Merge branch 'levelheader-startrings' into 'master'

Startrings level header option

Closes #155

See merge request STJr/SRB2Internal!237
This commit is contained in:
Monster Iestyn 2019-06-25 16:43:16 -04:00
commit ac669d77c4
5 changed files with 9 additions and 1 deletions

View file

@ -1323,6 +1323,8 @@ static void readlevelheader(MYFILE *f, INT32 num)
else else
mapheaderinfo[num-1]->menuflags &= ~LF2_WIDEICON; mapheaderinfo[num-1]->menuflags &= ~LF2_WIDEICON;
} }
else if (fastcmp(word, "STARTRINGS"))
mapheaderinfo[num-1]->startrings = (UINT16)i;
else else
deh_warning("Level header %d: unknown word '%s'", num, word); deh_warning("Level header %d: unknown word '%s'", num, word);
} }

View file

@ -313,6 +313,7 @@ typedef struct
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
char selectheading[22]; ///< Level select heading. Allows for controllable grouping. char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
UINT16 startrings; ///< Number of rings players start with.
// Freed animals stuff. // Freed animals stuff.
UINT8 numFlickies; ///< Internal. For freed flicky support. UINT8 numFlickies; ///< Internal. For freed flicky support.

View file

@ -2397,6 +2397,8 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
P_SpawnPlayer(playernum); P_SpawnPlayer(playernum);
players[playernum].rings = mapheaderinfo[gamemap-1]->startrings;
if (starpost) //Don't even bother with looking for a place to spawn. if (starpost) //Don't even bother with looking for a place to spawn.
{ {
P_MovePlayerToStarpost(playernum); P_MovePlayerToStarpost(playernum);

View file

@ -2080,6 +2080,8 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->levelflags); lua_pushinteger(L, header->levelflags);
else if (fastcmp(field,"menuflags")) else if (fastcmp(field,"menuflags"))
lua_pushinteger(L, header->menuflags); lua_pushinteger(L, header->menuflags);
else if (fastcmp(field,"startrings"))
lua_pushinteger(L, header->startrings);
// TODO add support for reading numGradedMares and grades // TODO add support for reading numGradedMares and grades
else { else {
// Read custom vars now // Read custom vars now

View file

@ -209,6 +209,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
mapheaderinfo[num]->actnum = 0; mapheaderinfo[num]->actnum = 0;
mapheaderinfo[num]->typeoflevel = 0; mapheaderinfo[num]->typeoflevel = 0;
mapheaderinfo[num]->nextlevel = (INT16)(i + 1); mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
mapheaderinfo[num]->startrings = 0;
snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->musname[6] = 0;
mapheaderinfo[num]->mustrack = 0; mapheaderinfo[num]->mustrack = 0;
@ -2175,7 +2176,7 @@ static void P_LevelInitStuff(void)
tokenbits = 0; tokenbits = 0;
runemeraldmanager = false; runemeraldmanager = false;
emeraldspawndelay = 60*TICRATE; emeraldspawndelay = 60*TICRATE;
nummaprings = 0; nummaprings = mapheaderinfo[gamemap-1]->startrings;
// emerald hunt // emerald hunt
hunt1 = hunt2 = hunt3 = NULL; hunt1 = hunt2 = hunt3 = NULL;