Subversion Repositories eduke32

Rev

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

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