Doubts about Scumm VM

Coordinator
Dec 3, 2012 at 1:31 AM

So, just starting the topic, one thing I don't really get is the script types. Could it be something like "Room"or "Object"? It seems some of the script types go to infinite loops, while some others don't.

Coordinator
Dec 4, 2012 at 10:45 PM

So, one thing I realized right now is that script status is actually a byte, where each bit is a flag. For example, bit 7 determines whether the script is frozen - I'm not sure yet what's the difference in behavior from frozen to paused, but for one thing, frozen scripts should not be executed by RunActiveScripts(). I'm taking a look at that right now.

Coordinator
Dec 10, 2012 at 1:38 AM

DOUBT: WHERE IN THE OBJECT DATA ARE THE IMAGES USED FOR THE INVENTORY? I CAN ONLY SEE THE IMAGES USED ON THE ROOMS.

Coordinator
Dec 10, 2012 at 12:38 PM
Edited Dec 10, 2012 at 12:41 PM

Yes it is really stange because if I look into the code you commited, you load the IM01 bitmap of the object to display it.

If you look in the verb.cpp file of scummVM. They have a "DrawVerb" function that call the following function (I didn't found in the verb.cpp file a function like the one used by scummV2 "redrawV2Inventory" so I suppose that an object in the inventory is a verb?):

 

 imptr = getObjectImage(obim, 1);

 The GetObjectImage function is declared in the object.cpp file and use this line to use the correct block name:

ptr = findResource(IMxx_tags[state], ptr);

 And when I look at the declaration of IMxx_tags, we see that the state 1 equals IM01:

 

 

 static const uint32 IMxx_tags[] = {

 

MKTAG('I','M','0','0'),

MKTAG('I','M','0','1'),

MKTAG('I','M','0','2'),

MKTAG('I','M','0','3'),

MKTAG('I','M','0','4'),

MKTAG('I','M','0','5'),

MKTAG('I','M','0','6'),

MKTAG('I','M','0','7'),

MKTAG('I','M','0','8'),

MKTAG('I','M','0','9'),

MKTAG('I','M','0','A'),

MKTAG('I','M','0','B'),

MKTAG('I','M','0','C'),

MKTAG('I','M','0','D'),

MKTAG('I','M','0','E'),

MKTAG('I','M','0','F'),

MKTAG('I','M','1','0')

};

 Maybe that some object bitmaps are the same that the one used ingame?

Coordinator
Dec 10, 2012 at 4:22 PM

The thing that was most surprising is that there is a numberOfImages which is equal to 1, on the object "sword", for example. I'll check this part of the code on Scumm VM.

Coordinator
Dec 11, 2012 at 1:03 AM

I found that out - these images are in room 99, and there is one opcode that assigns objects to verbs (OpVerbCommand, case 22). When that is called, the verb receives the image of the object. I'm not sure if this is the best way to do that.

There's still something wrong in the image loading - when loading some objects, it might get lost by reading one byte too much (and then never really finding the blocks again). I've added some hacks (like if (objectsCount == 90) objectsCount -= 7;)  just to keep it working for the time being, just so you know.