Skip to content

Commit

Permalink
Chasecam speed effect interpolation, and more
Browse files Browse the repository at this point in the history
Also added a `break` to a loop in the FOV changing code, and fixed the explosion shake effect being stopped by the menu even if the game isn't actually paused (i.e. during demo playback or net play).

Additionally, some reformatting.
  • Loading branch information
MrAlaux committed Nov 29, 2023
1 parent 6db6f50 commit 5aee869
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Disabled Armor icon by default.
- **Speed of non-Melt wipes is now independent of resolution**
- **Implemented Teleporter Zoom for multiplayer respawning**
- **Applied interpolation for Chasecam speed effect**
- **MDK Fist attacks now prioritize enemies over friends**
- **Current resolution is now reported by some video-related menu items**
- **Disabled `input_spy` and `input_menu_reloadlevel` when typing in Chat**
Expand All @@ -42,5 +43,6 @@
- **Excess speed when airborne with noclip enabled** [thanks @kitchen-ace]
- **Blazing door sound fix not applying to Boom doors**
- **Teleporter Zoom and BFG "explosion" shake affecting all players in multiplayer**
- **Explosion shake being stopped by the menu during demo playback and netgames**
- **Fixed a demo desync** caused by a failed weapon autoswitch when picking up ammo
- **Tweaked dark menu background and Automap overlay algorithm** (fixes very low values)
31 changes: 22 additions & 9 deletions src/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,11 @@ void R_ExecuteSetViewSize (void)
if (fovfx[FOVFX_ZOOM].target != zoomtarget)
{ fovchange = true; }
else for (i = 0; i < NUMFOVFX; i++)
if (fovfx[i].target || fovfx[i].current) { fovchange = true; }
if (fovfx[i].target || fovfx[i].current)
{
fovchange = true;
break;
}
}

if (fovchange)
Expand All @@ -639,6 +643,7 @@ void R_ExecuteSetViewSize (void)
fovchange = false;

fovfx[FOVFX_ZOOM].old = fovfx[FOVFX_ZOOM].current = fovfx[FOVFX_ZOOM].target;

if (zoomtarget || fovfx[FOVFX_ZOOM].target)
{
// Special handling for zoom
Expand All @@ -650,13 +655,16 @@ void R_ExecuteSetViewSize (void)

if ( (sign > 0 && fovfx[FOVFX_ZOOM].target > zoomtarget)
|| (sign < 0 && fovfx[FOVFX_ZOOM].target < zoomtarget))
{ fovfx[FOVFX_ZOOM].target = zoomtarget; }
{
fovfx[FOVFX_ZOOM].target = zoomtarget;
}

if (fovfx[FOVFX_ZOOM].current != fovfx[FOVFX_ZOOM].target)
{ fovchange = true; }
}

fovfx[FOVFX_TELEPORT].old = fovfx[FOVFX_TELEPORT].current = fovfx[FOVFX_TELEPORT].target;

if (fovfx[FOVFX_TELEPORT].target)
{
if ((fovfx[FOVFX_TELEPORT].target -= 5) < 0)
Expand Down Expand Up @@ -884,7 +892,7 @@ void R_SetupFrame (player_t *player)
{
static fixed_t xofs=0, yofs=0, zofs=0;

if (!(menuactive || paused))
if (!((menuactive && !demoplayback && !netgame) || paused))
{
static int oldtime = -1;

Expand All @@ -909,7 +917,7 @@ void R_SetupFrame (player_t *player)
chasecam_on = STRICTMODE(chasecam_mode || (death_camera && player->mo->health <= 0 && player->playerstate == PST_DEAD));
if (chasecam_on)
{
static fixed_t extradist = 0;
static fixed_t oldextradist = 0, extradist = 0;
const fixed_t z = MIN(playerz + ((player->mo->health <= 0 && player->playerstate == PST_DEAD) ? 6*FRACUNIT : chasecamheight),
player->mo->ceilingz - (2*FRACUNIT));
fixed_t slope;
Expand All @@ -924,19 +932,24 @@ void R_SetupFrame (player_t *player)
pitch = -pitch;
}

dist += extradist;

{ // `extradist` is applied on the next tic
{
static int oldtic = -1;

if (gametic != oldtic) {
if (oldtic != gametic) {
oldextradist = extradist;
extradist = FixedMul(player->mo->momx, finecosine[viewangle >> ANGLETOFINESHIFT])
+ FixedMul(player->mo->momy, finesine[viewangle >> ANGLETOFINESHIFT]);
}

oldtic = gametic;
}

if (uncapped && leveltime > 1 && player->mo->interp == true && leveltime > oldleveltime)
{
dist += oldextradist + FixedMul(extradist - oldextradist, fractionaltic);
}
else { dist += extradist; }

P_PositionChasecam(z, dist, slope = (-(lookdir * FRACUNIT) / PLAYER_SLOPE_DENOM));

if (chasecam.hit) {
Expand Down

0 comments on commit 5aee869

Please sign in to comment.