2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2016-02-07 02:38:23 +00:00
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2016-02-07 02:38:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef game_h_
|
|
|
|
#define game_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2017-02-19 22:15:29 +00:00
|
|
|
#ifndef ONLY_USERDEFS
|
2016-02-07 02:38:03 +00:00
|
|
|
#include "premap.h" // XXX
|
2017-02-19 22:15:29 +00:00
|
|
|
#endif
|
2013-07-13 21:04:52 +00:00
|
|
|
|
2018-03-07 04:21:05 +00:00
|
|
|
#include "fix16.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "gamevars.h"
|
2019-08-29 01:21:02 +00:00
|
|
|
#include "mmulti.h"
|
2019-03-21 02:24:19 +00:00
|
|
|
#include "network.h"
|
2019-11-25 16:19:48 +00:00
|
|
|
#include "menu/menu.h"
|
2020-01-26 09:58:00 +00:00
|
|
|
#include "palette.h"
|
2018-03-07 04:21:05 +00:00
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
BEGIN_DUKE_NS
|
2014-11-26 04:39:23 +00:00
|
|
|
|
2017-02-19 22:15:29 +00:00
|
|
|
#ifndef ONLY_USERDEFS
|
|
|
|
|
2013-12-28 17:04:34 +00:00
|
|
|
// Compile game-side legacy Room over Room code?
|
|
|
|
#define LEGACY_ROR 1
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define USERQUOTE_LEFTOFFSET 5
|
|
|
|
#define USERQUOTE_RIGHTOFFSET 14
|
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
#if defined(GEKKO) || defined(__OPENDINGUX__)
|
|
|
|
# define VIEWSCREENFACTOR 0
|
|
|
|
#elif defined(__ANDROID__)
|
|
|
|
# define VIEWSCREENFACTOR 1
|
|
|
|
#else
|
|
|
|
# define VIEWSCREENFACTOR 2
|
|
|
|
#endif
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
enum GametypeFlags_t {
|
|
|
|
GAMETYPE_COOP = 0x00000001,
|
|
|
|
GAMETYPE_WEAPSTAY = 0x00000002,
|
|
|
|
GAMETYPE_FRAGBAR = 0x00000004,
|
|
|
|
GAMETYPE_SCORESHEET = 0x00000008,
|
|
|
|
GAMETYPE_DMSWITCHES = 0x00000010,
|
|
|
|
GAMETYPE_COOPSPAWN = 0x00000020,
|
|
|
|
GAMETYPE_ACCESSCARDSPRITES = 0x00000040,
|
|
|
|
GAMETYPE_COOPVIEW = 0x00000080,
|
|
|
|
GAMETYPE_COOPSOUND = 0x00000100,
|
|
|
|
GAMETYPE_OTHERPLAYERSINMAP = 0x00000200,
|
|
|
|
GAMETYPE_ITEMRESPAWN = 0x00000400,
|
|
|
|
GAMETYPE_MARKEROPTION = 0x00000800,
|
|
|
|
GAMETYPE_PLAYERSFRIENDLY = 0x00001000,
|
|
|
|
GAMETYPE_FIXEDRESPAWN = 0x00002000,
|
|
|
|
GAMETYPE_ACCESSATSTART = 0x00004000,
|
|
|
|
GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000,
|
|
|
|
GAMETYPE_TDM = 0x00010000,
|
|
|
|
GAMETYPE_TDMSPAWN = 0x00020000
|
|
|
|
};
|
|
|
|
|
|
|
|
// logo control
|
|
|
|
enum LogoFlags_t {
|
|
|
|
LOGO_ENABLED = 0x00000001,
|
|
|
|
LOGO_PLAYANIM = 0x00000002,
|
|
|
|
LOGO_PLAYMUSIC = 0x00000004,
|
|
|
|
LOGO_3DRSCREEN = 0x00000008,
|
|
|
|
LOGO_TITLESCREEN = 0x00000010,
|
|
|
|
LOGO_DUKENUKEM = 0x00000020,
|
|
|
|
LOGO_THREEDEE = 0x00000040,
|
|
|
|
LOGO_PLUTOPAKSPRITE = 0x00000080,
|
|
|
|
LOGO_SHAREWARESCREENS = 0x00000100,
|
2013-03-04 01:24:17 +00:00
|
|
|
LOGO_TENSCREEN = 0x00000200,
|
2013-03-15 16:56:29 +00:00
|
|
|
LOGO_STOPANIMSOUNDS = 0x00000400,
|
|
|
|
LOGO_NOE4CUTSCENE = 0x00000800,
|
2014-06-16 23:16:37 +00:00
|
|
|
LOGO_NOE1BONUSSCENE = 0x00001000,
|
|
|
|
LOGO_NOE2BONUSSCENE = 0x00002000,
|
|
|
|
LOGO_NOE3BONUSSCENE = 0x00004000,
|
|
|
|
LOGO_NOE4BONUSSCENE = 0x00008000,
|
|
|
|
LOGO_NOE1ENDSCREEN = 0x00010000,
|
|
|
|
LOGO_NOE2ENDSCREEN = 0x00020000,
|
|
|
|
LOGO_NOE3RADLOGO = 0x00040000,
|
|
|
|
LOGO_NODUKETEAMTEXT = 0x00080000,
|
|
|
|
LOGO_NODUKETEAMPIC = 0x00100000,
|
2017-12-12 05:13:49 +00:00
|
|
|
LOGO_STOPMISCSOUNDS = 0x00200000,
|
|
|
|
LOGO_NOGAMETITLE = 0x00400000,
|
|
|
|
LOGO_NOTITLEBAR = 0x00800000,
|
2018-01-26 04:35:37 +00:00
|
|
|
LOGO_HIDEEPISODE = 0x01000000,
|
2018-01-29 02:14:09 +00:00
|
|
|
LOGO_NOHELP = 0x02000000,
|
|
|
|
LOGO_NOCREDITS = 0x04000000,
|
2010-08-02 08:13:51 +00:00
|
|
|
};
|
|
|
|
|
2018-01-26 04:34:51 +00:00
|
|
|
enum {
|
|
|
|
STATUSBAR_NONONE = 0x00000001,
|
|
|
|
STATUSBAR_NOMINI = 0x00000002,
|
|
|
|
STATUSBAR_NOFULL = 0x00000004,
|
|
|
|
STATUSBAR_NOSHRINK = 0x00000008,
|
|
|
|
STATUSBAR_NOFRAGBAR = 0x00000010,
|
|
|
|
STATUSBAR_NOOVERLAY = 0x00000020,
|
|
|
|
STATUSBAR_NOMODERN = 0x00000040,
|
|
|
|
};
|
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
void A_DeleteSprite(int spriteNum);
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2013-03-15 16:56:29 +00:00
|
|
|
static inline int32_t G_GetLogoFlags(void)
|
|
|
|
{
|
|
|
|
return Gv_GetVarByLabel("LOGO_FLAGS",255, -1, -1);
|
|
|
|
}
|
|
|
|
|
2013-01-19 18:28:32 +00:00
|
|
|
# define CAMERA(Membname) (ud.camera ## Membname)
|
|
|
|
# define CAMERADIST g_cameraDistance
|
|
|
|
# define CAMERACLOCK g_cameraClock
|
|
|
|
|
2017-02-19 22:15:29 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-01 06:19:09 +00:00
|
|
|
#define MAXSAVEGAMENAMESTRUCT 32
|
|
|
|
#define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1)
|
2017-02-19 22:15:29 +00:00
|
|
|
#define MAXPWLOCKOUT 128
|
|
|
|
#define MAXRTSNAME 128
|
|
|
|
|
2018-03-17 03:26:10 +00:00
|
|
|
#define MAX_RETURN_VALUES 6
|
2018-02-26 20:20:00 +00:00
|
|
|
|
2013-01-19 18:28:32 +00:00
|
|
|
typedef struct {
|
|
|
|
vec3_t camerapos;
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t const_visibility,uw_framerate;
|
|
|
|
int32_t camera_time,folfvel,folavel,folx,foly,fola;
|
2019-10-22 15:00:22 +00:00
|
|
|
int32_t reccnt;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2019-12-19 08:31:39 +00:00
|
|
|
int32_t statusbarscale,weaponswitch; // JBF 20031125
|
2019-11-09 18:15:03 +00:00
|
|
|
int32_t statusbarmode;
|
|
|
|
int32_t noexits;
|
|
|
|
int32_t althud;
|
2019-10-22 21:43:16 +00:00
|
|
|
int32_t statusbarflags, statusbarrange;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2019-11-09 18:15:03 +00:00
|
|
|
int32_t entered_name,screen_tilting;
|
|
|
|
int32_t coop,screen_size;
|
2019-10-21 23:00:22 +00:00
|
|
|
int32_t playerai,angleinterpolation;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
|
2019-11-09 18:15:03 +00:00
|
|
|
int32_t m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_monsters_off;
|
|
|
|
int32_t ffire,m_player_skill,m_level_number,m_volume_number,multimode;
|
|
|
|
int32_t player_skill,level_number,volume_number,marker;
|
2019-12-16 08:19:04 +00:00
|
|
|
int32_t music_episode, music_level;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2015-02-08 08:03:30 +00:00
|
|
|
int32_t playerbest;
|
2015-01-25 12:16:58 +00:00
|
|
|
|
2018-02-26 20:20:00 +00:00
|
|
|
int32_t returnvar[MAX_RETURN_VALUES-1];
|
|
|
|
|
2018-03-08 03:55:07 +00:00
|
|
|
uint32_t userbytever;
|
|
|
|
|
2018-03-07 04:21:18 +00:00
|
|
|
fix16_t cameraq16ang, cameraq16horiz;
|
|
|
|
int16_t camerasect;
|
2010-08-02 08:13:51 +00:00
|
|
|
int16_t pause_on,from_bonus;
|
|
|
|
int16_t camerasprite,last_camsprite;
|
2017-06-23 03:58:08 +00:00
|
|
|
int16_t last_level,secretlevel;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2018-01-29 02:14:16 +00:00
|
|
|
int8_t menutitle_pal, slidebar_palselected, slidebar_paldisabled;
|
|
|
|
|
2019-07-19 09:49:18 +00:00
|
|
|
int32_t last_stateless_level, last_stateless_volume; // strictly internal
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
struct {
|
|
|
|
int32_t AutoAim;
|
2018-11-18 18:08:44 +00:00
|
|
|
int32_t ShowWeapons;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
} config;
|
|
|
|
|
|
|
|
char overhead_on,last_overhead,showweapons;
|
|
|
|
char god,warp_on,cashman,eog,showallmap;
|
2019-12-24 11:59:26 +00:00
|
|
|
char scrollmode,noclip;
|
2010-08-02 08:13:51 +00:00
|
|
|
char display_bonus_screen;
|
|
|
|
char show_level_text;
|
2017-12-01 06:19:15 +00:00
|
|
|
|
|
|
|
uint8_t user_map;
|
2018-01-26 04:34:43 +00:00
|
|
|
uint8_t screenfade, menubackground;
|
2018-01-29 11:14:17 +00:00
|
|
|
uint8_t shadow_pal;
|
2010-08-02 08:13:51 +00:00
|
|
|
} user_defs;
|
|
|
|
|
2017-02-19 22:15:29 +00:00
|
|
|
extern user_defs ud;
|
|
|
|
|
|
|
|
#ifndef ONLY_USERDEFS
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
// this is checked against http://eduke32.com/VERSION
|
|
|
|
extern const char *s_buildDate;
|
2014-07-28 06:42:28 +00:00
|
|
|
|
2019-12-11 00:01:03 +00:00
|
|
|
extern char boardfilename[BMAX_PATH];
|
2019-08-15 04:39:46 +00:00
|
|
|
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES
|
|
|
|
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
|
|
|
|
#define USERMAPMUSICFAKESLOT ((USERMAPMUSICFAKEVOLUME * MAXLEVELS) + USERMAPMUSICFAKELEVEL)
|
2012-06-03 16:09:33 +00:00
|
|
|
|
2018-01-29 11:13:21 +00:00
|
|
|
static inline int G_HaveUserMap(void)
|
|
|
|
{
|
|
|
|
return (boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int Menu_HaveUserMap(void)
|
|
|
|
{
|
2019-11-09 18:15:03 +00:00
|
|
|
return (boardfilename[0] != 0 && m_level_number == 7 && ud.m_volume_number == 0);
|
2018-01-29 11:13:21 +00:00
|
|
|
}
|
|
|
|
|
2012-06-03 16:09:33 +00:00
|
|
|
extern const char *G_DefaultRtsFile(void);
|
|
|
|
|
2013-12-28 17:04:34 +00:00
|
|
|
#ifdef LEGACY_ROR
|
2010-08-02 08:13:51 +00:00
|
|
|
extern char ror_protectedsectors[MAXSECTORS];
|
2013-12-28 17:04:34 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2016-02-07 02:38:03 +00:00
|
|
|
extern int32_t g_Debug;
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t g_Shareware;
|
2013-01-19 18:28:32 +00:00
|
|
|
#if !defined LUNATIC
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t g_cameraClock;
|
|
|
|
extern int32_t g_cameraDistance;
|
2013-01-19 18:28:32 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t g_crosshairSum;
|
|
|
|
extern int32_t g_doQuickSave;
|
|
|
|
extern int32_t g_levelTextTime;
|
|
|
|
extern int32_t g_quitDeadline;
|
|
|
|
extern int32_t g_restorePalette;
|
|
|
|
extern int32_t tempwallptr;
|
|
|
|
extern int32_t ticrandomseed;
|
|
|
|
extern int32_t vote_map;
|
|
|
|
extern int32_t voting;
|
|
|
|
|
2012-01-19 21:57:22 +00:00
|
|
|
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
int32_t A_CheckInventorySprite(spritetype *s);
|
2016-02-07 02:38:23 +00:00
|
|
|
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
|
|
|
|
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
|
2018-10-16 06:08:58 +00:00
|
|
|
int A_Spawn(int spriteNum,int tileNum);
|
2016-08-27 01:41:04 +00:00
|
|
|
int G_DoMoveThings(void);
|
2012-01-19 21:57:22 +00:00
|
|
|
//int32_t G_EndOfLevel(void);
|
2014-05-31 12:26:41 +00:00
|
|
|
|
2011-06-29 19:57:05 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz);
|
|
|
|
#else
|
|
|
|
#define Yax_SetBunchZs(sectnum, cf, daz)
|
|
|
|
#endif
|
|
|
|
|
2013-05-19 19:29:13 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
void El_CreateGameState(void);
|
|
|
|
#endif
|
2013-05-20 19:31:37 +00:00
|
|
|
void G_PostCreateGameState(void);
|
2013-05-19 19:29:13 +00:00
|
|
|
|
2016-08-27 01:41:33 +00:00
|
|
|
void A_SpawnCeilingGlass(int spriteNum,int sectNum,int glassCnt);
|
|
|
|
void A_SpawnGlass(int spriteNum,int glassCnt);
|
|
|
|
void A_SpawnRandomGlass(int spriteNum,int wallNum,int glassCnt);
|
2018-10-16 06:08:58 +00:00
|
|
|
void A_SpawnWallGlass(int spriteNum,int wallnum,int glassCnt);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_AddUserQuote(const char *daquote);
|
|
|
|
void G_BackToMenu(void);
|
2016-02-07 02:38:03 +00:00
|
|
|
void G_DumpDebugInfo(void);
|
2015-02-08 08:03:30 +00:00
|
|
|
|
|
|
|
const char* G_PrintYourTime(void);
|
|
|
|
const char* G_PrintParTime(void);
|
|
|
|
const char* G_PrintDesignerTime(void);
|
|
|
|
const char* G_PrintBestTime(void);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_BonusScreen(int32_t bonusonly);
|
2012-01-19 21:57:22 +00:00
|
|
|
//void G_CheatGetInv(void);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_DisplayRest(int32_t smoothratio);
|
2019-06-29 17:48:05 +00:00
|
|
|
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura, int32_t smoothratio);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_DrawBackground(void);
|
|
|
|
void G_DrawFrags(void);
|
2018-03-07 04:21:31 +00:00
|
|
|
void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t horiz, int32_t smoothratio);
|
2018-10-16 06:08:58 +00:00
|
|
|
void G_DrawRooms(int32_t playerNum,int32_t smoothratio);
|
2010-08-02 08:13:51 +00:00
|
|
|
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);
|
2018-10-16 06:08:58 +00:00
|
|
|
void G_GameExit(const char *msg) ATTRIBUTE((noreturn));
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_GameQuit(void);
|
|
|
|
void G_HandleLocalKeys(void);
|
|
|
|
void G_HandleSpecialKeys(void);
|
2012-08-20 21:32:11 +00:00
|
|
|
void G_PrintGameQuotes(int32_t snum);
|
2012-01-19 21:57:22 +00:00
|
|
|
//void G_SE40(int32_t smoothratio);
|
2010-08-02 08:13:51 +00:00
|
|
|
void G_Shutdown(void);
|
|
|
|
void G_UpdatePlayerFromMenu(void);
|
|
|
|
void P_DoQuote(int32_t q,DukePlayer_t *p);
|
2020-01-26 09:58:00 +00:00
|
|
|
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags flags);
|
2013-06-01 06:55:00 +00:00
|
|
|
|
2014-04-09 18:51:35 +00:00
|
|
|
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
|
|
|
|
if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
|
|
|
|
} while (0)
|
|
|
|
|
2014-05-22 11:17:50 +00:00
|
|
|
// Cstat protection mask for (currently) spawned MASKWALL* sprites.
|
|
|
|
// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()?
|
|
|
|
// 2048+(32+16)+8+4
|
2018-02-16 06:38:31 +00:00
|
|
|
#define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_ALIGNMENT_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP);
|
2014-05-22 11:17:50 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
|
2012-01-19 21:57:22 +00:00
|
|
|
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
|
2018-10-16 06:08:58 +00:00
|
|
|
void G_InitTimer(int32_t ticspersec);
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2018-11-18 18:12:38 +00:00
|
|
|
static inline int G_GetTeamPalette(int team)
|
2010-08-02 08:13:51 +00:00
|
|
|
{
|
2018-11-18 18:12:38 +00:00
|
|
|
static CONSTEXPR int8_t pal[] = { 3, 10, 11, 12 };
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-03-22 09:25:15 +00:00
|
|
|
if ((unsigned)team >= ARRAY_SIZE(pal))
|
2010-08-02 08:13:51 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
return pal[team];
|
|
|
|
}
|
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
#define A_CheckSpriteFlags(spriteNum, iType) (((g_tile[sprite[spriteNum].picnum].flags^actor[spriteNum].flags) & iType) != 0)
|
2012-01-19 21:58:23 +00:00
|
|
|
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
|
2012-10-30 15:54:35 +00:00
|
|
|
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)
|
2010-08-02 08:13:51 +00:00
|
|
|
#define S_StopSound(num) S_StopEnvSound(num, -1)
|
|
|
|
|
2016-08-27 01:40:56 +00:00
|
|
|
extern int G_StartRTS(int lumpNum, int localPlayer);
|
2014-01-30 19:12:10 +00:00
|
|
|
|
2013-02-10 16:24:38 +00:00
|
|
|
extern void G_MaybeAllocPlayer(int32_t pnum);
|
|
|
|
|
2019-10-19 23:41:40 +00:00
|
|
|
static inline int32_t gameHandleEvents(void)
|
2012-09-05 17:25:34 +00:00
|
|
|
{
|
|
|
|
Net_GetPackets();
|
2019-10-19 23:41:35 +00:00
|
|
|
return handleevents();
|
2012-09-05 17:25:34 +00:00
|
|
|
}
|
|
|
|
|
2019-08-27 13:39:54 +00:00
|
|
|
static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
|
|
|
|
{
|
2019-12-24 11:59:26 +00:00
|
|
|
if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) ||
|
2019-08-27 13:39:54 +00:00
|
|
|
(g_netServer || ud.multimode > 1) ||
|
|
|
|
ud.recstat == 2) ||
|
|
|
|
ud.pause_on)
|
|
|
|
{
|
|
|
|
return 65536;
|
|
|
|
}
|
|
|
|
|
2020-02-02 09:27:47 +00:00
|
|
|
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
|
2012-09-08 22:18:40 +00:00
|
|
|
}
|
|
|
|
|
2012-08-26 22:16:08 +00:00
|
|
|
// sector effector lotags
|
2016-08-27 01:40:46 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SE_0_ROTATING_SECTOR = 0,
|
|
|
|
SE_1_PIVOT = 1,
|
|
|
|
SE_2_EARTHQUAKE = 2,
|
2012-09-08 22:18:44 +00:00
|
|
|
SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
|
2016-08-27 01:40:46 +00:00
|
|
|
SE_4_RANDOM_LIGHTS = 4,
|
|
|
|
SE_5 = 5,
|
|
|
|
SE_6_SUBWAY = 6,
|
2012-09-08 22:18:44 +00:00
|
|
|
// ^^ potentially incomplete substitution in code
|
|
|
|
// vv almost surely complete substitution
|
2016-08-27 01:40:46 +00:00
|
|
|
SE_7_TELEPORT = 7,
|
|
|
|
SE_8_UP_OPEN_DOOR_LIGHTS = 8,
|
|
|
|
SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
|
|
|
|
SE_10_DOOR_AUTO_CLOSE = 10,
|
|
|
|
SE_11_SWINGING_DOOR = 11,
|
|
|
|
SE_12_LIGHT_SWITCH = 12,
|
|
|
|
SE_13_EXPLOSIVE = 13,
|
|
|
|
SE_14_SUBWAY_CAR = 14,
|
|
|
|
SE_15_SLIDING_DOOR = 15,
|
|
|
|
SE_16_REACTOR = 16,
|
|
|
|
SE_17_WARP_ELEVATOR = 17,
|
2012-09-08 22:18:44 +00:00
|
|
|
SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
|
2016-08-27 01:40:46 +00:00
|
|
|
SE_19_EXPLOSION_LOWERS_CEILING = 19,
|
|
|
|
SE_20_STRETCH_BRIDGE = 20,
|
|
|
|
SE_21_DROP_FLOOR = 21,
|
|
|
|
SE_22_TEETH_DOOR = 22,
|
|
|
|
SE_23_ONE_WAY_TELEPORT = 23,
|
|
|
|
SE_24_CONVEYOR = 24,
|
|
|
|
SE_25_PISTON = 25,
|
|
|
|
SE_26 = 26,
|
|
|
|
SE_27_DEMO_CAM = 27,
|
|
|
|
SE_28_LIGHTNING = 28,
|
|
|
|
SE_29_WAVES = 29,
|
|
|
|
SE_30_TWO_WAY_TRAIN = 30,
|
|
|
|
SE_31_FLOOR_RISE_FALL = 31,
|
|
|
|
SE_32_CEILING_RISE_FALL = 32,
|
|
|
|
SE_33_QUAKE_DEBRIS = 33,
|
|
|
|
SE_34 = 34, // XXX
|
|
|
|
SE_35 = 35, // XXX
|
|
|
|
SE_36_PROJ_SHOOTER = 36,
|
|
|
|
SE_49_POINT_LIGHT = 49,
|
|
|
|
SE_50_SPOT_LIGHT = 50,
|
|
|
|
SE_130 = 130,
|
|
|
|
SE_131 = 131,
|
2012-08-26 22:16:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// sector lotags
|
2016-08-27 01:40:46 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ST_0_NO_EFFECT = 0,
|
2012-10-14 20:41:17 +00:00
|
|
|
ST_1_ABOVE_WATER = 1,
|
2016-08-27 01:40:46 +00:00
|
|
|
ST_2_UNDERWATER = 2,
|
|
|
|
ST_3 = 3,
|
2012-10-14 20:41:17 +00:00
|
|
|
// ^^^ maybe not complete substitution in code
|
2016-08-27 01:40:46 +00:00
|
|
|
ST_9_SLIDING_ST_DOOR = 9,
|
|
|
|
ST_15_WARP_ELEVATOR = 15,
|
|
|
|
ST_16_PLATFORM_DOWN = 16,
|
|
|
|
ST_17_PLATFORM_UP = 17,
|
|
|
|
ST_18_ELEVATOR_DOWN = 18,
|
|
|
|
ST_19_ELEVATOR_UP = 19,
|
|
|
|
ST_20_CEILING_DOOR = 20,
|
|
|
|
ST_21_FLOOR_DOOR = 21,
|
|
|
|
ST_22_SPLITTING_DOOR = 22,
|
|
|
|
ST_23_SWINGING_DOOR = 23,
|
|
|
|
ST_25_SLIDING_DOOR = 25,
|
|
|
|
ST_26_SPLITTING_ST_DOOR = 26,
|
|
|
|
ST_27_STRETCH_BRIDGE = 27,
|
|
|
|
ST_28_DROP_FLOOR = 28,
|
|
|
|
ST_29_TEETH_DOOR = 29,
|
2012-08-26 22:16:08 +00:00
|
|
|
ST_30_ROTATE_RISE_BRIDGE = 30,
|
2016-08-27 01:40:46 +00:00
|
|
|
ST_31_TWO_WAY_TRAIN = 31,
|
2012-09-08 22:18:44 +00:00
|
|
|
// left: ST 32767, 65534, 65535
|
2012-08-26 22:16:08 +00:00
|
|
|
};
|
|
|
|
|
2012-09-08 22:18:34 +00:00
|
|
|
|
2013-07-13 21:04:52 +00:00
|
|
|
static inline void G_NewGame_EnterLevel(void)
|
|
|
|
{
|
2019-11-09 18:15:03 +00:00
|
|
|
G_NewGame(ud.m_volume_number, m_level_number, ud.m_player_skill);
|
2013-07-13 21:04:52 +00:00
|
|
|
|
|
|
|
if (G_EnterLevel(MODE_GAME))
|
|
|
|
G_BackToMenu();
|
|
|
|
}
|
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
static inline int G_GetMusicIdx(const char *str)
|
2014-09-07 18:10:13 +00:00
|
|
|
{
|
|
|
|
int32_t lev, ep;
|
2018-10-07 05:21:10 +00:00
|
|
|
signed char b1, b2;
|
2014-09-07 18:10:13 +00:00
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
int numMatches = sscanf(str, "%c%d%c%d", &b1,&ep, &b2,&lev);
|
2014-09-07 18:10:13 +00:00
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
if (numMatches != 4 || Btoupper(b1) != 'E' || Btoupper(b2) != 'L')
|
2014-09-07 18:10:13 +00:00
|
|
|
return -1;
|
|
|
|
|
2019-05-27 22:30:42 +00:00
|
|
|
if ((unsigned)--lev >= MAXLEVELS)
|
|
|
|
return -2;
|
|
|
|
|
|
|
|
if (ep == 0)
|
|
|
|
return (MAXVOLUMES * MAXLEVELS) + lev;
|
|
|
|
|
|
|
|
if ((unsigned)--ep >= MAXVOLUMES)
|
2014-09-07 18:10:13 +00:00
|
|
|
return -2;
|
|
|
|
|
|
|
|
return (ep * MAXLEVELS) + lev;
|
|
|
|
}
|
|
|
|
|
2019-12-26 06:27:48 +00:00
|
|
|
|
|
|
|
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
|
|
|
|
|
|
|
|
EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ONLY_USERDEFS
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
static inline int G_GetViewscreenSizeShift(T const * spr)
|
2015-07-25 17:23:22 +00:00
|
|
|
{
|
|
|
|
#if VIEWSCREENFACTOR == 0
|
2019-04-18 17:25:24 +00:00
|
|
|
UNREFERENCED_PARAMETER(spr);
|
2015-07-25 17:23:22 +00:00
|
|
|
return VIEWSCREENFACTOR;
|
|
|
|
#else
|
2019-12-26 06:27:48 +00:00
|
|
|
static CONSTEXPR int const mask = (1<<VIEWSCREENFACTOR)-1;
|
2019-04-18 17:25:24 +00:00
|
|
|
const int rem = (spr->xrepeat & mask) | (spr->yrepeat & mask);
|
2015-07-25 17:23:22 +00:00
|
|
|
|
2018-11-18 18:12:38 +00:00
|
|
|
for (int i=0; i < VIEWSCREENFACTOR; i++)
|
2015-07-25 17:23:22 +00:00
|
|
|
if (rem & (1<<i))
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return VIEWSCREENFACTOR;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-01-08 01:33:35 +00:00
|
|
|
#if defined game_c_ || !defined DISABLE_INLINING
|
|
|
|
|
|
|
|
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)
|
|
|
|
{
|
2019-11-09 18:15:03 +00:00
|
|
|
ud.statusbarscale = clamp(sc, 36, 100);
|
2016-01-08 01:33:35 +00:00
|
|
|
G_UpdateScreenArea();
|
|
|
|
}
|
|
|
|
|
|
|
|
// the point of this is to prevent re-running a function or calculation passed to potentialValue
|
|
|
|
// without making a new variable under each individual circumstance
|
|
|
|
EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue)
|
|
|
|
{
|
|
|
|
if (potentialValue > *variable)
|
|
|
|
*variable = potentialValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-08-12 21:06:51 +00:00
|
|
|
#endif
|
2017-02-19 22:15:29 +00:00
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
END_DUKE_NS
|
|
|
|
|
2017-02-19 22:15:29 +00:00
|
|
|
#endif
|