2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
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
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef global_h_
|
|
|
|
#define global_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "compat.h"
|
|
|
|
#include "duke3d.h"
|
|
|
|
#include "mmulti.h"
|
|
|
|
#include "quotes.h"
|
|
|
|
#include "sector.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifdef global_c_
|
2010-08-02 08:13:51 +00:00
|
|
|
#define G_EXTERN
|
|
|
|
#else
|
|
|
|
#define G_EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MAXINTERPOLATIONS MAXSPRITES
|
2012-06-17 19:45:41 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2012-03-25 22:00:27 +00:00
|
|
|
#define MAXSKILLS 7
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
// duke3d global soup :(
|
|
|
|
|
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
G_EXTERN int32_t g_interpolationCnt;
|
2012-11-05 02:49:08 +00:00
|
|
|
G_EXTERN int32_t g_interpolationLock;
|
|
|
|
G_EXTERN int32_t oldipos[MAXINTERPOLATIONS];
|
|
|
|
G_EXTERN int32_t *curipos[MAXINTERPOLATIONS];
|
|
|
|
G_EXTERN int32_t bakipos[MAXINTERPOLATIONS];
|
2014-07-28 06:43:16 +00:00
|
|
|
|
2012-11-05 02:49:08 +00:00
|
|
|
|
2015-04-24 00:08:46 +00:00
|
|
|
G_EXTERN int32_t duke3d_globalflags;
|
|
|
|
|
2015-12-20 05:18:53 +00:00
|
|
|
// KEEPINSYNC astub.c (used values only)
|
|
|
|
enum DUKE3D_GLOBALFLAGS {
|
2015-04-24 00:08:46 +00:00
|
|
|
DUKE3D_NO_WIDESCREEN_PINNING = 1<<0,
|
2015-10-03 11:53:19 +00:00
|
|
|
DUKE3D_NO_HARDCODED_FOGPALS = 1<<1,
|
2015-12-20 05:18:53 +00:00
|
|
|
DUKE3D_NO_PALETTE_CHANGES = 1<<2,
|
2015-04-24 00:08:46 +00:00
|
|
|
};
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN DukeStatus_t sbar;
|
|
|
|
G_EXTERN actor_t actor[MAXSPRITES];
|
2012-11-11 17:57:06 +00:00
|
|
|
// g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game
|
2012-10-30 15:54:35 +00:00
|
|
|
G_EXTERN tiledata_t g_tile[MAXTILES];
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN animwalltype animwall[MAXANIMWALLS];
|
2016-08-27 01:40:35 +00:00
|
|
|
G_EXTERN char *apStrings[MAXQUOTES],*apXStrings[MAXQUOTES];
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN char *label;
|
2012-06-04 22:01:45 +00:00
|
|
|
G_EXTERN int32_t g_musicIndex;
|
2012-08-16 21:48:13 +00:00
|
|
|
G_EXTERN char g_loadFromGroupOnly;
|
2016-08-27 01:42:01 +00:00
|
|
|
G_EXTERN char g_skillCnt;
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN char pus,pub;
|
|
|
|
G_EXTERN char ready2send;
|
2014-05-17 12:36:40 +00:00
|
|
|
#define MAXPLAYERNAME 32
|
|
|
|
G_EXTERN char szPlayerName[MAXPLAYERNAME];
|
2017-06-19 23:07:18 +00:00
|
|
|
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],buf[1024];
|
2014-05-17 12:36:40 +00:00
|
|
|
#define TYPEBUFSIZE 141
|
|
|
|
G_EXTERN char typebuf[TYPEBUFSIZE];
|
2016-08-27 01:40:35 +00:00
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
G_EXTERN input_t localInput;
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN input_t recsync[RECSYNCBUFSIZ];
|
2016-08-27 01:42:01 +00:00
|
|
|
|
2017-01-01 13:23:29 +00:00
|
|
|
G_EXTERN int32_t g_animWallCnt;
|
|
|
|
G_EXTERN int32_t g_animateCnt;
|
|
|
|
G_EXTERN int32_t g_cloudCnt;
|
|
|
|
G_EXTERN int32_t g_curViewscreen;
|
|
|
|
G_EXTERN int32_t g_frameRate;
|
|
|
|
G_EXTERN int32_t g_cyclerCnt;
|
|
|
|
G_EXTERN int32_t g_damageCameras;
|
|
|
|
G_EXTERN int32_t g_doQuickSave;
|
|
|
|
G_EXTERN int32_t g_earthquakeTime;
|
|
|
|
G_EXTERN int32_t g_freezerSelfDamage;
|
|
|
|
G_EXTERN int32_t g_gameQuit;
|
|
|
|
G_EXTERN int32_t g_globalRandom;
|
|
|
|
G_EXTERN int32_t g_impactDamage;
|
|
|
|
G_EXTERN int32_t g_labelCnt;
|
|
|
|
G_EXTERN int32_t g_maxPlayerHealth;
|
|
|
|
G_EXTERN int32_t g_mirrorCount;
|
|
|
|
G_EXTERN int32_t g_mostConcurrentPlayers;
|
|
|
|
G_EXTERN int32_t g_musicSize;
|
|
|
|
G_EXTERN int32_t g_playerSpawnCnt;
|
|
|
|
G_EXTERN int32_t g_scriptDebug;
|
|
|
|
G_EXTERN int32_t g_showShareware;
|
|
|
|
G_EXTERN int32_t g_spriteDeleteQueuePos;
|
|
|
|
G_EXTERN int32_t g_startArmorAmount;
|
|
|
|
G_EXTERN int32_t g_tripbombLaserMode;
|
|
|
|
G_EXTERN int32_t screenpeek;
|
2016-08-27 01:42:01 +00:00
|
|
|
|
|
|
|
G_EXTERN int16_t g_animateSect[MAXANIMATES];
|
|
|
|
G_EXTERN int32_t *g_animatePtr[MAXANIMATES];
|
|
|
|
G_EXTERN int32_t g_animateGoal[MAXANIMATES];
|
|
|
|
G_EXTERN int32_t g_animateVel[MAXANIMATES];
|
|
|
|
|
|
|
|
G_EXTERN int16_t g_cloudSect[256];
|
|
|
|
G_EXTERN int16_t g_cloudX;
|
|
|
|
G_EXTERN int16_t g_cloudY;
|
2019-08-27 13:39:54 +00:00
|
|
|
G_EXTERN ClockTicks g_cloudClock;
|
2016-08-27 01:42:01 +00:00
|
|
|
|
|
|
|
G_EXTERN int16_t SpriteDeletionQueue[1024];
|
|
|
|
G_EXTERN int16_t g_cyclers[MAXCYCLERS][6];
|
|
|
|
G_EXTERN int16_t g_mirrorSector[64];
|
|
|
|
G_EXTERN int16_t g_mirrorWall[64];
|
|
|
|
G_EXTERN int32_t *labelcode;
|
|
|
|
G_EXTERN int32_t *labeltype;
|
2019-08-27 13:39:54 +00:00
|
|
|
G_EXTERN ClockTicks lockclock;
|
|
|
|
G_EXTERN ClockTicks ototalclock;
|
2016-08-27 01:42:01 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
G_EXTERN intptr_t *apScript;
|
2016-08-27 01:42:01 +00:00
|
|
|
G_EXTERN intptr_t *g_scriptPtr;
|
|
|
|
|
|
|
|
G_EXTERN map_t g_mapInfo[(MAXVOLUMES + 1) * MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music
|
|
|
|
G_EXTERN vec2_t g_origins[MAXANIMPOINTS];
|
2015-02-07 17:29:11 +00:00
|
|
|
|
|
|
|
// XXX: I think this pragma pack is meaningless here.
|
|
|
|
// MSDN (https://msdn.microsoft.com/en-us/library/2e70t5y1%28VS.80%29.aspx) says:
|
|
|
|
// "pack takes effect at the first struct, union, or class declaration after
|
|
|
|
// the pragma is seen; pack has no effect on definitions."
|
2012-11-05 02:49:08 +00:00
|
|
|
#pragma pack(push,1)
|
2015-02-07 17:29:11 +00:00
|
|
|
#ifdef global_c_
|
|
|
|
static playerdata_t g_player_s[1 + MAXPLAYERS];
|
|
|
|
playerdata_t *const g_player = &g_player_s[1];
|
|
|
|
#else
|
|
|
|
extern playerdata_t *const g_player;
|
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
|
2012-11-05 02:49:08 +00:00
|
|
|
G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
|
|
|
#pragma pack(pop)
|
2015-02-07 17:29:11 +00:00
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
G_EXTERN char g_soundlocks[MAXSOUNDS];
|
2017-01-01 13:23:29 +00:00
|
|
|
G_EXTERN int32_t g_noEnemies;
|
|
|
|
G_EXTERN int32_t g_restorePalette;
|
|
|
|
G_EXTERN int32_t g_screenCapture;
|
2012-10-30 15:54:35 +00:00
|
|
|
G_EXTERN projectile_t SpriteProjectile[MAXSPRITES];
|
2010-08-02 08:13:51 +00:00
|
|
|
G_EXTERN sound_t g_sounds[MAXSOUNDS];
|
|
|
|
G_EXTERN uint32_t everyothertime;
|
|
|
|
G_EXTERN uint32_t g_moveThingsCount;
|
2019-01-12 00:21:53 +00:00
|
|
|
G_EXTERN double g_gameUpdateTime;
|
|
|
|
G_EXTERN double g_gameUpdateAndDrawTime;
|
2018-08-02 07:53:09 +00:00
|
|
|
#define GAMEUPDATEAVGTIMENUMSAMPLES 100
|
2019-01-12 00:21:53 +00:00
|
|
|
extern double g_gameUpdateAvgTime;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef global_c_
|
2016-08-27 01:42:01 +00:00
|
|
|
extern char CheatKeys[2];
|
|
|
|
extern char g_gametypeNames[MAXGAMETYPES][33];
|
|
|
|
extern char g_setupFileName[BMAX_PATH];
|
|
|
|
extern char g_skillNames[MAXSKILLS][33];
|
|
|
|
extern char g_volumeNames[MAXVOLUMES][33];
|
|
|
|
|
2017-01-01 13:23:29 +00:00
|
|
|
extern int32_t g_actorRespawnTime;
|
|
|
|
extern int32_t g_bouncemineRadius;
|
|
|
|
extern int32_t g_deleteQueueSize;
|
|
|
|
extern int32_t g_gametypeCnt;
|
|
|
|
extern int32_t g_itemRespawnTime;
|
|
|
|
extern int32_t g_morterRadius;
|
|
|
|
extern int32_t g_numFreezeBounces;
|
|
|
|
extern int32_t g_pipebombRadius;
|
|
|
|
extern int32_t g_playerFriction;
|
|
|
|
extern int32_t g_rpgRadius;
|
|
|
|
extern int32_t g_scriptSize;
|
|
|
|
extern int32_t g_seenineRadius;
|
|
|
|
extern int32_t g_shrinkerRadius;
|
|
|
|
extern int32_t g_spriteGravity;
|
|
|
|
extern int32_t g_timerTicsPerSecond;
|
|
|
|
extern int32_t g_tripbombRadius;
|
|
|
|
extern int32_t g_volumeCnt;
|
2016-08-27 01:42:01 +00:00
|
|
|
|
|
|
|
extern int16_t g_blimpSpawnItems[15];
|
|
|
|
extern int32_t g_gametypeFlags[MAXGAMETYPES];
|
|
|
|
extern int32_t g_volumeFlags[MAXVOLUMES];
|
|
|
|
|
2015-02-07 17:29:11 +00:00
|
|
|
extern const char *s_buildDate;
|
2012-12-29 10:58:38 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-22 22:15:20 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
EF_HIDEFROMSP = 1<<0,
|
2015-03-08 07:56:45 +00:00
|
|
|
// EF_HIDEFROMMP = 1<<1,
|
2015-02-22 22:15:20 +00:00
|
|
|
};
|
|
|
|
|
2016-01-08 01:33:35 +00:00
|
|
|
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);
|
|
|
|
EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
|
|
|
|
|
|
|
|
#if defined global_c_ || !defined DISABLE_INLINING
|
|
|
|
|
|
|
|
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
|
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
for (bssize_t i=g_interpolationCnt-1; i>=0; i--) oldipos[i] = *curipos[i];
|
2016-01-08 01:33:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen
|
|
|
|
{
|
2016-08-27 01:42:01 +00:00
|
|
|
int32_t i=g_interpolationCnt-1;
|
2016-01-08 01:33:35 +00:00
|
|
|
|
|
|
|
if (--g_interpolationLock)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (; i>=0; i--) *curipos[i] = bakipos[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
END_DUKE_NS
|
|
|
|
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|