diff --git a/src/d_player.h b/src/d_player.h index 24c4f9252..7bee5f337 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 8a1079c36..ff62f2459 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -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")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 2e47f2077..7cf437384 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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); diff --git a/src/p_setup.c b/src/p_setup.c index 7597b7d87..b8db575b5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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; diff --git a/src/p_user.c b/src/p_user.c index 52b4cd88a..fd09b0847 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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); }