Subversion Repositories eduke32

Rev

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

Rev 3008 Rev 3053
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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
#define USERQUOTE_LEFTOFFSET    5
26
#define USERQUOTE_LEFTOFFSET    5
27
#define USERQUOTE_RIGHTOFFSET   14
27
#define USERQUOTE_RIGHTOFFSET   14
28
28
29
enum GametypeFlags_t {
29
enum GametypeFlags_t {
30
    GAMETYPE_COOP                   = 0x00000001,
30
    GAMETYPE_COOP                   = 0x00000001,
31
    GAMETYPE_WEAPSTAY               = 0x00000002,
31
    GAMETYPE_WEAPSTAY               = 0x00000002,
32
    GAMETYPE_FRAGBAR                = 0x00000004,
32
    GAMETYPE_FRAGBAR                = 0x00000004,
33
    GAMETYPE_SCORESHEET             = 0x00000008,
33
    GAMETYPE_SCORESHEET             = 0x00000008,
34
    GAMETYPE_DMSWITCHES             = 0x00000010,
34
    GAMETYPE_DMSWITCHES             = 0x00000010,
35
    GAMETYPE_COOPSPAWN              = 0x00000020,
35
    GAMETYPE_COOPSPAWN              = 0x00000020,
36
    GAMETYPE_ACCESSCARDSPRITES      = 0x00000040,
36
    GAMETYPE_ACCESSCARDSPRITES      = 0x00000040,
37
    GAMETYPE_COOPVIEW               = 0x00000080,
37
    GAMETYPE_COOPVIEW               = 0x00000080,
38
    GAMETYPE_COOPSOUND              = 0x00000100,
38
    GAMETYPE_COOPSOUND              = 0x00000100,
39
    GAMETYPE_OTHERPLAYERSINMAP      = 0x00000200,
39
    GAMETYPE_OTHERPLAYERSINMAP      = 0x00000200,
40
    GAMETYPE_ITEMRESPAWN            = 0x00000400,
40
    GAMETYPE_ITEMRESPAWN            = 0x00000400,
41
    GAMETYPE_MARKEROPTION           = 0x00000800,
41
    GAMETYPE_MARKEROPTION           = 0x00000800,
42
    GAMETYPE_PLAYERSFRIENDLY        = 0x00001000,
42
    GAMETYPE_PLAYERSFRIENDLY        = 0x00001000,
43
    GAMETYPE_FIXEDRESPAWN           = 0x00002000,
43
    GAMETYPE_FIXEDRESPAWN           = 0x00002000,
44
    GAMETYPE_ACCESSATSTART          = 0x00004000,
44
    GAMETYPE_ACCESSATSTART          = 0x00004000,
45
    GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
45
    GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
46
    GAMETYPE_TDM                    = 0x00010000,
46
    GAMETYPE_TDM                    = 0x00010000,
47
    GAMETYPE_TDMSPAWN               = 0x00020000
47
    GAMETYPE_TDMSPAWN               = 0x00020000
48
};
48
};
49
49
50
// logo control
50
// logo control
51
enum LogoFlags_t {
51
enum LogoFlags_t {
52
    LOGO_ENABLED           = 0x00000001,
52
    LOGO_ENABLED           = 0x00000001,
53
    LOGO_PLAYANIM          = 0x00000002,
53
    LOGO_PLAYANIM          = 0x00000002,
54
    LOGO_PLAYMUSIC         = 0x00000004,
54
    LOGO_PLAYMUSIC         = 0x00000004,
55
    LOGO_3DRSCREEN         = 0x00000008,
55
    LOGO_3DRSCREEN         = 0x00000008,
56
    LOGO_TITLESCREEN       = 0x00000010,
56
    LOGO_TITLESCREEN       = 0x00000010,
57
    LOGO_DUKENUKEM         = 0x00000020,
57
    LOGO_DUKENUKEM         = 0x00000020,
58
    LOGO_THREEDEE          = 0x00000040,
58
    LOGO_THREEDEE          = 0x00000040,
59
    LOGO_PLUTOPAKSPRITE    = 0x00000080,
59
    LOGO_PLUTOPAKSPRITE    = 0x00000080,
60
    LOGO_SHAREWARESCREENS  = 0x00000100,
60
    LOGO_SHAREWARESCREENS  = 0x00000100,
61
    LOGO_TENSCREEN         = 0x00000200
61
    LOGO_TENSCREEN         = 0x00000200
62
};
62
};
63
63
64
typedef enum basepal_ {
64
typedef enum basepal_ {
65
    BASEPAL = 0,
65
    BASEPAL = 0,
66
    WATERPAL,
66
    WATERPAL,
67
    SLIMEPAL,
67
    SLIMEPAL,
68
    DREALMSPAL,
68
    DREALMSPAL,
69
    TITLEPAL,
69
    TITLEPAL,
70
    ENDINGPAL,  // 5
70
    ENDINGPAL,  // 5
71
    ANIMPAL,
71
    ANIMPAL,
72
    BASEPALCOUNT
72
    BASEPALCOUNT
73
} basepal_t;
73
} basepal_t;
74
74
75
void A_DeleteSprite(int32_t s);
75
void A_DeleteSprite(int32_t s);
76
76
77
typedef struct {
77
typedef struct {
78
    vec3_t camera;
78
    vec3_t camera;
79
    int32_t const_visibility,uw_framerate;
79
    int32_t const_visibility,uw_framerate;
80
    int32_t camera_time,folfvel,folavel,folx,foly,fola;
80
    int32_t camera_time,folfvel,folavel,folx,foly,fola;
81
    int32_t reccnt,crosshairscale;
81
    int32_t reccnt,crosshairscale;
82
82
83
    int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon;   // JBF 20031125
83
    int32_t runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon;   // JBF 20031125
84
    int32_t democams,color,msgdisptime,statusbarmode;
84
    int32_t democams,color,msgdisptime,statusbarmode;
85
    int32_t m_noexits,noexits,autovote,automsg,idplayers;
85
    int32_t m_noexits,noexits,autovote,automsg,idplayers;
86
    int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
86
    int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
87
87
88
    int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
88
    int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
89
    int32_t coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
89
    int32_t coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
90
    int32_t playerai,angleinterpolation,obituaries;
90
    int32_t playerai,angleinterpolation,obituaries;
91
91
92
    int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
92
    int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
93
    int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
93
    int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
94
    int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
94
    int32_t m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
95
    int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
95
    int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
96
96
97
    int32_t configversion;
97
    int32_t configversion;
98
98
99
    int16_t cameraang, camerasect, camerahoriz;
99
    int16_t cameraang, camerasect, camerahoriz;
100
    int16_t pause_on,from_bonus;
100
    int16_t pause_on,from_bonus;
101
    int16_t camerasprite,last_camsprite;
101
    int16_t camerasprite,last_camsprite;
102
    int16_t last_level,secretlevel, bgstretch;
102
    int16_t last_level,secretlevel, bgstretch;
103
103
104
    struct {
104
    struct {
105
        int32_t UseJoystick;
105
        int32_t UseJoystick;
106
        int32_t UseMouse;
106
        int32_t UseMouse;
107
        int32_t AutoAim;
107
        int32_t AutoAim;
108
        int32_t ShowOpponentWeapons;
108
        int32_t ShowOpponentWeapons;
109
        int32_t MouseDeadZone,MouseBias;
109
        int32_t MouseDeadZone,MouseBias;
110
        int32_t SmoothInput;
110
        int32_t SmoothInput;
111
111
112
        // JBF 20031211: Store the input settings because
112
        // JBF 20031211: Store the input settings because
113
        // (currently) jmact can't regurgitate them
113
        // (currently) jmact can't regurgitate them
114
        int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
114
        int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
115
        int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
115
        int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
116
        int32_t MouseAnalogueAxes[MAXMOUSEAXES];
116
        int32_t MouseAnalogueAxes[MAXMOUSEAXES];
117
        int32_t MouseAnalogueScale[MAXMOUSEAXES];
117
        int32_t MouseAnalogueScale[MAXMOUSEAXES];
118
        int32_t JoystickFunctions[MAXJOYBUTTONS][2];
118
        int32_t JoystickFunctions[MAXJOYBUTTONS][2];
119
        int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
119
        int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
120
        int32_t JoystickAnalogueAxes[MAXJOYAXES];
120
        int32_t JoystickAnalogueAxes[MAXJOYAXES];
121
        int32_t JoystickAnalogueScale[MAXJOYAXES];
121
        int32_t JoystickAnalogueScale[MAXJOYAXES];
122
        int32_t JoystickAnalogueDead[MAXJOYAXES];
122
        int32_t JoystickAnalogueDead[MAXJOYAXES];
123
        int32_t JoystickAnalogueSaturate[MAXJOYAXES];
123
        int32_t JoystickAnalogueSaturate[MAXJOYAXES];
124
        uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
124
        uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
125
125
126
        //
126
        //
127
        // Sound variables
127
        // Sound variables
128
        //
128
        //
129
        int32_t FXDevice;
129
        int32_t FXDevice;
130
        int32_t MusicDevice;
130
        int32_t MusicDevice;
131
        int32_t FXVolume;
131
        int32_t FXVolume;
132
        int32_t MusicVolume;
132
        int32_t MusicVolume;
133
        int32_t SoundToggle;
133
        int32_t SoundToggle;
134
        int32_t MusicToggle;
134
        int32_t MusicToggle;
135
        int32_t VoiceToggle;
135
        int32_t VoiceToggle;
136
        int32_t AmbienceToggle;
136
        int32_t AmbienceToggle;
137
137
138
        int32_t NumVoices;
138
        int32_t NumVoices;
139
        int32_t NumChannels;
139
        int32_t NumChannels;
140
        int32_t NumBits;
140
        int32_t NumBits;
141
        int32_t MixRate;
141
        int32_t MixRate;
142
142
143
        int32_t ReverseStereo;
143
        int32_t ReverseStereo;
144
144
145
        //
145
        //
146
        // Screen variables
146
        // Screen variables
147
        //
147
        //
148
148
149
        int32_t ScreenMode;
149
        int32_t ScreenMode;
150
150
151
        int32_t ScreenWidth;
151
        int32_t ScreenWidth;
152
        int32_t ScreenHeight;
152
        int32_t ScreenHeight;
153
        int32_t ScreenBPP;
153
        int32_t ScreenBPP;
154
154
155
        int32_t ForceSetup;
155
        int32_t ForceSetup;
156
        int32_t NoAutoLoad;
156
        int32_t NoAutoLoad;
157
157
158
        int32_t scripthandle;
158
        int32_t scripthandle;
159
        int32_t setupread;
159
        int32_t setupread;
160
160
161
        int32_t CheckForUpdates;
161
        int32_t CheckForUpdates;
162
        int32_t LastUpdateCheck;
162
        int32_t LastUpdateCheck;
163
        int32_t useprecache;
163
        int32_t useprecache;
164
    } config;
164
    } config;
165
165
166
    char overhead_on,last_overhead,showweapons;
166
    char overhead_on,last_overhead,showweapons;
167
    char god,warp_on,cashman,eog,showallmap;
167
    char god,warp_on,cashman,eog,showallmap;
168
    char show_help,scrollmode,noclip;
168
    char show_help,scrollmode,noclip;
169
    char ridecule[10][40];
169
    char ridecule[10][40];
170
    char savegame[10][22];
170
    char savegame[10][22];
171
    char pwlockout[128],rtsname[128];
171
    char pwlockout[128],rtsname[128];
172
    char display_bonus_screen;
172
    char display_bonus_screen;
173
    char show_level_text;
173
    char show_level_text;
174
} user_defs;
174
} user_defs;
175
175
176
176
177
extern cactype cac[];
177
extern cactype cac[];
178
178
179
// this is checked against http://eduke32.com/VERSION
179
// this is checked against http://eduke32.com/VERSION
180
extern const char *s_buildDate;
180
extern const char *s_buildDate;
181
extern const char *g_gameNamePtr;
181
extern const char *g_gameNamePtr;
182
extern const char *g_rtsNamePtr;
182
extern const char *g_rtsNamePtr;
183
183
184
extern char **g_scriptModules;
184
extern char **g_scriptModules;
185
extern int32_t g_scriptModulesNum;
185
extern int32_t g_scriptModulesNum;
186
186
187
extern char CheatStrings[][MAXCHEATLEN];
187
extern char CheatStrings[][MAXCHEATLEN];
188
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
188
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH];
189
extern char boardfilename[BMAX_PATH];
189
extern char boardfilename[BMAX_PATH];
190
190
191
extern const char *defaultrtsfilename[GAMECOUNT];
191
extern const char *defaultrtsfilename[GAMECOUNT];
192
extern const char *G_DefaultRtsFile(void);
192
extern const char *G_DefaultRtsFile(void);
193
193
194
extern char g_modDir[BMAX_PATH];
194
extern char g_modDir[BMAX_PATH];
195
extern char inputloc;
195
extern char inputloc;
196
extern char ror_protectedsectors[MAXSECTORS];
196
extern char ror_protectedsectors[MAXSECTORS];
197
197
198
extern float r_ambientlight;
198
extern float r_ambientlight;
199
199
200
extern int32_t althud_flashing;
200
extern int32_t althud_flashing;
201
extern int32_t althud_numberpal;
201
extern int32_t althud_numberpal;
202
extern int32_t althud_numbertile;
202
extern int32_t althud_numbertile;
203
extern int32_t althud_shadows;
203
extern int32_t althud_shadows;
204
extern int32_t cacnum;
204
extern int32_t cacnum;
205
//extern int32_t drawing_ror;
205
//extern int32_t drawing_ror;
206
extern int32_t g_Shareware;
206
extern int32_t g_Shareware;
207
extern int32_t g_cameraClock;
207
extern int32_t g_cameraClock;
208
extern int32_t g_cameraDistance;
208
extern int32_t g_cameraDistance;
209
extern int32_t g_cameraDistance;
209
extern int32_t g_cameraDistance;
210
extern int32_t g_crosshairSum;
210
extern int32_t g_crosshairSum;
211
extern int32_t g_doQuickSave;
211
extern int32_t g_doQuickSave;
212
extern int32_t g_forceWeaponChoice;
212
extern int32_t g_forceWeaponChoice;
213
extern int32_t g_fakeMultiMode;
213
extern int32_t g_fakeMultiMode;
214
extern int32_t g_levelTextTime;
214
extern int32_t g_levelTextTime;
215
extern int32_t g_noSetup;
215
extern int32_t g_noSetup;
216
extern int32_t g_quitDeadline;
216
extern int32_t g_quitDeadline;
217
extern int32_t g_restorePalette;
217
extern int32_t g_restorePalette;
218
extern int32_t hud_glowingquotes;
218
extern int32_t hud_glowingquotes;
219
extern int32_t hud_showmapname;
219
extern int32_t hud_showmapname;
220
extern int32_t lastvisinc;
220
extern int32_t lastvisinc;
221
extern int32_t rts_numlumps;
221
extern int32_t rts_numlumps;
222
extern int32_t qsetmode;
222
extern int32_t qsetmode;
223
extern int32_t quotebot;
223
extern int32_t quotebot;
224
extern int32_t quotebotgoal;
224
extern int32_t quotebotgoal;
225
extern int32_t r_maxfps;
225
extern int32_t r_maxfps;
226
extern int32_t tempwallptr;
226
extern int32_t tempwallptr;
227
extern int32_t ticrandomseed;
227
extern int32_t ticrandomseed;
228
extern int32_t vote_map;
228
extern int32_t vote_map;
229
extern int32_t voting;
229
extern int32_t voting;
230
230
231
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
231
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
232
232
233
extern palette_t CrosshairColors;
233
extern palette_t CrosshairColors;
234
extern palette_t DefaultCrosshairColors;
234
extern palette_t DefaultCrosshairColors;
235
235
236
extern uint32_t g_frameDelay;
236
extern uint32_t g_frameDelay;
237
237
238
extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768];
238
extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768];
239
extern uint8_t *basepaltable[BASEPALCOUNT];
239
extern uint8_t *basepaltable[BASEPALCOUNT];
240
extern int8_t g_noFloorPal[MAXPALOOKUPS];
240
extern int8_t g_noFloorPal[MAXPALOOKUPS];
241
241
242
extern user_defs ud;
242
extern user_defs ud;
243
243
244
int32_t A_CheckInventorySprite(spritetype *s);
244
int32_t A_CheckInventorySprite(spritetype *s);
245
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);
245
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);
246
int32_t A_Spawn(int32_t j,int32_t pn);
246
int32_t A_Spawn(int32_t j,int32_t pn);
247
int32_t G_DoMoveThings(void);
247
int32_t G_DoMoveThings(void);
248
//int32_t G_EndOfLevel(void);
248
//int32_t G_EndOfLevel(void);
249
int32_t G_GameTextLen(int32_t x,const char *t);
249
int32_t G_GameTextLen(int32_t x,const char *t);
250
int32_t G_PrintGameText(int32_t f,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);
250
int32_t G_PrintGameText(int32_t f,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);
251
int32_t GetTime(void);
251
int32_t GetTime(void);
252
int32_t kopen4loadfrommod(const char *filename,char searchfirst);
252
int32_t kopen4loadfrommod(const char *filename,char searchfirst);
253
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
253
int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb);
254
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
254
int32_t mpgametext(int32_t y,const char *t,int32_t s,int32_t dabits);
255
int32_t startwin_run(void);
255
int32_t startwin_run(void);
256
256
257
#ifdef YAX_ENABLE
257
#ifdef YAX_ENABLE
258
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
258
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
259
#else
259
#else
260
#define Yax_SetBunchZs(sectnum, cf, daz)
260
#define Yax_SetBunchZs(sectnum, cf, daz)
261
#endif
261
#endif
262
262
263
void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n);
263
void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n);
264
void A_SpawnGlass(int32_t i,int32_t n);
264
void A_SpawnGlass(int32_t i,int32_t n);
265
void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n);
265
void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n);
266
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
266
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
267
void G_AddUserQuote(const char *daquote);
267
void G_AddUserQuote(const char *daquote);
268
void G_BackToMenu(void);
268
void G_BackToMenu(void);
269
void G_BonusScreen(int32_t bonusonly);
269
void G_BonusScreen(int32_t bonusonly);
270
//void G_CheatGetInv(void);
270
//void G_CheatGetInv(void);
271
void G_DisplayRest(int32_t smoothratio);
271
void G_DisplayRest(int32_t smoothratio);
272
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
272
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
273
void G_DrawBackground(void);
273
void G_DrawBackground(void);
274
void G_DrawFrags(void);
274
void G_DrawFrags(void);
275
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
275
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
276
void G_DrawRooms(int32_t snum,int32_t smoothratio);
276
void G_DrawRooms(int32_t snum,int32_t smoothratio);
277
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);
277
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);
278
void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
278
void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
279
void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
279
void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
280
void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
280
void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
281
void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
281
void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
282
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
282
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
283
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
283
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
284
void G_GameQuit(void);
284
void G_GameQuit(void);
285
void G_GetCrosshairColor(void);
285
void G_GetCrosshairColor(void);
286
void G_HandleLocalKeys(void);
286
void G_HandleLocalKeys(void);
287
void G_HandleSpecialKeys(void);
287
void G_HandleSpecialKeys(void);
288
void G_PrintGameQuotes(int32_t snum);
288
void G_PrintGameQuotes(int32_t snum);
289
//void G_SE40(int32_t smoothratio);
289
//void G_SE40(int32_t smoothratio);
290
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
290
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
291
void G_SetStatusBarScale(int32_t sc);
291
void G_SetStatusBarScale(int32_t sc);
292
void G_Shutdown(void);
292
void G_Shutdown(void);
293
void G_UpdatePlayerFromMenu(void);
293
void G_UpdatePlayerFromMenu(void);
294
void M32RunScript(const char *s);
294
void M32RunScript(const char *s);
295
void P_DoQuote(int32_t q,DukePlayer_t *p);
295
void P_DoQuote(int32_t q,DukePlayer_t *p);
296
extern int32_t textsc(int32_t sc);
296
extern int32_t textsc(int32_t sc);
297
void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
297
void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
298
int32_t app_main(int32_t argc,const char **argv);
298
int32_t app_main(int32_t argc,const char **argv);
299
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
299
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
300
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
300
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
301
301
302
static inline int32_t G_GetTeamPalette(int32_t team)
302
static inline int32_t G_GetTeamPalette(int32_t team)
303
{
303
{
304
    int8_t pal[] = { 3, 10, 11, 12 };
304
    int8_t pal[] = { 3, 10, 11, 12 };
305
305
306
    if ((unsigned)team >= (sizeof(pal)/sizeof(pal[0])))
306
    if ((unsigned)team >= (sizeof(pal)/sizeof(pal[0])))
307
        return 0;
307
        return 0;
308
308
309
    return pal[team];
309
    return pal[team];
310
}
310
}
311
311
312
#if defined(_WIN32)
312
#if defined(_WIN32)
313
int32_t G_GetVersionFromWebsite(char *buffer);
313
int32_t G_GetVersionFromWebsite(char *buffer);
314
#endif
314
#endif
315
315
316
#ifdef RENDERTYPEWIN
316
#ifdef RENDERTYPEWIN
317
void app_crashhandler(void);
317
void app_crashhandler(void);
318
#ifdef USE_OPENGL
318
#ifdef USE_OPENGL
319
extern char forcegl;
319
extern char forcegl;
320
#endif
320
#endif
321
#endif
321
#endif
322
322
323
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
323
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
324
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
324
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
325
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16)
325
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16)
326
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
326
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
327
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
327
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
328
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536)
328
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536)
329
#define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536)
329
#define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536)
330
#define A_CheckSpriteFlags(iActor, iType) (((SpriteFlags[sprite[iActor].picnum]^actor[iActor].flags) & iType) != 0)
330
#define A_CheckSpriteFlags(iActor, iType) (((SpriteFlags[sprite[iActor].picnum]^actor[iActor].flags) & iType) != 0)
331
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
331
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
332
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (SpriteFlags[iPicnum] & iType) != 0)
332
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (SpriteFlags[iPicnum] & iType) != 0)
333
#define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c)
333
#define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c)
334
#define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c)
334
#define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c)
335
#define S_StopSound(num) S_StopEnvSound(num, -1)
335
#define S_StopSound(num) S_StopEnvSound(num, -1)
336
336
337
static inline void G_HandleAsync(void)
337
static inline void G_HandleAsync(void)
338
{
338
{
339
    handleevents();
339
    handleevents();
340
    Net_GetPackets();
340
    Net_GetPackets();
341
}
341
}
342
342
343
static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk)
343
static inline int32_t calc_smoothratio(int32_t totalclk, int32_t ototalclk)
344
{
344
{
345
    return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536);
345
    return clamp((totalclk-ototalclk)*(65536/TICSPERFRAME), 0, 65536);
346
}
346
}
347
347
348
// sector effector lotags
348
// sector effector lotags
349
enum {
349
enum {
350
    SE_0_ROTATING_SECTOR = 0,
350
    SE_0_ROTATING_SECTOR = 0,
351
    SE_1_PIVOT = 1,
351
    SE_1_PIVOT = 1,
352
    SE_2_EARTHQUAKE = 2,
352
    SE_2_EARTHQUAKE = 2,
353
    SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
353
    SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
354
    SE_4_RANDOM_LIGHTS = 4,
354
    SE_4_RANDOM_LIGHTS = 4,
355
    SE_5 = 5,
355
    SE_5 = 5,
356
    SE_6_SUBWAY = 6,
356
    SE_6_SUBWAY = 6,
357
    // ^^ potentially incomplete substitution in code
357
    // ^^ potentially incomplete substitution in code
358
    // vv almost surely complete substitution
358
    // vv almost surely complete substitution
359
    SE_7_TELEPORT = 7,
359
    SE_7_TELEPORT = 7,
360
    SE_8_UP_OPEN_DOOR_LIGHTS = 8,
360
    SE_8_UP_OPEN_DOOR_LIGHTS = 8,
361
    SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
361
    SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
362
    SE_10_DOOR_AUTO_CLOSE = 10,
362
    SE_10_DOOR_AUTO_CLOSE = 10,
363
    SE_11_SWINGING_DOOR = 11,
363
    SE_11_SWINGING_DOOR = 11,
364
    SE_12_LIGHT_SWITCH = 12,
364
    SE_12_LIGHT_SWITCH = 12,
365
    SE_13_EXPLOSIVE = 13,
365
    SE_13_EXPLOSIVE = 13,
366
    SE_14_SUBWAY_CAR = 14,
366
    SE_14_SUBWAY_CAR = 14,
367
    SE_15_SLIDING_DOOR = 15,
367
    SE_15_SLIDING_DOOR = 15,
368
    SE_16_REACTOR = 16,
368
    SE_16_REACTOR = 16,
369
    SE_17_WARP_ELEVATOR = 17,
369
    SE_17_WARP_ELEVATOR = 17,
370
    SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
370
    SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
371
    SE_19_EXPLOSION_LOWERS_CEILING = 19,
371
    SE_19_EXPLOSION_LOWERS_CEILING = 19,
372
    SE_20_STRETCH_BRIDGE = 20,
372
    SE_20_STRETCH_BRIDGE = 20,
373
    SE_21_DROP_FLOOR = 21,
373
    SE_21_DROP_FLOOR = 21,
374
    SE_22_TEETH_DOOR = 22,
374
    SE_22_TEETH_DOOR = 22,
375
    SE_23_ONE_WAY_TELEPORT = 23,
375
    SE_23_ONE_WAY_TELEPORT = 23,
376
    SE_24_CONVEYOR = 24,
376
    SE_24_CONVEYOR = 24,
377
    SE_25_PISTON = 25,
377
    SE_25_PISTON = 25,
378
    SE_26 = 26,
378
    SE_26 = 26,
379
    SE_27_DEMO_CAM = 27,
379
    SE_27_DEMO_CAM = 27,
380
    SE_28_LIGHTNING = 28,
380
    SE_28_LIGHTNING = 28,
381
    SE_29_WAVES = 29,
381
    SE_29_WAVES = 29,
382
    SE_30_TWO_WAY_TRAIN = 30,
382
    SE_30_TWO_WAY_TRAIN = 30,
383
    SE_31_FLOOR_RISE_FALL = 31,
383
    SE_31_FLOOR_RISE_FALL = 31,
384
    SE_32_CEILING_RISE_FALL = 32,
384
    SE_32_CEILING_RISE_FALL = 32,
385
    SE_33_QUAKE_DEBRIS = 33,
385
    SE_33_QUAKE_DEBRIS = 33,
386
    SE_34 = 34,  // XXX
386
    SE_34 = 34,  // XXX
387
    SE_35 = 35,  // XXX
387
    SE_35 = 35,  // XXX
388
    SE_36_PROJ_SHOOTER = 36,
388
    SE_36_PROJ_SHOOTER = 36,
-
 
389
    SE_49_POINT_LIGHT = 49,
-
 
390
    SE_50_SPOT_LIGHT = 50,
389
};
391
};
390
392
391
// sector lotags
393
// sector lotags
392
enum {
394
enum {
393
    // left: ST 1 and 2
395
    // left: ST 1 and 2
394
    ST_9_SLIDING_ST_DOOR = 9,
396
    ST_9_SLIDING_ST_DOOR = 9,
395
    ST_15_WARP_ELEVATOR = 15,
397
    ST_15_WARP_ELEVATOR = 15,
396
    ST_16_PLATFORM_DOWN = 16,
398
    ST_16_PLATFORM_DOWN = 16,
397
    ST_17_PLATFORM_UP = 17,
399
    ST_17_PLATFORM_UP = 17,
398
    ST_18_ELEVATOR_DOWN = 18,
400
    ST_18_ELEVATOR_DOWN = 18,
399
    ST_19_ELEVATOR_UP = 19,
401
    ST_19_ELEVATOR_UP = 19,
400
    ST_20_CEILING_DOOR = 20,
402
    ST_20_CEILING_DOOR = 20,
401
    ST_21_FLOOR_DOOR = 21,
403
    ST_21_FLOOR_DOOR = 21,
402
    ST_22_SPLITTING_DOOR = 22,
404
    ST_22_SPLITTING_DOOR = 22,
403
    ST_23_SWINGING_DOOR = 23,
405
    ST_23_SWINGING_DOOR = 23,
404
    ST_25_SLIDING_DOOR = 25,
406
    ST_25_SLIDING_DOOR = 25,
405
    ST_26_SPLITTING_ST_DOOR = 26,
407
    ST_26_SPLITTING_ST_DOOR = 26,
406
    ST_27_STRETCH_BRIDGE = 27,
408
    ST_27_STRETCH_BRIDGE = 27,
407
    ST_28_DROP_FLOOR = 28,
409
    ST_28_DROP_FLOOR = 28,
408
    ST_29_TEETH_DOOR = 29,
410
    ST_29_TEETH_DOOR = 29,
409
    ST_30_ROTATE_RISE_BRIDGE = 30,
411
    ST_30_ROTATE_RISE_BRIDGE = 30,
410
    ST_31_TWO_WAY_TRAIN = 31,
412
    ST_31_TWO_WAY_TRAIN = 31,
411
    // left: ST 32767, 65534, 65535
413
    // left: ST 32767, 65534, 65535
412
};
414
};
413
415
414
// Cheats
416
// Cheats
415
// KEEPINSYNC game.c: char CheatStrings[][]
417
// KEEPINSYNC game.c: char CheatStrings[][]
416
enum cheatindex_t
418
enum cheatindex_t
417
{
419
{
418
    CHEAT_CORNHOLIO,  // 0
420
    CHEAT_CORNHOLIO,  // 0
419
    CHEAT_STUFF,
421
    CHEAT_STUFF,
420
    CHEAT_SCOTTY,
422
    CHEAT_SCOTTY,
421
    CHEAT_COORDS,
423
    CHEAT_COORDS,
422
    CHEAT_VIEW,
424
    CHEAT_VIEW,
423
    CHEAT_TIME,  // 5
425
    CHEAT_TIME,  // 5
424
    CHEAT_UNLOCK,
426
    CHEAT_UNLOCK,
425
    CHEAT_CASHMAN,
427
    CHEAT_CASHMAN,
426
    CHEAT_ITEMS,
428
    CHEAT_ITEMS,
427
    CHEAT_RATE,
429
    CHEAT_RATE,
428
    CHEAT_SKILL,  // 10
430
    CHEAT_SKILL,  // 10
429
    CHEAT_BETA,
431
    CHEAT_BETA,
430
    CHEAT_HYPER,
432
    CHEAT_HYPER,
431
    CHEAT_MONSTERS,
433
    CHEAT_MONSTERS,
432
    CHEAT_RESERVED,
434
    CHEAT_RESERVED,
433
    CHEAT_RESERVED2,  // 15
435
    CHEAT_RESERVED2,  // 15
434
    CHEAT_TODD,
436
    CHEAT_TODD,
435
    CHEAT_SHOWMAP,
437
    CHEAT_SHOWMAP,
436
    CHEAT_KROZ,
438
    CHEAT_KROZ,
437
    CHEAT_ALLEN,
439
    CHEAT_ALLEN,
438
    CHEAT_CLIP,  // 20
440
    CHEAT_CLIP,  // 20
439
    CHEAT_WEAPONS,
441
    CHEAT_WEAPONS,
440
    CHEAT_INVENTORY,
442
    CHEAT_INVENTORY,
441
    CHEAT_KEYS,
443
    CHEAT_KEYS,
442
    CHEAT_DEBUG,
444
    CHEAT_DEBUG,
443
    CHEAT_RESERVED3,  // 25
445
    CHEAT_RESERVED3,  // 25
444
    CHEAT_COMEGETSOME,
446
    CHEAT_COMEGETSOME,
445
};
447
};
446
448
447
449
448
# define G_ModDirSnprintf(buf, size, basename, ...) \
450
# define G_ModDirSnprintf(buf, size, basename, ...) \
449
( \
451
( \
450
    ( \
452
    ( \
451
        (g_modDir[0] != '/') ? \
453
        (g_modDir[0] != '/') ? \
452
            Bsnprintf(buf, size, "%s/" basename, g_modDir, ## __VA_ARGS__) : \
454
            Bsnprintf(buf, size, "%s/" basename, g_modDir, ## __VA_ARGS__) : \
453
            Bsnprintf(buf, size, basename, ## __VA_ARGS__) \
455
            Bsnprintf(buf, size, basename, ## __VA_ARGS__) \
454
    ) >= ((int32_t)size)-1 \
456
    ) >= ((int32_t)size)-1 \
455
)
457
)
456
458
457
#endif
459
#endif
458
 
460