mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
* Added "Flickylist = DEMO" option, creating the five species of flicky similar enough in appearance to the Freed Animals from the days of yore.
* Set the default flicky group to be equivalent to Flickylist = Demo. * Refactored a little. (This also removed a crash-causing typo in a Z_Free in P_ClearSingleMapHeaderInfo.)
This commit is contained in:
parent
21b316e9a4
commit
6ed8d99b48
3 changed files with 40 additions and 13 deletions
|
@ -371,8 +371,7 @@ static void clear_levels(void)
|
|||
// (no need to set num to 0, we're freeing the entire header shortly)
|
||||
Z_Free(mapheaderinfo[i]->customopts);
|
||||
|
||||
if (mapheaderinfo[i]->flickies)
|
||||
Z_Free(mapheaderinfo[i]->flickies);
|
||||
P_DeleteFlickies(i);
|
||||
P_DeleteGrades(i);
|
||||
|
||||
Z_Free(mapheaderinfo[i]);
|
||||
|
@ -1123,12 +1122,9 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
if (fastcmp(word, "FLICKYLIST") || fastcmp(word, "ANIMALLIST"))
|
||||
{
|
||||
if (fastcmp(word2, "NONE"))
|
||||
{
|
||||
if (mapheaderinfo[num-1]->flickies)
|
||||
Z_Free(mapheaderinfo[num-1]->flickies);
|
||||
mapheaderinfo[num-1]->flickies = NULL;
|
||||
mapheaderinfo[num-1]->numFlickies = 0;
|
||||
}
|
||||
P_DeleteFlickies(num-1);
|
||||
else if (fastcmp(word2, "DEMO"))
|
||||
P_SetDemoFlickies(num-1);
|
||||
else if (fastcmp(word2, "ALL"))
|
||||
{
|
||||
mobjtype_t tmpflickies[MAXFLICKIES];
|
||||
|
@ -1138,7 +1134,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
mapheaderinfo[num-1]->numFlickies++)
|
||||
tmpflickies[mapheaderinfo[num-1]->numFlickies] = FLICKYTYPES[mapheaderinfo[num-1]->numFlickies].type;
|
||||
|
||||
if (mapheaderinfo[num-1]->numFlickies)
|
||||
if (mapheaderinfo[num-1]->numFlickies) // just in case...
|
||||
{
|
||||
size_t newsize = sizeof(mobjtype_t) * mapheaderinfo[num-1]->numFlickies;
|
||||
mapheaderinfo[num-1]->flickies = Z_Realloc(mapheaderinfo[num-1]->flickies, newsize, PU_STATIC, NULL);
|
||||
|
|
|
@ -160,6 +160,33 @@ FUNCNORETURN static ATTRNORETURN void CorruptMapError(const char *msg)
|
|||
I_Error("Invalid or corrupt map.\nLook in log file or text console for technical details.");
|
||||
}
|
||||
|
||||
/** Sets a header's flickies to be equivalent to the original Freed Animals
|
||||
*
|
||||
* \param i The header to set flickies for
|
||||
*/
|
||||
void P_SetDemoFlickies(INT16 i)
|
||||
{
|
||||
mapheaderinfo[i]->numFlickies = 5;
|
||||
mapheaderinfo[i]->flickies = Z_Realloc(mapheaderinfo[i]->flickies, 5*sizeof(mobjtype_t), PU_STATIC, NULL);
|
||||
mapheaderinfo[i]->flickies[0] = MT_FLICKY_02/*MT_BUNNY*/;
|
||||
mapheaderinfo[i]->flickies[1] = MT_FLICKY_01/*MT_BIRD*/;
|
||||
mapheaderinfo[i]->flickies[2] = MT_FLICKY_12/*MT_MOUSE*/;
|
||||
mapheaderinfo[i]->flickies[3] = MT_FLICKY_11/*MT_COW*/;
|
||||
mapheaderinfo[i]->flickies[4] = MT_FLICKY_03/*MT_CHICKEN*/;
|
||||
}
|
||||
|
||||
/** Clears a header's flickies
|
||||
*
|
||||
* \param i The header to clear flickies for
|
||||
*/
|
||||
void P_DeleteFlickies(INT16 i)
|
||||
{
|
||||
if (mapheaderinfo[i]->flickies)
|
||||
Z_Free(mapheaderinfo[i]->flickies);
|
||||
mapheaderinfo[i]->flickies = NULL;
|
||||
mapheaderinfo[i]->numFlickies = 0;
|
||||
}
|
||||
|
||||
#define NUMLAPS_DEFAULT 4
|
||||
|
||||
/** Clears the data from a single map header.
|
||||
|
@ -224,10 +251,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE);
|
||||
mapheaderinfo[num]->menuflags = 0;
|
||||
// Flickies. Nope, no delfile support here either
|
||||
if (mapheaderinfo[num]->flickies)
|
||||
Z_Free(mapheaderinfo[i]->flickies);
|
||||
mapheaderinfo[num]->flickies = NULL;
|
||||
mapheaderinfo[num]->numFlickies = 0;
|
||||
#if 1 // equivalent to "FlickyList = DEMO"
|
||||
P_SetDemoFlickies(num);
|
||||
#else // equivalent to "FlickyList = NONE"
|
||||
P_DeleteFlickies(num);
|
||||
#endif
|
||||
// TODO grades support for delfile (pfft yeah right)
|
||||
P_DeleteGrades(num);
|
||||
// an even further impossibility, delfile custom opts support
|
||||
|
|
|
@ -66,6 +66,9 @@ void P_WriteThings(lumpnum_t lump);
|
|||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
void P_SetDemoFlickies(INT16 i);
|
||||
void P_DeleteFlickies(INT16 i);
|
||||
|
||||
// Needed for NiGHTS
|
||||
void P_ReloadRings(void);
|
||||
void P_DeleteGrades(INT16 i);
|
||||
|
|
Loading…
Reference in a new issue