Community

SCI Programming => SCI Syntax Help => Topic started by: sven on August 30, 2021, 03:21:48 PM

Title: Decompiled game is crashing
Post by: sven on August 30, 2021, 03:21:48 PM
I used sci companion to de-compile Space Quest 3. The code works fine except for when the game uses the "controls" object. Using it causes the game to crash. Does anyone know what is needed to make it work that maybe the de-compiler forgot to do? Below is an example of a line that makes the game crash from rm017.sc:

(controls
      add: engine navBut TLBut cruiseBut LSpeedBut ASpeedBut radarBut weaponBut
      eachElementDo: #init
      draw:
)

This code gets executed when you look at the screen in the aluminum mallard space ship.

I'm not that great with coding, so please forgive me.
Title: Re: Decompiled game is crashing
Post by: EricOakford on August 30, 2021, 07:49:21 PM
I used sci companion to de-compile Space Quest 3. The code works fine except for when the game uses the "controls" object. Using it causes the game to crash. Does anyone know what is needed to make it work that maybe the de-compiler forgot to do? Below is an example of a line that makes the game crash from rm017.sc:

(controls
      add: engine navBut TLBut cruiseBut LSpeedBut ASpeedBut radarBut weaponBut
      eachElementDo: #init
      draw:
)

This code gets executed when you look at the screen in the aluminum mallard space ship.

I'm not that great with coding, so please forgive me.

That could be because in GAME.SC, the controls object is actually called roomControls, but the original name was lost in compilation and replaced with the name "controls". This causes name conflicts with Room's controls property. So you'd have to rename the controls object into roomControls, and change Room's init: line
Code: [Select]
(= controls controls) into
Code: [Select]
(= controls roomControls).

I actually have already done the hard work of a full decompilation of SQ3, available here (https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/sq3).
Title: Re: Decompiled game is crashing
Post by: sven on August 30, 2021, 09:38:19 PM
I actually have already done the hard work of a full decompilation of SQ3, available here (https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/sq3).

I downloaded your de-compiled source code for sq3, but I'm having trouble getting it to compile, I get like 1000 errors for things that should be working just fine. Here is what I'm doing...

First I grabbed a mint copy of sq3
Second I copied your "src" folder and your game.ini into the sq3 folder
Third I used Sci Companion to open the game and I hit compile all...

Then it says that every single line of code is bad  :P
 
Title: Re: Decompiled game is crashing
Post by: Collector on August 30, 2021, 10:24:00 PM
Do you have a different game version?
Title: Re: Decompiled game is crashing
Post by: sven on August 30, 2021, 11:06:44 PM
Do you have a different game version?

Space Quest ]I[
Version: 1.0 P
Inter.: 0.000.453
Date: 3-22-89

this is what is says in my QAFiLE, I'm not sure how to tell what the source code version is though
Title: Re: Decompiled game is crashing
Post by: OmerMor on August 31, 2021, 01:15:55 PM
Do you have a different game version?

Space Quest ]I[
Version: 1.0 P
Inter.: 0.000.453
Date: 3-22-89

this is what is says in my QAFiLE, I'm not sure how to tell what the source code version is though

It says so in the readme.txt file (https://github.com/EricOakford/SCI-Decompilation-Archive/blob/master/sq3/readme.txt):
Code: [Select]
### Space Quest III (SQ3)
  Game version 1.018
  Interpreter version 0.000.685

  Tested to completion with no known issues.