AlbanBedel / scummc

A Scumm Compiler
GNU General Public License v2.0
129 stars 19 forks source link

drawObject/drawObjectAt do not redraw inventory items or mouse cursor #14

Open markusbkk opened 2 months ago

markusbkk commented 2 months ago

I know this project is essentially abandoned but maybe somebody stumbles upon this and can either help with a fix or at least find some use in the information provided here.

During the latest work on my fork I set up a small example that introduces the user to a Sam & Max Hit the Road-like GUI where the right mouse button is used to switch actions and the left mouse button is used to perform said action.

Unfortunately, I quickly realized that

setObjectState( cursor, 2 );
drawObject(cursor, 2);

doesn't actually redraw the cursor. The object's internal state is updated but there's no redraw event taking place.

Looking at the ScummVM debugger, I then found out that the redraw event is apparently only executed for objects in the main room.

Opening up the Open Quest example and adding setObjectState(loadFlObject(objA,InventoryItems), 2); to the scanner object's open case actually confirmed this suspicion. The object gets added to the main room and henceforth reacts to state changes. Unfortunately, that's not very helpful because there's now two instances and one of it is drawn in the top left corner of the screen, far outside the inventory GUI.

markusbkk commented 2 months ago

Been discussing this with a few SCUMM Lords on Discord.

Interestingly, it appears Lucas Arts themselves didn't use object states for inventory items. At least not in Sam & Max, where they used three separate items for something that could've easily been made into one (unless, for some reason, this never worked even in the original LEC interpreters) .

image image image

I'm gonna run through DOTT later today and descumm the part with the frozen hamster. If it turns out they used separate objects for that too, there's a very high chance this is a 31 year old bug that ScummVM inherited and even the original designers worked around.