mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add G_FixCamera, reset camera, angle and view interpolation
This commit is contained in:
parent
f2cc5ce36a
commit
d020c9faaa
3 changed files with 26 additions and 26 deletions
33
src/g_game.c
33
src/g_game.c
|
|
@ -1580,7 +1580,6 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
|||
UINT8 viewd;
|
||||
|
||||
INT32 *displayplayerp;
|
||||
camera_t *camerap;
|
||||
|
||||
INT32 olddisplayplayer;
|
||||
INT32 playersviewable;
|
||||
|
|
@ -1631,22 +1630,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
|||
(*displayplayerp) = playernum;
|
||||
if ((*displayplayerp) != olddisplayplayer)
|
||||
{
|
||||
camerap = &camera[viewnum-1];
|
||||
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
||||
|
||||
R_ResetViewInterpolation(viewnum);
|
||||
G_FixCamera(viewnum);
|
||||
}
|
||||
|
||||
if (viewnum > splits)
|
||||
{
|
||||
for (viewd = splits+1; viewd < viewnum; ++viewd)
|
||||
{
|
||||
displayplayerp = (&displayplayers[viewd-1]);
|
||||
camerap = &camera[viewd];
|
||||
|
||||
(*displayplayerp) = G_FindView(0, viewd, onlyactive, false);
|
||||
|
||||
P_ResetCamera(&players[(*displayplayerp)], camerap);
|
||||
G_FixCamera(viewd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1708,6 +1699,26 @@ void G_ResetViews(void)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_FixCamera
|
||||
// Reset camera position, angle and interpolation on a view
|
||||
// after changing state.
|
||||
//
|
||||
void G_FixCamera(UINT8 view)
|
||||
{
|
||||
player_t *player = &players[displayplayers[view - 1]];
|
||||
|
||||
// The order of displayplayers can change, which would
|
||||
// invalidate localangle.
|
||||
localangle[view - 1] = player->angleturn;
|
||||
|
||||
P_ResetCamera(player, &camera[view - 1]);
|
||||
|
||||
// Make sure the viewport doesn't interpolate at all into
|
||||
// its new position -- just snap instantly into place.
|
||||
R_ResetViewInterpolation(view);
|
||||
}
|
||||
|
||||
//
|
||||
// G_Ticker
|
||||
// Make ticcmd_ts for the players.
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ INT32 G_CountPlayersPotentiallyViewable(boolean active);
|
|||
void G_ResetViews(void);
|
||||
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
|
||||
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
|
||||
void G_FixCamera(UINT8 viewnum);
|
||||
|
||||
void G_AddPlayer(INT32 playernum);
|
||||
void G_SpectatePlayerOnJoin(INT32 playernum);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "d_clisrv.h" // playerconsole
|
||||
#include "doomdef.h" // MAXPLAYERS
|
||||
#include "doomstat.h" // consoleplayer
|
||||
#include "g_game.h" // localangle
|
||||
#include "g_game.h" // G_FixCamera
|
||||
#include "g_party.h"
|
||||
#include "g_state.h"
|
||||
#include "p_local.h"
|
||||
|
|
@ -136,20 +136,8 @@ public:
|
|||
|
||||
for (std::size_t i = 0; i < size(); ++i)
|
||||
{
|
||||
const playernum_t player = at(i);
|
||||
|
||||
displayplayers[i] = player;
|
||||
|
||||
// The order of displayplayers can change, which
|
||||
// would make localangle invalid now.
|
||||
localangle[i] = players[player].angleturn;
|
||||
|
||||
P_ResetCamera(&players[player], &camera[i]);
|
||||
|
||||
// Make sure the viewport doesn't interpolate at
|
||||
// all into its new position -- just snap
|
||||
// instantly into place.
|
||||
R_ResetViewInterpolation(1 + i);
|
||||
displayplayers[i] = at(i);
|
||||
G_FixCamera(1 + i);
|
||||
}
|
||||
|
||||
r_splitscreen = size() - 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue