mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-13 06:10:50 +00:00
Merge branch 'nightsplus-laplogic' into nights-score-lap
# Conflicts: # src/p_setup.c
This commit is contained in:
commit
0c0a403bb3
8 changed files with 79 additions and 9 deletions
|
@ -456,17 +456,23 @@ typedef struct player_s
|
|||
boolean bonustime; // Capsule destroyed, now it's bonus time!
|
||||
mobj_t *capsule; // Go inside the capsule
|
||||
UINT8 mare; // Current mare
|
||||
UINT8 marelap; // Current mare lap
|
||||
UINT8 marebonuslap; // Current mare lap starting from bonus time
|
||||
|
||||
// Statistical purposes.
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
|
@ -2230,6 +2230,8 @@ void G_PlayerReborn(INT32 player)
|
|||
if (p->mare == 255)
|
||||
p->mare = 0;
|
||||
|
||||
p->marelap = p->marebonuslap = 0;
|
||||
|
||||
// Check to make sure their color didn't change somehow...
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
|
|
|
@ -290,12 +290,20 @@ static int player_get(lua_State *L)
|
|||
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
|
||||
else if (fastcmp(field,"mare"))
|
||||
lua_pushinteger(L, plr->mare);
|
||||
else if (fastcmp(field,"marelap"))
|
||||
lua_pushinteger(L, plr->marelap);
|
||||
else if (fastcmp(field,"marebonuslap"))
|
||||
lua_pushinteger(L, plr->marebonuslap);
|
||||
else if (fastcmp(field,"marebegunat"))
|
||||
lua_pushinteger(L, plr->marebegunat);
|
||||
else if (fastcmp(field,"startedtime"))
|
||||
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"))
|
||||
|
@ -308,6 +316,10 @@ static int player_get(lua_State *L)
|
|||
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,"maxlink"))
|
||||
lua_pushinteger(L, plr->maxlink);
|
||||
else if (fastcmp(field,"texttimer"))
|
||||
|
@ -572,12 +584,20 @@ static int player_set(lua_State *L)
|
|||
}
|
||||
else if (fastcmp(field,"mare"))
|
||||
plr->mare = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"marelap"))
|
||||
plr->marelap = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"marebonuslap"))
|
||||
plr->marebonuslap = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"marebegunat"))
|
||||
plr->marebegunat = (tic_t)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"startedtime"))
|
||||
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"))
|
||||
|
@ -590,6 +610,10 @@ static int player_set(lua_State *L)
|
|||
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,"maxlink"))
|
||||
plr->maxlink = (INT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"texttimer"))
|
||||
|
|
|
@ -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)
|
||||
|
|
19
src/p_map.c
19
src/p_map.c
|
@ -1097,24 +1097,33 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
P_SetTarget(&thing->target, tmthing);
|
||||
}
|
||||
|
||||
// Respawn rings and items
|
||||
// NiGHTS lap logic
|
||||
if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE)
|
||||
&& (tmthing->player || thing->player))
|
||||
{
|
||||
mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing;
|
||||
player_t *pl = (droneobj == thing) ? tmthing->player : thing->player;
|
||||
|
||||
// Must be in bonus time, and must be NiGHTS, must wait about a second
|
||||
// Must be NiGHTS, must wait about a second
|
||||
// must be flying in the SAME DIRECTION as the last time you came through.
|
||||
// not (your direction) xor (stored direction)
|
||||
// In other words, you can't u-turn and respawn rings near the drone.
|
||||
if (pl->bonustime && (pl->powers[pw_carry] == CR_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && (
|
||||
if ((pl->powers[pw_carry] == CR_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && (
|
||||
!(pl->flyangle > 90 && pl->flyangle < 270)
|
||||
^ (droneobj->extravalue1 > 90 && droneobj->extravalue1 < 270)
|
||||
))
|
||||
{
|
||||
// Reload all the fancy ring stuff!
|
||||
P_ReloadRings();
|
||||
pl->marelap++;
|
||||
pl->lapbegunat = leveltime;
|
||||
pl->lapstartedtime = pl->nightstime;
|
||||
|
||||
if (pl->bonustime)
|
||||
{
|
||||
pl->marebonuslap++;
|
||||
|
||||
// Respawn rings and items
|
||||
P_ReloadRings();
|
||||
}
|
||||
}
|
||||
droneobj->extravalue1 = pl->flyangle;
|
||||
droneobj->extravalue2 = (INT32)leveltime + TICRATE;
|
||||
|
|
|
@ -198,16 +198,22 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT8(save_p, players[i].drilldelay);
|
||||
WRITEUINT8(save_p, players[i].bonustime);
|
||||
WRITEUINT8(save_p, players[i].mare);
|
||||
WRITEUINT8(save_p, players[i].marelap);
|
||||
WRITEUINT8(save_p, players[i].marebonuslap);
|
||||
|
||||
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);
|
||||
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);
|
||||
WRITEINT32(save_p, players[i].maxlink);
|
||||
WRITEUINT8(save_p, players[i].texttimer);
|
||||
WRITEUINT8(save_p, players[i].textvar);
|
||||
|
@ -388,16 +394,22 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].drilldelay = READUINT8(save_p);
|
||||
players[i].bonustime = (boolean)READUINT8(save_p);
|
||||
players[i].mare = READUINT8(save_p);
|
||||
players[i].marelap = READUINT8(save_p);
|
||||
players[i].marebonuslap = READUINT8(save_p);
|
||||
|
||||
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);
|
||||
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].maxlink = READINT32(save_p);
|
||||
players[i].texttimer = READUINT8(save_p);
|
||||
players[i].textvar = READUINT8(save_p);
|
||||
|
|
|
@ -2381,11 +2381,14 @@ 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 =\
|
||||
players[i].anotherflyangle = players[i].nightstime =\
|
||||
players[i].mare = players[i].totalmarescore =\
|
||||
players[i].mare = players[i].marelap =\
|
||||
players[i].marebonuslap = players[i].lapbegunat =\
|
||||
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
|
||||
|
|
18
src/p_user.c
18
src/p_user.c
|
@ -387,6 +387,8 @@ boolean P_TransferToNextMare(player_t *player)
|
|||
CONS_Debug(DBG_NIGHTS, "Mare is %d\n", mare);
|
||||
|
||||
player->mare = mare;
|
||||
player->marelap = 0;
|
||||
player->marebonuslap = 0;
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
|
@ -574,6 +576,8 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
player->climbing = 0;
|
||||
player->mo->fuse = 0;
|
||||
player->speed = 0;
|
||||
player->marelap = 0;
|
||||
player->marebonuslap = 0;
|
||||
P_SetTarget(&player->mo->target, NULL);
|
||||
P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL));
|
||||
|
||||
|
@ -633,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)
|
||||
|
@ -662,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);
|
||||
|
@ -680,6 +684,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
|
||||
oldmare = player->mare;
|
||||
oldmarelap = player->marelap;
|
||||
oldmarebonuslap = player->marebonuslap;
|
||||
|
||||
if (!P_TransferToNextMare(player))
|
||||
{
|
||||
|
@ -707,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;
|
||||
|
@ -739,10 +747,13 @@ 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);
|
||||
player->finishedrings = (INT16)(player->rings);
|
||||
|
||||
// Add score to temp leaderboards
|
||||
if (!(netgame||multiplayer) && P_IsLocalPlayer(player))
|
||||
|
@ -753,6 +764,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue