- moved velocity data into DBloodActor.

This commit is contained in:
Christoph Oelckers 2021-09-04 12:52:02 +02:00
parent 6a8f59e991
commit f4b900c540
27 changed files with 580 additions and 565 deletions

View file

@ -2394,7 +2394,7 @@ static void actInitThings()
pSprite->flags = thingInfo[nType].flags;
if (pSprite->flags & kPhysGravity) pSprite->flags |= kPhysFalling;
act->xvel() = act->yvel() = act->zvel() = 0;
act->xvel = act->yvel = act->zvel = 0;
switch (pSprite->type)
{
@ -2500,7 +2500,7 @@ static void actInitDudes()
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
#endif
act->xvel() = act->yvel() = act->zvel() = 0;
act->xvel = act->yvel = act->zvel = 0;
#ifdef NOONE_EXTENSIONS
// add a way to set custom hp for every enemy - should work only if map just started and not loaded.
@ -2590,9 +2590,9 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
int size = (tileWidth(pSprite->picnum) * pSprite->xrepeat * tileHeight(pSprite->picnum) * pSprite->yrepeat) >> 1;
int t = scale(damage, size, mass);
int nSprite = pSprite->index;
actor->xvel() += MulScale(t, dx, 16);
actor->yvel() += MulScale(t, dy, 16);
actor->zvel() += MulScale(t, dz, 16);
actor->xvel += MulScale(t, dx, 16);
actor->yvel += MulScale(t, dy, 16);
actor->zvel += MulScale(t, dz, 16);
}
}
actDamageSprite(source, actor, kDamageExplode, damage);
@ -2745,9 +2745,9 @@ static void actNapalmMove(DBloodActor* actor)
spawnparam[0] = pXSprite->data4 >> 1;
spawnparam[1] = pXSprite->data4 - spawnparam[0];
int ang = pSprite->ang;
actor->xvel() = 0;
actor->yvel() = 0;
actor->zvel() = 0;
actor->xvel = 0;
actor->yvel = 0;
actor->zvel = 0;
for (int i = 0; i < 2; i++)
{
int t1 = Random(0x33333) + 0x33333;
@ -2994,7 +2994,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
actDropObject(actor, pXSprite->dropMsg);
pSprite->flags &= ~kPhysMove;
actor->xvel() = actor->yvel() = 0;
actor->xvel = actor->yvel = 0;
playGenDudeSound(actor, kGenDudeSndTransforming);
int seqId = pXSprite->data2 + kGenDudeSeqTransform;
@ -3022,7 +3022,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
int top, bottom;
GetActorExtents(actor, &top, &bottom);
CGibPosition gibPos(pSprite->x, pSprite->y, top);
CGibVelocity gibVel(actor->xvel() >> 1, actor->yvel() >> 1, -0xccccc);
CGibVelocity gibVel(actor->xvel >> 1, actor->yvel >> 1, -0xccccc);
GibSprite(actor, nGibType, &gibPos, &gibVel);
}
}
@ -3267,7 +3267,7 @@ static void spawnGibs(DBloodActor* actor, int type, int velz)
int top, bottom;
GetActorExtents(actor, &top, &bottom);
CGibPosition gibPos(actor->s().x, actor->s().y, top);
CGibVelocity gibVel(actor->xvel() >> 1, actor->yvel() >> 1, velz);
CGibVelocity gibVel(actor->xvel >> 1, actor->yvel >> 1, velz);
GibSprite(actor, GIBTYPE_27, &gibPos, &gibVel);
}
@ -4170,10 +4170,10 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
static void actKickObject(DBloodActor* kicker, DBloodActor* kicked)
{
int nSpeed = ClipLow(approxDist(kicker->xvel(), kicker->yvel()) * 2, 0xaaaaa);
kicked->xvel() = MulScale(nSpeed, Cos(kicker->s().ang + Random2(85)), 30);
kicked->yvel() = MulScale(nSpeed, Sin(kicker->s().ang + Random2(85)), 30);
kicked->zvel() = MulScale(nSpeed, -0x2000, 14);
int nSpeed = ClipLow(approxDist(kicker->xvel, kicker->yvel) * 2, 0xaaaaa);
kicked->xvel = MulScale(nSpeed, Cos(kicker->s().ang + Random2(85)), 30);
kicked->yvel = MulScale(nSpeed, Sin(kicker->s().ang + Random2(85)), 30);
kicked->zvel = MulScale(nSpeed, -0x2000, 14);
kicked->s().flags = 7;
}
@ -4238,7 +4238,7 @@ static void checkCeilHit(DBloodActor* actor)
auto actor2 = coll.actor;
spritetype* pSprite2 = &actor2->s();
XSPRITE* pXSprite2 = &actor2->x();
if ((pSprite2->statnum == kStatThing || pSprite2->statnum == kStatDude) && (actor->xvel() != 0 || actor->yvel() != 0 || actor->zvel() != 0))
if ((pSprite2->statnum == kStatThing || pSprite2->statnum == kStatDude) && (actor->xvel != 0 || actor->yvel != 0 || actor->zvel != 0))
{
if (pSprite2->statnum == kStatThing)
{
@ -4247,14 +4247,14 @@ static void checkCeilHit(DBloodActor* actor)
if (pThingInfo->flags & 1) pSprite2->flags |= 1;
if (pThingInfo->flags & 2) pSprite2->flags |= 4;
// Inlined ?
actor2->xvel() += MulScale(4, pSprite2->x - pSprite->x, 2);
actor2->yvel() += MulScale(4, pSprite2->y - pSprite->y, 2);
actor2->xvel += MulScale(4, pSprite2->x - pSprite->x, 2);
actor2->yvel += MulScale(4, pSprite2->y - pSprite->y, 2);
}
else
{
pSprite2->flags |= 5;
actor2->xvel() += MulScale(4, pSprite2->x - pSprite->x, 2);
actor2->yvel() += MulScale(4, pSprite2->y - pSprite->y, 2);
actor2->xvel += MulScale(4, pSprite2->x - pSprite->x, 2);
actor2->yvel += MulScale(4, pSprite2->y - pSprite->y, 2);
#ifdef NOONE_EXTENSIONS
// add size shroom abilities
@ -4350,7 +4350,7 @@ static void checkHit(DBloodActor* actor)
// add size shroom abilities
if ((actor2->IsPlayerActor() && isShrinked(actor2)) || (actor->IsPlayerActor() && isGrown(actor)))
{
if (actor->xvel() != 0 && actor2->IsDudeActor())
if (actor->xvel != 0 && actor2->IsDudeActor())
{
int mass1 = getDudeInfo(pSprite->type)->mass;
int mass2 = getDudeInfo(pSprite2->type)->mass;
@ -4365,7 +4365,7 @@ static void checkHit(DBloodActor* actor)
{
actKickObject(actor, actor2);
sfxPlay3DSound(actor, 357, -1, 1);
int dmg = (mass1 - mass2) + abs(FixedToInt(actor->xvel()));
int dmg = (mass1 - mass2) + abs(FixedToInt(actor->xvel));
if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg);
}
}
@ -4578,7 +4578,7 @@ static void ProcessTouchObjects(DBloodActor* actor)
}
// enough to reset SpriteHit values
if (nHWall != -1 || actor2) actor->xvel() += 5;
if (nHWall != -1 || actor2) actor->xvel += 5;
}
#endif
@ -4612,9 +4612,9 @@ void actAirDrag(DBloodActor* actor, int a2)
wind_y = MulScale(wind, Sin(pXSector->windAng), 30);
}
}
actor->xvel() += MulScale(wind_x - actor->xvel(), a2, 16);
actor->yvel() += MulScale(wind_y - actor->yvel(), a2, 16);
actor->zvel() -= MulScale(actor->zvel(), a2, 16);
actor->xvel += MulScale(wind_x - actor->xvel, a2, 16);
actor->yvel += MulScale(wind_y - actor->yvel, a2, 16);
actor->zvel -= MulScale(actor->zvel, a2, 16);
}
//---------------------------------------------------------------------------
@ -4638,13 +4638,13 @@ static Collision MoveThing(DBloodActor* actor)
lhit.setNone();
GetActorExtents(actor, &top, &bottom);
const int bakCompat = enginecompatibility_mode;
if (actor->xvel() || actor->yvel())
if (actor->xvel || actor->yvel)
{
short bakCstat = pSprite->cstat;
pSprite->cstat &= ~257;
if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode())
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
lhit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
lhit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12, actor->yvel >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
enginecompatibility_mode = bakCompat; // restore
pSprite->cstat = bakCstat;
assert(nSector >= 0);
@ -4658,7 +4658,7 @@ static Collision MoveThing(DBloodActor* actor)
if (coll.type == kHitWall)
{
int nHitWall = coll.index;
actWallBounceVector(&actor->xvel(), &actor->yvel(), nHitWall, pThingInfo->elastic);
actWallBounceVector(&actor->xvel, &actor->yvel, nHitWall, pThingInfo->elastic);
switch (pSprite->type)
{
case kThingZombieHead:
@ -4678,7 +4678,7 @@ static Collision MoveThing(DBloodActor* actor)
FindSector(pSprite->x, pSprite->y, pSprite->z, &nSector);
}
pSprite->z += actor->zvel() >> 8;
pSprite->z += actor->zvel >> 8;
int ceilZ, floorZ;
Collision ceilColl, floorColl;
@ -4688,7 +4688,7 @@ static Collision MoveThing(DBloodActor* actor)
if ((pSprite->flags & 2) && bottom < floorZ)
{
pSprite->z += 455;
actor->zvel() += 58254;
actor->zvel += 58254;
if (pSprite->type == kThingZombieHead)
{
auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
@ -4703,9 +4703,9 @@ static Collision MoveThing(DBloodActor* actor)
RotateVector(&v2c, &v28, vbx);
RotateVector(&v2c, &v24, v30);
RotateVector(&v28, &v24, v34);
fxActor->xvel() = actor->xvel() + v2c;
fxActor->yvel() = actor->yvel() + v28;
fxActor->zvel() = actor->zvel() + v24;
fxActor->xvel = actor->xvel + v2c;
fxActor->yvel = actor->yvel + v28;
fxActor->zvel = actor->zvel + v24;
}
}
}
@ -4718,30 +4718,30 @@ static Collision MoveThing(DBloodActor* actor)
actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom;
int v20 = actor->zvel() - velFloor[pSprite->sectnum];
int v20 = actor->zvel - velFloor[pSprite->sectnum];
if (v20 > 0)
{
pSprite->flags |= 4;
int vax = actFloorBounceVector(&actor->xvel(), &actor->yvel(), (int*)&v20, pSprite->sectnum, pThingInfo->elastic);
int vax = actFloorBounceVector(&actor->xvel, &actor->yvel, (int*)&v20, pSprite->sectnum, pThingInfo->elastic);
int nDamage = MulScale(vax, vax, 30) - pThingInfo->dmgResist;
if (nDamage > 0) actDamageSprite(actor, actor, kDamageFall, nDamage);
actor->zvel() = v20;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel()) < 0x10000)
actor->zvel = v20;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel) < 0x10000)
{
actor->zvel() = 0;
actor->zvel = 0;
pSprite->flags &= ~4;
}
switch (pSprite->type)
{
case kThingNapalmBall:
if (actor->zvel() == 0 || Chance(0xA000)) actNapalmMove(actor);
if (actor->zvel == 0 || Chance(0xA000)) actNapalmMove(actor);
break;
case kThingZombieHead:
if (abs(actor->zvel()) > 0x80000)
if (abs(actor->zvel) > 0x80000)
{
sfxPlay3DSound(actor, 607, 0, 0);
actDamageSprite(nullptr, actor, kDamageFall, 80);
@ -4749,14 +4749,14 @@ static Collision MoveThing(DBloodActor* actor)
break;
case kThingKickablePail:
if (abs(actor->zvel()) > 0x80000)
if (abs(actor->zvel) > 0x80000)
sfxPlay3DSound(actor, 374, 0, 0);
break;
}
lhit = kHitSector | nSector;
}
else if (actor->zvel() == 0)
else if (actor->zvel == 0)
pSprite->flags &= ~4;
}
@ -4772,16 +4772,16 @@ static Collision MoveThing(DBloodActor* actor)
{
actor->hit.ceilhit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0);
if (actor->zvel() < 0)
if (actor->zvel < 0)
{
actor->xvel() = MulScale(actor->xvel(), 0xc000, 16);
actor->yvel() = MulScale(actor->yvel(), 0xc000, 16);
actor->zvel() = MulScale(-actor->zvel(), 0x4000, 16);
actor->xvel = MulScale(actor->xvel, 0xc000, 16);
actor->yvel = MulScale(actor->yvel, 0xc000, 16);
actor->zvel = MulScale(-actor->zvel, 0x4000, 16);
switch (pSprite->type)
{
case kThingZombieHead:
if (abs(actor->zvel()) > 0x80000)
if (abs(actor->zvel) > 0x80000)
{
sfxPlay3DSound(actor, 607, 0, 0);
actDamageSprite(nullptr, actor, kDamageFall, 80);
@ -4789,7 +4789,7 @@ static Collision MoveThing(DBloodActor* actor)
break;
case kThingKickablePail:
if (abs(actor->zvel()) > 0x80000)
if (abs(actor->zvel) > 0x80000)
sfxPlay3DSound(actor, 374, 0, 0);
break;
}
@ -4799,7 +4799,7 @@ static Collision MoveThing(DBloodActor* actor)
if (bottom >= floorZ)
{
int nVel = approxDist(actor->xvel(), actor->yvel());
int nVel = approxDist(actor->xvel, actor->yvel);
int nVelClipped = ClipHigh(nVel, 0x11111);
Collision& coll = floorColl;
@ -4809,20 +4809,20 @@ static Collision MoveThing(DBloodActor* actor)
auto hitSpr = &hitActor->s();
if ((hitSpr->cstat & 0x30) == 0)
{
actor->xvel() += MulScale(4, pSprite->x - hitSpr->x, 2);
actor->yvel() += MulScale(4, pSprite->y - hitSpr->y, 2);
actor->xvel += MulScale(4, pSprite->x - hitSpr->x, 2);
actor->yvel += MulScale(4, pSprite->y - hitSpr->y, 2);
lhit = actor->hit.hit;
}
}
if (nVel > 0)
{
int t = DivScale(nVelClipped, nVel, 16);
actor->xvel() -= MulScale(t, actor->xvel(), 16);
actor->yvel() -= MulScale(t, actor->yvel(), 16);
actor->xvel -= MulScale(t, actor->xvel, 16);
actor->yvel -= MulScale(t, actor->yvel, 16);
}
}
if (actor->xvel() || actor->yvel())
pSprite->ang = getangle(actor->xvel(), actor->yvel());
if (actor->xvel || actor->yvel)
pSprite->ang = getangle(actor->xvel, actor->yvel);
return lhit;
}
@ -4855,12 +4855,12 @@ void MoveDude(DBloodActor* actor)
assert(nSector >= 0 && nSector < kMaxSectors);
if (actor->xvel() || actor->yvel())
if (actor->xvel || actor->yvel)
{
if (pPlayer && gNoClip)
{
pSprite->x += actor->xvel() >> 12;
pSprite->y += actor->yvel() >> 12;
pSprite->x += actor->xvel >> 12;
pSprite->y += actor->yvel >> 12;
if (!FindSector(pSprite->x, pSprite->y, &nSector))
nSector = pSprite->sectnum;
}
@ -4868,7 +4868,7 @@ void MoveDude(DBloodActor* actor)
{
short bakCstat = pSprite->cstat;
pSprite->cstat &= ~257;
actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, wd, tz, bz, CLIPMASK0);
actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12, actor->yvel >> 12, wd, tz, bz, CLIPMASK0);
if (nSector == -1)
{
nSector = pSprite->sectnum;
@ -4942,7 +4942,7 @@ void MoveDude(DBloodActor* actor)
// ???
}
}
actWallBounceVector((int*)&actor->xvel(), (int*)&actor->yvel(), nHitWall, 0);
actWallBounceVector((int*)&actor->xvel, (int*)&actor->yvel, nHitWall, 0);
break;
}
}
@ -4989,7 +4989,7 @@ void MoveDude(DBloodActor* actor)
if (pUpperLink && (pUpperLink->s().type == kMarkerUpWater || pUpperLink->s().type == kMarkerUpGoo)) bDepth = 1;
if (pLowerLink && (pLowerLink->s().type == kMarkerLowWater || pLowerLink->s().type == kMarkerLowGoo)) bDepth = 1;
if (pPlayer) wd += 16;
if (actor->zvel()) pSprite->z += actor->zvel() >> 8;
if (actor->zvel) pSprite->z += actor->zvel >> 8;
int ceilZ, floorZ;
Collision ceilColl, floorColl;
@ -5026,10 +5026,10 @@ void MoveDude(DBloodActor* actor)
if (vc)
{
pSprite->z += ((vc * 4) / 2) >> 8;
actor->zvel() += vc;
actor->zvel += vc;
}
}
if (pPlayer && actor->zvel() > 0x155555 && !pPlayer->fallScream && pXSprite->height > 0)
if (pPlayer && actor->zvel > 0x155555 && !pPlayer->fallScream && pXSprite->height > 0)
{
const bool playerAlive = (pXSprite->health > 0) || VanillaMode(); // only trigger falling scream if player is alive or vanilla mode
if (playerAlive)
@ -5064,7 +5064,7 @@ void MoveDude(DBloodActor* actor)
pPlayer->bubbleTime = 0;
if (!pPlayer->cantJump && (pPlayer->input.actions & SB_JUMP))
{
actor->zvel() = -0x6aaaa;
actor->zvel = -0x6aaaa;
pPlayer->cantJump = 1;
}
sfxPlay3DSound(actor, 721, -1, 0);
@ -5117,7 +5117,7 @@ void MoveDude(DBloodActor* actor)
pPlayer->posture = 1;
pXSprite->burnTime = 0;
pPlayer->bubbleTime = abs(actor->zvel()) >> 12;
pPlayer->bubbleTime = abs(actor->zvel) >> 12;
evPostActor(actor, 0, kCallbackPlayerBubble);
sfxPlay3DSound(actor, 720, -1, 0);
}
@ -5217,10 +5217,10 @@ void MoveDude(DBloodActor* actor)
{
actor->hit.florhit = floorColl;
pSprite->z += floorZ - bottom;
int v30 = actor->zvel() - velFloor[pSprite->sectnum];
int v30 = actor->zvel - velFloor[pSprite->sectnum];
if (v30 > 0)
{
int vax = actFloorBounceVector((int*)&actor->xvel(), (int*)&actor->yvel(), (int*)&v30, pSprite->sectnum, 0);
int vax = actFloorBounceVector((int*)&actor->xvel, (int*)&actor->yvel, (int*)&v30, pSprite->sectnum, 0);
int nDamage = MulScale(vax, vax, 30);
if (pPlayer)
{
@ -5234,10 +5234,10 @@ void MoveDude(DBloodActor* actor)
nDamage -= 100 << 4;
if (nDamage > 0)
actDamageSprite(actor, actor, kDamageFall, nDamage);
actor->zvel() = v30;
if (abs(actor->zvel()) < 0x10000)
actor->zvel = v30;
if (abs(actor->zvel) < 0x10000)
{
actor->zvel() = velFloor[pSprite->sectnum];
actor->zvel = velFloor[pSprite->sectnum];
pSprite->flags &= ~4;
}
else
@ -5259,9 +5259,9 @@ void MoveDude(DBloodActor* actor)
auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sectnum, pFXs->x, pFXs->y, pFXs->z, 0);
if (pFX2)
{
pFX2->xvel() = Random2(0x6aaaa);
pFX2->yvel() = Random2(0x6aaaa);
pFX2->zvel() = -(int)Random(0xd5555);
pFX2->xvel = Random2(0x6aaaa);
pFX2->yvel = Random2(0x6aaaa);
pFX2->zvel = -(int)Random(0xd5555);
}
}
}
@ -5269,7 +5269,7 @@ void MoveDude(DBloodActor* actor)
}
}
}
else if (actor->zvel() == 0)
else if (actor->zvel == 0)
pSprite->flags &= ~4;
}
@ -5285,8 +5285,8 @@ void MoveDude(DBloodActor* actor)
actor->hit.ceilhit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0);
if (actor->zvel() <= 0 && (pSprite->flags & 4))
actor->zvel() = MulScale(-actor->zvel(), 0x2000, 16);
if (actor->zvel <= 0 && (pSprite->flags & 4))
actor->zvel = MulScale(-actor->zvel, 0x2000, 16);
}
else
actor->hit.ceilhit = 0;
@ -5294,15 +5294,15 @@ void MoveDude(DBloodActor* actor)
GetActorExtents(actor, &top, &bottom);
pXSprite->height = ClipLow(floorZ - bottom, 0) >> 8;
if (actor->xvel() || actor->yvel())
if (actor->xvel || actor->yvel)
{
if (floorColl.type == kHitSprite)
{
auto hitAct = floorColl.actor;
if ((hitAct->s().cstat & 0x30) == 0)
{
actor->xvel() += MulScale(4, pSprite->x - hitAct->s().x, 2);
actor->yvel() += MulScale(4, pSprite->y - hitAct->s().y, 2);
actor->xvel += MulScale(4, pSprite->x - hitAct->s().x, 2);
actor->yvel += MulScale(4, pSprite->y - hitAct->s().y, 2);
return;
}
}
@ -5314,11 +5314,11 @@ void MoveDude(DBloodActor* actor)
int nDrag = gDudeDrag;
if (pXSprite->height > 0)
nDrag -= scale(gDudeDrag, pXSprite->height, 0x100);
actor->xvel() -= mulscale16r(actor->xvel(), nDrag);
actor->yvel() -= mulscale16r(actor->yvel(), nDrag);
actor->xvel -= mulscale16r(actor->xvel, nDrag);
actor->yvel -= mulscale16r(actor->yvel, nDrag);
if (approxDist(actor->xvel(), actor->yvel()) < 0x1000)
actor->xvel() = actor->yvel() = 0;
if (approxDist(actor->xvel, actor->yvel) < 0x1000)
actor->xvel = actor->yvel = 0;
}
}
@ -5345,7 +5345,7 @@ int MoveMissile(DBloodActor* actor)
gHitInfo.clearObj();
if (pSprite->type == kMissileFlameSpray) actAirDrag(actor, 0x1000);
if (actor->GetTarget() != nullptr && (actor->xvel() || actor->yvel() || actor->zvel()))
if (actor->GetTarget() != nullptr && (actor->xvel || actor->yvel || actor->zvel))
{
auto target = actor->GetTarget();
spritetype* pTarget = &target->s();
@ -5357,20 +5357,20 @@ int MoveMissile(DBloodActor* actor)
int vx = missileInfo[pSprite->type - kMissileBase].velocity;
int vy = 0;
RotatePoint(&vx, &vy, (nTargetAngle + 1536) & 2047, 0, 0);
actor->xvel() = vx;
actor->yvel() = vy;
actor->xvel = vx;
actor->yvel = vy;
int dx = pTarget->x - pSprite->x;
int dy = pTarget->y - pSprite->y;
int dz = pTarget->z - pSprite->z;
int deltaz = dz / 10;
if (pTarget->z < pSprite->z) deltaz = -deltaz;
actor->zvel() += deltaz;
actor->zvel += deltaz;
}
}
int vx = actor->xvel() >> 12;
int vy = actor->yvel() >> 12;
int vz = actor->zvel() >> 8;
int vx = actor->xvel >> 12;
int vy = actor->yvel >> 12;
int vz = actor->zvel >> 8;
int top, bottom;
GetActorExtents(actor, &top, &bottom);
int i = 1;
@ -5434,11 +5434,11 @@ int MoveMissile(DBloodActor* actor)
}
if (cliptype >= 0 && cliptype != 3)
{
int nAngle = getangle(actor->xvel(), actor->yvel());
int nAngle = getangle(actor->xvel, actor->yvel);
pos.x -= MulScale(Cos(nAngle), 16, 30);
pos.y -= MulScale(Sin(nAngle), 16, 30);
int nVel = approxDist(actor->xvel(), actor->yvel());
vz -= scale(0x100, actor->zvel(), nVel);
int nVel = approxDist(actor->xvel, actor->yvel);
vz -= scale(0x100, actor->zvel, nVel);
updatesector(pos.x, pos.y, &nSector);
nSector2 = nSector;
}
@ -5624,7 +5624,7 @@ void actExplodeSprite(DBloodActor* actor)
GibSprite(actor, GIBTYPE_5, nullptr, nullptr);
break;
}
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
actPostSprite(actor, kStatExplosion);
pSprite->xrepeat = pSprite->yrepeat = explodeInfo[nType].repeat;
@ -5827,14 +5827,14 @@ static void actCheckThings()
}
if (sector[nSector].floorstat & 64) angle = (angle + GetWallAngle(sector[nSector].wallptr) + 512) & 2047;
actor->xvel() += MulScale(speed, Cos(angle), 30);
actor->yvel() += MulScale(speed, Sin(angle), 30);
actor->xvel += MulScale(speed, Cos(angle), 30);
actor->yvel += MulScale(speed, Sin(angle), 30);
}
}
actAirDrag(actor, 128);
if (((pSprite->index >> 8) & 15) == (gFrameCount & 15) && (pSprite->flags & 2)) pSprite->flags |= 4;
if ((pSprite->flags & 4) || actor->xvel() || actor->yvel() || actor->zvel() || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
{
Collision hit = MoveThing(actor);
if (hit.type)
@ -6122,9 +6122,9 @@ static void actCheckTraps()
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0);
if (pFX)
{
pFX->xvel() = dx + Random2(0x8888);
pFX->yvel() = dy + Random2(0x8888);
pFX->zvel() = Random2(0x8888);
pFX->xvel = dx + Random2(0x8888);
pFX->yvel = dy + Random2(0x8888);
pFX->zvel = Random2(0x8888);
}
x += (dx / 2) >> 12;
y += (dy / 2) >> 12;
@ -6181,7 +6181,7 @@ static void actCheckDudes()
// handle incarnations of custom dude
if (pSprite->type == kDudeModernCustom && pXSprite->txID > 0 && pXSprite->sysData1 == kGenDudeTransformStatus)
{
actor->xvel() = actor->yvel() = 0;
actor->xvel = actor->yvel = 0;
if (seqGetStatus(actor) < 0) genDudeTransform(actor);
}
#endif
@ -6237,7 +6237,7 @@ static void actCheckDudes()
else
pPlayer->chokeEffect = 0;
if (actor->xvel() || actor->yvel())
if (actor->xvel || actor->yvel)
sfxPlay3DSound(actor, 709, 100, 2);
pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0);
@ -6290,14 +6290,14 @@ static void actCheckDudes()
angle = (angle + GetWallAngle(sector[nSector].wallptr) + 512) & 2047;
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
actor->xvel() += dx;
actor->yvel() += dy;
actor->xvel += dx;
actor->yvel += dy;
}
}
if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376);
else actAirDrag(actor, 128);
if ((pSprite->flags & 4) || actor->xvel() || actor->yvel() || actor->zvel() || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
if ((pSprite->flags & 4) || actor->xvel || actor->yvel || actor->zvel || velFloor[pSprite->sectnum] || velCeil[pSprite->sectnum])
MoveDude(actor);
}
}
@ -6335,9 +6335,9 @@ void actCheckFlares()
int z = pTarget->z + pXSprite->targetZ;
vec3_t pos = { x, y, z };
setActorPos(actor, &pos);
actor->xvel() = target->xvel();
actor->yvel() = target->yvel();
actor->zvel() = target->zvel();
actor->xvel = target->xvel;
actor->yvel = target->yvel;
actor->zvel = target->zvel;
}
else
{
@ -6434,9 +6434,9 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
pSprite->x = pSource->x;
pSprite->y = pSource->y;
pSprite->z = pSource->z;
actor->xvel() = source->xvel();
actor->yvel() = source->yvel();
actor->zvel() = source->zvel();
actor->xvel = source->xvel;
actor->yvel = source->yvel;
actor->zvel = source->zvel;
pSprite->flags = 0;
actor->addX();
actor->hit.florhit = 0;
@ -6638,12 +6638,12 @@ DBloodActor* actFireThing(DBloodActor* actor, int a2, int a3, int a4, int thingT
spritetype* pThing = &fired->s();
fired->SetOwner(actor);
pThing->ang = pSprite->ang;
fired->xvel() = MulScale(a6, Cos(pThing->ang), 30);
fired->yvel() = MulScale(a6, Sin(pThing->ang), 30);
fired->zvel() = MulScale(a6, a4, 14);
fired->xvel() += actor->xvel() / 2;
fired->yvel() += actor->yvel() / 2;
fired->zvel() += actor->zvel() / 2;
fired->xvel = MulScale(a6, Cos(pThing->ang), 30);
fired->yvel = MulScale(a6, Sin(pThing->ang), 30);
fired->zvel = MulScale(a6, a4, 14);
fired->xvel += actor->xvel / 2;
fired->yvel += actor->yvel / 2;
fired->zvel += actor->zvel / 2;
return fired;
}
@ -6687,9 +6687,9 @@ void actBuildMissile(DBloodActor* spawned, DBloodActor* actor)
break;
case kMissileFlameHound:
seqSpawn(27, spawned, -1);
spawned->xvel() += actor->xvel() / 2 + Random2(0x11111);
spawned->yvel() += actor->yvel() / 2 + Random2(0x11111);
spawned->zvel() += actor->zvel() / 2 + Random2(0x11111);
spawned->xvel += actor->xvel / 2 + Random2(0x11111);
spawned->yvel += actor->yvel / 2 + Random2(0x11111);
spawned->zvel += actor->zvel / 2 + Random2(0x11111);
break;
case kMissileFireballCerberus:
seqSpawn(61, spawned, dword_2192E0);
@ -6697,16 +6697,16 @@ void actBuildMissile(DBloodActor* spawned, DBloodActor* actor)
break;
case kMissileFireballTchernobog:
seqSpawn(23, spawned, dword_2192D8);
spawned->xvel() += actor->xvel() / 2 + Random2(0x11111);
spawned->yvel() += actor->yvel() / 2 + Random2(0x11111);
spawned->zvel() += actor->zvel() / 2 + Random2(0x11111);
spawned->xvel += actor->xvel / 2 + Random2(0x11111);
spawned->yvel += actor->yvel / 2 + Random2(0x11111);
spawned->zvel += actor->zvel / 2 + Random2(0x11111);
break;
case kMissileFlameSpray:
if (Chance(0x8000)) seqSpawn(0, spawned, -1);
else seqSpawn(1, spawned, -1);
spawned->xvel() += actor->xvel() / 2 + Random2(0x11111);
spawned->yvel() += actor->yvel() / 2 + Random2(0x11111);
spawned->zvel() += actor->zvel() / 2 + Random2(0x11111);
spawned->xvel += actor->xvel / 2 + Random2(0x11111);
spawned->yvel += actor->yvel / 2 + Random2(0x11111);
spawned->zvel += actor->zvel / 2 + Random2(0x11111);
break;
case kMissileFlareAlt:
evPostActor(spawned, 30, kCallbackFXFlareBurst);
@ -6773,9 +6773,9 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
pMissile->yrepeat = pMissileInfo->yrepeat;
pMissile->picnum = pMissileInfo->picnum;
pMissile->ang = (pSprite->ang + pMissileInfo->angleOfs) & 2047;
spawned->xvel() = MulScale(pMissileInfo->velocity, a4, 14);
spawned->yvel() = MulScale(pMissileInfo->velocity, a5, 14);
spawned->zvel() = MulScale(pMissileInfo->velocity, a6, 14);
spawned->xvel = MulScale(pMissileInfo->velocity, a4, 14);
spawned->yvel = MulScale(pMissileInfo->velocity, a5, 14);
spawned->zvel = MulScale(pMissileInfo->velocity, a6, 14);
spawned->SetOwner(actor);
pMissile->cstat |= 1;
spawned->SetTarget(nullptr);
@ -7028,9 +7028,9 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
if (t > 0 && pVectorData->impulse)
{
int t2 = DivScale(pVectorData->impulse, t, 8);
actor->xvel() += MulScale(a4, t2, 16);
actor->yvel() += MulScale(a5, t2, 16);
actor->zvel() += MulScale(a6, t2, 16);
actor->xvel += MulScale(a4, t2, 16);
actor->yvel += MulScale(a5, t2, 16);
actor->zvel += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
@ -7058,9 +7058,9 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
if (t > 0 && pVectorData->impulse)
{
int t2 = DivScale(pVectorData->impulse, t, 8);
actor->xvel() += MulScale(a4, t2, 16);
actor->yvel() += MulScale(a5, t2, 16);
actor->zvel() += MulScale(a6, t2, 16);
actor->xvel += MulScale(a4, t2, 16);
actor->yvel += MulScale(a5, t2, 16);
actor->zvel += MulScale(a6, t2, 16);
}
if (pVectorData->burnTime)
{
@ -7094,7 +7094,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
else if (t3 > FX_NONE) pFX = gFX.fxSpawnActor(t3, nSector, x, y, z, 0);
if (pFX)
{
pFX->zvel() = 0x2222;
pFX->zvel = 0x2222;
pFX->s().ang = (GetWallAngle(nWall) + 512) & 2047;
pFX->s().cstat |= 16;
}
@ -7117,9 +7117,9 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
if (pXSprite->physAttr & kPhysDebrisVector) {
int impulse = DivScale(pVectorData->impulse, ClipLow(actor->spriteMass.mass, 10), 6);
actor->xvel() += MulScale(a4, impulse, 16);
actor->yvel() += MulScale(a5, impulse, 16);
actor->zvel() += MulScale(a6, impulse, 16);
actor->xvel += MulScale(a4, impulse, 16);
actor->yvel += MulScale(a5, impulse, 16);
actor->zvel += MulScale(a6, impulse, 16);
if (pVectorData->burnTime != 0) {
if (!pXSprite->burnTime) evPostActor(actor, 0, kCallbackFXFlameLick);
@ -7187,9 +7187,9 @@ void FireballSeqCallback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel();
pFX->yvel() = actor->yvel();
pFX->zvel() = actor->zvel();
pFX->xvel = actor->xvel;
pFX->yvel = actor->yvel;
pFX->zvel = actor->zvel;
}
}
@ -7199,9 +7199,9 @@ void NapalmSeqCallback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel();
pFX->yvel() = actor->yvel();
pFX->zvel() = actor->zvel();
pFX->xvel = actor->xvel;
pFX->yvel = actor->yvel;
pFX->zvel = actor->zvel;
}
}
@ -7211,9 +7211,9 @@ void Fx32Callback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel();
pFX->yvel() = actor->yvel();
pFX->zvel() = actor->zvel();
pFX->xvel = actor->xvel;
pFX->yvel = actor->yvel;
pFX->zvel = actor->zvel;
}
}
@ -7223,9 +7223,9 @@ void Fx33Callback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel();
pFX->yvel() = actor->yvel();
pFX->zvel() = actor->zvel();
pFX->xvel = actor->xvel;
pFX->yvel = actor->yvel;
pFX->zvel = actor->zvel;
}
}

View file

@ -262,8 +262,8 @@ void aiChooseDirection(DBloodActor* actor, int a3)
int vc = ((a3 + 1024 - pSprite->ang) & 2047) - 1024;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
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;
@ -314,8 +314,8 @@ void aiMoveForward(DBloodActor* actor)
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
if (abs(nAng) > 341)
return;
actor->xvel() += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel() += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
}
//---------------------------------------------------------------------------
@ -354,8 +354,8 @@ void aiMoveDodge(DBloodActor* actor)
{
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -363,8 +363,8 @@ void aiMoveDodge(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
}

View file

@ -223,8 +223,8 @@ static void batMoveDodgeUp(DBloodActor* actor)
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -232,9 +232,9 @@ static void batMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x52aaa;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x52aaa;
}
static void batMoveDodgeDown(DBloodActor* actor)
@ -250,8 +250,8 @@ static void batMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -259,9 +259,9 @@ static void batMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void batThinkChase(DBloodActor* actor)
@ -347,16 +347,16 @@ static void batMoveForward(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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 >> 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void batMoveSwoop(DBloodActor* actor)
@ -381,14 +381,14 @@ static void batMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void batMoveFly(DBloodActor* actor)
@ -413,14 +413,14 @@ static void batMoveFly(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x2d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x2d555;
}
void batMoveToCeil(DBloodActor* actor)

View file

@ -468,8 +468,8 @@ static void beastMoveForward(DBloodActor* actor)
int nDist = approxDist(dx, dy);
if (nDist <= 0x400 && Random(64) < 32)
return;
actor->xvel() += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel() += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(pSprite->ang), 30);
actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(pSprite->ang), 30);
}
static void sub_628A0(DBloodActor* actor)
@ -493,16 +493,16 @@ static void sub_628A0(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = 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_62AE0(DBloodActor* actor)
@ -532,14 +532,14 @@ static void sub_62AE0(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
}
static void sub_62D7C(DBloodActor* actor)
@ -570,14 +570,14 @@ static void sub_62D7C(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 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

@ -236,8 +236,8 @@ static void eelMoveDodgeUp(DBloodActor* actor)
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -245,9 +245,9 @@ static void eelMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x8000;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
}
static void eelMoveDodgeDown(DBloodActor* actor)
@ -263,8 +263,8 @@ static void eelMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -272,9 +272,9 @@ static void eelMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void eelThinkChase(DBloodActor* actor)
@ -355,16 +355,16 @@ static void eelMoveForward(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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 >> 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void eelMoveSwoop(DBloodActor* actor)
@ -386,14 +386,14 @@ static void eelMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x22222;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x22222;
}
static void eelMoveAscend(DBloodActor* actor)
@ -415,14 +415,14 @@ static void eelMoveAscend(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x8000;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x8000;
}
void eelMoveToCeil(DBloodActor* actor)

View file

@ -332,16 +332,16 @@ static void sub_65D04(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = 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)
@ -372,14 +372,14 @@ static void sub_65F44(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -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)
@ -410,14 +410,14 @@ static void sub_661E0(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 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

@ -107,9 +107,9 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
if (tt1.at10)
{
int t = DivScale(nDist, tt1.at10, 12);
x2 += (actor2->xvel() * t) >> 12;
y2 += (actor2->yvel() * t) >> 12;
z2 += (actor2->zvel() * t) >> 8;
x2 += (actor2->xvel * t) >> 12;
y2 += (actor2->yvel * t) >> 12;
z2 += (actor2->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);
@ -187,9 +187,9 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
if (tt1.at10)
{
int t = DivScale(nDist, tt1.at10, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);

View file

@ -140,9 +140,9 @@ void BlastSSeqCallback(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);
@ -306,8 +306,8 @@ static void gargMoveDodgeUp(DBloodActor* actor)
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -315,9 +315,9 @@ static void gargMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x1d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
}
static void gargMoveDodgeDown(DBloodActor* actor)
@ -337,8 +337,8 @@ static void gargMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -346,9 +346,9 @@ static void gargMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void gargThinkChase(DBloodActor* actor)
@ -570,16 +570,16 @@ static void gargMoveForward(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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 >> 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void gargMoveSlow(DBloodActor* actor)
@ -608,20 +608,20 @@ static void gargMoveSlow(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
t2 >>= 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudeGargoyleFlesh:
actor->zvel() = 0x44444;
actor->zvel = 0x44444;
break;
case kDudeGargoyleStone:
actor->zvel() = 0x35555;
actor->zvel = 0x35555;
break;
}
}
@ -652,19 +652,19 @@ static void gargMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudeGargoyleFlesh:
actor->zvel() = t1;
actor->zvel = t1;
break;
case kDudeGargoyleStone:
actor->zvel() = t1;
actor->zvel = t1;
break;
}
}
@ -695,19 +695,19 @@ static void gargMoveFly(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudeGargoyleFlesh:
actor->zvel() = -t1;
actor->zvel = -t1;
break;
case kDudeGargoyleStone:
actor->zvel() = -t1;
actor->zvel = -t1;
break;
}
}

View file

@ -123,9 +123,9 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);
@ -284,8 +284,8 @@ static void ghostMoveDodgeUp(DBloodActor* actor)
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -293,9 +293,9 @@ static void ghostMoveDodgeUp(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -0x1d555;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -0x1d555;
}
static void ghostMoveDodgeDown(DBloodActor* actor)
@ -316,8 +316,8 @@ static void ghostMoveDodgeDown(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int dx = actor->xvel();
int dy = actor->yvel();
int dx = actor->xvel;
int dy = actor->yvel;
int t1 = DMulScale(dx, nCos, dy, nSin, 30);
int t2 = DMulScale(dx, nSin, -dy, nCos, 30);
if (pXSprite->dodgeDir > 0)
@ -325,9 +325,9 @@ static void ghostMoveDodgeDown(DBloodActor* actor)
else
t2 -= pDudeInfo->sideSpeed;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 0x44444;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = 0x44444;
}
static void ghostThinkChase(DBloodActor* actor)
@ -464,16 +464,16 @@ static void ghostMoveForward(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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 >> 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
static void ghostMoveSlow(DBloodActor* actor)
@ -502,17 +502,17 @@ static void ghostMoveSlow(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
t2 >>= 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudePhantasm:
actor->zvel() = 0x44444;
actor->zvel = 0x44444;
break;
}
}
@ -543,16 +543,16 @@ static void ghostMoveSwoop(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudePhantasm:
actor->zvel() = t1;
actor->zvel = t1;
break;
}
}
@ -583,16 +583,16 @@ static void ghostMoveFly(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
switch (pSprite->type) {
case kDudePhantasm:
actor->zvel() = -t1;
actor->zvel = -t1;
break;
}
}

View file

@ -328,16 +328,16 @@ static void sub_6CB00(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = 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_6CD74(DBloodActor* actor)
@ -367,14 +367,14 @@ static void sub_6CD74(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = -dz;
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel = -dz;
}
static void sub_6D03C(DBloodActor* actor)
@ -404,14 +404,14 @@ static void sub_6D03C(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->zvel() = 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

@ -131,9 +131,9 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
case kDudeSpiderBrown:
case kDudeSpiderRed:
case kDudeSpiderBlack:
actor->xvel() = IntToFixed(dx);
actor->yvel() = IntToFixed(dy);
actor->zvel() = IntToFixed(dz);
actor->xvel = IntToFixed(dx);
actor->yvel = IntToFixed(dy);
actor->zvel = IntToFixed(dz);
break;
}
}

View file

@ -90,9 +90,9 @@ void sub_71BD4(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);
@ -165,9 +165,9 @@ void sub_720AC(int, DBloodActor* actor)
if (tt.at10)
{
int t = DivScale(nDist, tt.at10, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int tx = x + MulScale(Cos(pSprite->ang), nDist, 30);
int ty = y + MulScale(Sin(pSprite->ang), nDist, 30);

View file

@ -236,7 +236,7 @@ void genDudeAttack1(int, DBloodActor* actor)
if (actor->GetTarget() == nullptr) return;
int dx, dy, dz;
actor->xvel() = actor->yvel() = 0;
actor->xvel = actor->yvel = 0;
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
short dispersion = pExtra->baseDispersion;
@ -518,8 +518,8 @@ static void unicultThinkChase(DBloodActor* actor)
// quick hack to prevent spinning around or changing attacker's sprite angle on high movement speeds
// when attacking the target. It happens because vanilla function takes in account x and y velocity,
// so i use fake velocity with fixed value and pass it as argument.
int xvelocity = actor->xvel();
int yvelocity = actor->yvel();
int xvelocity = actor->xvel;
int yvelocity = actor->yvel;
if (inAttack(pXSprite->aiState))
xvelocity = yvelocity = ClipLow(pSprite->clipdist >> 1, 1);
@ -759,7 +759,7 @@ static void unicultThinkChase(DBloodActor* actor)
int nType = curWeapon - kTrapExploder; const EXPLOSION* pExpl = &explodeInfo[nType];
if (CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1))
{
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
if (doExplosion(actor, nType) && pXSprite->health > 0)
actDamageSprite(actor, actor, kDamageExplode, 65535);
}
@ -1176,16 +1176,16 @@ void aiGenDudeMoveForward(DBloodActor* actor)
return;
int nCos = Cos(pSprite->ang);
int nSin = Sin(pSprite->ang);
int vx = actor->xvel();
int vy = actor->yvel();
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 >> 1;
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
actor->xvel = DMulScale(t1, nCos, t2, nSin, 30);
actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30);
}
else
{
@ -1200,8 +1200,8 @@ void aiGenDudeMoveForward(DBloodActor* actor)
int cos = Cos(pSprite->ang);
int frontSpeed = actor->genDudeExtra.moveSpeed;
actor->xvel() += MulScale(cos, frontSpeed, 30);
actor->yvel() += MulScale(sin, frontSpeed, 30);
actor->xvel += MulScale(cos, frontSpeed, 30);
actor->yvel += MulScale(sin, frontSpeed, 30);
}
}
@ -1865,8 +1865,8 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
if (nDist != 0 && cansee(pSprite->x, pSprite->y, top, pSprite->sectnum, x, y, z, pTarget->sectnum))
{
int t = DivScale(nDist, 0x1aaaaa, 12);
x += (actTarget->xvel() * t) >> 12;
y += (actTarget->yvel() * t) >> 12;
x += (actTarget->xvel * t) >> 12;
y += (actTarget->yvel * t) >> 12;
int angBak = pSprite->ang;
pSprite->ang = getangle(x - pSprite->x, y - pSprite->y);
int dx = bcos(pSprite->ang);

View file

@ -98,6 +98,7 @@ public:
GENDUDEEXTRA genDudeExtra;
DBloodActor* prevmarker; // needed by the nnext marker code. This originally hijacked targetX in XSPRITE
POINT3D basePoint;
int xvel, yvel, zvel;
int cumulDamage; // this one's transient and does not need to be saved.
bool explosionhackflag; // this originally hijacked the target field which is not safe when working with pointers.
@ -114,6 +115,7 @@ public:
spriteMass = {};
hit = {};
basePoint = {};
xvel = yvel = zvel = 0;
}
bool hasX() { return sprite[index].extra > 0; }
void addX()
@ -122,9 +124,6 @@ public:
}
spritetype& s() { return sprite[index]; }
XSPRITE& x() { return xsprite[sprite[index].extra]; } // calling this does not validate the xsprite!
int& xvel() { return Blood::xvel[index]; }
int& yvel() { return Blood::yvel[index]; }
int& zvel() { return Blood::zvel[index]; }
int GetIndex() { return s().time; } // For error printing only! This is only identical with the sprite index for items spawned at map start.
void SetOwner(DBloodActor* own)

View file

@ -49,9 +49,9 @@ void fxFlameLick(DBloodActor* actor, int) // 0
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(-dx);
pFX->yvel() = actor->yvel() + Random2(-dy);
pFX->zvel() = actor->zvel() - Random(0x1aaaa);
pFX->xvel = actor->xvel + Random2(-dx);
pFX->yvel = actor->yvel + Random2(-dy);
pFX->zvel = actor->zvel - Random(0x1aaaa);
}
}
if (pXSprite->burnTime > 0)
@ -72,7 +72,7 @@ void FlareBurst(DBloodActor* actor, int) // 2
{
if (!actor) return;
spritetype *pSprite = &actor->s();
int nAngle = getangle(actor->xvel(), actor->yvel());
int nAngle = getangle(actor->xvel, actor->yvel);
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
{
@ -94,9 +94,9 @@ void FlareBurst(DBloodActor* actor, int) // 2
dz >>= 1;
}
RotateVector(&dx, &dy, nAngle);
spawnedactor->xvel() += dx;
spawnedactor->yvel() += dy;
spawnedactor->zvel() += dz;
spawnedactor->xvel += dx;
spawnedactor->yvel += dy;
spawnedactor->zvel += dz;
evPostActor(spawnedactor, 960, kCallbackRemove);
}
evPostActor(actor, 0, kCallbackRemove);
@ -109,9 +109,9 @@ void fxFlareSpark(DBloodActor* actor, int) // 3
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() - Random(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel - Random(0x1aaaa);
}
evPostActor(actor, 4, kCallbackFXFlareSpark);
}
@ -123,9 +123,9 @@ void fxFlareSparkLite(DBloodActor* actor, int) // 4
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() - Random(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel - Random(0x1aaaa);
}
evPostActor(actor, 12, kCallbackFXFlareSparkLite);
}
@ -142,9 +142,9 @@ void fxZombieBloodSpurt(DBloodActor* actor, int) // 5
auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x11111);
pFX->yvel() = actor->yvel() + Random2(0x11111);
pFX->zvel() = actor->zvel() - 0x6aaaa;
pFX->xvel = actor->xvel + Random2(0x11111);
pFX->yvel = actor->yvel + Random2(0x11111);
pFX->zvel = actor->zvel - 0x6aaaa;
}
if (pXSprite->data1 > 0)
{
@ -167,9 +167,9 @@ void fxBloodSpurt(DBloodActor* actor, int) // 6
if (pFX)
{
pFX->s().ang = 0;
pFX->xvel() = actor->xvel()>>8;
pFX->yvel() = actor->yvel()>>8;
pFX->zvel() = actor->zvel()>>8;
pFX->xvel = actor->xvel>>8;
pFX->yvel = actor->yvel>>8;
pFX->zvel = actor->zvel>>8;
}
evPostActor(actor, 6, kCallbackFXBloodSpurt);
}
@ -182,9 +182,9 @@ void fxArcSpark(DBloodActor* actor, int) // 7
auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x10000);
pFX->yvel() = actor->yvel() + Random2(0x10000);
pFX->zvel() = actor->zvel() - Random(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x10000);
pFX->yvel = actor->yvel + Random2(0x10000);
pFX->zvel = actor->zvel - Random(0x1aaaa);
}
evPostActor(actor, 3, kCallbackFXArcSpark);
}
@ -194,7 +194,7 @@ void fxDynPuff(DBloodActor* actor, int) // 8
{
if (!actor) return;
spritetype *pSprite = &actor->s();
if (actor->zvel())
if (actor->zvel)
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30);
@ -203,9 +203,9 @@ void fxDynPuff(DBloodActor* actor, int) // 8
auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sectnum, x, y, z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel();
pFX->yvel() = actor->yvel();
pFX->zvel() = actor->zvel();
pFX->xvel = actor->xvel;
pFX->yvel = actor->yvel;
pFX->zvel = actor->zvel;
}
}
evPostActor(actor, 12, kCallbackFXDynPuff);
@ -246,7 +246,7 @@ void Respawn(DBloodActor* actor, int) // 9
pSprite->type = pSprite->inittype;
actor->SetOwner(nullptr);
pSprite->flags &= ~kHitagRespawn;
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
pXSprite->respawnPending = 0;
pXSprite->burnTime = 0;
pXSprite->isTriggered = 0;
@ -317,9 +317,9 @@ void PlayerBubble(DBloodActor* actor, int) // 10
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() + Random2(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel + Random2(0x1aaaa);
}
}
evPostActor(actor, 4, kCallbackPlayerBubble);
@ -332,7 +332,7 @@ void EnemyBubble(DBloodActor* actor, int) // 11
spritetype *pSprite = &actor->s();
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
for (int i = 0; i < (abs(actor->zvel())>>18); i++)
for (int i = 0; i < (abs(actor->zvel)>>18); i++)
{
int nDist = (pSprite->xrepeat*(tileWidth(pSprite->picnum)/2))>>2;
int nAngle = Random(2048);
@ -342,9 +342,9 @@ void EnemyBubble(DBloodActor* actor, int) // 11
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() + Random2(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel + Random2(0x1aaaa);
}
}
evPostActor(actor, 4, kCallbackEnemeyBubble);
@ -423,9 +423,9 @@ void fxTeslaAlt(DBloodActor* actor, int) // 15
auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX)
{
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() - Random(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel - Random(0x1aaaa);
}
evPostActor(actor, 3, kCallbackFXTeslaAlt);
}
@ -445,13 +445,13 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
int top, bottom; GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ - bottom;
int zv = actor->zvel() - velFloor[pSprite->sectnum];
int zv = actor->zvel - velFloor[pSprite->sectnum];
if (actor->zvel() == 0) sleeveStopBouncing(actor);
if (actor->zvel == 0) sleeveStopBouncing(actor);
else if (zv > 0) {
actFloorBounceVector((int*)& actor->xvel(), (int*)& actor->yvel(), &zv, pSprite->sectnum, 0x9000);
actor->zvel() = zv;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel()) < 0x20000) {
actFloorBounceVector((int*)& actor->xvel, (int*)& actor->yvel, &zv, pSprite->sectnum, 0x9000);
actor->zvel = zv;
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel) < 0x20000) {
sleeveStopBouncing(actor);
return;
}
@ -475,7 +475,7 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
void sleeveStopBouncing(DBloodActor* actor)
{
auto pSprite = &actor->s();
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
if (pSprite->extra > 0) seqKill(3, pSprite->extra);
sfxKill3DSound(pSprite, -1, -1);
@ -535,9 +535,9 @@ void fxPodBloodSpray(DBloodActor* actor, int) // 18
if (pFX)
{
pFX->s().ang = 0;
pFX->xvel() = actor->xvel() >> 8;
pFX->yvel() = actor->yvel() >> 8;
pFX->zvel() = actor->zvel() >> 8;
pFX->xvel = actor->xvel >> 8;
pFX->yvel = actor->yvel >> 8;
pFX->zvel = actor->zvel >> 8;
}
evPostActor(actor, 6, kCallbackFXPodBloodSpray);
}
@ -609,7 +609,7 @@ void sub_76A08(DBloodActor *actor, spritetype *pSprite2, PLAYER *pPlayer) // ???
pSprite->ang = pSprite2->ang;
ChangeActorSect(actor, pSprite2->sectnum);
sfxPlay3DSound(pSprite2, 201, -1, 0);
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
viewBackupSpriteLoc(pSprite->index, pSprite);
if (pPlayer)
{

View file

@ -49,8 +49,6 @@ XSPRITE xsprite[kMaxXSprites];
XSECTOR xsector[kMaxXSectors];
XWALL xwall[kMaxXWalls];
int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
unsigned short nextXSprite[kMaxXSprites];
int XWallsUsed, XSectorsUsed;
@ -198,7 +196,7 @@ int InsertSprite(int nSector, int nStat)
actor->SetOwner(nullptr);
pSprite->extra = -1;
pSprite->index = nSprite;
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
Numsprites++;

View file

@ -305,8 +305,6 @@ extern FixedBitArray<MAXSPRITES> activeXSprites;
extern char qsector_filler[kMaxSectors];
extern int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
extern int gVisibility;
extern int gMapRev, gMattId, gSkyCount;
extern const char *gItemText[];

View file

@ -201,11 +201,11 @@ void CFX::fxProcess(void)
assert(pSprite->type < kFXMax);
FXDATA *pFXData = &gFXData[pSprite->type];
actAirDrag(actor, pFXData->drag);
pSprite->x += actor->xvel()>>12;
pSprite->y += actor->yvel()>>12;
pSprite->z += actor->zvel()>>8;
pSprite->x += actor->xvel>>12;
pSprite->y += actor->yvel>>12;
pSprite->z += actor->zvel>>8;
// Weird...
if (actor->xvel() || (actor->yvel() && pSprite->z >= sector[pSprite->sectnum].floorz))
if (actor->xvel || (actor->yvel && pSprite->z >= sector[pSprite->sectnum].floorz))
{
updatesector(pSprite->x, pSprite->y, &nSector);
if (nSector == -1)
@ -230,7 +230,7 @@ void CFX::fxProcess(void)
ChangeActorSect(actor, nSector);
}
}
if (actor->xvel() || actor->yvel() || actor->zvel())
if (actor->xvel || actor->yvel || actor->zvel)
{
int32_t floorZ, ceilZ;
getzsofslope(nSector, pSprite->x, pSprite->y, &ceilZ, &floorZ);
@ -251,7 +251,7 @@ void CFX::fxProcess(void)
continue;
}
}
actor->zvel() += pFXData->gravity;
actor->zvel += pFXData->gravity;
}
}
@ -269,9 +269,9 @@ void fxSpawnBlood(DBloodActor *actor, int )
if (bloodactor)
{
bloodactor->s().ang = 1024;
bloodactor->xvel() = Random2(0x6aaaa);
bloodactor->yvel() = Random2(0x6aaaa);
bloodactor->zvel() = -(int)Random(0x10aaaa)-100;
bloodactor->xvel = Random2(0x6aaaa);
bloodactor->yvel = Random2(0x6aaaa);
bloodactor->zvel = -(int)Random(0x10aaaa)-100;
evPostActor(bloodactor, 8, kCallbackFXBloodSpurt);
}
}
@ -294,9 +294,9 @@ void fxSpawnPodStuff(DBloodActor* actor, int )
if (spawnactor)
{
spawnactor->s().ang = 1024;
spawnactor->xvel() = Random2(0x6aaaa);
spawnactor->yvel() = Random2(0x6aaaa);
spawnactor->zvel() = -(int)Random(0x10aaaa)-100;
spawnactor->xvel = Random2(0x6aaaa);
spawnactor->yvel = Random2(0x6aaaa);
spawnactor->zvel = -(int)Random(0x10aaaa)-100;
evPostActor(spawnactor, 8, kCallbackFXPodBloodSpray);
}
}
@ -315,9 +315,9 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
pBrass->s().ang = Random(2047);
int nDist = (a4 << 18) / 120 + Random2(((a4 / 4) << 18) / 120);
int nAngle = pSprite->ang + Random2(56) + 512;
pBrass->xvel() = MulScale(nDist, Cos(nAngle), 30);
pBrass->yvel() = MulScale(nDist, Sin(nAngle), 30);
pBrass->zvel() = actor->zvel() - (0x20000 + (Random2(40) << 18) / 120);
pBrass->xvel = MulScale(nDist, Cos(nAngle), 30);
pBrass->yvel = MulScale(nDist, Sin(nAngle), 30);
pBrass->zvel = actor->zvel - (0x20000 + (Random2(40) << 18) / 120);
}
}
@ -335,9 +335,9 @@ void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4)
pShell->s().ang = Random(2047);
int nDist = (a4 << 18) / 120 + Random2(((a4 / 4) << 18) / 120);
int nAngle = pSprite->ang + Random2(56) + 512;
pShell->xvel() = MulScale(nDist, Cos(nAngle), 30);
pShell->yvel() = MulScale(nDist, Sin(nAngle), 30);
pShell->zvel() = actor->zvel() - (0x20000 + (Random2(20) << 18) / 120);
pShell->xvel = MulScale(nDist, Cos(nAngle), 30);
pShell->yvel = MulScale(nDist, Sin(nAngle), 30);
pShell->zvel = actor->zvel - (0x20000 + (Random2(20) << 18) / 120);
}
}

View file

@ -315,34 +315,34 @@ void GibFX(DBloodActor* actor, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *pV
pFX->s().pal = pSprite->pal;
if (pVel)
{
pFX->xvel() = pVel->vx+Random2(pGFX->atd);
pFX->yvel() = pVel->vy+Random2(pGFX->atd);
pFX->zvel() = pVel->vz-Random(pGFX->at11);
pFX->xvel = pVel->vx+Random2(pGFX->atd);
pFX->yvel = pVel->vy+Random2(pGFX->atd);
pFX->zvel = pVel->vz-Random(pGFX->at11);
}
else
{
pFX->xvel() = Random2((pGFX->atd<<18)/120);
pFX->yvel() = Random2((pGFX->atd<<18)/120);
pFX->xvel = Random2((pGFX->atd<<18)/120);
pFX->yvel = Random2((pGFX->atd<<18)/120);
switch(pSprite->cstat&48)
{
case 16:
pFX->zvel() = Random2((pGFX->at11<<18)/120);
pFX->zvel = Random2((pGFX->at11<<18)/120);
break;
default:
if (dz2 < dz1 && dz2 < 0x4000)
{
pFX->zvel() = 0;
pFX->zvel = 0;
}
else if (dz2 > dz1 && dz1 < 0x4000)
{
pFX->zvel() = -(int)Random((abs(pGFX->at11)<<18)/120);
pFX->zvel = -(int)Random((abs(pGFX->at11)<<18)/120);
}
else
{
if ((pGFX->at11<<18)/120 < 0)
pFX->zvel() = -(int)Random((abs(pGFX->at11)<<18)/120);
pFX->zvel = -(int)Random((abs(pGFX->at11)<<18)/120);
else
pFX->zvel() = Random2((pGFX->at11<<18)/120);
pFX->zvel = Random2((pGFX->at11<<18)/120);
}
break;
}
@ -392,31 +392,31 @@ void GibThing(DBloodActor* actor, GIBTHING *pGThing, CGibPosition *pPos, CGibVel
pGib->picnum = pGThing->Kills;
if (pVel)
{
gibactor->xvel() = pVel->vx+Random2(pGThing->atc);
gibactor->yvel() = pVel->vy+Random2(pGThing->atc);
gibactor->zvel() = pVel->vz-Random(pGThing->at10);
gibactor->xvel = pVel->vx+Random2(pGThing->atc);
gibactor->yvel = pVel->vy+Random2(pGThing->atc);
gibactor->zvel = pVel->vz-Random(pGThing->at10);
}
else
{
gibactor->xvel() = Random2((pGThing->atc<<18)/120);
gibactor->yvel() = Random2((pGThing->atc<<18)/120);
gibactor->xvel = Random2((pGThing->atc<<18)/120);
gibactor->yvel = Random2((pGThing->atc<<18)/120);
switch (pSprite->cstat&48)
{
case 16:
gibactor->zvel() = Random2((pGThing->at10<<18)/120);
gibactor->zvel = Random2((pGThing->at10<<18)/120);
break;
default:
if (dz2 < dz1 && dz2 < 0x4000)
{
gibactor->zvel() = 0;
gibactor->zvel = 0;
}
else if (dz2 > dz1 && dz1 < 0x4000)
{
gibactor->zvel() = -(int)Random((pGThing->at10<<18)/120);
gibactor->zvel = -(int)Random((pGThing->at10<<18)/120);
}
else
{
gibactor->zvel() = Random2((pGThing->at10<<18)/120);
gibactor->zvel = Random2((pGThing->at10<<18)/120);
}
break;
}
@ -464,15 +464,15 @@ void GibFX(int nWall, GIBFX * pGFX, int a3, int a4, int a5, int a6, CGibVelocity
pGib->s().pal = pWall->pal;
if (!pVel)
{
pGib->xvel() = Random2((pGFX->atd<<18)/120);
pGib->yvel() = Random2((pGFX->atd<<18)/120);
pGib->zvel() = -(int)Random((pGFX->at11<<18)/120);
pGib->xvel = Random2((pGFX->atd<<18)/120);
pGib->yvel = Random2((pGFX->atd<<18)/120);
pGib->zvel = -(int)Random((pGFX->at11<<18)/120);
}
else
{
pGib->xvel() = Random2((pVel->vx << 18) / 120);
pGib->yvel() = Random2((pVel->vy << 18) / 120);
pGib->zvel() = -(int)Random((pVel->vz<<18)/120);
pGib->xvel = Random2((pVel->vx << 18) / 120);
pGib->yvel = Random2((pVel->vy << 18) / 120);
pGib->zvel = -(int)Random((pVel->vz<<18)/120);
}
}
}

View file

@ -478,14 +478,22 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DBloodActor& w, DB
if (arc.BeginObject(keyname))
{
#ifndef OLD_SAVEGAME
arc("xvel", w.xvel, def->xvel)
("yvel", w.yvel, def->yvel)
("zvel", w.zvel, def->zvel);
#endif
// The rest is only relevant if the actor has an xsprite.
if (w.hasX())
{
arc("dudeslope", w.dudeSlope, def->dudeSlope)
("dudeextra", w.dudeExtra, def->dudeExtra)
("explosionflag", w.explosionhackflag, def->explosionhackflag)
("spritehit", w.hit, def->hit)
("basepoint", w.basePoint, def->basePoint);
("spritehit", w.hit, def->hit);
#ifndef OLD_SAVEGAME
arc("basepoint", w.basePoint, def->basePoint);
#endif
if (gModernMap)
{
@ -715,17 +723,29 @@ void SerializeState(FSerializer& arc)
.Array("xwall", xwall, XWallsUsed) // todo
.Array("xsector", xsector, XSectorsUsed)
.SparseArray("actors", bloodActors, kMaxSprites, activeSprites)
.SparseArray("xsprite", xsprite, kMaxXSprites, activeXSprites)
.SparseArray("xvel", xvel, kMaxSprites, activeSprites)
.SparseArray("yvel", yvel, kMaxSprites, activeSprites)
.SparseArray("zvel", zvel, kMaxSprites, activeSprites);
.SparseArray("xsprite", xsprite, kMaxXSprites, activeXSprites);
#ifdef OLD_SAVEGAME
POINT3D baseSprite[kMaxSprites];
for (int i = 0; i < kMaxSprites; i++) baseSprite[i] = bloodActors[i].basePoint;
arc.SparseArray("basesprite", baseSprite, kMaxSprites, activeSprites);
if (arc.isReading()) for (int i = 0; i < kMaxSprites; i++) if (activeSprites[i]) bloodActors[i].basePoint = baseSprite[i];
int xvel[kMaxSprites], yvel[kMaxSprites], zvel[kMaxSprites];
for (int i = 0; i < kMaxSprites; i++)
{
baseSprite[i] = bloodActors[i].basePoint;
xvel[i] = bloodActors[i].xvel;
yvel[i] = bloodActors[i].yvel;
zvel[i] = bloodActors[i].zvel;
}
arc.SparseArray("basesprite", baseSprite, kMaxSprites, activeSprites)
.SparseArray("xvel", xvel, kMaxSprites, activeSprites)
.SparseArray("yvel", yvel, kMaxSprites, activeSprites)
.SparseArray("zvel", zvel, kMaxSprites, activeSprites);
if (arc.isReading()) for (int i = 0; i < kMaxSprites; i++) if (activeSprites[i])
{
bloodActors[i].basePoint = baseSprite[i];
bloodActors[i].xvel = xvel[i];
bloodActors[i].yvel = yvel[i];
bloodActors[i].zvel = zvel[i];
}
#endif
arc.EndObject();
}

View file

@ -1108,7 +1108,7 @@ static void windGenDoVerticalWind(int factor, int nSector)
case kStatFree:
continue;
case kStatFX:
if (actor->zvel()) break;
if (actor->zvel) break;
continue;
case kStatThing:
case kStatDude:
@ -1122,16 +1122,16 @@ static void windGenDoVerticalWind(int factor, int nSector)
if (maxZfound && pSpr->z <= maxZ)
{
zdiff = pSpr->z - maxZ;
if (actor->zvel() < 0) actor->zvel() += MulScale(actor->zvel() >> 4, zdiff, 16);
if (actor->zvel < 0) actor->zvel += MulScale(actor->zvel >> 4, zdiff, 16);
continue;
}
val = -MulScale(factor * 64, 0x10000, 16);
if (actor->zvel() >= 0) actor->zvel() += val;
else actor->zvel() = val;
if (actor->zvel >= 0) actor->zvel += val;
else actor->zvel = val;
pSpr->z += actor->zvel() >> 12;
pSpr->z += actor->zvel >> 12;
}
@ -1406,8 +1406,8 @@ void nnExtProcessSuperSprites()
angle = (angle + GetWallAngle(sector[pDebris->sectnum].wallptr) + 512) & 2047;
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
debrisactor->xvel() += dx;
debrisactor->yvel() += dy;
debrisactor->xvel += dx;
debrisactor->yvel += dy;
}
}
@ -1422,11 +1422,11 @@ void nnExtProcessSuperSprites()
auto pact = pPlayer->actor();
if (pact->hit.hit.type == kHitSprite && pact->hit.hit.index == nDebris)
{
int nSpeed = approxDist(pact->xvel(), pact->yvel());
int nSpeed = approxDist(pact->xvel, pact->yvel);
nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3));
debrisactor->xvel() += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
debrisactor->yvel() += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);
debrisactor->xvel += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
debrisactor->yvel += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);
debrisactor->hit.hit = pPlayer->pSprite->index | 0xc000;
}
@ -1434,17 +1434,17 @@ void nnExtProcessSuperSprites()
}
if (pXDebris->physAttr & kPhysGravity) pXDebris->physAttr |= kPhysFalling;
if ((pXDebris->physAttr & kPhysFalling) || debrisactor->xvel() || debrisactor->yvel() || debrisactor->zvel() || velFloor[pDebris->sectnum] || velCeil[pDebris->sectnum])
if ((pXDebris->physAttr & kPhysFalling) || debrisactor->xvel || debrisactor->yvel || debrisactor->zvel || velFloor[pDebris->sectnum] || velCeil[pDebris->sectnum])
debrisMove(i);
if (debrisactor->xvel() || debrisactor->yvel())
pXDebris->goalAng = getangle(debrisactor->xvel(), debrisactor->yvel()) & 2047;
if (debrisactor->xvel || debrisactor->yvel)
pXDebris->goalAng = getangle(debrisactor->xvel, debrisactor->yvel) & 2047;
int ang = pDebris->ang & 2047;
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble);
else if (Chance(0x1000 - mass))
{
if (debrisactor->zvel() > 0x100) debrisBubble(debrisactor);
if (debrisactor->zvel > 0x100) debrisBubble(debrisactor);
if (ang == pXDebris->goalAng)
{
pXDebris->goalAng = (pDebris->ang + Random3(kAng60)) & 2047;
@ -1452,7 +1452,7 @@ void nnExtProcessSuperSprites()
}
}
int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->xvel()) + abs(debrisactor->yvel())) >> 5)), (uwater) ? 1 : 0);
int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->xvel) + abs(debrisactor->yvel)) >> 5)), (uwater) ? 1 : 0);
if (ang < pXDebris->goalAng) pDebris->ang = ClipHigh(ang + angStep, pXDebris->goalAng);
else if (ang > pXDebris->goalAng) pDebris->ang = ClipLow(ang - angStep, pXDebris->goalAng);
@ -1674,9 +1674,9 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, int x, int y, int z,
{
int t = scale(dmg, size, actor->spriteMass.mass);
actor->xvel() += MulScale(t, dx, 16);
actor->yvel() += MulScale(t, dy, 16);
actor->zvel() += MulScale(t, dz, 16);
actor->xvel += MulScale(t, dx, 16);
actor->yvel += MulScale(t, dy, 16);
actor->zvel += MulScale(t, dz, 16);
}
if (thing)
@ -1711,9 +1711,9 @@ void debrisBubble(DBloodActor* actor)
int z = bottom - Random(bottom - top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sectnum, x, y, z, 0);
if (pFX) {
pFX->xvel() = actor->xvel() + Random2(0x1aaaa);
pFX->yvel() = actor->yvel() + Random2(0x1aaaa);
pFX->zvel() = actor->zvel() + Random2(0x1aaaa);
pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa);
pFX->zvel = actor->zvel + Random2(0x1aaaa);
}
}
@ -1765,14 +1765,14 @@ void debrisMove(int listIndex)
uwater = true;
}
if (actor->xvel() || actor->yvel())
if (actor->xvel || actor->yvel)
{
short oldcstat = pSprite->cstat;
pSprite->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12,
actor->yvel() >> 12, clipDist, ceilDist, floorDist, CLIPMASK0);
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12,
actor->yvel >> 12, clipDist, ceilDist, floorDist, CLIPMASK0);
pSprite->cstat = oldcstat;
if (pSprite->sectnum != nSector)
@ -1792,7 +1792,7 @@ void debrisMove(int listIndex)
{
moveHit = actor->hit.hit;
i = moveHit.index;
actWallBounceVector(&actor->xvel(), &actor->yvel(), i, tmpFraction);
actWallBounceVector(&actor->xvel, &actor->yvel, i, tmpFraction);
}
}
@ -1811,8 +1811,8 @@ void debrisMove(int listIndex)
if (sector[nSector].extra > 0)
uwater = xsector[sector[nSector].extra].Underwater;
if (actor->zvel())
pSprite->z += actor->zvel() >> 8;
if (actor->zvel)
pSprite->z += actor->zvel >> 8;
int ceilZ, floorZ;
Collision ceilColl, floorColl;
@ -1828,7 +1828,7 @@ void debrisMove(int listIndex)
if (gLowerLink[nSector] >= 0) cz += (cz < 0) ? 0x500 : -0x500;
if (top > cz && (!(pXSprite->physAttr & kPhysDebrisFloat) || fz <= bottom << 2))
actor->zvel() -= DivScale((bottom - ceilZ) >> 6, mass, 8);
actor->zvel -= DivScale((bottom - ceilZ) >> 6, mass, 8);
if (fz < bottom)
vc = 58254 + ((bottom - fz) * -80099) / div;
@ -1836,14 +1836,14 @@ void debrisMove(int listIndex)
if (vc)
{
pSprite->z += ((vc << 2) >> 1) >> 8;
actor->zvel() += vc;
actor->zvel += vc;
}
}
else if ((pXSprite->physAttr & kPhysGravity) && bottom < floorZ)
{
pSprite->z += 455;
actor->zvel() += 58254;
actor->zvel += 58254;
}
@ -1881,17 +1881,17 @@ void debrisMove(int listIndex)
if (floorZ <= bottom) {
actor->hit.florhit = floorColl;
int v30 = actor->zvel() - velFloor[pSprite->sectnum];
int v30 = actor->zvel - velFloor[pSprite->sectnum];
if (v30 > 0)
{
pXSprite->physAttr |= kPhysFalling;
actFloorBounceVector(&actor->xvel(), &actor->yvel(), &v30, pSprite->sectnum, tmpFraction);
actor->zvel() = v30;
actFloorBounceVector(&actor->xvel, &actor->yvel, &v30, pSprite->sectnum, tmpFraction);
actor->zvel = v30;
if (abs(actor->zvel()) < 0x10000)
if (abs(actor->zvel) < 0x10000)
{
actor->zvel() = velFloor[pSprite->sectnum];
actor->zvel = velFloor[pSprite->sectnum];
pXSprite->physAttr &= ~kPhysFalling;
}
@ -1904,9 +1904,9 @@ void debrisMove(int listIndex)
for (i = 0; i < 7; i++)
{
if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->s().sectnum, pFX->s().x, pFX->s().y, pFX->s().z, 0)) == NULL) continue;
pFX2->xvel() = Random2(0x6aaaa);
pFX2->yvel() = Random2(0x6aaaa);
pFX2->zvel() = -(int)Random(0xd5555);
pFX2->xvel = Random2(0x6aaaa);
pFX2->yvel = Random2(0x6aaaa);
pFX2->zvel = -(int)Random(0xd5555);
}
break;
case kSurfWater:
@ -1915,7 +1915,7 @@ void debrisMove(int listIndex)
}
}
else if (actor->zvel() == 0)
else if (actor->zvel == 0)
{
pXSprite->physAttr &= ~kPhysFalling;
}
@ -1931,8 +1931,8 @@ void debrisMove(int listIndex)
{
actor->hit.ceilhit = moveHit = ceilColl;
pSprite->z += ClipLow(ceilZ - top, 0);
if (actor->zvel() <= 0 && (pXSprite->physAttr & kPhysFalling))
actor->zvel() = MulScale(-actor->zvel(), 0x2000, 16);
if (actor->zvel <= 0 && (pXSprite->physAttr & kPhysFalling))
actor->zvel = MulScale(-actor->zvel, 0x2000, 16);
}
else
@ -1948,14 +1948,14 @@ void debrisMove(int listIndex)
trTriggerSprite(actor, kCmdToggle);
}
if (!actor->xvel() && !actor->yvel()) return;
if (!actor->xvel && !actor->yvel) return;
else if (floorColl.type == kHitSprite)
{
if ((floorColl.actor->s().cstat & 0x30) == 0)
{
actor->xvel() += MulScale(4, pSprite->x - floorColl.actor->s().x, 2);
actor->yvel() += MulScale(4, pSprite->y - floorColl.actor->s().y, 2);
actor->xvel += MulScale(4, pSprite->x - floorColl.actor->s().x, 2);
actor->yvel += MulScale(4, pSprite->y - floorColl.actor->s().y, 2);
return;
}
}
@ -1968,10 +1968,10 @@ void debrisMove(int listIndex)
if (pXSprite->height > 0)
nDrag -= scale(nDrag, pXSprite->height, 0x100);
actor->xvel() -= mulscale16r(actor->xvel(), nDrag);
actor->yvel() -= mulscale16r(actor->yvel(), nDrag);
if (approxDist(actor->xvel(), actor->yvel()) < 0x1000)
actor->xvel() = actor->yvel() = 0;
actor->xvel -= mulscale16r(actor->xvel, nDrag);
actor->yvel -= mulscale16r(actor->yvel, nDrag);
if (approxDist(actor->xvel, actor->yvel) < 0x1000)
actor->xvel = actor->yvel = 0;
}
//---------------------------------------------------------------------------
@ -2722,7 +2722,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, int objIndex, D
else flags &= ~(kPhysGravity | kPhysFalling);
pSprite->flags &= ~(kPhysMove | kPhysGravity | kPhysFalling);
targetactor->xvel() = targetactor->yvel() = targetactor->zvel() = 0;
targetactor->xvel = targetactor->yvel = targetactor->zvel = 0;
pXSprite->restState = pXSprite->state;
}
@ -2835,7 +2835,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, int objIndex, D
{
if (oldFlags == 0)
targetactor->xvel() = targetactor->yvel() = targetactor->zvel() = 0;
targetactor->xvel = targetactor->yvel = targetactor->zvel = 0;
if (nIndex != -1)
{
@ -2853,7 +2853,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, int objIndex, D
if (pSprite->statnum == kStatThing) ChangeActorStat(targetactor, 0);
// set random goal ang for swimming so they start turning
if ((flags & kPhysDebrisSwim) && !targetactor->xvel() && !targetactor->yvel() && !targetactor->zvel())
if ((flags & kPhysDebrisSwim) && !targetactor->xvel && !targetactor->yvel && !targetactor->zvel)
pXSprite->goalAng = (pSprite->ang + Random3(kAng45)) & 2047;
if (pXSprite->physAttr & kPhysDebrisVector)
@ -2871,7 +2871,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, int objIndex, D
{
pXSprite->physAttr = flags;
targetactor->xvel() = targetactor->yvel() = targetactor->zvel() = 0;
targetactor->xvel = targetactor->yvel = targetactor->zvel = 0;
if (pSprite->lotag >= kThingBase && pSprite->lotag < kThingMax)
ChangeActorStat(targetactor, kStatThing); // if it was a thing - restore statnum
}
@ -3168,7 +3168,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
}
if (pXSource->data3 == 1)
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
viewBackupSpriteLoc(pSprite->index, pSprite);
@ -4570,10 +4570,10 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
case 25:
switch (arg1)
{
case 0: return (objActor->xvel() || objActor->yvel() || objActor->zvel());
case 1: return (objActor->xvel());
case 2: return (objActor->yvel());
case 3: return (objActor->zvel());
case 0: return (objActor->xvel || objActor->yvel || objActor->zvel);
case 1: return (objActor->xvel);
case 2: return (objActor->yvel);
case 3: return (objActor->zvel);
}
break;
case 30:
@ -6520,9 +6520,9 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor)
if (pXSource->data2 > 0)
{
int velocity = pXSource->data2 << 12;
missileactor->xvel() = MulScale(velocity, dx, 14);
missileactor->yvel() = MulScale(velocity, dy, 14);
missileactor->zvel() = MulScale(velocity, dz, 14);
missileactor->xvel = MulScale(velocity, dx, 14);
missileactor->yvel = MulScale(velocity, dy, 14);
missileactor->zvel = MulScale(velocity, dz, 14);
}
// add bursting for missiles
@ -6767,12 +6767,12 @@ void useSlopeChanger(DBloodActor* sourceactor, int objType, int objIndex, DBlood
if (spr->extra > 0 && xspr->physAttr > 0)
{
xspr->physAttr |= kPhysFalling;
iactor->zvel()++;
iactor->zvel++;
}
else if ((spr->statnum == kStatThing || spr->statnum == kStatDude) && (spr->flags & kPhysGravity))
{
spr->flags |= kPhysFalling;
iactor->zvel()++;
iactor->zvel++;
}
}
}
@ -7677,7 +7677,7 @@ void nnExtAiSetDirection(DBloodActor* actor, int a3)
int nSprite = pSprite->index;
int vc = ((a3 + 1024 - pSprite->ang) & 2047) - 1024;
int t1 = DMulScale(actor->xvel(), Cos(pSprite->ang), actor->yvel(), Sin(pSprite->ang), 30);
int t1 = DMulScale(actor->xvel, Cos(pSprite->ang), actor->yvel, Sin(pSprite->ang), 30);
int vsi = ((t1 * 15) >> 12) / 2;
int v8 = 341;
@ -8162,7 +8162,7 @@ void aiPatrolMove(DBloodActor* actor)
if (pExtra->flying || spriteIsUnderwater(actor))
{
goalAng >>= 1;
actor->zvel() = dz;
actor->zvel = dz;
if (pSprite->flags & kPhysGravity)
pSprite->flags &= ~kPhysGravity;
}
@ -8177,8 +8177,8 @@ void aiPatrolMove(DBloodActor* actor)
if (abs(nAng) > goalAng || ((pXTarget->waitTime > 0 || pXTarget->data1 == pXTarget->data2) && aiPatrolMarkerReached(actor)))
{
actor->xvel() = 0;
actor->yvel() = 0;
actor->xvel = 0;
actor->yvel = 0;
return;
}
@ -8192,13 +8192,13 @@ void aiPatrolMove(DBloodActor* actor)
else
{
int frontSpeed = aiPatrolGetVelocity(pDudeInfo->frontSpeed, pXTarget->busyTime);
actor->xvel() += MulScale(frontSpeed, Cos(pSprite->ang), 30);
actor->yvel() += MulScale(frontSpeed, Sin(pSprite->ang), 30);
actor->xvel += MulScale(frontSpeed, Cos(pSprite->ang), 30);
actor->yvel += MulScale(frontSpeed, Sin(pSprite->ang), 30);
}
vel = MulScale(vel, approxDist(dx, dy) << 6, 16);
actor->xvel() = ClipRange(actor->xvel(), -vel, vel);
actor->yvel() = ClipRange(actor->yvel(), -vel, vel);
actor->xvel = ClipRange(actor->xvel, -vel, vel);
actor->yvel = ClipRange(actor->yvel, -vel, vel);
return;
}
@ -8559,8 +8559,8 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
{
auto act = pPlayer->actor();
itCanHear = (!deaf && (nDist < hearDist || hearChance > 0));
if (itCanHear && nDist < feelDist && (act->xvel() || act->yvel() || act->zvel()))
hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->xvel()) + abs(act->yvel()) + abs(act->zvel()))) >> 6, 0)), 0);
if (itCanHear && nDist < feelDist && (act->xvel || act->yvel || act->zvel))
hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->xvel) + abs(act->yvel) + abs(act->zvel))) >> 6, 0)), 0);
}
if (seeDist)
@ -8810,7 +8810,7 @@ void aiPatrolThink(DBloodActor* actor)
if (pXSprite->stateTimer > 0 || pXMarker->data1 == pXMarker->data2)
{
if (pExtra->flying)
actor->zvel() = Random2(0x8000);
actor->zvel = Random2(0x8000);
// turn while waiting
if (pMarker->flags & kModernTypeFlag16)
@ -9179,7 +9179,7 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
if (!actor) return;
spritetype* pSprite = &actor->s();
if (pSprite->statnum != kStatProjectile) return;
int nAngle = getangle(actor->xvel(), actor->yvel());
int nAngle = getangle(actor->xvel, actor->yvel);
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
@ -9220,9 +9220,9 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
dz >>= 1;
}
RotateVector(&dx, &dy, nAngle);
burstactor->xvel() += dx;
burstactor->yvel() += dy;
burstactor->zvel() += dz;
burstactor->xvel += dx;
burstactor->yvel += dy;
burstactor->zvel += dz;
evPostActor(burstactor, 960, kCallbackRemove);
}
evPostActor(actor, 0, kCallbackRemove);

View file

@ -724,7 +724,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->throwPower = 0;
pPlayer->deathTime = 0;
pPlayer->nextWeapon = kWeapNone;
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
pInput->avel = 0;
pInput->actions = 0;
pInput->fvel = 0;
@ -1280,9 +1280,9 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
if (nMass)
{
int t2 = DivScale(0xccccc, nMass, 8);
actor->xvel() += MulScale(x, t2, 16);
actor->yvel() += MulScale(y, t2, 16);
actor->zvel() += MulScale(z, t2, 16);
actor->xvel += MulScale(x, t2, 16);
actor->yvel += MulScale(y, t2, 16);
actor->zvel += MulScale(z, t2, 16);
}
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered)
trTriggerSprite(*a2, pXSprite, kCmdSpritePush);
@ -1420,15 +1420,15 @@ void ProcessInput(PLAYER *pPlayer)
forward = MulScale(pPosture->frontAccel, forward, 8);
else
forward = MulScale(pPosture->backAccel, forward, 8);
actor->xvel() += MulScale(forward, x, 30);
actor->yvel() += MulScale(forward, y, 30);
actor->xvel += MulScale(forward, x, 30);
actor->yvel += MulScale(forward, y, 30);
}
if (pInput->svel)
{
int strafe = pInput->svel;
strafe = MulScale(pPosture->sideAccel, strafe, 8);
actor->xvel() += MulScale(strafe, y, 30);
actor->yvel() -= MulScale(strafe, x, 30);
actor->xvel += MulScale(strafe, y, 30);
actor->yvel -= MulScale(strafe, x, 30);
}
}
else if (pXSprite->height < 256)
@ -1447,8 +1447,8 @@ void ProcessInput(PLAYER *pPlayer)
forward = MulScale(pPosture->backAccel, forward, 8);
if (pXSprite->height)
forward = MulScale(forward, speed, 16);
actor->xvel() += MulScale(forward, x, 30);
actor->yvel() += MulScale(forward, y, 30);
actor->xvel += MulScale(forward, x, 30);
actor->yvel += MulScale(forward, y, 30);
}
if (pInput->svel)
{
@ -1456,8 +1456,8 @@ void ProcessInput(PLAYER *pPlayer)
strafe = MulScale(pPosture->sideAccel, strafe, 8);
if (pXSprite->height)
strafe = MulScale(strafe, speed, 16);
actor->xvel() += MulScale(strafe, y, 30);
actor->yvel() -= MulScale(strafe, x, 30);
actor->xvel += MulScale(strafe, y, 30);
actor->yvel -= MulScale(strafe, x, 30);
}
}
@ -1476,9 +1476,9 @@ void ProcessInput(PLAYER *pPlayer)
switch (pPlayer->posture) {
case 1:
if (pInput->actions & SB_JUMP)
actor->zvel() -= pPosture->normalJumpZ;//0x5b05;
actor->zvel -= pPosture->normalJumpZ;//0x5b05;
if (pInput->actions & SB_CROUCH)
actor->zvel() += pPosture->normalJumpZ;//0x5b05;
actor->zvel += pPosture->normalJumpZ;//0x5b05;
break;
case 2:
if (!(pInput->actions & SB_CROUCH))
@ -1491,8 +1491,8 @@ void ProcessInput(PLAYER *pPlayer)
#endif
sfxPlay3DSound(pSprite, 700, 0, 0);
if (packItemActive(pPlayer, 4)) actor->zvel() = pPosture->pwupJumpZ; //-0x175555;
else actor->zvel() = pPosture->normalJumpZ; //-0xbaaaa;
if (packItemActive(pPlayer, 4)) actor->zvel = pPosture->pwupJumpZ; //-0x175555;
else actor->zvel = pPosture->normalJumpZ; //-0xbaaaa;
pPlayer->cantJump = 1;
}
@ -1582,9 +1582,9 @@ void ProcessInput(PLAYER *pPlayer)
int nSprite = pPlayer->pSprite->index;
int x = bcos(pPlayer->pSprite->ang);
int y = bsin(pPlayer->pSprite->ang);
spawned->xvel() = pPlayer->actor()->xvel() + MulScale(0x155555, x, 14);
spawned->yvel() = pPlayer->actor()->yvel() + MulScale(0x155555, y, 14);
spawned->zvel() = pPlayer->actor()->zvel();
spawned->xvel = pPlayer->actor()->xvel + MulScale(0x155555, x, 14);
spawned->yvel = pPlayer->actor()->yvel + MulScale(0x155555, y, 14);
spawned->zvel = pPlayer->actor()->zvel;
pPlayer->hand = 0;
}
pInput->actions &= ~SB_OPEN;
@ -1683,15 +1683,15 @@ void playerProcess(PLAYER *pPlayer)
}
}
ProcessInput(pPlayer);
int nSpeed = approxDist(actor->xvel(), actor->yvel());
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel(), 0x7000);
int nSpeed = approxDist(actor->xvel, actor->yvel);
pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel, 0x7000);
int dz = pPlayer->pSprite->z-pPosture->eyeAboveZ-pPlayer->zView;
if (dz > 0)
pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16);
else
pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16);
pPlayer->zView += pPlayer->zViewVel>>8;
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->zvel(), 0x5000);
pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->zvel, 0x5000);
dz = pPlayer->pSprite->z-pPosture->weaponAboveZ-pPlayer->zWeapon;
if (dz > 0)
pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16);
@ -1973,7 +1973,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
CGibPosition gibPos(pSprite->x, pSprite->y, top);
CGibVelocity gibVel(pActor->xvel() >> 1, pActor->yvel() >> 1, -0xccccc);
CGibVelocity gibVel(pActor->xvel >> 1, pActor->yvel >> 1, -0xccccc);
GibSprite(pActor, GIBTYPE_27, &gibPos, &gibVel);
GibSprite(pActor, GIBTYPE_7, NULL, NULL);
fxSpawnBlood(pActor, nDamage<<4);

View file

@ -62,9 +62,9 @@ void viewInitializePrediction(void)
predict.z = gMe->pSprite->z;
predict.sectnum = gMe->pSprite->sectnum;
predict.at73 = gMe->pSprite->flags;
predict.xvel = gMe->actor()->xvel();
predict.yvel = gMe->actor()->yvel();
predict.zvel = gMe->actor()->zvel();
predict.xvel = gMe->actor()->xvel;
predict.yvel = gMe->actor()->yvel;
predict.zvel = gMe->actor()->zvel;
predict.floordist = gMe->pXSprite->height;
predict.at48 = gMe->posture;
predict.spin = gMe->angle.spin;

View file

@ -366,7 +366,7 @@ void SEQINST::Update()
// by NoOne: add surfaceSound trigger feature
spritetype* pSprite = &sprite[xsprite[index].reference];
auto actor = &bloodActors[pSprite->index];
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel() == 0 && actor->xvel() != 0) {
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel == 0 && actor->xvel != 0) {
if (gUpperLink[pSprite->sectnum] >= 0) break; // don't play surface sound for stacked sectors
int surf = tileGetSurfType(sector[pSprite->sectnum].floorpicnum);

View file

@ -94,7 +94,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3
auto actor = &bloodActors[sprt->index];
// Engine expects velocity in units per second, not units per tic.
if (vel) *vel = { actor->xvel() * (30 / 65536.f), actor->zvel() * (-30 / 65536.f), actor->yvel() * (-30 / 65536.f) };
if (vel) *vel = { actor->xvel * (30 / 65536.f), actor->zvel * (-30 / 65536.f), actor->yvel * (-30 / 65536.f) };
*pos = GetSoundPos(&sprt->pos);
}
else if (type == SOURCE_Ambient)

View file

@ -242,8 +242,8 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
if (nDist != 0 && cansee(pSprite->x, pSprite->y, top, pSprite->sectnum, x, y, z, pTarget->sectnum))
{
int t = DivScale(nDist, 0x1aaaaa, 12);
x += (target->xvel()*t)>>12;
y += (target->yvel()*t)>>12;
x += (target->xvel*t)>>12;
y += (target->yvel*t)>>12;
int angBak = pSprite->ang;
pSprite->ang = getangle(x-pSprite->x, y-pSprite->y);
int dx = bcos(pSprite->ang);
@ -1461,7 +1461,7 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
pSprite->ang = pDest->ang;
ChangeActorSect(actor, pDest->sectnum);
sfxPlay3DSound(pDest, 201, -1, 0);
actor->xvel() = actor->yvel() = actor->zvel() = 0;
actor->xvel = actor->yvel = actor->zvel = 0;
int nSprite = actor->s().index;
gInterpolateSprite.Clear(nSprite);
viewBackupSpriteLoc(nSprite, pSprite);

View file

@ -384,9 +384,9 @@ void UpdateAimVector(PLAYER * pPlayer)
if (pWeaponTrack->seeker)
{
int t = DivScale(nDist, pWeaponTrack->seeker, 12);
x2 += (actor->xvel() * t) >> 12;
y2 += (actor->yvel() * t) >> 12;
z2 += (actor->zvel() * t) >> 8;
x2 += (actor->xvel * t) >> 12;
y2 += (actor->yvel * t) >> 12;
z2 += (actor->zvel * t) >> 8;
}
int lx = x + MulScale(Cos(pPSprite->ang), nDist, 30);
int ly = y + MulScale(Sin(pPSprite->ang), nDist, 30);