Opened 6 years ago

Closed 6 years ago

#10777 closed defect (fixed)

QFG4: Crash when gliding across the swamp on return trip

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

Description

ScummVM 2.1.0git3797-ge7d23d2cd9 (Oct 25 2018 04:17:12)
Windows 7 64bit
QFG4 CD (English)

Casting glide works on the swamp, for the most part. However during the return trip, one screen short of escape, the game crashes when exiting east (approaching the wisp area).

"ERROR: Invalid arithmetic operation (require signed number - params: 0015:041c and 0000:0000) from method Grooper::doit (room 535, script 64977, localCall ffffffff)!"

Workaround: Click HAND on the rightmost hill, to land there. Then WALK to the next screen, and cast glide again.

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

Attachments (2)

sci.056 (64.5 KB ) - added by Vhati 6 years ago.
SavedGame (CD) - Swamp glide east
sci.057 (52.0 KB ) - added by Vhati 6 years ago.
SavedGame (Floppy) - Swamp glide east

Download all attachments as: .zip

Change History (8)

by Vhati, 6 years ago

Attachment: sci.056 added

SavedGame (CD) - Swamp glide east

comment:1 by Vhati, 6 years ago

Occurs in the floppy edition under ScummVM, too.

Slightly different message (first param).

"ERROR: Invalid arithmetic operation (require signed number - params: 0015:0404 and 0000:0000) from method Grooper::doit (room 535, script 64977, localCall ffffffff)!"


ScummVM 2.1.0git3797-ge7d23d2cd9 (Oct 25 2018 04:17:12)
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

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

by Vhati, 6 years ago

Attachment: sci.057 added

SavedGame (Floppy) - Swamp glide east

comment:2 by Vhati, 6 years ago

Summary: QFG4: Gliding across the swamp crashes on return tripQFG4: Crash when gliding across the swamp on return trip

comment:3 by Vhati, 6 years ago

Digging into the CD edition...
This is an problem setting up room 535, when entering from room 541.

Script 535: sFromWest::changeState(0) does this.

	(hero
		x: -5
		y: 129
		init:
		normalize:
		setLoop: -1
		setLoop: Grooper
		setCycle: Walk
		view: 5
		setMotion: PolyPath 10 129 self
	)

backtrace breadcrumbs.

Script 64998: hero::setHeading(0000:005a)  // 90d
Script 28: stopGroop::doit(hero, 0000:005a, 0000:0000)
  # That punts to a superclass Grooper::doit(...)
Script 64977: Grooper::doit(...)

We wind up in Grooper::doit()'s else branch below (client is hero).

(= temp0
	(if
		(and
			(== (client loop?) (- (NumLoops client) 1))
			((client cycler?) isKindOf: StopWalk)
			(== ((client cycler?) vStopped?) -1)
		)
		[local0 (client cel?)]
	else
		[local0 (client loop?)]
	)
)

local0 is an int array defined at the top of the script.

[local0 8] = [2 6 4 0 3 5 1 7]

This is taking a hero property, using its value as an array index, and assigning the lookup result in temp0.

Reminder: The error in the OP was "Invalid arithmetic operation (require signed number".

hero's "cel" property is 0.

hero's "loop" property is a Grooper object.

An object can't be used as an array index!

Indeed. In the previous room, hero's "loop" property is a fluctuating integer.


When I have a better understanding of Grooper's purpose, I can work on guessing what was intended.

Had it not exploded, doit() would've concluded with what amounts to
hero::setCycle( Grycler::init(hero, stopGroop (???), theLoopIndex) )

	(client
		cycler: 0
		mover: 0
		setMotion: 0
		setCycle: Grycler self temp0
	)



Wild speculation: hero has a setLooper() method. Maybe "setLoop: Grooper" was a typo? If so, they did it 4 times in that room.

*clickety-click*

"setLooper: Grooper" appears in scripts: 50, 51.
"setLooper: stopGroop" in script 28.
"setLooper: (ScriptID 28 1) 1" in script 320.
"looper: myLooper" in script 320. (another Grooper subclass)
Looper is rarely used at all. Definitely an object.

"setLoop: Grooper" appears in scripts: 440, 530, 535, 541, 542, 543, 545.
"setLoop: (ScriptID 28 1)" in script 10.
Loop is overwhelmingly an integer though.

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

comment:4 by Vhati, 6 years ago

Pull Request: SCI32: Fix QFG4 crash when gliding across swamp

comment:5 by digitall, 6 years ago

Keywords: has-pull-request added

comment:6 by bluegr, 6 years ago

Owner: set to bluegr
Resolution: fixed
Status: newclosed

Thanks for your work! Closing

Note: See TracTickets for help on using tickets.