mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-21 03:11:24 +00:00
Race lap linedef executor
Set up similar to NiGHTS Mare linedef executors. Give a sector the "Race Lap" sector type, tag it, then set the frontside x-offset on the trigger line to the lap it should activate on minus 1. There are a few flags you can check on the trigger line to modify its behavior. - Normally the executor will only trigger if its exactly on the lap specified. Check Not Climbable to make it execute on laps equal to or greater than, or check Block Enemies to make it execute on laps equal to or less than. - By default, the executor will check current lap with the person in last's lap. Check E4 to instead find the current lap from the player who triggered it. This flag is better for triggering events ahead of the players, while the default effect is better for triggering events behind the players.
This commit is contained in:
parent
f9db3620f4
commit
15f0e16344
4 changed files with 62 additions and 20 deletions
|
@ -3438,7 +3438,7 @@ void K_CheckBalloons(void)
|
|||
if (playeringame[winnernum])
|
||||
{
|
||||
P_AddPlayerScore(&players[winnernum], 1);
|
||||
CONS_Printf(M_GetText("%s recieved a point for winning!\n"));
|
||||
CONS_Printf(M_GetText("%s recieved a point for winning!\n"), player_names[winnernum]);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
|
|
@ -182,6 +182,7 @@ void P_DoJump(player_t *player, boolean soundandstate);
|
|||
boolean P_AnalogMove(player_t *player);
|
||||
boolean P_TransferToNextMare(player_t *player);
|
||||
UINT8 P_FindLowestMare(void);
|
||||
UINT8 P_FindLowestLap(void);
|
||||
void P_FindEmerald(void);
|
||||
void P_TransferToAxis(player_t *player, INT32 axisnum);
|
||||
boolean P_PlayerMoving(INT32 pnum);
|
||||
|
|
42
src/p_spec.c
42
src/p_spec.c
|
@ -1701,28 +1701,38 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
if (!(ALL7EMERALDS(emeralds)))
|
||||
return false;
|
||||
}
|
||||
else if (GETSECSPECIAL(caller->special, 2) == 7)
|
||||
else if (GETSECSPECIAL(caller->special, 2) == 7) // SRB2Kart: reusing for Race Lap executor
|
||||
{
|
||||
UINT8 mare;
|
||||
UINT8 lap;
|
||||
|
||||
if (!(maptol & TOL_NIGHTS))
|
||||
return false;
|
||||
|
||||
mare = P_FindLowestMare();
|
||||
|
||||
if (triggerline->flags & ML_NOCLIMB)
|
||||
if (actor && actor->player && triggerline->flags & ML_EFFECT4)
|
||||
{
|
||||
if (!(mare <= dist))
|
||||
return false;
|
||||
}
|
||||
else if (triggerline->flags & ML_BLOCKMONSTERS)
|
||||
{
|
||||
if (!(mare >= dist))
|
||||
return false;
|
||||
if (maptol & TOL_NIGHTS)
|
||||
lap = actor->player->mare;
|
||||
else
|
||||
lap = actor->player->laps;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(mare == dist))
|
||||
if (maptol & TOL_NIGHTS)
|
||||
lap = P_FindLowestMare();
|
||||
else
|
||||
lap = P_FindLowestLap();
|
||||
}
|
||||
|
||||
if (triggerline->flags & ML_NOCLIMB) // Need higher than or equal to
|
||||
{
|
||||
if (lap < (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
return false;
|
||||
}
|
||||
else if (triggerline->flags & ML_BLOCKMONSTERS) // Need lower than or equal to
|
||||
{
|
||||
if (lap > (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
return false;
|
||||
}
|
||||
else // Need equal to
|
||||
{
|
||||
if (lap != (sides[triggerline->sidenum[0]].textureoffset >> FRACBITS))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
37
src/p_user.c
37
src/p_user.c
|
@ -377,6 +377,35 @@ UINT8 P_FindLowestMare(void)
|
|||
return mare;
|
||||
}
|
||||
|
||||
//
|
||||
// P_FindLowestLap
|
||||
//
|
||||
// SRB2Kart, a similar function as above for finding the lowest lap
|
||||
//
|
||||
UINT8 P_FindLowestLap(void)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 lowest = UINT8_MAX;
|
||||
|
||||
if (!G_RaceGametype())
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (lowest == 255)
|
||||
lowest = players[i].laps;
|
||||
else if (players[i].laps < lowest)
|
||||
lowest = players[i].laps;
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "Lowest laps found: %d\n", lowest);
|
||||
|
||||
return lowest;
|
||||
}
|
||||
|
||||
//
|
||||
// P_TransferToNextMare
|
||||
//
|
||||
|
@ -8826,12 +8855,14 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
thiscam->momx = FixedMul(x - thiscam->x, camspeed);
|
||||
thiscam->momy = FixedMul(y - thiscam->y, camspeed);
|
||||
|
||||
if (GETSECSPECIAL(thiscam->subsector->sector->special, 1) == 6
|
||||
if ((GETSECSPECIAL(thiscam->subsector->sector->special, 1) == 6
|
||||
&& thiscam->z < thiscam->subsector->sector->floorheight + 256*FRACUNIT
|
||||
&& FixedMul(z - thiscam->z, camspeed) < 0)
|
||||
{
|
||||
#if 0
|
||||
|| player->kartstuff[k_feather] & 2 // SRB2Kart: don't follow while bouncing, experimental
|
||||
#endif
|
||||
)
|
||||
thiscam->momz = 0; // Don't go down a death pit
|
||||
}
|
||||
else
|
||||
thiscam->momz = FixedMul(z - thiscam->z, camspeed);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue