From 837b7c0a30a03476e50890d7ea38f900b08dac66 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 27 Sep 2020 02:07:07 +1000 Subject: [PATCH] - SW: Changed some downscaled and upscaled Q16.16 variables missed when doing 46810ec490f336fea4de7dfe840daa9512b429a6. --- source/games/duke/src/player_d.cpp | 14 +++--- source/games/duke/src/player_r.cpp | 14 +++--- source/games/duke/src/player_w.cpp | 4 +- source/sw/src/draw.cpp | 20 ++------ source/sw/src/jweapon.cpp | 6 +-- source/sw/src/weapon.cpp | 80 +++++++++++++++--------------- 6 files changed, 61 insertions(+), 77 deletions(-) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 33e5bc127..2a285996f 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -166,7 +166,7 @@ void shoot_d(int i, int atwith) } else { - zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.)); + zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); sx += sintable[(sa + 860) & 0x7FF] / 448; sy += sintable[(sa + 348) & 0x7FF] / 448; sz += (3 << 8); @@ -224,7 +224,7 @@ void shoot_d(int i, int atwith) } else { - zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.)); + zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); if (sprite[ps[p].i].xvel != 0) vel = (int)((((512 - (1024 - abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024))) @@ -681,7 +681,7 @@ void shoot_d(int i, int atwith) sa = getangle(sprite[j].x - sx, sprite[j].y - sy); } else - zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.)); + zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); } else { @@ -769,7 +769,7 @@ void shoot_d(int i, int atwith) if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x - sx, sprite[j].y - sy); } - else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.)); + else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); if (atwith == RPG) S_PlayActorSound(RPG_SHOOT, i); @@ -1090,7 +1090,7 @@ void shoot_d(int i, int atwith) zvel = ((sprite[j].z - sz - dal - (4 << 8)) * 768) / (ldist(&sprite[ps[p].i], &sprite[j])); sa = getangle(sprite[j].x - sx, sprite[j].y - sy); } - else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.)); + else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); } else if (s->statnum != 3) { @@ -2122,12 +2122,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->on_ground && (actions & SB_CROUCH)) { k = 15; - i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } else { k = 140; - i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } j = EGS(p->cursectnum, diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 624e28509..31cd579c8 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -602,7 +602,7 @@ void shoot_r(int i, int atwith) sa = getangle(sprite[j].x - sx, sprite[j].y - sy); } else - zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.)); + zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); } else { @@ -693,7 +693,7 @@ void shoot_r(int i, int atwith) { sx += sintable[(s->ang + 512 + 160) & 2047] >> 7; sy += sintable[(s->ang + 160) & 2047] >> 7; - zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.)); + zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); } } else @@ -804,7 +804,7 @@ void shoot_r(int i, int atwith) if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x - sx, sprite[j].y - sy); } - else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.)); + else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); if (atwith == RPG) S_PlayActorSound(RPG_SHOOT, i); else if (isRRRA()) @@ -2843,12 +2843,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) { k = 15; - i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } else { k = 140; - i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } j = EGS(p->cursectnum, @@ -3253,12 +3253,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) { k = 15; - i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } else { k = 32; - i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } j = EGS(p->cursectnum, diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index d1b877568..810f045b6 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) if (p->on_ground && (actions & SB_CROUCH)) { k = 15; - i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } else { k = 140; - i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.)); + i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); } j = EGS(p->cursectnum, diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 5b5e3d4d3..ecf4d8fdd 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -389,25 +389,11 @@ DoMotionBlur(tspritetype const * const tsp) switch (tu->motion_blur_dist) { case 64: - dx = nx = MOVEx(64, ang); - dy = ny = MOVEy(64, ang); - nz = FixedToInt(z_amt_per_pixel * 64); - break; case 128: - dx = nx = MOVEx(128, ang); - dy = ny = MOVEy(128, ang); - nz = FixedToInt(z_amt_per_pixel * 128); - break; case 256: - dx = nx = MOVEx(256, ang); - dy = ny = MOVEy(256, ang); - nz = FixedToInt(z_amt_per_pixel * 256); - break; case 512: - dx = nx = MOVEx(512, ang); - dy = ny = MOVEy(512, ang); - nz = FixedToInt(z_amt_per_pixel * 512); - break; + nz = FixedToInt(z_amt_per_pixel * tu->motion_blur_dist); + [[fallthrough]]; default: dx = nx = MOVEx(tu->motion_blur_dist, ang); dy = ny = MOVEy(tu->motion_blur_dist, ang); @@ -1340,7 +1326,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t zvect = 0; // new horiz to player - *tq16horiz = IntToFixed(100 - (zvect/256)); + *tq16horiz = IntToFixed(100) - (zvect << 8); *tq16horiz = max(*tq16horiz, IntToFixed(PLAYER_HORIZ_MIN)); *tq16horiz = min(*tq16horiz, IntToFixed(PLAYER_HORIZ_MAX)); diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index fe27a3364..4429ffded 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -1418,7 +1418,7 @@ PlayerInitChemBomb(PLAYERp pp) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) SET(wu->Flags, SPR_UNDERWATER); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; // //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff), // FixedToInt(pp->q16horizoff + pp->q16horiz)); @@ -1862,7 +1862,7 @@ PlayerInitCaltrops(PLAYERp pp) // They go out at different angles // wp->ang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; oclipdist = pp->SpriteP->clipdist; pp->SpriteP->clipdist = 0; @@ -2496,7 +2496,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum) if (u->PlayerP) { - wp->z += ((100 - FixedToInt(u->PlayerP->q16horiz)) * (HORIZ_MULT/3)); + wp->z += xs_CRoundToInt((IntToFixed(100) - u->PlayerP->q16horiz) * ((HORIZ_MULT / 3.) / FRACUNIT)); } switch (wu->ID) diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index e516181fe..b37dc54c3 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -12826,7 +12826,7 @@ DoRing(int16_t Weapon) sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14; sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14; if (User[sp->owner]->PlayerP) - sp->z += (u->Dist * ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT)) >> 9; + sp->z += (u->Dist * ((IntToFixed(100) - pp->q16horiz) >> 9)) >> 9; //sp->ang = NORM_ANGLE(sp->ang + 512); //updatesector(sp->x, sp->y); @@ -12913,7 +12913,7 @@ InitSpellRing(PLAYERp pp) // put it out there sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14; sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14; - sp->z = pp->posz + Z(20) + ((u->Dist * ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT)) >> 9); + sp->z = pp->posz + Z(20) + ((u->Dist * ((IntToFixed(100) - pp->q16horiz) >> 9)) >> 9); sp->ang = NORM_ANGLE(sp->ang + 512); @@ -13452,7 +13452,7 @@ InitSpellNapalm(PLAYERp pp) sp->xrepeat = 32; sp->yrepeat = 32; sp->clipdist = 0; - sp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); SET(u->Flags2, SPR2_BLUR_TAPER_FAST); @@ -13607,7 +13607,7 @@ InitSpellMirv(PLAYERp pp) sp->xrepeat = 72; sp->yrepeat = 72; sp->clipdist = 32L >> 2; - sp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); @@ -13758,7 +13758,7 @@ InitSwordAttack(PLAYERp pp) int daz; daang = FixedToInt(pp->q16ang); - daz = ((100 - FixedToInt(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); + daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang @@ -13948,7 +13948,7 @@ InitFistAttack(PLAYERp pp) int daz; daang = FixedToInt(pp->q16ang); - daz = ((100 - FixedToInt(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); + daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang @@ -14621,7 +14621,7 @@ InitStar(PLAYERp pp) wp->clipdist = 32L >> 2; // wp->zvel was overflowing with this calculation - had to move to a local // long var - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT)); wu->ceiling_dist = Z(1); wu->floor_dist = Z(1); @@ -14678,7 +14678,7 @@ InitStar(PLAYERp pp) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np)) SET(nu->Flags, SPR_UNDERWATER); - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT)); np->zvel = zvel >> 1; if (MissileSetPos(nw, DoStar, 1000)) @@ -14742,7 +14742,7 @@ InitHeartAttack(PLAYERp pp) sp->xrepeat = 52; sp->yrepeat = 52; sp->clipdist = 0; - sp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); SET(u->Flags2, SPR2_DONT_TARGET_OWNER); SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); @@ -14966,7 +14966,7 @@ InitShotgun(PLAYERp pp) } else { - daz = (100 - FixedToInt(pp->q16horiz)) * 2000; + daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)); daang = FixedToInt(pp->q16ang); } @@ -15142,8 +15142,7 @@ InitLaser(PLAYERp pp) wp->clipdist = 64L>>2; // the slower the missile travels the less of a zvel it needs - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); - wp->zvel /= 4; + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 11; wu->WeaponNum = u->WeaponNum; wu->Radius = 200; @@ -15250,7 +15249,7 @@ InitRail(PLAYERp pp) wp->yrepeat = 52; wp->xrepeat = 52; wp->shade = -15; - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT+17)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 17.) / FRACUNIT)); wu->RotNum = 5; NewStateGroup(w, &sg_Rail[0]); @@ -15451,7 +15450,7 @@ InitRocket(PLAYERp pp) wp->yrepeat = 90; wp->xrepeat = 90; wp->shade = -15; - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT+35)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 35.) / FRACUNIT)); wp->clipdist = 64L>>2; @@ -15582,7 +15581,7 @@ InitBunnyRocket(PLAYERp pp) wp->yrepeat = 64; wp->xrepeat = 64; wp->shade = -15; - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT+35)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 35.) / FRACUNIT)); wp->clipdist = 64L>>2; @@ -15696,7 +15695,7 @@ InitNuke(PLAYERp pp) wp->yrepeat = 128; wp->xrepeat = 128; wp->shade = -15; - zvel = ((100 - FixedToInt(pp->q16horiz)) * (HORIZ_MULT-36)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT - 36.) / FRACUNIT)); wp->clipdist = 64L>>2; // Set to red palette @@ -15903,7 +15902,7 @@ InitMicro(PLAYERp pp) wp->yrepeat = 24; wp->xrepeat = 24; wp->shade = -15; - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->clipdist = 64L>>2; // randomize zvelocity @@ -17433,8 +17432,8 @@ InitTracerUzi(PLAYERp pp) nx = pp->posx; ny = pp->posy; //nz = pp->posz + pp->bob_z + Z(8); - //nz = pp->posz + pp->bob_z + Z(8) + ((100 - FixedToInt(pp->q16horiz)) * 72); - nz = pp->posz + Z(8) + ((100 - FixedToInt(pp->q16horiz)) * 72); + //nz = pp->posz + pp->bob_z + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); + nz = pp->posz + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); // Spawn a shot // Inserting and setting up variables @@ -17452,7 +17451,7 @@ InitTracerUzi(PLAYERp pp) wp->xrepeat = 10; wp->shade = -40; wp->zvel = 0; - //wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + //wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->clipdist = 32 >> 2; wu->WeaponNum = u->WeaponNum; @@ -17479,7 +17478,7 @@ InitTracerUzi(PLAYERp pp) return 0; } - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); + wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); pp->SpriteP->clipdist = oclipdist; @@ -17831,7 +17830,7 @@ InitUzi(PLAYERp pp) { //daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(24) - 12)); - daz = ((100 - FixedToInt(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); + daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); } @@ -18006,7 +18005,7 @@ InitEMP(PLAYERp pp) InitTracerUzi(pp); - //daz = nz = pp->posz + Z(8) + ((100 - FixedToInt(pp->q16horiz)) * 72); + //daz = nz = pp->posz + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); //daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); daz = nz = pp->posz + pp->bob_z; @@ -18016,7 +18015,7 @@ InitEMP(PLAYERp pp) } else { - daz = (100 - FixedToInt(pp->q16horiz)) * 2000; + daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)); daang = FixedToInt(pp->q16ang); } @@ -18190,7 +18189,7 @@ InitTankShell(short SpriteNum, PLAYERp pp) SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_INVISIBLE); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); + wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); WeaponAutoAim(sp, w, 64, false); // a bit of randomness @@ -18269,7 +18268,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp) wp->yrepeat = 24; wp->xrepeat = 24; wp->shade = -15; - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->clipdist = 64L>>2; // randomize zvelocity @@ -18350,7 +18349,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp) SET(wu->Flags2, SPR2_SO_MISSILE); SET(wp->cstat, CSTAT_SPRITE_YCENTER); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); + wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); WeaponAutoAim(sp, w, 64, false); // a bit of randomness @@ -18397,7 +18396,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp) SET(wu->Flags2, SPR2_SO_MISSILE); SET(wp->cstat, CSTAT_SPRITE_YCENTER); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * (wp->xvel/8)); + wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); WeaponAutoAim(sp, w, 64, false); // a bit of randomness @@ -18446,7 +18445,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp) wp->yrepeat = 52; wp->xrepeat = 52; wp->shade = -15; - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wu->RotNum = 5; NewStateGroup(w, &sg_Rail[0]); @@ -18506,8 +18505,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp) wp->shade = -15; // the slower the missile travels the less of a zvel it needs - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); - wp->zvel /= 4; + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 11; wu->Radius = 200; wu->ceiling_dist = Z(1); @@ -18563,12 +18561,12 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp) } else { - int horiz; - horiz = FixedToInt(pp->q16horiz); - if (horiz < 75) - horiz = 75; + fixed_t q16horiz = pp->q16horiz; + fixed_t horizmin = IntToFixed(75); + if (q16horiz < horizmin) + q16horiz = horizmin; - daz = ((100 - horiz) * 2000) + (RANDOM_RANGE(Z(80)) - Z(40)); + daz = xs_CRoundToInt((IntToFixed(100) - q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(Z(80)) - Z(40)); daang = sp->ang; } @@ -19306,7 +19304,7 @@ InitGrenade(PLAYERp pp) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) SET(wu->Flags, SPR_UNDERWATER); - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; ////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff), FixedToInt(pp->q16horizoff + pp->q16horiz)); //MONO_PRINT(ds); @@ -19453,7 +19451,7 @@ InitMine(PLAYERp pp) wp->xrepeat = 32; wp->shade = -15; wp->clipdist = 128L>>2; - wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wu->WeaponNum = u->WeaponNum; wu->Radius = 200; wu->ceiling_dist = Z(5); @@ -19466,7 +19464,7 @@ InitMine(PLAYERp pp) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) SET(wu->Flags, SPR_UNDERWATER); - //wp->zvel = ((100 - FixedToInt(pp->q16horiz)) * HORIZ_MULT); + //wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; MissileSetPos(w, DoMine, 800); @@ -19619,8 +19617,8 @@ InitFireball(PLAYERp pp) wu->ceiling_dist = Z(6); wu->floor_dist = Z(6); - //zvel = ((100 - FixedToInt(pp->q16horiz)) * (100+ADJUST)); - zvel = ((100 - FixedToInt(pp->q16horiz)) * (240L)); + //zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((100. + ADJUST) / FRACUNIT)); + zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (240. / FRACUNIT)); //wu->RotNum = 5; //NewStateGroup(w, &sg_Fireball);