mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- SW: SectorExp floatified
This commit is contained in:
parent
ed6adc33c4
commit
22dae296c6
3 changed files with 15 additions and 15 deletions
|
@ -115,6 +115,7 @@ inline int RANDOM(void)
|
|||
return randomseed;
|
||||
}
|
||||
int RANDOM_P2(int pwr_of_2) { return (RANDOM() & (pwr_of_2 - 1)); }
|
||||
double RANDOM_P2F(int pwr_of_2) { return (RANDOM() & (pwr_of_2 - 1)) * maptoworld; }
|
||||
|
||||
//
|
||||
// Map directions/degrees
|
||||
|
@ -2068,11 +2069,16 @@ inline int ActorUpperZ(DSWActor* actor)
|
|||
return (ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2));
|
||||
}
|
||||
|
||||
inline int ActorLowerZ(DSWActor* actor)
|
||||
inline int int_ActorLowerZ(DSWActor* actor)
|
||||
{
|
||||
return (ActorZOfBottom(actor) - (ActorSizeZ(actor) >> 2));
|
||||
}
|
||||
|
||||
inline double ActorLowerZ(DSWActor* actor)
|
||||
{
|
||||
return (ActorZOfBottom(actor) - (ActorSizeZ(actor) * 0.25)) * zinttoworld;
|
||||
}
|
||||
|
||||
// Z size of top (TOS) and bottom (BOS) part of sprite
|
||||
inline int ActorSizeToTop(DSWActor* a)
|
||||
{
|
||||
|
|
|
@ -841,15 +841,13 @@ int AnimateSwitch(DSWActor* actor, int tgt_value)
|
|||
}
|
||||
|
||||
|
||||
void SectorExp(DSWActor* actor, sectortype* sectp, short orig_ang, int zh)
|
||||
void SectorExp(DSWActor* actor, sectortype* sectp, double zh)
|
||||
{
|
||||
int x,y,z;
|
||||
|
||||
actor->spr.cstat &= ~(CSTAT_SPRITE_ALIGNMENT_WALL|CSTAT_SPRITE_ALIGNMENT_FLOOR);
|
||||
SectorMidPoint(sectp, &x, &y, &z);
|
||||
auto mid = SectorMidPoint(sectp);
|
||||
// randomize the explosions
|
||||
actor->set_int_ang(orig_ang + RANDOM_P2(256) - 128);
|
||||
actor->set_int_pos({ x + RANDOM_P2(256) - 128, y + RANDOM_P2(1024) - 512, zh });
|
||||
actor->spr.angle = DAngle::fromBuild(RANDOM_P2(256) - 128);
|
||||
actor->spr.pos = { mid.X + RANDOM_P2F(256) - 16, mid.Y + RANDOM_P2F(1024) - 64, zh };
|
||||
|
||||
// setup vars needed by SectorExp
|
||||
ChangeActorSect(actor, sectp);
|
||||
|
@ -868,13 +866,8 @@ void SectorExp(DSWActor* actor, sectortype* sectp, short orig_ang, int zh)
|
|||
|
||||
void DoExplodeSector(short match)
|
||||
{
|
||||
short orig_ang;
|
||||
int zh;
|
||||
|
||||
sectortype* sectp;
|
||||
|
||||
orig_ang = 0;
|
||||
|
||||
SWStatIterator it(STAT_EXPLODING_CEIL_FLOOR);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
|
@ -898,9 +891,9 @@ void DoExplodeSector(short match)
|
|||
sectp->setceilingslope(SP_TAG6(actor));
|
||||
}
|
||||
|
||||
for (zh = sectp->int_ceilingz(); zh < sectp->int_floorz(); zh += Z(60))
|
||||
for (double zh = sectp->ceilingz; zh < sectp->floorz; zh += 60)
|
||||
{
|
||||
SectorExp(actor, actor->sector(), orig_ang, zh + Z(RANDOM_P2(64)) - Z(32));
|
||||
SectorExp(actor, actor->sector(), zh + RANDOM_P2(64) - 32);
|
||||
}
|
||||
|
||||
// don't need it any more
|
||||
|
|
|
@ -3728,7 +3728,8 @@ int ActorCoughItem(DSWActor* actor)
|
|||
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
|
||||
actorNew->spr.cstat = 0;
|
||||
actorNew->spr.extra = 0;
|
||||
actorNew->set_int_pos({ actor->int_pos().X, actor->int_pos().Y, ActorLowerZ(actor) + Z(10) });
|
||||
actorNew->spr.pos.XY() = actor->spr.pos.XY();
|
||||
actorNew->spr.pos.Z = ActorLowerZ(actor) + 10;
|
||||
actorNew->spr.angle = actor->spr.angle;
|
||||
|
||||
// vel
|
||||
|
|
Loading…
Reference in a new issue