mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-10 23:56:19 +00:00
Follower angle lag + lookback
- ANGLELAG lets you set how fast the followers swivel around. Default is 8*FRACUNIT, old behavior can be returned with FRACUNIT. - Followers reverse their angle when you hold the lookback button. - All lag values can't go below FRACUNIT instead of 1.
This commit is contained in:
parent
b5334e6b42
commit
cda0441abb
3 changed files with 33 additions and 3 deletions
|
|
@ -3827,6 +3827,7 @@ void readfollower(MYFILE *f)
|
|||
followers[numfollowers].zoffs = 32*FRACUNIT;
|
||||
followers[numfollowers].horzlag = 2*FRACUNIT;
|
||||
followers[numfollowers].vertlag = 6*FRACUNIT;
|
||||
followers[numfollowers].anglelag = 8*FRACUNIT;
|
||||
followers[numfollowers].bobspeed = TICRATE*2;
|
||||
followers[numfollowers].bobamp = 4*FRACUNIT;
|
||||
followers[numfollowers].hitconfirmtime = TICRATE;
|
||||
|
|
@ -3888,6 +3889,10 @@ void readfollower(MYFILE *f)
|
|||
{
|
||||
followers[numfollowers].vertlag = (fixed_t)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ANGLELAG"))
|
||||
{
|
||||
followers[numfollowers].vertlag = (fixed_t)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BOBSPEED"))
|
||||
{
|
||||
followers[numfollowers].bobspeed = (tic_t)get_number(word2);
|
||||
|
|
@ -4002,8 +4007,9 @@ if ((signed)followers[numfollowers].field < threshold) \
|
|||
FALLBACK(dist, "DIST", 0, 0);
|
||||
FALLBACK(height, "HEIGHT", 1, 1);
|
||||
FALLBACK(zoffs, "ZOFFS", 0, 0);
|
||||
FALLBACK(horzlag, "HORZLAG", 1, 1);
|
||||
FALLBACK(vertlag, "VERTLAG", 1, 1);
|
||||
FALLBACK(horzlag, "HORZLAG", FRACUNIT, FRACUNIT);
|
||||
FALLBACK(vertlag, "VERTLAG", FRACUNIT, FRACUNIT);
|
||||
FALLBACK(anglelag, "ANGLELAG", FRACUNIT, FRACUNIT);
|
||||
FALLBACK(bobamp, "BOBAMP", 0, 0);
|
||||
FALLBACK(bobspeed, "BOBSPEED", 0, 0);
|
||||
FALLBACK(hitconfirmtime, "HITCONFIRMTIME", 1, 1);
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ void K_HandleFollower(player_t *player)
|
|||
fixed_t bubble; // bubble scale (0 if no bubble)
|
||||
mobj_t *bmobj; // temp bubble mobj
|
||||
|
||||
angle_t destAngle, angleDiff;
|
||||
|
||||
if (player->followerready == false)
|
||||
{
|
||||
// we aren't ready to perform anything follower related yet.
|
||||
|
|
@ -346,7 +348,27 @@ void K_HandleFollower(player_t *player)
|
|||
}
|
||||
|
||||
// if we're moving let's make the angle the direction we're moving towards. This is to avoid drifting / reverse looking awkward.
|
||||
player->follower->angle = K_MomentumAngle(player->follower);
|
||||
destAngle = K_MomentumAngle(player->follower);
|
||||
|
||||
// Sal: Turn the follower around when looking backwards.
|
||||
if ( player->cmd.buttons & BT_LOOKBACK )
|
||||
{
|
||||
destAngle += ANGLE_180;
|
||||
}
|
||||
|
||||
// Sal: Smoothly rotate angle to the destination value.
|
||||
angleDiff = destAngle - player->follower->angle;
|
||||
|
||||
if (angleDiff > ANGLE_180)
|
||||
{
|
||||
angleDiff = InvAngle(FixedDiv(InvAngle(angleDiff), fl.anglelag));
|
||||
}
|
||||
else
|
||||
{
|
||||
angleDiff = FixedDiv(angleDiff, fl.anglelag);
|
||||
}
|
||||
|
||||
player->follower->angle += angleDiff;
|
||||
|
||||
// Finally, if the follower has bubbles, move them, set their scale, etc....
|
||||
// This is what I meant earlier by it being easier, now we can just use this weird lil loop to get the job done!
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ typedef struct follower_s
|
|||
|
||||
fixed_t horzlag; // Lag for X/Y displacement. Default is 2. Must be > 0 because we divide by this number.
|
||||
fixed_t vertlag; // Z displacement lag. Default is 6. Must be > 0 because we divide by this number.
|
||||
fixed_t anglelag; // Angle rotation lag. Default is 8. Must be > 0 because we divide by this number.
|
||||
|
||||
fixed_t bobamp; // Bob amplitude. Default is 4.
|
||||
tic_t bobspeed; // Arbitrary modifier for bobbing speed. Default is TICRATE*2 (70)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue