home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-23 | 22.7 KB | 755 lines | [TEXT/PJMM] |
- {================================================}
- {=============== Game window handler ================}
- {================================================}
-
- { Example file for Ingemars Sprite Animation Toolkit. }
- { © Ingemar Ragnemalm 1992-1994 }
- { See doc files for legal terms for using this code. }
-
- { This file holds the game window and game menu handlers for HeartQuest.}
- { This is where most game-specific code goes, except for the code describing}
- { each object. }
-
- { GameWindInit is called to initialize, which initializes the window and installs}
- {handler procedures (note that menus are installed in main.p). It calls the routines}
- {to initialize offscreen GrafPorts and all the animated objects. }
-
- { When the user selects New Game, StartGame is called to set up a new}
- { game, and then MoveIt, the game driver routine is called. }
-
- unit GameWindow;
-
- interface
-
- uses
- {$IFC UNDEFINED THINK_PASCAL}
- Types, Quickdraw, Resources, ToolUtils, Events, QuickDrawText,{}
- Menus, Windows,
- {$ELSEC}
- InterfacesUI,
- {$ENDC}
- TransSkel, SAT, {}
- GameGlobals, sPlayer, sFlypaper, sHeart, sBonus, sPoints, scores, SoundConst, Sound, ClutFade;
-
- procedure DoGameMenu (item: integer);
- procedure GameWindInit;
- procedure DoGameOver;
- procedure InitSprites;
- procedure DrawBackground;
- procedure HQRedraw;
-
-
- implementation
-
- {var}
- {mp: MonsterPtr; { Bra att ha en global tillgänglig. Dvs praktiskt... }
- { SlemtorksHandlerPtr: ProcPtr;}
-
- procedure InitSprites;
- begin
- { Call the init routines for each the sprite unit! Don't forget this! }
- InitFlypaper;
- InitHeart;
- InitPlayer;
- InitBonus;
- InitPoints;
- end;
-
-
- { Setup a bonus level. This is called when a level finishes and all bonus objects were collected.}
- procedure SetupBonusLevel (level: integer);
- var
- p: point;
- i: integer;
- mp: SpritePtr;
- r: rect;
- s: Str255;
- er: EventRecord; {For EventAvail}
- strwidth: integer;
-
- begin { SetupBonusLevel }
-
- SATSoundPlay(drringH, 10, false);
- {SATSoundEvents; Not needed since we call SATRun soon.}
-
- { Clear the sprite list }
- while gSAT.sRoot <> nil do
- SATKillSprite(gSAT.sRoot);
-
- bonusLevelRunning := true;
-
- { Create all the sprites for the level, depending on the level number. }
-
- {batchCount := level * 2 + 10;}
- for i := 1 to level * 2 + 10 do
- mp := SATNewSprite(-2, SATRand(gSAT.offSizeH - 112) + 17, -SATRand(400 + 25 * level), @SetupBonusHeart);
-
- { Reposition mouse to the center of the game area. }
- p.h := 256;
- p.v := 171;
- SATSetMouse(p);
- { Make the player sprite. }
- mp := SATNewSprite(2, (gSAT.offSizeH - xsize) div 2, gSAT.offSizeV div 2, @SetupPlayer);
- { Copy gSAT.backScreen to gSAT.offScreen to erase old sprites. }
- CopyBits(gSAT.backScreen.port^.portBits, gSAT.offScreen.port^.portBits, gSAT.offScreen.port^.portRect, gSAT.offScreen.port^.portRect, srcCopy, nil);
- HQRedraw; {replaces the following out-commented lines:}
-
- AddScore(0);
- { Do one frame of animation just to draw all the objects. }
- SATRun(false); {false or features^^.PlotFast; slow is ok - no hurry!}
-
- strwidth := StringWidth(MyGetIndString(startbonusStrID));
-
- { Draw a message and wait for click- this is a bit ugly. Consider other ways. }
- SetPort(gSAT.wind.port);
- SetRect(r, gSAT.offSizeH div 2 - strwidth div 2 - 5 + 2, gSAT.offSizeV div 2 + 35 + 2, gSAT.offSizeH div 2 + strwidth div 2 + 5 + 2, gSAT.offSizeV div 2 + 60 + 2); {offset by 2 pixels}
- PaintRect(r);
- SetRect(r, gSAT.offSizeH div 2 - strwidth div 2 - 5, gSAT.offSizeV div 2 + 35, gSAT.offSizeH div 2 + strwidth div 2 + 5, gSAT.offSizeV div 2 + 60);
- EraseRect(r);
-
- MoveTo(gSAT.offSizeH div 2 - strwidth div 2, gSAT.offSizeV div 2 + 50);
- DrawString(MyGetIndString(startbonusStrID)); {str 16: Click mouse for bonus level!}
-
- {Wait until something happens}
- FlushEvents(everyEvent, 0); { To forget events, like mouse clicks etc. }
- repeat
- until EventAvail(mDownMask + keyDownMask, er);
-
- { Redraw to get rid of the message we just made. }
- HQRedraw;
- end; { SetupBonusLevel }
-
- { Setup a new level. This is called when the game starts ans at each new level.}
- procedure SetupLevel (level: integer);
- var
- p: point;
- i: integer;
- mp, oldmp: SpritePtr;
- r: rect;
- s: Str255;
- er: EventRecord; {For EventAvail}
- strwidth: integer;
-
- { A routine to create a bunch of hearts }
- procedure MakeHearts (howmany: integer);
- var
- i: integer;
- mp: SpritePtr;
- begin
- for i := 1 to howmany do
- case SATRand(4) of
- 0:
- mp := SATNewSprite(-2, SATRand(gSAT.offSizeH - 112) + 17, 0, @SetupHeart);
- 1:
- mp := SATNewSprite(-2, SATRand(gSAT.offSizeH - 112) + 17, gSAT.offSizeV - 32, @SetupHeart);
- 2:
- mp := SATNewSprite(-2, 0, SATRand(gSAT.offSizeV - 32) + 17, @SetupHeart);
- 3:
- mp := SATNewSprite(-2, gSAT.offSizeH - xsize, SATRand(gSAT.offSizeV - 32) + 17, @SetupHeart);
- end;
- end;
-
- begin { SetupLevel }
-
- { Clear the sprite list }
- while gSAT.sRoot <> nil do
- SATKillSprite(gSAT.sRoot);
-
- { Create all the sprites for the level, depending on the level number. }
- case level of
- 1:
- begin
- bonus := 250;
- MakeHearts(6);
- mp := SATNewSprite(-3, 10, 10, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- end;
- 2:
- begin
- bonus := 300;
- MakeHearts(10);
- mp := SATNewSprite(-3, 10, 10, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 20, @SetupFlypaper);
- mp := SATNewSprite(-3, 20, gSAT.offSizeV - 32, @SetupFlypaper);
- end;
- 3:
- begin
- MakeHearts(12);
- bonus := 350;
- mp := SATNewSprite(-3, 5, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, 5, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- end;
- 4:
- begin
- MakeHearts(12);
- bonus := 350;
- mp := SATNewSprite(-3, 5, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, 5, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, 5, (gSAT.offSizeV - 32) mod 2, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, (gSAT.offSizeV - 32) mod 2, @SetupFlypaper);
- end;
- 5:
- begin
- MakeHearts(10);
- bonus := 380;
- mp := SATNewSprite(-3, 5, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, 5, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- end;
- 6:
- begin
- MakeHearts(12);
- bonus := 420;
- mp := SATNewSprite(-3, 5, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 5, @SetupFlypaper);
- mp := SATNewSprite(-3, 5, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, (gSAT.offSizeV - 32) mod 2, @SetupFlypaper);
- end;
- otherwise
- begin
- MakeHearts(level * 2);
- bonus := 300 + 20 * level;
- for i := 0 to level - 1 do
- begin
- case SATRand(6) of
- 0:
- mp := SATNewSprite(-3, 5, 5, @SetupFlypaper);
- 1:
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, 5, @SetupFlypaper);
- 2:
- mp := SATNewSprite(-3, 5, 300, @SetupFlypaper);
- 3:
- mp := SATNewSprite(-3, gSAT.offSizeH - xsize - 32, gSAT.offSizeV - 32, @SetupFlypaper);
- 4:
- mp := SATNewSprite(-3, (gSAT.offSizeH - xsize - 32) div 2, 5, @SetupFlypaper);
- 5:
- mp := SATNewSprite(-3, (gSAT.offSizeH - xsize - 32), gSAT.offSizeV - 32, @SetupFlypaper);
- end; { case }
- end;
- end;
- end;
-
- bonusLevelRunning := false;
-
- { Reposition mouse to the center of the game area. }
- p.h := 256;
- p.v := 171;
- SATSetMouse(p);
- { Make the player sprite. }
- mp := SATNewSprite(2, (gSAT.offSizeH - xsize) div 2, gSAT.offSizeV div 2, @SetupPlayer);
-
- {Fade out while we redraw!}
- FadeScreen(20, true, fadeTo);
-
- { Copy gSAT.backScreen to gSAT.offScreen to erase old sprites. }
- CopyBits(gSAT.backScreen.port^.portBits, gSAT.offScreen.port^.portBits, gSAT.offScreen.port^.portRect, gSAT.offScreen.port^.portRect, srcCopy, nil);
- HQRedraw;
-
- AddScore(0);
- { Do one frame of animation just to draw all the objects. }
- SATRun(false); {false or features^^.PlotFast; slow is ok - no hurry!}
-
- if level = 1 then
- s := MyGetIndString(startgameStrID) {str 16: Click the mouse to start the game.}
- else
- s := stringof(MyGetIndString(startlevelStrID), level : 1, '.'); {str 17: Click the mouse to start level }
-
- if level = 1 then
- strwidth := StringWidth(s)
- else
- strwidth := StringWidth(s);
-
- { Draw a message and wait for click- this is a bit ugly. Consider other ways. }
- SetPort(gSAT.wind.port);
- SetRect(r, gSAT.offSizeH div 2 - strwidth div 2 - 5 + 2, gSAT.offSizeV div 2 + 35 + 2, gSAT.offSizeH div 2 + strwidth div 2 + 5 + 2, gSAT.offSizeV div 2 + 60 + 2); {offset by 2 pixels}
- PaintRect(r);
- SetRect(r, gSAT.offSizeH div 2 - strwidth div 2 - 5, gSAT.offSizeV div 2 + 35, gSAT.offSizeH div 2 + strwidth div 2 + 5, gSAT.offSizeV div 2 + 60);
- EraseRect(r);
-
- MoveTo(gSAT.offSizeH div 2 - strwidth div 2, gSAT.offSizeV div 2 + 50);
- DrawString(s);
-
- FadeScreen(20, false, fadeTo);
-
- {Wait until something happens}
- FlushEvents(EveryEvent, 0); { To forget events, like mouse clicks etc. }
- repeat
- until EventAvail(mDownMask + keyDownMask, er);
-
- { Redraw to get rid of the message we just made. }
- HQRedraw;
- end; { SetupLevel }
-
- { Start a new game. Initialize level, score, number of lives, and call setuplevel to make the first level. }
- procedure StartGame;
- begin
- ZeroScore;
- level := 1;
-
- bonusesCollected := 0;
-
- SetupLevel(level);
- end;
-
- { Game Over procedure. Draw "Game Over" text, check high scores. }
-
- procedure DoGameOver;
- var
- { Variables for the Game Over-box }
- theRect, theRect2: rect;
- thePict: Handle;
- bredd, i: integer;
- dx, dy: integer;
- time: longint;
- begin
- SetMenuItemText(GameMenu, Pause, MyGetIndString(pauseStrID)); {str 18: Pause}
- { Game Over display! }
- SetPort(gSAT.wind.port);
- if gSAT.colorFlag and (gSAT.initDepth <> 1) then
- thePICT := GetResource('PICT', 129)
- else
- thePICT := GetResource('PICT', 128);
- theRect := PicHandle(thePICT)^^.picFrame;
- theRect.right := theRect.right - theRect.left;
- theRect.bottom := theRect.bottom - theRect.top;
- theRect.top := 0;
- theRect.left := 0;
-
- dx := (gSAT.offSizeH - (theRect.right - theRect.left)) div 2 - theRect.left;
- dy := (gSAT.offSizeV - (theRect.bottom - theRect.top)) div 2 - theRect.top;
- OffsetRect(theRect, dx, dy);
-
- bredd := theRect.right - theRect.left;
- theRect2 := theRect;
-
- i := 1;
- repeat
- time := TickCount;
- theRect.right := theRect2.right - bredd * (80 - i) div 160;
- theRect.left := theRect2.left + bredd * (80 - i) div 160;
- DrawPicture(PicHandle(thePICT), TheRect);
- i := i + TickCount - time;
- until i >= 80;
-
- SetPort(gSAT.offScreen.port);
- DrawPicture(PicHandle(thePICT), TheRect);
- SetPort(gSAT.wind.port);
-
- InvalRect(theRect);
-
- SATSoundShutUp; { Dispose of sound channel }
-
- FlushEvents(everyEvent, 0); { To forget events, like mouse clicks etc. }
- ShowCursor;
- SATShowMBar(nil);
-
- UpdateHigh; { Game over, was it high score? }
- end;
-
-
- { This routine is the game driver. It calls the "Animator" package until the game ends or is paused. }
- { I also read the keyboard here. This could optionally be moved to the "player object" module. }
-
- procedure MoveIt;
- var
- fr, tr, r: Rect;
- pt: Point;
- t, l: longint;
- theEvent: EventRecord; { för att testa musklick }
- { To check for key clicks with GetKeys: - no longer used. km: KeyMap;}
- hasEvent: Boolean;
- ignore: OSerr;
- begin
- stillrunning := true; { A flag that tells whether or not to quit this routine. }
-
- HideCursor; { NOTE: No matter how we leave the MoveIt procedure, we should ShowCursor. }
-
- pt.h := 256;
- pt.v := 171;
- SATSetMouse(pt);
- SATHideMBar(gSAT.wind.port);
- HQRedraw;
-
- { Main loop! Keep running until the game is paused or ends. }
- while stillrunning = true do
- begin
- t := TickCount;
- SetPort(gSAT.offScreen.port);
-
- {Reset booleans that will be set by the sprites.}
- bonusObjectRunning := false;
- levelCompleted := true;
-
- { Here is the real heart of the loop: call Animator once per loop. It will call all the objects. }
- SATRun(features^^.plotFast);
- {SATSoundEvents; No longer needed - included in SATRun!}
-
- { All the rest of the main loop is game specific, next level, bonus handling, etc. }
-
- {Decrease bonus. Out of bonus? Does not apply to bonus levels.}
- if not bonusLevelRunning then
- if not bonusObjectRunning or features^^.macho then
- if bonus > 0 then
- begin
- bonus := bonus - 1;
- if bonus mod 10 = 0 then
- begin
- AddScore(0);
- if features^^.macho then
- if bonus < 110 then
- SATSoundPlay(TickSndH, 0, false);
- end
- else if features^^.macho then
- if bonus < 26 then
- if bonus mod 5 = 0 then
- SATSoundPlay(TickSndH, 0, false);
- end
- else if features^^.macho then
- stillrunning := false;
-
- if levelCompleted then{(batchcount < 1)}
- {All hearts collected?}
- begin
- SATSoundShutUp;
-
- SATSoundPlay(sadarSndH, 0, true);
- repeat
- SATSoundEvents
- until SATSoundDone;
-
- {If it isn't a bonus level, we should give the player the bonus remaining}
- if not bonusLevelRunning then
- if bonus > 0 then
- while bonus > 0 do
- begin
- bonus := bonus - 10;
-
- SATSoundPlay(KlounkSndH, 0, true);
- repeat
- SATSoundEvents
- until SATSoundDone;
-
- if bonus < 0 then
- begin
- l := bonus;
- bonus := 0;
- AddScoreS(10 + l); {A special synchronous version of AddScore}
- end
- else
- AddScoreS(10); { Bonus! }
- end { if bonus > 0 }
- else if features^^.macho then
- stillrunning := false; { If no bonus, game over }
-
- {Level finished? Do we want a new level?}
- if (stillrunning and features^^.macho) or (level < 3) then
- if bonusesCollected >= kBonusLevelTresh then
- begin
- SetupBonusLevel(level);
- AddScoreS(0); {To update the level number}
- bonusesCollected := bonusesCollected - kBonusLevelTresh;
- end
- else
- begin
- level := level + 1;
- SetupLevel(level);
- AddScoreS(0); {To update the level number}
- end
- else
- stillrunning := false;
- end; {if (batchcount < 1)}
-
- { Check for keys being pressed }
- if features^^.allowBG then { if we are allowed to use the normal method }
- begin
- SystemTask;
- { Replaced the following call by WaitNextEvent if you want to be modern (but less backwards compatible). :-) }
- hasEvent := GetNextEvent(keyDownMask, theEvent)
- end
- else {Otherwise, use the faster GetOSEvent}
- begin
- hasEvent := GetOSEvent(keyDownMask, theEvent)
- end;
-
- {If there was a keydown, see if it was one of the menu options that we support when running.}
- if hasEvent then { there was a keydown }
- if BitAnd(theEvent.modifiers, cmdKey) <> 0 then
- begin
- case char(BitAnd(theEvent.message, charCodeMask)) of
- 'p':
- begin
- PauseFlag := true;
- SATSoundShutUp; { Dispose of sound channel }
- ShowCursor;
- SATShowMBar(nil);
- FlushEvents(6 + 8, 0); { In order to forget the cmd-p }
- SetMenuItemText(GameMenu, Pause, MyGetIndString(resumeStrID)); {str 19: Resume}
- exit(MoveIt);
- end;
- '.':
- stillRunning := false;
- 'q':
- begin
- stillRunning := false;
- SkelWhoa;
- end;
- 's':
- begin
- DoGameMenu(sound);
- end;
- otherwise
- ;
- end; {case}
- end
- else if BitAnd(theEvent.message, charCodeMask) = 27 then {ESC}
- stillRunning := false;
-
- { Delay, using TickCount so it doesn't matter how fast our Mac is. }
- while ((TickCount - t) < 3) do
- ;
-
- end; { while stillrunning (main loop) }
-
- DoGameOver;
-
- FlushEvents(mouseDown + keyDown, 0); { In order to forget the cmd-p }
- end;
-
- {Almost same as SATRedraw, but not black borders}
- procedure HQRedraw;
- var
- r: Rect;
- savePort: SATPort;
- begin
- SATGetPort(savePort);
- SATSetPortScreen;
-
- if gSAT.colorFlag then
- RGBForeColor(fadeTo); {Same color as we fade to!}
-
- SetRect(r, gSAT.wind.port^.portRect.left, gSAT.wind.port^.portRect.top, 0, gSAT.wind.port^.portRect.bottom);
- PaintRect(r);
- SetRect(r, 0, gSAT.wind.port^.portRect.top, gSAT.offSizeH, 0);
- PaintRect(r);
- SetRect(r, 0, gSAT.offSizeV, gSAT.wind.port^.portRect.right, gSAT.wind.port^.portRect.bottom);
- PaintRect(r);
- SetRect(r, gSAT.offSizeH, gSAT.wind.port^.portRect.top, gSAT.wind.port^.portRect.right, gSAT.offSizeV);
- PaintRect(r);
-
- SetRect(r, 0, 0, gSAT.offSizeH, gSAT.offSizeV);
-
- ForeColor(blackColor);
- CopyBits(gSAT.offScreen.port^.portBits, gSAT.wind.port^.portBits, r, r, srcCopy, nil);
- SATSetPort(savePort);
- end;
-
- {We used to draw the background ourselves rather than using a simple backdrop PICT, to save space and to get}
- {the dithered background. However, using the shades in the object drawing part of ClarisWorks, I can make PICT}
- {resources that are fairly small, so I use that instead now.}
- {Thus, DrawBackground ONLY draws the trees!}
- procedure DrawBackground;
- var
- ph: PicHandle;
- ignore: OSErr;
- col: RGBColor;
- thinr, r: Rect;
- i, j: integer;
-
- posH, posV, scale, height, width: longint; {For scaling the trees}
- begin
- SATSetPortBackScreen;
- SetRect(r, 0, 0, gSAT.offSizeH, gSAT.offSizeV);
-
- if gSAT.colorFlag then
- RGBForeColor(fadeTo); {Same color as we fade to!}
- PaintRect(r);
- ForeColor(blackColor);
-
- SATDrawPicts(132, 133);
- SATSetPortBackScreen;
-
- {Draw trees using PICTs!}
-
- {First get the right PICT}
- if gSAT.initDepth = 1 then
- begin
- ph := GetPicture(135); {bw tree PICT}
- end
- else
- begin
- ph := GetPicture(134); {color tree PICT}
- end;
- if ph = nil then
- exit(DrawBackground);
-
- {Scale by ph^^.picframe}
- for i := 0 to 10 do
- {For more trees: for j := i to 4 do}
- begin
- posH := SATRand(gSAT.offSizeH);
- posV := gSAT.offSizeV div 2 + longint(i) * i * gSAT.offSizeV div 300;
-
- scale := (posV - gSAT.offSizeV div 4) div 17;
- height := scale * (ph^^.picframe.bottom - ph^^.picframe.top) div 40;
- width := scale * (ph^^.picframe.right - ph^^.picframe.left) div 40;
-
- r.top := posV - height;
- r.bottom := posV;
- r.right := posH + width;
- r.left := posH;
-
- DrawPicture(ph, r);
- end;
-
- ReleaseResource(handle(ph));
-
- CopyBits(gSAT.backScreen.port^.portBits, gSAT.offScreen.port^.portBits, gSAT.backScreen.port^.portRect, gSAT.backScreen.port^.PortRect, srcCopy, nil);
- SATSetPortScreen;
- {HQRedraw;}
- {CopyBits(gSAT.backScreen^.portBits, gSAT.wind^.portBits, gSAT.backScreen^.portRect, gSAT.backScreen^.PortRect, srcCopy + ditherCopy, nil);}
- end;
-
-
- procedure GameWindUpdate;
- var
- s: str255;
- r: Rect;
- crsr: CursHandle;
- begin
- {When the depth has changed, the game wind will get an update event,}
- {so let's give SAT a chance to update itself before updating!}
-
- crsr := GetCursor(WatchCursor);
- SetCursor(crsr^^);
- if SATDepthChangeTest then
- begin
- DrawBackground; {Redraw trees}
- end;
- ReleaseResource(handle(crsr));
- InitCursor;
-
- HQRedraw;
- AddScore(0);
- end;
-
- procedure DoGameMenu (item: integer);
- begin
- case (item) of
- run:
- begin
- { Test if we have Color QD, and if so, test bit depth! Alert if features^^.PlotFast.}
- if SATDepthChangeTest then {Update if necessary}
- DrawBackground;
- if not ((gSAT.initDepth = 1) or (gSAT.initDepth = 4) or (gSAT.initDepth = 8)) and features^^.PlotFast then
- begin
- SATReportStr(MyGetIndString(pleaseuncheckStrID));
- {str 23: Please uncheck ''Fast animation'' or set the monitor to 1-, 4- or 8-bit mode in the Control Panel.}
- exit(DoGameMenu);
- end;
- if pauseFlag then
- if SATQuestionStr(MyGetIndString(endStrID)) then {str 24: End the Current game?}
- DoGameMenu(abort)
- else
- exit(DoGameMenu);
- DisableItem(gameMenu, macho);
- ShowWindow(gSAT.wind.port);
- SelectWindow(gSAT.wind.port);
- StartGame;
- GameWindUpdate;
- MoveIt;
- if not pauseFlag then
- EnableItem(GameMenu, macho);
- end;
- sound:
- begin
- features^^.sound := not features^^.sound;
- CheckItem(GameMenu, sound, features^^.sound);
- if features^^.sound then { Tell the sound package our settings, so we don't have to bother. }
- SATSoundOn
- else
- SATSoundOff;
- ChangedResource(handle(features));
- end;
- macho:
- begin
- features^^.macho := not features^^.macho;
- CheckItem(GameMenu, macho, features^^.macho);
- ChangedResource(handle(features));
- end;
- AllowBG:
- begin
- features^^.AllowBG := not features^^.AllowBG;
- CheckItem(GameMenu, AllowBG, features^^.AllowBG);
- ChangedResource(handle(features));
- end;
- FastAnimation:
- begin
- features^^.PlotFast := not features^^.PlotFast;
- CheckItem(GameMenu, FastAnimation, features^^.PlotFast);
- ChangedResource(handle(features));
- end;
- pause:
- begin
- { Pause is only interesting here as "resume". }
- if pauseFlag then
- begin
- { Test if we have Color QD, and if so, test bit depth! Alert if features^^.PlotFast.}
- if SATDepthChangeTest then {Update if necessary}
- DrawBackground;
- if not ((gSAT.initDepth = 1) or (gSAT.initDepth = 4) or (gSAT.initDepth = 8)) and features^^.PlotFast then
- begin
- SATReportStr(MyGetIndString(pleaseuncheckStrID)); {str 23}
- exit(DoGameMenu);
- end;
- SetMenuItemText(GameMenu, pause, MyGetIndString(pauseStrID)); {str 18}
- pauseFlag := false;
- ShowWindow(gSAT.wind.port);
- SelectWindow(gSAT.wind.port);
- GameWindUpdate;
- MoveIt;
- if not pauseFlag then
- EnableItem(GameMenu, macho);
- end;
- end;
- abort:
- begin
- if pauseFlag then
- begin
- SetMenuItemText(GameMenu, Pause, MyGetIndString(pauseStrID)); {str 18}
- DoGameOver;
- pauseFlag := false;
- EnableItem(GameMenu, macho);
- end
- end;
- end;
- end;
-
- procedure GameWindMouse (thePoint: Point; theTime: longint; theMods: integer; myProc: ProcPtr);
- begin
- if pauseFlag then
- DoGameMenu(pause)
- else
- DoGameMenu(run);
- end;
-
- procedure GameWindIdle;
- begin
- end;
-
- procedure GameWindClose;
- begin
- end;
-
- procedure GameWindInit;
- begin
- { Tell TransSkel to handle all the tedious things with gSAT.wind. }
- dummy := SkelWindow(gSAT.wind.port, @GameWindMouse, nil, @GameWindUpdate, nil, @GameWindClose, nil, @GameWindIdle, false);
- end;
-
- end.