Parallel walk and talk scripts in Scumm

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
g99k
Posts: 10
Joined: Sun Aug 13, 2006 6:09 pm

Parallel walk and talk scripts in Scumm

Post by g99k »

Can someone help me with Scumm scripts?

I am trying to script a Scumm game in ScummC, but I am having troubles organizing 2 parallel scripts that both manipulate the ego actor's animation. :( In detail, the problem is as follows:
  1. If the ego actor is talking, and the user then issues a new walk command, the actor starts walking with the talking script still running.
  2. Once the talking script ends, it forces the actor into a standing hold, overriding the walk animation.
  3. The walk script, however, still moves the actor across the room, now without a walk animation, making it look like he's sliding.
I could kill the talk script as soon as the actor walks, or wait for the talking script to end before allowing any new commands, but I think this is not how the original Scumm games work.

It is even more evident with 2-sentence-responses: try to make Bernard look at his textbook, or Guybrush at the Woodtick sign, and then start walking. They will say the second sentence while walking, but without breaking the walk animation.

Does anyone know how this is scripted? :?

I browsed the original scripts, but couldn't find any answer in the VERB or SENTENCE scripts that start the responses to interaction. If anyone could point me to a specific location in the code, it would help too.

Thanks in advance!
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

DOTT and MI2 use quite different versions of SCUMM (v5 vs. v6), but as for the example in Woodtick:

Object script 7-46 issues a simple printEgo() command for Guybrush, while the verb script (which is all SCUMM games the global script 4) uses walkActorTo(VAR_EGO,x, y) to walk the actor. So nothing fancy is being done.

If you tell us which commands exactly your scripts issue, maybe we can say more.
g99k
Posts: 10
Joined: Sun Aug 13, 2006 6:09 pm

Post by g99k »

I still couldn't find out anything. :? Thanks a lot for your reply, anyway!

In the ScummC scripts again, nothing fancy is being done. The walk and talk scripts look like this:

Code: Select all

walkActorTo(VAR_EGO,VAR_VIRT_MOUSE_X,VAR_VIRT_MOUSE_Y);
waitForActor(VAR_EGO);
...

egoSay("That doesn't seem to work.");
waitForMessage();
...
That's why I'm so surprised that the talk anim yields nicely to a running walk script in the original LEC games, while the same (?) talk anim messes up the walk in the ScummC game. I suspect that it has do to either with a clever setup of the costume, or the handler scripts, or both.

I couldn't get anything out of the costumes or scripts so far, so I'd like to insert a bit of debugging code into ScummVM, to check exactly when and what kind of talkStart and talkStop anims are run by the engine.

Where would be a good place for that? ScummEngine::actorTalk() in actor.cpp most probably?
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

Small side note: be careful about the terms "walk script" and "talk script". These have a special fixed meaning in newer SCUMM versions, which do not match what you have in mind... ;). Nevertheless, your meaning is clear, I just wanted to point out this tidbit ;).

Anyway, what costume data are you using? Your own, or costume data copied from an existing LucasArts game? It might indeed be a problem with your costume data which cause what you are seeing. Also, you may have to setup the actor/costume data correctly, of course (by setting the costume, calling animateCostume, etc.).

But if that is the case, it should not occur with "original" game data, of course. To test the whole thing, though, I would try to insert fake scripts into one of the original games, or to copy costume data from one of the LEC game into your custom game.

I would have to look more closely into this to say more, but right now I simply lack the time.
g99k
Posts: 10
Joined: Sun Aug 13, 2006 6:09 pm

Post by g99k »

Half of the puzzle is solved: in a two-sentence response, the talkStart anim is only started once when running the original games. I don't know why, though. :?

It could be a different scripting of the wait calls. In the ScummC code, the two sentences were scripted as two separate actorTalk() calls with one waitForActor() between them. In the dumped scripts for the original games, the two sentences are combined into one with a :wait: separator. Is that a special character in the string, or just a shortcut for the dump output?

As for the talkStop anim, I don't know. Even in the original games, runActorTalkScript() can get called with talkStopFrame 5 during a walk, and _frame really gets set to that number in startAnimActor(). However, here it doesn't have any visible effect, while in the ScummC game the talkStop anim is played for the rest of the walk, instead of the walk anim.

A _talkScript (the one with the special meaning) doesn't seem to exist in either game.

I'd add more debugging statements to ScummVM, but I have no idea where I could look next. The costume data is not copied from an existing game, anyway. I might try to insert the original costumes into the ScummC game and vice versa, as you suggested, but I've never messed with the compiled binaries before. What are the right tools for that job?
Post Reply