Fix most of compilation warnings

This commit is contained in:
Alug committed 2023-12-30 15:55:07 +01:00
1 parent ed6e16cdce
commit a4e8ce7f01
29 files changed
+140 -141

No files matched your search

+7 -2
View File
@@ -140,7 +140,7 @@ static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen == 2
static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3
static tic_t neededtic;
SINT8 servernode = 0; // the number of the server node
char connectedservername[MAXSERVERNAME];
char connectedservername[MAXSERVERNAME+1];
/// \brief do we accept new players?
/// \todo WORK!
boolean acceptnewnode = true;
@@ -1139,7 +1139,7 @@ static void GetPackets(void);
static cl_mode_t cl_mode = CL_SEARCHING;
#ifdef HAVE_CURL
char http_source[MAX_MIRROR_LENGTH];
char http_source[MAX_MIRROR_LENGTH+1];
#endif
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
@@ -1626,7 +1626,12 @@ static void SV_SendPlayerInfo(INT32 node)
}
netbuffer->u.playerinfo[i].node = i;
// Can't really change this because net compatibility, but the warning is annoying
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
#pragma GCC diagnostic pop
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
//fetch IP address
+1 -1
View File
@@ -553,7 +553,7 @@ extern boolean dedicated; // For dedicated server
extern UINT16 software_MAXPACKETLENGTH;
extern boolean acceptnewnode;
extern SINT8 servernode;
extern char connectedservername[MAXSERVERNAME];
extern char connectedservername[MAXSERVERNAME+1];
void Command_Ping_f(void);
extern tic_t connectiontimeout;
+1 -1
View File
@@ -969,7 +969,7 @@ static void D_FindAddonsToAutoload(void)
boolean postload;
INT32 i;
char wadsToAutoload[256] = "", renameAutoloadStrings[256] = "";
char wadsToAutoload[256] = "";
// does it exist tho
autoloadpath = va("%s"PATHSEP"%s",srb2home,AUTOLOADCONFIGFILENAME);
+1 -1
View File
@@ -461,7 +461,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_forceskin = {"forceskin", "Off", CV_NETVAR|CV_CALL|CV_CHEAT, Forceskin_cons_t, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_fakelocalskin = {"fakelocalskin", "None", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
-1
View File
@@ -825,7 +825,6 @@ void SV_FileSendTicker(void)
size_t size;
filetx_t *f;
INT32 packetsent, ram, i, j;
INT32 maxpacketsent;
if (!filestosend) // No file to send
return;
+3 -3
View File
@@ -1079,7 +1079,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
if (i && i <= 1035)
snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i));
else if (i && i <= 1050)
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7);
strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 6);
else
mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string
mapheaderinfo[num-1]->musname[6] = 0;
@@ -1104,7 +1104,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
else if (fastcmp(word, "SKYNUM"))
mapheaderinfo[num-1]->skynum = (INT16)i;
else if (fastcmp(word, "INTERSCREEN"))
strncpy(mapheaderinfo[num-1]->interscreen, word2, 8);
memcpy(mapheaderinfo[num-1]->interscreen, word2, 8);
else if (fastcmp(word, "PRECUTSCENENUM"))
mapheaderinfo[num-1]->precutscenenum = (UINT8)i;
else if (fastcmp(word, "CUTSCENENUM"))
@@ -2932,7 +2932,7 @@ static void readmaincfg(MYFILE *f)
// Also save a time attack folder
filenamelen = strlen(gamedatafilename)-4; // Strip off the extension
filenamelen = min(filenamelen, sizeof (timeattackfolder));
strncpy(timeattackfolder, gamedatafilename, filenamelen);
memcpy(timeattackfolder, gamedatafilename, filenamelen);
timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0';
strcpy(savegamename, timeattackfolder);
+5 -3
View File
@@ -441,11 +441,13 @@ filestatus_t filesearch(int nfiles, filequery_t *files, const char *startpath, b
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
#if defined(__linux__) || defined(__FreeBSD__)
if (dent->d_type == DT_UNKNOWN)
if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode))
if (dent->d_type == DT_UNKNOWN && lstat(searchpath,&fsstat) == 0)
{
if (S_ISDIR(fsstat.st_mode))
dent->d_type = DT_DIR;
else if (lstat(searchpath,&fsstat) == 0 && S_ISLNK(fsstat.st_mode))
else if (S_ISLNK(fsstat.st_mode))
dent->d_type = DT_LNK;
}
// Symlinks aren't always directory symlinks. Dunno if this would resolve recursive
// symlinks, but i think stat already does that
+7 -6
View File
@@ -832,7 +832,8 @@ const char *G_BuildMapName(INT32 map)
map = G_RandMap(G_TOLFlag(cv_newgametype.value), map, false, 0, false, NULL)+1;
}
if (map < 100)
if (map < 100 && map >= 0) // ...but why use signed integer in first place? idk but this prevents warning (and potential buffer overflow lol)
sprintf(&mapname[3], "%.2d", map);
else
{
@@ -5383,7 +5384,7 @@ void G_ReadDemoExtraData(void)
void G_WriteDemoExtraData(void)
{
INT32 i;
char name[16];
char name[17];
for (i = 0; i < MAXPLAYERS; i++)
{
@@ -5416,7 +5417,7 @@ void G_WriteDemoExtraData(void)
{
// Name
memset(name, 0, 16);
strncpy(name, player_names[i], 16);
memcpy(name, player_names[i], 15); // Keeping 1 null byte for safety, sorry players with name containing more than 15 characters
M_Memcpy(demo_p,name,16);
demo_p += 16;
}
@@ -6763,7 +6764,7 @@ void G_RecordMetal(void)
void G_BeginRecording(void)
{
UINT8 i, p;
char name[16];
char name[17];
player_t *player = &players[consoleplayer];
char *filename;
@@ -6864,7 +6865,7 @@ void G_BeginRecording(void)
// Name
memset(name, 0, 16);
strncpy(name, player_names[p], 16);
memcpy(name, player_names[p], 15);
M_Memcpy(demo_p,name,16);
demo_p += 16;
@@ -6951,7 +6952,7 @@ void G_BeginMetal(void)
void G_WriteStanding(UINT8 ranking, char *name, INT32 skinnum, UINT8 color, UINT32 val)
{
char temp[16];
char temp[17];
if (demoinfo_p && *(UINT32 *)demoinfo_p == 0)
{
+2 -2
View File
@@ -2377,7 +2377,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (rover->master->flags & ML_TFERLINE)
{
size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount);
size_t linenum = min((size_t)(gr_curline->linedef-gr_backsector->lines[0]), rover->master->frontsector->linecount);
newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
@@ -2577,7 +2577,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (rover->master->flags & ML_TFERLINE)
{
size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount);
size_t linenum = min((size_t)(gr_curline->linedef-gr_backsector->lines[0]), rover->master->frontsector->linecount);
newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
+8 -7
View File
@@ -1641,7 +1641,7 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable)
ltcachetail = cache_entry;
}
ltcachetail->next = NULL;
GLenum internalFormat;
if (gl_version[0] == '1' || gl_version[0] == '2')
{
@@ -1655,13 +1655,13 @@ EXPORT UINT32 HWRAPI(AddLightTable) (UINT8 *lighttable)
{
internalFormat = GL_R8;
}
pglGenTextures(1, &ltcachetail->id);
if (!ltcachetail->id){
GL_MSG_Error("HWR Lighttable cache entry id is zero");
CV_Set(&cv_grpaletteshader, "Off"); // turn that thing off if you cant use it
return;
}
return 0;
}
pglBindTexture(GL_TEXTURE_2D, ltcachetail->id);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -3023,15 +3023,15 @@ static void SkyVertex(vbo_vertex_t *vbo, int r, int c)
vbo->z = z;
}
void RevertStencilBuffer()// TODO need to add OpenGL stencil functions to function importing
/*void RevertStencilBuffer()// TODO need to add OpenGL stencil functions to function importing
{
/*const float screenVerts[12] =
const float screenVerts[12] =
{
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};*/
};
const float screenVerts[12] =
{
@@ -3070,6 +3070,7 @@ void RevertStencilBuffer()// TODO need to add OpenGL stencil functions to functi
pglEnable(GL_BLEND);
pglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
*/
static GLSkyVBO sky_vbo;
+17 -11
View File
@@ -555,7 +555,8 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
const char *newmsg;
INT32 spc = 1; // used if nodenum[1] is a space.
char *nodenum = (char*) malloc(3);
strncpy(nodenum, msg+3, 3);
memcpy(nodenum, msg+3, 2);
nodenum[2] = '\0';
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
{
@@ -571,15 +572,15 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
}
}
// I'm very bad at C, I swear I am, additional checks eww!
if (spc != 0)
if (spc != 0)
{
if (msg[5] != ' ')
{
if (msg[5] != ' ')
{
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
free(nodenum);
return;
}
}
target = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
@@ -1233,7 +1234,8 @@ static void HU_queueChatChar(INT32 c)
return;
}
strncpy(nodenum, msg+3, 3);
memcpy(nodenum, msg+3, 2);
nodenum[2] = '\0';
// check for undesirable characters in our "number"
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
@@ -1944,7 +1946,8 @@ static void HU_DrawChat(void)
nodenum = (char*) malloc(3);
strncpy(nodenum, w_chat+3, 3);
memcpy(nodenum, w_chat+3, 2);
nodenum[2] = '\0';
n = atoi((const char*) nodenum); // turn that into a number
free(nodenum);
// special cases:
@@ -2585,7 +2588,7 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
SINT8 i = 0;
SINT8 yoffset = 6;
INT32 dx;
//INT32 dx;
gfxnum = Ping_gfx_num(lag);
@@ -2932,7 +2935,10 @@ void HU_DoCEcho(const char *msg)
I_OutputMsg("%s\n", msg); // print to log
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later
strncpy(cechotext, msg, sizeof(cechotext));
#pragma GCC diagnostic pop
strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1);
cechotext[sizeof(cechotext) - 1] = '\0';
cechotimer = cechoduration;
+6 -6
View File
@@ -596,8 +596,8 @@ UINT8 K_GetKartColorByName(const char *name)
return 0;
}
UINT8 K_GetHudColor(void)
{
static UINT8 K_GetHudColor(void)
{
if (cv_colorizedhud.value){
if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value;
}
@@ -605,7 +605,7 @@ UINT8 K_GetHudColor(void)
return ((stplyr && gamestate == GS_LEVEL) ? stplyr->skincolor : cv_playercolor.value);
}
boolean K_UseColorHud(void)
static boolean K_UseColorHud(void)
{
return (cv_colorizedhud.value && clr_hud);
}
@@ -6933,7 +6933,7 @@ static patch_t *kp_lapsticker;
static patch_t *kp_lapstickerbig;
static patch_t *kp_lapstickerbig2;
static patch_t *kp_lapstickerwide;
static patch_t *kp_lapstickernarrow;
//static patch_t *kp_lapstickernarrow;
static patch_t *kp_splitlapflag;
static patch_t *kp_bumpersticker;
static patch_t *kp_bumperstickerwide;
@@ -6948,7 +6948,7 @@ static patch_t *kp_lapstickerclr;
static patch_t *kp_lapstickerbigclr;
static patch_t *kp_lapstickerbig2clr;
static patch_t *kp_lapstickerwideclr;
static patch_t *kp_lapstickernarrowclr;
//static patch_t *kp_lapstickernarrowclr;
static patch_t *kp_bumperstickerclr;
static patch_t *kp_bumperstickerwideclr;
static patch_t *kp_karmastickerclr;
@@ -7039,7 +7039,7 @@ void K_LoadKartHUDGraphics(void)
kp_timestickerwide = W_CachePatchName("K_STTIMW", PU_HUDGFX);
kp_lapsticker = W_CachePatchName("K_STLAPS", PU_HUDGFX);
kp_lapstickerwide = W_CachePatchName("K_STLAPW", PU_HUDGFX);
kp_lapstickernarrow = W_CachePatchName("K_STLAPN", PU_HUDGFX);
//kp_lapstickernarrow = W_CachePatchName("K_STLAPN", PU_HUDGFX);
kp_splitlapflag = W_CachePatchName("K_SPTLAP", PU_HUDGFX);
kp_bumpersticker = W_CachePatchName("K_STBALN", PU_HUDGFX);
kp_bumperstickerwide = W_CachePatchName("K_STBALW", PU_HUDGFX);
-1
View File
@@ -17,7 +17,6 @@ extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local);
UINT8 K_GetKartColorByName(const char *name);
UINT8 K_GetHudColor(void);
void K_RegisterKartStuff(void);
+39 -34
View File
@@ -4775,23 +4775,23 @@ static void M_DrawMenuTitle(void)
}
// TODO: This is fucking terrible.
static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 box_x, INT32 alpha)
static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 alpha)
{
const char* icopy = strdup(str);
const char** clines = NULL;
char* icopy = strdup(str);
char** clines = NULL;
INT16 num_lines = 0;
if (icopy == NULL) return;
char* token = strtok(icopy, "\n");
while (token != NULL)
while (token != NULL)
{
const char* line = strdup(token);
char* line = strdup(token);
if (line == NULL) return;
clines = (const char**)realloc(clines, (num_lines + 1) * sizeof(const char*));
clines = realloc(clines, (num_lines + 1) * sizeof(char*));
clines[num_lines] = line;
num_lines++;
@@ -4819,7 +4819,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]);
yoffset += 10;
// Remember to free the memory for each line when you're done with it.
free((void*)clines[i]);
free(clines[i]);
}
free(clines);
@@ -4977,7 +4977,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_ControlsTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ControlsTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ControlsTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -4987,7 +4987,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_MouseTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_MouseTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_MouseTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -4997,7 +4997,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_VideoTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_VideoTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_VideoTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5007,7 +5007,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_SoundTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5017,7 +5017,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_SoundAdvancedTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundAdvancedTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundAdvancedTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5027,7 +5027,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_ExpTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ExpTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ExpTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5037,7 +5037,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_ChatOptionsTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ChatOptionsTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ChatOptionsTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5049,7 +5049,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_GameTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_GameTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_GameTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5060,7 +5060,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_ServerOptionsTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ServerOptionsTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ServerOptionsTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5071,7 +5071,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_AdvServerOptionsTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvServerOptionsTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvServerOptionsTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5084,7 +5084,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_PlayerDistortTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_PlayerDistortTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_PlayerDistortTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5097,7 +5097,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_CreditTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_CreditTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_CreditTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5107,7 +5107,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_BirdTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_BirdTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_BirdTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5117,7 +5117,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_TiltTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_TiltTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_TiltTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5127,7 +5127,7 @@ static void M_DrawGenericMenu(void)
{
if (!(OP_AdvancedBirdTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvancedBirdTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvancedBirdTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5284,7 +5284,7 @@ static void M_DrawGenericScrollMenu(void)
{
if (!(OP_OpenGLTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_OpenGLTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_OpenGLTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5297,7 +5297,7 @@ static void M_DrawGenericScrollMenu(void)
{
if (!(OP_SaturnTooltips[itemOn] == NULL))
{
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SaturnTooltips[itemOn], 30, coolalphatimer);
M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SaturnTooltips[itemOn], coolalphatimer);
if (coolalphatimer > 0 && interpTimerHackAllow)
coolalphatimer--;
}
@@ -5824,7 +5824,8 @@ menu_t MessageDef =
M_DrawMessageMenu, // drawing routine ->
0, 0, // x, y (TO HACK)
0, // lastOn, flags (TO HACK)
NULL
NULL,
{0},
};
@@ -6805,7 +6806,9 @@ static void PrepReplayList(void)
else
{
demolist[i].type = MD_NOTLOADED;
snprintf(demolist[i].filepath, 255, "%s%s", menupath, dirmenu[i] + DIR_STRING);
// FIXME - do something with buffer sizes. menupath is 1024 chars but filepath is only
// 256. I'm not really sure what to do here but don't want to leave warnings...
snprintf(demolist[i].filepath, 255, "%.254s%s", menupath, dirmenu[i] + DIR_STRING);
sprintf(demolist[i].title, ".....");
}
}
@@ -8228,9 +8231,11 @@ static size_t st_namescrollstate = 0;
static void M_MusicTest(INT32 choice)
{
INT32 ul = skyRoomMenuTranslations[choice-1];
UINT8 i;
char buf[8];
//INT32 ul = skyRoomMenuTranslations[choice-1];
//UINT8 i;
//char buf[8];
(void)choice;
if (!S_PrepareSoundTest())
{
@@ -8267,7 +8272,7 @@ static void M_MusicTest(INT32 choice)
static void M_DrawMusicTest(void)
{
INT32 x, y, i;
char* title;
//char* title;
//fixed_t hscale = FRACUNIT/2, vscale = FRACUNIT/2, bounce = 0;
//UINT8 frame[4] = {0, 0, -1, SKINCOLOR_RUBY};
@@ -8503,9 +8508,9 @@ static void M_DrawMusicTest(void)
}
if (soundtestdefs[t]->title[0])
strncpy(buf, soundtestdefs[t]->title + nameoffset, MAXLENGTH);
memcpy(buf, soundtestdefs[t]->title + nameoffset, MAXLENGTH);
else
strncpy(buf, soundtestdefs[t]->source + nameoffset, MAXLENGTH);
memcpy(buf, soundtestdefs[t]->source + nameoffset, MAXLENGTH);
buf[MAXLENGTH] = 0;
V_DrawString(x, y, (t == st_sel ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE|V_MONOSPACE, buf);
@@ -11024,7 +11029,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
if (cv_nextmap.value && cv_showtrackaddon.value)
{
char *addonname = wadfiles[mapwads[cv_nextmap.value-1]]->filename;
INT32 len, sw = 0;
INT32 len;
INT32 charlimit = 21 + (dupadjust/5);
nameonly(addonname);
len = strlen(addonname);
@@ -11524,7 +11529,7 @@ static boolean setupm_skinlockedselect;
#define SKINGRIDNEWWIDTH 8
#define SKINGRIDNEWHEIGHT 9
static char *sortNames[] = {
static const char *sortNames[] = {
"Name",
"Internal name",
"Speed",
+1 -1
View File
@@ -3480,7 +3480,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
boolean mapsadded = false;
lumpinfo_t *lumpinfo;
if ((numlumps = W_InitFile(wadfilename, 0, &wadnum, local)) == INT16_MAX)
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
{
refreshdirmenu |= REFRESHDIR_NOTLOADED;
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
+2 -1
View File
@@ -472,7 +472,8 @@ 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);
memcpy(animdefs[i].startname, animdefsToken, 9);
animdefs[i].startname[8] = '\0';
}
// animdefs[i].startname is now set to animdefsToken either way.
+2 -2
View File
@@ -621,8 +621,8 @@ void R_FlushTranslationColormapCache(void)
for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++)
if (translationtablecache[i])
memset(translationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
for (i = 0; i < (INT32)(sizeof(localtranslationtablecache) / sizeof(localtranslationtablecache[0])); i++)
for (i = 0; i < (INT32)(sizeof(localtranslationtablecache) / sizeof(localtranslationtablecache[0])); i++)
if (localtranslationtablecache[i])
memset(localtranslationtablecache[i], 0, MAXTRANSLATIONS * sizeof(UINT8**));
}
-26
View File
@@ -1154,7 +1154,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
INT32 side, i;
size_t nodenum;
subsector_t *ret;
seg_t *seg;
// single subsector is a special case
if (numnodes == 0)
@@ -1184,31 +1183,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
static mobj_t *viewmobj;
// recalc necessary stuff for mouseaiming
// slopes are already calculated for the full possible view (which is 4*viewheight).
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
static void R_SetupFreelook(void)
{
INT32 dy = 0;
// clip it in the case we are looking a hardware 90 degrees full aiming
// (lmps, network and use F12...)
if (rendermode == render_soft
#ifdef HWRENDER
|| cv_grshearing.value
#endif
)
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
if (rendermode == render_soft)
{
dy = (AIMINGTODY(aimingangle)>>FRACBITS) * viewwidth/BASEVIDWIDTH;
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
}
centery = (viewheight/2) + dy;
centeryfrac = centery<<FRACBITS;
}
void R_SkyboxFrame(player_t *player)
{
camera_t *thiscam = &camera[0];
-2
View File
@@ -1019,8 +1019,6 @@ void R_DrawSinglePlane(visplane_t *pl)
temp = P_GetZAt(pl->slope, pl->viewx, pl->viewy);
zeroheight = FIXED_TO_FLOAT(temp);
#define ANG2RAD(angle) ((float)((angle)*M_PIl)/ANGLE_180)
// p is the texture origin in view space
// Don't add in the offsets at this stage, because doing so can result in
// errors if the flat is rotated.
+1 -1
View File
@@ -755,7 +755,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (pfloor->master->flags & ML_TFERLINE)
{
size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount);
size_t linenum = min((size_t)(curline->linedef-backsector->lines[0]), pfloor->master->frontsector->linecount);
newline = pfloor->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
+8 -13
View File
@@ -1316,15 +1316,13 @@ static void R_ProjectSprite(mobj_t *thing)
size_t rot;
UINT8 flip;
/*boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(thing));*/
boolean mirrored = thing->mirrored;
boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored);
INT32 lindex;
vissprite_t *vis;
spritecut_e cut = SC_NONE;
angle_t ang = 0; // gcc 4.6 and lower fix
fixed_t iscale;
@@ -3544,22 +3542,25 @@ void R_AddSkins(UINT16 wadnum, boolean local)
else if (!stricmp(stoken, "sprite"))
{
strupr(value);
strncpy(skin->sprite, value, sizeof skin->sprite);
memcpy(skin->sprite, value, sizeof skin->sprite);
}
else if (!stricmp(stoken, "facerank"))
{
strupr(value);
strncpy(skin->facerank, value, sizeof skin->facerank);
memcpy(skin->facerank, value, sizeof(skin->facerank)-1);
skin->facerank[sizeof(skin->facerank)-1] = '\0';
}
else if (!stricmp(stoken, "facewant"))
{
strupr(value);
strncpy(skin->facewant, value, sizeof skin->facewant);
memcpy(skin->facewant, value, sizeof(skin->facewant)-1);
skin->facewant[sizeof(skin->facewant)-1] = '\0';
}
else if (!stricmp(stoken, "facemmap"))
{
strupr(value);
strncpy(skin->facemmap, value, sizeof skin->facemmap);
strncpy(skin->facemmap, value, sizeof(skin->facemmap)-1);
skin->facemmap[sizeof(skin->facemmap)-1] = '\0';
}
#define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value);
@@ -3614,7 +3615,6 @@ next_token:
free(buf2);
lump++; // if no sprite defined use spirte just after this one
INT32 sprnum;
if (skin->sprite[0] == '\0')
{
const char *csprname = W_CheckNameForNumPwad(wadnum, lump);
@@ -3625,9 +3625,6 @@ next_token:
lastlump++;
// allocate (or replace) sprite frames, and set spritedef
R_AddSingleSpriteDef(csprname, &skin->spritedef, wadnum, lump, lastlump);
// i feel like generally most skin authors just use PLAY here, so just assume PLAY
sprnum = SPR_PLAY;
}
else
{
@@ -3675,8 +3672,6 @@ next_token:
R_AddSingleSpriteDef(sprname, &skin->spritedef, wadnum, lstart, lend);
}
sprnum = numspritelumps - 1;
// I don't particularly care about skipping to the end of the used frames.
// We could be using frames from ANYWHERE in the current WAD file, including
// right before us, which is a terrible idea.
+10 -5
View File
@@ -1429,8 +1429,9 @@ void S_LoadMusicDefs(UINT16 wadnum)
//CONS_Printf("S_LoadMusicDefs: Added song '%s'\n", def->name);
}
}
strncpy(def->filename, wadfiles[wadnum]->filename, 256);
memcpy(def->filename, wadfiles[wadnum]->filename, 256);
def->filename[256] = '\0';
skip_lump:
stoken = strtok(NULL, "\r\n ");
@@ -1981,14 +1982,14 @@ static void S_ChangeMusicToQueue(void)
void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 position, UINT32 prefadems, UINT32 fadeinms)
{
char newmusic[7];
char newmusic[7] = {0};
if (S_MusicDisabled()
|| demo.rewinding // Don't mess with music while rewinding!
|| demo.title) // SRB2Kart: Demos don't interrupt title screen music
return;
strncpy(newmusic, mmusic, 7);
strncpy(newmusic, mmusic, 6);
#ifdef HAVE_BLUA
if(LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
return;
@@ -2451,8 +2452,12 @@ void StereoSep_OnChange(void)
void AmigaFilter_OnChange(void)
{
if (openmpt_mhandle)
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value ? "1" : "0");
#else
openmpt_module_ctl_set(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value ? "1" : "0");
}
#endif
}
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
+1 -1
View File
@@ -161,7 +161,7 @@ typedef struct musicdef_s
char name[7];
char usage[256];
char source[256];
char filename[256];
char filename[256+1];
// for the music test stuff
// generally if these are present on vanilla the game would throw up a warning
// a sacrifice i suppose
+5 -2
View File
@@ -2605,7 +2605,7 @@ INT32 I_NumJoys(void)
return numjoy;
}
static char joyname[255]; // MAX_PATH; joystick name is straight from the driver
static char joyname[256]; // MAX_PATH; joystick name is straight from the driver
const char *I_GetJoyName(INT32 joyindex)
{
@@ -2616,7 +2616,10 @@ const char *I_GetJoyName(INT32 joyindex)
{
tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname)
strncpy(joyname, tempname, 255);
{
memcpy(joyname, tempname, 255);
joyname[255] = '\0';
}
}
return joyname;
}
+6 -1
View File
@@ -1255,11 +1255,16 @@ boolean I_PlaySong(boolean looping)
if (openmpt_mhandle)
{
openmpt_module_select_subsong(openmpt_mhandle, 0);
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_text(openmpt_mhandle, "dither", "1");
#else
openmpt_module_ctl_set(openmpt_mhandle, "dither", "1");
#endif
openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_STEREOSEPARATION_PERCENT, cv_stereosep.value); //have a feeling some might like it
openmpt_module_ctl_set(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value ? "1" : "0");
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
openmpt_module_ctl_set_text(openmpt_mhandle, "render.resampler.emulate_amiga_type", cv_amigatype.string);
#else
openmpt_module_ctl_set(openmpt_mhandle, "render.resampler.emulate_amiga", cv_amigafilter.value ? "1" : "0");
#endif
openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value);
if (looping)
+2 -2
View File
@@ -177,7 +177,7 @@ const char *R_GetPalname(UINT16 num)
if (num > 0 && num <= 10000)
snprintf(newpal, 8, "PAL%04u", num-1);
strncpy(palname, newpal, 8);
memcpy(palname, newpal, 9);
return palname;
}
@@ -536,7 +536,7 @@ void V_DrawStretchyFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, fixed_t vsca
// Draws a patch cropped and scaled to arbitrary size.
void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t *patch, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
{
fixed_t col, ofs, colfrac, rowfrac, fdup, vdup;
fixed_t col, ofs, colfrac, rowfrac, fdup;
INT32 dupx, dupy;
const column_t *column;
UINT8 *desttop, *dest;
+2 -2
View File
@@ -716,7 +716,7 @@ static void W_ReadFileShaders(wadfile_t *wadfile)
//
// Can now load dehacked files (.soc)
//
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local)
UINT16 W_InitFile(const char *filename, boolean local)
{
FILE *handle;
lumpinfo_t *lumpinfo = NULL;
@@ -957,7 +957,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
G_SetGameModified(true, false);
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
rc = W_InitFile(q[i].filename, 0, 0, false);
rc = W_InitFile(q[i].filename, false);
if (rc == INT16_MAX)
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
overallrc &= (rc != INT16_MAX) ? 1 : 0;
+1 -1
View File
@@ -136,7 +136,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors);
//
// if local is true, it wouldn't check if file adds complex things, therefore
// allowing to still join server without the "you have wrong addons loaded" error
UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local);
UINT16 W_InitFile(const char *filename, boolean local);
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num);
#endif
+2 -2
View File
@@ -337,7 +337,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
// Y_AnimatedVoteScreenCheck
//
// Check if the lumps exist (checking for VEXTR(N|W)xx for race and VEXTRB(N|W)xx for battle)
void Y_AnimatedVoteScreenCheck(void)
static void Y_AnimatedVoteScreenCheck(void)
{
char tmpPrefix[] = "INTS";
boolean stopSearching = false;
@@ -1055,7 +1055,7 @@ static void Y_UnloadData(void)
//
// Draw animated patch based on frame counter on vote screen
//
void Y_DrawAnimatedVoteScreenPatch(boolean widePatch){
static void Y_DrawAnimatedVoteScreenPatch(boolean widePatch){
char tempAnimPrefix[7];
(widePatch) ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix);
INT32 tempFoundAnimVoteFrames = (widePatch) ? foundAnimVoteWideFrames : foundAnimVoteFrames;