- wrapped most clipdist assignments

This commit is contained in:
Christoph Oelckers 2022-09-09 18:32:42 +02:00
parent d664f50240
commit 1ba20c7dce
26 changed files with 105 additions and 102 deletions

View file

@ -508,7 +508,7 @@ DEFINE_FIELD_NAMED(DCoreActor, spr.extra, extra)
DEFINE_FIELD_NAMED(DCoreActor, spr.detail, detail)
DEFINE_FIELD_NAMED(DCoreActor, spr.shade, shade)
DEFINE_FIELD_NAMED(DCoreActor, spr.pal, pal)
DEFINE_FIELD_NAMED(DCoreActor, spr.clipdist, clipdist)
DEFINE_FIELD_NAMED(DCoreActor, spr. clipdist, clipdist)
DEFINE_FIELD_NAMED(DCoreActor, spr.blend, blend)
DEFINE_FIELD_NAMED(DCoreActor, spr.xrepeat, xrepeat)
DEFINE_FIELD_NAMED(DCoreActor, spr.yrepeat, yrepeat)

View file

@ -268,7 +268,7 @@ public:
double fClipdist() const
{
return spr.clipdist * 0.25;
return spr. clipdist * 0.25;
}
int int_clipdist()
@ -281,6 +281,11 @@ public:
spr. clipdist = val;
}
int native_clipdist()
{
return spr. clipdist;
}
void set_const_clipdist(int val) // only for searching purposes
{
spr. clipdist = val;

View file

@ -305,7 +305,7 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
spr.picnum = fr.ReadInt16();
spr.shade = fr.ReadInt8();
spr.pal = fr.ReadUInt8();
spr.clipdist = fr.ReadUInt8();
spr. clipdist = fr.ReadUInt8();
spr.blend = fr.ReadUInt8();
spr.xrepeat = fr.ReadUInt8();
spr.yrepeat = fr.ReadUInt8();
@ -334,7 +334,7 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno)
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
spr.shade = fr.ReadInt8();
spr.pal = fr.ReadUInt8();
spr.clipdist = fr.ReadUInt8();
spr. clipdist = fr.ReadUInt8();
spr.xrepeat = fr.ReadUInt8();
spr.yrepeat = fr.ReadUInt8();
spr.xoffset = fr.ReadInt8();
@ -389,7 +389,7 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno)
spr.pal = sec->floorpal;
spr.blend = 0;
spr.clipdist = 32;
spr. clipdist = 32;
spr.xoffset = 0;
spr.yoffset = 0;
spr.detail = 0;

View file

@ -2383,7 +2383,7 @@ static void actInitThings()
// but what if it have voxel model...?
if (!gModernMap)
#endif
act->spr.clipdist = thingInfo[nType].clipdist;
act->set_native_clipdist(thingInfo[nType].clipdist);
act->spr.flags = thingInfo[nType].flags;
if (act->spr.flags & kPhysGravity) act->spr.flags |= kPhysFalling;
@ -2480,12 +2480,12 @@ static void actInitDudes()
if (gModernMap) break;
[[fallthrough]];
default:
act->spr.clipdist = dudeInfo[nType].clipdist;
act->set_native_clipdist(dudeInfo[nType].clipdist);
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
break;
}
#else
act->spr.clipdist = dudeInfo[nType].clipdist;
act->set_native_clipdist(dudeInfo[nType].clipdist);
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
#endif
@ -4183,7 +4183,7 @@ static void checkCeilHit(DBloodActor* actor)
}
if (mass1 > mass2)
{
int dmg = abs((mass1 - mass2) * (actor2->spr.clipdist - actor->spr.clipdist));
int dmg = abs((mass1 - mass2) * (actor2->native_clipdist()) - actor->native_clipdist());
if (actor2->IsDudeActor())
{
if (dmg > 0) actDamageSprite(actor2, actor, (Chance(0x2000)) ? kDamageFall : (Chance(0x4000)) ? kDamageExplode : kDamageBullet, dmg);
@ -4347,7 +4347,7 @@ static void checkFloorHit(DBloodActor* actor)
if ((actor2->IsPlayerActor() && Chance(0x500)) || !actor2->IsPlayerActor())
actKickObject(actor, actor2);
int dmg = (mass1 - mass2) + actor->spr.clipdist;
int dmg = (mass1 - mass2) + actor->native_clipdist();
if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg);
}
}
@ -6245,7 +6245,7 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
SetActor(spawned, pos);
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->spr.clipdist = getDudeInfo(nDude + kDudeBase)->clipdist;
spawned->set_native_clipdist(getDudeInfo(nDude + kDudeBase)->clipdist);
spawned->xspr.health = getDudeInfo(nDude + kDudeBase)->startHealth << 4;
spawned->xspr.respawn = 1;
if (getSequence(getDudeInfo(nDude + kDudeBase)->seqStartID))
@ -6303,7 +6303,7 @@ DBloodActor* actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingT
assert(actor->hasX());
const THINGINFO* pThingInfo = &thingInfo[nType];
actor->xspr.health = pThingInfo->startHealth << 4;
actor->spr.clipdist = pThingInfo->clipdist;
actor->set_native_clipdist(pThingInfo->clipdist);
actor->spr.flags = pThingInfo->flags;
if (actor->spr.flags & 2) actor->spr.flags |= 4;
actor->spr.cstat |= pThingInfo->cstat;
@ -6392,12 +6392,12 @@ DBloodActor* actFireThing(DBloodActor* actor, int a2, int a3, int a4, int thingT
int x = actor->int_pos().X + MulScale(a2, Cos(actor->int_ang() + 512), 30);
int y = actor->int_pos().Y + MulScale(a2, Sin(actor->int_ang() + 512), 30);
int z = actor->int_pos().Z + a3;
x += MulScale(actor->spr.clipdist, Cos(actor->int_ang()), 28);
y += MulScale(actor->spr.clipdist, Sin(actor->int_ang()), 28);
if (HitScan(actor, z, x - actor->int_pos().X, y - actor->int_pos().Y, 0, CLIPMASK0, actor->spr.clipdist) != -1)
x += MulScale(actor->native_clipdist(), Cos(actor->int_ang()), 28);
y += MulScale(actor->native_clipdist(), Sin(actor->int_ang()), 28);
if (HitScan(actor, z, x - actor->int_pos().X, y - actor->int_pos().Y, 0, CLIPMASK0, actor->native_clipdist()) != -1)
{
x = gHitInfo.int_hitpos().X - MulScale(actor->spr.clipdist << 1, Cos(actor->int_ang()), 28);
y = gHitInfo.int_hitpos().Y - MulScale(actor->spr.clipdist << 1, Sin(actor->int_ang()), 28);
x = gHitInfo.int_hitpos().X - MulScale(actor->native_clipdist() << 1, Cos(actor->int_ang()), 28);
y = gHitInfo.int_hitpos().Y - MulScale(actor->native_clipdist() << 1, Sin(actor->int_ang()), 28);
}
auto fired = actSpawnThing(actor->sector(), x, y, z, thingType);
fired->SetOwner(actor);
@ -6505,7 +6505,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
int x = actor->int_pos().X + MulScale(a2, Cos(actor->int_ang() + 512), 30);
int y = actor->int_pos().Y + MulScale(a2, Sin(actor->int_ang() + 512), 30);
int z = actor->int_pos().Z + a3;
int clipdist = pMissileInfo->clipDist + actor->spr.clipdist;
int clipdist = pMissileInfo->clipDist + actor->native_clipdist();
x += MulScale(clipdist, Cos(actor->int_ang()), 28);
y += MulScale(clipdist, Sin(actor->int_ang()), 28);
int hit = HitScan(actor, z, x - actor->int_pos().X, y - actor->int_pos().Y, 0, CLIPMASK0, clipdist);
@ -6530,7 +6530,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
spawned->spr.type = nType;
spawned->spr.shade = pMissileInfo->shade;
spawned->spr.pal = 0;
spawned->spr.clipdist = pMissileInfo->clipDist;
spawned->set_native_clipdist(pMissileInfo->clipDist);
spawned->spr.flags = 1;
spawned->spr.xrepeat = pMissileInfo->xrepeat;
spawned->spr.yrepeat = pMissileInfo->yrepeat;

View file

@ -144,11 +144,11 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
if (target->IsPlayerActor() && pDudeExtraE->birthCounter < 10)
{
if (nDist < 0x1a00 && nDist > 0x1400 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
spawned = actSpawnDude(actor, kDudeSpiderRed, actor->spr.clipdist, 0);
spawned = actSpawnDude(actor, kDudeSpiderRed, actor->native_clipdist(), 0);
else if (nDist < 0x1400 && nDist > 0xc00 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
spawned = actSpawnDude(actor, kDudeSpiderBrown, actor->spr.clipdist, 0);
spawned = actSpawnDude(actor, kDudeSpiderBrown, actor->native_clipdist(), 0);
else if (nDist < 0xc00 && abs(actor->int_ang() - nAngle) < pDudeInfo->periphery)
spawned = actSpawnDude(actor, kDudeSpiderBrown, actor->spr.clipdist, 0);
spawned = actSpawnDude(actor, kDudeSpiderBrown, actor->native_clipdist(), 0);
if (spawned)
{

View file

@ -243,7 +243,7 @@ void genDudeAttack1(int, DBloodActor* actor)
else if (pExtra->weaponType == kGenDudeWeaponSummon)
{
DBloodActor* spawned = nullptr;
int dist = actor->spr.clipdist << 4;
int dist = actor->native_clipdist() << 4;
if (pExtra->slaveCount <= gGameOptions.nDifficulty)
{
if ((spawned = actSpawnDude(actor, pExtra->curWeapon, dist + Random(dist), 0)) != NULL)
@ -489,7 +489,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->spr.clipdist >> 1, 1));
velocity.X = velocity.Y = FixedToFloat(ClipLow(actor->native_clipdist() >> 1, 1));
//aiChooseDirection(actor,getangle(dx, dy));
aiGenDudeChooseDirection(actor, VecToAngle(dx, dy), velocity);
@ -1881,7 +1881,7 @@ DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, int nDist)
spawned->spr.angle = actor->spr.angle;
SetActor(spawned, pos);
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->spr.clipdist = dudeInfo[nType - kDudeBase].clipdist;
spawned->set_native_clipdist(dudeInfo[nType - kDudeBase].clipdist);
// inherit weapon, seq and sound settings.
spawned->xspr.data1 = source->xspr.data1;
@ -2262,7 +2262,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->spr.clipdist;
pExtra->initVals[2] = actor->native_clipdist();
if (propId) break;
[[fallthrough]];
@ -2476,7 +2476,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
if (!(actor->sector()->floorstat & CSTAT_SECTOR_SKY))
actor->add_int_z(ClipHigh(actor->sector()->int_floorz() - zBot, 0));
actor->spr.clipdist = ClipRange((actor->spr.xrepeat + actor->spr.yrepeat) >> 1, 4, 120);
actor->set_native_clipdist(ClipRange((actor->spr.xrepeat + actor->spr.yrepeat) >> 1, 4, 120));
if (propId) break;
}
}

View file

@ -302,7 +302,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
switch (actor->spr.type) {
default:
actor->spr.clipdist = getDudeInfo(nType + kDudeBase)->clipdist;
actor->set_native_clipdist(getDudeInfo(nType + kDudeBase)->clipdist);
if (getSequence(getDudeInfo(nType + kDudeBase)->seqStartID))
seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID, actor, -1);
break;
@ -317,7 +317,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
actor->SetTarget(nullptr);
}
#else
actor->spr.clipdist = getDudeInfo(nType + kDudeBase)->clipdist;
actor->set_native_clipdist(getDudeInfo(nType + kDudeBase)->clipdist);
actor->xspr.health = getDudeInfo(nType + kDudeBase)->startHealth << 4;
if (getSequence(getDudeInfo(nType + kDudeBase)->seqStartID))
seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID, actor, -1);
@ -454,7 +454,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
if (!actor) return;
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->native_clipdist(), CLIPMASK0);
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->add_int_z(floorZ - bottom);
@ -513,7 +513,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->native_clipdist(), CLIPMASK0);
int top, bottom; GetActorExtents(actor, &top, &bottom);
actor->add_int_z(floorZ - bottom);
@ -641,7 +641,7 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->spr.clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, actor->native_clipdist(), CLIPMASK0);
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->add_int_z(floorZ - bottom);

View file

@ -328,8 +328,8 @@ void fxSpawnPodStuff(DBloodActor* actor, int)
void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
{
int x = actor->int_pos().X + MulScale(actor->spr.clipdist - 4, Cos(actor->int_ang()), 28);
int y = actor->int_pos().Y + MulScale(actor->spr.clipdist - 4, Sin(actor->int_ang()), 28);
int x = actor->int_pos().X + MulScale(actor->native_clipdist() - 4, Cos(actor->int_ang()), 28);
int y = actor->int_pos().Y + MulScale(actor->native_clipdist() - 4, Sin(actor->int_ang()), 28);
x += MulScale(a3, Cos(actor->int_ang() + 512), 30);
y += MulScale(a3, Sin(actor->int_ang() + 512), 30);
auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), actor->sector(), x, y, z, 0);
@ -353,8 +353,8 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4)
{
int x = actor->int_pos().X + MulScale(actor->spr.clipdist - 4, Cos(actor->int_ang()), 28);
int y = actor->int_pos().Y + MulScale(actor->spr.clipdist - 4, Sin(actor->int_ang()), 28);
int x = actor->int_pos().X + MulScale(actor->native_clipdist() - 4, Cos(actor->int_ang()), 28);
int y = actor->int_pos().Y + MulScale(actor->native_clipdist() - 4, Sin(actor->int_ang()), 28);
x += MulScale(a3, Cos(actor->int_ang() + 512), 30);
y += MulScale(a3, Sin(actor->int_ang() + 512), 30);
auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), actor->sector(), x, y, z, 0);

View file

@ -277,7 +277,7 @@ static DBloodActor* nnExtSpawnDude(DBloodActor* sourceactor, DBloodActor* origin
pDudeActor->set_int_ang(angle);
pDudeActor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
pDudeActor->spr.clipdist = getDudeInfo(nType)->clipdist;
pDudeActor->set_native_clipdist(getDudeInfo(nType)->clipdist);
pDudeActor->xspr.respawn = 1;
pDudeActor->xspr.health = getDudeInfo(nType)->startHealth << 4;
@ -1412,7 +1412,7 @@ void sfxPlayVectorSound(DBloodActor* actor, int vectorId)
int getSpriteMassBySize(DBloodActor* actor)
{
int mass = 0; int seqId = -1; int clipDist = actor->spr.clipdist;
int mass = 0; int seqId = -1; int clipDist = actor->native_clipdist();
if (!actor->hasX())
{
I_Error("getSpriteMassBySize: actor->spr.hasX == false");
@ -1461,7 +1461,7 @@ int getSpriteMassBySize(DBloodActor* actor)
picnum = actor->spr.picnum;
}
clipDist = ClipLow(actor->spr.clipdist, 1);
clipDist = ClipLow(actor->native_clipdist(), 1);
int x = tileWidth(picnum);
int y = tileHeight(picnum);
int xrepeat = actor->spr.xrepeat;
@ -1524,7 +1524,7 @@ int getSpriteMassBySize(DBloodActor* actor)
cached->yrepeat = actor->spr.yrepeat;
cached->picnum = actor->spr.picnum;
cached->seqId = seqId;
cached->clipdist = actor->spr.clipdist;
cached->clipdist = actor->native_clipdist();
return cached->mass;
}
@ -4605,7 +4605,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->spr.clipdist, arg1, arg2, cmpOp);
case 10: return condCmp(objActor->native_clipdist(), arg1, arg2, cmpOp);
case 15:
if (!objActor->GetOwner()) return false;
else if (PUSH) condPush(aCond, objActor->GetOwner());
@ -5597,13 +5597,13 @@ bool modernTypeOperateSector(sectortype* pSector, const EVENT& event)
void useCustomDudeSpawn(DBloodActor* pSource, DBloodActor* pActor)
{
genDudeSpawn(pSource, pActor, pActor->spr.clipdist << 1);
genDudeSpawn(pSource, pActor, pActor->native_clipdist() << 1);
}
void useDudeSpawn(DBloodActor* pSource, DBloodActor* pActor)
{
if (randomSpawnDude(pSource, pActor, pActor->spr.clipdist << 1, 0) == nullptr)
nnExtSpawnDude(pSource, pActor, pActor->xspr.data1, pActor->spr.clipdist << 1, 0);
if (randomSpawnDude(pSource, pActor, pActor->native_clipdist() << 1, 0) == nullptr)
nnExtSpawnDude(pSource, pActor, pActor->xspr.data1, pActor->native_clipdist() << 1, 0);
}
//---------------------------------------------------------------------------
@ -7897,7 +7897,7 @@ bool aiPatrolMarkerReached(DBloodActor* actor)
auto markeractor = actor->GetTarget();
if (markeractor && markeractor->spr.type == kMarkerPath)
{
int okDist = ClipLow(markeractor->spr.clipdist << 1, 4);
int okDist = ClipLow(markeractor->native_clipdist() << 1, 4);
int oX = abs(markeractor->int_pos().X - actor->int_pos().X) >> 4;
int oY = abs(markeractor->int_pos().Y - actor->int_pos().Y) >> 4;
@ -7905,7 +7905,7 @@ bool aiPatrolMarkerReached(DBloodActor* actor)
{
if (spriteIsUnderwater(actor) || pExtra->flying)
{
okDist = markeractor->spr.clipdist << 4;
okDist = markeractor->native_clipdist() << 4;
int ztop, zbot, ztop2, zbot2;
GetActorExtents(actor, &ztop, &zbot);
GetActorExtents(markeractor, &ztop2, &zbot2);
@ -9223,7 +9223,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22
}
burstactor->spr.pal = actor->spr.pal;
burstactor->spr.clipdist = actor->spr.clipdist / 4;
burstactor->set_native_clipdist(actor->native_clipdist() / 4);
burstactor->spr.flags = actor->spr.flags;
burstactor->spr.xrepeat = actor->spr.xrepeat / 2;
burstactor->spr.yrepeat = actor->spr.yrepeat / 2;

View file

@ -694,7 +694,7 @@ void playerSetRace(PLAYER* pPlayer, int nLifeMode)
pPlayer->lifeMode = nLifeMode;
// By NoOne: don't forget to change clipdist for grow and shrink modes
pPlayer->actor->spr.clipdist = pDudeInfo->clipdist;
pPlayer->actor->set_native_clipdist(pDudeInfo->clipdist);
for (int i = 0; i < 7; i++)
pDudeInfo->damageVal[i] = MulScale(Handicap[gSkill], pDudeInfo->startDamage[i], 8);
@ -812,7 +812,7 @@ void playerStart(int nPlayer, int bNewLevel)
actor->set_int_ang(pStartZone->ang);
pPlayer->angle.ang = actor->spr.angle;
actor->spr.type = kDudePlayer1 + nPlayer;
actor->spr.clipdist = pDudeInfo->clipdist;
actor->set_native_clipdist(pDudeInfo->clipdist);
actor->spr.flags = 15;
actor->xspr.burnTime = 0;
actor->SetBurnSource(nullptr);
@ -1758,7 +1758,7 @@ void ProcessInput(PLAYER* pPlayer)
if (pPlayer->handTime <= 0 && pPlayer->hand)
{
DBloodActor* pactor = pPlayer->actor;
auto spawned = actSpawnDude(pactor, kDudeHand, pPlayer->actor->spr.clipdist << 1, 0);
auto spawned = actSpawnDude(pactor, kDudeHand, pPlayer->actor->native_clipdist() << 1, 0);
if (spawned)
{
spawned->set_int_ang((pPlayer->actor->int_ang() + 1024) & 2047);

View file

@ -2575,7 +2575,7 @@ void handle_se00(DDukeActor* actor)
actor->tempang += 4;
if (actor->tempang >= 256)
callsound(actor->sector(), actor, true);
if (actor->spr.clipdist) l = 1;
if (actor->native_clipdist()) l = 1;
else l = -1;
}
else actor->tempang = 256;
@ -2603,7 +2603,7 @@ void handle_se00(DDukeActor* actor)
actor->tempang -= 4;
if (actor->tempang <= 0)
callsound(actor->sector(), actor, true);
if (actor->spr.clipdist) l = -1;
if (actor->native_clipdist()) l = -1;
else l = 1;
}
else actor->tempang = 0;

View file

@ -1097,7 +1097,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo
j->spr.yrepeat = 8;
j->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL;
j->set_int_ang((j->int_ang() + 512) & 2047);
j->spr.clipdist = MulScale(proj->spr.xrepeat, tileWidth(proj->spr.picnum), 7);
j->set_native_clipdist(MulScale(proj->spr.xrepeat, tileWidth(proj->spr.picnum), 7));
}
}
deletesprite(proj);
@ -1878,7 +1878,7 @@ static void rrra_specialstats()
{
act->spr.xrepeat >>= 1;
act->spr.yrepeat >>= 1;
act->spr.clipdist = MulScale(act->spr.xrepeat, tileHeight(act->spr.picnum), 7);
act->set_native_clipdist(MulScale(act->spr.xrepeat, tileHeight(act->spr.picnum), 7));
}
break;
}

View file

@ -1196,8 +1196,8 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, act->spr.pal, sActor, sPlayer);
break;
case ACTOR_CLIPDIST:
if (bSet) act->spr.clipdist = lValue;
else SetGameVarID(lVar2, act->spr.clipdist, sActor, sPlayer);
if (bSet) act->set_native_clipdist(lValue);
else SetGameVarID(lVar2, act->native_clipdist(), sActor, sPlayer);
break;
case ACTOR_DETAIL:
if (bSet) act->spriteextra = lValue;
@ -2190,7 +2190,7 @@ int ParseState::parse(void)
break;
case concmd_clipdist:
insptr++;
g_ac->spr.clipdist = (uint8_t) *insptr;
g_ac->set_native_clipdist( (uint8_t) *insptr);
insptr++;
break;
case concmd_cstat:

View file

@ -3398,7 +3398,7 @@ void processinput_r(int snum)
shrunk = (pact->spr.yrepeat < 8);
int tempfz;
if (pact->spr.clipdist == 64)
if (pact->native_clipdist() == 64)
{
getzrange(p->player_int_pos(), psectp, &cz, chz, &fz, clz, 163L, CLIPMASK0);
tempfz = getflorzofslopeptr(psectp, p->player_int_pos().X, p->player_int_pos().Y);
@ -3932,7 +3932,7 @@ HORIZONLY:
while (ud.clipping == 0)
{
int blocked;
if (pact->spr.clipdist == 64)
if (pact->native_clipdist() == 64)
blocked = (pushmove(p->pos, &p->cursector, 128, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);
else
blocked = (pushmove(p->pos, &p->cursector, 16, (4 << 8), (4 << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512);

View file

@ -136,7 +136,7 @@ public:
void setClipDistFromTile()
{
spr.clipdist = MulScale(spr.xrepeat, tileWidth(spr.picnum), 7);
set_native_clipdist(MulScale(spr.xrepeat, tileWidth(spr.picnum), 7));
}
};

View file

@ -355,7 +355,7 @@ int MoveBullet(int nBullet)
}
}
coll = movesprite(pActor, pBullet->vect, pActor->spr.clipdist >> 1, pActor->spr.clipdist >> 1, CLIPMASK1);
coll = movesprite(pActor, pBullet->vect, pActor->native_clipdist() >> 1, pActor->native_clipdist() >> 1, CLIPMASK1);
MOVEEND:
if (coll.type || coll.exbits)

View file

@ -75,7 +75,7 @@ void ThrowGrenade(int nPlayer, int, int, int ecx, int push1)
pActor->nTurn = ((90 - pActor->nIndex2) * (90 - pActor->nIndex2)) + nVel;
pActor->set_int_zvel((-64 * push1) - 4352);
auto nMov = movesprite(pActor, bcos(nAngle) * (pPlayerActor->spr.clipdist << 3), bsin(nAngle) * (pPlayerActor->spr.clipdist << 3), ecx, 0, 0, CLIPMASK1);
auto nMov = movesprite(pActor, bcos(nAngle) * (pPlayerActor->native_clipdist() << 3), bsin(nAngle) * (pPlayerActor->native_clipdist() << 3), ecx, 0, 0, CLIPMASK1);
if (nMov.type == kHitWall)
{
nAngle = GetWallNormal(nMov.hitWall);
@ -280,7 +280,7 @@ void AIGrenade::Tick(RunListEvent* ev)
int zVel = pActor->int_zvel();
Gravity(pActor);
auto nMov = movesprite(pActor, pActor->x, pActor->y, pActor->int_zvel(), pActor->spr.clipdist >> 1, pActor->spr.clipdist >> 1, CLIPMASK1);
auto nMov = movesprite(pActor, pActor->x, pActor->y, pActor->int_zvel(), pActor->native_clipdist() >> 1, pActor->native_clipdist() >> 1, CLIPMASK1);
if (!nMov.type && !nMov.exbits)
return;

View file

@ -635,8 +635,8 @@ loc_flag:
DAngle nAngle = pPlayerActor->spr.angle;
auto thePos = pPlayerActor->spr.pos;
int ebp = nAngle.Cos() * (1 << 14) * (pPlayerActor->spr.clipdist << 3);
int ebx = nAngle.Sin() * (1 << 14) * (pPlayerActor->spr.clipdist << 3);
int ebp = nAngle.Cos() * (1 << 14) * (pPlayerActor->native_clipdist() << 3);
int ebx = nAngle.Sin() * (1 << 14) * (pPlayerActor->native_clipdist() << 3);
if (WeaponInfo[nWeapon].c)
{

View file

@ -812,7 +812,7 @@ void CreatePushBlock(sectortype* pSector)
sBlockInfo[nBlock].field_8 = mindist * worldtoint;
pActor->spr.clipdist = (int(mindist * worldtoint) & 0xFF) << 2;
pActor->set_native_clipdist( (int(mindist * worldtoint) & 0xFF) << 2);
pSector->extra = nBlock;
}
@ -956,7 +956,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
pos.Y = pActor->int_pos().Y;
pSectorB = pSector;
clipmove(pos, &pSectorB, -xvect, -yvect, 4 * pActor->spr.clipdist, 0, 0, CLIPMASK0, scratch);
clipmove(pos, &pSectorB, -xvect, -yvect, 4 * pActor->native_clipdist(), 0, 0, CLIPMASK0, scratch);
if (pSectorB) {
ChangeActorSect(pActor, pSectorB);
@ -973,9 +973,9 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
pSectorB = pNextSector;
clipmove(pos, &pSectorB,
-xvect - (bcos(nAngle) * (4 * pActor->spr.clipdist)),
-yvect - (bsin(nAngle) * (4 * pActor->spr.clipdist)),
4 * pActor->spr.clipdist, 0, 0, CLIPMASK0, scratch);
-xvect - (bcos(nAngle) * (4 * pActor->native_clipdist())),
-yvect - (bsin(nAngle) * (4 * pActor->native_clipdist())),
4 * pActor->native_clipdist(), 0, 0, CLIPMASK0, scratch);
if (pSectorB != pNextSector && (pSectorB == pSector || pNextSector == pSector))
@ -989,8 +989,8 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
else
{
movesprite(pActor,
(xvect << 14) + bcos(nAngle) * pActor->spr.clipdist,
(yvect << 14) + bsin(nAngle) * pActor->spr.clipdist,
(xvect << 14) + bcos(nAngle) * pActor->native_clipdist(),
(yvect << 14) + bsin(nAngle) * pActor->native_clipdist(),
0, 0, 0, CLIPMASK0);
}
}
@ -1018,7 +1018,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
if (pActor->spr.statnum >= 99 && nZVal == pActor->int_pos().Z && !(pActor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
{
pSectorB = pSector;
clipmove(pActor->spr.pos, &pSectorB, xvect, yvect, 4 * pActor->spr.clipdist, 5120, -5120, CLIPMASK0, scratch);
clipmove(pActor->spr.pos, &pSectorB, xvect, yvect, 4 * pActor->native_clipdist(), 5120, -5120, CLIPMASK0, scratch);
}
}
}

View file

@ -2053,7 +2053,7 @@ inline double ActorSizeToTop(DSWActor* a)
inline void SetActorSizeX(DSWActor* sp)
{
sp->spr.clipdist = MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6);
sp->set_native_clipdist(MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6));
}
inline bool Facing(DSWActor* actor1, DSWActor* actor2)

View file

@ -1291,13 +1291,13 @@ int PlayerInitChemBomb(PLAYER* pp)
actorNew->vel.Z -= pp->horizon.horiz.asbuildf() * HORIZ_MULTF;
oclipdist = plActor->spr.clipdist;
oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
actorNew->set_const_clipdist(0);
MissileSetPos(actorNew, DoChemBomb, 1000);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
actorNew->set_const_clipdist(80 >> 2);
UpdateChange(actorNew, 0.5);
@ -1655,13 +1655,13 @@ int PlayerInitCaltrops(PLAYER* pp)
actorNew->vel.Z -= pp->horizon.horiz.asbuildf() * 0.5;
oclipdist = plActor->spr.clipdist;
oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
actorNew->set_const_clipdist(0);
MissileSetPos(actorNew, DoCaltrops, 1000);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
actorNew->set_const_clipdist(80 >> 2);
UpdateChange(actorNew, 0.5);
@ -1736,7 +1736,7 @@ int InitPhosphorus(DSWActor* actor)
actorNew->spr.shade = -15;
// !FRANK - clipbox must be <= weapon otherwise can clip thru walls
if (actor->spr.clipdist > 0)
actorNew->spr.clipdist = actor->spr.clipdist-1;
actorNew->set_native_clipdist(actor->spr.clipdist-1);
else
actorNew->copy_clipdist(actor);
actorNew->user.WeaponNum = actor->user.WeaponNum;

View file

@ -3559,7 +3559,7 @@ int DoPlayerWadeSuperJump(PLAYER* pp)
if (hit.hitSector != nullptr && abs(hit.hitSector->floorz - pp->pos.Z) < 50)
{
double dist = (pp->pos.XY() - hit.hitpos.XY()).Length();
double comp = ((((int)pp->actor->spr.clipdist)<<2) + 256) * inttoworld;
double comp = (pp->actor->fClipdist() + 16);
if (dist < comp)
return true;
}

View file

@ -1263,20 +1263,18 @@ void KillMatchingCrackSprites(short match)
void WeaponExplodeSectorInRange(DSWActor* wActor)
{
int radius;
SWStatIterator it(STAT_SPRITE_HIT_MATCH);
while (auto actor = it.Next())
{
// test to see if explosion is close to crack sprite
double dist = (wActor->spr.pos - actor->spr.pos).Length();
if (actor->spr.clipdist == 0)
if (actor->native_clipdist() == 0)
continue;
radius = (((int)actor->spr.clipdist) << 2) * 8;
double radius = actor->fClipdist() * 8;
if (dist > ((wActor->user.Radius/2) + radius) * inttoworld)
if (dist > (wActor->user.fRadius()/2) + radius)
continue;
if (!FAFcansee(wActor->spr.pos, wActor->sector(), actor->spr.pos, actor->sector()))

View file

@ -1843,7 +1843,7 @@ void SpriteSetup(void)
{
sectp->u_defined = true;
sectp->number = actor->spr.lotag;
if (actor->spr.clipdist == 1)
if (actor->native_clipdist() == 1)
sectp->flags |= (SECTFU_CANT_SURFACE);
change_actor_stat(actor, STAT_UNDERWATER2);
}

View file

@ -1048,7 +1048,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
break;
case SPAWN_SPOT:
if (actor->spr.clipdist == 3)
if (actor->native_clipdist() == 3)
{
change_actor_stat(actor, STAT_NO_STATE);
SpawnUser(actor, 0, nullptr);
@ -1118,7 +1118,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
else
sop->max_damage = actorNew->user.MaxHealth;
switch (actor->spr.clipdist)
switch (actor->native_clipdist()) // notreallyclipdist
{
case 0:
break;
@ -2562,7 +2562,7 @@ void VehicleSetSmoke(SECTOR_OBJECT* sop, ANIMATOR* animator)
{
case SPAWN_SPOT:
if (actor->spr.clipdist == 3)
if (actor->native_clipdist() == 3)
{
if (animator)
{

View file

@ -45,8 +45,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
#define RESTORE_CLIP actor->spr.clipdist = oclipdist
#define SAVE_CLIP auto oclipdist = actor->spr.clipdist
#define RESTORE_CLIP actor->set_native_clipdist(oclipdist)
#define SAVE_CLIP auto oclipdist = actor->native_clipdist()
struct MISSILE_PLACEMENT
{
@ -5412,7 +5412,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->spr.clipdist)<<(2));
dist -= (((int)actor->native_clipdist())<(2));
if (dist < 0) dist = 0;
@ -12072,7 +12072,7 @@ void InitSpellNapalm(PLAYER* pp)
actor->user.ceiling_dist = (1);
actor->user.Dist = 12.5;
auto oclipdist = plActor->spr.clipdist;
auto oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(1);
if (mp[i].dist_over != 0)
@ -12086,7 +12086,7 @@ void InitSpellNapalm(PLAYER* pp)
if (MissileSetPos(actor, DoNapalm, mp[i].dist_out))
{
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
KillActor(actor);
continue;
}
@ -12094,7 +12094,7 @@ void InitSpellNapalm(PLAYER* pp)
if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actor))
actor->user.Flags |= (SPR_UNDERWATER);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
actor->user.Counter = 0;
@ -12204,13 +12204,13 @@ int InitSpellMirv(PLAYER* pp)
actorNew->user.Dist = 12.5;
DSWActor* plActor = pp->actor;
auto oclipdist = plActor->spr.clipdist;
auto oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
UpdateChange(actorNew);
MissileSetPos(actorNew, DoMirv, 600);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
actorNew->user.Counter = 0;
return 0;
@ -13179,14 +13179,14 @@ void InitHeartAttack(PLAYER* pp)
actorNew->user.ceiling_dist = (1);
actorNew->user.Dist = 12.5;
auto oclipdist = plActor->spr.clipdist;
auto oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(1);
UpdateChange(actorNew);
MissileSetPos(actorNew, DoBloodWorm, mp[i].dist_out);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
actorNew->user.Counter = 0;
actorNew->user.Counter2 = 0;
actorNew->user.Counter3 = 0;
@ -15344,7 +15344,7 @@ int InitTracerUzi(PLAYER* pp)
actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE);
DSWActor* plActor = pp->actor;
auto oclipdist = plActor->spr.clipdist;
auto oclipdist = plActor->native_clipdist();
plActor->set_const_clipdist(0);
actorNew->spr.angle += DAngle90;
@ -15356,14 +15356,14 @@ int InitTracerUzi(PLAYER* pp)
if (MissileSetPos(actorNew, DoTracerStart, 800))
{
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
KillActor(actorNew);
return 0;
}
actorNew->vel.Z = -pp->horizon.horiz.asbuildf() * actorNew->vel.X * (1. / 128.);
plActor->spr.clipdist = oclipdist;
plActor->set_native_clipdist(oclipdist);
WeaponAutoAim(pp->actor, actorNew, DAngle22_5 / 4, false);