Opened 6 months ago

Closed 4 months ago

#10768 closed defect (fixed)

QFG4: Unlit torch appears lit, inventory leaks across restarts

Reported by: Vhati Owned by: bluegr
Priority: normal Component: Engine: SCI
Keywords: SCI32 original has-pull-request Cc:
Game: Quest for Glory 4

Description

ScummVM 2.1.0git3770-g15306581ab (Oct 18 2018 04:27:32)
Windows 7 64bit
QFG4 CD (English)

Starting out in the bone room after taking the torch... The torch icon already has its fire when it hasn't been lit yet. There's no glow around the hero, and the door won't open until you actually use the flint on it (with the dagger present). The torch apears pre-lit even if you never picked up the flint and dagger.

The original interpreter did not have this bug.

File - 5kb MD5 - Full MD5
RESOURCE.000 - 263dce4aa34c49d3ad29bec889007b1c - 1364ba69e3c0abb68cc0170650a56692
RESOURCE.AUD - c39521bffb1d8b19a57394866184a0ca - 71098b9e97e20c8941c0e4812d5f906f
RESOURCE.MAP - aba367f2102e81782d961b14fbe3d630 - 801a04cc6aa5d437681a2dd0b6545248
RESOURCE.SFX - 3cf95e09dab8b11d675e0537e18b499a - 7c858d7253f86dab4cc6066013c5ecec

Attachments (1)

sci.002 (53.1 KB) - added by Vhati 6 months ago.
SavedGame (CD) - Start

Download all attachments as: .zip

Change History (10)

Changed 6 months ago by Vhati

Attachment: sci.002 added

SavedGame (CD) - Start

comment:1 Changed 6 months ago by Vhati

The floppy edition under ScummVM did not have this bug.

ScummVM 2.1.0git3770-g15306581ab (Oct 18 2018 04:27:32)
Windows 7 64bit
QFG4 Floppy 1.1a + note patch (English)

File - 5kb MD5 - Full MD5
RESOURCE.000 - f64fd6aa3977939a86ff30783dd677e1 - ff42260a665995a85aeb277ad80aac8a
RESOURCE.MAP - d10a4cc177d2091d744e2ad8c049b0ae - 3695b1b0a1d15f3d324ea9f0cc325245
RESOURCE.SFX - 3cf95e09dab8b11d675e0537e18b499a - 7c858d7253f86dab4cc6066013c5ecec

comment:2 Changed 6 months ago by Vhati

Huh. I saw this in the Floppy edition under ScummVM. However, despite restarting several times, I couldn't reproduce it.

Last edited 6 months ago by Vhati (previous) (diff)

comment:3 Changed 6 months ago by Vhati

Got it! A variable isn't getting reset between playthroughs.

  • Restore a savegame in which you *do* have a lit torch. (Practically every savegame qualifies)
  • In the control panel, click "Restart". Create a new character.
  • Take the torch. It will already have the lit icon.

I have reproduced this in both the CD and floppy editions and their original interpreters.

comment:4 Changed 6 months ago by Vhati

Keywords: original added

comment:5 Changed 5 months ago by Vhati

Several variables aren't getting reset, in fact.


script 0 - Glory::restart() takes care of some attributes of each item...

		(= temp0 0)
		(while (< temp0 57)
			((gQGInv at: temp0)
				owner: 0
				state: 0
				amount: 0
				maskView: 0
				maskLoop: 0
				maskCel: 0
			)
			(++ temp0)
		)

Interactive items sometimes change their "loop"/"cel". Each item has a constant "mainLoop"/"mainCel" attribute for the default. That could be copied during a restart. Or maybe those volatile attributes can be turned into "maskLoop"/"maskCel", and the existing code will reset them.

Items also have a "value" (weight) that grows when combined with other items. This weight will continue to grow with each restart and further combination. There is no default for "value", so each item would need its own hardcoded reset. Luckily, there are only two such items.

  • thePiepan (script 16)
    • value, loop, cel
  • theTorch (script 35)
    • cel
  • theBroom (script 35)
    • value, cel

Some items dynamically decide "loop"/"cel" based on "state" - which IS reset - in a custom show() method, so they're fine.

Last edited 5 months ago by Vhati (previous) (diff)

comment:6 Changed 5 months ago by Vhati

Summary: QFG4: Torch appears lit when it isn'tQFG4: Unlit torch appears lit, inventory leaks across restarts

comment:7 Changed 5 months ago by Vhati

script 0 - restart()

(method (restart &tmp temp0 temp1 temp2)
	(if (and (not argc) (not (proc91_0 0 0 0 37 1)))
		(return)
	)
	(= global37 0)
	(g103_longSong stop:)
	(g199_longSong2 stop:)
	(g403_longSong3 stop:)
	(= g11_myCurrentRoomNum 100)
	(statusCode doit: 100)
	(UpdatePlane
		((g2_myCurrentRoom plane?) back: 0 picture: -1 yourself:)
	)
	(if (g84_talkers size:) (g91_gloryMessager cue: 1))
	(PalCycle 4)
	(RemapColors 0)
	(g32_features eachElementDo: #dispose release:)
	(g5_cast eachElementDo: #dispose)
	(g7_timers eachElementDo: #delete)
	(g78_theDoits release:)
	(g2_myCurrentRoom dispose:)
	(FrameOut)
# glorySpells
	(= temp1 (ScriptID 21 0))
	(= temp0 0)
	(while (< temp0 22)
		((temp1 at: temp0) owner: 0)
		(++ temp0)
	)
	(= temp0 0)
	(while (< temp0 57)
		((g9_gloryInv at: temp0)
			owner: 0
			state: 0
			amount: 0
			maskView: 0
			maskLoop: 0
			maskCel: 0
		)
		(++ temp0)
	)
	(if
	(not (& ((= temp2 (ScriptID 36 1)) signal?) $0008))
		(temp2 hide:)
	)
	(g69_mainIconBar curIcon: (g69_mainIconBar at: 1))
	(g69_mainIconBar advanceCurIcon:)
	(global157 dispose:)
	(= temp0 100)
	(while (< temp0 699)
		(= [global0 temp0] 0)
		(++ temp0)
	)
	(= global101 1234)
	(= g122_myNthDay 1)
	(= global134 20)
	(= global135 15)
	(= global138 9)
	(= global139 12)
	(= [global144 0] 180)
	(= [global144 1] 0)
	(= [global144 2] 45)
	(= [global144 3] 90)
	(= [global144 4] 135)
	(= [global144 5] 180)
	(= [global144 6] 225)
	(= [global144 6] 270) # Typo
	(= [global144 6] 315) # Typo
	(= global198 20)
	(= global367 2)
	(= global368 2)
	(= global369 3)
	(= global370 3)
	(= global371 3)
	(= global372 4)
	(= global373 5)
	(= global374 5)
	(= global375 6)
	(= global376 7)
	(= global377 8)
	(= global378 8)
	(= global379 5)
	(= global380 10)
	(= global381 15)
	(= global382 20)
	(= global383 6)
	(= global384 8)
	(= global385 7)
	(= global386 10)
	(= global387 10)
	(= global420 100)
	(= global422 150)
	(= global439 2)
	(= global460 1)
	(= global450 8)
	(= global433 6)
	(= global466 400)
	(= global157 (Str new: 40))
	((= g103_longSong longSong) owner: self flags: 1)
	((= g199_longSong2 longSong2) owner: self flags: 1)
	((= g403_longSong3 longSong3) owner: self flags: 1)
	(= g2_myCurrentRoom 0)
	((ScriptID 1) init:)
	(DisposeScript 1)
	(g0_hero get: 0)
)
Last edited 5 months ago by Vhati (previous) (diff)

comment:8 Changed 5 months ago by Vhati

Keywords: has-pull-request added

Pull Request: SCI32: Fix QFG4 inventory leaks across restarts

comment:9 Changed 4 months ago by bluegr

Owner: set to bluegr
Resolution: fixed
Status: newclosed

Thanks for your work! The pull request has been merged, so this can be closed now

Note: See TracTickets for help on using tickets.