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:
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.:
(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:
;;;;
;;;; 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.