Merge nightsplus-laplogic

This commit is contained in:
mazmazz 2018-08-12 21:20:14 -04:00
commit 296d527993
6 changed files with 30 additions and 4 deletions

View File

@ -469,9 +469,12 @@ 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
UINT8 totalmarelap; // total mare lap
UINT8 totalmarebonuslap; // total 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

View File

@ -312,12 +312,18 @@ 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"))
lua_pushinteger(L, plr->lastmarelap);
else if (fastcmp(field,"lastmarebonuslap"))
lua_pushinteger(L, plr->lastmarebonuslap);
else if (fastcmp(field,"totalmarelap"))
lua_pushinteger(L, plr->totalmarelap);
else if (fastcmp(field,"totalmarebonuslap"))
lua_pushinteger(L, plr->totalmarebonuslap);
else if (fastcmp(field,"maxlink"))
lua_pushinteger(L, plr->maxlink);
else if (fastcmp(field,"texttimer"))
@ -604,12 +610,18 @@ 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"))
plr->lastmarelap = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"lastmarebonuslap"))
plr->lastmarebonuslap = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"totalmarelap"))
plr->totalmarelap = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"totalmarebonuslap"))
plr->totalmarebonuslap = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"maxlink"))
plr->maxlink = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"texttimer"))

View File

@ -1114,12 +1114,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
))
{
pl->marelap++;
pl->totalmarelap++;
pl->lapbegunat = leveltime;
pl->lapstartedtime = pl->nightstime;
if (pl->bonustime)
if (pl->bonustime)
{
pl->marebonuslap++;
pl->totalmarebonuslap++;
// Respawn rings and items
P_ReloadRings();

View File

@ -210,9 +210,12 @@ 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);
WRITEUINT8(save_p, players[i].totalmarelap);
WRITEUINT8(save_p, players[i].totalmarebonuslap);
WRITEINT32(save_p, players[i].maxlink);
WRITEUINT8(save_p, players[i].texttimer);
WRITEUINT8(save_p, players[i].textvar);
@ -405,9 +408,12 @@ 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);
players[i].totalmarelap = READUINT8(save_p);
players[i].totalmarebonuslap = READUINT8(save_p);
players[i].maxlink = READINT32(save_p);
players[i].texttimer = READUINT8(save_p);
players[i].textvar = READUINT8(save_p);

View File

@ -2382,14 +2382,15 @@ static void P_LevelInitStuff(void)
players[i].finishedtime = players[i].finishedspheres =\
players[i].finishedrings = players[i].lastmare =\
players[i].lastmarelap = players[i].lastmarebonuslap =\
players[i].totalmarelap = players[i].totalmarebonuslap =\
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].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;

View File

@ -668,7 +668,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
player->followitem = skins[DEFAULTNIGHTSSKIN].followitem;
}
player->nightstime = player->startedtime = player->lapstartedtime = nightstime*TICRATE;
player->nightstime = player->startedtime = player->lapstartedtime = nighttime*TICRATE;
player->bonustime = false;
P_RestoreMusic(player);
@ -735,6 +735,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;
@ -761,6 +762,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 += player->marescore;
player->lastmarescore = player->marescore;
player->marescore = 0;
player->marebegunat = leveltime;