diff --git a/src/d_player.h b/src/d_player.h index 498b7166d..648867b92 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -463,6 +463,8 @@ typedef struct player_s tic_t marebegunat; // Leveltime when mare begun tic_t startedtime; // Time which you started this mare with. tic_t finishedtime; // Time it took you to finish the mare (used for display) + tic_t lapbegunat; // Leveltime when lap begun + tic_t lapstartedtime; // Time which you started this lap with. 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 diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 7deefa7ff..114aa27b0 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -300,6 +300,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->startedtime); else if (fastcmp(field,"finishedtime")) lua_pushinteger(L, plr->finishedtime); + else if (fastcmp(field,"lapbegunat")) + lua_pushinteger(L, plr->lapbegunat); + else if (fastcmp(field,"lapstartedtime")) + lua_pushinteger(L, plr->lapstartedtime); else if (fastcmp(field,"finishedspheres")) lua_pushinteger(L, plr->finishedspheres); else if (fastcmp(field,"finishedrings")) @@ -588,6 +592,10 @@ static int player_set(lua_State *L) plr->startedtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedtime")) plr->finishedtime = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapbegunat")) + plr->lapbegunat = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapstartedtime")) + plr->lapstartedtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedspheres")) plr->finishedspheres = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedrings")) diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..e7590439e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1134,6 +1134,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player->nightstime += special->info->speed; player->startedtime += special->info->speed; + player->lapstartedtime += special->info->speed; P_RestoreMusic(player); } else @@ -1143,6 +1144,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { players[i].nightstime += special->info->speed; players[i].startedtime += special->info->speed; + players[i].lapstartedtime += special->info->speed; P_RestoreMusic(&players[i]); } if (special->info->deathsound != sfx_None) diff --git a/src/p_map.c b/src/p_map.c index 415e2bac1..7d3538573 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1114,6 +1114,8 @@ static boolean PIT_CheckThing(mobj_t *thing) )) { pl->marelap++; + pl->lapbegunat = leveltime; + pl->lapstartedtime = pl->nightstime; if (pl->bonustime) { diff --git a/src/p_saveg.c b/src/p_saveg.c index 2b48cc783..e18802f57 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -204,6 +204,8 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].marebegunat); WRITEUINT32(save_p, players[i].startedtime); WRITEUINT32(save_p, players[i].finishedtime); + WRITEUINT32(save_p, players[i].lapbegunat); + WRITEUINT32(save_p, players[i].lapstartedtime); WRITEINT16(save_p, players[i].finishedspheres); WRITEINT16(save_p, players[i].finishedrings); WRITEUINT32(save_p, players[i].marescore); @@ -397,6 +399,8 @@ static void P_NetUnArchivePlayers(void) players[i].marebegunat = READUINT32(save_p); players[i].startedtime = READUINT32(save_p); players[i].finishedtime = READUINT32(save_p); + players[i].lapbegunat = READUINT32(save_p); + players[i].lapstartedtime = READUINT32(save_p); players[i].finishedspheres = READINT16(save_p); players[i].finishedrings = READINT16(save_p); players[i].marescore = READUINT32(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index e4b6034b1..4b10f431c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2387,7 +2387,8 @@ static void P_LevelInitStuff(void) players[i].linktimer = players[i].flyangle =\ players[i].anotherflyangle = players[i].nightstime =\ players[i].mare = players[i].marelap =\ - players[i].marebonuslap = players[i].realtime =\ + players[i].marebonuslap = players[i].lapbegunat =\ + players[i].lapstartedtime = players[i].realtime =\ players[i].exiting = 0; // i guess this could be part of the above but i feel mildly uncomfortable implicitly casting diff --git a/src/p_user.c b/src/p_user.c index 99ecb8154..06f42dcad 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -666,7 +666,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->followitem = skins[DEFAULTNIGHTSSKIN].followitem; } - player->nightstime = player->startedtime = nighttime*TICRATE; + player->nightstime = player->startedtime = player->lapstartedtime = nighttime*TICRATE; player->bonustime = false; P_RestoreMusic(player); @@ -762,6 +762,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->lastmarescore = player->marescore; player->marescore = 0; player->marebegunat = leveltime; + player->lapbegunat = leveltime; player->spheres = player->rings = 0; }