[Scummvm-tracker] [ScummVM] #10777: QFG4: Crash when gliding across the swamp on return trip

Vhati trac at scummvm.org
Thu Nov 8 22:30:29 CET 2018


#10777: QFG4: Crash when gliding across the swamp on return trip
--------------------------------+-------------------------
  Reporter:  Vhati              |      Owner:  (none)
      Type:  defect             |     Status:  new
  Priority:  high               |  Component:  Engine: SCI
Resolution:                     |   Keywords:  SCI32
      Game:  Quest for Glory 4  |
--------------------------------+-------------------------

Comment (by Vhati):

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

 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! '''

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

 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.

--
Ticket URL: <https://bugs.scummvm.org/ticket/10777#comment:3>
ScummVM <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list