Subversion Repositories eduke32

Rev

Rev 4989 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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