|
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
|
Includes
- Special macros defined for this file:
Pragma directives
Disabled compiler warnings (Visual C++-only)
All of the below warnings will not be issued by the compiler:
Warning ID
|
Level
|
Description
|
C4127
|
Level 4
|
conditional expression is constant
|
C4152
|
Level 4
|
non standard extension, function/data ptr conversion in expression
|
C4213
|
Level 4
|
nonstandard extension used : cast on l-value
|
C4514
|
Level 4
|
'function' : unreferenced inline function has been removed
|
C4306
|
Level 3
|
Disabled only for Win64
'identifier' : conversion from 'type1' to 'type2' of greater size
|
Externs
Variables
Data name
|
Data type
|
Non-extern location(s)
|
Description
|
numskincolors
|
UINT16
|
d_main.c
|
|
skincolors[MAXSKINCOLORS]
|
skincolor_t
|
info.c
|
|
*logstream
|
FILE
|
sdl/i_main.c
win32/win_main.c
hardware/s_ds3d/s_ds3d.c
hardware/s_fmod/s_fmod.c
|
Declared only if LOGMESSAGES is enabled
|
logfilename[1024]
|
char
|
sdl/i_main.c
|
Declared only if LOGMESSAGES is enabled
|
savegamename[256]
|
char
|
d_main.c
|
Savegame file name format string.
|
liveeventbackup[256]
|
char
|
d_main.c
|
|
VERSION
|
int
|
d_main.c
|
Game version number
|
SUBVERSION
|
int
|
d_main.c
|
Game sub-version number
|
devparm
|
boolean
|
d_main.c
|
Set to true if the game is launched with -debug in the command line parameters. Otherwise, this will be false.
|
cv_debug
|
INT32
|
d_netcmd.c
|
Stores the combined value of the current development mode feature flags applied; see the Debug section.
|
shiftdown
ctrldown
altdown
|
UINT8
|
d_main.c
|
Modifier key variables; these indicate whether the left or right Shift, Ctrl and Alt keys are being held down or not, respectively.
|
capslock
|
boolean
|
d_main.c
|
Indicates whether caps lock is on or not.
|
*compdate
*comptime
*comprevision
*compbranch
|
const char
|
comptime.c
|
Compilation date, time, revision and branch
|
Function pointers
Data name
|
Return type
|
Params
|
Attributes
|
Non-extern location(s)
|
Description
|
M_Memcpy
|
void *
|
void *dest ,
const void *src ,
size_t n
|
FUNCNONNULL
|
m_misc.c
|
Pointer to the memory copying function. Depending on the system's CPU (or the command line parameters given), MMX, 3DNow, MMXExt, or SSE may be used internally for optimization.
|
Function prototypes
Function name
|
Return type
|
Params
|
Defined in
|
Attributes
|
Description/Other notes
|
I_Error
|
void
|
const char *error ,
...
|
android/i_system.c
djgppdos/i_system.c
dummy/i_system.c
sdl/i_system.c
win32/win_sys.c
|
FUNCIERROR
|
Forces the game to close, displaying a formatted error message in a separate window.
|
I_OutputMsg
|
void
|
const char *error ,
...
|
android/i_system.c
djgppdos/i_system.c
dummy/i_system.c
sdl/i_system.c
win32/win_sys.c
|
FUNCPRINTF
|
Writes a formatted message to the output device.
|
CONS_Printf
|
void
|
const char *fmt ,
...
|
console.c
|
FUNCPRINTF
|
Prints a formatted message to the console.
|
CONS_Alert
|
void
|
alerttype_t level ,
const char *fmt ,
...
|
console.c
|
FUNCDEBUG
|
Prints a formatted alert message (notice, warning or error) to the console.
|
CONS_Debug
|
void
|
INT32 debugflags ,
const char *fmt ,
...
|
console.c
|
FUNCDEBUG
|
Prints a formatted debugging message to the console for development mode. debugflags determines the feature flags required for the message to be printed.
|
M_StartupLocale
|
void
|
none
|
m_misc.c
|
|
Sets up gettext to translate SRB2's strings.
|
va
|
char *
|
const char *format ,
...
|
m_misc.c
|
FUNCPRINTF
|
Returns a temporary string made out of varargs. This allows formatting in string arguments for functions that do not normally support formatting.
|
M_GetToken
|
char *
|
const char *inputString
|
m_misc.c
|
|
Token parser function for TEXTURES and ANIMDEFS . Returns a pointer to a string containing the fetched token.
|
M_UnGetToken
|
void
|
none
|
m_misc.c
|
|
|
M_GetTokenPos
|
UINT32
|
none
|
m_misc.c
|
|
|
M_SetTokenPos
|
void
|
UINT32 newPos
|
m_misc.c
|
|
|
sizeu1
|
char *
|
size_t num
|
m_misc.c
|
|
Function to put a size_t argument in a character buffer, format it with PRIdS , and returning the pointer to the buffer.
|
sizeu2
|
char *
|
size_t num
|
m_misc.c
|
|
Function to put a size_t argument in a character buffer, format it with PRIdS , and returning the pointer to the buffer.
|
sizeu3
|
char *
|
size_t num
|
m_misc.c
|
|
Function to put a size_t argument in a character buffer, format it with PRIdS , and returning the pointer to the buffer.
|
sizeu4
|
char *
|
size_t num
|
m_misc.c
|
|
Function to put a size_t argument in a character buffer, format it with PRIdS , and returning the pointer to the buffer.
|
sizeu5
|
char *
|
size_t num
|
m_misc.c
|
|
Function to put a size_t argument in a character buffer, format it with PRIdS , and returning the pointer to the buffer.
|
I_GetKey
|
INT32
|
none
|
android/i_system.c
djgppdos/i_system.c
dummy/i_system.c
sdl/i_system.c
win32/win_sys.c
|
|
Returns a key that has been pushed, or 0 (replaces getchar() at game startup).
|
Macros
Version macros
Note: VERSION
and SUBVERSION
are now variables instead of macros; the current SRB2 version now is defined by the SRB2VERSION
macro in version.h
.
Macro
|
Defined as
|
Description
|
VERSIONSTRING
|
if DEVELOP is defined:
"Development EXE"
if BETAVERSION is defined:
"v"SRB2VERSION" "BETAVERSION
Other:
"v"SRB2VERSION
|
Version string; this is displayed on the title screen and used by the console command version
|
VERSIONSTRING_RC
|
if BETAVERSION is defined:
SRB2VERSION " " BETAVERSION "\0"
Other:
SRB2VERSION "\0"
|
|
VERSIONSTRINGW
|
WSTRING (VERSIONSTRING)code>
|
Wide string version of VERSIONSTRING ; used by I_UpdateMumble if HAVE_MUMBLE is defined.
|
SERVER_URL_PROTOCOL
|
"srb2://"
|
|
USE_PATCH_DTA
|
1 (Enabled)
|
Does this version require an added patch file?
|
USE_KART
|
Disabled
|
Use .kart extension addons
|
Update alerts
Macro
|
Defined as
|
Description
|
UPDATE_ALERT
|
1 (Enabled)
|
If enabled, displays update alerts. Note: This is disabled if BETAVERSION is enabled.
|
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"
|
String used in alert for notifying an update is available
|
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"
|
I_Error version of UPDATE_ALERT_STRING , used when trying to host through command line parameters
|
Modification details
Note: MODID
and MODVERSION
are now defined in version.h
.
- See also: Console/Commands >
mod_details
Macro
|
Defined as
|
Description
|
CODEBASE
|
220
|
Version of SRB2 the modification is based on (220 = 2.2)
|
Exec version
Macro
|
Defined as
|
Description
|
MAJOREXECVERSION
|
MODVERSION
|
|
MINOREXECVERSION
|
0
|
|
GETMAJOREXECVERSION(v)
|
|
|
GETMINOREXECVERSION(v)
|
|
|
GETEXECVERSION(major,minor)
|
|
|
EXECVERSION
|
GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION)
|
|
In-game constants
Macro
|
Defined as
|
Description
|
Players
|
MAXPLAYERS
|
32
|
Maximum possible number of players
|
MAXSKINS
|
MAXPLAYERS (32)
|
Maximum possible number of character skins
|
PLAYERSMASK
|
(MAXPLAYERS-1) (31)
|
Used to limit integers representing player numbers to values between 0 and 31. In particular, some functions that search for players (such as P_LookForPlayers ) use this macro to limit actor->lastlook to an integer that can be used in the players and playeringame arrays when looking for a new player.
e.g. x & PLAYERSMASK
|
MAXPLAYERNAME
|
21
|
Maximum possible player name length
|
Skin colors
|
COLORRAMPSIZE
|
16
|
|
MAXCOLORNAME
|
32
|
|
NUMCOLORFREESLOTS
|
1024
|
|
Tic rate
|
OLDTICRATE
|
35
|
Number of tics in a second ("Old" value) – this is the "base" tic rate macro. NEWTICRATERATIO is used to convert this to the "new" tic-rate value.
|
NEWTICRATERATIO
|
1
|
TICRATE :OLDTICRATE ratio
|
TICRATE
|
(OLDTICRATE*NEWTICRATERATIO) (35)
|
Number of tics in a second ("New" value) – this is the main tic rate macro used throughout the source code.
|
MUSICRATE
|
1000
|
The music playback rate, or the number of milliseconds in a second, i.e., anything multiplied by this value is a measurement in seconds (in the context of music playback).
|
Miscellaneous
|
RING_DIST
|
512*FRACUNIT
|
Attraction Shield's ring-attraction radius – how close a player with the shield needs to be to a ring to attract it. Also used by the Homing Attack character ability, as the maximum distance a player can be from their targeted object.
|
PUSHACCEL
|
(2*FRACUNIT)
|
Acceleration for MF2_SLIDEPUSH items.
|
MAX_JOYSTICK
|
4
|
Max gamepad/joysticks that can be detected/used
|
Debug
- See also: Development mode
Decimal
|
Hexadecimal
|
Name
|
Description
|
1
|
0x0001
|
DBG_BASIC
|
Basic
|
2
|
0x0002
|
DBG_DETAILED
|
Detailed
|
4
|
0x0004
|
DBG_PLAYER
|
Player
|
8
|
0x0008
|
DBG_RENDER
|
Render
|
16
|
0x0010
|
DBG_NIGHTSBASIC
|
NiGHTS Basic
|
32
|
0x0020
|
DBG_NIGHTS
|
NiGHTS
|
64
|
0x0040
|
DBG_POLYOBJ
|
PolyObj
|
128
|
0x0080
|
DBG_GAMELOGIC
|
Gamelogic
|
256
|
0x0100
|
DBG_NETPLAY
|
Netplay
|
512
|
0x0200
|
DBG_MEMORY
|
Memory
|
1024
|
0x0400
|
DBG_SETUP
|
Setup
|
2048
|
0x0800
|
DBG_LUA
|
Lua
|
4096
|
0x1000
|
DBG_RANDOMIZER
|
Randomizer
|
8192
|
0x2000
|
DBG_VIEWMORPH
|
Viewmorph
|
Disabled code and code under testing
Macro
|
Status
|
Description
|
NETGAME_DEVMODE
|
Disabled
|
Allows the use of development mode in multiplayer.
|
NETGAME_GRAVITY
|
Disabled
|
Allows the use of gravity in netgames.
|
DUMPCONSISTENCY
|
Disabled
|
Dumps the contents of a network save game upon consistency failure for debugging.
|
SEENAMES
|
Enabled
|
See name of player in your crosshair.
|
WEIGHTEDRECYCLER
|
Disabled
|
Code for weighted recyclers. (ported from X-SRB2)
|
SAVEGAME_OTHERVERSIONS
|
Disabled
|
Allow loading of savegames between different versions of the game. (ported from X-SRB2)
|
SHUFFLE
|
Enabled
|
Shuffle's incomplete OpenGL sorting code.
|
ALLOW_RESETDATA
|
Enabled
|
Allows use of ResetData in SOCs. (see MainCfg )
|
CLIENT_LOADINGSCREEN
|
Enabled
|
Display a connection screen on join attempts.
|
REDSANALOG
|
Disabled
|
Experimental tweaks to analog mode.
|
MUSICSLOT_COMPATIBILITY
|
Enabled
|
Backwards compatibility with musicslots.
|
PAPER_COLLISIONCORRECTION
|
Disabled
|
Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls.
|
NEWCLIP
|
Enabled
|
New clipping code for OpenGL.
|
GL_SHADERS
|
Enabled
|
OpenGL shaders
|
SECTORSPECIALSAFTERTHINK
|
Disabled
|
Handles touching sector specials in P_PlayerAfterThink instead of P_PlayerThink . Required for proper collision with moving sloped surfaces that have sector specials on them.
|
LUA_PATCH_SAFETY
|
Disabled
|
Cache patches in Lua in a way that renderer switching will work flawlessly.
|
WALLFLATS
|
Enabled
|
Render flats on walls
|
OLD22DEMOCOMPAT
|
Enabled
|
Maintain compatibility with older 2.2 demos
|
Sound system
Macro
|
Defined as
|
Description
|
SOUND_DUMMY
|
0
|
Dummy interface
|
SOUND_SDL
|
1
|
Generic SDL interface
|
SOUND_MIXER
|
2
|
Mixer interface
|
SOUND_FMOD
|
3
|
FMOD interface
|
SOUND
|
Any of the above, depends on compilation settings
|
Macro for determining the sound interface to use
|
Function macros
Macro
|
Defined as
|
Description
|
M_GetText(String)
|
|
Calls gettext to find an alternative translation for the string given. If none are available, this just returns the original string given.
This macro's normal definition requires GETTEXT to be enabled; otherwise, this macro is just defined as the string originally given.
|
ANG2RAD(angle)
|
((float)((angle)*M_PI)/ANGLE_180)
|
|
ZZ_Alloc(x)
|
Z_Malloc(x, PU_STATIC, NULL)
|
|
ZZ_Calloc(x)
|
Z_Calloc(x, PU_STATIC, NULL)
|
|
min(x, y)
|
(((x) < (y)) ? (x) : (y))
|
This definition of min is used only if the function is not already defined.
|
max(x, y)
|
(((x) > (y)) ? (x) : (y))
|
This definition of max is used only if the function is not already defined.
|
I_Assert(e)
|
if PARANOIA is defined:
((e) ? (void)0 : I_Error("assert failed: %s, file %s, line %d", #e, __FILE__, __LINE__))
Other:
|
If the assert given fails, the game calls I_Error giving the file and line where the assert failed in.
This macro's definition requires PARANOIA to be enabled (note: it is undefined in normal SRB2 builds); otherwise, this function does nothing.
|
Floating point constants
Macro
|
Defined as
|
Description
|
M_PIl
|
3.1415926535897932384626433832795029L
|
|
FLT_EPSILON
|
1.1920928955078125e-7f
|
Epsilon for single-precision floating point numbers.
|
DBL_EPSILON
|
2.2204460492503131e-16l
|
Epsilon for double-precision floating point numbers.
|
Sprite rotation
Macro
|
Defined as
|
Description
|
ROTSPRITE
|
1 (Enabled)
|
|
ROTANGLES
|
72
|
|
ROTANGDIFF
|
(360 / ROTANGLES)
|
|
Miscellaneous
Macro
|
Defined as
|
Description
|
ASMCALL
|
|
Win32-only
|
LOGMESSAGES
|
1 (Enabled)
|
Win32/Unix (non-MS-DOS)/Apple/Mac OS-only
If enabled, writes messages in log.txt
|
DEFAULTDIR
|
Unix (except MS-DOS, Cygwin or Apple systems):
".srb2"
Other:
"srb2"
|
Name of local directory for config files and savegames.
|
POTENTIALLYUNUSED
|
CONS_Alert(CONS_WARNING, "(%s:%d) Unused code appears to be used.\n", __FILE__, __LINE__)
|
Give a warning message in the console if any function (or part of one) containing this macro is called. Currently unused in SRB2's source code.
|
SAVEGAMENAME
|
"srb2sav"
|
Default file name (without numbers or .ssg extension) for SRB2's savegame files
|
PATHSEP
|
Win32:
"\\" (backslash)
Other:
"/" (slash)
|
The character that separates pathnames
|
PUNCTUATION
|
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
|
NO_PNG_LUMPS
|
0 (Disabled)
|
Defined only if HAVE_PNG is not defined
|
MASTERSERVER
|
1 (Enabled)
|
Defined only if HAVE_CURL is defined, and NONET is not defined
|
Typedefs
Name
|
Type
|
Description
|
skincolor_t
struct skincolor_s
|
struct
|
The skin color struct.
|
skincolornum_t
|
enum
|
The skin colors enum. Includes the translations for super colors.
|
alerttype_t
|
enum
|
Alert types for CONS_Alert .
|
Enumerations
skincolornum_t
Reserved linedef tags
alerttype_t
Value
|
Name
|
Description
|
0
|
CONS_NOTICE
|
Low-importance alert; e.g.: incorrect input
|
1
|
CONS_WARNING
|
Medium-importance alert; e.g.: minor issue in WAD detected on load
|
2
|
CONS_ERROR
|
High-importance alert; e.g.: maximum WAD files reached, or WAD file not found
|
Structs
skincolor_t
Data name
|
Data type
|
Description
|
name[MAXCOLORNAME+1]
|
char
|
Skincolor name
|
ramp[COLORRAMPSIZE]
|
UINT8
|
Colormap ramp
|
invcolor
|
UINT16
|
Signpost color
|
invshade
|
UINT8
|
Signpost color shade
|
chatcolor
|
UINT16
|
Chat color
|
accessible
|
boolean
|
Accessible by the color command + setup menu
|