Salvage the remaining parts of 8f68a21

I'm keeping the screenshot mapname tho :^)
This commit is contained in:
GenericHeroGuy 2025-02-17 21:43:12 +01:00
parent c93fa43f24
commit 723164152f
6 changed files with 10 additions and 26 deletions

View file

@ -1893,14 +1893,11 @@ void D_SRB2Main(void)
if (server && !M_CheckParm("+map"))
{
// Prevent warping to nonexistent levels
if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR)
I_Error("Could not warp to %s (map not found)\n", G_BuildMapName(pstartmap));
// Prevent warping to locked levels
// ... unless you're in a dedicated server. Yes, technically this means you can view any level by
// running a dedicated server and joining it yourself, but that's better than making dedicated server's
// lives hell.
else if (!dedicated && M_MapLocked(pstartmap))
if (!dedicated && M_MapLocked(pstartmap))
I_Error("You need to unlock this level before you can warp to it!\n");
else
{

View file

@ -442,9 +442,6 @@ void DRPC_UpdatePresence(void)
char detailstr[48+1];
#ifdef USEMAPIMG
char mapimg[8+1];
#endif
char mapname[5+21+21+2+1];
char charimg[4+SKINNAMESIZE+1];
@ -547,16 +544,6 @@ void DRPC_UpdatePresence(void)
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) // Map info
&& !(demo.playback && demo.title))
{
#ifdef USEMAPIMG
if ((gamemap >= 1 && gamemap <= 60) // supported race maps
|| (gamemap >= 136 && gamemap <= 164)) // supported battle maps
{
snprintf(mapimg, 8, "%s", G_BuildMapName(gamemap));
strlwr(mapimg);
discordPresence.largeImageKey = mapimg; // Map image
}
else
#endif
if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
{
// Hell map, use the method that got you here :P

View file

@ -1354,7 +1354,7 @@ void G_DoLoadLevel(boolean resetplayer)
// cleanup
if (titlemapinaction == TITLEMAP_LOADING)
{
if (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR)
if (gamemap < 1 || gamemap > nummapheaders)
{
titlemap = 0; // let's not infinite recursion ok
Command_ExitGame_f();
@ -3606,7 +3606,7 @@ tryagain:
break;
}
if (vLump == NULL && ((l = W_CheckNumForName(va("%sS01",mapheaderinfo[ix+1]->lumpname))) == LUMPERROR))
if (vLump == NULL && ((l = W_CheckNumForLongName(va("%sS01",mapheaderinfo[ix+1]->lumpname))) == LUMPERROR))
{
vres_Free(vRes);
continue;

View file

@ -2281,7 +2281,7 @@ static void Dummystaff_OnChange(void)
dummystaffname[0] = '\0';
// TODO: Use map header to determine lump name
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR)
if ((l = W_CheckNumForLongName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR)
{
CV_StealthSetValue(&cv_dummystaff, 0);
return;
@ -2290,7 +2290,7 @@ static void Dummystaff_OnChange(void)
{
char *temp = dummystaffname;
UINT8 numstaff = 1;
while (numstaff < 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),numstaff+1))) != LUMPERROR)
while (numstaff < 99 && (l = W_CheckNumForLongName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),numstaff+1))) != LUMPERROR)
numstaff++;
if (cv_dummystaff.value < 1)
@ -2298,7 +2298,7 @@ static void Dummystaff_OnChange(void)
else if (cv_dummystaff.value > numstaff)
CV_StealthSetValue(&cv_dummystaff, 1);
if ((l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR)
if ((l = W_CheckNumForLongName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR)
return; // shouldn't happen but might as well check...
G_UpdateStaffGhostName(l);

View file

@ -793,7 +793,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
"Unknown";
#endif
char rendermodetxt[9];
char maptext[8];
char maptext[MAXMAPLUMPNAME];
char lvlttltext[48];
char locationtxt[40];
char ctrevision[40];
@ -814,7 +814,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
}
if (gamestate == GS_LEVEL)
snprintf(maptext, 8, "%s", G_BuildMapName(gamemap));
snprintf(maptext, MAXMAPLUMPNAME, "%s", G_BuildMapName(gamemap));
else
snprintf(maptext, 8, "Unknown");

View file

@ -7849,7 +7849,7 @@ static void P_LoadRecordGhosts(void)
lumpnum_t l;
UINT8 j = 1;
// TODO: Use map header to determine lump name
while (j <= 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(gamemap),j))) != LUMPERROR)
while (j <= 99 && (l = W_CheckNumForLongName(va("%sS%02u",G_BuildMapName(gamemap),j))) != LUMPERROR)
{
G_AddGhost(va("%sS%02u",G_BuildMapName(gamemap),j));
j++;
@ -7991,7 +7991,7 @@ static void P_InitGametype(void)
#else
strcpy(ver, VERSIONSTRING);
#endif
sprintf(buf, "%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online"PATHSEP"%s"PATHSEP"%d-%s",
snprintf(buf, sizeof buf, "%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online"PATHSEP"%s"PATHSEP"%d-%s",
srb2home, ver, (int) (time(NULL)), G_BuildMapName(gamemap));
parts = M_PathParts(buf);