mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
UCRP_SPEEDOMETER
Provide a percentage between 100 and 999 inclusive. Reach that speed on the speedometer at any point during the race to achieve the condition.
This commit is contained in:
parent
9e1aec4298
commit
35ca8e6191
5 changed files with 41 additions and 2 deletions
|
|
@ -422,6 +422,8 @@ struct roundconditions_t
|
|||
targetdamaging_t targetdamaging;
|
||||
UINT8 gachabom_miser;
|
||||
|
||||
fixed_t maxspeed;
|
||||
|
||||
mobjeflag_t wet_player;
|
||||
|
||||
// 32 triggers, one bit each, for map execution
|
||||
|
|
|
|||
|
|
@ -2949,6 +2949,18 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(params[0], "SPEEDOMETER"))
|
||||
{
|
||||
PARAMCHECK(1);
|
||||
ty = UCRP_SPEEDOMETER;
|
||||
re = get_number(params[1]);
|
||||
|
||||
if (re < 100 || re > 999)
|
||||
{
|
||||
deh_warning("Speed percent %d out of range (100 - 999) for condition ID %d", re, id+1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(params[0], "TRIGGER"))
|
||||
{
|
||||
PARAMCHECK(1);
|
||||
|
|
|
|||
10
src/m_cond.c
10
src/m_cond.c
|
|
@ -1599,6 +1599,9 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
|
|||
case UCRP_RINGSEXACT:
|
||||
return (player->hudrings == cn->requirement);
|
||||
|
||||
case UCRP_SPEEDOMETER:
|
||||
return (player->roundconditions.maxspeed >= cn->requirement);
|
||||
|
||||
case UCRP_TRIGGER: // requires map trigger set
|
||||
return !!(player->roundconditions.unlocktriggers & (1 << cn->requirement));
|
||||
|
||||
|
|
@ -2369,6 +2372,13 @@ static const char *M_GetConditionString(condition_t *cn)
|
|||
case UCRP_RINGSEXACT:
|
||||
return va("with exactly %d Rings", cn->requirement);
|
||||
|
||||
case UCRP_SPEEDOMETER:
|
||||
return va("reach %s%u%% on the speedometer",
|
||||
(cn->requirement == 999)
|
||||
? "" : "at least",
|
||||
cn->requirement
|
||||
);
|
||||
|
||||
case UCRP_TRIGGER:
|
||||
return "do something special";
|
||||
|
||||
|
|
|
|||
|
|
@ -108,8 +108,10 @@ typedef enum
|
|||
UCRP_FINISHTIMEEXACT, // Finish == [time, tics]
|
||||
UCRP_FINISHTIMELEFT, // Finish with at least [time, tics] to spare
|
||||
|
||||
UCRP_RINGS, // Finish >= [rings]
|
||||
UCRP_RINGSEXACT, // Finish == [rings]
|
||||
UCRP_RINGS, // >= [rings]
|
||||
UCRP_RINGSEXACT, // == [rings]
|
||||
|
||||
UCRP_SPEEDOMETER, // >= [percentage]
|
||||
|
||||
UCRP_TRIGGER, // Map execution trigger [id]
|
||||
|
||||
|
|
|
|||
13
src/p_user.c
13
src/p_user.c
|
|
@ -1920,6 +1920,19 @@ static void P_3dMovement(player_t *player)
|
|||
// Calculates player's speed based on distance-of-a-line formula
|
||||
player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
||||
|
||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||
|
||||
if (player->speed > topspeed)
|
||||
{
|
||||
const fixed_t convSpeed = (player->speed * 100) / topspeed;
|
||||
|
||||
if (convSpeed > player->roundconditions.maxspeed)
|
||||
{
|
||||
player->roundconditions.maxspeed = convSpeed;
|
||||
//player->roundconditions.checkthisframe = true; -- no, safe to leave until lapchange at worst
|
||||
}
|
||||
}
|
||||
|
||||
// Monster Iestyn - 04-11-13
|
||||
// Quadrants are stupid, excessive and broken, let's do this a much simpler way!
|
||||
// Get delta angle from rmom angle and player angle first
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue