Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on December 10, 2018, 09:10:10 PM

Title: Importing a Character (a la Quest for Glory)
Post by: Doan Sephim on December 10, 2018, 09:10:10 PM
How'd they do this? I assume it saved a file that contains values for certain variables, but what how would one accomplish actually importing this into another program?
Title: Re: Importing a Character (a la Quest for Glory)
Post by: MusicallyInspired on December 11, 2018, 09:16:56 AM
I doubt it's a standard SCI save file. I haven't looked into it at all, but my guess is it's more likely a completely custom format in byte code that they scripted the games to understand. AGDI's QFG2VGA remake (made in AGS) will also understand these files and produce a new one for use in QFG3 onward.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on December 11, 2018, 01:19:30 PM
True enough on being a custom format.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: OmerMor on December 11, 2018, 03:59:31 PM
I attached the original save and import scripts I could find.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Charles on December 17, 2018, 04:31:20 PM
It's interesting seeing these original scripts (especially since I think SCI Companion's decompiler has trouble decompiling those particular scripts).

I remember reading about one of the bugs in QFG2's exporting, related to one poor coder's misunderstanding of how boolean math works, but it's neat being able to see it in black and white.

Code: [Select]
;; Bits in svMiscEquip
(define  FINESWORD_BIT  $0001) ; fine sword
(define  FLAMESWORD_BIT $0002) ; flaming sword
(define  COMPASS_BIT    $0003) ; compass [NB, COMPASS_BIT == FINESWORD_BIT & FLAMESWORD_BIT]
(define  PIN_BIT        $0004) ; spahire pin
(define  LAMP_BIT       $0008) ; brass lamp
(define  TOKEN_BIT      $0010) ; EOF token
(define  GLASSES_BIT    $0020) ; X-Ray Glasses

; things transferred from "Quest for Glory 1"
(define  BABA_BIT       $0030) ; Flag set from QG1 [NB, BABA_BIT == TOKEN_BIT & GLASSES_BIT]
(define  SWORD_BIT      $0040) ; Sword
(define  CHAIN_BIT      $0080) ;
(define  PICK_BIT       $0100) ;
(define  TOOL_BIT       $0200) ;

I knew about the COMPASS_BIT, but the BABA_BIT is new to me.  It's interesting to see that the QFG3 import code also replicates the bug... I wonder if it just wasn't noticed as being wrong then. I imagine the AGD team had to leave that bug as is in QFG2VGA, because it's just too intwined to change, without breaking compatibility with QFG3/4.