mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- deal with portals in P_AimCamera.
This will most likely need some more testing and refining but at least it should work through line portals now.
This commit is contained in:
parent
a0b2915b8f
commit
90553bb61c
3 changed files with 18 additions and 3 deletions
|
@ -351,7 +351,7 @@ bool P_CheckMissileSpawn (AActor *missile, fixed_t maxdist);
|
||||||
void P_PlaySpawnSound(AActor *missile, AActor *spawner);
|
void P_PlaySpawnSound(AActor *missile, AActor *spawner);
|
||||||
|
|
||||||
// [RH] Position the chasecam
|
// [RH] Position the chasecam
|
||||||
void P_AimCamera (AActor *t1, fixed_t &x, fixed_t &y, fixed_t &z, sector_t *&sec);
|
void P_AimCamera (AActor *t1, fixed_t &x, fixed_t &y, fixed_t &z, sector_t *&sec, bool &unlinked);
|
||||||
|
|
||||||
// [RH] Means of death
|
// [RH] Means of death
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -4874,7 +4874,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
|
||||||
CVAR(Float, chase_height, -8.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Float, chase_height, -8.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector)
|
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector, bool &unlinked)
|
||||||
{
|
{
|
||||||
fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
|
fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
|
||||||
angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT;
|
angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT;
|
||||||
|
@ -4905,6 +4905,7 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
|
||||||
CameraZ = trace.Z;
|
CameraZ = trace.Z;
|
||||||
}
|
}
|
||||||
CameraSector = trace.Sector;
|
CameraSector = trace.Sector;
|
||||||
|
unlinked = trace.unlinked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -927,6 +927,7 @@ void R_SetupFrame (AActor *actor)
|
||||||
player_t *player = actor->player;
|
player_t *player = actor->player;
|
||||||
unsigned int newblend;
|
unsigned int newblend;
|
||||||
InterpolationViewer *iview;
|
InterpolationViewer *iview;
|
||||||
|
bool unlinked = false;
|
||||||
|
|
||||||
if (player != NULL && player->mo == actor)
|
if (player != NULL && player->mo == actor)
|
||||||
{ // [RH] Use camera instead of viewplayer
|
{ // [RH] Use camera instead of viewplayer
|
||||||
|
@ -962,9 +963,22 @@ void R_SetupFrame (AActor *actor)
|
||||||
if (player != NULL && gamestate != GS_TITLELEVEL &&
|
if (player != NULL && gamestate != GS_TITLELEVEL &&
|
||||||
((player->cheats & CF_CHASECAM) || (r_deathcamera && camera->health <= 0)))
|
((player->cheats & CF_CHASECAM) || (r_deathcamera && camera->health <= 0)))
|
||||||
{
|
{
|
||||||
|
sector_t *oldsector = R_PointInSubsector(iview->oviewx, iview->oviewy)->sector;
|
||||||
// [RH] Use chasecam view
|
// [RH] Use chasecam view
|
||||||
P_AimCamera (camera, iview->nviewx, iview->nviewy, iview->nviewz, viewsector);
|
P_AimCamera (camera, iview->nviewx, iview->nviewy, iview->nviewz, viewsector, unlinked);
|
||||||
r_showviewer = true;
|
r_showviewer = true;
|
||||||
|
// Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition
|
||||||
|
// it's probably best to just reset the interpolation for this move.
|
||||||
|
// Note that this can still cause problems with unusually linked portals
|
||||||
|
if (viewsector->PortalGroup != oldsector->PortalGroup || (unlinked && P_AproxDistance(iview->oviewx - iview->nviewx, iview->oviewy - iview->nviewy) > 256 * FRACUNIT))
|
||||||
|
{
|
||||||
|
iview->otic = nowtic;
|
||||||
|
iview->oviewx = iview->nviewx;
|
||||||
|
iview->oviewy = iview->nviewy;
|
||||||
|
iview->oviewz = iview->nviewz;
|
||||||
|
iview->oviewpitch = iview->nviewpitch;
|
||||||
|
iview->oviewangle = iview->nviewangle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue