mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Merge branch 'next' into more-sprite2
This commit is contained in:
commit
5dd82cb7db
30 changed files with 140 additions and 113 deletions
|
@ -245,6 +245,7 @@ target_compile_options(SRB2SDL2 PRIVATE
|
|||
# This is a direct translation from versions.mk
|
||||
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-trigraphs
|
||||
-W # Was controlled by RELAXWARNINGS
|
||||
-Wfloat-equal
|
||||
|
@ -312,11 +313,7 @@ target_compile_options(SRB2SDL2 PRIVATE
|
|||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
|
||||
-Wno-error=format-overflow
|
||||
-Wno-error=stringop-truncation
|
||||
-Wno-error=stringop-overflow
|
||||
-Wno-format-overflow
|
||||
-Wno-stringop-truncation
|
||||
-Wno-stringop-overflow
|
||||
-Wno-error=multistatement-macros
|
||||
>
|
||||
|
||||
|
@ -329,7 +326,9 @@ target_compile_options(SRB2SDL2 PRIVATE
|
|||
$<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
||||
-Wall
|
||||
-Wno-absolute-value
|
||||
-Wextra
|
||||
-Wno-trigraphs
|
||||
-Wconditional-uninitialized
|
||||
-Wno-error=non-literal-null-conversion
|
||||
-Wno-error=constant-conversion
|
||||
-Wno-error=unused-but-set-variable
|
||||
|
@ -346,6 +345,9 @@ target_compile_options(SRB2SDL2 PRIVATE
|
|||
# C++, GNU, Clang and Apple Clang
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-trigraphs
|
||||
-Wconditional-uninitialized
|
||||
>
|
||||
|
||||
# C++, MSVC
|
||||
|
|
|
@ -135,11 +135,7 @@ ifdef GCC71
|
|||
endif
|
||||
ifdef GCC81
|
||||
WFLAGS+=-Wno-error=format-overflow
|
||||
WFLAGS+=-Wno-error=stringop-truncation
|
||||
WFLAGS+=-Wno-error=stringop-overflow
|
||||
WFLAGS+=-Wno-format-overflow
|
||||
WFLAGS+=-Wno-stringop-truncation
|
||||
WFLAGS+=-Wno-stringop-overflow
|
||||
WFLAGS+=-Wno-error=multistatement-macros
|
||||
endif
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
|||
void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
int loop;
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
TValue *tm;
|
||||
TValue *tm = NULL;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
Table *h = hvalue(t);
|
||||
TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
|
||||
|
|
|
@ -2060,16 +2060,16 @@ void CV_StealthSet(consvar_t *var, const char *value)
|
|||
*/
|
||||
static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth)
|
||||
{
|
||||
char val[SKINNAMESIZE+1];
|
||||
char val[SKINNAMESIZE+1] = "None";
|
||||
|
||||
if (var == &cv_forceskin) // Special handling.
|
||||
{
|
||||
const char *tmpskin = NULL;
|
||||
if ((value < 0) || (value >= numskins))
|
||||
tmpskin = "None";
|
||||
;
|
||||
else
|
||||
tmpskin = skins[value]->name;
|
||||
strncpy(val, tmpskin, SKINNAMESIZE);
|
||||
memcpy(val, tmpskin, SKINNAMESIZE);
|
||||
}
|
||||
else
|
||||
sprintf(val, "%d", value);
|
||||
|
|
|
@ -324,7 +324,7 @@ void readPlayer(MYFILE *f, INT32 num)
|
|||
if (fastcmp(word, "PICNAME"))
|
||||
{
|
||||
SLOTFOUND
|
||||
strncpy(description[num].picname, word2, 8);
|
||||
strncpy(description[num].picname, word2, sizeof(description[num].picname)-1);
|
||||
}
|
||||
else if (fastcmp(word, "DISPLAYNAME"))
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ void readPlayer(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME"))
|
||||
{
|
||||
SLOTFOUND
|
||||
strncpy(description[num].nametag, word2, 8);
|
||||
strncpy(description[num].nametag, word2, sizeof(description[num].nametag)-1);
|
||||
}
|
||||
else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR"))
|
||||
{
|
||||
|
@ -1163,7 +1163,7 @@ void readgametype(MYFILE *f, char *gtname)
|
|||
INT16 newgtrankingstype = -1;
|
||||
int newgtinttype = 0;
|
||||
char gtdescription[441];
|
||||
char gtconst[MAXLINELEN];
|
||||
char gtconst[MAXLINELEN+1];
|
||||
|
||||
// Empty strings.
|
||||
gtdescription[0] = '\0';
|
||||
|
@ -1677,7 +1677,7 @@ void readlevelheader(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "SKYNUM"))
|
||||
mapheaderinfo[num-1]->skynum = (INT16)i;
|
||||
else if (fastcmp(word, "INTERSCREEN"))
|
||||
strncpy(mapheaderinfo[num-1]->interscreen, word2, 8);
|
||||
strncpy(mapheaderinfo[num-1]->interscreen, word2, sizeof(mapheaderinfo[num-1]->interscreen)-1);
|
||||
else if (fastcmp(word, "PRECUTSCENENUM"))
|
||||
mapheaderinfo[num-1]->precutscenenum = (UINT8)i;
|
||||
else if (fastcmp(word, "CUTSCENENUM"))
|
||||
|
@ -2294,7 +2294,7 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
|
|||
char name[34];
|
||||
name[0] = '\x82'; // color yellow
|
||||
name[1] = 0;
|
||||
strncat(name, word2, 33);
|
||||
strncat(name, word2, 32);
|
||||
name[33] = 0;
|
||||
|
||||
// Replace _ with ' '
|
||||
|
@ -2304,7 +2304,7 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum)
|
|||
name[j] = ' ';
|
||||
}
|
||||
|
||||
strncpy(textprompts[num]->page[pagenum].name, name, 32);
|
||||
strncpy(textprompts[num]->page[pagenum].name, name, sizeof(textprompts[num]->page[pagenum].name));
|
||||
}
|
||||
else
|
||||
*textprompts[num]->page[pagenum].name = '\0';
|
||||
|
@ -3794,7 +3794,7 @@ void readmaincfg(MYFILE *f)
|
|||
}
|
||||
else if (fastcmp(word, "TITLEPICSNAME"))
|
||||
{
|
||||
strncpy(ttname, word2, 9);
|
||||
strncpy(ttname, word2, sizeof(ttname)-1);
|
||||
titlechanged = true;
|
||||
}
|
||||
else if (fastcmp(word, "TITLEPICSX"))
|
||||
|
@ -3878,8 +3878,12 @@ void readmaincfg(MYFILE *f)
|
|||
savemoddata = true;
|
||||
|
||||
// Also save a time attack folder
|
||||
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
|
||||
strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder)));
|
||||
filenamelen = strlen(gamedatafilename); // Strip off the extension
|
||||
if (filenamelen >= 4)
|
||||
filenamelen -= 4;
|
||||
if (filenamelen >= sizeof(timeattackfolder))
|
||||
filenamelen = sizeof(timeattackfolder)-1;
|
||||
strncpy(timeattackfolder, gamedatafilename, filenamelen);
|
||||
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
|
||||
|
||||
strcpy(savegamename, timeattackfolder);
|
||||
|
|
|
@ -165,7 +165,7 @@ extern boolean exitfadestarted;
|
|||
typedef struct
|
||||
{
|
||||
UINT8 numpics;
|
||||
char picname[8][8];
|
||||
char picname[8][8+1];
|
||||
UINT8 pichires[8];
|
||||
char *text;
|
||||
UINT16 xcoord[8];
|
||||
|
@ -296,69 +296,69 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
// The original eight, plus one.
|
||||
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
|
||||
char subttl[33]; ///< Subtitle for level
|
||||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
INT16 marathonnext; ///< See nextlevel, but for Marathon mode. Necessary to support hub worlds ala SUGOI.
|
||||
char keywords[33]; ///< Keywords separated by space to search for. 32 characters.
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
UINT32 muspos; ///< Music position to jump to.
|
||||
char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
||||
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
||||
INT16 skynum; ///< Sky number to use.
|
||||
INT16 skybox_scalex; ///< Skybox X axis scale. (0 = no movement, 1 = 1:1 movement, 16 = 16:1 slow movement, -4 = 1:4 fast movement, etc.)
|
||||
INT16 skybox_scaley; ///< Skybox Y axis scale.
|
||||
INT16 skybox_scalez; ///< Skybox Z axis scale.
|
||||
char lvlttl[21+1]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
|
||||
char subttl[32+1]; ///< Subtitle for level
|
||||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
INT16 marathonnext; ///< See nextlevel, but for Marathon mode. Necessary to support hub worlds ala SUGOI.
|
||||
char keywords[32+1]; ///< Keywords separated by space to search for. 32 characters.
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
UINT32 muspos; ///< Music position to jump to.
|
||||
char forcecharacter[16+1]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable.
|
||||
UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave.
|
||||
INT16 skynum; ///< Sky number to use.
|
||||
INT16 skybox_scalex; ///< Skybox X axis scale. (0 = no movement, 1 = 1:1 movement, 16 = 16:1 slow movement, -4 = 1:4 fast movement, etc.)
|
||||
INT16 skybox_scaley; ///< Skybox Y axis scale.
|
||||
INT16 skybox_scalez; ///< Skybox Z axis scale.
|
||||
|
||||
// Extra information.
|
||||
char interscreen[8]; ///< 320x200 patch to display at intermission.
|
||||
char runsoc[33]; ///< SOC to execute at start of level (32 character limit instead of 63)
|
||||
char scriptname[33]; ///< Script to use when the map is switched to. (32 character limit instead of 191)
|
||||
UINT8 precutscenenum; ///< Cutscene number to play BEFORE a level starts.
|
||||
UINT8 cutscenenum; ///< Cutscene number to use, 0 for none.
|
||||
INT16 countdown; ///< Countdown until level end?
|
||||
UINT16 palette; ///< PAL lump to use on this map
|
||||
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
|
||||
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
||||
char interscreen[8+1]; ///< 320x200 patch to display at intermission.
|
||||
char runsoc[32+1]; ///< SOC to execute at start of level (32 character limit instead of 63)
|
||||
char scriptname[32+1]; ///< Script to use when the map is switched to. (32 character limit instead of 191)
|
||||
UINT8 precutscenenum; ///< Cutscene number to play BEFORE a level starts.
|
||||
UINT8 cutscenenum; ///< Cutscene number to use, 0 for none.
|
||||
INT16 countdown; ///< Countdown until level end?
|
||||
UINT16 palette; ///< PAL lump to use on this map
|
||||
UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden.
|
||||
SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no.
|
||||
UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in?
|
||||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
||||
|
||||
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
fixed_t gravity; ///< Map-wide gravity.
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
fixed_t gravity; ///< Map-wide gravity.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[9]; ///< Zig zag patch.
|
||||
char ltzztext[9]; ///< Zig zag text.
|
||||
char ltactdiamond[9]; ///< Act diamond.
|
||||
char ltzzpatch[8+1]; ///< Zig zag patch.
|
||||
char ltzztext[8+1]; ///< Zig zag text.
|
||||
char ltactdiamond[8+1]; ///< Act diamond.
|
||||
|
||||
// Freed animals stuff.
|
||||
UINT8 numFlickies; ///< Internal. For freed flicky support.
|
||||
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
|
||||
UINT8 numFlickies; ///< Internal. For freed flicky support.
|
||||
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
|
||||
|
||||
// NiGHTS stuff.
|
||||
UINT8 numGradedMares; ///< Internal. For grade support.
|
||||
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
|
||||
UINT8 numGradedMares; ///< Internal. For grade support.
|
||||
nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful.
|
||||
|
||||
// Music stuff.
|
||||
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
|
||||
char musintername[7]; ///< Intermission screen music.
|
||||
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
|
||||
char musintername[7]; ///< Intermission screen music.
|
||||
|
||||
char muspostbossname[7]; ///< Post-bossdeath music.
|
||||
UINT16 muspostbosstrack; ///< Post-bossdeath track.
|
||||
UINT32 muspostbosspos; ///< Post-bossdeath position
|
||||
UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds.
|
||||
|
||||
SINT8 musforcereset; ///< Force resetmusic (-1 for default; 0 for force off; 1 for force on)
|
||||
SINT8 musforcereset; ///< Force resetmusic (-1 for default; 0 for force off; 1 for force on)
|
||||
|
||||
// Lua stuff.
|
||||
// (This is not ifdeffed so the map header structure can stay identical, just in case.)
|
||||
|
|
|
@ -4387,11 +4387,10 @@ void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum
|
|||
if (!tag || !tag[0])
|
||||
return;
|
||||
|
||||
strncpy(suffixedtag, tag, 33);
|
||||
suffixedtag[32] = 0;
|
||||
strncpy(suffixedtag, tag, sizeof(suffixedtag)-1);
|
||||
|
||||
if (tutorialmode)
|
||||
suffixed = F_GetTextPromptTutorialTag(suffixedtag, 33);
|
||||
suffixed = F_GetTextPromptTutorialTag(suffixedtag, sizeof(suffixedtag)-1);
|
||||
|
||||
for (*promptnum = 0 + tutorialpromptnum; *promptnum < MAX_PROMPTS; (*promptnum)++)
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ typedef enum
|
|||
extern ttmode_enum ttmode;
|
||||
extern UINT8 ttscale;
|
||||
// ttmode user vars
|
||||
extern char ttname[9];
|
||||
extern char ttname[8+1];
|
||||
extern INT16 ttx;
|
||||
extern INT16 tty;
|
||||
extern INT16 ttloop;
|
||||
|
|
|
@ -1650,7 +1650,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp, UINT16 this_demo_version)
|
|||
UINT16 totalfiles;
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
filestatus_t ncs;
|
||||
filestatus_t ncs = FS_NOTFOUND;
|
||||
boolean toomany = false;
|
||||
boolean alreadyloaded;
|
||||
UINT16 i, j;
|
||||
|
|
|
@ -5403,7 +5403,7 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc)
|
|||
INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
|
||||
{
|
||||
boolean usemapcode = false;
|
||||
INT32 newmapnum;
|
||||
INT32 newmapnum = -1;
|
||||
size_t mapnamelen = strlen(mapname);
|
||||
char *p;
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
|
|||
// GL_MSG_Warning : Raises a warning.
|
||||
// -----------------+
|
||||
|
||||
static void GL_MSG_Warning(const char *format, ...)
|
||||
FUNCPRINTF static void GL_MSG_Warning(const char *format, ...)
|
||||
{
|
||||
char str[4096] = "";
|
||||
va_list arglist;
|
||||
|
@ -203,7 +203,7 @@ static void GL_MSG_Warning(const char *format, ...)
|
|||
// GL_MSG_Error : Raises an error.
|
||||
// -----------------+
|
||||
|
||||
static void GL_MSG_Error(const char *format, ...)
|
||||
FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
|
||||
{
|
||||
char str[4096] = "";
|
||||
va_list arglist;
|
||||
|
|
|
@ -499,10 +499,10 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
|||
// what we're gonna do now is check if the player exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
char playernum[3];
|
||||
char playernum[3+1];
|
||||
INT32 spc = 1; // used if playernum[1] is a space.
|
||||
|
||||
strncpy(playernum, msg+3, 3);
|
||||
strncpy(playernum, msg+3, sizeof(playernum)-1);
|
||||
// check for undesirable characters in our "number"
|
||||
if (((playernum[0] < '0') || (playernum[0] > '9')) || ((playernum[1] < '0') || (playernum[1] > '9')))
|
||||
{
|
||||
|
@ -975,7 +975,7 @@ static void HU_sendChatMessage(void)
|
|||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if playernum[1] is a space.
|
||||
char playernum[3];
|
||||
char playernum[3+1];
|
||||
const char *newmsg;
|
||||
|
||||
// what we're gonna do now is check if the player exists
|
||||
|
@ -988,7 +988,7 @@ static void HU_sendChatMessage(void)
|
|||
return;
|
||||
}
|
||||
|
||||
strncpy(playernum, msg+3, 3);
|
||||
strncpy(playernum, msg+3, sizeof(playernum)-1);
|
||||
// check for undesirable characters in our "number"
|
||||
if (!(isdigit(playernum[0]) && isdigit(playernum[1])))
|
||||
{
|
||||
|
@ -1687,13 +1687,14 @@ static void HU_DrawChat(void)
|
|||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat[3])
|
||||
{
|
||||
char playernum[3];
|
||||
char playernum[3+1];
|
||||
UINT32 n;
|
||||
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
|
||||
break;
|
||||
|
||||
strncpy(playernum, w_chat+3, 3);
|
||||
strncpy(playernum, w_chat+3, sizeof(playernum)-1);
|
||||
playernum[3] = 0;
|
||||
n = atoi(playernum); // turn that into a number
|
||||
// special cases:
|
||||
|
||||
|
@ -2990,7 +2991,7 @@ void HU_DoCEcho(const char *msg)
|
|||
{
|
||||
I_OutputMsg("%s\n", msg); // print to log
|
||||
|
||||
strncpy(cechotext, msg, sizeof(cechotext));
|
||||
strncpy(cechotext, msg, sizeof(cechotext)-1);
|
||||
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
|
||||
cechotext[sizeof(cechotext) - 1] = '\0';
|
||||
cechotimer = cechoduration;
|
||||
|
|
|
@ -19,6 +19,7 @@ enum hud {
|
|||
hud_stagetitle = 0,
|
||||
hud_textspectator,
|
||||
hud_crosshair,
|
||||
hud_powerups,
|
||||
// Singleplayer / Co-op
|
||||
hud_score,
|
||||
hud_time,
|
||||
|
|
|
@ -41,6 +41,7 @@ static const char *const hud_disable_options[] = {
|
|||
"stagetitle",
|
||||
"textspectator",
|
||||
"crosshair",
|
||||
"powerups",
|
||||
|
||||
"score",
|
||||
"time",
|
||||
|
|
|
@ -2692,7 +2692,7 @@ static boolean MIT_SetCurTitlePics(UINT32 menutype, INT32 level, INT32 *retval,
|
|||
curhidepics = menupres[menutype].hidetitlepics;
|
||||
curttmode = menupres[menutype].ttmode;
|
||||
curttscale = (menupres[menutype].ttscale != UINT8_MAX ? menupres[menutype].ttscale : ttscale);
|
||||
strncpy(curttname, menupres[menutype].ttname, 9);
|
||||
strncpy(curttname, menupres[menutype].ttname, sizeof(curttname)-1);
|
||||
curttx = (menupres[menutype].ttx != INT16_MAX ? menupres[menutype].ttx : ttx);
|
||||
curtty = (menupres[menutype].tty != INT16_MAX ? menupres[menutype].tty : tty);
|
||||
curttloop = (menupres[menutype].ttloop != INT16_MAX ? menupres[menutype].ttloop : ttloop);
|
||||
|
@ -11235,7 +11235,8 @@ static void M_DrawRoomMenu(void)
|
|||
if (dot_frame < 0)
|
||||
dot_frame = 0;
|
||||
|
||||
strncpy(&text[dot_frame], "...", min(dots, 3 - dot_frame));
|
||||
if (dot_frame != 3)
|
||||
strncpy(&text[dot_frame], "...", min(dots, 3 - dot_frame));
|
||||
}
|
||||
|
||||
frame += renderdeltatics;
|
||||
|
|
|
@ -378,7 +378,7 @@ typedef struct
|
|||
char displayname[SKINNAMESIZE+1];
|
||||
INT16 skinnum[2];
|
||||
UINT16 oppositecolor;
|
||||
char nametag[8];
|
||||
char nametag[8+1];
|
||||
patch_t *namepic;
|
||||
UINT16 tagtextcolor;
|
||||
UINT16 tagoutlinecolor;
|
||||
|
|
|
@ -307,7 +307,7 @@ boolean CL_SendJoin(void)
|
|||
else
|
||||
player2name = cv_playername2.zstring;
|
||||
|
||||
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME);
|
||||
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, sizeof(netbuffer->u.clientcfg.names[0])-1);
|
||||
strncpy(netbuffer->u.clientcfg.names[1], player2name, MAXPLAYERNAME);
|
||||
|
||||
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak));
|
||||
|
|
|
@ -940,7 +940,7 @@ void Command_Droprate(void)
|
|||
static boolean ShouldDropPacket(void)
|
||||
{
|
||||
return (packetdropquantity[netbuffer->packettype])
|
||||
|| (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
|| (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ HMS_on_read (char *s, size_t _1, size_t n, void *userdata)
|
|||
return n;
|
||||
}
|
||||
|
||||
static struct HMS_buffer *
|
||||
FUNCDEBUG static struct HMS_buffer *
|
||||
HMS_connect (int proto, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
|
@ -115,12 +115,12 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
netbuffer->u.serverinfo.refusereason = GetRefuseReason(node);
|
||||
|
||||
strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype],
|
||||
sizeof netbuffer->u.serverinfo.gametypename);
|
||||
sizeof(netbuffer->u.serverinfo.gametypename)-1);
|
||||
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
|
||||
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();
|
||||
netbuffer->u.serverinfo.flags = (dedicated ? SV_DEDICATED : 0);
|
||||
strncpy(netbuffer->u.serverinfo.servername, cv_servername.string,
|
||||
MAXSERVERNAME);
|
||||
sizeof(netbuffer->u.serverinfo.servername)-1);
|
||||
strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7);
|
||||
|
||||
M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16);
|
||||
|
@ -184,7 +184,9 @@ static void SV_SendPlayerInfo(INT32 node)
|
|||
}
|
||||
|
||||
netbuffer->u.playerinfo[i].num = i;
|
||||
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
|
||||
memset(netbuffer->u.playerinfo[i].name, 0x00, sizeof(netbuffer->u.playerinfo[i].name));
|
||||
memcpy(netbuffer->u.playerinfo[i].name, player_names[i], sizeof(player_names[i]));
|
||||
|
||||
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
|
||||
|
||||
//fetch IP address
|
||||
|
|
|
@ -363,7 +363,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
|
|||
// Increase the size to make room for the new animation definition
|
||||
maxanims++;
|
||||
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
|
||||
strncpy(animdefs[i].startname, animdefsToken, 9);
|
||||
strncpy(animdefs[i].startname, animdefsToken, sizeof(animdefs[i].startname)-1);
|
||||
}
|
||||
|
||||
// animdefs[i].startname is now set to animdefsToken either way.
|
||||
|
|
|
@ -11307,7 +11307,7 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails)
|
|||
fixed_t backwards = -1*FRACUNIT;
|
||||
boolean doswim = (player->panim == PA_ABILITY && (player->mo->eflags & MFE_UNDERWATER));
|
||||
boolean doroll = (player->panim == PA_ROLL || (player->panim == PA_JUMP && !(player->charflags & SF_NOJUMPSPIN)) || doswim);
|
||||
angle_t rollangle;
|
||||
angle_t rollangle = 0;
|
||||
boolean panimchange;
|
||||
INT32 ticnum = 0;
|
||||
statenum_t chosenstate;
|
||||
|
@ -12089,7 +12089,7 @@ void P_PlayerThink(player_t *player)
|
|||
// deez New User eXperiences.
|
||||
{
|
||||
angle_t oldang = player->drawangle, diff = 0;
|
||||
UINT8 factor;
|
||||
UINT8 factor = 0;
|
||||
// Directionchar!
|
||||
// Camera angle stuff.
|
||||
if (player->exiting // no control, no modification
|
||||
|
|
|
@ -556,7 +556,7 @@ static boolean ParseDecimal(tokenizer_t *sc, double *out)
|
|||
return M_StringToDecimal(tkn, out);
|
||||
}
|
||||
|
||||
static struct PaletteRemapParseResult *ThrowError(const char *format, ...)
|
||||
FUNCPRINTF static struct PaletteRemapParseResult *ThrowError(const char *format, ...)
|
||||
{
|
||||
const size_t err_size = 512 * sizeof(char);
|
||||
|
||||
|
@ -792,7 +792,7 @@ static struct PaletteRemapParseResult *PaletteRemap_ParseTranslation(const char
|
|||
return result;
|
||||
}
|
||||
|
||||
static void PrintError(const char *name, const char *format, ...)
|
||||
FUNCDEBUG static void PrintError(const char *name, const char *format, ...)
|
||||
{
|
||||
char error[256];
|
||||
|
||||
|
|
|
@ -1910,7 +1910,7 @@ static void S_AddMusicStackEntry(const char *mname, UINT16 mflags, boolean loopi
|
|||
if (!music_stacks)
|
||||
{
|
||||
music_stacks = Z_Calloc(sizeof (*mst), PU_MUSIC, NULL);
|
||||
strncpy(music_stacks->musname, (status == JT_MASTER ? mname : (S_CheckQueue() ? queue_name : mapmusname)), 7);
|
||||
strncpy(music_stacks->musname, (status == JT_MASTER ? mname : (S_CheckQueue() ? queue_name : mapmusname)), sizeof(music_stacks->musname)-1);
|
||||
music_stacks->musflags = (status == JT_MASTER ? mflags : (S_CheckQueue() ? queue_flags : mapmusflags));
|
||||
music_stacks->looping = (status == JT_MASTER ? looping : (S_CheckQueue() ? queue_looping : true));
|
||||
music_stacks->position = (status == JT_MASTER ? position : (S_CheckQueue() ? queue_position : S_GetMusicPosition()));
|
||||
|
@ -2033,7 +2033,7 @@ boolean S_RecallMusic(UINT16 status, boolean fromfirst)
|
|||
if (result)
|
||||
{
|
||||
*entry = *result;
|
||||
strncpy(entry->musname, result->musname, 7);
|
||||
memcpy(entry->musname, result->musname, sizeof(entry->musname));
|
||||
}
|
||||
|
||||
// no result, just grab mapmusname
|
||||
|
@ -2255,7 +2255,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
|||
if (S_MusicDisabled())
|
||||
return;
|
||||
|
||||
strncpy(newmusic, mmusic, 7);
|
||||
strncpy(newmusic, mmusic, sizeof(newmusic)-1);
|
||||
if (LUA_HookMusicChange(music_name, &hook_param))
|
||||
return;
|
||||
newmusic[6] = 0;
|
||||
|
|
|
@ -238,7 +238,7 @@ UINT32 S_GetMusicPosition(void);
|
|||
|
||||
typedef struct musicstack_s
|
||||
{
|
||||
char musname[7];
|
||||
char musname[7+1];
|
||||
UINT16 musflags;
|
||||
boolean looping;
|
||||
UINT32 position;
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
// SRB2Kart
|
||||
#include "r_fps.h" // R_GetFramerateCap
|
||||
|
||||
#include "lua_hud.h" // LUA_HudEnabled
|
||||
|
||||
// --------------------------------------------
|
||||
// assembly or c drawer routines for 8bpp/16bpp
|
||||
// --------------------------------------------
|
||||
|
@ -494,6 +496,7 @@ void SCR_ClosedCaptions(void)
|
|||
basey -= 8;
|
||||
else if ((modeattacking == ATTACKING_NIGHTS)
|
||||
|| (!(maptol & TOL_NIGHTS)
|
||||
&& LUA_HudEnabled(hud_powerups)
|
||||
&& ((cv_powerupdisplay.value == 2) // "Always"
|
||||
|| (cv_powerupdisplay.value == 1 && !camera.chase)))) // "First-person only"
|
||||
basey -= 16;
|
||||
|
|
|
@ -1714,7 +1714,7 @@ const char *I_GetJoyName(INT32 joyindex)
|
|||
{
|
||||
tempname = SDL_JoystickNameForIndex(joyindex);
|
||||
if (tempname)
|
||||
strncpy(joyname, tempname, 255);
|
||||
strncpy(joyname, tempname, sizeof(joyname)-1);
|
||||
}
|
||||
return joyname;
|
||||
}
|
||||
|
@ -2857,7 +2857,7 @@ size_t I_GetRandomBytes(char *destination, size_t count)
|
|||
{
|
||||
#if defined (__unix__) || defined (UNIXCOMMON) || defined(__APPLE__)
|
||||
FILE *rndsource;
|
||||
size_t actual_bytes;
|
||||
size_t actual_bytes = 0;
|
||||
|
||||
if (!(rndsource = fopen("/dev/urandom", "r")))
|
||||
if (!(rndsource = fopen("/dev/random", "r")))
|
||||
|
|
|
@ -140,15 +140,18 @@ static void Midiplayer_Onchange(void)
|
|||
restart = true;
|
||||
}
|
||||
|
||||
if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
if (!Mix_GetSoundFonts() || stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
{
|
||||
if (!Mix_SetSoundFonts(cv_midisoundfontpath.string)) // == 0 means error
|
||||
CONS_Alert(CONS_ERROR, "Sound font error: %s", Mix_GetError());
|
||||
else
|
||||
restart = true;
|
||||
}
|
||||
|
||||
#if SDL_MIXER_VERSION_ATLEAST(2,5,0)
|
||||
Mix_SetTimidityCfg(cv_miditimiditypath.string);
|
||||
#else
|
||||
Mix_Timidity_addToPathList(cv_miditimiditypath.string);
|
||||
#endif
|
||||
|
||||
if (restart)
|
||||
S_StartEx(true);
|
||||
|
@ -159,7 +162,7 @@ static void MidiSoundfontPath_Onchange(void)
|
|||
if (Mix_GetMidiPlayer() != MIDI_Fluidsynth || (I_SongType() != MU_NONE && I_SongType() != MU_MID_EX))
|
||||
return;
|
||||
|
||||
if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
if (!Mix_GetSoundFonts() || stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
{
|
||||
char *miditoken;
|
||||
char *source = strdup(cv_midisoundfontpath.string);
|
||||
|
@ -286,8 +289,12 @@ void I_StartupSound(void)
|
|||
#ifdef HAVE_MIXERX
|
||||
Mix_SetMidiPlayer(cv_midiplayer.value);
|
||||
Mix_SetSoundFonts(cv_midisoundfontpath.string);
|
||||
#if SDL_MIXER_VERSION_ATLEAST(2,5,0)
|
||||
Mix_SetTimidityCfg(cv_miditimiditypath.string);
|
||||
#else
|
||||
Mix_Timidity_addToPathList(cv_miditimiditypath.string);
|
||||
#endif
|
||||
#endif
|
||||
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
|
||||
Mix_Init(MIX_INIT_FLAC|MIX_INIT_MP3|MIX_INIT_OGG|MIX_INIT_MOD);
|
||||
#endif
|
||||
|
@ -942,7 +949,12 @@ UINT32 I_GetSongLength(void)
|
|||
else
|
||||
{
|
||||
#ifdef HAVE_MIXERX
|
||||
#if SDL_MIXER_VERSION_ATLEAST(2,5,0)
|
||||
double xlength = Mix_MusicDuration(music);
|
||||
#else
|
||||
double xlength = Mix_GetMusicTotalTime(music);
|
||||
#endif
|
||||
|
||||
if (xlength >= 0)
|
||||
return (UINT32)(xlength*1000);
|
||||
#endif
|
||||
|
@ -1198,10 +1210,14 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
#ifdef HAVE_MIXERX
|
||||
if (Mix_GetMidiPlayer() != cv_midiplayer.value)
|
||||
Mix_SetMidiPlayer(cv_midiplayer.value);
|
||||
if (stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
if (!Mix_GetSoundFonts() || stricmp(Mix_GetSoundFonts(), cv_midisoundfontpath.string))
|
||||
Mix_SetSoundFonts(cv_midisoundfontpath.string);
|
||||
#if SDL_MIXER_VERSION_ATLEAST(2,5,0)
|
||||
Mix_SetTimidityCfg(cv_miditimiditypath.string);
|
||||
#else
|
||||
Mix_Timidity_addToPathList(cv_miditimiditypath.string); // this overwrites previous custom path
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
/*
|
||||
|
|
|
@ -817,7 +817,7 @@ static inline void ST_drawRings(void)
|
|||
|
||||
static void ST_drawLivesArea(void)
|
||||
{
|
||||
INT32 v_colmap = V_YELLOWMAP, livescount;
|
||||
INT32 v_colmap = V_YELLOWMAP, livescount = -1;
|
||||
boolean notgreyedout = false;
|
||||
|
||||
if (!stplyr->skincolor)
|
||||
|
@ -2823,14 +2823,14 @@ static void ST_overlayDrawer(void)
|
|||
|| ((splitscreen && stplyr == &players[secondarydisplayplayer]) && !camera2.chase))
|
||||
{
|
||||
ST_drawFirstPersonHUD();
|
||||
if (cv_powerupdisplay.value)
|
||||
if (cv_powerupdisplay.value && LUA_HudEnabled(hud_powerups))
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
}
|
||||
else if (cv_powerupdisplay.value == 2)
|
||||
else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups))
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
|
||||
}
|
||||
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2)
|
||||
else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups))
|
||||
ST_drawPowerupHUD(); // same as it ever was...
|
||||
|
||||
if (!(netgame || multiplayer) || !hu_showscores)
|
||||
|
|
|
@ -384,13 +384,14 @@ void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue)
|
|||
|
||||
const char *R_GetPalname(UINT16 num)
|
||||
{
|
||||
static char palname[9];
|
||||
char newpal[9] = "PLAYPAL";
|
||||
static char palname[8+1];
|
||||
char newpal[9] = "PLAYPAL\0";
|
||||
|
||||
if (num > 0 && num <= 10000)
|
||||
snprintf(newpal, 8, "PAL%04u", num-1);
|
||||
|
||||
strncpy(palname, newpal, 8);
|
||||
strncpy(palname, newpal, sizeof(palname)-1);
|
||||
palname[8] = 0;
|
||||
return palname;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue