diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 4412fdef4..52d094857 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -565,7 +565,7 @@ void movefta_r(void) (isRRRA() && (isIn(s->picnum, COOT, COOTSTAYPUT, BIKER, BIKERB, BIKERBV2, CHEER, CHEERB, CHEERSTAYPUT, MINIONBOAT, HULKBOAT, CHEERBOAT, RABBIT, COOTPLAY, BILLYPLAY, MAKEOUT, MAMA) || (s->picnum == MINION && s->pal == 8))) - || (sintable[(s->ang + 512) & 2047] * (px - sx) + sintable[s->ang & 2047] * (py - sy) >= 0)) + || (bcos(s->ang) * (px - sx) + bsin(s->ang) * (py - sy) >= 0)) { int r1 = krand(); int r2 = krand(); @@ -708,16 +708,12 @@ int ifhitbyweapon_r(DDukeActor *actor) case EXPLODINGBARREL: case TRIPBOMBSPRITE: case RPG2: - ps[p].posxv += - actor->extra * (sintable[(actor->ang + 512) & 2047]) << 2; - ps[p].posyv += - actor->extra * (sintable[actor->ang & 2047]) << 2; + ps[p].posxv += actor->extra * bcos(actor->ang, 2); + ps[p].posyv += actor->extra * bsin(actor->ang, 2); break; default: - ps[p].posxv += - actor->extra * (sintable[(actor->ang + 512) & 2047]) << 1; - ps[p].posyv += - actor->extra * (sintable[actor->ang & 2047]) << 1; + ps[p].posxv += actor->extra * bcos(actor->ang, 1); + ps[p].posyv += actor->extra * bsin(actor->ang, 1); break; } } @@ -1277,8 +1273,8 @@ static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos) } if (s->extra <= 0) { - s->x += sintable[(s->ang + 512) & 2047] >> 7; - s->y += sintable[s->ang & 2047] >> 7; + s->x += bcos(s->ang, -7); + s->y += bsin(s->ang, -7); auto Owner = proj->GetOwner(); if (!isRRRA() || !Owner || (Owner->s.picnum != CHEER && Owner->s.picnum != CHEERSTAYPUT)) { @@ -1419,8 +1415,8 @@ static void weaponcommon_r(DDukeActor *proj) Collision coll; movesprite_ex(proj, - (k * (sintable[(s->ang + 512) & 2047])) >> 14, - (k * (sintable[s->ang & 2047])) >> 14, ll, CLIPMASK1, coll); + mulscale14(k, bcos(s->ang)), + mulscale14(k, bsin(s->ang)), ll, CLIPMASK1, coll); if ((s->picnum == RPG || (isRRRA() && isIn(s->picnum, RPG2, RRTILE1790))) && proj->temp_actor != nullptr) if (FindDistance2D(s->x - proj->temp_actor->s.x, s->y - proj->temp_actor->s.y) < 256) @@ -1453,8 +1449,8 @@ static void weaponcommon_r(DDukeActor *proj) for (k = -3; k < 2; k++) { auto x = EGS(s->sectnum, - s->x + ((k * sintable[(s->ang + 512) & 2047]) >> 9), - s->y + ((k * sintable[s->ang & 2047]) >> 9), + s->x + mulscale9(k, bcos(s->ang)), + s->y + mulscale9(k, bsin(s->ang)), s->z + ((k * ksgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2), s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5); @@ -1928,8 +1924,8 @@ void movetransports_r(void) changespritesect(act2, Owner->s.sectnum); - movesprite_ex(act2, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14, - (spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1, coll); + movesprite_ex(act2, mulscale14(spr2->xvel, bcos(spr2->ang)), + mulscale14(spr2->xvel, bsin(spr2->ang)), 0, CLIPMASK1, coll); break; case 161: @@ -1944,8 +1940,8 @@ void movetransports_r(void) changespritesect(act2, Owner->s.sectnum); - movesprite_ex(act2, (spr2->xvel * sintable[(spr2->ang + 512) & 2047]) >> 14, - (spr2->xvel * sintable[spr2->ang & 2047]) >> 14, 0, CLIPMASK1, coll); + movesprite_ex(act2, mulscale14(spr2->xvel, bcos(spr2->ang)), + mulscale14(spr2->xvel, bsin(spr2->ang)), 0, CLIPMASK1, coll); break; } @@ -2155,8 +2151,8 @@ static void rrra_specialstats() S_PlaySound(183); s->extra--; int j = movesprite_ex(act, - (s->hitag * sintable[(s->ang + 512) & 2047]) >> 14, - (s->hitag * sintable[s->ang & 2047]) >> 14, + mulscale14(s->hitag, bcos(s->ang)), + mulscale14(s->hitag, bsin(s->ang)), s->hitag << 1, CLIPMASK0, coll); if (j > 0) { @@ -2595,8 +2591,8 @@ static void heavyhbomb(DDukeActor *actor) Collision coll; movesprite_ex(actor, - (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14, - (s->xvel * (sintable[s->ang & 2047])) >> 14, + mulscale14(s->xvel, bcos(s->ang)), + mulscale14(s->xvel, bsin(s->ang)), s->zvel, CLIPMASK0, coll); if (sector[s->sectnum].lotag == 1 && s->zvel == 0) @@ -2789,8 +2785,8 @@ static int henstand(DDukeActor *actor) makeitfall(actor); Collision coll; movesprite_ex(actor, - (sintable[(s->ang + 512) & 2047] * s->xvel) >> 14, - (sintable[s->ang & 2047] * s->xvel) >> 14, + mulscale14(bcos(s->ang), s->xvel), + mulscale14(bsin(s->ang), s->xvel), s->zvel, CLIPMASK0, coll); if (coll.type) { @@ -2912,8 +2908,8 @@ void moveactors_r(void) if (sector[sect].lotag == 903) makeitfall(act); movesprite_ex(act, - (s->xvel*sintable[(s->ang+512)&2047])>>14, - (s->xvel*sintable[s->ang&2047])>>14, + mulscale14(s->xvel, bcos(s->ang)), + mulscale14(s->xvel, bsin(s->ang)), s->zvel,CLIPMASK0, coll); switch (sector[sect].lotag) { @@ -2953,8 +2949,8 @@ void moveactors_r(void) } makeitfall(act); movesprite_ex(act, - (s->xvel*(sintable[(s->ang+512)&2047]))>>14, - (s->xvel*(sintable[s->ang&2047]))>>14, + mulscale14(s->xvel, bcos(s->ang)), + mulscale14(s->xvel, bsin(s->ang)), s->zvel,CLIPMASK0, coll); if (coll.type > kHitSector) { @@ -2984,8 +2980,8 @@ void moveactors_r(void) } makeitfall(act); movesprite_ex(act, - (s->xvel*sintable[(s->ang+512)&2047])>>14, - (s->xvel*sintable[s->ang&2047])>>14, + mulscale14(s->xvel, bcos(s->ang)), + mulscale14(s->xvel, bsin(s->ang)), s->zvel,CLIPMASK0, coll); if (s->z >= sector[sect].floorz - (8<<8)) { @@ -3083,8 +3079,8 @@ void moveactors_r(void) if (s->xvel) { movesprite_ex(act, - (s->xvel*sintable[(s->ang+512)&2047])>>14, - (s->xvel*sintable[s->ang&2047])>>14, + mulscale14(s->xvel, bcos(s->ang)), + mulscale14(s->xvel, bsin(s->ang)), s->zvel,CLIPMASK0, coll); s->xvel--; } @@ -3633,7 +3629,7 @@ void moveeffectors_r(void) //STATNUM 3 case 29: act->s.hitag += 64; - l = mulscale12((int)act->s.yvel, sintable[act->s.hitag & 2047]); + l = mulscale12(act->s.yvel, bsin(act->s.hitag)); sc->floorz = act->s.z + l; break; @@ -3734,7 +3730,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel) } if (a & spin) - spr->ang += sintable[((t[0] << 3) & 2047)] >> 6; + spr->ang += bsin(t[0] << 3, -6); if (a & face_player_slow) { @@ -3771,12 +3767,12 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (spr->picnum == CHEER) { if (t[0] < 16) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 40); + spr->zvel -= bcos(t[0] << 4) / 40; } else { if (t[0] < 16) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] >> 5); + spr->zvel -= bcos(t[0] << 4, -5); } } if (a & justjump1) @@ -3784,12 +3780,12 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (spr->picnum == RABBIT) { if (t[0] < 8) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 30); + spr->zvel -= bcos(t[0] << 4) / 30; } else if (spr->picnum == MAMA) { if (t[0] < 8) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 35); + spr->zvel -= bcos(t[0] << 4) / 35; } } if (a & justjump2) @@ -3797,24 +3793,24 @@ void move_r(DDukeActor *actor, int pnum, int xvel) if (spr->picnum == RABBIT) { if (t[0] < 8) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 24); + spr->zvel -= bcos(t[0] << 4) / 24; } else if (spr->picnum == MAMA) { if (t[0] < 8) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 28); + spr->zvel -= bcos(t[0] << 4) / 28; } } if (a & windang) { if (t[0] < 8) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] / 24); + spr->zvel -= bcos(t[0] << 4) / 24; } } else if ((a & jumptoplayer) == jumptoplayer) { if (t[0] < 16) - spr->zvel -= (sintable[(512 + (t[0] << 4)) & 2047] >> 5); + spr->zvel -= bcos(t[0] << 4, -5); } @@ -3986,8 +3982,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel) Collision coll; actor->movflag = movesprite_ex(actor, - (daxvel * (sintable[(angdif + 512) & 2047])) >> 14, - (daxvel * (sintable[angdif & 2047])) >> 14, spr->zvel, CLIPMASK0, coll); + mulscale14(daxvel, bcos(angdif)), + mulscale14(daxvel, bsin(angdif)), spr->zvel, CLIPMASK0, coll); } if (a)