Subversion Repositories eduke32

Rev

Rev 4968 | Rev 4989 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4968 Rev 4986
1
//-------------------------------------------------------------------------
1
//-------------------------------------------------------------------------
2
/*
2
/*
3
Copyright (C) 2010 EDuke32 developers and contributors
3
Copyright (C) 2010 EDuke32 developers and contributors
4

4

5
This file is part of EDuke32.
5
This file is part of EDuke32.
6

6

7
EDuke32 is free software; you can redistribute it and/or
7
EDuke32 is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License version 2
8
modify it under the terms of the GNU General Public License version 2
9
as published by the Free Software Foundation.
9
as published by the Free Software Foundation.
10

10

11
This program is distributed in the hope that it will be useful,
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14

14

15
See the GNU General Public License for more details.
15
See the GNU General Public License for more details.
16

16

17
You should have received a copy of the GNU General Public License
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
*/
20
*/
21
//-------------------------------------------------------------------------
21
//-------------------------------------------------------------------------
22
22
23
#ifndef game_h_
23
#ifndef game_h_
24
#define game_h_
24
#define game_h_
25
25
26
#include "premap.h"
26
#include "premap.h"
27
27
28
#ifdef __cplusplus
28
#ifdef __cplusplus
29
extern "C" {
29
extern "C" {
30
#endif
30
#endif
31
31
32
// Compile game-side legacy Room over Room code?
32
// Compile game-side legacy Room over Room code?
33
#define LEGACY_ROR 1
33
#define LEGACY_ROR 1
34
34
35
#define USERQUOTE_LEFTOFFSET    5
35
#define USERQUOTE_LEFTOFFSET    5
36
#define USERQUOTE_RIGHTOFFSET   14
36
#define USERQUOTE_RIGHTOFFSET   14
37
37
38
#define MAXRIDECULE 10
38
#define MAXRIDECULE 10
39
#define MAXRIDECULELENGTH 40
39
#define MAXRIDECULELENGTH 40
40
#define MAXSAVEGAMES 10
40
#define MAXSAVEGAMES 10
41
#define MAXSAVEGAMENAME 22
41
#define MAXSAVEGAMENAME 22
42
#define MAXPWLOCKOUT 128
42
#define MAXPWLOCKOUT 128
43
#define MAXRTSNAME 128
43
#define MAXRTSNAME 128
44
44
45
enum GametypeFlags_t {
45
enum GametypeFlags_t {
46
    GAMETYPE_COOP                   = 0x00000001,
46
    GAMETYPE_COOP                   = 0x00000001,
47
    GAMETYPE_WEAPSTAY               = 0x00000002,
47
    GAMETYPE_WEAPSTAY               = 0x00000002,
48
    GAMETYPE_FRAGBAR                = 0x00000004,
48
    GAMETYPE_FRAGBAR                = 0x00000004,
49
    GAMETYPE_SCORESHEET             = 0x00000008,
49
    GAMETYPE_SCORESHEET             = 0x00000008,
50
    GAMETYPE_DMSWITCHES             = 0x00000010,
50
    GAMETYPE_DMSWITCHES             = 0x00000010,
51
    GAMETYPE_COOPSPAWN              = 0x00000020,
51
    GAMETYPE_COOPSPAWN              = 0x00000020,
52
    GAMETYPE_ACCESSCARDSPRITES      = 0x00000040,
52
    GAMETYPE_ACCESSCARDSPRITES      = 0x00000040,
53
    GAMETYPE_COOPVIEW               = 0x00000080,
53
    GAMETYPE_COOPVIEW               = 0x00000080,
54
    GAMETYPE_COOPSOUND              = 0x00000100,
54
    GAMETYPE_COOPSOUND              = 0x00000100,
55
    GAMETYPE_OTHERPLAYERSINMAP      = 0x00000200,
55
    GAMETYPE_OTHERPLAYERSINMAP      = 0x00000200,
56
    GAMETYPE_ITEMRESPAWN            = 0x00000400,
56
    GAMETYPE_ITEMRESPAWN            = 0x00000400,
57
    GAMETYPE_MARKEROPTION           = 0x00000800,
57
    GAMETYPE_MARKEROPTION           = 0x00000800,
58
    GAMETYPE_PLAYERSFRIENDLY        = 0x00001000,
58
    GAMETYPE_PLAYERSFRIENDLY        = 0x00001000,
59
    GAMETYPE_FIXEDRESPAWN           = 0x00002000,
59
    GAMETYPE_FIXEDRESPAWN           = 0x00002000,
60
    GAMETYPE_ACCESSATSTART          = 0x00004000,
60
    GAMETYPE_ACCESSATSTART          = 0x00004000,
61
    GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
61
    GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
62
    GAMETYPE_TDM                    = 0x00010000,
62
    GAMETYPE_TDM                    = 0x00010000,
63
    GAMETYPE_TDMSPAWN               = 0x00020000
63
    GAMETYPE_TDMSPAWN               = 0x00020000
64
};
64
};
65
65
66
// logo control
66
// logo control
67
enum LogoFlags_t {
67
enum LogoFlags_t {
68
    LOGO_ENABLED           = 0x00000001,
68
    LOGO_ENABLED           = 0x00000001,
69
    LOGO_PLAYANIM          = 0x00000002,
69
    LOGO_PLAYANIM          = 0x00000002,
70
    LOGO_PLAYMUSIC         = 0x00000004,
70
    LOGO_PLAYMUSIC         = 0x00000004,
71
    LOGO_3DRSCREEN         = 0x00000008,
71
    LOGO_3DRSCREEN         = 0x00000008,
72
    LOGO_TITLESCREEN       = 0x00000010,
72
    LOGO_TITLESCREEN       = 0x00000010,
73
    LOGO_DUKENUKEM         = 0x00000020,
73
    LOGO_DUKENUKEM         = 0x00000020,
74
    LOGO_THREEDEE          = 0x00000040,
74
    LOGO_THREEDEE          = 0x00000040,
75
    LOGO_PLUTOPAKSPRITE    = 0x00000080,
75
    LOGO_PLUTOPAKSPRITE    = 0x00000080,
76
    LOGO_SHAREWARESCREENS  = 0x00000100,
76
    LOGO_SHAREWARESCREENS  = 0x00000100,
77
    LOGO_TENSCREEN         = 0x00000200,
77
    LOGO_TENSCREEN         = 0x00000200,
78
    LOGO_STOPANIMSOUNDS    = 0x00000400,
78
    LOGO_STOPANIMSOUNDS    = 0x00000400,
79
    LOGO_NOE4CUTSCENE      = 0x00000800,
79
    LOGO_NOE4CUTSCENE      = 0x00000800,
80
    LOGO_NOE1BONUSSCENE    = 0x00001000,
80
    LOGO_NOE1BONUSSCENE    = 0x00001000,
81
    LOGO_NOE2BONUSSCENE    = 0x00002000,
81
    LOGO_NOE2BONUSSCENE    = 0x00002000,
82
    LOGO_NOE3BONUSSCENE    = 0x00004000,
82
    LOGO_NOE3BONUSSCENE    = 0x00004000,
83
    LOGO_NOE4BONUSSCENE    = 0x00008000,
83
    LOGO_NOE4BONUSSCENE    = 0x00008000,
84
    LOGO_NOE1ENDSCREEN     = 0x00010000,
84
    LOGO_NOE1ENDSCREEN     = 0x00010000,
85
    LOGO_NOE2ENDSCREEN     = 0x00020000,
85
    LOGO_NOE2ENDSCREEN     = 0x00020000,
86
    LOGO_NOE3RADLOGO       = 0x00040000,
86
    LOGO_NOE3RADLOGO       = 0x00040000,
87
    LOGO_NODUKETEAMTEXT    = 0x00080000,
87
    LOGO_NODUKETEAMTEXT    = 0x00080000,
88
    LOGO_NODUKETEAMPIC     = 0x00100000,
88
    LOGO_NODUKETEAMPIC     = 0x00100000,
89
};
89
};
90
90
91
enum ScreenTextFlags_t {
91
enum ScreenTextFlags_t {
92
    TEXT_XRIGHT          = 0x00000001,
92
    TEXT_XRIGHT          = 0x00000001,
93
    TEXT_XCENTER         = 0x00000002,
93
    TEXT_XCENTER         = 0x00000002,
94
    TEXT_YBOTTOM         = 0x00000004,
94
    TEXT_YBOTTOM         = 0x00000004,
95
    TEXT_YCENTER         = 0x00000008,
95
    TEXT_YCENTER         = 0x00000008,
96
    TEXT_INTERNALSPACE   = 0x00000010,
96
    TEXT_INTERNALSPACE   = 0x00000010,
97
    TEXT_TILESPACE       = 0x00000020,
97
    TEXT_TILESPACE       = 0x00000020,
98
    TEXT_INTERNALLINE    = 0x00000040,
98
    TEXT_INTERNALLINE    = 0x00000040,
99
    TEXT_TILELINE        = 0x00000080,
99
    TEXT_TILELINE        = 0x00000080,
100
    TEXT_XOFFSETZERO     = 0x00000100,
100
    TEXT_XOFFSETZERO     = 0x00000100,
101
    TEXT_XJUSTIFY        = 0x00000200,
101
    TEXT_XJUSTIFY        = 0x00000200,
102
    TEXT_YOFFSETZERO     = 0x00000400,
102
    TEXT_YOFFSETZERO     = 0x00000400,
103
    TEXT_YJUSTIFY        = 0x00000800,
103
    TEXT_YJUSTIFY        = 0x00000800,
104
    TEXT_LINEWRAP        = 0x00001000,
104
    TEXT_LINEWRAP        = 0x00001000,
105
    TEXT_UPPERCASE       = 0x00002000,
105
    TEXT_UPPERCASE       = 0x00002000,
106
    TEXT_INVERTCASE      = 0x00004000,
106
    TEXT_INVERTCASE      = 0x00004000,
107
    TEXT_IGNOREESCAPE    = 0x00008000,
107
    TEXT_IGNOREESCAPE    = 0x00008000,
108
    TEXT_LITERALESCAPE   = 0x00010000,
108
    TEXT_LITERALESCAPE   = 0x00010000,
109
    TEXT_BACKWARDS       = 0x00020000,
109
    TEXT_BACKWARDS       = 0x00020000,
110
    TEXT_GAMETEXTNUMHACK = 0x00040000,
110
    TEXT_GAMETEXTNUMHACK = 0x00040000,
111
    TEXT_DIGITALNUMBER   = 0x00080000,
111
    TEXT_DIGITALNUMBER   = 0x00080000,
112
    TEXT_BIGALPHANUM     = 0x00100000,
112
    TEXT_BIGALPHANUM     = 0x00100000,
113
    TEXT_GRAYFONT        = 0x00200000,
113
    TEXT_GRAYFONT        = 0x00200000,
114
};
114
};
115
115
116
void A_DeleteSprite(int32_t s);
116
void A_DeleteSprite(int32_t s);
117
117
118
static inline int32_t G_GetLogoFlags(void)
118
static inline int32_t G_GetLogoFlags(void)
119
{
119
{
120
#if !defined LUNATIC
120
#if !defined LUNATIC
121
    return Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1);
121
    return Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1);
122
#else
122
#else
123
    extern int32_t g_logoFlags;
123
    extern int32_t g_logoFlags;
124
    return g_logoFlags;
124
    return g_logoFlags;
125
#endif
125
#endif
126
}
126
}
127
127
128
#ifdef LUNATIC
128
#ifdef LUNATIC
129
typedef struct {
129
typedef struct {
130
    vec3_t pos;
130
    vec3_t pos;
131
    int32_t dist, clock;
131
    int32_t dist, clock;
132
    int16_t ang, horiz, sect;
132
    int16_t ang, horiz, sect;
133
} camera_t;
133
} camera_t;
134
134
135
extern camera_t g_camera;
135
extern camera_t g_camera;
136
136
137
# define CAMERA(Membname) (g_camera.Membname)
137
# define CAMERA(Membname) (g_camera.Membname)
138
# define CAMERADIST (g_camera.dist)
138
# define CAMERADIST (g_camera.dist)
139
# define CAMERACLOCK (g_camera.clock)
139
# define CAMERACLOCK (g_camera.clock)
140
#else
140
#else
141
# define CAMERA(Membname) (ud.camera ## Membname)
141
# define CAMERA(Membname) (ud.camera ## Membname)
142
# define CAMERADIST g_cameraDistance
142
# define CAMERADIST g_cameraDistance
143
# define CAMERACLOCK g_cameraClock
143
# define CAMERACLOCK g_cameraClock
144
#endif
144
#endif
145
145
146
// KEEPINSYNC lunatic/defs.ilua
146
// KEEPINSYNC lunatic/defs.ilua
147
typedef struct {
147
typedef struct {
148
#if !defined LUNATIC
148
#if !defined LUNATIC
149
    vec3_t camerapos;
149
    vec3_t camerapos;
150
#endif
150
#endif
151
    int32_t const_visibility,uw_framerate;
151
    int32_t const_visibility,uw_framerate;
152
    int32_t camera_time,folfvel,folavel,folx,foly,fola;
152
    int32_t camera_time,folfvel,folavel,folx,foly,fola;
153
    int32_t reccnt,crosshairscale;
153
    int32_t reccnt,crosshairscale;
154
154
155
    int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon;   // JBF 20031125
155
    int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon;   // JBF 20031125
156
    int32_t democams,color,msgdisptime,statusbarmode;
156
    int32_t democams,color,msgdisptime,statusbarmode;
157
    int32_t m_noexits,noexits,autovote,automsg,idplayers;
157
    int32_t m_noexits,noexits,autovote,automsg,idplayers;
158
    int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
158
    int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
159
159
160
    int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
160
    int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
161
    int32_t coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
161
    int32_t coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
162
    int32_t playerai,angleinterpolation,obituaries;
162
    int32_t playerai,angleinterpolation,obituaries;
163
163
164
    int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
164
    int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
165
    int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
165
    int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
166
    int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
166
    int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
167
    int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
167
    int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
168
168
169
    vec2_t m_origin;
169
    vec2_t m_origin;
170
    int32_t playerbest;
170
    int32_t playerbest;
171
171
172
    int32_t configversion;
172
    int32_t configversion;
173
#if !defined LUNATIC
173
#if !defined LUNATIC
174
    int16_t cameraang, camerasect, camerahoriz;
174
    int16_t cameraang, camerasect, camerahoriz;
175
#endif
175
#endif
176
    int16_t pause_on,from_bonus;
176
    int16_t pause_on,from_bonus;
177
    int16_t camerasprite,last_camsprite;
177
    int16_t camerasprite,last_camsprite;
178
    int16_t last_level,secretlevel, bgstretch;
178
    int16_t last_level,secretlevel, bgstretch;
179
179
180
    struct {
180
    struct {
181
        int32_t UseJoystick;
181
        int32_t UseJoystick;
182
        int32_t UseMouse;
182
        int32_t UseMouse;
183
        int32_t AutoAim;
183
        int32_t AutoAim;
184
        int32_t ShowOpponentWeapons;
184
        int32_t ShowOpponentWeapons;
185
        int32_t MouseDeadZone,MouseBias;
185
        int32_t MouseDeadZone,MouseBias;
186
        int32_t SmoothInput;
186
        int32_t SmoothInput;
187
187
188
        // JBF 20031211: Store the input settings because
188
        // JBF 20031211: Store the input settings because
189
        // (currently) jmact can't regurgitate them
189
        // (currently) jmact can't regurgitate them
190
        int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
190
        int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
191
        int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
191
        int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
192
        int32_t MouseAnalogueAxes[MAXMOUSEAXES];
192
        int32_t MouseAnalogueAxes[MAXMOUSEAXES];
193
        int32_t MouseAnalogueScale[MAXMOUSEAXES];
193
        int32_t MouseAnalogueScale[MAXMOUSEAXES];
194
        int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
194
        int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2];
195
        int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
195
        int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
196
        int32_t JoystickAnalogueAxes[MAXJOYAXES];
196
        int32_t JoystickAnalogueAxes[MAXJOYAXES];
197
        int32_t JoystickAnalogueScale[MAXJOYAXES];
197
        int32_t JoystickAnalogueScale[MAXJOYAXES];
198
        int32_t JoystickAnalogueDead[MAXJOYAXES];
198
        int32_t JoystickAnalogueDead[MAXJOYAXES];
199
        int32_t JoystickAnalogueSaturate[MAXJOYAXES];
199
        int32_t JoystickAnalogueSaturate[MAXJOYAXES];
200
        uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
200
        uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
201
201
202
        //
202
        //
203
        // Sound variables
203
        // Sound variables
204
        //
204
        //
205
        int32_t FXDevice;
-
 
206
        int32_t MusicDevice;
-
 
207
        int32_t MasterVolume;
205
        int32_t MasterVolume;
208
        int32_t FXVolume;
206
        int32_t FXVolume;
209
        int32_t MusicVolume;
207
        int32_t MusicVolume;
210
        int32_t SoundToggle;
208
        int32_t SoundToggle;
211
        int32_t MusicToggle;
209
        int32_t MusicToggle;
212
        int32_t VoiceToggle;
210
        int32_t VoiceToggle;
213
        int32_t AmbienceToggle;
211
        int32_t AmbienceToggle;
214
212
215
        int32_t NumVoices;
213
        int32_t NumVoices;
216
        int32_t NumChannels;
214
        int32_t NumChannels;
217
        int32_t NumBits;
215
        int32_t NumBits;
218
        int32_t MixRate;
216
        int32_t MixRate;
219
217
220
        int32_t ReverseStereo;
218
        int32_t ReverseStereo;
221
219
222
        //
220
        //
223
        // Screen variables
221
        // Screen variables
224
        //
222
        //
225
223
226
        int32_t ScreenMode;
224
        int32_t ScreenMode;
227
225
228
        int32_t ScreenWidth;
226
        int32_t ScreenWidth;
229
        int32_t ScreenHeight;
227
        int32_t ScreenHeight;
230
        int32_t ScreenBPP;
228
        int32_t ScreenBPP;
231
229
232
        int32_t ForceSetup;
230
        int32_t ForceSetup;
233
        int32_t NoAutoLoad;
231
        int32_t NoAutoLoad;
234
232
235
        int32_t scripthandle;
233
        int32_t scripthandle;
236
        int32_t setupread;
234
        int32_t setupread;
237
235
238
        int32_t CheckForUpdates;
236
        int32_t CheckForUpdates;
239
        int32_t LastUpdateCheck;
237
        int32_t LastUpdateCheck;
240
        int32_t useprecache;
238
        int32_t useprecache;
241
    } config;
239
    } config;
242
240
243
    char overhead_on,last_overhead,showweapons;
241
    char overhead_on,last_overhead,showweapons;
244
    char god,warp_on,cashman,eog,showallmap;
242
    char god,warp_on,cashman,eog,showallmap;
245
    char show_help,scrollmode,noclip;
243
    char show_help,scrollmode,noclip;
246
    char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
244
    char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
247
    char savegame[MAXSAVEGAMES][MAXSAVEGAMENAME];
245
    char savegame[MAXSAVEGAMES][MAXSAVEGAMENAME];
248
    char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
246
    char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
249
    char display_bonus_screen;
247
    char display_bonus_screen;
250
    char show_level_text;
248
    char show_level_text;
251
} user_defs;
249
} user_defs;
252
250
253
251
254
// this is checked against http://eduke32.com/VERSION
252
// this is checked against http://eduke32.com/VERSION
255
extern const char *s_buildDate;
253
extern const char *s_buildDate;
256
254
257
extern const char *g_rtsNamePtr;
255
extern const char *g_rtsNamePtr;
258
256
259
extern char CheatStrings[][MAXCHEATLEN];
257
extern char CheatStrings[][MAXCHEATLEN];
260
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
258
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
261
extern char boardfilename[BMAX_PATH];
259
extern char boardfilename[BMAX_PATH];
262
260
263
extern const char *defaultrtsfilename[GAMECOUNT];
261
extern const char *defaultrtsfilename[GAMECOUNT];
264
extern const char *G_DefaultRtsFile(void);
262
extern const char *G_DefaultRtsFile(void);
265
263
266
#ifdef LEGACY_ROR
264
#ifdef LEGACY_ROR
267
extern char ror_protectedsectors[MAXSECTORS];
265
extern char ror_protectedsectors[MAXSECTORS];
268
#endif
266
#endif
269
267
270
extern float r_ambientlight;
268
extern float r_ambientlight;
271
269
272
extern int32_t althud_flashing;
270
extern int32_t althud_flashing;
273
extern int32_t althud_numberpal;
271
extern int32_t althud_numberpal;
274
extern int32_t althud_numbertile;
272
extern int32_t althud_numbertile;
275
extern int32_t althud_shadows;
273
extern int32_t althud_shadows;
276
274
277
extern int32_t g_Shareware;
275
extern int32_t g_Shareware;
278
#if !defined LUNATIC
276
#if !defined LUNATIC
279
extern int32_t g_cameraClock;
277
extern int32_t g_cameraClock;
280
extern int32_t g_cameraDistance;
278
extern int32_t g_cameraDistance;
281
#endif
279
#endif
282
extern int32_t g_crosshairSum;
280
extern int32_t g_crosshairSum;
283
extern int32_t g_doQuickSave;
281
extern int32_t g_doQuickSave;
284
extern int32_t g_forceWeaponChoice;
282
extern int32_t g_forceWeaponChoice;
285
extern int32_t g_fakeMultiMode;
283
extern int32_t g_fakeMultiMode;
286
extern int32_t g_levelTextTime;
284
extern int32_t g_levelTextTime;
287
extern int32_t g_noSetup;
285
extern int32_t g_noSetup;
288
extern int32_t g_quitDeadline;
286
extern int32_t g_quitDeadline;
289
extern int32_t g_restorePalette;
287
extern int32_t g_restorePalette;
290
extern int32_t hud_glowingquotes;
288
extern int32_t hud_glowingquotes;
291
extern int32_t hud_showmapname;
289
extern int32_t hud_showmapname;
292
extern int32_t quotebot;
290
extern int32_t quotebot;
293
extern int32_t quotebotgoal;
291
extern int32_t quotebotgoal;
294
extern int32_t r_maxfps;
292
extern int32_t r_maxfps;
295
extern int32_t tempwallptr;
293
extern int32_t tempwallptr;
296
extern int32_t ticrandomseed;
294
extern int32_t ticrandomseed;
297
extern int32_t vote_map;
295
extern int32_t vote_map;
298
extern int32_t voting;
296
extern int32_t voting;
299
297
300
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
298
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
301
299
302
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
300
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
303
301
304
extern palette_t CrosshairColors;
302
extern palette_t CrosshairColors;
305
extern palette_t DefaultCrosshairColors;
303
extern palette_t DefaultCrosshairColors;
306
304
307
extern uint32_t g_frameDelay;
305
extern uint32_t g_frameDelay;
308
306
309
extern user_defs ud;
307
extern user_defs ud;
310
308
311
int32_t A_CheckInventorySprite(spritetype *s);
309
int32_t A_CheckInventorySprite(spritetype *s);
312
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
310
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
313
int32_t A_Spawn(int32_t j,int32_t pn);
311
int32_t A_Spawn(int32_t j,int32_t pn);
314
int32_t G_DoMoveThings(void);
312
int32_t G_DoMoveThings(void);
315
//int32_t G_EndOfLevel(void);
313
//int32_t G_EndOfLevel(void);
316
int32_t G_GameTextLen(int32_t x,const char *t);
314
int32_t G_GameTextLen(int32_t x,const char *t);
317
int32_t G_PrintGameText(int32_t hack,int32_t tile,int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t o,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z, int32_t a);
315
int32_t G_PrintGameText(int32_t hack,int32_t tile,int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t o,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z, int32_t a);
318
extern int32_t minitext_lowercase;
316
extern int32_t minitext_lowercase;
319
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
317
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
320
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
318
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
321
319
322
#ifdef YAX_ENABLE
320
#ifdef YAX_ENABLE
323
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
321
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
324
#else
322
#else
325
#define Yax_SetBunchZs(sectnum, cf, daz)
323
#define Yax_SetBunchZs(sectnum, cf, daz)
326
#endif
324
#endif
327
325
328
#ifdef LUNATIC
326
#ifdef LUNATIC
329
void El_CreateGameState(void);
327
void El_CreateGameState(void);
330
#endif
328
#endif
331
void G_PostCreateGameState(void);
329
void G_PostCreateGameState(void);
332
330
333
void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n);
331
void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n);
334
void A_SpawnGlass(int32_t i,int32_t n);
332
void A_SpawnGlass(int32_t i,int32_t n);
335
void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n);
333
void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n);
336
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
334
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
337
void G_AddUserQuote(const char *daquote);
335
void G_AddUserQuote(const char *daquote);
338
void G_BackToMenu(void);
336
void G_BackToMenu(void);
339
337
340
const char* G_PrintYourTime(void);
338
const char* G_PrintYourTime(void);
341
const char* G_PrintParTime(void);
339
const char* G_PrintParTime(void);
342
const char* G_PrintDesignerTime(void);
340
const char* G_PrintDesignerTime(void);
343
const char* G_PrintBestTime(void);
341
const char* G_PrintBestTime(void);
344
void G_BonusScreen(int32_t bonusonly);
342
void G_BonusScreen(int32_t bonusonly);
345
//void G_CheatGetInv(void);
343
//void G_CheatGetInv(void);
346
void G_DisplayRest(int32_t smoothratio);
344
void G_DisplayRest(int32_t smoothratio);
347
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
345
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
348
void G_DrawBackground(void);
346
void G_DrawBackground(void);
349
void G_DrawFrags(void);
347
void G_DrawFrags(void);
350
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
348
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
351
void G_DrawRooms(int32_t snum,int32_t smoothratio);
349
void G_DrawRooms(int32_t snum,int32_t smoothratio);
352
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
350
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
353
#if !defined LUNATIC
351
#if !defined LUNATIC
354
void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
352
void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
355
void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
353
void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
356
void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
354
void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
357
void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
355
void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
358
#endif
356
#endif
359
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
357
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
360
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
358
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
361
void G_GameQuit(void);
359
void G_GameQuit(void);
362
void G_GetCrosshairColor(void);
360
void G_GetCrosshairColor(void);
363
void G_HandleLocalKeys(void);
361
void G_HandleLocalKeys(void);
364
void G_HandleSpecialKeys(void);
362
void G_HandleSpecialKeys(void);
365
void G_UpdateAppTitle(void);
363
void G_UpdateAppTitle(void);
366
void G_PrintGameQuotes(int32_t snum);
364
void G_PrintGameQuotes(int32_t snum);
367
//void G_SE40(int32_t smoothratio);
365
//void G_SE40(int32_t smoothratio);
368
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
366
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
369
void G_Shutdown(void);
367
void G_Shutdown(void);
370
void G_UpdatePlayerFromMenu(void);
368
void G_UpdatePlayerFromMenu(void);
371
void M32RunScript(const char *s);
369
void M32RunScript(const char *s);
372
void P_DoQuote(int32_t q,DukePlayer_t *p);
370
void P_DoQuote(int32_t q,DukePlayer_t *p);
373
extern int32_t textsc(int32_t sc);
371
extern int32_t textsc(int32_t sc);
374
void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
372
void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
375
373
376
extern int32_t G_GetStringLineLength(const char *text, const char *end, const int32_t iter);
374
extern int32_t G_GetStringLineLength(const char *text, const char *end, const int32_t iter);
377
extern int32_t G_GetStringNumLines(const char *text, const char *end, const int32_t iter);
375
extern int32_t G_GetStringNumLines(const char *text, const char *end, const int32_t iter);
378
extern char* G_GetSubString(const char *text, const char *end, const int32_t iter, const int32_t length);
376
extern char* G_GetSubString(const char *text, const char *end, const int32_t iter, const int32_t length);
379
extern int32_t G_GetStringTile(int32_t font, char *t, int32_t f);
377
extern int32_t G_GetStringTile(int32_t font, char *t, int32_t f);
380
extern vec2_t G_ScreenTextSize(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const char *str, const int32_t o, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2);
378
extern vec2_t G_ScreenTextSize(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const char *str, const int32_t o, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, const int32_t x1, const int32_t y1, const int32_t x2, const int32_t y2);
381
extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, const int32_t magnitude);
379
extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, const int32_t magnitude);
382
extern vec2_t G_ScreenText(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
380
extern vec2_t G_ScreenText(const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
383
extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, const int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
381
extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, const int32_t font, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, const char *str, const int32_t shade, int32_t pal, int32_t o, const int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, const int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
384
382
385
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
383
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
386
    if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
384
    if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
387
} while (0)
385
} while (0)
388
386
389
// Cstat protection mask for (currently) spawned MASKWALL* sprites.
387
// Cstat protection mask for (currently) spawned MASKWALL* sprites.
390
// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()?
388
// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()?
391
// 2048+(32+16)+8+4
389
// 2048+(32+16)+8+4
392
#define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP);
390
#define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP);
393
391
394
int32_t app_main(int32_t argc,const char **argv);
392
int32_t app_main(int32_t argc,const char **argv);
395
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
393
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
396
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
394
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
397
void G_InitTimer(int32_t ticpersec);
395
void G_InitTimer(int32_t ticpersec);
398
396
399
static inline int32_t G_GetTeamPalette(int32_t team)
397
static inline int32_t G_GetTeamPalette(int32_t team)
400
{
398
{
401
    int8_t pal[] = { 3, 10, 11, 12 };
399
    int8_t pal[] = { 3, 10, 11, 12 };
402
400
403
    if ((unsigned)team >= ARRAY_SIZE(pal))
401
    if ((unsigned)team >= ARRAY_SIZE(pal))
404
        return 0;
402
        return 0;
405
403
406
    return pal[team];
404
    return pal[team];
407
}
405
}
408
406
409
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
407
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
410
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
408
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
411
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16)
409
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16)
412
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
410
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
413
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
411
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
414
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
412
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
415
#define gametextpalbits(x,y,t,s,p,dabits,a) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536, a)
413
#define gametextpalbits(x,y,t,s,p,dabits,a) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536, a)
416
#define mpgametext(y, t, s, dabits) G_PrintGameText(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0);
414
#define mpgametext(y, t, s, dabits) G_PrintGameText(4,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0);
417
415
418
#define A_CheckSpriteFlags(iActor, iType) (((g_tile[sprite[iActor].picnum].flags^actor[iActor].flags) & iType) != 0)
416
#define A_CheckSpriteFlags(iActor, iType) (((g_tile[sprite[iActor].picnum].flags^actor[iActor].flags) & iType) != 0)
419
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
417
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
420
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)
418
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)
421
#define S_StopSound(num) S_StopEnvSound(num, -1)
419
#define S_StopSound(num) S_StopEnvSound(num, -1)
422
420
423
extern int32_t G_StartRTS(int32_t i, int localp);
421
extern int32_t G_StartRTS(int32_t i, int localp);
424
422
425
extern void G_MaybeAllocPlayer(int32_t pnum);
423
extern void G_MaybeAllocPlayer(int32_t pnum);
426
424
427
static inline void G_HandleAsync(void)
425
static inline void G_HandleAsync(void)
428
{
426
{
429
    handleevents();
427
    handleevents();
430
    Net_GetPackets();
428
    Net_GetPackets();
431
}
429
}
432
430
433
static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk)
431
static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk)
434
{
432
{
435
    return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536);
433
    return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536);
436
}
434
}
437
435
438
// sector effector lotags
436
// sector effector lotags
439
enum {
437
enum {
440
    SE_0_ROTATING_SECTOR = 0,
438
    SE_0_ROTATING_SECTOR = 0,
441
    SE_1_PIVOT = 1,
439
    SE_1_PIVOT = 1,
442
    SE_2_EARTHQUAKE = 2,
440
    SE_2_EARTHQUAKE = 2,
443
    SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
441
    SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
444
    SE_4_RANDOM_LIGHTS = 4,
442
    SE_4_RANDOM_LIGHTS = 4,
445
    SE_5 = 5,
443
    SE_5 = 5,
446
    SE_6_SUBWAY = 6,
444
    SE_6_SUBWAY = 6,
447
    // ^^ potentially incomplete substitution in code
445
    // ^^ potentially incomplete substitution in code
448
    // vv almost surely complete substitution
446
    // vv almost surely complete substitution
449
    SE_7_TELEPORT = 7,
447
    SE_7_TELEPORT = 7,
450
    SE_8_UP_OPEN_DOOR_LIGHTS = 8,
448
    SE_8_UP_OPEN_DOOR_LIGHTS = 8,
451
    SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
449
    SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
452
    SE_10_DOOR_AUTO_CLOSE = 10,
450
    SE_10_DOOR_AUTO_CLOSE = 10,
453
    SE_11_SWINGING_DOOR = 11,
451
    SE_11_SWINGING_DOOR = 11,
454
    SE_12_LIGHT_SWITCH = 12,
452
    SE_12_LIGHT_SWITCH = 12,
455
    SE_13_EXPLOSIVE = 13,
453
    SE_13_EXPLOSIVE = 13,
456
    SE_14_SUBWAY_CAR = 14,
454
    SE_14_SUBWAY_CAR = 14,
457
    SE_15_SLIDING_DOOR = 15,
455
    SE_15_SLIDING_DOOR = 15,
458
    SE_16_REACTOR = 16,
456
    SE_16_REACTOR = 16,
459
    SE_17_WARP_ELEVATOR = 17,
457
    SE_17_WARP_ELEVATOR = 17,
460
    SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
458
    SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
461
    SE_19_EXPLOSION_LOWERS_CEILING = 19,
459
    SE_19_EXPLOSION_LOWERS_CEILING = 19,
462
    SE_20_STRETCH_BRIDGE = 20,
460
    SE_20_STRETCH_BRIDGE = 20,
463
    SE_21_DROP_FLOOR = 21,
461
    SE_21_DROP_FLOOR = 21,
464
    SE_22_TEETH_DOOR = 22,
462
    SE_22_TEETH_DOOR = 22,
465
    SE_23_ONE_WAY_TELEPORT = 23,
463
    SE_23_ONE_WAY_TELEPORT = 23,
466
    SE_24_CONVEYOR = 24,
464
    SE_24_CONVEYOR = 24,
467
    SE_25_PISTON = 25,
465
    SE_25_PISTON = 25,
468
    SE_26 = 26,
466
    SE_26 = 26,
469
    SE_27_DEMO_CAM = 27,
467
    SE_27_DEMO_CAM = 27,
470
    SE_28_LIGHTNING = 28,
468
    SE_28_LIGHTNING = 28,
471
    SE_29_WAVES = 29,
469
    SE_29_WAVES = 29,
472
    SE_30_TWO_WAY_TRAIN = 30,
470
    SE_30_TWO_WAY_TRAIN = 30,
473
    SE_31_FLOOR_RISE_FALL = 31,
471
    SE_31_FLOOR_RISE_FALL = 31,
474
    SE_32_CEILING_RISE_FALL = 32,
472
    SE_32_CEILING_RISE_FALL = 32,
475
    SE_33_QUAKE_DEBRIS = 33,
473
    SE_33_QUAKE_DEBRIS = 33,
476
    SE_34 = 34,  // XXX
474
    SE_34 = 34,  // XXX
477
    SE_35 = 35,  // XXX
475
    SE_35 = 35,  // XXX
478
    SE_36_PROJ_SHOOTER = 36,
476
    SE_36_PROJ_SHOOTER = 36,
479
    SE_49_POINT_LIGHT = 49,
477
    SE_49_POINT_LIGHT = 49,
480
    SE_50_SPOT_LIGHT = 50,
478
    SE_50_SPOT_LIGHT = 50,
481
    SE_130 = 130,
479
    SE_130 = 130,
482
    SE_131 = 131,
480
    SE_131 = 131,
483
};
481
};
484
482
485
// sector lotags
483
// sector lotags
486
enum {
484
enum {
487
    ST_1_ABOVE_WATER = 1,
485
    ST_1_ABOVE_WATER = 1,
488
    ST_2_UNDERWATER = 2,
486
    ST_2_UNDERWATER = 2,
489
    ST_3 = 3,
487
    ST_3 = 3,
490
    // ^^^ maybe not complete substitution in code
488
    // ^^^ maybe not complete substitution in code
491
    ST_9_SLIDING_ST_DOOR = 9,
489
    ST_9_SLIDING_ST_DOOR = 9,
492
    ST_15_WARP_ELEVATOR = 15,
490
    ST_15_WARP_ELEVATOR = 15,
493
    ST_16_PLATFORM_DOWN = 16,
491
    ST_16_PLATFORM_DOWN = 16,
494
    ST_17_PLATFORM_UP = 17,
492
    ST_17_PLATFORM_UP = 17,
495
    ST_18_ELEVATOR_DOWN = 18,
493
    ST_18_ELEVATOR_DOWN = 18,
496
    ST_19_ELEVATOR_UP = 19,
494
    ST_19_ELEVATOR_UP = 19,
497
    ST_20_CEILING_DOOR = 20,
495
    ST_20_CEILING_DOOR = 20,
498
    ST_21_FLOOR_DOOR = 21,
496
    ST_21_FLOOR_DOOR = 21,
499
    ST_22_SPLITTING_DOOR = 22,
497
    ST_22_SPLITTING_DOOR = 22,
500
    ST_23_SWINGING_DOOR = 23,
498
    ST_23_SWINGING_DOOR = 23,
501
    ST_25_SLIDING_DOOR = 25,
499
    ST_25_SLIDING_DOOR = 25,
502
    ST_26_SPLITTING_ST_DOOR = 26,
500
    ST_26_SPLITTING_ST_DOOR = 26,
503
    ST_27_STRETCH_BRIDGE = 27,
501
    ST_27_STRETCH_BRIDGE = 27,
504
    ST_28_DROP_FLOOR = 28,
502
    ST_28_DROP_FLOOR = 28,
505
    ST_29_TEETH_DOOR = 29,
503
    ST_29_TEETH_DOOR = 29,
506
    ST_30_ROTATE_RISE_BRIDGE = 30,
504
    ST_30_ROTATE_RISE_BRIDGE = 30,
507
    ST_31_TWO_WAY_TRAIN = 31,
505
    ST_31_TWO_WAY_TRAIN = 31,
508
    // left: ST 32767, 65534, 65535
506
    // left: ST 32767, 65534, 65535
509
};
507
};
510
508
511
// Cheats
509
// Cheats
512
// KEEPINSYNC game.c: char CheatStrings[][]
510
// KEEPINSYNC game.c: char CheatStrings[][]
513
enum cheatindex_t
511
enum cheatindex_t
514
{
512
{
515
    CHEAT_CORNHOLIO,  // 0
513
    CHEAT_CORNHOLIO,  // 0
516
    CHEAT_STUFF,
514
    CHEAT_STUFF,
517
    CHEAT_SCOTTY,
515
    CHEAT_SCOTTY,
518
    CHEAT_COORDS,
516
    CHEAT_COORDS,
519
    CHEAT_VIEW,
517
    CHEAT_VIEW,
520
    CHEAT_TIME,  // 5
518
    CHEAT_TIME,  // 5
521
    CHEAT_UNLOCK,
519
    CHEAT_UNLOCK,
522
    CHEAT_CASHMAN,
520
    CHEAT_CASHMAN,
523
    CHEAT_ITEMS,
521
    CHEAT_ITEMS,
524
    CHEAT_RATE,
522
    CHEAT_RATE,
525
    CHEAT_SKILL,  // 10
523
    CHEAT_SKILL,  // 10
526
    CHEAT_BETA,
524
    CHEAT_BETA,
527
    CHEAT_HYPER,
525
    CHEAT_HYPER,
528
    CHEAT_MONSTERS,
526
    CHEAT_MONSTERS,
529
    CHEAT_RESERVED,
527
    CHEAT_RESERVED,
530
    CHEAT_RESERVED2,  // 15
528
    CHEAT_RESERVED2,  // 15
531
    CHEAT_TODD,
529
    CHEAT_TODD,
532
    CHEAT_SHOWMAP,
530
    CHEAT_SHOWMAP,
533
    CHEAT_KROZ,
531
    CHEAT_KROZ,
534
    CHEAT_ALLEN,
532
    CHEAT_ALLEN,
535
    CHEAT_CLIP,  // 20
533
    CHEAT_CLIP,  // 20
536
    CHEAT_WEAPONS,
534
    CHEAT_WEAPONS,
537
    CHEAT_INVENTORY,
535
    CHEAT_INVENTORY,
538
    CHEAT_KEYS,
536
    CHEAT_KEYS,
539
    CHEAT_DEBUG,
537
    CHEAT_DEBUG,
540
    CHEAT_RESERVED3,  // 25
538
    CHEAT_RESERVED3,  // 25
541
    CHEAT_COMEGETSOME,
539
    CHEAT_COMEGETSOME,
542
};
540
};
543
541
544
542
545
# define G_ModDirSnprintf(buf, size, basename, ...) \
543
# define G_ModDirSnprintf(buf, size, basename, ...) \
546
( \
544
( \
547
    ( \
545
    ( \
548
        (g_modDir[0] != '/') ? \
546
        (g_modDir[0] != '/') ? \
549
            Bsnprintf(buf, size, "%s/" basename, g_modDir, ## __VA_ARGS__) : \
547
            Bsnprintf(buf, size, "%s/" basename, g_modDir, ## __VA_ARGS__) : \
550
            Bsnprintf(buf, size, basename, ## __VA_ARGS__) \
548
            Bsnprintf(buf, size, basename, ## __VA_ARGS__) \
551
    ) >= ((int32_t)size)-1 \
549
    ) >= ((int32_t)size)-1 \
552
)
550
)
553
551
554
#include "game_inline.h"
552
#include "game_inline.h"
555
553
556
static inline void G_NewGame_EnterLevel(void)
554
static inline void G_NewGame_EnterLevel(void)
557
{
555
{
558
    G_NewGame(ud.m_volume_number, ud.m_level_number, ud.m_player_skill);
556
    G_NewGame(ud.m_volume_number, ud.m_level_number, ud.m_player_skill);
559
557
560
    if (G_EnterLevel(MODE_GAME))
558
    if (G_EnterLevel(MODE_GAME))
561
        G_BackToMenu();
559
        G_BackToMenu();
562
}
560
}
563
561
564
static inline int32_t G_GetMusicIdx(const char *str)
562
static inline int32_t G_GetMusicIdx(const char *str)
565
{
563
{
566
    int32_t lev, ep;
564
    int32_t lev, ep;
567
    char b1, b2;
565
    char b1, b2;
568
566
569
    int32_t matches = sscanf(str, "%c%d%c%d", &b1,&ep, &b2,&lev);
567
    int32_t matches = sscanf(str, "%c%d%c%d", &b1,&ep, &b2,&lev);
570
568
571
    if (matches != 4 || Btoupper(b1) != 'E' || Btoupper(b2) != 'L')
569
    if (matches != 4 || Btoupper(b1) != 'E' || Btoupper(b2) != 'L')
572
        return -1;
570
        return -1;
573
571
574
    if ((unsigned)--lev >= MAXLEVELS || (unsigned)--ep >= MAXVOLUMES)
572
    if ((unsigned)--lev >= MAXLEVELS || (unsigned)--ep >= MAXVOLUMES)
575
        return -2;
573
        return -2;
576
574
577
    return (ep * MAXLEVELS) + lev;
575
    return (ep * MAXLEVELS) + lev;
578
}
576
}
579
577
580
extern void G_StartMusic(void);
578
extern void G_StartMusic(void);
581
579
582
#ifdef LUNATIC
580
#ifdef LUNATIC
583
void El_SetCON(const char *conluacode);
581
void El_SetCON(const char *conluacode);
584
void G_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
582
void G_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
585
                       int32_t shade, int32_t orientation, int32_t p);
583
                       int32_t shade, int32_t orientation, int32_t p);
586
#endif
584
#endif
587
585
588
#ifdef __cplusplus
586
#ifdef __cplusplus
589
}
587
}
590
#endif
588
#endif
591
589
592
#endif
590
#endif
593
 
591