- Blood: Replace SinScale16() with bsin() from backend.

This commit is contained in:
Mitch Richters 2021-10-30 17:22:17 +11:00 committed by Christoph Oelckers
parent 879e2f3ce4
commit 3ec1767791
23 changed files with 60 additions and 65 deletions

View file

@ -6133,7 +6133,7 @@ static void actCheckTraps()
x += (dx / 2) >> 12;
y += (dy / 2) >> 12;
}
dy = SinScale16(pSprite->ang);
dy = bsin(pSprite->ang);
dx = CosScale16(pSprite->ang);
gVectorData[kVectorTchernobogBurn].maxDist = pXSprite->data1 << 9;
actFireVector(actor, 0, 0, dx, dy, Random2(0x8888), kVectorTchernobogBurn);

View file

@ -138,7 +138,7 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
int x = pSprite->x;
int y = pSprite->y;
int z = pSprite->z;
HitScan(pSprite, z, CosScale16(nAngle), SinScale16(nAngle), 0, CLIPMASK0, nRange);
HitScan(pSprite, z, CosScale16(nAngle), bsin(nAngle), 0, CLIPMASK0, nRange);
int nDist = approxDist(x - gHitInfo.hitx, y - gHitInfo.hity);
if (nDist - (pSprite->clipdist << 2) < nRange)
{

View file

@ -69,7 +69,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type);

View file

@ -70,7 +70,7 @@ void SlashSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
// Correct ?
int dz = pSprite->z - pTarget->z;
dx += Random3(4000 - 700 * gGameOptions.nDifficulty);
@ -87,7 +87,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
XSPRITE* pXSprite = &actor1->x();
spritetype* pSprite = &actor1->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int x = pSprite->x;
int y = pSprite->y;
int z = pSprite->z;

View file

@ -81,7 +81,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
spritetype* pTarget = &actor->GetTarget()->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type);

View file

@ -62,7 +62,7 @@ void SeqAttackCallback(int, DBloodActor* actor)
{
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = actor->dudeSlope;
dx += Random2(1500);
dy += Random2(1500);

View file

@ -61,7 +61,7 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
@ -89,7 +89,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
TARGETTRACK tt1 = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa };
Aim aim;
aim.dx = CosScale16(pSprite->ang);
aim.dy = SinScale16(pSprite->ang);
aim.dy = bsin(pSprite->ang);
aim.dz = actor->dudeSlope;
int nClosest = 0x7fffffff;
BloodStatIterator it(kStatDude);
@ -134,7 +134,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
}
else
@ -168,7 +168,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
Aim aim;
int ax, ay, az;
aim.dx = ax = CosScale16(pSprite->ang);
aim.dy = ay = SinScale16(pSprite->ang);
aim.dy = ay = bsin(pSprite->ang);
aim.dz = actor->dudeSlope;
az = 0;
int nClosest = 0x7fffffff;
@ -216,7 +216,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
}
else

View file

@ -78,7 +78,7 @@ void TommySeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = actor->dudeSlope;
dx += Random3((5 - gGameOptions.nDifficulty) * 1000);
dy += Random3((5 - gGameOptions.nDifficulty) * 1000);
@ -94,7 +94,7 @@ void TeslaSeqCallback(int, DBloodActor* actor)
if (Chance(dword_138BB0[gGameOptions.nDifficulty]))
{
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = actor->dudeSlope;
dx += Random3((5 - gGameOptions.nDifficulty) * 1000);
dy += Random3((5 - gGameOptions.nDifficulty) * 1000);
@ -109,7 +109,7 @@ void ShotSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = actor->dudeSlope;
dx += Random2((5 - gGameOptions.nDifficulty) * 1000 - 500);
dy += Random2((5 - gGameOptions.nDifficulty) * 1000 - 500);

View file

@ -89,7 +89,7 @@ void SlashFSeqCallback(int, DBloodActor* actor)
int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2;
int dz = height - height2;
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
int r1 = Random(50);
int r2 = Random(50);
@ -122,7 +122,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa };
Aim aim;
aim.dx = CosScale16(pSprite->ang);
aim.dy = SinScale16(pSprite->ang);
aim.dy = bsin(pSprite->ang);
aim.dz = actor->dudeSlope;
int nClosest = 0x7fffffff;
BloodStatIterator it(kStatDude);
@ -167,7 +167,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
if (tz > -0x333)
aim.dz = DivScale(tz, nDist, 10);

View file

@ -73,7 +73,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor)
int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2;
int dz = height - height2;
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
sfxPlay3DSound(actor, 1406, 0, 0);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGhost);
int r1 = Random(50);
@ -105,7 +105,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa };
Aim aim;
aim.dx = CosScale16(pSprite->ang);
aim.dy = SinScale16(pSprite->ang);
aim.dy = bsin(pSprite->ang);
aim.dz = actor->dudeSlope;
int nClosest = 0x7fffffff;
BloodStatIterator it(kStatDude);
@ -150,7 +150,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
if (tz > -0x333)
aim.dz = DivScale(tz, nDist, 10);

View file

@ -65,7 +65,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = pSprite->z - pTarget->z;
dx += Random3(2000);
dy += Random3(2000);

View file

@ -48,7 +48,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
@ -69,7 +69,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
void houndBurnSeqCallback(int, DBloodActor* actor)
{
spritetype* pSprite = &actor->s();
actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileFlameHound);
actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileFlameHound);
}
static void houndThinkSearch(DBloodActor* actor)

View file

@ -47,7 +47,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype* pTarget = &actor->GetTarget()->s();

View file

@ -66,7 +66,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
dx += Random2(2000);
dy += Random2(2000);
int dz = Random2(2000);
@ -118,7 +118,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
dx += Random2(200);
dy += Random2(200);
int dz = Random2(200);

View file

@ -75,7 +75,7 @@ void sub_71BD4(int, DBloodActor* actor)
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x100000 };
Aim aim;
aim.dx = CosScale16(pSprite->ang);
aim.dy = SinScale16(pSprite->ang);
aim.dy = bsin(pSprite->ang);
aim.dz = actor->dudeSlope;
int nClosest = 0x7fffffff;
BloodStatIterator it(kStatDude);
@ -120,7 +120,7 @@ void sub_71BD4(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
}
else
@ -142,7 +142,7 @@ void sub_720AC(int, DBloodActor* actor)
int height = pSprite->yrepeat * pDudeInfo->eyeHeight;
int ax, ay, az;
ax = CosScale16(pSprite->ang);
ay = SinScale16(pSprite->ang);
ay = bsin(pSprite->ang);
int x = pSprite->x;
int y = pSprite->y;
int z = height;
@ -195,7 +195,7 @@ void sub_720AC(int, DBloodActor* actor)
{
nClosest = nDist2;
aim.dx = CosScale16(nAngle);
aim.dy = SinScale16(nAngle);
aim.dy = bsin(nAngle);
aim.dz = DivScale(tz, nDist, 10);
}
else

View file

@ -151,7 +151,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
for (int i = -8191; i < 8192; i += by)
{
HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), i, clipMask, dist);
HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), i, clipMask, dist);
if (!fStart && actor->GetTarget() == gHitInfo.hitactor) fStart = i;
else if (fStart && actor->GetTarget() != gHitInfo.hitactor)
{
@ -214,7 +214,7 @@ void punchCallback(int, DBloodActor* actor)
nZOffset2 = getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat << 2;
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int dz = nZOffset1 - nZOffset2;
if (!playGenDudeSound(actor, kGenDudeSndAttackMelee))
@ -247,7 +247,7 @@ void genDudeAttack1(int, DBloodActor* actor)
if (pExtra->weaponType == kGenDudeWeaponHitscan)
{
dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope;
dx = CosScale16(pSprite->ang); dy = bsin(pSprite->ang); dz = actor->dudeSlope;
// dispersal modifiers here in case if non-melee enemy
if (!dudeIsMelee(actor))
{
@ -285,7 +285,7 @@ void genDudeAttack1(int, DBloodActor* actor)
}
else if (pExtra->weaponType == kGenDudeWeaponMissile)
{
dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope;
dx = CosScale16(pSprite->ang); dy = bsin(pSprite->ang); dz = actor->dudeSlope;
// dispersal modifiers here
dx += Random3(dispersion); dy += Random3(dispersion); dz += Random3(dispersion >> 1);
@ -778,9 +778,9 @@ static void unicultThinkChase(DBloodActor* actor)
{
int objDist = -1; int targetDist = -1; int hit = -1;
if (weaponType == kGenDudeWeaponHitscan)
hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist);
hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK1, dist);
else if (weaponType == kGenDudeWeaponMissile)
hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist);
hit = HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, CLIPMASK0, dist);
if (hit >= 0)
{
@ -902,7 +902,7 @@ static void unicultThinkChase(DBloodActor* actor)
else if (weaponType == kGenDudeWeaponHitscan && hscn)
{
if (genDudeAdjustSlope(actor, dist, weaponType)) break;
VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1);
VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, dist, 1);
if (actor == gHitInfo.hitactor) break;
bool immune = nnExtIsImmune(pHSprite, gVectorData[curWeapon].dmgType);
@ -962,7 +962,7 @@ static void unicultThinkChase(DBloodActor* actor)
if (hit == 4 && weaponType == kGenDudeWeaponHitscan && hscn)
{
bool masked = (pHWall->cstat & CSTAT_WALL_MASKED);
if (masked) VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1);
if (masked) VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), actor->dudeSlope, dist, 1);
//viewSetSystemMessage("WALL VHIT: %d", gHitInfo.hitwall);
if ((actor != gHitInfo.hitactor) && (pHWall->type != kWallGib || !masked || pXHWall == NULL || !pXHWall->triggerVector || pXHWall->locked))
@ -1875,7 +1875,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
int angBak = pSprite->ang;
pSprite->ang = getangle(x - pSprite->x, y - pSprite->y);
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4;
int dz = DivScale(tz - top - 256, nDist, 10);
int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0);

View file

@ -74,7 +74,7 @@ void HackSeqCallback(int, DBloodActor* actor)
int height2 = (pTarget->yrepeat * pDudeInfoT->eyeHeight) << 2;
int dz = height - height2;
int dx = CosScale16(nAngle);
int dy = SinScale16(nAngle);
int dy = bsin(nAngle);
sfxPlay3DSound(pSprite, 1101, 1, 0);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorAxe);
}

View file

@ -58,7 +58,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor)
int height = (pDudeInfo->eyeHeight * pSprite->yrepeat);
DUDEINFO* pDudeInfoT = getDudeInfo(pTarget->type);
int height2 = (pDudeInfoT->eyeHeight * pTarget->yrepeat);
actFireVector(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), height - height2, kVectorCleaver);
actFireVector(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), height - height2, kVectorCleaver);
}
void PukeSeqCallback(int, DBloodActor* actor)
@ -75,7 +75,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
int ty = pXSprite->targetY - pSprite->y;
int nAngle = getangle(tx, ty);
int dx = CosScale16(nAngle);
int dy = SinScale16(nAngle);
int dy = bsin(nAngle);
sfxPlay3DSound(pSprite, 1203, 1, 0);
actFireMissile(actor, 0, -(height - height2), dx, dy, 0, kMissilePukeGreen);
}
@ -83,7 +83,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
void ThrowSeqCallback(int, DBloodActor* actor)
{
spritetype* pSprite = &actor->s();
actFireMissile(actor, 0, -getDudeInfo(pSprite->type)->eyeHeight, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileButcherKnife);
actFireMissile(actor, 0, -getDudeInfo(pSprite->type)->eyeHeight, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileButcherKnife);
}
static void zombfThinkSearch(DBloodActor* actor)

View file

@ -83,11 +83,6 @@ inline int Cos(int ang)
return costable[ang & 2047];
}
inline int SinScale16(int ang)
{
return FixedToInt(costable[(ang - 512) & 2047]);
}
inline int CosScale16(int ang)
{
return FixedToInt(costable[ang & 2047]);

View file

@ -3982,7 +3982,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
if ((pPlayer = getPlayerById(pSpr->type)) != NULL)
var = HitScan(pSpr, pPlayer->zWeapon, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, arg1, arg3 << 1);
else if (IsDudeSprite(pSpr))
var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), SinScale16(pSpr->ang), (!xspriRangeIsFine(pSpr->extra)) ? 0 : spractor->dudeSlope, arg1, arg3 << 1);
var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), bsin(pSpr->ang), (!xspriRangeIsFine(pSpr->extra)) ? 0 : spractor->dudeSlope, arg1, arg3 << 1);
else if ((var2 & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FLOOR) {
var3 = (var2 & 0x0008) ? 0x10000 << 1 : -(0x10000 << 1);
@ -3990,7 +3990,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
} else {
var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), SinScale16(pSpr->ang), 0, arg1, arg3 << 1);
var = HitScan(pSpr, pSpr->z, CosScale16(pSpr->ang), bsin(pSpr->ang), 0, arg1, arg3 << 1);
}
@ -5533,7 +5533,7 @@ void useUniMissileGen(XSPRITE* pXSource, spritetype* pSprite) {
else dz = -0x4000;
} else {
dx = CosScale16(pSprite->ang);
dy = SinScale16(pSprite->ang);
dy = bsin(pSprite->ang);
dz = pXSource->data3 << 6; // add slope controlling
if (dz > 0x10000) dz = 0x10000;
else if (dz < -0x10000) dz = -0x10000;

View file

@ -1246,7 +1246,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
*a3 = 0;
spritetype *pSprite = pPlayer->pSprite;
int x = CosScale16(pSprite->ang);
int y = SinScale16(pSprite->ang);
int y = bsin(pSprite->ang);
int z = pPlayer->slope;
int hit = HitScan(pSprite, pPlayer->zView, x, y, z, 0x10000040, 128);
int hitDist = approxDist(pSprite->x-gHitInfo.hitx, pSprite->y-gHitInfo.hity)>>4;
@ -1580,7 +1580,7 @@ void ProcessInput(PLAYER *pPlayer)
pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047;
int nSprite = pPlayer->pSprite->index;
int x = CosScale16(pPlayer->pSprite->ang);
int y = SinScale16(pPlayer->pSprite->ang);
int y = bsin(pPlayer->pSprite->ang);
xvel[pSprite2->index] = xvel[nSprite] + MulScale(0x155555, x, 14);
yvel[pSprite2->index] = yvel[nSprite] + MulScale(0x155555, y, 14);
zvel[pSprite2->index] = zvel[nSprite];
@ -2123,9 +2123,9 @@ void voodooTarget(PLAYER *pPlayer)
for (int i = 0; i < 4; i++)
{
int ang1 = (pPlayer->voodooVar1+pPlayer->vodooVar2)&2047;
actFireVector(actor, 0, dz, CosScale16(ang1), SinScale16(ang1), v4, kVectorVoodoo10);
actFireVector(actor, 0, dz, CosScale16(ang1), bsin(ang1), v4, kVectorVoodoo10);
int ang2 = (pPlayer->voodooVar1+2048-pPlayer->vodooVar2)&2047;
actFireVector(actor, 0, dz, CosScale16(ang2), SinScale16(ang2), v4, kVectorVoodoo10);
actFireVector(actor, 0, dz, CosScale16(ang2), bsin(ang2), v4, kVectorVoodoo10);
}
pPlayer->voodooTargets = ClipLow(pPlayer->voodooTargets-1, 0);
}

View file

@ -249,7 +249,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
int angBak = pSprite->ang;
pSprite->ang = getangle(x-pSprite->x, y-pSprite->y);
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dy = bsin(pSprite->ang);
int tz = pTarget->z - (pTarget->yrepeat * pDudeInfo->aimHeight) * 4;
int dz = DivScale(tz - top - 256, nDist, 10);
int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0);
@ -2258,7 +2258,7 @@ void FireballTrapSeqCallback(int, DBloodActor* actor)
if (pSprite->cstat&32)
actFireMissile(actor, 0, 0, 0, 0, (pSprite->cstat&8) ? 0x4000 : -0x4000, kMissileFireball);
else
actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), 0, kMissileFireball);
actFireMissile(actor, 0, 0, CosScale16(pSprite->ang), bsin(pSprite->ang), 0, kMissileFireball);
}
@ -2275,7 +2275,7 @@ void MGunFireSeqCallback(int, DBloodActor* actor)
evPostActor(&bloodActors[pXSprite->reference], 1, kCmdOff);
}
int dx = CosScale16(pSprite->ang)+Random2(1000);
int dy = SinScale16(pSprite->ang)+Random2(1000);
int dy = bsin(pSprite->ang)+Random2(1000);
int dz = Random2(1000);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorBullet);
sfxPlay3DSound(pSprite, 359, -1, 0);

View file

@ -354,7 +354,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int z = pPlayer->zWeapon;
Aim aim;
aim.dx = CosScale16(pPSprite->ang);
aim.dy = SinScale16(pPSprite->ang);
aim.dy = bsin(pPSprite->ang);
aim.dz = pPlayer->slope;
WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
int nTarget = -1;
@ -416,7 +416,7 @@ void UpdateAimVector(PLAYER * pPlayer)
{
nClosest = nDist2;
aim.dx = CosScale16(angle);
aim.dy = SinScale16(angle);
aim.dy = bsin(angle);
aim.dz = DivScale(dzCenter, nDist, 10);
nTarget = nSprite;
}
@ -465,7 +465,7 @@ void UpdateAimVector(PLAYER * pPlayer)
{
nClosest = nDist2;
aim.dx = CosScale16(angle);
aim.dy = SinScale16(angle);
aim.dy = bsin(angle);
aim.dz = DivScale(dz, nDist, 10);
nTarget = nSprite;
}
@ -1296,7 +1296,7 @@ void FireSpread(int nTrigger, PLAYER *pPlayer)
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
int dx = CosScale16(angle);
int dy = SinScale16(angle);
int dy = bsin(angle);
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
int r1, r2, r3;
r1 = Random3(300);
@ -1318,7 +1318,7 @@ void AltFireSpread(int nTrigger, PLAYER *pPlayer)
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
int dx = CosScale16(angle);
int dy = SinScale16(angle);
int dy = bsin(angle);
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
int r1, r2, r3;
r1 = Random3(300);
@ -1348,7 +1348,7 @@ void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
Aim *aim = &pPlayer->aim;
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
int dx = CosScale16(angle);
int dy = SinScale16(angle);
int dy = bsin(angle);
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
if (powerupCheck(pPlayer, kPwUpTwoGuns) && checkAmmo2(pPlayer, 3, 2))
{