Opened 6 years ago

Closed 6 years ago

#10829 closed defect (fixed)

QFG4: Iron safe room, door to the east sends hero west

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

Description

Windows 7 64bit
QFG4 CD (English)

The iron safe room can get into a state where the righthand door denies passage to the east, consistently sending hero west instead.

This is convoluted, so I'll explain in a comment to allow editing.

The original interpreter also does this.

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

Change History (6)

comment:1 by Vhati, 6 years ago

Quick and dirty way to reproduce...

  • Create a non-rogue character.
    • (Castle doors require rogues to pick them, which is different from opening.)
  • Get the oil.
    • send hero get 15.
  • Teleport to the empty stairway (east of the safe).
    • room 624
  • Oil the empty stairway's lower door, and open it to enter the safe room (from the right).
  • Open the safe room's left door, to enter the haunted stairway (west of the safe).
  • Turn back and open the haunted stairway's upper door, to enter the safe room (from the left).
  • Open the safe room's right door. It will send hero west, not east.

Another way...

  • Create a non-rogue character.
  • Get the oil.
    • send hero get 15.
  • Teleport to the safe room.
    • room 643
  • Oil the safe room's left door. Yes, oil the LEFT door.
  • Open the safe room's left door, to enter the haunted stairway (west of the safe).
  • Turn back and open the haunted stairway's upper door, to enter the safe room (from the left).
  • Open the safe room's right door. It will send hero west, not east.

comment:2 by Vhati, 6 years ago

Occurs in the floppy edition under ScummVM, and its original interpreter, too.


ScummVM 2.1.0git3990-ge0307e9 (Dec 6, 2018 14:26:10)
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:3 by Vhati, 6 years ago

The safe room uses local2 to remember which door it last decided hero was closer to.


script 643 - sOpenTheDoor::changeState()

(0
	(g1_glory handsOff:)
	(doorSound play:)
	(if (< (g0_hero x?) 160)
		(= local2 1)
		(if (not (proc0_4 214)) # test plot flag for oiled left door
			# The door hinges squeak in protest as you open the door.
			(g91_gloryMessager say: 1 4 3 1 0 640)
			(squeakSound play:)
		)
		(pLeftDoor setCycle: End self)
	else
		# local2 is inside the if!?
		(if (not (proc0_4 215)) # test plot flag for oiled right door
			(= local2 0)
			# The door hinges squeak in protest as you open the door.
			(g91_gloryMessager say: 1 4 3 1 0 640)
			(squeakSound play:)
		)
		(pRightDoor setCycle: End self)
	)
)
# ...
(2
	(if local2
		(g2_myCurrentRoom newRoom: 625)
	else
		(g2_myCurrentRoom newRoom: 624)
	)
)

The right side isn't reliably setting local2.


That means if the right door *is* oiled, local2 was last set by init() depending on the previous room number.


script 643 - rm643::init()

(switch g12_myPrevRoomNum
	(625
		(= local2 1)
		(= local0 55)
		(= local1 164)
		(g0_hero posn: 9 130)
	)
	(else 
		(= local0 257)
		(= local1 166)
		(g0_hero posn: 288 146)
	)

Thus if hero enters from the left (setting local2 = 1) and opens the righthand door, with flag 215, hero is sent west to the haunted stairway (265), not east to the empty stairway (624).


To add more confusion...

  • The west room sets flag 214 to oil the left door.
  • The east room sets flag 215 to oil the right door.
  • Within the the safe room, both doors' doVerb(oil) methods swapped the flags!
    • The left door (vLeftDoor) sets 215, right door (vBackDoor) sets 214.
Last edited 6 years ago by Vhati (previous) (diff)

comment:4 by Vhati, 6 years ago

Keywords: has-pull-request added

Pull Request: SCI32: Fix QFG4 iron safe room doors

comment:5 by Vhati, 6 years ago

Within the the safe room, both doors' doVerb(oil) methods swapped the flags!

I can confirm that bug is unique.

I mapped out every castle room's setting of oil flags, in the CD edition. All the other rooms agree with their neighbors.

  * 114: great hall (630), east        ; eavesdrop stair (627), upper
  * 118: EXIT bookshelf (661), east    ; goon stair (629), upper
  * 207: great hall (630), north       ; haunted stair (625), lower
  * 208: candle bookshelf (662), north ; eavesdrop stair (627), lower
  * 209: candle bookshelf (662), east  ; room 631, west
  * 210: room 631, east                ; room 644, west
  * 211: room 644, east                ; bat stairs (632), lower
  * 212: crest bookshelf (663), east   ; bat stairs (632), upper
  * 213: wraith bed (641), east        ; barrel (623), west
  * 214: safe (643), west              ; haunted stair (625), upper
  * 215: safe (643), east              ; an empty stair (624), lower
  * 216: room 642, north               ; an empty stair (624), upper
  * 217: room 622, east                ; room 642, west
  * 218: room 642, east                ; hallway (626), west
  * 219: room 640, east                ; room 622, west
  * 220: room 640, west                ; Tanya stair (620), lower
  * 221: room 640, north               ; an empty stair (621), upper
  * 222: Tanya stair (621), upper      ; {Tanya's bedroom doesn't care about oil.}
  * 223: pink bed (660), north         ; an empty stair (621), lower
  * 224: EXIT bookshelf (661), west    ; {hallway has no north door}
  * 225: barrel (623), east            ; {great hall has no west door}

Floppy edition is the same.

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

comment:6 by bluegr, 6 years ago

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.