[Scummvm-devel] setCursorFromImg and findObjectInRoom with v6

Alban Bedel albeu at free.fr
Tue Jun 7 12:56:19 CEST 2005


Hi everybody,

I'm writing a compiler for scumm v6, still pretty experimental but it can
build simple games. However i stepped on something that i believe is a pb
in scummvm. It showup when i try to setup a cursor image and i traced it
down to the findObjectInRoom function. Here is the start of it:

void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id,
 uint room) {
	// some cuhhed out declarations
        if (findWhat & foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
                if (_features & GF_OLD_BUNDLE) {
                        // some stuff we don't care about in this case
                }
                fo->obcd = obcdptr = getOBCDFromObject(id);
                assert(obcdptr);
                fo->obim = obimptr = obcdptr + READ_BE_UINT32(obcdptr + 4);
                fo->cdhd = (const CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
                fo->imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
                return;
        }


The problem is as follow: setCursorFromImg will call findObjectInRoom
with the foCheckAlreadyLoaded flag set, and in my case the cursor
image is already loaded (as the game have only one room).
However the code found inside the if make no sense with v6 data afaict.
It seems to assume that OBIM is right after OBCD which i never saw in
the dott data files.

In the case of dott (and probably most other games) the cursor is in
a ressource room or the like, so in the above condition getObjectIndex(id)
fail anyway. Apparently setCursorFromImg is the only place where
findObjectInRoom is called with foCheckAlreadyLoaded set. so i tried to
simply add _version < 6 to the above test and everything work fine.

To me it seems this code was meant only for some other version of scumm.
Could somebody with more knowledge of scumm (and the other versions)
comments on this. Thanks in advance.

	Albeu

PS: If some are intersted to see the compiler itself check
    http://alban.dotsec.net/Projects/ScummC.





More information about the Scummvm-devel mailing list