Subversion Repositories eduke32

Rev

Rev 4989 | Details | Compare with Previous | Last modification | View Log | RSS feed

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