Track player's previous mare rings with player->finishedrings.

There may not be a point to this, other than to be consistent with how spheres are tracked. If non-special stage NiGHTS should tally a ring bonus, this may be useful.
This commit is contained in:
mazmazz 2018-08-10 04:05:20 -04:00
parent b05960431d
commit bd8316f49b
5 changed files with 20 additions and 6 deletions

View File

@ -462,6 +462,7 @@ typedef struct player_s
tic_t startedtime; // Time which you started this mare with.
tic_t finishedtime; // Time it took you to finish the mare (used for display)
INT16 finishedspheres; // The spheres you had left upon finishing the mare
INT16 finishedrings; // The rings/stars you had left upon finishing the mare
UINT32 marescore; // score for this nights stage
UINT32 lastmarescore; // score for the last mare
UINT8 lastmare; // previous mare

View File

@ -298,6 +298,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->finishedtime);
else if (fastcmp(field,"finishedspheres"))
lua_pushinteger(L, plr->finishedspheres);
else if (fastcmp(field,"finishedrings"))
lua_pushinteger(L, plr->finishedrings);
else if (fastcmp(field,"marescore"))
lua_pushinteger(L, plr->marescore);
else if (fastcmp(field,"lastmarescore"))
@ -576,6 +578,8 @@ static int player_set(lua_State *L)
plr->finishedtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"finishedspheres"))
plr->finishedspheres = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"finishedrings"))
plr->finishedrings = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"marescore"))
plr->marescore = (UINT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastmarescore"))

View File

@ -203,6 +203,7 @@ static void P_NetArchivePlayers(void)
WRITEUINT32(save_p, players[i].startedtime);
WRITEUINT32(save_p, players[i].finishedtime);
WRITEINT16(save_p, players[i].finishedspheres);
WRITEINT16(save_p, players[i].finishedrings);
WRITEUINT32(save_p, players[i].marescore);
WRITEUINT32(save_p, players[i].lastmarescore);
WRITEUINT8(save_p, players[i].lastmare);
@ -391,6 +392,7 @@ static void P_NetUnArchivePlayers(void)
players[i].startedtime = READUINT32(save_p);
players[i].finishedtime = READUINT32(save_p);
players[i].finishedspheres = READINT16(save_p);
players[i].finishedrings = READINT16(save_p);
players[i].marescore = READUINT32(save_p);
players[i].lastmarescore = READUINT32(save_p);
players[i].lastmare = READUINT8(save_p);

View File

@ -2380,12 +2380,13 @@ static void P_LevelInitStuff(void)
players[i].marescore = players[i].lastmarescore =\
players[i].maxlink = players[i].startedtime =\
players[i].finishedtime = players[i].finishedspheres =\
players[i].lastmare = players[i].marebegunat =\
players[i].textvar = players[i].texttimer =\
players[i].linkcount = players[i].linktimer =\
players[i].flyangle = players[i].anotherflyangle =\
players[i].nightstime = players[i].mare =\
players[i].realtime = players[i].exiting = 0;
players[i].finishedrings = players[i].lastmare =\
players[i].marebegunat = players[i].textvar =\
players[i].texttimer = players[i].linkcount =\
players[i].linktimer = players[i].flyangle =\
players[i].anotherflyangle = players[i].nightstime =\
players[i].mare = players[i].realtime =\
players[i].exiting = 0;
// i guess this could be part of the above but i feel mildly uncomfortable implicitly casting
players[i].gotcontinue = false;

View File

@ -685,6 +685,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
{
INT32 i;
INT32 total_spheres = 0;
INT32 total_rings = 0;
P_SetTarget(&player->mo->target, NULL);
@ -692,7 +693,10 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
{
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]/* && players[i].powers[pw_carry] == CR_NIGHTSMODE*/)
{
total_spheres += players[i].spheres;
total_rings += players[i].rings;
}
}
for (i = 0; i < MAXPLAYERS; i++)
@ -706,11 +710,13 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
if (G_IsSpecialStage(gamemap))
{
players[i].finishedspheres = (INT16)total_spheres;
players[i].finishedrings = (INT16)total_rings;
P_AddPlayerScore(player, total_spheres * 50);
}
else
{
players[i].finishedspheres = (INT16)(players[i].spheres);
players[i].finishedrings = (INT16)(players[i].rings);
P_AddPlayerScore(&players[i], (players[i].spheres) * 50);
}