mirror of
https://github.com/Blzut3/Wolf3D-Mac.git
synced 2025-02-19 21:31:11 +00:00
1 line
61 KiB
C
1 line
61 KiB
C
|
/*********************
Main Macintosh code
*********************/
#include "Wolfdef.h" /* All the game equates */
#include <string.h>
#include <ctype.h>
#include <setjmp.h>
#include <palettes.h>
#include <qdoffscreen.h>
#include <Gestalt.h>
#include "SoundMusicSystem.h"
#include "PickAMonitor.h"
#include "Hidemenubar.h"
#include "Prefs.h"
#include <AppleEvents.h>
static Word DoMyAlert(Word AlertNum);
static void CenterSFWindow(Point *MyPoint,Word x,Word y);
static void CenterAWindow(WindowPtr MyWindow);
static void FixPauseMenu(void);
Boolean LoadGame(void);
pascal Boolean StandardModalFilterProc(DialogPtr theDialog, EventRecord *theEvent, short *itemHit);
Word ChooseGameDiff(void);
Word DoEvent(EventRecord *event);
void DoUpdate(WindowPtr window);
void DrawWindow(WindowPtr window);
void AdjustMenus(void);
void DoMenuCommand(LongWord menuResult);
Boolean DoCloseWindow(WindowPtr window);
void InitTools(void);
void SaveGame(void);
void LoadPrefs(void);
void SavePrefs(void);
Boolean ChooseLoadGame(void);
Boolean ChooseSaveGame(void);
OSErr MyEventHandler(AppleEvent *MyAppleEvent,AppleEvent *AppleReply,long MyRefCon);
Boolean MouseHit; /* True if a mouse was pressed */
static MenuHandle PauseMenu;
static Boolean WaitNextOK; /* True if WaitNextEvent is present */
static Boolean LowOnMem; /* True if sound is disabled for low memory */
static Boolean OpenPending; /* True if a load game apple event occured */
static Byte *SaveFileName; /* Pointer to the save file name */
static short SaveFileVol; /* Directory referance for save file name */
static long SaveFileParID; /* Parent directory id of save-game file */
static Boolean ValidRects; /* Are there blank rects in the window? */
static RgnHandle BlackRgn; /* Blank region for window blanking */
static Rect QDGameRect; /* Rect of the game playing area */
static Rect GameRect = {0,0,200,320}; /* Size of the playfield */
static Rect BlackRect = {0,0,480,640}; /* Rect for the Black Window (Set to main window size) */
static Rect BlackRect2 = {0,0,480,640}; /* True rect for the Black window (Global) */
static Word OldPixDepth; /* Previous pixel depth of screen */
Word MacWidth; /* Width of play screen (Same as GameRect.right) */
Word MacHeight; /* Height of play screen (Same as GameRect.bottom) */
Word MacViewHeight; /* Height of 3d screen (Bottom of 3D view */
static Word MonitorWidth=640; /* Width of the monitor in pixels */
static Word MonitorHeight=480; /* Height of the monitor in pixels */
Word QuitFlag; /* I quit if true */
Word TrueVideoWidth; /* Width of video monitor in bytes */
Byte *TrueVideoPointer; /* Pointer to the video monitor memory */
Byte *GameVideoPointer; /* Pointer to start of 3D view on monitor memory (Used by BlastScreen) */
Boolean DoQuickDraw = TRUE; /* Use quickdraw for updates? */
static Boolean DimQD; /* Force QuickDraw forever! */
Word IgnoreMessage; /* Variable set by prefs to ignore messages */
static CursHandle WatchHandle; /* Handle to a watch cursor */
#define RectX ((MonitorWidth-MacWidth)/2)
#define RectY ((MonitorHeight-MacHeight)/2)
Word VidXs[] = {320,512,640,640}; /* Screen sizes to play with */
Word VidYs[] = {200,384,400,480};
Word VidVs[] = {160,320,320,400};
Word VidPics[] = {rFaceShapes,rFace512,rFace640,rFace640}; /* Resource #'s for art */
static Word MouseBaseX;
static Word MouseBaseY;
static Boolean InPause; /* Pause active? */
extern jmp_buf ResetJmp;
extern Boolean JumpOK;
extern CWindowPtr GameWindow; /* Pointer to main game window */
extern CGrafPtr GameGWorld; /* Grafport to offscreen buffer */
GDHandle gMainGDH; /* Main graphics handle */
CTabHandle MainColorHandle; /* Main color table handle */
static void WaitCursor(void);
static void ResetPalette(void);
static void DoBackground(EventRecord *event);
static void InitAEStuff(void);
static void FixTheCursor(void);
/***************************
Dialog filter for 68020/30 version speed warning
***************************/
#ifndef __powerc
static pascal Boolean InitFilter(DialogPtr theDialog, EventRecord *theEvent, shor
|