Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"For" statements do not compile correctly #23

Open
EricOakford opened this issue Sep 29, 2019 · 1 comment
Open

"For" statements do not compile correctly #23

EricOakford opened this issue Sep 29, 2019 · 1 comment

Comments

@EricOakford
Copy link

In the original SCI16 source, there are cases of "for" statements being used. In some of these cases, compiling causes bugs when the code is run.

For example, here is some code from QSOUND.SC from my QFG2 demo decompile, in the check: method of QueuedSound:

;EO: In the SCI16 QSOUND.SC, the original code messed up the dance scene. ;So the code being used is from the decompiled script. ;This is likely a compiler issue with "for" statements. ;;; (if (IsObject client) ;;; (for ;;; ( (= cues (- theSignal (or prevSignal 127))) ;;; ) ;;; cues ;;; ( (-- cues) ;;; ) ;;; ;;; ;;loop body ;;; ;;--------- ;;; (client cue: self) ;;; ) ;;; ) ;Here is the decompiled code (if (IsObject client) (= cues (- theSignal (if prevSignal else 127))) (while cues (client cue: self) (-- cues) ) ) (= prevSignal theSignal) )

A similar example of original code not compiling correctly is from DPATH.SC, from the same decompile:

(method (init theClient thePoints &tmp i) (= points (if points else (List new:))) ;EO: The following line of code causes a "Not an Object: $1" error in room 7 ; (= points (or points (List new:))) ;create only once

@OmerMor
Copy link
Contributor

OmerMor commented Oct 28, 2019

Here are the above snippets, formatted correctly:

         ;EO: In the SCI16 QSOUND.SC, the original code messed up the dance scene.
         ;So the code being used is from the decompiled script.
;;;         (if (IsObject client)
;;;            (for
;;;               (  (= cues (- theSignal (or prevSignal 127)))
;;;               )
;;;               cues
;;;               (  (-- cues)
;;;               )
;;;
;;;               ;;loop body
;;;               ;;---------
;;;               (client cue: self)
;;;            )
;;;         )
         ;Here is the decompiled code
         (if (IsObject client)
            (= cues (- theSignal (if prevSignal else 127)))
            (while cues
               (client cue: self)
               (-- cues)
            )
         )
         (= prevSignal theSignal)
      )
   (method (init theClient thePoints &tmp i)
      (= points (if points else (List new:)))
      ;EO: The following line of code causes a "Not an Object: $1" error in room 7
;     (= points (or points (List new:)))  ;create only once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants