mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 19:21:44 +00:00
- second batch of sector.cpp
This commit is contained in:
parent
2b8ea7ae1b
commit
1e00a4ff18
4 changed files with 24 additions and 54 deletions
|
@ -495,20 +495,6 @@ int DoActorOperate(DSWActor* actor)
|
||||||
&nearsector, &nearwall, &nearsprite,
|
&nearsector, &nearwall, &nearsprite,
|
||||||
&nearhitdist, 1024L, NTAG_SEARCH_LO_HI, nullptr);
|
&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
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -954,7 +954,7 @@ short AnimateSwitch(SPRITEp sp, short tgt_value)
|
||||||
|
|
||||||
sp->picnum -= 1;
|
sp->picnum -= 1;
|
||||||
|
|
||||||
if (tgt_value == true)
|
if (tgt_value == int(true))
|
||||||
{
|
{
|
||||||
AnimateSwitch(sp, tgt_value);
|
AnimateSwitch(sp, tgt_value);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1312,10 +1312,10 @@ void KillMatchingCrackSprites(short match)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WeaponExplodeSectorInRange(short weapon)
|
void WeaponExplodeSectorInRange(DSWActor* wActor)
|
||||||
{
|
{
|
||||||
SPRITEp wp = &sprite[weapon];
|
SPRITEp wp = &wActor->s();
|
||||||
USERp wu = User[weapon].Data();
|
USERp wu = wActor->u();
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
int dist;
|
int dist;
|
||||||
int radius;
|
int radius;
|
||||||
|
@ -1341,7 +1341,7 @@ void WeaponExplodeSectorInRange(short weapon)
|
||||||
|
|
||||||
|
|
||||||
// pass in explosion type
|
// 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 del_x = 0,del_y = 0;
|
||||||
int i;
|
|
||||||
unsigned stat;
|
unsigned stat;
|
||||||
short found;
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
found = -1;
|
DSWActor* found = nullptr;
|
||||||
|
|
||||||
// search for a DELETE_SPRITE with same match tag
|
// search for a DELETE_SPRITE with same match tag
|
||||||
StatIterator it(STAT_DELETE_SPRITE);
|
SWStatIterator it(STAT_DELETE_SPRITE);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
if (sprite[i].lotag == match)
|
auto sp = &actor->s();
|
||||||
|
if (sp->lotag == match)
|
||||||
{
|
{
|
||||||
found = i;
|
found = actor;
|
||||||
del_x = sprite[i].x;
|
del_x = sp->x;
|
||||||
del_y = sprite[i].y;
|
del_y = sp->y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found == -1)
|
if (found == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (stat = 0; stat < SIZ(StatList); stat++)
|
for (stat = 0; stat < SIZ(StatList); stat++)
|
||||||
|
@ -1431,20 +1430,19 @@ void DoDeleteSpriteMatch(short match)
|
||||||
}
|
}
|
||||||
|
|
||||||
// kill the DELETE_SPRITE
|
// kill the DELETE_SPRITE
|
||||||
KillSprite(found);
|
KillActor(found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoChangorMatch(short match)
|
void DoChangorMatch(short match)
|
||||||
{
|
{
|
||||||
int sn;
|
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
SECTORp sectp;
|
SECTORp sectp;
|
||||||
|
|
||||||
StatIterator it(STAT_CHANGOR);
|
SWStatIterator it(STAT_CHANGOR);
|
||||||
while ((sn = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[sn];
|
auto sp = &actor->s();
|
||||||
sectp = §or[sp->sectnum];
|
sectp = §or[sp->sectnum];
|
||||||
|
|
||||||
if (SP_TAG2(sp) != match)
|
if (SP_TAG2(sp) != match)
|
||||||
|
@ -1484,7 +1482,7 @@ void DoChangorMatch(short match)
|
||||||
// if not set then go ahead and kill it
|
// if not set then go ahead and kill it
|
||||||
if (TEST_BOOL2(sp) == 0)
|
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)
|
bool ComboSwitchTest(short combo_type, short match)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
SPRITEp sp;
|
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
StatIterator it(STAT_DEFAULT);
|
SWStatIterator it(STAT_DEFAULT);
|
||||||
while ((i = it.NextIndex()) >= 0)
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
sp = &sprite[i];
|
auto sp = &actor->s();
|
||||||
|
|
||||||
if (sp->lotag == combo_type && sp->hitag == match)
|
if (sp->lotag == combo_type && sp->hitag == match)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ void DoSector(void);
|
||||||
short AnimateSwitch(SPRITEp sp,short tgt_value);
|
short AnimateSwitch(SPRITEp sp,short tgt_value);
|
||||||
void ShootableSwitch(short SpriteNum);
|
void ShootableSwitch(short SpriteNum);
|
||||||
bool TestKillSectorObject(SECTOR_OBJECTp sop);
|
bool TestKillSectorObject(SECTOR_OBJECTp sop);
|
||||||
void WeaponExplodeSectorInRange(short weapon);
|
void WeaponExplodeSectorInRange(DSWActor*);
|
||||||
|
|
||||||
void initlava(void);
|
void initlava(void);
|
||||||
void movelava(char *dapic);
|
void movelava(char *dapic);
|
||||||
|
|
|
@ -3469,16 +3469,10 @@ AutoShrap:
|
||||||
short spnum;
|
short spnum;
|
||||||
short size;
|
short size;
|
||||||
SPRITEp ep;
|
SPRITEp ep;
|
||||||
// USERp eu;
|
|
||||||
|
|
||||||
spnum = SpawnLargeExp(ParentNum);
|
spnum = SpawnLargeExp(ParentNum);
|
||||||
ASSERT(spnum >= 0);
|
ASSERT(spnum >= 0);
|
||||||
//spnum = SpawnSectorExp(ParentNum);
|
|
||||||
ep = &sprite[spnum];
|
ep = &sprite[spnum];
|
||||||
// eu = User[spnum];
|
|
||||||
|
|
||||||
//eu->xchange = MOVEx(92, ep->ang);
|
|
||||||
//eu->ychange = MOVEy(92, ep->ang);
|
|
||||||
|
|
||||||
size = ep->xrepeat;
|
size = ep->xrepeat;
|
||||||
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
|
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
|
||||||
|
@ -3491,16 +3485,10 @@ AutoShrap:
|
||||||
short spnum;
|
short spnum;
|
||||||
short size;
|
short size;
|
||||||
SPRITEp ep;
|
SPRITEp ep;
|
||||||
// USERp eu;
|
|
||||||
|
|
||||||
//spnum = SpawnSectorExp(ParentNum);
|
|
||||||
spnum = SpawnLargeExp(ParentNum);
|
spnum = SpawnLargeExp(ParentNum);
|
||||||
ASSERT(spnum >= 0);
|
ASSERT(spnum >= 0);
|
||||||
ep = &sprite[spnum];
|
ep = &sprite[spnum];
|
||||||
// eu = User[spnum];
|
|
||||||
|
|
||||||
//eu->xchange = MOVEx(92, ep->ang);
|
|
||||||
//eu->ychange = MOVEy(92, ep->ang);
|
|
||||||
|
|
||||||
size = ep->xrepeat;
|
size = ep->xrepeat;
|
||||||
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
|
ep->xrepeat = ep->yrepeat = size + shrap_delta_size;
|
||||||
|
@ -7730,7 +7718,7 @@ int DoExpDamageTest(DSWActor* actor)
|
||||||
|
|
||||||
// crack sprites
|
// crack sprites
|
||||||
if (wu->ID != MUSHROOM_CLOUD)
|
if (wu->ID != MUSHROOM_CLOUD)
|
||||||
WeaponExplodeSectorInRange(Weapon);
|
WeaponExplodeSectorInRange(actor);
|
||||||
|
|
||||||
// Just like DoDamageTest() except that it doesn't care about the Owner
|
// Just like DoDamageTest() except that it doesn't care about the Owner
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue