mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Some quake improvements
- Use easing functions for quake intensity - Camera distance takes Z height into account
This commit is contained in:
parent
d0b16f2025
commit
2230c855ae
1 changed files with 8 additions and 4 deletions
|
|
@ -47,6 +47,7 @@
|
||||||
#include "k_respawn.h"
|
#include "k_respawn.h"
|
||||||
#include "k_terrain.h"
|
#include "k_terrain.h"
|
||||||
#include "acs/interface.h"
|
#include "acs/interface.h"
|
||||||
|
#include "m_easing.h"
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
#include "hardware/hw3sound.h"
|
#include "hardware/hw3sound.h"
|
||||||
|
|
@ -9411,17 +9412,20 @@ void P_DoQuakeOffset(UINT8 view, mappoint_t *viewPos, mappoint_t *offset)
|
||||||
ir = quake->intensity;
|
ir = quake->intensity;
|
||||||
|
|
||||||
// Modulate with time remaining.
|
// Modulate with time remaining.
|
||||||
ir = FixedMul(ir, 2 * FRACUNIT * (quake->time + 1) / quake->startTime);
|
ir = Easing_InOutSine(FRACUNIT * (quake->time + 1) / quake->startTime, ir, 0);
|
||||||
|
|
||||||
// Modulate with distance from epicenter, if it exists.
|
// Modulate with distance from epicenter, if it exists.
|
||||||
if (quake->radius > 0 && quake->epicenter != NULL)
|
if (quake->radius > 0 && quake->epicenter != NULL)
|
||||||
{
|
{
|
||||||
fixed_t epidist = P_AproxDistance(
|
fixed_t epidist = P_AproxDistance(
|
||||||
|
P_AproxDistance(
|
||||||
viewPos->x - quake->epicenter->x,
|
viewPos->x - quake->epicenter->x,
|
||||||
viewPos->y - quake->epicenter->y
|
viewPos->y - quake->epicenter->y
|
||||||
|
),
|
||||||
|
viewPos->z - quake->epicenter->z
|
||||||
);
|
);
|
||||||
|
|
||||||
ir = FixedMul(ir, FixedDiv(max(0, quake->radius - epidist), quake->radius));
|
ir = Easing_InOutSine(min(FRACUNIT, FixedDiv(epidist, quake->radius)), ir, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
addZ += ir;
|
addZ += ir;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue