home *** CD-ROM | disk | FTP | other *** search
-
- #include "swar.h"
-
- InitGame()
- {
- NewMatch();
-
- } /* InitGame() */
-
- GameCycle()
- {
- GrafPtr savePort;
- Rect bigRect;
- extern CWindowPtr gPictureWindow;
- extern CGrafPort *gOSPtr;
- extern Boolean gMatchIsEnding, gPlaying;
- extern short gMatchTicker;
- extern RGBColor myWhite, myBlack;
-
- bigRect.top = 0;
- bigRect.bottom = 479;
- bigRect.left = 0;
- bigRect.right = 639;
- GetPort(&savePort);
- SetPort((GrafPtr)gPictureWindow);
- CheckKeyboard();
- MoveObjects();
- if (!gPlaying)
- return;
- DrawObjects();
- SetPort(savePort);
-
- if (gMatchIsEnding && (--gMatchTicker == 0)) {
- RGBForeColor(&myBlack);
- RGBBackColor(&myBlack);
- EraseRect(&bigRect);
- RGBForeColor(&myBlack);
- RGBBackColor(&myWhite);
- NewMatch();
- } /* if */
-
- } /* GameCycle() */
-
- MoveObjects()
- {
- MoveShips();
- MoveShots();
- MoveDebris();
-
- } /* MoveObjects() */
-
- DrawObjects()
- {
-
- DrawStars();
- DrawShips();
- DrawShots();
- DrawDebris();
-
- } /* DrawObjects() */
-
- NewMatch()
- {
- extern Handle gNewMatchSoundH;
- extern Boolean gMatchIsEnding;
-
- AStopSnd();
- AInitSnd();
- InitStars();
- InitShips();
- InitShots();
- InitDebris();
- ASndPlay(gNewMatchSoundH);
- gMatchIsEnding = FALSE;
-
- } /* NewMatch() */
-