Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3205 closed defect (fixed)

WEEN: Long delay in the intro

Reported by: eriktorbjorn Owned by: DrMcCoy
Priority: low Component: Engine: Gob
Keywords: script Cc:
Game: Ween

Description

Latest ScummVM SVN snapshot
English version of the game

Near the end of the intro, we are shown a view looking in through the window of the house. This image should only be shown for a few seconds at most, but ScummVM shows it a lot longer than that.

The reason for this seems to be the code in o1_keyFunc() that adds a delay to keep the engine from hogging the CPU in busy-waiting scripts.

DrMcCoy already knows about this - I have spoke to him about it before - but I'm filing this bug report so that it won't be forgotten.

Ticket imported from: #1726130. Ticket imported from: bugs/3205.

Change History (5)

comment:1 Changed 12 years ago by DrMcCoy

Owner: set to DrMcCoy
Priority: normallow

comment:2 Changed 12 years ago by DrMcCoy

Yes, the script basically does

VAR_59 = 0;
do {
o1_keyFunc(1);
VAR_59++;
} until ((VAR_59 == 5000) || (VAR_0 == 27));

. I don't know how to deal with it right now and since you can just abort that screen by pressing ESC (o1_keyfunc(1) stores the pressed key into VAR_0), I don't view it as that critical either (it /is/ annoying, though).

comment:3 Changed 12 years ago by fingolfin

So do I understand it right that the problem is that one of the game scripts does a "busy wait", by counting till 5000, and that this causes problems because the "wait" function is "slower" in ScummVM than the original to avoid CPU hogging?

If so, I would view it as follows: This is a portability bug in the original game scripts, and example of bad coding. Just add a workaround for it: "if game == Ween and scriptId == XYZ and VAR_59 < 4000 then VAR_59 = 4000;" Or so. Mark this with a big "WORKAROUND" comment. It's not nice, but since you are not doing anything *conceptually* wrong, I don't think it's worth waiting for a "better" solution to magically pop up. WEll, and even if it does, you can still easily remove that workaround again later :).

comment:4 Changed 12 years ago by DrMcCoy

Okay, added the workaround. Closing it as fixed then.

comment:5 Changed 12 years ago by DrMcCoy

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.