diff --git a/src/d_player.h b/src/d_player.h index cea3d5130..498b7166d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -468,6 +468,8 @@ typedef struct player_s UINT32 marescore; // score for this nights stage UINT32 lastmarescore; // score for the last mare UINT8 lastmare; // previous mare + UINT8 lastmarelap; // previous mare lap + UINT8 lastmarebonuslap; // previous mare bonus lap INT32 maxlink; // maximum link obtained UINT8 texttimer; // nights_texttime should not be local UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 345f4a4d0..7deefa7ff 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -310,6 +310,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->lastmarescore); else if (fastcmp(field,"lastmare")) lua_pushinteger(L, plr->lastmare); + else if (fastcmp(field,"lastmarelap")) + lua_pushinteger(L, plr->lastmarelap); + else if (fastcmp(field,"lastmarebonuslap")) + lua_pushinteger(L, plr->lastmarebonuslap); else if (fastcmp(field,"maxlink")) lua_pushinteger(L, plr->maxlink); else if (fastcmp(field,"texttimer")) @@ -594,6 +598,10 @@ static int player_set(lua_State *L) plr->lastmarescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmare")) plr->lastmare = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarelap")) + plr->lastmarelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarebonuslap")) + plr->lastmarebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"maxlink")) plr->maxlink = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"texttimer")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 729342424..2b48cc783 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -209,6 +209,8 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].marescore); WRITEUINT32(save_p, players[i].lastmarescore); WRITEUINT8(save_p, players[i].lastmare); + WRITEUINT8(save_p, players[i].lastmarelap); + WRITEUINT8(save_p, players[i].lastmarebonuslap); WRITEINT32(save_p, players[i].maxlink); WRITEUINT8(save_p, players[i].texttimer); WRITEUINT8(save_p, players[i].textvar); @@ -400,6 +402,8 @@ static void P_NetUnArchivePlayers(void) players[i].marescore = READUINT32(save_p); players[i].lastmarescore = READUINT32(save_p); players[i].lastmare = READUINT8(save_p); + players[i].lastmarelap = READUINT8(save_p); + players[i].lastmarebonuslap = READUINT8(save_p); players[i].maxlink = READINT32(save_p); players[i].texttimer = READUINT8(save_p); players[i].textvar = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 46f77536d..e4b6034b1 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2381,6 +2381,7 @@ static void P_LevelInitStuff(void) players[i].maxlink = players[i].startedtime =\ players[i].finishedtime = players[i].finishedspheres =\ players[i].finishedrings = players[i].lastmare =\ + players[i].lastmarelap = players[i].lastmarebonuslap =\ players[i].marebegunat = players[i].textvar =\ players[i].texttimer = players[i].linkcount =\ players[i].linktimer = players[i].flyangle =\ diff --git a/src/p_user.c b/src/p_user.c index b7336b545..99ecb8154 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -637,7 +637,7 @@ static void P_DeNightserizePlayer(player_t *player) // NiGHTS Time! void P_NightserizePlayer(player_t *player, INT32 nighttime) { - INT32 oldmare; + UINT8 oldmare, oldmarelap, oldmarebonuslap; // Bots can't be NiGHTSerized, silly!1 :P if (player->bot) @@ -684,6 +684,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) } oldmare = player->mare; + oldmarelap = player->marelap; + oldmarebonuslap = player->marebonuslap; if (!P_TransferToNextMare(player)) { @@ -711,6 +713,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) players[i].texttimer = (3 * TICRATE) - 10; players[i].textvar = 4; // Score and grades players[i].lastmare = players[i].mare; + players[i].lastmarelap = players[i].marelap; + players[i].lastmarebonuslap = players[i].marebonuslap; if (G_IsSpecialStage(gamemap)) { players[i].finishedspheres = (INT16)total_spheres; @@ -742,7 +746,9 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) // Spheres bonus P_AddPlayerScore(player, (player->spheres) * 50); - player->lastmare = (UINT8)oldmare; + player->lastmare = oldmare; + player->lastmarelap = oldmarelap; + player->lastmarebonuslap = oldmarebonuslap; player->texttimer = 4*TICRATE; player->textvar = 4; // Score and grades player->finishedspheres = (INT16)(player->spheres);