Debian Codegraph @

game/Maelstrom_Globals.h

raw symbols SCIP
1 /*
2 Maelstrom: Open Source version of the classic game by Ambrosia Software
3 Copyright (C) 1997-2026 Sam Lantinga <[email protected]>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 #ifndef _Maelstrom_Globals_h
23 #define _Maelstrom_Globals_h
24
25 #include <SDL3/SDL.h>
26
27 #include "../screenlib/SDL_FrameBuf.h"
28 #include "../screenlib/UIManager.h"
29
30 #include "../maclib/Mac_FontServ.h"
31 #include "../maclib/Mac_Sound.h"
32 #include "../maclib/Mac_Compat.h"
33
34 #include "../utils/prefs.h"
35
36 #include "Maelstrom.h"
37
38 #include "myerror.h"
39 #include "fastrand.h"
40 #include "replay.h"
41 #include "scores.h"
42 #include "controls.h"
43 #include "gameinfo.h"
44 #include "steam.h"
45
46 // Preferences keys
47 #define PREFERENCES_RESOLUTION "Resolution"
48 #define PREFERENCES_HANDLE "Handle"
49 #define PREFERENCES_DEATHMATCH "Network.Deathmatch"
50 #define PREFERENCES_MULTIPLAYER_LIVES "Network.Lives"
51 #define PREFERENCES_MULTIPLAYER_FRAGS "Network.Frags"
52 #define PREFERENCES_KIDMODE "Cheat.KidMode"
53 #define PREFERENCES_CONTINUES "Cheat.Continues"
54 #define PREFERENCES_MOD_FILE "ModFile"
55
56 // The restart event
57 #define SDL_EVENT_RESTART_INITIALIZATION (SDL_EVENT_USER + 0)
58
59 // The Font Server :)
60 extern FontServ *fontserv;
61
62 // The Preferences
63 extern Prefs *prefs;
64
65 // The Sound Server *grin*
66 extern Sound *sound;
67
68 // The SCREEN!! :)
69 extern FrameBuf *screen;
70
71 // The UI system
72 extern UIManager *ui;
73
74 /* Boolean type */
75 typedef Uint8 Bool;
76
77 // Functions from main.cpp
78 extern void PrintUsage(void);
79 extern bool IsPhone(void);
80 extern bool IsTablet(void);
81 extern int DrawText(int x, int y, const char *text, MFont *font, Uint8 style,
82 Uint8 R, Uint8 G, Uint8 B);
83 extern void DelayFrame(void);
84 extern void DelaySound(void);
85 extern void DelayAndDraw(int ticks);
86
87 // Functions from init.cpp
88 extern void SetStar(int which);
89 extern void SetBorderStar(int which);
90
91 // External variables...
92 // in main.cpp :
93 extern Bool gInitializing;
94 extern Bool gControlBrakes;
95 extern Bool gNetworkAvailable;
96 extern Bool gUpdateBuffer;
97 extern Bool gRunning;
98
99
100 // in init.cpp :
101 struct Resolution {
102 int w, h;
103 char path_suffix[32];
104 char file_suffix[32];
105 float scale;
106 };
107 extern array<Resolution> gResolutions;
108 extern int gResolutionIndex;
109 extern char *gReplayFile;
110 extern Uint32 gLastGameID;
111 extern SDL_Rect gScrnRect;
112 extern MPoint gShotOrigins[SHIP_FRAMES];
113 extern MPoint gThrustOrigins[SHIP_FRAMES];
114 extern MPoint gVelocityTable[SHIP_FRAMES];
115 extern StarPtr gTheStars[MAX_STARS];
116 extern StarPtr gBorderStars[MAX_BORDER_STARS];
117 extern Uint32 gStarColors[];
118 extern Uint32 gSpriteCRC;
119
120 // in game.cpp :
121 extern int gDisplayed;
122 extern int gGameOn;
123 extern int gPaused;
124 extern int gBoomDelay;
125 extern int gNextBoom;
126 extern int gBoomPhase;
127 extern int gNumRocks;
128 extern int gNumSmallRocksDestroyed;
129 extern int gLastStar;
130 extern int gWhenDone;
131
132 extern int gMultiplierShown;
133 extern int gPrizeShown;
134 extern int gBonusShown;
135 extern int gWhenHoming;
136 extern int gWhenGrav;
137 extern int gWhenDamaged;
138
139 extern int gWhenNova;
140 extern int gShakeTime;
141 extern int gFreezeTime;
142
143 extern int gWave;
144 class Object;
145 extern Object *gEnemySprite;
146 extern int gWhenEnemy;
147 extern Replay gReplay;
148
149 // in controls.cpp :
150 extern Controls controls;
151 extern PrefsVariable<int> gSoundLevel;
152 extern PrefsVariable<int> gGammaCorrect;
153 extern PrefsVariable<int> gZoomGame;
154 // int scores.cpp :
155 extern Scores hScores[NUM_SCORES];
156
157 // -- Variables specific to each game
158 // in game.cpp :
159 extern GameInfo gGameInfo;
160 // in init.cpp :
161 extern Uint64 gLastDrawn;
162 extern int gNumSprites;
163
164 // UI panel definitions...
165 #define PANEL_SPLASH "splash"
166 #define PANEL_LOADING "loading"
167 #define PANEL_MAIN "main"
168 #define PANEL_GAME "game"
169 #define PANEL_BONUS "bonus"
170 #define PANEL_CONTINUE "continue"
171 #define PANEL_GAMEOVER "gameover"
172 #define PANEL_ABOUT "about_story"
173 #define DIALOG_LOBBY "lobby"
174 #define DIALOG_CONTROLS "controls"
175 #define DIALOG_ZAP "zap"
176 #define DIALOG_DAWN "dawn"
177 #define DIALOG_CHEAT "cheat"
178 #define DIALOG_KIDMODE "kidmode"
179 #define DIALOG_MESSAGE "message"
180
181 // Sound resource definitions...
182 #define gShotSound 100
183 #define gMultiplier 101
184 #define gExplosionSound 102
185 #define gShipHitSound 103
186 #define gBoom1 104
187 #define gBoom2 105
188 #define gMultiplierGone 106
189 #define gMultShotSound 107
190 #define gSteelHit 108
191 #define gBonk 109
192 #define gRiff 110
193 #define gPrizeAppears 111
194 #define gGotPrize 112
195 #define gGameOver 113
196 #define gNewLife 114
197 #define gBonusAppears 115
198 #define gBonusShot 116
199 #define gNoBonus 117
200 #define gGravAppears 118
201 #define gHomingAppears 119
202 #define gShieldOnSound 120
203 #define gNoShieldSound 121
204 #define gNovaAppears 122
205 #define gNovaBoom 123
206 #define gLuckySound 124
207 #define gDamagedAppears 125
208 #define gSavedShipSound 126
209 #define gFunk 127
210 #define gEnemyAppears 128
211 #define gPrettyGood 131
212 #define gThrusterSound 132
213 #define gEnemyFire 133
214 #define gFreezeSound 134
215 #define gIdiotSound 135
216 #define gPauseSound 136
217
218 /* -- The blit'ers we use */
219 extern BlitPtr gRock1R, gRock2R, gRock3R, gDamagedShip;
220 extern BlitPtr gRock1L, gRock2L, gRock3L, gShipExplosion;
221 extern BlitPtr gPlayerShip[MAX_PLAYERS];
222 extern BlitPtr gExplosion, gNova, gEnemyShip, gEnemyShip2;
223 extern BlitPtr gMult[], gSteelRoidL;
224 extern BlitPtr gSteelRoidR, gPrize, gBonusBlit, gPointBlit;
225 extern BlitPtr gVortexBlit, gMineBlitL, gMineBlitR, gShieldBlit;
226 extern BlitPtr gThrust1, gThrust2;
227 extern BlitPtr gShrapnel1[MAX_PLAYERS], gShrapnel2[MAX_PLAYERS];
228
229 /* -- The prize CICN's */
230
231 extern UITexture *gAutoFireIcon, *gAirBrakesIcon, *gMult2Icon, *gMult3Icon;
232 extern UITexture *gMult4Icon, *gMult5Icon, *gLuckOfTheIrishIcon;
233 extern UITexture *gLongFireIcon, *gTripleFireIcon, *gShieldIcon;
234
235 #endif // _Maelstrom_Globals_h