diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 1f089b11e..4d6a81b44 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -716,7 +716,7 @@ void viewDrawScreen(bool sceneonly) { q16horiz += q16slopehoriz; } - cZ += (FixedToInt(q16horiz) - 100) * 10; + cZ += xs_CRoundToInt((q16horiz - IntToFixed(100)) / 6553.6); cameradist = -1; cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate); } diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index eae5f08e3..1c3c7c8c3 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -116,7 +116,7 @@ void playerLookUp(int snum, ESyncBits actions); void playerLookDown(int snum, ESyncBits actions); void playerAimUp(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); int hits(int i); int hitasprite(int i, short* hitsp); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 3741ea8bc..efeb404f8 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -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; 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); ny = (sintable[(ang + 1024) & 2047] >> 4); - nz = (horiz - 100) * 128; + nz = (q16horiz - IntToFixed(100)) >> 9; sp = &sprite[pp->i]; diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 47640ceb4..6a62407bf 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -604,7 +604,7 @@ void displayrooms(int snum, double smoothratio) { if (cl_viewbob) cposz += p->opyoff + xs_CRoundToInt(fmulscale16(p->pyoff - p->opyoff, smoothratio)); } - else view(p, &cposx, &cposy, &cposz, §, cang.asbuild(), choriz.asbuild(), smoothratio); + else view(p, &cposx, &cposy, &cposz, §, cang.asbuild(), choriz.asq16(), smoothratio); // do screen rotation. renderSetRollAngle(FixedToInt(q16rotscrnang)); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 6b00d52ec..3bd500985 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -942,7 +942,7 @@ post_analyzesprites(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 }; 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 vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3); vy = (sintable[NORM_ANGLE(ang + 1024)] >> 3); - vz = (horiz - 100) * 256L; + vz = (q16horiz - IntToFixed(100)) >> 8; // Player sprite of current view 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; RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); ASSERT(*vsect >= 0 && *vsect < MAXSECTORS); - BackView(nx, ny, nz, vsect, nq16ang, horiz); + BackView(nx, ny, nz, vsect, nq16ang, q16horiz); hsp->cstat = flag_backup; return; } @@ -1061,7 +1061,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, short horiz) } 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 }; SPRITEp sp; @@ -1081,7 +1081,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz) vx += DIV2(vx); vy += DIV2(vy); - vz = (horiz - 100) * 256; + vz = (q16horiz - IntToFixed(100)) >> 8; // Player sprite of current view 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; 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; return; } @@ -1307,7 +1307,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t { case 1: pp->last_camera_sp = sp; - CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100); + CircleCamera(tx, ty, tz, tsectnum, tq16ang, IntToFixed(100)); found_camera = true; break; @@ -1719,7 +1719,7 @@ drawscreen(PLAYERp pp, double smoothratio) if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { - BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, FixedToInt(tq16horiz)); + BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, tq16horiz); } else {