Opened 9 months ago

Closed 7 months ago

#10605 closed defect (fixed)

ZVISION: ZGI: Stuck on the burning doll screen

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Engine: ZVision
Keywords: Cc:
Game: Zork Grand Inquisitor

Description

If you bring up the inventory screen after lighting the inquisitor doll on fire before anyone has yelled "Fire! Fire!", you will get stuck on that screen. This appears to be yet another script bug.

In pe.scr, there is the following:

puzzle:17159 {	# pe_fire_on_the_box
    criteria {
        [17160] = 1	# pe5e_fire_fire
    }
    results {
        action:assign(17160, 0)	# pe5e_fire_fire
        action:timer:17161(15)	# pe_fire
    }
}

puzzle:17162 {	# pe_fire_reset
    criteria {
        [17161] > 10	# pe_fire
    }
    results {
        action:add(17161, -10)	# pe_fire
        action:timer:17161([17161])	# pe_fire
        action:assign(17162, 0)	# pe_fire_reset
    }
    flags {
        once_per_inst
    }
}

puzzle:17163 {	# pe_play_alarm_vo
    criteria {
        [17161] = 2	# pe_fire
    }
    results {
        action:assign(17161, 0)	# pe_fire
        action:crossfade(01011 01012 -1 0 55 0 500)	# NULL
        action:kill(01011)	# voice_over
        action:assign(01013, 16)	# person_talking
        action:universe_music:01011(0 pe5eh03p.raw 0 [17155])	# pe_guard_current_volume
    }
}

So the timer starts at 15, and as long as it's > 10 it will count down by 10. When it times out, it's automagically set to 2, which triggers the "Fire! Fire!" sound.

But if the time is killed prematurely, it will write the remaining time into the state value, like this:

TimerNode::~TimerNode() {
	if (_key != StateKey_NotSet)
		_engine->getScriptManager()->setStateValue(_key, 2);
	int32 timeLeft = _timeLeft / (_engine->getGameId() == GID_NEMESIS ? 1000 : 100);
	if (timeLeft > 0)
		_engine->getScriptManager()->setStateValue(_key, timeLeft); // If timer was stopped by stop or kill
}

So if the timer is killed while the remaining time is less than 10, the timer will stop counting down.

Attachments (1)

zgi-win.003 (16.2 KB) - added by eriktorbjorn 9 months ago.
Savegame before lighting the doll on fire.

Download all attachments as: .zip

Change History (5)

Changed 9 months ago by eriktorbjorn

Attachment: zgi-win.003 added

Savegame before lighting the doll on fire.

comment:1 Changed 9 months ago by eriktorbjorn

I'm not sure what the correct solution is, but assuming that the timer handling in general is correct I guess replacing the criteria for 17162 (pe_fire_reset) so that it counts down as long as the timer is > 0 (but not the magic value 2) things should be fine.

Perhaps the timer node should also never write 1 as remaining time, but rather set it to 2 in that case? If so, it should be enough to change the criteria to > 2.

comment:2 Changed 9 months ago by bonki

Component: --Unset--Engine: ZVision
Game: Zork Grand Inquisitor

comment:3 Changed 7 months ago by eriktorbjorn

My workaround [1] was accepted while I was on vacation, so this bug should be fixed now.

[1] https://github.com/scummvm/scummvm/pull/1236

comment:4 Changed 7 months ago by eriktorbjorn

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.