- use the vel() wrappers in a few more places.

This commit is contained in:
Christoph Oelckers 2021-09-16 19:30:35 +02:00
parent 595893a9a0
commit 8168c6f85c
4 changed files with 21 additions and 22 deletions

View file

@ -2994,7 +2994,8 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
if (pXSprite->dropMsg > 0) // drop items
actDropObject(actor, pXSprite->dropMsg);
pSprite->flags &= ~kPhysMove; xvel[pSprite->index] = yvel[pSprite->index] = 0;
pSprite->flags &= ~kPhysMove;
actor->xvel() = actor->yvel() = 0;
playGenDudeSound(pSprite, kGenDudeSndTransforming);
int seqId = pXSprite->data2 + kGenDudeSeqTransform;

View file

@ -257,13 +257,12 @@ void aiChooseDirection(DBloodActor* actor, int a3)
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int vc = ((a3+1024-pSprite->ang)&2047)-1024;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = xvel[nSprite];
int dy = yvel[nSprite];
int dx = actor->xvel();
int dy = actor->yvel();
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int vsi = ((t1*15)>>12) / 2;
int v8 = 341;

View file

@ -315,7 +315,6 @@ static void sub_65D04(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
@ -333,26 +332,26 @@ static void sub_65D04(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = xvel[nSprite];
int vy = yvel[nSprite];
int vx = actor->xvel();
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (actor->GetTarget() == nullptr)
t1 += nAccel;
else
t1 += nAccel>>2;
xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30);
yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void sub_65F44(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype *pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
@ -373,24 +372,24 @@ static void sub_65F44(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = xvel[nSprite];
int vy = yvel[nSprite];
int vx = actor->xvel();
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel;
xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30);
yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30);
zvel[nSprite] = -dz;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -dz;
}
static void sub_661E0(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
if (!actor->ValidateTarget(__FUNCTION__)) return;
spritetype *pTarget = &actor->GetTarget()->s();
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
@ -411,14 +410,14 @@ static void sub_661E0(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = xvel[nSprite];
int vy = yvel[nSprite];
int vx = actor->xvel();
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
t1 += nAccel>>1;
xvel[nSprite] = DMulScale(t1, nCos, t2, nSin, 30);
yvel[nSprite] = DMulScale(t1, nSin, -t2, nCos, 30);
zvel[nSprite] = dz;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = dz;
}
END_BLD_NS

View file

@ -211,7 +211,7 @@ void genDudeAttack1(int, DBloodActor* actor)
if (pXSprite->target_i < 0) return;
int dx, dy, dz;
xvel[pSprite->index] = yvel[pSprite->index] = 0;
actor->xvel() = actor->yvel() = 0;
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite);
short dispersion = pExtra->baseDispersion;