mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 04:02:37 +00:00
Merge branch 'whip-sprzoff' into 'master'
Instawhip hop adjust sprite offset instead of physical Z position + flashing nitpick Closes #601 See merge request KartKrew/Kart!1406
This commit is contained in:
commit
7cdf8fbfdd
6 changed files with 33 additions and 7 deletions
|
|
@ -504,6 +504,7 @@ struct player_t
|
|||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
fixed_t cameraOffset;
|
||||
|
||||
skybox_t skybox;
|
||||
|
||||
|
|
|
|||
27
src/k_kart.c
27
src/k_kart.c
|
|
@ -7794,6 +7794,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->mo->spritexoffset = 0;
|
||||
player->mo->spriteyoffset = 0;
|
||||
|
||||
player->cameraOffset = 0;
|
||||
|
||||
if (player->curshield == KSHIELD_TOP)
|
||||
{
|
||||
mobj_t *top = K_GetGardenTop(player);
|
||||
|
|
@ -7814,6 +7816,21 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(player->whip) && (player->whip->flags2 & MF2_AMBUSH))
|
||||
{
|
||||
// Linear acceleration and deceleration to a peak.
|
||||
// There is a constant total time to complete but the
|
||||
// acceleration and deceleration times can be made
|
||||
// asymmetrical.
|
||||
const fixed_t hop = 24 * mapobjectscale;
|
||||
const INT32 duration = 12;
|
||||
const INT32 mid = (duration / 2) - 1;
|
||||
const INT32 t = (duration - mid) - player->whip->fuse;
|
||||
|
||||
player->cameraOffset = hop - (abs(t * hop) / (t < 0 ? mid : duration - mid));
|
||||
player->mo->sprzoff += player->cameraOffset;
|
||||
}
|
||||
|
||||
K_UpdateOffroad(player);
|
||||
K_UpdateDraft(player);
|
||||
K_UpdateEngineSounds(player); // Thanks, VAda!
|
||||
|
|
@ -10943,9 +10960,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
P_SetTarget(&whip->target, player->mo);
|
||||
K_MatchGenericExtraFlags(whip, player->mo);
|
||||
P_SpawnFakeShadow(whip, 20);
|
||||
whip->fuse = 12; // Changing instawhip animation duration? Look here
|
||||
player->flashing = max(player->flashing, 12);
|
||||
player->mo->momz += 4*mapobjectscale;
|
||||
whip->fuse = INSTAWHIP_DURATION;
|
||||
player->flashing = max(player->flashing, INSTAWHIP_DURATION);
|
||||
|
||||
if (P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
whip->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
if (!K_PowerUpRemaining(player, POWERUP_BADGE))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ Make sure this matches the actual number of states
|
|||
#define GROW_PHYSICS_SCALE (3*FRACUNIT/2)
|
||||
#define SHRINK_PHYSICS_SCALE (3*FRACUNIT/4)
|
||||
|
||||
#define INSTAWHIP_DURATION (12)
|
||||
#define INSTAWHIP_COOLDOWN (TICRATE*2)
|
||||
#define INSTAWHIP_STARTOFRACE (255)
|
||||
#define INSTAWHIP_STARTOFBATTLE (1)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ void Obj_InstaWhipThink (mobj_t *whip)
|
|||
// Visuals
|
||||
whip->renderflags |= RF_NOSPLATBILLBOARD|RF_FULLBRIGHT;
|
||||
|
||||
if (whip->renderflags & RF_DONTDRAW)
|
||||
// This is opposite of player flashing tics
|
||||
if (leveltime & 1)
|
||||
whip->renderflags &= ~RF_DONTDRAW;
|
||||
else
|
||||
whip->renderflags |= RF_DONTDRAW;
|
||||
|
|
|
|||
|
|
@ -3427,6 +3427,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
z = mo->z + pviewheight + distz;
|
||||
}
|
||||
|
||||
z += player->cameraOffset;
|
||||
|
||||
// point viewed by the camera
|
||||
// this point is just 64 unit forward the player
|
||||
dist = 64*cameraScale;
|
||||
|
|
@ -3471,13 +3473,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - player->mo->height);
|
||||
angle = R_PointToAngle2(0, thiscam->z + thiscam->height, dist, mo->z + mo->height - player->mo->height + player->cameraOffset);
|
||||
if (thiscam->pitch < ANGLE_180 && thiscam->pitch > angle)
|
||||
angle += (thiscam->pitch - angle)/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + player->mo->height);
|
||||
angle = R_PointToAngle2(0, thiscam->z, dist, mo->z + player->mo->height + player->cameraOffset);
|
||||
if (thiscam->pitch >= ANGLE_180 && thiscam->pitch < angle)
|
||||
angle -= (angle - thiscam->pitch)/2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ INT32 R_ThingLightLevel(mobj_t* thing)
|
|||
|
||||
if (player)
|
||||
{
|
||||
if (player->instaShieldCooldown && (player->rings <= 0) && (leveltime & 1))
|
||||
if (player->instaShieldCooldown && !player->whip && (player->rings <= 0) && (leveltime & 1))
|
||||
{
|
||||
// Darken on every other frame of instawhip cooldown
|
||||
lightlevel -= 128;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue