- Blood/Duke/SW: Smooth out player's zpos adjustment while in 3rd person view.

This commit is contained in:
Mitchell Richters 2020-09-23 23:12:59 +10:00
parent ce7af5fe0e
commit 64113f8f9c
5 changed files with 13 additions and 13 deletions

View file

@ -716,7 +716,7 @@ void viewDrawScreen(bool sceneonly)
{ {
q16horiz += q16slopehoriz; q16horiz += q16slopehoriz;
} }
cZ += (FixedToInt(q16horiz) - 100) * 10; cZ += xs_CRoundToInt((q16horiz - IntToFixed(100)) / 6553.6);
cameradist = -1; cameradist = -1;
cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate); cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate);
} }

View file

@ -116,7 +116,7 @@ void playerLookUp(int snum, ESyncBits actions);
void playerLookDown(int snum, ESyncBits actions); void playerLookDown(int snum, ESyncBits actions);
void playerAimUp(int snum, ESyncBits actions); void playerAimUp(int snum, ESyncBits actions);
void playerAimDown(int snum, ESyncBits actions); void playerAimDown(int snum, ESyncBits actions);
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, int horiz, double smoothratio); bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio);
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n); void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
int hits(int i); int hits(int i);
int hitasprite(int i, short* hitsp); int hitasprite(int i, short* hitsp);

View file

@ -1086,7 +1086,7 @@ int haskey(int sect, int snum)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, int horiz, double smoothratio) bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio)
{ {
spritetype* sp; spritetype* sp;
int i, nx, ny, nz, hx, hy, hitx, hity, hitz; int i, nx, ny, nz, hx, hy, hitx, hity, hitz;
@ -1094,7 +1094,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
nx = (sintable[(ang + 1536) & 2047] >> 4); nx = (sintable[(ang + 1536) & 2047] >> 4);
ny = (sintable[(ang + 1024) & 2047] >> 4); ny = (sintable[(ang + 1024) & 2047] >> 4);
nz = (horiz - 100) * 128; nz = (q16horiz - IntToFixed(100)) >> 9;
sp = &sprite[pp->i]; sp = &sprite[pp->i];

View file

@ -604,7 +604,7 @@ void displayrooms(int snum, double smoothratio)
{ {
if (cl_viewbob) cposz += p->opyoff + xs_CRoundToInt(fmulscale16(p->pyoff - p->opyoff, smoothratio)); if (cl_viewbob) cposz += p->opyoff + xs_CRoundToInt(fmulscale16(p->pyoff - p->opyoff, smoothratio));
} }
else view(p, &cposx, &cposy, &cposz, &sect, cang.asbuild(), choriz.asbuild(), smoothratio); else view(p, &cposx, &cposy, &cposz, &sect, cang.asbuild(), choriz.asq16(), smoothratio);
// do screen rotation. // do screen rotation.
renderSetRollAngle(FixedToInt(q16rotscrnang)); renderSetRollAngle(FixedToInt(q16rotscrnang));

View file

@ -942,7 +942,7 @@ post_analyzesprites(void)
void void
BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz) BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16horiz)
{ {
vec3_t n = { *nx, *ny, *nz }; vec3_t n = { *nx, *ny, *nz };
SPRITEp sp; SPRITEp sp;
@ -959,7 +959,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz)
// Calculate the vector (nx,ny,nz) to shoot backwards // Calculate the vector (nx,ny,nz) to shoot backwards
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3); vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
vy = (sintable[NORM_ANGLE(ang + 1024)] >> 3); vy = (sintable[NORM_ANGLE(ang + 1024)] >> 3);
vz = (horiz - 100) * 256L; vz = (q16horiz - IntToFixed(100)) >> 8;
// Player sprite of current view // Player sprite of current view
sp = &sprite[pp->PlayerSprite]; sp = &sprite[pp->PlayerSprite];
@ -1016,7 +1016,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz)
flag_backup = hsp->cstat; flag_backup = hsp->cstat;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS); ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
BackView(nx, ny, nz, vsect, nq16ang, horiz); BackView(nx, ny, nz, vsect, nq16ang, q16horiz);
hsp->cstat = flag_backup; hsp->cstat = flag_backup;
return; return;
} }
@ -1061,7 +1061,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz)
} }
void void
CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz) CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16horiz)
{ {
vec3_t n = { *nx, *ny, *nz }; vec3_t n = { *nx, *ny, *nz };
SPRITEp sp; SPRITEp sp;
@ -1081,7 +1081,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
vx += DIV2(vx); vx += DIV2(vx);
vy += DIV2(vy); vy += DIV2(vy);
vz = (horiz - 100) * 256; vz = (q16horiz - IntToFixed(100)) >> 8;
// Player sprite of current view // Player sprite of current view
sp = &sprite[pp->PlayerSprite]; sp = &sprite[pp->PlayerSprite];
@ -1137,7 +1137,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
flag_backup = hsp->cstat; flag_backup = hsp->cstat;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
CircleCamera(nx, ny, nz, vsect, nq16ang, horiz); CircleCamera(nx, ny, nz, vsect, nq16ang, q16horiz);
hsp->cstat = flag_backup; hsp->cstat = flag_backup;
return; return;
} }
@ -1307,7 +1307,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
{ {
case 1: case 1:
pp->last_camera_sp = sp; pp->last_camera_sp = sp;
CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100); CircleCamera(tx, ty, tz, tsectnum, tq16ang, IntToFixed(100));
found_camera = true; found_camera = true;
break; break;
@ -1719,7 +1719,7 @@ drawscreen(PLAYERp pp, double smoothratio)
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
{ {
BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, FixedToInt(tq16horiz)); BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, tq16horiz);
} }
else else
{ {