2014-03-15 16:59:03 +00:00
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
2023-03-31 12:53:31 +00:00
// Copyright (C) 1999-2023 by Sonic Team Junior.
2014-03-15 16:59:03 +00:00
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file doomdef.h
/// \brief Internally used data structures for virtually everything,
/// key definitions, lots of other stuff.
# ifndef __DOOMDEF__
# define __DOOMDEF__
// Sound system select
// This should actually be in the makefile,
// but I can't stand that gibberish. D:
# define SOUND_DUMMY 0
# define SOUND_SDL 1
# define SOUND_MIXER 2
# define SOUND_FMOD 3
# ifndef SOUND
2014-07-25 23:10:24 +00:00
# ifdef HAVE_SDL
2014-03-15 16:59:03 +00:00
// Use Mixer interface?
# ifdef HAVE_MIXER
# define SOUND SOUND_MIXER
# ifdef HW3SOUND
# undef HW3SOUND
# endif
# endif
// Use generic SDL interface.
# ifndef SOUND
# define SOUND SOUND_SDL
# endif
# else // No SDL.
// Use FMOD?
# ifdef HAVE_FMOD
# define SOUND SOUND_FMOD
# ifdef HW3SOUND
# undef HW3SOUND
# endif
# else
// No more interfaces. :(
# define SOUND SOUND_DUMMY
# endif
# endif
# endif
# ifdef _WINDOWS
2016-08-13 14:03:17 +00:00
# define NONET
2014-03-15 16:59:03 +00:00
# if !defined (HWRENDER) && !defined (NOHW)
# define HWRENDER
# endif
# endif
2017-09-29 22:25:34 +00:00
# ifdef _WIN32
2014-03-15 16:59:03 +00:00
# define ASMCALL __cdecl
# else
# define ASMCALL
# endif
# ifdef _MSC_VER
# pragma warning(disable : 4127 4152 4213 4514)
# ifdef _WIN64
# pragma warning(disable : 4306)
# endif
# endif
// warning level 4
// warning C4127: conditional expression is constant
// warning C4152: nonstandard extension, function/data pointer conversion in expression
// warning C4213: nonstandard extension used : cast on l-value
2020-07-11 05:20:33 +00:00
# include "version.h"
2014-03-15 16:59:03 +00:00
# include "doomtype.h"
# include <stdarg.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
2016-04-02 19:09:00 +00:00
# define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
2014-03-15 16:59:03 +00:00
# include <math.h>
# ifdef GETTEXT
# include <libintl.h>
# endif
2020-01-11 18:48:47 +00:00
# include <locale.h> // locale should not be dependent on GETTEXT -- 11/01/20 Monster Iestyn
2014-03-15 16:59:03 +00:00
# include <sys/types.h>
# include <sys/stat.h>
# include <ctype.h>
2021-03-22 14:43:26 +00:00
# ifdef _WIN32
2014-03-15 16:59:03 +00:00
# include <io.h>
# endif
2022-10-15 04:56:01 +00:00
FILE * fopenfile ( const char * , const char * ) ;
2014-03-15 16:59:03 +00:00
//#define NOMD5
2023-08-01 02:29:45 +00:00
// If you don't disable ALL debug first, you get ALL debug enabled
# if !defined (NDEBUG)
2024-01-07 18:07:28 +00:00
# ifndef PACKETDROP
2023-08-01 02:29:45 +00:00
# define PACKETDROP
2024-01-07 18:07:28 +00:00
# endif
# ifndef PARANOIA
2023-08-01 02:29:45 +00:00
# define PARANOIA
2024-01-07 18:07:28 +00:00
# endif
# ifndef RANGECHECK
2023-08-01 02:29:45 +00:00
# define RANGECHECK
2024-01-07 18:07:28 +00:00
# endif
# ifndef ZDEBUG
2023-08-01 02:29:45 +00:00
# define ZDEBUG
# endif
2024-01-07 18:07:28 +00:00
# endif
2023-08-01 02:29:45 +00:00
2014-03-15 16:59:03 +00:00
// Uncheck this to compile debugging code
//#define RANGECHECK
//#ifndef PARANOIA
//#define PARANOIA // do some tests that never fail but maybe
// turn this on by make etc.. DEBUGMODE = 1 or use the Debug profile in the VC++ projects
//#endif
2021-03-30 18:27:10 +00:00
# if defined (_WIN32) || defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (macintosh)
2014-03-15 16:59:03 +00:00
# define LOGMESSAGES // write message in log.txt
# endif
# ifdef LOGMESSAGES
extern FILE * logstream ;
2019-12-24 02:20:04 +00:00
extern char logfilename [ 1024 ] ;
2014-03-15 16:59:03 +00:00
# endif
2019-12-26 04:44:25 +00:00
/* A mod name to further distinguish versions. */
# define SRB2APPLICATION "SRB2"
2019-12-06 17:13:04 +00:00
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
2015-01-22 19:36:17 +00:00
# ifdef DEVELOP
2016-01-14 12:31:48 +00:00
# define VERSIONSTRING "Development EXE"
2021-08-28 17:14:36 +00:00
# define VERSIONSTRING_RC "Development EXE" "\0"
2016-01-14 12:31:48 +00:00
// most interface strings are ignored in development mode.
// we use comprevision and compbranch instead.
2020-09-25 22:55:37 +00:00
// VERSIONSTRING_RC is for the resource-definition script used by windows builds
2014-03-15 16:59:03 +00:00
# else
2020-09-01 22:37:32 +00:00
# ifdef BETAVERSION
# define VERSIONSTRING "v"SRB2VERSION" "BETAVERSION
2020-09-25 22:55:37 +00:00
# define VERSIONSTRING_RC SRB2VERSION " " BETAVERSION "\0"
2014-03-15 16:59:03 +00:00
# else
2020-07-11 05:20:33 +00:00
# define VERSIONSTRING "v"SRB2VERSION
2020-09-25 22:55:37 +00:00
# define VERSIONSTRING_RC SRB2VERSION "\0"
2020-09-01 22:37:32 +00:00
# endif
2014-11-12 14:28:14 +00:00
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
2014-03-15 16:59:03 +00:00
# endif
2020-07-11 05:39:46 +00:00
# define VERSIONSTRINGW WSTRING (VERSIONSTRING)
2020-03-21 12:47:29 +00:00
/* A custom URL protocol for server links. */
# define SERVER_URL_PROTOCOL "srb2: //"
2016-03-10 02:30:11 +00:00
// Does this version require an added patch file?
// Comment or uncomment this as necessary.
2023-05-04 14:17:10 +00:00
# define USE_PATCH_DTA
2016-03-10 02:30:11 +00:00
2021-12-02 22:50:44 +00:00
// Enforce a limit of loaded WAD files.
//#define ENFORCE_WAD_LIMIT
2018-12-16 21:07:47 +00:00
// Use .kart extension addons
//#define USE_KART
2014-03-15 16:59:03 +00:00
// Modification options
// If you want to take advantage of the Master Server's ability to force clients to update
// to the latest version, fill these out. Otherwise, just comment out UPDATE_ALERT and leave
// the other options the same.
// Comment out this line to completely disable update alerts (recommended for testing, but not for release)
2020-09-01 23:22:29 +00:00
# ifndef BETAVERSION
2014-03-15 16:59:03 +00:00
# define UPDATE_ALERT
2020-09-01 23:22:29 +00:00
# endif
2014-03-15 16:59:03 +00:00
// The string used in the alert that pops up in the event of an update being available.
// Please change to apply to your modification (we don't want everyone asking where your mod is on SRB2.org!).
# define UPDATE_ALERT_STRING \
" A new update is available for SRB2. \n " \
" Please visit SRB2.org to download it. \n " \
" \n " \
" You are using version: %s \n " \
" The newest version is: %s \n " \
" \n " \
" This update is required for online \n " \
" play using the Master Server. \n " \
" You will not be able to connect to \n " \
" the Master Server until you update to \n " \
" the newest version of the game. \n " \
" \n " \
" (Press a key) \n "
// The string used in the I_Error alert upon trying to host through command line parameters.
// Generally less filled with newlines, since Windows gives you lots more room to work with.
# define UPDATE_ALERT_STRING_CONSOLE \
" A new update is available for SRB2. \n " \
" Please visit SRB2.org to download it. \n " \
" \n " \
" You are using version: %s \n " \
" The newest version is: %s \n " \
" \n " \
" This update is required for online play using the Master Server. \n " \
" You will not be able to connect to the Master Server \n " \
" until you update to the newest version of the game. \n "
// For future use, the codebase is the version of SRB2 that the modification is based on,
// and should not be changed unless you have merged changes between versions of SRB2
// (such as 2.0.4 to 2.0.5, etc) into your working copy.
// Will always resemble the versionstring, 205 = 2.0.5, 210 = 2.1, etc.
2015-01-22 15:51:31 +00:00
# define CODEBASE 220
2014-03-15 16:59:03 +00:00
2018-12-20 22:16:04 +00:00
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
2018-12-20 22:56:51 +00:00
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
// to an increment in MODVERSION. This might never happen in practice.
// If MODVERSION increases, set MINOREXECVERSION to 0.
2018-12-20 22:16:04 +00:00
# define MAJOREXECVERSION MODVERSION
2023-01-27 01:26:28 +00:00
# define MINOREXECVERSION 0
2018-12-20 22:16:04 +00:00
// (It would have been nice to use VERSION and SUBVERSION but those are zero'd out for DEVELOP builds)
2018-12-20 07:14:41 +00:00
// Macros
# define GETMAJOREXECVERSION(v) (v & 0xFFFF)
# define GETMINOREXECVERSION(v) (v >> 16)
# define GETEXECVERSION(major,minor) (major + (minor << 16))
# define EXECVERSION GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION)
2014-03-15 16:59:03 +00:00
// =========================================================================
// The maximum number of players, multiplayer/networking.
// NOTE: it needs more than this to increase the number of players...
# define MAXPLAYERS 32
2017-03-16 18:57:42 +00:00
# define MAXSKINS 32
2014-03-15 16:59:03 +00:00
# define PLAYERSMASK (MAXPLAYERS-1)
# define MAXPLAYERNAME 21
2020-02-15 08:18:41 +00:00
# define COLORRAMPSIZE 16
# define MAXCOLORNAME 32
2020-05-24 00:29:07 +00:00
# define NUMCOLORFREESLOTS 1024
2020-02-15 08:18:41 +00:00
typedef struct skincolor_s
{
char name [ MAXCOLORNAME + 1 ] ; // Skincolor name
UINT8 ramp [ COLORRAMPSIZE ] ; // Colormap ramp
2020-05-24 00:29:07 +00:00
UINT16 invcolor ; // Signpost color
2020-02-15 08:18:41 +00:00
UINT8 invshade ; // Signpost color shade
UINT16 chatcolor ; // Chat color
boolean accessible ; // Accessible by the color command + setup menu
} skincolor_t ;
2014-03-15 16:59:03 +00:00
typedef enum
{
SKINCOLOR_NONE = 0 ,
2017-07-22 22:24:12 +00:00
// Greyscale ranges
2014-03-15 16:59:03 +00:00
SKINCOLOR_WHITE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_BONE ,
SKINCOLOR_CLOUDY ,
2017-08-02 12:11:21 +00:00
SKINCOLOR_GREY ,
SKINCOLOR_SILVER ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_CARBON ,
SKINCOLOR_JET ,
2014-03-15 16:59:03 +00:00
SKINCOLOR_BLACK ,
2017-07-22 22:24:12 +00:00
// Desaturated
SKINCOLOR_AETHER ,
SKINCOLOR_SLATE ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_MOONSTONE ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_BLUEBELL ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_PINK ,
2022-10-26 22:37:15 +00:00
SKINCOLOR_ROSEWOOD ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_YOGURT ,
2022-10-26 22:37:15 +00:00
SKINCOLOR_LATTE ,
2014-03-15 16:59:03 +00:00
SKINCOLOR_BROWN ,
2022-10-27 09:22:33 +00:00
SKINCOLOR_BOULDER ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_BRONZE ,
2022-10-26 22:37:15 +00:00
SKINCOLOR_SEPIA ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_ECRU ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_TAN ,
SKINCOLOR_BEIGE ,
2022-10-26 22:37:15 +00:00
SKINCOLOR_ROSEBUSH ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_MOSS ,
SKINCOLOR_AZURE ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_EGGPLANT ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_LAVENDER ,
// Viv's vivid colours (toast 21/07/17)
2022-10-26 22:24:12 +00:00
// Tweaks & additions (Lach, sphere, Alice, MotorRoach 26/10/22)
2017-07-22 22:24:12 +00:00
SKINCOLOR_RUBY ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_CHERRY ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SALMON ,
2022-10-26 11:44:25 +00:00
SKINCOLOR_PEPPER ,
2014-03-15 16:59:03 +00:00
SKINCOLOR_RED ,
2015-07-25 13:07:05 +00:00
SKINCOLOR_CRIMSON ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_FLAME ,
2022-12-31 02:18:26 +00:00
SKINCOLOR_GARNET ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_KETCHUP ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_PEACHY ,
SKINCOLOR_QUAIL ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_FOUNDATION ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SUNSET ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_COPPER ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_APRICOT ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_ORANGE ,
SKINCOLOR_RUST ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_TANGERINE ,
2023-01-03 22:08:39 +00:00
SKINCOLOR_TOPAZ ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_GOLD ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SANDY ,
2023-01-03 22:08:39 +00:00
SKINCOLOR_GOLDENROD ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_YELLOW ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_OLIVE ,
2023-07-05 10:10:30 +00:00
SKINCOLOR_PEAR ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_LEMON ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_LIME ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_PERIDOT ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_APPLE ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_HEADLIGHT ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_CHARTREUSE ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_GREEN ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_FOREST ,
2022-12-31 02:18:26 +00:00
SKINCOLOR_SHAMROCK ,
2022-10-26 11:44:25 +00:00
SKINCOLOR_JADE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_MINT ,
2022-10-26 11:44:25 +00:00
SKINCOLOR_MASTER ,
2022-12-31 02:18:26 +00:00
SKINCOLOR_EMERALD ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SEAFOAM ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_ISLAND ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_BOTTLE ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_AQUA ,
SKINCOLOR_TEAL ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_OCEAN ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_WAVE ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_CYAN ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_TURQUOISE ,
2022-12-31 13:30:47 +00:00
SKINCOLOR_AQUAMARINE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SKY ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_MARINE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_CERULEAN ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_DREAM ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_ICY ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_DAYBREAK ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_SAPPHIRE , // sweet mother, i cannot weave – slender aphrodite has overcome me with longing for a girl
2022-10-26 22:24:12 +00:00
SKINCOLOR_ARCTIC ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_CORNFLOWER ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_BLUE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_COBALT ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_MIDNIGHT ,
SKINCOLOR_GALAXY ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_VAPOR ,
SKINCOLOR_DUSK ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_MAJESTY ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_PASTEL ,
SKINCOLOR_PURPLE ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_NOBLE ,
SKINCOLOR_FUCHSIA ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_BUBBLEGUM ,
2023-08-24 11:33:38 +00:00
SKINCOLOR_SIBERITE ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_MAGENTA ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_NEON ,
SKINCOLOR_VIOLET ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_ROYAL ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_LILAC ,
2022-10-26 11:44:25 +00:00
SKINCOLOR_MAUVE ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_EVENTIDE ,
2017-07-22 22:24:12 +00:00
SKINCOLOR_PLUM ,
2020-02-15 03:30:37 +00:00
SKINCOLOR_RASPBERRY ,
2022-10-26 11:44:25 +00:00
SKINCOLOR_TAFFY ,
2015-11-07 19:56:21 +00:00
SKINCOLOR_ROSY ,
2022-10-26 22:24:12 +00:00
SKINCOLOR_FANCY ,
SKINCOLOR_SANGRIA ,
2022-10-27 09:22:33 +00:00
SKINCOLOR_VOLCANIC ,
2014-03-15 16:59:03 +00:00
2020-02-15 08:18:41 +00:00
FIRSTSUPERCOLOR ,
2014-03-15 16:59:03 +00:00
// Super special awesome Super flashing colors!
2020-02-15 08:18:41 +00:00
SKINCOLOR_SUPERSILVER1 = FIRSTSUPERCOLOR ,
2016-08-10 18:48:20 +00:00
SKINCOLOR_SUPERSILVER2 ,
SKINCOLOR_SUPERSILVER3 ,
SKINCOLOR_SUPERSILVER4 ,
SKINCOLOR_SUPERSILVER5 ,
SKINCOLOR_SUPERRED1 ,
SKINCOLOR_SUPERRED2 ,
SKINCOLOR_SUPERRED3 ,
SKINCOLOR_SUPERRED4 ,
SKINCOLOR_SUPERRED5 ,
SKINCOLOR_SUPERORANGE1 ,
SKINCOLOR_SUPERORANGE2 ,
SKINCOLOR_SUPERORANGE3 ,
SKINCOLOR_SUPERORANGE4 ,
SKINCOLOR_SUPERORANGE5 ,
SKINCOLOR_SUPERGOLD1 ,
SKINCOLOR_SUPERGOLD2 ,
SKINCOLOR_SUPERGOLD3 ,
SKINCOLOR_SUPERGOLD4 ,
SKINCOLOR_SUPERGOLD5 ,
SKINCOLOR_SUPERPERIDOT1 ,
SKINCOLOR_SUPERPERIDOT2 ,
SKINCOLOR_SUPERPERIDOT3 ,
SKINCOLOR_SUPERPERIDOT4 ,
SKINCOLOR_SUPERPERIDOT5 ,
2017-08-02 12:11:21 +00:00
SKINCOLOR_SUPERSKY1 ,
SKINCOLOR_SUPERSKY2 ,
SKINCOLOR_SUPERSKY3 ,
SKINCOLOR_SUPERSKY4 ,
SKINCOLOR_SUPERSKY5 ,
2016-08-10 18:48:20 +00:00
SKINCOLOR_SUPERPURPLE1 ,
SKINCOLOR_SUPERPURPLE2 ,
SKINCOLOR_SUPERPURPLE3 ,
SKINCOLOR_SUPERPURPLE4 ,
SKINCOLOR_SUPERPURPLE5 ,
SKINCOLOR_SUPERRUST1 ,
SKINCOLOR_SUPERRUST2 ,
SKINCOLOR_SUPERRUST3 ,
SKINCOLOR_SUPERRUST4 ,
SKINCOLOR_SUPERRUST5 ,
SKINCOLOR_SUPERTAN1 ,
SKINCOLOR_SUPERTAN2 ,
SKINCOLOR_SUPERTAN3 ,
SKINCOLOR_SUPERTAN4 ,
SKINCOLOR_SUPERTAN5 ,
2020-02-15 08:18:41 +00:00
SKINCOLOR_FIRSTFREESLOT ,
2020-05-24 00:29:07 +00:00
SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1 ,
2020-02-15 08:18:41 +00:00
MAXSKINCOLORS ,
NUMSUPERCOLORS = ( ( SKINCOLOR_FIRSTFREESLOT - FIRSTSUPERCOLOR ) / 5 )
} skincolornum_t ;
2020-05-28 16:43:04 +00:00
extern UINT16 numskincolors ;
2020-02-15 08:18:41 +00:00
extern skincolor_t skincolors [ MAXSKINCOLORS ] ;
2014-03-15 16:59:03 +00:00
// State updates, number of tics / second.
// NOTE: used to setup the timer rate, see I_StartupTimer().
# define TICRATE 35
# define NEWTICRATERATIO 1 // try 4 for 140 fps :)
# define NEWTICRATE (TICRATE*NEWTICRATERATIO)
2018-09-18 14:22:17 +00:00
# define MUSICRATE 1000 // sound timing is calculated by milliseconds
2014-03-15 16:59:03 +00:00
# define RING_DIST 512*FRACUNIT // how close you need to be to a ring to attract it
# define PUSHACCEL (2*FRACUNIT) // Acceleration for MF2_SLIDEPUSH items.
2021-12-28 22:51:08 +00:00
// Special linedef executor tag numbers! Binary map format only (UDMF has other ways of doing these things).
2014-03-15 16:59:03 +00:00
enum {
2019-06-19 23:24:13 +00:00
LE_PINCHPHASE = - 2 , // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!)
LE_ALLBOSSESDEAD = - 3 , // All bosses in the map are dead (Egg capsule raise)
LE_BOSSDEAD = - 4 , // A boss in the map died (Chaos mode boss tally)
2019-07-02 23:50:12 +00:00
LE_BOSS4DROP = - 5 , // CEZ boss dropped its cage (also subtract the number of hitpoints it's lost)
2019-06-19 23:24:13 +00:00
LE_BRAKVILEATACK = - 6 , // Brak's doing his LOS attack, oh noes
LE_TURRET = 32000 , // THZ turret
LE_BRAKPLATFORM = 4200 , // v2.0 Black Eggman destroys platform
LE_CAPSULE2 = 682 , // Egg Capsule
LE_CAPSULE1 = 681 , // Egg Capsule
LE_CAPSULE0 = 680 , // Egg Capsule
LE_KOOPA = 650 , // Distant cousin to Gay Bowser
LE_AXE = 649 , // MKB Axe object
LE_PARAMWIDTH = - 100 // If an object that calls LinedefExecute has a nonzero parameter value, this times the parameter will be subtracted. (Mostly for the purpose of coexisting bosses...)
2014-03-15 16:59:03 +00:00
} ;
// Name of local directory for config files and savegames
2021-03-30 18:27:10 +00:00
# if (defined (__unix__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (__APPLE__)
2014-03-15 16:59:03 +00:00
# define DEFAULTDIR ".srb2"
# else
# define DEFAULTDIR "srb2"
# endif
# include "g_state.h"
// commonly used routines - moved here for include convenience
/** \brief The I_Error function
\ param error the error message
\ return void
*/
void I_Error ( const char * error , . . . ) FUNCIERROR ;
/** \brief write a message to stderr (use before I_Quit) for when you need to quit with a msg, but need
the return code 0 of I_Quit ( ) ;
\ param error message string
\ return void
*/
void I_OutputMsg ( const char * error , . . . ) FUNCPRINTF ;
// console.h
typedef enum
{
CONS_NOTICE ,
CONS_WARNING ,
CONS_ERROR
} alerttype_t ;
void CONS_Printf ( const char * fmt , . . . ) FUNCPRINTF ;
void CONS_Alert ( alerttype_t level , const char * fmt , . . . ) FUNCDEBUG ;
void CONS_Debug ( INT32 debugflags , const char * fmt , . . . ) FUNCDEBUG ;
// For help debugging functions.
# define POTENTIALLYUNUSED CONS_Alert(CONS_WARNING, "(%s:%d) Unused code appears to be used.\n", __FILE__, __LINE__)
# include "m_swap.h"
// Things that used to be in dstrings.h
# define SAVEGAMENAME "srb2sav"
2020-05-12 17:37:15 +00:00
extern char savegamename [ 256 ] ;
2020-05-15 12:23:37 +00:00
extern char liveeventbackup [ 256 ] ;
2014-03-15 16:59:03 +00:00
// m_misc.h
# ifdef GETTEXT
# define M_GetText(String) gettext(String)
# else
// If no translations are to be used, make a stub
// M_GetText function that just returns the string.
# define M_GetText(x) (x)
# endif
2020-01-11 20:24:43 +00:00
void M_StartupLocale ( void ) ;
2014-03-15 16:59:03 +00:00
extern void * ( * M_Memcpy ) ( void * dest , const void * src , size_t n ) FUNCNONNULL ;
char * va ( const char * format , . . . ) FUNCPRINTF ;
char * M_GetToken ( const char * inputString ) ;
2016-10-22 22:19:24 +00:00
void M_UnGetToken ( void ) ;
2022-01-08 12:17:15 +00:00
void M_TokenizerOpen ( const char * inputString ) ;
void M_TokenizerClose ( void ) ;
const char * M_TokenizerRead ( UINT32 i ) ;
UINT32 M_TokenizerGetEndPos ( void ) ;
void M_TokenizerSetEndPos ( UINT32 newPos ) ;
2014-03-15 16:59:03 +00:00
char * sizeu1 ( size_t num ) ;
char * sizeu2 ( size_t num ) ;
char * sizeu3 ( size_t num ) ;
char * sizeu4 ( size_t num ) ;
char * sizeu5 ( size_t num ) ;
// d_main.c
2020-07-11 05:39:46 +00:00
extern int VERSION ;
extern int SUBVERSION ;
2014-03-15 16:59:03 +00:00
extern boolean devparm ; // development mode (-debug)
// d_netcmd.c
extern INT32 cv_debug ;
# define DBG_BASIC 0x0001
# define DBG_DETAILED 0x0002
2018-04-08 13:31:56 +00:00
# define DBG_PLAYER 0x0004
2014-03-15 16:59:03 +00:00
# define DBG_RENDER 0x0008
# define DBG_NIGHTSBASIC 0x0010
# define DBG_NIGHTS 0x0020
# define DBG_POLYOBJ 0x0040
# define DBG_GAMELOGIC 0x0080
# define DBG_NETPLAY 0x0100
# define DBG_MEMORY 0x0200
# define DBG_SETUP 0x0400
# define DBG_LUA 0x0800
2018-04-08 13:31:56 +00:00
# define DBG_RANDOMIZER 0x1000
2020-01-18 02:39:15 +00:00
# define DBG_VIEWMORPH 0x2000
2014-03-15 16:59:03 +00:00
// =======================
// Misc stuff for later...
// =======================
2019-08-18 17:16:48 +00:00
# define ANG2RAD(angle) ((float)((angle)*M_PI) / ANGLE_180)
2016-11-02 22:23:22 +00:00
// Modifier key variables, accessible anywhere
extern UINT8 shiftdown , ctrldown , altdown ;
2018-07-31 09:10:02 +00:00
extern boolean capslock ;
2016-11-02 22:23:22 +00:00
2014-03-15 16:59:03 +00:00
// if we ever make our alloc stuff...
# define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL)
2019-02-23 04:18:33 +00:00
# define ZZ_Calloc(x) Z_Calloc(x, PU_STATIC, NULL)
2014-03-15 16:59:03 +00:00
// i_system.c, replace getchar() once the keyboard has been appropriated
INT32 I_GetKey ( void ) ;
2021-12-17 06:10:36 +00:00
/* http://www.cse.yorku.ca/~oz/hash.html */
static inline
UINT32 quickncasehash ( const char * p , size_t n )
{
size_t i = 0 ;
UINT32 x = 5381 ;
while ( i < n & & p [ i ] )
{
x = ( x * 33 ) ^ tolower ( p [ i ] ) ;
i + + ;
}
return x ;
}
2014-03-15 16:59:03 +00:00
# ifndef min // Double-Check with WATTCP-32's cdefs.h
# define min(x, y) (((x) < (y)) ? (x) : (y))
# endif
# ifndef max // Double-Check with WATTCP-32's cdefs.h
# define max(x, y) (((x) > (y)) ? (x) : (y))
# endif
2023-01-27 01:26:28 +00:00
// Max gamepad/joysticks that can be detected/used.
# define MAX_JOYSTICKS 4
2019-03-02 23:56:44 +00:00
# ifndef M_PIl
# define M_PIl 3.1415926535897932384626433832795029L
# endif
2018-12-25 01:22:10 +00:00
// Floating point comparison epsilons from float.h
2018-12-25 01:36:28 +00:00
# ifndef FLT_EPSILON
2018-12-25 01:22:10 +00:00
# define FLT_EPSILON 1.1920928955078125e-7f
2018-12-25 01:36:28 +00:00
# endif
# ifndef DBL_EPSILON
2019-03-02 23:56:44 +00:00
# define DBL_EPSILON 2.2204460492503131e-16l
2018-12-25 01:36:28 +00:00
# endif
2018-12-25 01:22:10 +00:00
2014-03-15 16:59:03 +00:00
// An assert-type mechanism.
# ifdef PARANOIA
# define I_Assert(e) ((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
# else
# define I_Assert(e) ((void)0)
# endif
// The character that separates pathnames. Forward slash on
2020-07-25 22:55:51 +00:00
// most systems, but reverse solidus (\) on Windows.
# if defined (_WIN32)
2014-03-15 16:59:03 +00:00
# define PATHSEP "\\"
# else
# define PATHSEP " / "
# endif
2020-01-08 20:58:19 +00:00
# define PUNCTUATION "!\"#$%&'()*+,-. / :;<=>?@[\\]^_`{|}~"
2014-03-15 16:59:03 +00:00
// Compile date and time and revision.
2023-08-01 02:29:45 +00:00
extern const char
* compdate ,
* comptime ,
* comprevision ,
* compbranch ,
* compnote ,
* comptype ;
extern int
compuncommitted ,
compoptimized ;
2014-03-15 16:59:03 +00:00
// Disabled code and code under testing
// None of these that are disabled in the normal build are guaranteed to work perfectly
// Compile them at your own risk!
/// Allows the use of devmode in multiplayer. AKA "fishcake"
//#define NETGAME_DEVMODE
/// Allows gravity changes in netgames, no questions asked.
//#define NETGAME_GRAVITY
/// Dumps the contents of a network save game upon consistency failure for debugging.
//#define DUMPCONSISTENCY
/// Who put weights on my recycler? ... Inuyasha did.
/// \note XMOD port.
//#define WEIGHTEDRECYCLER
/// Allow loading of savegames between different versions of the game.
/// \note XMOD port.
/// Most modifications should probably enable this.
//#define SAVEGAME_OTHERVERSIONS
/// Shuffle's incomplete OpenGL sorting code.
2014-03-19 23:10:37 +00:00
# define SHUFFLE // This has nothing to do with sorting, why was it disabled?
2014-03-15 16:59:03 +00:00
/// Allow the use of the SOC RESETINFO command.
/// \note Builds that are tight on memory should disable this.
/// This stops the game from storing backups of the states, sprites, and mobjinfo tables.
/// Though this info is compressed under normal circumstances, it's still a lot of extra
/// memory that never gets touched.
# define ALLOW_RESETDATA
2014-11-12 00:55:07 +00:00
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
2016-08-20 14:15:48 +00:00
/// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
2016-08-18 21:20:42 +00:00
//#define PAPER_COLLISIONCORRECTION
2017-01-10 18:01:03 +00:00
/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
/// on the bright side it fixes some weird issues with translucent walls
/// \note SRB2CB port.
/// SRB2CB itself ported this from PrBoom+
2017-01-12 21:44:27 +00:00
# define NEWCLIP
2017-01-10 18:01:03 +00:00
2020-01-24 01:30:36 +00:00
/// OpenGL shaders
2019-12-25 19:22:01 +00:00
# define GL_SHADERS
2016-10-31 20:15:11 +00:00
/// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink.
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
2018-06-06 13:42:50 +00:00
# define SECTORSPECIALSAFTERTHINK
2016-10-31 20:15:11 +00:00
2019-08-18 17:16:48 +00:00
/// Sprite rotation
# define ROTSPRITE
2019-12-17 16:39:26 +00:00
# define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
2019-08-18 17:16:48 +00:00
# define ROTANGDIFF (360 / ROTANGLES)
2019-11-09 04:36:53 +00:00
/// PNG support
2019-09-07 19:54:26 +00:00
# ifndef HAVE_PNG
# define NO_PNG_LUMPS
# endif
2019-05-27 02:37:23 +00:00
2019-11-09 04:36:53 +00:00
/// Render flats on walls
# define WALLFLATS
2020-06-20 01:04:20 +00:00
/// Maintain compatibility with older 2.2 demos
# define OLD22DEMOCOMPAT
2020-08-30 00:51:59 +00:00
# if defined (HAVE_CURL) && ! defined (NONET)
2020-08-17 04:42:58 +00:00
# define MASTERSERVER
# else
# undef UPDATE_ALERT
# endif
2014-03-15 16:59:03 +00:00
# endif // __DOOMDEF__