Add lapbegunat and lapstartedtime player variables

There is no lapfinishedtime because [mare]finishedtime refers to when Egg Capsule is destroyed. That concept does not apply to laps.
This commit is contained in:
mazmazz 2018-08-10 17:12:26 -04:00
parent 18b5b70822
commit 4e02171c23
7 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -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"))

View File

@ -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)

View File

@ -1114,6 +1114,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
))
{
pl->marelap++;
pl->lapbegunat = leveltime;
pl->lapstartedtime = pl->nightstime;
if (pl->bonustime)
{

View File

@ -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);

View File

@ -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

View File

@ -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;
}