mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-26 14:21:03 +00:00
Allow per-mare timers in NiGHTS via level header
This commit is contained in:
parent
b5232a4ca4
commit
48a8043c1d
5 changed files with 39 additions and 1 deletions
|
@ -1528,6 +1528,12 @@ void readlevelheader(MYFILE *f, INT32 num)
|
||||||
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NiGHTS time limits (per mare)
|
||||||
|
else if (fastncmp(word, "NIGHTSTIME", 10))
|
||||||
|
{
|
||||||
|
P_AddNiGHTSTimes((INT16)(num-1), word2);
|
||||||
|
}
|
||||||
|
|
||||||
// Strings that can be truncated
|
// Strings that can be truncated
|
||||||
else if (fastcmp(word, "SELECTHEADING"))
|
else if (fastcmp(word, "SELECTHEADING"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -335,6 +335,7 @@ typedef struct
|
||||||
INT32 sstimer; ///< Timer for special stages.
|
INT32 sstimer; ///< Timer for special stages.
|
||||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||||
fixed_t gravity; ///< Map-wide gravity.
|
fixed_t gravity; ///< Map-wide gravity.
|
||||||
|
UINT16 nightstimer[8]; ///< Per-mare time limits for NiGHTS stages.
|
||||||
|
|
||||||
// Title card.
|
// Title card.
|
||||||
char ltzzpatch[9]; ///< Zig zag patch.
|
char ltzzpatch[9]; ///< Zig zag patch.
|
||||||
|
|
|
@ -355,6 +355,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
||||||
mapheaderinfo[num]->marathonnext = 0;
|
mapheaderinfo[num]->marathonnext = 0;
|
||||||
mapheaderinfo[num]->startrings = 0;
|
mapheaderinfo[num]->startrings = 0;
|
||||||
mapheaderinfo[num]->sstimer = 90;
|
mapheaderinfo[num]->sstimer = 90;
|
||||||
|
for (UINT8 n = 0; n < 8; n++)
|
||||||
|
mapheaderinfo[num]->nightstimer[n] = 0;
|
||||||
mapheaderinfo[num]->ssspheres = 1;
|
mapheaderinfo[num]->ssspheres = 1;
|
||||||
mapheaderinfo[num]->gravity = FRACUNIT/2;
|
mapheaderinfo[num]->gravity = FRACUNIT/2;
|
||||||
mapheaderinfo[num]->keywords[0] = '\0';
|
mapheaderinfo[num]->keywords[0] = '\0';
|
||||||
|
@ -522,6 +524,29 @@ UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade)
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void P_AddNiGHTSTimes(INT16 i, char *gtext)
|
||||||
|
{
|
||||||
|
char *spos = gtext;
|
||||||
|
|
||||||
|
for (UINT8 n = 0; n < 8; n++)
|
||||||
|
{
|
||||||
|
if (spos != NULL)
|
||||||
|
{
|
||||||
|
mapheaderinfo[i]->nightstimer[n] = atoi(spos);
|
||||||
|
CONS_Debug(DBG_SETUP, "%u ", atoi(spos));
|
||||||
|
// Grab next comma
|
||||||
|
spos = strchr(spos, ',');
|
||||||
|
if (spos)
|
||||||
|
++spos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapheaderinfo[i]->nightstimer[n] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// levelflats
|
// levelflats
|
||||||
//
|
//
|
||||||
|
|
|
@ -123,5 +123,6 @@ UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
|
||||||
UINT8 P_HasGrades(INT16 map, UINT8 mare);
|
UINT8 P_HasGrades(INT16 map, UINT8 mare);
|
||||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
|
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
|
||||||
UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade);
|
UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade);
|
||||||
|
void P_AddNiGHTSTimes(INT16 i, char *gtext);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -774,7 +774,7 @@ static void P_DeNightserizePlayer(player_t *player)
|
||||||
// NiGHTS Time!
|
// NiGHTS Time!
|
||||||
void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
||||||
{
|
{
|
||||||
UINT8 oldmare, oldmarelap, oldmarebonuslap;
|
UINT8 oldmare, oldmarelap, oldmarebonuslap, newmare;
|
||||||
|
|
||||||
// Bots can't be NiGHTSerized, silly!1 :P
|
// Bots can't be NiGHTSerized, silly!1 :P
|
||||||
if (player->bot)
|
if (player->bot)
|
||||||
|
@ -795,6 +795,11 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use mare-specific time limit if specified
|
||||||
|
newmare = P_FindLowestMare();
|
||||||
|
if (mapheaderinfo[gamemap-1]->nightstimer[newmare] > 0)
|
||||||
|
nighttime = mapheaderinfo[gamemap-1]->nightstimer[newmare];
|
||||||
|
|
||||||
player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING);
|
player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING);
|
||||||
player->homing = 0;
|
player->homing = 0;
|
||||||
player->mo->fuse = 0;
|
player->mo->fuse = 0;
|
||||||
|
|
Loading…
Reference in a new issue