- various replacements of vel

This commit is contained in:
Christoph Oelckers 2022-09-01 21:46:30 +02:00
parent f1d3126435
commit 7a7a2cdb39
6 changed files with 35 additions and 30 deletions

View file

@ -236,6 +236,11 @@ public:
__int_vel .Z = x; __int_vel .Z = x;
} }
void set_int_bvel(vec3_t x)
{
__int_vel = x;
}
void add_int_bvel_x(int x) void add_int_bvel_x(int x)
{ {
__int_vel .X += x; __int_vel .X += x;

View file

@ -4149,7 +4149,7 @@ static void checkCeilHit(DBloodActor* actor)
auto actor2 = coll.actor(); auto actor2 = coll.actor();
if (actor2 && actor2->hasX()) if (actor2 && actor2->hasX())
{ {
if ((actor2->spr.statnum == kStatThing || actor2->spr.statnum == kStatDude) && (actor->__int_vel.X != 0 || actor->__int_vel.Y != 0 || actor->__int_vel.Z != 0)) if ((actor2->spr.statnum == kStatThing || actor2->spr.statnum == kStatDude) && (actor->int_vel().X != 0 || actor->int_vel().Y != 0 || actor->int_vel().Z != 0))
{ {
auto adelta = actor2->spr.pos - actor->spr.pos; auto adelta = actor2->spr.pos - actor->spr.pos;
if (actor2->spr.statnum == kStatThing) if (actor2->spr.statnum == kStatThing)
@ -4257,7 +4257,7 @@ static void checkHit(DBloodActor* actor)
// add size shroom abilities // add size shroom abilities
if ((actor2->IsPlayerActor() && isShrinked(actor2)) || (actor->IsPlayerActor() && isGrown(actor))) if ((actor2->IsPlayerActor() && isShrinked(actor2)) || (actor->IsPlayerActor() && isGrown(actor)))
{ {
if (actor->__int_vel.X != 0 && actor2->IsDudeActor()) if (actor->int_vel().X != 0 && actor2->IsDudeActor())
{ {
int mass1 = getDudeInfo(actor->spr.type)->mass; int mass1 = getDudeInfo(actor->spr.type)->mass;
int mass2 = getDudeInfo(actor2->spr.type)->mass; int mass2 = getDudeInfo(actor2->spr.type)->mass;
@ -4525,7 +4525,7 @@ static Collision MoveThing(DBloodActor* actor)
lhit.setNone(); lhit.setNone();
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
const int bakCompat = enginecompatibility_mode; const int bakCompat = enginecompatibility_mode;
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
{ {
auto bakCstat = actor->spr.cstat; auto bakCstat = actor->spr.cstat;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
@ -4626,7 +4626,7 @@ static Collision MoveThing(DBloodActor* actor)
switch (actor->spr.type) switch (actor->spr.type)
{ {
case kThingNapalmBall: case kThingNapalmBall:
if (actor->__int_vel.Z == 0 || Chance(0xA000)) actNapalmMove(actor); if (actor->int_vel().Z == 0 || Chance(0xA000)) actNapalmMove(actor);
break; break;
case kThingZombieHead: case kThingZombieHead:
@ -4645,7 +4645,7 @@ static Collision MoveThing(DBloodActor* actor)
lhit.setSector(pSector); lhit.setSector(pSector);
} }
else if (actor->__int_vel.Z == 0) else if (actor->int_vel().Z == 0)
actor->spr.flags &= ~4; actor->spr.flags &= ~4;
} }
@ -4709,7 +4709,7 @@ static Collision MoveThing(DBloodActor* actor)
actor->add_int_bvel_y(-MulScale(t, actor->int_vel().Y, 16)); actor->add_int_bvel_y(-MulScale(t, actor->int_vel().Y, 16));
} }
} }
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
actor->spr.angle = VecToAngle(actor->int_vel().X, actor->int_vel().Y); actor->spr.angle = VecToAngle(actor->int_vel().X, actor->int_vel().Y);
return lhit; return lhit;
} }
@ -4741,7 +4741,7 @@ void MoveDude(DBloodActor* actor)
assert(pSector); assert(pSector);
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
{ {
if (pPlayer && gNoClip) if (pPlayer && gNoClip)
{ {
@ -5148,7 +5148,7 @@ void MoveDude(DBloodActor* actor)
} }
} }
} }
else if (actor->__int_vel.Z == 0) else if (actor->int_vel().Z == 0)
actor->spr.flags &= ~4; actor->spr.flags &= ~4;
} }
@ -5173,7 +5173,7 @@ void MoveDude(DBloodActor* actor)
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
actor->xspr.height = ClipLow(floorZ - bottom, 0) >> 8; actor->xspr.height = ClipLow(floorZ - bottom, 0) >> 8;
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
{ {
if (floorColl.type == kHitSprite) if (floorColl.type == kHitSprite)
{ {
@ -5222,7 +5222,7 @@ int MoveMissile(DBloodActor* actor)
gHitInfo.clearObj(); gHitInfo.clearObj();
if (actor->spr.type == kMissileFlameSpray) actAirDrag(actor, 0x1000); if (actor->spr.type == kMissileFlameSpray) actAirDrag(actor, 0x1000);
if (actor->GetTarget() != nullptr && (actor->__int_vel.X || actor->__int_vel.Y || actor->int_vel().Z)) if (actor->GetTarget() != nullptr && (actor->int_vel().X != 0 || actor->int_vel().Y != 0 || actor->int_vel().Z))
{ {
auto target = actor->GetTarget(); auto target = actor->GetTarget();
@ -5678,7 +5678,7 @@ static void actCheckThings()
actAirDrag(actor, 128); actAirDrag(actor, 128);
if (((actor->GetIndex() >> 8) & 15) == (gFrameCount & 15) && (actor->spr.flags & 2)) actor->spr.flags |= 4; if (((actor->GetIndex() >> 8) & 15) == (gFrameCount & 15) && (actor->spr.flags & 2)) actor->spr.flags |= 4;
if ((actor->spr.flags & 4) || actor->__int_vel.X || actor->__int_vel.Y || actor->__int_vel.Z || actor->sector()->velFloor || actor->sector()->velCeil) if ((actor->spr.flags & 4) || actor->int_vel().X != 0 || actor->int_vel().Y != 0 || actor->int_vel().Z != 0 || actor->sector()->velFloor || actor->sector()->velCeil)
{ {
Collision hit = MoveThing(actor); Collision hit = MoveThing(actor);
if (hit.type) if (hit.type)
@ -6054,7 +6054,7 @@ static void actCheckDudes()
else else
pPlayer->chokeEffect = 0; pPlayer->chokeEffect = 0;
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
sfxPlay3DSound(actor, 709, 100, 2); sfxPlay3DSound(actor, 709, 100, 2);
pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0); pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0);
@ -6106,7 +6106,7 @@ static void actCheckDudes()
if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376); if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376);
else actAirDrag(actor, 128); else actAirDrag(actor, 128);
if ((actor->spr.flags & 4) || actor->__int_vel.X || actor->__int_vel.Y || actor->__int_vel.Z || actor->sector()->velFloor || actor->sector()->velCeil) if ((actor->spr.flags & 4) || actor->int_vel().X != 0 || actor->int_vel().Y != 0 || actor->int_vel().Z != 0 || actor->sector()->velFloor || actor->sector()->velCeil)
MoveDude(actor); MoveDude(actor);
} }
} }
@ -6926,7 +6926,7 @@ void FireballSeqCallback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_11, actor->sector(), actor->spr.pos, 0); auto pFX = gFX.fxSpawnActor(FX_11, actor->sector(), actor->spr.pos, 0);
if (pFX) if (pFX)
{ {
pFX->__int_vel = actor->__int_vel; pFX->set_int_bvel(actor->int_vel());
} }
} }
@ -6935,7 +6935,7 @@ void NapalmSeqCallback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_12, actor->sector(), actor->spr.pos, 0); auto pFX = gFX.fxSpawnActor(FX_12, actor->sector(), actor->spr.pos, 0);
if (pFX) if (pFX)
{ {
pFX->__int_vel = actor->__int_vel; pFX->set_int_bvel(actor->int_vel());
} }
} }
@ -6944,7 +6944,7 @@ void Fx32Callback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_32, actor->sector(), actor->spr.pos, 0); auto pFX = gFX.fxSpawnActor(FX_32, actor->sector(), actor->spr.pos, 0);
if (pFX) if (pFX)
{ {
pFX->__int_vel = actor->__int_vel; pFX->set_int_bvel(actor->int_vel());
} }
} }
@ -6953,7 +6953,7 @@ void Fx33Callback(int, DBloodActor* actor)
auto pFX = gFX.fxSpawnActor(FX_33, actor->sector(), actor->spr.pos, 0); auto pFX = gFX.fxSpawnActor(FX_33, actor->sector(), actor->spr.pos, 0);
if (pFX) if (pFX)
{ {
pFX->__int_vel = actor->__int_vel; pFX->set_int_bvel(actor->int_vel());
} }
} }

View file

@ -523,7 +523,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
int zv = actor->int_vel().Z - actor->sector()->velFloor; int zv = actor->int_vel().Z - actor->sector()->velFloor;
if (actor->__int_vel.Z == 0) sleeveStopBouncing(actor); if (actor->int_vel().Z == 0) sleeveStopBouncing(actor);
else if (zv > 0) { else if (zv > 0) {
actFloorBounceVector((int*)&actor->__int_vel.X, (int*)&actor->__int_vel.Y, &zv, actor->sector(), 0x9000); actFloorBounceVector((int*)&actor->__int_vel.X, (int*)&actor->__int_vel.Y, &zv, actor->sector(), 0x9000);
actor->set_int_bvel_z(zv); actor->set_int_bvel_z(zv);

View file

@ -216,7 +216,7 @@ void CFX::fxProcess(void)
actAirDrag(actor, pFXData->drag); actAirDrag(actor, pFXData->drag);
actor->add_int_pos({ actor->int_vel().X >> 12, actor->int_vel().Y >> 12, actor->int_vel().Z >> 8 }); actor->add_int_pos({ actor->int_vel().X >> 12, actor->int_vel().Y >> 12, actor->int_vel().Z >> 8 });
// Weird... // Weird...
if (actor->__int_vel.X || (actor->__int_vel.Y && actor->spr.pos.Z >= actor->sector()->floorz)) if (actor->int_vel().X != 0 || (actor->__int_vel.Y && actor->spr.pos.Z >= actor->sector()->floorz))
{ {
updatesector(actor->spr.pos, &pSector); updatesector(actor->spr.pos, &pSector);
if (pSector == nullptr) if (pSector == nullptr)
@ -240,7 +240,7 @@ void CFX::fxProcess(void)
ChangeActorSect(actor, pSector); ChangeActorSect(actor, pSector);
} }
} }
if (actor->__int_vel.X || actor->__int_vel.Y || actor->int_vel().Z) if (actor->int_vel().X != 0 || actor->int_vel().Y != 0 || actor->int_vel().Z)
{ {
int32_t floorZ, ceilZ; int32_t floorZ, ceilZ;
getzsofslopeptr(pSector, actor->spr.pos, &ceilZ, &floorZ); getzsofslopeptr(pSector, actor->spr.pos, &ceilZ, &floorZ);

View file

@ -1343,10 +1343,10 @@ void nnExtProcessSuperSprites()
} }
if (debrisactor->xspr.physAttr & kPhysGravity) debrisactor->xspr.physAttr |= kPhysFalling; if (debrisactor->xspr.physAttr & kPhysGravity) debrisactor->xspr.physAttr |= kPhysFalling;
if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->__int_vel.X || debrisactor->__int_vel.Y || debrisactor->__int_vel.Z || debrisactor->sector()->velFloor || debrisactor->sector()->velCeil) if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->int_vel().X != 0 || debrisactor->int_vel().Y != 0 || debrisactor->int_vel().Z != 0 || debrisactor->sector()->velFloor || debrisactor->sector()->velCeil)
debrisMove(i); debrisMove(i);
if (debrisactor->__int_vel.X || debrisactor->int_vel().Y) if (debrisactor->int_vel().X != 0 || debrisactor->int_vel().Y)
debrisactor->xspr.goalAng = getangle(debrisactor->int_vel().X, debrisactor->int_vel().Y) & 2047; debrisactor->xspr.goalAng = getangle(debrisactor->int_vel().X, debrisactor->int_vel().Y) & 2047;
int ang = debrisactor->int_ang() & 2047; int ang = debrisactor->int_ang() & 2047;
@ -1662,7 +1662,7 @@ void debrisMove(int listIndex)
uwater = true; uwater = true;
} }
if (actor->__int_vel.X || actor->int_vel().Y) if (actor->int_vel().X != 0 || actor->int_vel().Y)
{ {
auto oldcstat = actor->spr.cstat; auto oldcstat = actor->spr.cstat;
@ -1815,7 +1815,7 @@ void debrisMove(int listIndex)
} }
} }
else if (actor->__int_vel.Z == 0) else if (actor->int_vel().Z == 0)
{ {
actor->xspr.physAttr &= ~kPhysFalling; actor->xspr.physAttr &= ~kPhysFalling;
} }
@ -4617,7 +4617,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
else if (arg1 == 2) return condCmp(objActor->int_vel().Y, arg1, arg2, cmpOp); else if (arg1 == 2) return condCmp(objActor->int_vel().Y, arg1, arg2, cmpOp);
else if (arg1 == 3) return condCmp(objActor->int_vel().Z, arg1, arg2, cmpOp); else if (arg1 == 3) return condCmp(objActor->int_vel().Z, arg1, arg2, cmpOp);
} }
else if (arg1 == 0) return (objActor->__int_vel.X || objActor->__int_vel.Y || objActor->int_vel().Z); else if (arg1 == 0) return (objActor->int_vel().X != 0 || objActor->int_vel().Y != 0 || objActor->int_vel().Z);
else if (arg1 == 1) return (objActor->int_vel().X); else if (arg1 == 1) return (objActor->int_vel().X);
else if (arg1 == 2) return (objActor->int_vel().Y); else if (arg1 == 2) return (objActor->int_vel().Y);
else if (arg1 == 3) return (objActor->int_vel().Z); else if (arg1 == 3) return (objActor->int_vel().Z);
@ -6796,12 +6796,12 @@ void useSlopeChanger(DBloodActor* sourceactor, int objType, sectortype* pSect, D
if (iactor->hasX() && iactor->xspr.physAttr > 0) if (iactor->hasX() && iactor->xspr.physAttr > 0)
{ {
iactor->xspr.physAttr |= kPhysFalling; iactor->xspr.physAttr |= kPhysFalling;
iactor->__int_vel.Z++; iactor->add_int_bvel_z(1);
} }
else if ((iactor->spr.statnum == kStatThing || iactor->spr.statnum == kStatDude) && (iactor->spr.flags & kPhysGravity)) else if ((iactor->spr.statnum == kStatThing || iactor->spr.statnum == kStatDude) && (iactor->spr.flags & kPhysGravity))
{ {
iactor->spr.flags |= kPhysFalling; iactor->spr.flags |= kPhysFalling;
iactor->__int_vel.Z++; iactor->add_int_bvel_z(1);
} }
} }
} }
@ -8204,7 +8204,7 @@ void aiPatrolMove(DBloodActor* actor)
if (hitactor->hasX() && hitactor->xspr.health) if (hitactor->hasX() && hitactor->xspr.health)
{ {
hitactor->xspr.dodgeDir = (actor->xspr.dodgeDir > 0) ? -1 : 1; hitactor->xspr.dodgeDir = (actor->xspr.dodgeDir > 0) ? -1 : 1;
if (hitactor->__int_vel.X || hitactor->int_vel().Y) if (hitactor->int_vel().X != 0 || hitactor->int_vel().Y)
aiMoveDodge(hitactor); aiMoveDodge(hitactor);
} }
} }
@ -8574,7 +8574,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
{ {
DBloodActor* act = pPlayer->actor; DBloodActor* act = pPlayer->actor;
itCanHear = (!deaf && (nDist < hearDist || hearChance > 0)); itCanHear = (!deaf && (nDist < hearDist || hearChance > 0));
if (act && itCanHear && nDist < feelDist && (act->__int_vel.X || act->__int_vel.Y || act->int_vel().Z)) if (act && itCanHear && nDist < feelDist && (act->int_vel().X != 0 || act->int_vel().Y != 0 || act->int_vel().Z))
hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->int_vel().X) + abs(act->int_vel().Y) + abs(act->int_vel().Z))) >> 6, 0)), 0); hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->int_vel().X) + abs(act->int_vel().Y) + abs(act->int_vel().Z))) >> 6, 0)), 0);
} }

View file

@ -348,7 +348,7 @@ void SEQINST::Update()
// by NoOne: add surfaceSound trigger feature // by NoOne: add surfaceSound trigger feature
if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->__int_vel.Z == 0 && actor->__int_vel.X != 0) { if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->int_vel().Z == 0 && actor->int_vel().X != 0) {
if (actor->sector()->upperLink) break; // don't play surface sound for stacked sectors if (actor->sector()->upperLink) break; // don't play surface sound for stacked sectors
int surf = tileGetSurfType(actor->sector()->floorpicnum); int surf = tileGetSurfType(actor->sector()->floorpicnum);