diff --git a/src/d_player.h b/src/d_player.h index e7e6e48275b75e653513095d1cdf9ee73294b18b..fd41c762125ac5f9b6b09a5a0f91d635d52711ff 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -469,6 +469,7 @@ typedef struct player_s 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 + UINT32 totalmarescore; // score for all mares UINT8 lastmare; // previous mare UINT8 lastmarelap; // previous mare lap UINT8 lastmarebonuslap; // previous mare bonus lap diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 67efe77108c4153a8c17eb6963b27f6bedb9172a..f973061f1d6ca7c928b303129208ad279fb9048d 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -312,6 +312,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->marescore); else if (fastcmp(field,"lastmarescore")) lua_pushinteger(L, plr->lastmarescore); + else if (fastcmp(field,"totalmarescore")) + lua_pushinteger(L, plr->totalmarescore); else if (fastcmp(field,"lastmare")) lua_pushinteger(L, plr->lastmare); else if (fastcmp(field,"lastmarelap")) @@ -608,6 +610,8 @@ static int player_set(lua_State *L) plr->marescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarescore")) plr->lastmarescore = (UINT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarescore")) + plr->totalmarescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmare")) plr->lastmare = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarelap")) diff --git a/src/p_saveg.c b/src/p_saveg.c index bcc582cd04b97f7c65888d5284a524c33d5bda3f..22d43f358aa33133bd98f92d052325c9c61a2d49 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -210,6 +210,7 @@ static void P_NetArchivePlayers(void) WRITEINT16(save_p, players[i].finishedrings); WRITEUINT32(save_p, players[i].marescore); WRITEUINT32(save_p, players[i].lastmarescore); + WRITEUINT32(save_p, players[i].totalmarescore); WRITEUINT8(save_p, players[i].lastmare); WRITEUINT8(save_p, players[i].lastmarelap); WRITEUINT8(save_p, players[i].lastmarebonuslap); @@ -407,6 +408,7 @@ static void P_NetUnArchivePlayers(void) players[i].finishedrings = READINT16(save_p); players[i].marescore = READUINT32(save_p); players[i].lastmarescore = READUINT32(save_p); + players[i].totalmarescore = READUINT32(save_p); players[i].lastmare = READUINT8(save_p); players[i].lastmarelap = READUINT8(save_p); players[i].lastmarebonuslap = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index ee462193d28d1a75beba2995d59c96512963d0b5..368b95dd592fa184f5e4af730173909a1f63f157 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2389,8 +2389,8 @@ static void P_LevelInitStuff(void) players[i].anotherflyangle = players[i].nightstime =\ players[i].mare = players[i].marelap =\ players[i].marebonuslap = players[i].lapbegunat =\ - players[i].lapstartedtime = players[i].realtime =\ - players[i].exiting = 0; + players[i].lapstartedtime = players[i].totalmarescore =\ + 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 06f42dcadca344bb32f8b6610e9e7015cd2b86ad..9d677b4bc8554af8b8444f3452efb69c62691305 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -733,6 +733,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1); // transfer scores anyway + players[i].totalmarescore += players[i].marescore; players[i].lastmarescore = players[i].marescore; players[i].marescore = 0; @@ -759,6 +760,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1)); // Starting a new mare, transfer scores + player->totalmarescore += players[i].marescore; player->lastmarescore = player->marescore; player->marescore = 0; player->marebegunat = leveltime;