- replaced most native_clipdist() calls

Only those in nnext using internal int storage remain.
This commit is contained in:
Christoph Oelckers 2022-10-04 19:25:06 +02:00
parent e80c32cfd4
commit 9f19a1315b
7 changed files with 11 additions and 29 deletions

View file

@ -4166,7 +4166,7 @@ static void checkCeilHit(DBloodActor* actor)
}
if (mass1 > mass2)
{
int dmg = abs((mass1 - mass2) * (actor2->native_clipdist()) - actor->native_clipdist());
int dmg = 4 * (abs((mass1 - mass2) * actor2->clipdist) - actor->clipdist);
if (actor2->IsDudeActor())
{
if (dmg > 0) actDamageSprite(actor2, actor, (Chance(0x2000)) ? kDamageFall : (Chance(0x4000)) ? kDamageExplode : kDamageBullet, dmg);
@ -4330,7 +4330,7 @@ static void checkFloorHit(DBloodActor* actor)
if ((actor2->IsPlayerActor() && Chance(0x500)) || !actor2->IsPlayerActor())
actKickObject(actor, actor2);
int dmg = (mass1 - mass2) + actor->native_clipdist();
int dmg = (mass1 - mass2) + actor->clipdist * 4;
if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg);
}
}

View file

@ -487,7 +487,7 @@ static void unicultThinkChase(DBloodActor* actor)
// so i use fake velocity with fixed value and pass it as argument.
auto velocity = actor->vel;
if (inAttack(actor->xspr.aiState))
velocity.X = velocity.Y = FixedToFloat(ClipLow(actor->native_clipdist() >> 1, 1));
velocity.X = velocity.Y = max(actor->clipdist, 0.5) / 32768;
aiGenDudeChooseDirection(actor, nAngle, velocity);
@ -1895,7 +1895,7 @@ DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, double nDist)
spawned->xspr.busyTime = source->xspr.busyTime;
// inherit clipdist?
if (source->native_clipdist() > 0)
if (source->clipdist > 0)
spawned->copy_clipdist(source);
// inherit custom hp settings
@ -2261,7 +2261,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
pExtra->moveSpeed = getGenDudeMoveSpeed(actor, 0, true, false);
pExtra->initVals[0] = actor->spr.xrepeat;
pExtra->initVals[1] = actor->spr.yrepeat;
pExtra->initVals[2] = actor->native_clipdist();
pExtra->initVals[2] = actor->spr.clipdist;
if (propId) break;
[[fallthrough]];

View file

@ -1170,7 +1170,7 @@ void nnExtProcessSuperSprites()
if (!pProx->xspr.Proximity || (!pProx->xspr.Interrutable && pProx->xspr.state != pProx->xspr.restState) || pProx->xspr.locked == 1
|| pProx->xspr.isTriggered) continue; // don't process locked or triggered sprites
int okDist = (pProx->IsDudeActor()) ? 96 : ClipLow(pProx->native_clipdist() * 3, 32);
int okDist = (pProx->IsDudeActor()) ? 96 : max(int(pProx->clipdist * 12), 32);
auto pos = pProx->spr.pos;
auto pSect = pProx->sector();
@ -4575,7 +4575,7 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH)
case 5: return condCmp(objActor->spr.statnum, arg1, arg2, cmpOp);
case 6: return ((objActor->spr.flags & kHitagRespawn) || objActor->spr.statnum == kStatRespawn);
case 7: return condCmp(spriteGetSlope(objActor), arg1, arg2, cmpOp);
case 10: return condCmp(objActor->native_clipdist(), arg1, arg2, cmpOp);
case 10: return condCmp(int(objActor->clipdist * 4), arg1, arg2, cmpOp);
case 15:
if (!objActor->GetOwner()) return false;
else if (PUSH) condPush(aCond, objActor->GetOwner());

View file

@ -3395,7 +3395,7 @@ void processinput_r(int snum)
shrunk = (pact->spr.yrepeat < 8);
double tempfz;
if (pact->native_clipdist() == 64)
if (pact->clipdist == 16)
{
getzrange(p->pos, psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->pos);
@ -3918,7 +3918,7 @@ HORIZONLY:
while (ud.clipping == 0)
{
int blocked;
if (pact->native_clipdist() == 64)
if (pact->clipdist == 16)
blocked = (pushmove(p->pos, &p->cursector, 8, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);
else
blocked = (pushmove(p->pos, &p->cursector, 1, 4, 4, CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < DAngle90);

View file

@ -705,24 +705,6 @@ loc_flag:
DAngle nAngle = pPlayerActor->spr.angle;
auto thePos = pPlayerActor->spr.pos;
int ebp = nAngle.Cos() * (1 << 14) * (pPlayerActor->native_clipdist() << 3);
int ebx = nAngle.Sin() * (1 << 14) * (pPlayerActor->native_clipdist() << 3);
if (WeaponInfo[nWeapon].c)
{
int ecx;
int theVal = (totalmoves + 101) & (WeaponInfo[nWeapon].c - 1);
if (theVal & 1)
ecx = -theVal;
else
ecx = theVal;
DAngle angle = (nAngle + DAngle90).Normalized360();
ebp += angle.Cos() * (1 << 3) * ecx;
ebx += angle.Sin() * (1 << 3) * ecx;
}
double nHeight = GetActorHeight(pPlayerActor) * -0.5;
if (nAction < 6)

View file

@ -1744,7 +1744,7 @@ int InitPhosphorus(DSWActor* actor)
actorNew->spr.xrepeat = 64;
actorNew->spr.shade = -15;
// !FRANK - clipbox must be <= weapon otherwise can clip thru walls
if (actor->native_clipdist() > 0)
if (actor->clipdist > 0)
actorNew->clipdist -= 0.25;
else
actorNew->copy_clipdist(actor);

View file

@ -5409,7 +5409,7 @@ int GetDamage(DSWActor* actor, DSWActor* weapActor, int DamageNdx)
// take off the box around the player or else you'll never get
// the max_damage;
dist -= (((int)actor->native_clipdist())<(2));
dist -= int(actor->clipdist * worldtoint);
if (dist < 0) dist = 0;