2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2016-02-07 02:38:03 +00:00
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
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.
|
2006-04-13 20:47:06 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef duke3d_h_
|
|
|
|
#define duke3d_h_
|
2006-10-19 00:45:36 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// JBF
|
|
|
|
#include "a.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "baselayer.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "build.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "cache1d.h"
|
|
|
|
#include "compat.h"
|
|
|
|
#include "fx_man.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "pragmas.h"
|
2019-09-25 21:00:10 +00:00
|
|
|
#include "polymost.h"
|
2019-10-21 22:05:21 +00:00
|
|
|
#include "gamecvars.h"
|
2019-11-25 16:19:48 +00:00
|
|
|
#include "menu/menu.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2017-01-18 22:21:16 +00:00
|
|
|
#define HEAD2 APPNAME
|
2009-01-09 09:29:17 +00:00
|
|
|
|
2017-01-18 22:21:16 +00:00
|
|
|
#ifdef EDUKE32_STANDALONE
|
|
|
|
#define VOLUMEALL (1)
|
|
|
|
#define PLUTOPAK (1)
|
|
|
|
#define VOLUMEONE (0)
|
|
|
|
#else
|
|
|
|
#define VOLUMEALL (g_Shareware == 0)
|
|
|
|
#define PLUTOPAK (g_scriptVersion >= 14)
|
|
|
|
#define VOLUMEONE (g_Shareware == 1)
|
|
|
|
#endif
|
2006-07-22 05:20:25 +00:00
|
|
|
|
2018-11-18 18:08:26 +00:00
|
|
|
# define BYTEVERSION_EDUKE32 339
|
2011-12-25 15:34:37 +00:00
|
|
|
|
2016-01-21 19:35:30 +00:00
|
|
|
#define BYTEVERSION (BYTEVERSION_EDUKE32+(PLUTOPAK?1:(VOLUMEONE<<1)))
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define NUMPAGES 1
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
|
|
|
|
#define MOVEFIFOSIZ 2
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2012-06-17 19:45:37 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2012-06-03 16:10:08 +00:00
|
|
|
#define MAXLEVELS 64
|
2010-08-02 08:13:51 +00:00
|
|
|
#define MAXGAMETYPES 16
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-09-07 18:10:14 +00:00
|
|
|
enum {
|
|
|
|
MUS_FIRST_SPECIAL = MAXVOLUMES*MAXLEVELS,
|
|
|
|
|
|
|
|
MUS_INTRO = MUS_FIRST_SPECIAL,
|
|
|
|
MUS_BRIEFING = MUS_FIRST_SPECIAL + 1,
|
|
|
|
MUS_LOADING = MUS_FIRST_SPECIAL + 2,
|
2019-07-18 01:25:33 +00:00
|
|
|
MUS_USERMAP = MUS_FIRST_SPECIAL + 3,
|
2014-09-07 18:10:14 +00:00
|
|
|
};
|
|
|
|
|
2012-09-08 22:18:40 +00:00
|
|
|
////////// TIMING CONSTANTS //////////
|
|
|
|
// The number of 'totalclock' increments per second:
|
2010-08-02 08:13:51 +00:00
|
|
|
#define TICRATE 120
|
2012-09-08 22:18:40 +00:00
|
|
|
// The number of game state updates per second:
|
|
|
|
#define REALGAMETICSPERSEC 30
|
|
|
|
// The number of 'totalclock' increments per game state update:
|
|
|
|
// NOTE: calling a game state update a 'frame' is really weird.
|
|
|
|
// (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated
|
|
|
|
// to 4 by integer division.)
|
|
|
|
#define TICSPERFRAME (TICRATE/REALGAMETICSPERSEC)
|
|
|
|
// Used as a constant to satisfy all of the calculations written with ticrate =
|
|
|
|
// 26 in mind:
|
|
|
|
#define GAMETICSPERSEC 26
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 21:52:51 +00:00
|
|
|
#define PACKBUF_SIZE 32768
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define TILE_SAVESHOT (MAXTILES-1)
|
|
|
|
#define TILE_LOADSHOT (MAXTILES-3)
|
|
|
|
#define TILE_TILT (MAXTILES-2)
|
|
|
|
#define TILE_ANIM (MAXTILES-4)
|
|
|
|
#define TILE_VIEWSCR (MAXTILES-5)
|
2015-07-25 17:23:22 +00:00
|
|
|
// Reserved: TILE_VIEWSCR_1 (MAXTILES-6)
|
|
|
|
// Reserved: TILE_VIEWSCR_2 (MAXTILES-7)
|
|
|
|
EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
|
2006-04-15 03:12:08 +00:00
|
|
|
|
2014-02-22 19:38:47 +00:00
|
|
|
// sprites with these statnums should be considered for fixing
|
2012-12-23 19:24:21 +00:00
|
|
|
#define ROTFIXSPR_STATNUMP(k) ((k)==STAT_DEFAULT || (k)==STAT_STANDABLE || (k)==STAT_FX || \
|
2012-05-06 21:01:52 +00:00
|
|
|
(k)==STAT_FALLER || (k)==STAT_LIGHT)
|
2012-12-23 19:24:21 +00:00
|
|
|
#define ROTFIXSPR_MAGIC 0x18190000
|
2011-06-22 19:12:47 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
// JBF 20040604: sync is a function on some platforms
|
|
|
|
#define sync dsync
|
2009-04-26 05:57:42 +00:00
|
|
|
|
2012-02-12 13:47:33 +00:00
|
|
|
// Uncomment the following to remove calls to a.nasm functions with the GL renderers
|
|
|
|
// so that debugging with valgrind --smc-check=none is possible:
|
|
|
|
//#define DEBUG_VALGRIND_NO_SMC
|
|
|
|
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "actors.h"
|
2012-06-03 16:09:33 +00:00
|
|
|
#include "common_game.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "control.h"
|
2019-10-25 22:32:49 +00:00
|
|
|
#include "gamecontrol.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "game.h"
|
|
|
|
#include "gamedef.h"
|
|
|
|
#include "gameexec.h"
|
|
|
|
#include "gamevars.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "global.h"
|
|
|
|
#include "inv.h"
|
|
|
|
#include "macros.h"
|
|
|
|
#include "music.h"
|
|
|
|
#include "namesdyn.h"
|
2019-03-21 02:24:19 +00:00
|
|
|
#include "network.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "player.h"
|
|
|
|
#include "quotes.h"
|
|
|
|
#include "rts.h"
|
2016-02-07 02:38:23 +00:00
|
|
|
#include "screentext.h"
|
2018-11-18 18:09:48 +00:00
|
|
|
#include "sector.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
#include "soundsdyn.h"
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
static inline int32_t G_HaveActor(int spriteNum)
|
2012-12-29 15:21:28 +00:00
|
|
|
{
|
2016-08-27 01:40:46 +00:00
|
|
|
return g_tile[spriteNum].execPtr!=NULL;
|
2012-12-29 15:21:28 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 01:40:46 +00:00
|
|
|
static inline int32_t G_DefaultActorHealth(int spriteNum)
|
2012-12-29 15:21:28 +00:00
|
|
|
{
|
2016-08-27 01:40:46 +00:00
|
|
|
return G_HaveActor(spriteNum) ? g_tile[spriteNum].execPtr[0] : 0;
|
2012-12-29 15:21:28 +00:00
|
|
|
}
|
|
|
|
|
2019-11-03 11:32:58 +00:00
|
|
|
|
|
|
|
struct GameInterface : ::GameInterface
|
|
|
|
{
|
|
|
|
int app_main() override;
|
|
|
|
bool validate_hud(int) override;
|
|
|
|
void set_hud_layout(int size) override;
|
|
|
|
void set_hud_scale(int size) override;
|
2019-11-06 18:22:14 +00:00
|
|
|
bool mouseInactiveConditional(bool condition) override;
|
2019-11-10 10:42:25 +00:00
|
|
|
FString statFPS() override;
|
2019-11-12 21:00:33 +00:00
|
|
|
GameStats getStats() override;
|
2019-11-23 11:38:38 +00:00
|
|
|
// Access to the front end specific menu code. Use is restricted to the main menu, the ingame menu and the skill/episode selection.
|
|
|
|
// Everything else is either custom screens or will use the generic option menu style.
|
2019-11-24 21:31:27 +00:00
|
|
|
void DrawNativeMenuText(int fontnum, int state, int xpos, int ypos, float fontscale, const char* text, int orientation) override;
|
2019-11-23 22:05:24 +00:00
|
|
|
void MenuOpened() override;
|
2019-11-26 22:20:54 +00:00
|
|
|
void MenuClosed() override;
|
|
|
|
void MenuSound(EMenuSounds snd) override;
|
2019-11-23 22:05:24 +00:00
|
|
|
bool CanSave() override;
|
2019-11-26 22:20:54 +00:00
|
|
|
void CustomMenuSelection(int menu, int item) override;
|
|
|
|
void StartGame(FGameStartup& gs) override;
|
2019-11-23 11:38:38 +00:00
|
|
|
|
2019-11-03 11:32:58 +00:00
|
|
|
};
|
|
|
|
|
2019-09-21 20:53:00 +00:00
|
|
|
END_DUKE_NS
|
|
|
|
|
2008-12-19 00:53:54 +00:00
|
|
|
#endif
|