Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Charles

Pages: [1] 2 3
1
SCI Development Tools / Re: Decompilation Archive
« on: Today at 01:59:35 PM »
Made some more improvements:
  • fixed two incorrect decompilation lines in rm171 (arenaBearChange)
  • split game.sh into multiple headers
  • manually decompiled Main.sc::EgoDead asm into Sierra Script (script 0)
  • manually decompiled BoxSelector.sc::chAlloc::init asm into Sierra Script (script 203)
  • manually decompiled TargetRange.sc::rm73::init asm into Sierra Script (script 73)

2
SCI Development Tools / Re: Decompilation Archive
« on: May 06, 2019, 01:17:49 PM »
I've done a bit of touch-up work on Eric's excellent QFG1EGA src (v3).  A lot of minor changes:
  • replaced all view reference numbers with defines
  • replaced all OnControl and IllegalBits with defines
  • replaced all EncRoom::entrances with defines
  • replaced some StudioScript constants with SSCI constante (evKEYBOARD->keyDown, evJOYSTICK->direction)
  • gave names to all default global variables
  • renamed gCast, gRegions, gSounds, etc to their original SSCI names
  • fixed the (= controls controls) bug I mentioned in another thread
  • converted FLAGS to enum instead of individual defines
  • converted all Btst, Bclr, Bset flags to use the enum constant instead of a number. If I didn't know what the flag did, i named it FLAG_#, to make it easier to search for and trace later
  • added comments describing how the TrySkill and SkillUsed functions work
  • added defines for certain hardcoded values, like Ogre, kobold, Brutus Max HP; and the skill level needed to solve certain puzzles
  • I think that's the gist of it, but there were many little touches here and there so I may have missed mentioning something

It compiles, and I've done a quick play-through of a couple rooms without noticing any problems, but I haven't done an extensive start-to-finish run yet.

3
SCI Development Tools / Re: Decompiler ambiguity for SCI0 and SCI01
« on: May 06, 2019, 12:57:45 PM »
Thank you, that was exactly what I was looking for!

I don't know enough about assembly to really do anything yet, but I'd like to learn more. I know I came across some pages before on how to decompile SCI byte code, but I haven't been able to find them again for the longest time.

Aha, wait a sec, here we go! This was what I was looking for. An earlier blog post from you: https://mtnphil.wordpress.com/2016/04/09/decompiling-sci-byte-code-part-1/

And a wiki page to help decipher the assembly codes: https://wiki.scummvm.org/index.php/SCI/Specifications/SCI_virtual_machine/The_Sierra_PMachine

I think I'll give those a read when I find the time.  Thanks again for your help.

4
SCI Development Tools / Re: Decompiler ambiguity for SCI0 and SCI01
« on: May 03, 2019, 01:33:45 PM »
In (= controls controls) above, it clearly sets the Rm::controls property to a reference to the controls instance.
I don't think it clearly does that, but I do agree it's the most reasonable assumption.

I know how to rename things to avoid the conflict, but I was hoping to actually confirm the reasonable assumption.

5
SCI Development Tools / Re: Decompiler ambiguity for SCI0 and SCI01
« on: May 02, 2019, 11:47:19 PM »
Iĺm less concerned with fixing this in the general case for the decompile than I am in solving it manually in this specific case. This feels like an edge case, so my interest is more for accuracyĺs sake (for both the template and the decompilation archives).

How would one go about figuring out what the original control variables reference in that line? And is there a way without laboriously examining the bytecode?

6
SCI Development Tools / Decompiler ambiguity for SCI0 and SCI01
« on: May 02, 2019, 04:19:14 PM »
I was looking through the decompiled QFG1EGA, and noticed something I think might be decompiling wrong, and I wanted to get other opinions on.

I've tried this in fresh decompilations for LSL3, QFG1EGA and QFG2, all with the same results. In script 994 (GAME.SC) it decompiles to (trimmed unnecessary code):
Code: [Select]
(instance controls of Controls
(properties)
)
(class Rm of Rgn
(properties
controls 0
)

(method (init &tmp temp0)
(= controls controls)
)
)

So there's a script instance called controls, and there's a property in the Rm class called the same thing.  In the Rm class, it's assigning (= controls controls).  Looks like the IDE assumes they're referencing the same thing, the control property (and I assume the compiler does the same), but I believe the original code being decompiled is actually (= <property>controls <instance>controls).

Can anybody confirm what's going on, or am I way off base?

7
Everything-Else / Re: Infocom Source Code Released (in ZIL language)
« on: April 17, 2019, 09:21:24 AM »
Anybody know if there's any easy way to download them all? I'd rather not download 131 individual repositories if it can be avoided.

9
SCI Syntax Help / Re: Importing a Character (a la Quest for Glory)
« 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.

10
SCI Syntax Help / Re: Police Quest 1 VGA
« on: November 11, 2018, 11:43:49 PM »

I made "Export as patch file" in game folder.

I think this step was your problem. It sounds like you ôExport[ed] as patch fileö before compiling. That extracted the original script 200 from the resource.000 and saved it as a 200.scr ôpatchö file.

When you later compiled the script it updated within resource.000, but Sierra games always give priority to external ôpatchö files if they exist. So the game was always loading the original script it found in the exported 200.scr ignoring the updated script in resource.000, exactly like Kawa described.

By the way, I think the effort youĺre putting into your translation work is awesome, and I wish you all the best for it.

11
SCI Development Tools / Re: Recreating complete QFG1 EGA source code
« on: November 05, 2018, 04:08:45 PM »
Eric,

I was just looking through your code myself, and I noticed that you left script n982 and n896 out of the game.ini.  Even if you don't have a custom name for them, you should include them in the game.ini otherwise a Compile All won't include them.

Also, I believe n982 is SIGHT.SC. proc982_0 is IsOffScreen, proc982_1 is CantBeSeen, and proc982_2 is AngleDiff.

12
SCI Development Tools / Re: Recreating complete QFG1 EGA source code
« on: November 02, 2018, 08:48:43 PM »
Thanks for the update - very interesting!

Btst and Bclr are used in many SCI games, and it's not limited to event flags, so you if you don't like the original names, you might want to use bitTest and bitClear etc. Names like getEventFlag is too specific.
EDIT: So I noticed that these functions are actually tied to a specific global flags array. Here's the version from QfG2:
Code: [Select]
(procedure (Btst flagEnum)
   (& [gameFlags (/ flagEnum 16)] (>> $8000 (mod flagEnum 16)))
;; (DisposeScript FLAGS)
)

(procedure (Bset flagEnum  &tmp oldState)
   (= oldState (Btst flagEnum))
   (|= [gameFlags (/ flagEnum 16)] (>> $8000 (mod flagEnum 16)))
   oldState
;; (DisposeScript FLAGS)
)

(procedure (Bclr flagEnum  &tmp oldState)
   (= oldState (Btst flagEnum))
   (&= [gameFlags (/ flagEnum 16)] (~ (>> $8000 (mod flagEnum 16))))
   oldState
;; (DisposeScript FLAGS)
)

From OmerMor on the 1st page of this very thread.

13
SCI Development Tools / Re: Recreating complete QFG1 EGA source code
« on: November 02, 2018, 12:11:59 PM »
He means in the main.sc of the decompiled HQ1 v1.000 source I did.  I'd commented that they were originally called Bclr and Btst.  My comments were based on OmerMor's code snippets, so it's just a single source confirmation.

That's awesome work Eric, I'm looking forward to comparing the differences between HQ1 v1.000 and QFG1 v1.200.

When you do get to test the game, give a look at Henry's Outlook. I know I had decompiler issues with that room, when I did HQ1 v1.000.

14
I actually did (still do) my own studies, using system.sh and comparing the globals it lists to what the games actually use.
Sorry, I didn't mean to imply you haven't researched it... I got overeager to contribute.

From global 27 on, things get a little wobbly between SCI0 games
Pity. :(

I've had an idea for a while now to decompile a bunch of the SCI0 and SCI01 games, then do some automated cross-comparisons against the system-level scripts to what changes if any existed between games, but it hasn't been a priority for me. There are, what, 10 classic SCI0/01 games? Have you done that kind of comparison before, yourself?

15
hardcoding a bunch of global variables

Oooh, that's a feature I like the sounds of.  That sounds like it would be easy enough, with a bit more research. Sierra was a business, so it wouldn't make sense for them to make drastic changes from one version to the next, just incremental ones. From the SCI16 files OmerMor shared long ago, they originally defined the first 50 variables as global variables reserved for the system classes.
From the CLASS.TXT documentation:
Code: [Select]
                    Script Classes for Adventure Games

                          Author: Jeff Stephenson
                            Date: 5 April 1988
<snip>
                             Global Variables
Global variables 0 through 49 are reserved for use by the system classes.
Game-specific global variables start at 50.  The following global variables
are defined by the system.

ego
     The ID of a static instance of class Ego defined in game.sc.  This is
     the protagonist of the game.

curRoom
     The ID of the current Room.

userFont
     The number of the font to be used in Print statements, etc.  Default is
     1.  Set it to the font you wish to use in the init: method of your
     Game, or change it at will in the game.

cast
     The ID of a Set of Actors and Egos which constitutes the characters on
     the screen.

quit
     The main loop of the game is

          (while (not quit)
               (theGame doit:)
               (Wait speed)
          )

     so setting quit to TRUE breaks out of the main loop and terminates the
     game.

addToPics
     A Set of PicViews which have been added to the current picture.

debugOn
     A generic debugging flag.  I usually have a Debug menu item to set it,
     and trigger any debug display that I want off of it, rather than
     creating a special trigger whenever I want to debug something.

sounds
     The Set of Sounds currently playing.

inventory
     The ID of the Inventory class or instance which is the Set of all
     InvItems (inventory items) in the Game.  Inventory related issues are
     not well defined yet...

theGame
     The ID of the Game instance.

regions
     The Set of Regions currently in effect.

curRoomNum
     The number of the current Room.

prevRoomNum
     The number of the previous Room.  (So you know how you got where you
     are.)

newRoomNum
     Used by a Room to signal to the Game that it should change to a new
     Room.

showStyle
     The global style for the transition from one picture to another.  This
     may be overridden by the style property of a given room.  See the
     DrawPic kernel function for the possible styles.

overRun
     The number of timer ticks more than the Game's speed which it took to
     complete the last animation cycle.  A non-zero overRun means that the
     system is not keeping up.

However, that was the original documentation... by Hero's Quest 1 they'd expanded that to 100 variables, and the order had changed from their original documentation, and that was just 1989.
Here's the global names as best as I was able to determine them when I was was remastering the HQ1 source.  Some that I flag as unused are really because they're part of an array, like curSaveDir... I left them as individual variables because I kept hitting a bug if I tried to decompile from scratch with arrays in just the sco files.:
Code: [Select]
(local
;system-defined global variables
ego ;pointer to ego (original SSCI name)
theGame ;ID of the Game instance (original SSCI name)
curRoom ;ID of current room (original SSCI name)
gNewSpeed =  6 ;CI: used for overRun speed testing.
quit ;when TRUE, quit game (original SSCI name)
gCast ;cast ;The ID of a Set of Actors and Egos which constitutes the characters on the screen.
gRegions ;regions ;The Set of Regions currently in effect.
gTimers ;timers ;list of timers in the game
gSounds ;sounds ;set of sounds being played
inventory ;set of inventory items in game (not used in Hero's Quest)
gAddToPics ;addToPics ;list of views added to the picture
curRoomNum ;current room number
prevRoomNum ;previous room number
newRoomNum ;number of room to change to
debugOn ;generic debug flag -- set from debug menu
score ;the player's current score
possibleScore ;highest possible score
showStyle =  7 ;The global style for the transition from one picture to another.  This
      ;may be overridden by the style property of a given room.  See the
      ;DrawPic kernel function for the possible styles.
overRun ;The number of timer ticks more than the Game's speed which it took to
      ;complete the last animation cycle.  A non-zero overRun means that the
      ;system is not keeping up.
theCursor ;the number of the current cursor
normalCursor =  ARROW_CURSOR ;number of normal cursor form
waitCursor =  HAND_CURSOR ;cursor number of "wait" cursor
userFont =  USERFONT ;font to use for Print
smallFont =  4 ;small font for save/restore, etc.
lastEvent ;the last event (used by save/restore game)
modelessDialog ;the modeless Dialog known to User and Intrface
bigFont =  USERFONT ;large font
global27 =  12 ;CI: unused, unknown purpose
version =  {ego} ;pointer to 'incver' version string
;  WARNING!  Must be set in room 0
;  (usually to {x.yyy    } or {x.yyy.zzz})
theDoits ;list of objects to get doits each cycle
curSaveDir ;current save drive/directory string [20 chars long]
global31 ;unused
global32 ;unused
global33 ;unused
global34 ;unused
global35 ;unused
global36 ;unused
global37 ;unused
global38 ;unused
global39 ;unused
global40 ;unused
global41 ;unused
global42 ;unused
global43 ;unused
global44 ;unused
global45 ;unused
global46 ;unused
global47 ;unused
global48 ;unused
global49 ;unused
animationDelay =  10 ;
perspective ;player's viewing angle: degrees away
;  from vertical along y axis
gFeatures ;features ;locations that may respond to events
gSFeatures ;CI: saidFeatures?
useSortedFeatures ;enable cast & feature sorting? (default is FALSE)
isDemoGame ;enabled if this is a game demo, and not a full game.??
global56 ;unused
overlays =  -1
doMotionCue ;a motion cue has occurred - process it
systemWindow ;ID of standard system window
global60 =  3 ;unused/unknown
defaultPalette
modelessPort
global63 ;unused
global64 ;unused
global65 ;unused
global66 ;unused
global67 ;unused
global68 ;unused
global69 ;unused
global70 ;unused
global71 ;unused
global72 ;unused
global73 ;unused
global74 ;unused
global75 ;unused
global76 ;unused
global77 ;unused
global78 ;unused
global79 ;unused
global80 ;unused
global81 ;unused
global82 ;unused
global83 ;unused
global84 ;unused
global85 ;unused
global86 ;unused
global87 ;unused
global88 ;unused
global89 ;unused
global90 ;unused
global91 ;unused
global92 ;unused
global93 ;unused
global94 ;unused
global95 ;unused
global96 ;unused
global97 ;unused
global98 ;unused
global99 ;unused


Assuming script 996 is always File.sc and Class_996_0 is File, it'll notice if it's that or gamefile_sh and call it File after all.
That's probably a safe assumption. From another file from OmerMor, SYSTEM.SH:
Code: [Select]
;;;;
;;;;  SYSTEM.SH
;;;;
;;;;  (c) Sierra On-Line, Inc, 1992
;;;;
;;;;  Author: Unknown
;;;;
;;;;  This is the header file for the SCI system
;;;;
;;;;  Last Updated:
;;;;     Brian K. Hughes
;;;;     August 19, 1992


(include kernel.sh)     ;kernel external declarations


;╔════════════════╗
;║                ║
;║ Module Defines ║
;║                ║
;╚════════════════╝

(define  SYSTEM      999)
(define  ACTOR       998)
(define  MENU        997)
(define  USER        996)
(define  INVENT      995)
(define  GAME        994)
(define  FILE        993)
(define  MOTION      992)
(define  JUMP        991)
(define  SAVE        990)
(define  MUSIC       989)
(define  EGO         988)     ; was EXTRA
(define  GAUGE       987)
(define  ORBIT       986)
(define  FLAGS       985)     ; was AVOIDER
(define  REGPATH     984)     ; was SORTCOPY
(define  PATH        983)
(define  SIGHT       982)
(define  WINDOW      981)
(define  TUTORIAL    980)     ; was TEXTRA
(define  UNUSED_4    979)     ; was MOUSER
(define  GCONTROL    978)
(define  GROOPER     977)
(define  CAT         976)
(define  SCALETO     975)     ; was DEMO
(define  NAMEFIND    974)
(define  TIMER       973)
(define  CHASE       972)
(define  FOLLOW      971)
(define  WANDER      970)
(define  REVERSE     969)
(define  SMOOPER     968)
(define  DCICON      967)
(define  SORT        966)
(define  COUNT       965)
(define  DPATH       964)     ; will be merged into PATH
(define  RELDPATH    963)     ; will be merged into PATH
(define  UNUSED_7    962)     ; was QSCRIPT
(define  STOPWALK    961)
(define  UNUSED_8    960)     ; was TIMEDCUE
(define  QSOUND      959)
(define  LOADMANY    958)
(define  UNUSED_10   957)     ; was LASTLINK
(define  FORCOUNT    956)
(define  TRACK       955)
(define  DOOR        954)     ; was GOTOSAID
(define  APPROACH    953)
(define  LOGGER      952)
(define  MOVEFWD     951)
(define  FEATURE     950)
(define  BLOCK       949)
(define  WRITEFTR    948)
(define  DLGEDIT     947)     ; was DELAYEVT
(define  POLYGON     946)
(define  POLYPATH    945)
(define  FILESEL     944)
(define  POLYEDIT    943)
(define  MOVECYC     942)
(define  RANDCYC     941)
(define  UNUSED_11   940)     ; was PRINTD
(define  OSC         939)
(define  RANGEOSC    938)     ; was PCYCLE
(define  ICONBAR     937)
(define  BORDWIND    936)
(define  SCALER      935)
(define  SLIDEICON   934)
(define  PMOUSE      933)
(define  PFOLLOW     932)     ; was LANGUAGE
(define  CDACTOR     931)
(define  PCHASE      930)
(define  SYNC        929)
(define  TALKER      928)
(define  PAVOID      927)
(define  FLIPPOLY    926)
(define  CONV        925)
(define  MESSAGER    924)
(define  INSET       923)
(define  DIALOG      922)  ;Contains DIcon, DButton, DEdit, DSelector, Controls
(define  PRINT       921)  ;Front-end for dialogs

(define  INTRFACE    255)

Okay, that was a much bigger info-dump that I intended... and a bunch of stuff that's probably not news, either.   

Oooh, now that I think about it, Folder support would be a really neat feature.  You could put all the 900-scripts into a system folder, and put game scripts into a game folder to make organization easier.

Pages: [1] 2 3

SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.139 seconds with 21 queries.