- replaced all set_native_clipdist

Note that truncation has to be preserved here to ensure the size stays the same as before so the MulScales were not resolved into their factors.
This commit is contained in:
Christoph Oelckers 2022-10-04 19:22:46 +02:00
parent 84dfe98f17
commit a6e35edc6c
8 changed files with 10 additions and 22 deletions

View file

@ -167,11 +167,6 @@ public:
return static_cast<PClassActor*>(GetClass())->ActorInfo()->SpriteSet;
}
void set_native_clipdist(int val)
{
clipdist = val * 0.25;
}
int native_clipdist()
{
return clipdist * 4;

View file

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

View file

@ -181,14 +181,7 @@ void resetpins(sectortype* sect)
if (spawned)
{
spawned->spr.lotag = a2->spr.lotag;
if (spawned->spr.lotag == 3 || spawned->spr.lotag == 5)
{
spawned->set_native_clipdist((1 + (krand() % 1)) * 16 + 32);
}
else
{
spawned->set_native_clipdist((1 + (krand() % 1)) * 16 + 32);
}
spawned->clipdist = 12; // random formula here was bogus and always produced 48.
spawned->spr.angle -= DAngle22_5 * 0.125 * (((krand() & 32) - (krand() & 64)) >> 5); // weird formula to preserve number of krand calls.
}
}

View file

@ -1193,8 +1193,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->set_native_clipdist(lValue);
else SetGameVarID(lVar2, act->native_clipdist(), sActor, sPlayer);
if (bSet) act->clipdist = lValue * 0.25;
else SetGameVarID(lVar2, int(act->clipdist * 4), sActor, sPlayer);
break;
case ACTOR_DETAIL:
if (bSet) act->spriteextra = lValue;
@ -2196,7 +2196,7 @@ int ParseState::parse(void)
break;
case concmd_clipdist:
insptr++;
g_ac->set_native_clipdist( (uint8_t) *insptr);
g_ac->clipdist = ((uint8_t) *insptr) * 0.25;
insptr++;
break;
case concmd_cstat:

View file

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

View file

@ -747,7 +747,7 @@ void CreatePushBlock(sectortype* pSector)
sBlockInfo[nBlock].mindist = mindist;
pActor->set_native_clipdist( (int(mindist * worldtoint) & 0xFF) << 2);
pActor->clipdist = int(mindist * 16); // looks weird, but that's what the old code did.
pSector->extra = nBlock;
}

View file

@ -2020,7 +2020,7 @@ inline double ActorSizeToTop(DSWActor* a)
inline void SetActorSizeX(DSWActor* sp)
{
sp->set_native_clipdist(MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6));
sp->clipdist = MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6) * 0.25; // ensure proper truncation for this.
}
inline bool Facing(DSWActor* actor1, DSWActor* actor2)

View file

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