Add player_t marelap and marebonuslap, with logic
This commit is contained in:
parent
01f1e7fc33
commit
637a4a8446
|
@ -455,6 +455,8 @@ typedef struct player_s
|
||||||
boolean bonustime; // Capsule destroyed, now it's bonus time!
|
boolean bonustime; // Capsule destroyed, now it's bonus time!
|
||||||
mobj_t *capsule; // Go inside the capsule
|
mobj_t *capsule; // Go inside the capsule
|
||||||
UINT8 mare; // Current mare
|
UINT8 mare; // Current mare
|
||||||
|
UINT8 marelap; // Current mare lap
|
||||||
|
UINT8 marebonuslap; // Current mare lap starting from bonus time
|
||||||
|
|
||||||
// Statistical purposes.
|
// Statistical purposes.
|
||||||
tic_t marebegunat; // Leveltime when mare begun
|
tic_t marebegunat; // Leveltime when mare begun
|
||||||
|
|
|
@ -288,6 +288,10 @@ static int player_get(lua_State *L)
|
||||||
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
|
LUA_PushUserdata(L, plr->capsule, META_MOBJ);
|
||||||
else if (fastcmp(field,"mare"))
|
else if (fastcmp(field,"mare"))
|
||||||
lua_pushinteger(L, plr->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"))
|
else if (fastcmp(field,"marebegunat"))
|
||||||
lua_pushinteger(L, plr->marebegunat);
|
lua_pushinteger(L, plr->marebegunat);
|
||||||
else if (fastcmp(field,"startedtime"))
|
else if (fastcmp(field,"startedtime"))
|
||||||
|
@ -564,6 +568,10 @@ static int player_set(lua_State *L)
|
||||||
}
|
}
|
||||||
else if (fastcmp(field,"mare"))
|
else if (fastcmp(field,"mare"))
|
||||||
plr->mare = (UINT8)luaL_checkinteger(L, 3);
|
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"))
|
else if (fastcmp(field,"marebegunat"))
|
||||||
plr->marebegunat = (tic_t)luaL_checkinteger(L, 3);
|
plr->marebegunat = (tic_t)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"startedtime"))
|
else if (fastcmp(field,"startedtime"))
|
||||||
|
|
15
src/p_map.c
15
src/p_map.c
|
@ -905,25 +905,32 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
P_SetTarget(&thing->target, tmthing);
|
P_SetTarget(&thing->target, tmthing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Respawn rings and items
|
// NiGHTS lap logic
|
||||||
if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE)
|
if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE)
|
||||||
&& (tmthing->player || thing->player))
|
&& (tmthing->player || thing->player))
|
||||||
{
|
{
|
||||||
mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing;
|
mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing;
|
||||||
player_t *pl = (droneobj == thing) ? tmthing->player : thing->player;
|
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.
|
// must be flying in the SAME DIRECTION as the last time you came through.
|
||||||
// not (your direction) xor (stored direction)
|
// not (your direction) xor (stored direction)
|
||||||
// In other words, you can't u-turn and respawn rings near the drone.
|
// 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->anotherflyangle >= 90 && pl->anotherflyangle <= 270)
|
!(pl->anotherflyangle >= 90 && pl->anotherflyangle <= 270)
|
||||||
^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270)
|
^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
// Reload all the fancy ring stuff!
|
pl->marelap++;
|
||||||
|
|
||||||
|
if (pl->bonustime)
|
||||||
|
{
|
||||||
|
pl->marebonuslap++;
|
||||||
|
|
||||||
|
// Respawn rings and items
|
||||||
P_ReloadRings();
|
P_ReloadRings();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
droneobj->extravalue1 = pl->anotherflyangle;
|
droneobj->extravalue1 = pl->anotherflyangle;
|
||||||
droneobj->extravalue2 = (INT32)leveltime + TICRATE;
|
droneobj->extravalue2 = (INT32)leveltime + TICRATE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,8 @@ static void P_NetArchivePlayers(void)
|
||||||
WRITEUINT8(save_p, players[i].drilldelay);
|
WRITEUINT8(save_p, players[i].drilldelay);
|
||||||
WRITEUINT8(save_p, players[i].bonustime);
|
WRITEUINT8(save_p, players[i].bonustime);
|
||||||
WRITEUINT8(save_p, players[i].mare);
|
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].marebegunat);
|
||||||
WRITEUINT32(save_p, players[i].startedtime);
|
WRITEUINT32(save_p, players[i].startedtime);
|
||||||
|
@ -384,6 +386,8 @@ static void P_NetUnArchivePlayers(void)
|
||||||
players[i].drilldelay = READUINT8(save_p);
|
players[i].drilldelay = READUINT8(save_p);
|
||||||
players[i].bonustime = (boolean)READUINT8(save_p);
|
players[i].bonustime = (boolean)READUINT8(save_p);
|
||||||
players[i].mare = 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].marebegunat = READUINT32(save_p);
|
||||||
players[i].startedtime = READUINT32(save_p);
|
players[i].startedtime = READUINT32(save_p);
|
||||||
|
|
|
@ -2350,6 +2350,7 @@ static void P_LevelInitStuff(void)
|
||||||
players[i].linkcount = players[i].linktimer = 0;
|
players[i].linkcount = players[i].linktimer = 0;
|
||||||
players[i].flyangle = players[i].anotherflyangle = 0;
|
players[i].flyangle = players[i].anotherflyangle = 0;
|
||||||
players[i].nightstime = players[i].mare = 0;
|
players[i].nightstime = players[i].mare = 0;
|
||||||
|
players[i].marelap = 0; players[i].marebonuslap = 0;
|
||||||
P_SetTarget(&players[i].capsule, NULL);
|
P_SetTarget(&players[i].capsule, NULL);
|
||||||
players[i].drillmeter = 40*20;
|
players[i].drillmeter = 40*20;
|
||||||
|
|
||||||
|
|
|
@ -399,6 +399,8 @@ boolean P_TransferToNextMare(player_t *player)
|
||||||
CONS_Debug(DBG_NIGHTS, "Mare is %d\n", mare);
|
CONS_Debug(DBG_NIGHTS, "Mare is %d\n", mare);
|
||||||
|
|
||||||
player->mare = mare;
|
player->mare = mare;
|
||||||
|
player->marelap = 0;
|
||||||
|
player->marebonuslap = 0;
|
||||||
|
|
||||||
// scan the thinkers
|
// scan the thinkers
|
||||||
// to find the closest axis point
|
// to find the closest axis point
|
||||||
|
|
Loading…
Reference in a new issue