actnum is now a 2 character long string

For Cloud Cradle Zone, Act K
This commit is contained in:
TehRealSalt 2018-06-05 01:34:05 -04:00
parent 14caf66567
commit 0fc113e6dd
12 changed files with 66 additions and 53 deletions

View File

@ -1319,7 +1319,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
else
netbuffer->u.serverinfo.iszone = 0;
netbuffer->u.serverinfo.actnum = mapheaderinfo[gamemap-1]->actnum;
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
p = PutFileNeeded();
@ -1636,15 +1636,16 @@ static void CL_LoadReceivedSavegame(void)
if (P_LoadNetGame())
{
const INT32 actnum = mapheaderinfo[gamemap-1]->actnum;
CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap));
if (strcmp(mapheaderinfo[gamemap-1]->lvlttl, ""))
{
CONS_Printf(": %s", mapheaderinfo[gamemap-1]->lvlttl);
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
if (strcmp(mapheaderinfo[gamemap-1]->zonttl, ""))
CONS_Printf(" %s", mapheaderinfo[gamemap-1]->zonttl);
else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
CONS_Printf(M_GetText(" ZONE"));
if (actnum > 0)
CONS_Printf(" %2d", actnum);
if (strcmp(mapheaderinfo[gamemap-1]->actnum, ""))
CONS_Printf(" %s", mapheaderinfo[gamemap-1]->actnum);
}
CONS_Printf("\"\n");
}

View File

@ -4523,10 +4523,20 @@ static void Command_Showmap_f(void)
{
if (gamestate == GS_LEVEL)
{
if (mapheaderinfo[gamemap-1]->actnum)
CONS_Printf("%s (%d): %s %d\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum);
if (mapheaderinfo[gamemap-1]->zonttl)
{
if (mapheaderinfo[gamemap-1]->actnum)
CONS_Printf("%s (%d): %s %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum);
else
CONS_Printf("%s (%d): %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl);
}
else
CONS_Printf("%s (%d): %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl);
{
if (mapheaderinfo[gamemap-1]->actnum)
CONS_Printf("%s (%d): %s %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum);
else
CONS_Printf("%s (%d): %s\n", G_BuildMapName(gamemap), gamemap, mapheaderinfo[gamemap-1]->lvlttl);
}
}
else
CONS_Printf(M_GetText("You must be in a level to use this.\n"));

View File

@ -1136,10 +1136,12 @@ static void readlevelheader(MYFILE *f, INT32 num)
}
else if (fastcmp(word, "ACT"))
{
if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
/*if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
mapheaderinfo[num-1]->actnum = (UINT8)i;
else
deh_warning("Level header %d: invalid act number %d", num, i);
deh_warning("Level header %d: invalid act number %d", num, i);*/
deh_strlcpy(mapheaderinfo[num-1]->actnum, word2,
sizeof(mapheaderinfo[num-1]->actnum), va("Level header %d: actnum", num));
}
else if (fastcmp(word, "NEXTLEVEL"))
{

View File

@ -220,7 +220,7 @@ typedef struct
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
char zonttl[22]; ///< "ZONE" replacement name
UINT8 actnum; ///< Act number or 0 for none.
char actnum[3]; ///< SRB2Kart: Now a 2 character long string.
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
char musname[7]; ///< Music track to play. "" for no music.

View File

@ -4149,7 +4149,7 @@ char *G_BuildMapTitle(INT32 mapnum)
{
size_t len = 1;
const char *zonetext = NULL;
const INT32 actnum = mapheaderinfo[mapnum-1]->actnum;
const char *actnum = NULL;
len += strlen(mapheaderinfo[mapnum-1]->lvlttl);
if (strcmp(mapheaderinfo[mapnum-1]->zonttl, ""))
@ -4162,14 +4162,17 @@ char *G_BuildMapTitle(INT32 mapnum)
zonetext = M_GetText("ZONE");
len += strlen(zonetext) + 1; // ' ' + zonetext
}
if (actnum > 0)
len += 1 + 11; // ' ' + INT32
if (strcmp(mapheaderinfo[mapnum-1]->actnum, ""))
{
actnum = M_GetText(mapheaderinfo[mapnum-1]->actnum);
len += strlen(actnum) + 1; // ' ' + actnum
}
title = Z_Malloc(len, PU_STATIC, NULL);
sprintf(title, "%s", mapheaderinfo[mapnum-1]->lvlttl);
if (zonetext) sprintf(title + strlen(title), " %s", zonetext);
if (actnum > 0) sprintf(title + strlen(title), " %d", actnum);
if (actnum) sprintf(title + strlen(title), " %s", actnum);
}
return title;

View File

@ -1185,7 +1185,7 @@ static int mapheaderinfo_get(lua_State *L)
else if (fastcmp(field,"zonttl"))
lua_pushstring(L, header->zonttl);
else if (fastcmp(field,"actnum"))
lua_pushinteger(L, header->actnum);
lua_pushstring(L, header->actnum);
else if (fastcmp(field,"typeoflevel"))
lua_pushinteger(L, header->typeoflevel);
else if (fastcmp(field,"nextlevel"))

View File

@ -3373,15 +3373,15 @@ static void M_DrawPauseMenu(void)
if (mapheaderinfo[gamemap-1]->zonttl)
{
if (mapheaderinfo[gamemap-1]->actnum != 0)
V_DrawString(40, 28, V_YELLOWMAP, va("%s %s %d", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum));
if (mapheaderinfo[gamemap-1]->actnum)
V_DrawString(40, 28, V_YELLOWMAP, va("%s %s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl, mapheaderinfo[gamemap-1]->actnum));
else
V_DrawString(40, 28, V_YELLOWMAP, va("%s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->zonttl));
}
else
{
if (mapheaderinfo[gamemap-1]->actnum != 0)
V_DrawString(40, 28, V_YELLOWMAP, va("%s %d", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum));
if (mapheaderinfo[gamemap-1]->actnum)
V_DrawString(40, 28, V_YELLOWMAP, va("%s %s", mapheaderinfo[gamemap-1]->lvlttl, mapheaderinfo[gamemap-1]->actnum));
else
V_DrawString(40, 28, V_YELLOWMAP, mapheaderinfo[gamemap-1]->lvlttl);
}
@ -4896,7 +4896,7 @@ static void M_ReadSavegameInfo(UINT32 slot)
else
{
strcpy(savegameinfo[slot].levelname, mapheaderinfo[(fake-1) & 8191]->lvlttl);
savegameinfo[slot].actnum = mapheaderinfo[(fake-1) & 8191]->actnum;
savegameinfo[slot].actnum = 0; //mapheaderinfo[(fake-1) & 8191]->actnum
}
#ifdef SAVEGAMES_OTHERVERSIONS
@ -5349,15 +5349,15 @@ static void M_DrawStatsMaps(int location)
if (mapheaderinfo[mnum]->zonttl)
{
if (mapheaderinfo[mnum]->actnum != 0)
V_DrawString(20, y, V_YELLOWMAP, va("%s %s %d", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->zonttl, mapheaderinfo[mnum]->actnum));
if (mapheaderinfo[mnum]->actnum)
V_DrawString(20, y, V_YELLOWMAP, va("%s %s %s", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->zonttl, mapheaderinfo[mnum]->actnum));
else
V_DrawString(20, y, V_YELLOWMAP, va("%s %s", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->zonttl));
}
else
{
if (mapheaderinfo[mnum]->actnum != 0)
V_DrawString(20, y, V_YELLOWMAP, va("%s %d", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->actnum));
if (mapheaderinfo[mnum]->actnum)
V_DrawString(20, y, V_YELLOWMAP, va("%s %s", mapheaderinfo[mnum]->lvlttl, mapheaderinfo[mnum]->actnum));
else
V_DrawString(20, y, V_YELLOWMAP, mapheaderinfo[mnum]->lvlttl);
}

View File

@ -679,9 +679,9 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0')
snprintf(lvlttltext, 48, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? mapheaderinfo[gamemap-1]->zonttl : // SRB2kart
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? va(" %s",mapheaderinfo[gamemap-1]->zonttl) : // SRB2kart
((mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE"),
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(" %d",mapheaderinfo[gamemap-1]->actnum) : "");
(mapheaderinfo[gamemap-1]->actnum) ? va(" %s",mapheaderinfo[gamemap-1]->actnum) : "");
else
snprintf(lvlttltext, 48, "Unknown");

View File

@ -179,8 +179,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->subttl[0] = '\0';
DEH_WriteUndoline("ZONETITLE", mapheaderinfo[num]->zonttl, UNDO_NONE); // SRB2kart
mapheaderinfo[num]->zonttl[0] = '\0';
DEH_WriteUndoline("ACT", va("%d", mapheaderinfo[num]->actnum), UNDO_NONE);
mapheaderinfo[num]->actnum = 0;
DEH_WriteUndoline("ACT", mapheaderinfo[num]->actnum, UNDO_NONE); // SRB2kart
mapheaderinfo[num]->actnum[0] = '\0';
DEH_WriteUndoline("TYPEOFLEVEL", va("%d", mapheaderinfo[num]->typeoflevel), UNDO_NONE);
mapheaderinfo[num]->typeoflevel = 0;
DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE);
@ -2681,9 +2681,9 @@ boolean P_SetupLevel(boolean skipprecip)
V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to..."));
snprintf(tx, 63, "%s%s%s",
mapheaderinfo[gamemap-1]->lvlttl,
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? mapheaderinfo[gamemap-1]->zonttl : // SRB2kart
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? va(" %s",mapheaderinfo[gamemap-1]->zonttl) : // SRB2kart
((mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE"),
(mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : "");
(mapheaderinfo[gamemap-1]->actnum) ? va(", Act %s",mapheaderinfo[gamemap-1]->actnum) : "");
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
I_UpdateNoVsync();
}
@ -3039,7 +3039,7 @@ boolean P_SetupLevel(boolean skipprecip)
if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking || players[consoleplayer].lives <= 0)
&& (!modifiedgame || savemoddata) && cursaveslot >= 0 && !ultimatemode
&& !(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
&& (!G_IsSpecialStage(gamemap)) && gamemap != lastmapsaved && (mapheaderinfo[gamemap-1]->actnum < 2 || gamecomplete))
&& (!G_IsSpecialStage(gamemap)) && gamemap != lastmapsaved && (/*mapheaderinfo[gamemap-1]->actnum < 2 ||*/ gamecomplete))
G_SaveGame((UINT32)cursaveslot);
if (savedata.lives > 0)

View File

@ -77,7 +77,7 @@ static patch_t *race1;
static patch_t *race2;
static patch_t *race3;
static patch_t *racego;
static patch_t *ttlnum;
//static patch_t *ttlnum;
static patch_t *nightslink;
static patch_t *count5;
static patch_t *count4;
@ -753,7 +753,7 @@ static void ST_drawLevelTitle(void)
char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
char *subttl = mapheaderinfo[gamemap-1]->subttl;
char *zonttl = mapheaderinfo[gamemap-1]->zonttl; // SRB2kart
INT32 actnum = mapheaderinfo[gamemap-1]->actnum;
char *actnum = mapheaderinfo[gamemap-1]->actnum;
INT32 lvlttlxpos;
INT32 subttlxpos = BASEVIDWIDTH/2;
INT32 ttlnumxpos;
@ -765,11 +765,8 @@ static void ST_drawLevelTitle(void)
if (!(timeinmap > 2 && timeinmap-3 < 110))
return;
if (actnum > 0)
{
ttlnum = W_CachePatchName(va("TTL%.2d", actnum), PU_CACHE);
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)) - SHORT(ttlnum->width);
}
if (strlen(actnum) > 0)
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)) - V_LevelNameWidth(actnum);
else
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2));
@ -801,8 +798,8 @@ static void ST_drawLevelTitle(void)
default: zoney = 104; lvlttly = 80; break;
}
if (actnum)
V_DrawScaledPatch(ttlnumxpos, zoney, 0, ttlnum);
if (strlen(actnum) > 0)
V_DrawLevelTitle(ttlnumxpos+12, zoney, 0, actnum);
V_DrawLevelTitle(lvlttlxpos, lvlttly, 0, lvlttl);

View File

@ -1774,7 +1774,7 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
c = toupper(c) - LT_FONTSTART;
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
{
cx += 16*dupx;
cx += 12*dupx;
continue;
}
@ -1805,7 +1805,7 @@ INT32 V_LevelNameWidth(const char *string)
{
c = toupper(string[i]) - LT_FONTSTART;
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
w += 16;
w += 12;
else
w += SHORT(lt_font[c]->width);
}

View File

@ -1122,10 +1122,10 @@ void Y_StartIntermission(void)
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_STATIC);
// get act number
if (mapheaderinfo[prevmap]->actnum)
/*if (mapheaderinfo[prevmap]->actnum)
data.coop.ttlnum = W_CachePatchName(va("TTL%.2d", mapheaderinfo[prevmap]->actnum),
PU_STATIC);
else
else*/
data.coop.ttlnum = W_CachePatchName("TTL01", PU_STATIC);
// get background patches
@ -1317,7 +1317,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
"%.32s %.32s * %d *",
"%.32s %.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->zonttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
@ -1330,7 +1330,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
"%.32s * %d *",
"%.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
@ -1380,7 +1380,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
"%.32s %.32s * %d *",
"%.32s %.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->zonttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
@ -1393,7 +1393,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
"%.32s * %d *",
"%.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
@ -1423,7 +1423,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.match.levelstring,
sizeof data.match.levelstring,
"%.32s * %d *",
"%.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.match.levelstring,
@ -1459,7 +1459,7 @@ void Y_StartIntermission(void)
if (mapheaderinfo[prevmap]->actnum)
snprintf(data.competition.levelstring,
sizeof data.competition.levelstring,
"%.32s * %d *",
"%.32s * %s *",
mapheaderinfo[prevmap]->lvlttl, mapheaderinfo[prevmap]->actnum);
else
snprintf(data.competition.levelstring,
@ -2530,7 +2530,7 @@ void Y_StartVote(void)
if (mapheaderinfo[votelevels[i]]->actnum)
snprintf(levelinfo[i].str,
sizeof levelinfo[i].str,
"%.32s %.32s %d",
"%.32s %.32s %s",
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->zonttl, mapheaderinfo[votelevels[i]]->actnum);
else
snprintf(levelinfo[i].str,
@ -2543,7 +2543,7 @@ void Y_StartVote(void)
if (mapheaderinfo[votelevels[i]]->actnum)
snprintf(levelinfo[i].str,
sizeof levelinfo[i].str,
"%.32s %d",
"%.32s %s",
mapheaderinfo[votelevels[i]]->lvlttl, mapheaderinfo[votelevels[i]]->actnum);
else
snprintf(levelinfo[i].str,