- second batch of sector.cpp

This commit is contained in:
Christoph Oelckers 2021-11-02 20:58:26 +01:00
parent 2b8ea7ae1b
commit 1e00a4ff18
4 changed files with 24 additions and 54 deletions

View file

@ -495,20 +495,6 @@ int DoActorOperate(DSWActor* actor)
&nearsector, &nearwall, &nearsprite,
&nearhitdist, 1024L, NTAG_SEARCH_LO_HI, nullptr);
//DSPRINTF(ds,"nearsector = %d, nearwall = %d, nearsprite = %d hitdist == %ld\n",nearsector,nearwall,nearsprite,nearhitdist);
//MONO_PRINT(ds);
#if 0 // Actors don't hit switches on a whim
if (nearsprite >= 0 && nearhitdist < 1024)
{
if (OperateSprite(nearsprite, false))
{
u->WaitTics = 2 * 120;
NewStateGroup(actor, u->ActorActionSet->Stand);
}
}
#endif
}

View file

@ -954,7 +954,7 @@ short AnimateSwitch(SPRITEp sp, short tgt_value)
sp->picnum -= 1;
if (tgt_value == true)
if (tgt_value == int(true))
{
AnimateSwitch(sp, tgt_value);
return true;
@ -1312,10 +1312,10 @@ void KillMatchingCrackSprites(short match)
}
}
void WeaponExplodeSectorInRange(short weapon)
void WeaponExplodeSectorInRange(DSWActor* wActor)
{
SPRITEp wp = &sprite[weapon];
USERp wu = User[weapon].Data();
SPRITEp wp = &wActor->s();
USERp wu = wActor->u();
SPRITEp sp;
int dist;
int radius;
@ -1341,7 +1341,7 @@ void WeaponExplodeSectorInRange(short weapon)
// pass in explosion type
MissileHitMatch(weapon, WPN_ROCKET, actor->GetSpriteIndex());
MissileHitMatch(wActor->GetSpriteIndex(), WPN_ROCKET, actor->GetSpriteIndex());
}
}
@ -1382,28 +1382,27 @@ void DoDeleteSpriteMatch(short match)
};
int del_x = 0,del_y = 0;
int i;
unsigned stat;
short found;
while (true)
{
found = -1;
DSWActor* found = nullptr;
// search for a DELETE_SPRITE with same match tag
StatIterator it(STAT_DELETE_SPRITE);
while ((i = it.NextIndex()) >= 0)
SWStatIterator it(STAT_DELETE_SPRITE);
while (auto actor = it.Next())
{
if (sprite[i].lotag == match)
auto sp = &actor->s();
if (sp->lotag == match)
{
found = i;
del_x = sprite[i].x;
del_y = sprite[i].y;
found = actor;
del_x = sp->x;
del_y = sp->y;
break;
}
}
if (found == -1)
if (found == nullptr)
return;
for (stat = 0; stat < SIZ(StatList); stat++)
@ -1431,20 +1430,19 @@ void DoDeleteSpriteMatch(short match)
}
// kill the DELETE_SPRITE
KillSprite(found);
KillActor(found);
}
}
void DoChangorMatch(short match)
{
int sn;
SPRITEp sp;
SECTORp sectp;
StatIterator it(STAT_CHANGOR);
while ((sn = it.NextIndex()) >= 0)
SWStatIterator it(STAT_CHANGOR);
while (auto actor = it.Next())
{
sp = &sprite[sn];
auto sp = &actor->s();
sectp = &sector[sp->sectnum];
if (SP_TAG2(sp) != match)
@ -1484,7 +1482,7 @@ void DoChangorMatch(short match)
// if not set then go ahead and kill it
if (TEST_BOOL2(sp) == 0)
{
KillSprite(sn);
KillActor(actor);
}
}
}
@ -1541,14 +1539,12 @@ void DoMatchEverything(PLAYERp pp, short match, short state)
bool ComboSwitchTest(short combo_type, short match)
{
int i;
SPRITEp sp;
int state;
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
SWStatIterator it(STAT_DEFAULT);
while (auto actor = it.Next())
{
sp = &sprite[i];
auto sp = &actor->s();
if (sp->lotag == combo_type && sp->hitag == match)
{

View file

@ -73,7 +73,7 @@ void DoSector(void);
short AnimateSwitch(SPRITEp sp,short tgt_value);
void ShootableSwitch(short SpriteNum);
bool TestKillSectorObject(SECTOR_OBJECTp sop);
void WeaponExplodeSectorInRange(short weapon);
void WeaponExplodeSectorInRange(DSWActor*);
void initlava(void);
void movelava(char *dapic);

View file

@ -3469,16 +3469,10 @@ AutoShrap:
short spnum;
short size;
SPRITEp ep;
// USERp eu;
spnum = SpawnLargeExp(ParentNum);
ASSERT(spnum >= 0);
//spnum = SpawnSectorExp(ParentNum);
ep = &sprite[spnum];
// eu = User[spnum];
//eu->xchange = MOVEx(92, ep->ang);
//eu->ychange = MOVEy(92, ep->ang);
size = ep->xrepeat;
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
@ -3491,16 +3485,10 @@ AutoShrap:
short spnum;
short size;
SPRITEp ep;
// USERp eu;
//spnum = SpawnSectorExp(ParentNum);
spnum = SpawnLargeExp(ParentNum);
ASSERT(spnum >= 0);
ep = &sprite[spnum];
// eu = User[spnum];
//eu->xchange = MOVEx(92, ep->ang);
//eu->ychange = MOVEy(92, ep->ang);
size = ep->xrepeat;
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
@ -7730,7 +7718,7 @@ int DoExpDamageTest(DSWActor* actor)
// crack sprites
if (wu->ID != MUSHROOM_CLOUD)
WeaponExplodeSectorInRange(Weapon);
WeaponExplodeSectorInRange(actor);
// Just like DoDamageTest() except that it doesn't care about the Owner