The Game class is the main class of your
game. It is where the program begins, and where it ends.
Properties
Methods
-
void
init() |
Sets up all of the main classes
and global variables in your game.
First, it sets up the cast (gCast),
features (gFeatures), sFeatures (gSFeatures), sounds (gSounds),
regions (gRegions), locales (gLocales), addToPics (gAddToPics)
and timers (gTimer). Next, it sets up the global gSaveDirPtr
to a pointer to the save directory string buffer. Finally, it
initalizes the inventory (Inv) and user (User).
|
-
bool
doit() |
Performs all of the main game
actions.
It begins by checking the sounds
and timers. If there's a print dialog (gPrintDlg), it checks
it to see if it's timer is up and it should automatically close.
It animates the cast, and if gCastMotionCue is set, motion cues
the cast. It then executes the script's doit() method if the
script property is set. It calls doit() for each of the regions,
then if gRoomNumber is equal to gRoomNumberExit, calls User's
doit(), otherwise, executes the newRoom() method. It deletes
the timers, then returns whether the game is restarting.
|
-
void
showSelf() |
Calls the regions' showSelf()
method.
|
-
void
play() |
This is the main method of your
game. It is where the execution begins and ends.
It assigns the game class to
the global gGame and the a pointer to the save directory to
global gSaveDirPtr.If the game is not restarting, the obtains
the current working directory. It then sets the cursor to the
loading cursor, calls the game instance's init() method, and
sets it back to the normal cursor. It then loops calling the
game instance's doit() method and waiting according to the game
speed until the global gQUIT_FLAG is set.
|
-
void
replay() |
Similar to the play() method,
but is called after a game is restored.
|
-
void
newRoom(number roomNum) |
Changes the room to roomNum. This
is called when the user enters doors, or hits the edge of the
screen. To change a room in your game, you should use global
gRoom's newRoom() method.
|
-
void
startRoom(number roomNum) |
Initalizes and sets up a new room.
|
-
void
restart() |
Restarts the game.
|
-
void
restore([string strDescription]) |
Restores a game. If specified,
it the default game to open will be the one which has a description
matching strDescription.
It executes the SRDialog as a
restore dialog, and if a game is selected, attempts to restore
it.
|
-
void
save() |
Saves a game.
It executes the SRDialog as a
save dialog, and if a game is selected, attempts to save to
it.
|
-
void
changeScore(number addPoints) |
Adds addPoints to the game's score
(global variable gScore).
|
-
bool
handleEvent(heapPtr pEvent) |
Calls the handleEvent() method
from the regions class (pointed to by gRegions). If it returns
TRUE, it will return whether pEvent has been claimed or not.
If it returns FALSE, it calls the handleEvent() method from
the locales class (pointed to by gLocales). If it returns TRUE,
it will return whether pEvent has been claimed or not. Finally,
if both are FALSE, and the script property is set, it calls
the script's handleEvent() method. It then returns whether pEvent
has been claimed or not.
|
-
void
showMem() |
Displays current memory information
in a dialog box.
|
-
number
setSpeed(number newSpeed) |
Sets the game's speed to newSpeed
and returns the previous speed.
|
-
void
checkAni() |
Adds the cast members which are
extras to the picture, then calls kernel Animate()
for the cast.
|
-
void
notify() |
In the Game class, this is just
an empty place holder.
|
-
void
setScript(heapPtr newScript[, heapPtr theCaller, number
theRegister]) |
Disposes the current script pointed
to by the script property. If newScript is not NULL, it initializes
it with theCaller and theRegister is specified.
|
-
void
cue() |
If the script property is set,
it call's it's cue() method.
|
-
bool
wordFail(string aWord) |
Prints "I don't understand
<aWord>" to the screen in a dialog box. It always
returns FALSE.
|
-
void
syntaxFail() |
Prints a message indicating that
the line parsed doesn't appear to be a proper sentence.
|
-
void
semanticFail() |
Prints a message indicating that
the sentence parsed doesn't make sense.
|
-
void
pragmaFail() |
Prints the message "You've
left me responseless".
|
|