Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#3534 closed defect (fixed)

AGI: show.obj priority error

Reported by: SF/agibugs Owned by: SF/buddha_
Priority: normal Component: Engine: AGI
Version: Keywords:
Cc: Game: AGI Fanmade

Description

Version: ScummVM 0.10.0 (Jun 17 2007 18:01:36) OS: Mac OS X 10.4 Engine: AGI Games affected: all AGI games

There seems to be an occasional graphics glitch when inventory items are displayed with show.obj or show.obj.v. Items should be shown in front of all sprites and background objects but sometimes the item appears behind them.

Apparently the problem is related to the width of the view (sprite) depicting the inventory item. The issue probably exists in all games where the horizontal size of an item is <15px.

To reproduce in the fanmade game "AGI Quest": - start game - activate debug mode - type "gimme gimme" to get all inventory items - walk two screens east to the waterfall screen - type "look bottle" - bottom part of item is obscured by rock (error)

I'm unfamiliar with the code but I would guess that the problem is in /scummvm/trunk/engines/agi/sprite.cpp at SpritesMgr::showObj at the following line:

blitCel(x1, y1, s.xSize, c, _vm->_game.views[n].agi256_2);

Looks like the third argument sets the priority which here depends on the width (xSize) of the view. Perhaps s.xSize should be replaced with the value 15?

Ticket imported from: #1858037. Ticket imported from: bugs/3534.

Change History (4)

comment:1 by SF/buddha_, 16 years ago

Owner: set to SF/buddha_

comment:2 by SF/buddha_, 16 years ago

Looking at Sarien's source code at http://sarien.cvs.sourceforge.net/sarien/sarien/src/core/sprite.c?view=log I found that that the third parameter to blitCel was changed from 15 to s.xSize in revision 1.20. You can see the diff at http://sarien.cvs.sourceforge.net/sarien/sarien/src/core/sprite.c?r1=1.19&r2=1.20

Looking at NAGI's source code in src/obj_show.c it looks like NAGI uses priority 15 for showing the objects.

I also took a look at PC AGI 2.917's disassembled code from http://www.agidev.com/projects/nagi/dev.php and by comparing it with NAGI's source code I'd think it uses priority 15 for showing objects too (The disassembly didn't have all the names so this is bit of a guess to be honest). The part I'm referring to here is in Agi2917.idb's subShowObj:

cseg:5EA1 mov byte ptr [bp-0Bh], 0Fh cseg:5EA5 or word ptr [bp-0Ah], 4 cseg:5EAA mov byte ptr [bp-2Dh], 0FFh

I think the first line sets the priority to 15, the second handles some priority related flag and the last line sets view number to 0xFF. This is a guess based on looking at NAGI's source code as it has the following code in it:

In src/obj_show.c in 'void obj_show(u16 view_num)':

obj_view.priority = 0xF; obj_view.flags = obj_view.flags | O_PRIFIXED; obj_view.num = 0xFF;

where O_PRIFIXED has the value of 4.

So based on these observations I will submit a fix to this bug that will change the s.xSize to 15 hoping that it won't break anything that worked already.

comment:3 by SF/buddha_, 16 years ago

Resolution: fixed
Status: newclosed

comment:4 by SF/buddha_, 16 years ago

Revision 29984 fixed this bug and you can see the diff at http://scummvm.svn.sourceforge.net/viewvc/scummvm/scummvm/trunk/engines/agi/sprite.cpp?r1=29854&r2=29984

Note: See TracTickets for help on using tickets.