mirror of
https://github.com/DrBeef/Raze.git
synced 2025-04-07 16:21:16 +00:00
- all sectnums that can trivially be replaced.
Most of the rest is in backend calling code and should be done while cleaning up the backend API.
This commit is contained in:
parent
19f8458f01
commit
b7cfb07245
7 changed files with 22 additions and 29 deletions
|
@ -54,7 +54,7 @@ void PutStringInfo(PLAYERp pp, const char* string);
|
|||
|
||||
void DoSlidorMatch(PLAYERp pp, short match, bool);
|
||||
bool TestSlidorMatchActive(short match);
|
||||
void InterpSectorSprites(short sectnum, bool state);
|
||||
void InterpSectorSprites(sectortype* sect, bool state);
|
||||
|
||||
using INTERP_FUNC = void(*)(walltype*, int);
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ BEGIN_SW_NS
|
|||
|
||||
void DoRotatorMatch(PLAYERp pp, short match, bool);
|
||||
bool TestRotatorMatchActive(short match);
|
||||
void InterpSectorSprites(short sectnum, bool state);
|
||||
void DoMatchEverything(PLAYERp pp, short match, short state);
|
||||
void DoRotatorSetInterp(DSWActor*);
|
||||
void DoRotatorStopInterp(DSWActor*);
|
||||
|
|
|
@ -2373,7 +2373,7 @@ void PlayerOperateEnv(PLAYERp pp)
|
|||
{
|
||||
case TAG_VATOR:
|
||||
DoVatorOperate(pp, pp->cursector());
|
||||
DoSpikeOperate(pp->cursectnum);
|
||||
DoSpikeOperate(pp->cursector());
|
||||
DoRotatorOperate(pp, pp->cursector());
|
||||
DoSlidorOperate(pp, pp->cursector());
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
BEGIN_SW_NS
|
||||
|
||||
bool TestSpikeMatchActive(short match);
|
||||
void InterpSectorSprites(short sectnum, bool state);
|
||||
|
||||
void ReverseSpike(DSWActor* actor)
|
||||
{
|
||||
|
@ -102,7 +101,7 @@ void SetSpikeActive(DSWActor* actor)
|
|||
else
|
||||
StartInterpolation(sp->sector(), Interp_Sect_Floorheinum);
|
||||
|
||||
InterpSectorSprites(sp->sectnum, true);
|
||||
InterpSectorSprites(sp->sector(), true);
|
||||
|
||||
// play activate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
|
||||
|
@ -130,7 +129,7 @@ void SetSpikeInactive(DSWActor* actor)
|
|||
else
|
||||
StopInterpolation(sp->sector(), Interp_Sect_Floorheinum);
|
||||
|
||||
InterpSectorSprites(sp->sectnum, false);
|
||||
InterpSectorSprites(sp->sector(), false);
|
||||
|
||||
// play activate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
|
||||
|
@ -139,20 +138,18 @@ void SetSpikeInactive(DSWActor* actor)
|
|||
}
|
||||
|
||||
// called for operation from the space bar
|
||||
void DoSpikeOperate(short sectnum)
|
||||
void DoSpikeOperate(sectortype* sect)
|
||||
{
|
||||
SPRITEp fsp;
|
||||
short match;
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
SWSectIterator it(sect);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
fsp = &actor->s();
|
||||
|
||||
if (fsp->statnum == STAT_SPIKE && SP_TAG1(fsp) == SECT_SPIKE && SP_TAG3(fsp) == 0)
|
||||
{
|
||||
sectnum = fsp->sectnum;
|
||||
|
||||
match = SP_TAG2(fsp);
|
||||
if (match > 0)
|
||||
{
|
||||
|
@ -267,9 +264,9 @@ void SpikeAlign(DSWActor* actor)
|
|||
if ((int8_t)SP_TAG7(sp) < 0)
|
||||
{
|
||||
if (TEST(sp->cstat, CSTAT_SPRITE_YFLIP))
|
||||
alignceilslope(sp->sectnum, sp->x, sp->y, u->zclip);
|
||||
alignceilslope(sp->sector(), sp->x, sp->y, u->zclip);
|
||||
else
|
||||
alignflorslope(sp->sectnum, sp->x, sp->y, u->zclip);
|
||||
alignflorslope(sp->sector(), sp->x, sp->y, u->zclip);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -280,12 +277,12 @@ void SpikeAlign(DSWActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
void MoveSpritesWithSpike(short sectnum)
|
||||
void MoveSpritesWithSpike(sectortype* sect)
|
||||
{
|
||||
SPRITEp sp;
|
||||
int cz,fz;
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
SWSectIterator it(sect);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &actor->s();
|
||||
|
@ -296,7 +293,7 @@ void MoveSpritesWithSpike(short sectnum)
|
|||
if (TEST(sp->extra, SPRX_STAY_PUT_VATOR))
|
||||
continue;
|
||||
|
||||
getzsofslope(sectnum, sp->x, sp->y, &cz, &fz);
|
||||
getzsofslopeptr(sect, sp->x, sp->y, &cz, &fz);
|
||||
sp->z = fz;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +312,7 @@ int DoSpike(DSWActor* actor)
|
|||
lptr = &u->zclip;
|
||||
|
||||
DoSpikeMove(actor, lptr);
|
||||
MoveSpritesWithSpike(sp->sectnum);
|
||||
MoveSpritesWithSpike(sp->sector());
|
||||
SpikeAlign(actor);
|
||||
|
||||
// EQUAL this entry has finished
|
||||
|
@ -427,7 +424,7 @@ int DoSpikeAuto(DSWActor* actor)
|
|||
lptr = &u->zclip;
|
||||
|
||||
DoSpikeMove(actor, lptr);
|
||||
MoveSpritesWithSpike(sp->sectnum);
|
||||
MoveSpritesWithSpike(sp->sector());
|
||||
SpikeAlign(actor);
|
||||
|
||||
// EQUAL this entry has finished
|
||||
|
|
|
@ -780,12 +780,10 @@ void KillActor(DSWActor* actor)
|
|||
soundEngine->RelinkSound(SOURCE_Actor, &actor->s(), nullptr, &pos);
|
||||
|
||||
deletesprite(actor->GetSpriteIndex());
|
||||
// shred your garbage - but not statnum
|
||||
statnum = sp->statnum;
|
||||
sectnum = sp->sectnum;
|
||||
memset(sp, 0xCC, sizeof(SPRITE));
|
||||
sp->statnum = statnum;
|
||||
sp->sectnum = sectnum;
|
||||
// shred your garbage - but not statnum and sectnum, which the backend needs to manage the sprite.
|
||||
sp->clear();
|
||||
sp->statnum = MAXSTATUS;
|
||||
sp->sectnum = MAXSECTORS;
|
||||
|
||||
// Kill references in all users - slow but unavoidable if we don't want the game to crash on stale pointers.
|
||||
SWSpriteIterator it;
|
||||
|
|
|
@ -42,7 +42,6 @@ BEGIN_SW_NS
|
|||
|
||||
void DoVatorMatch(PLAYERp pp, short match);
|
||||
bool TestVatorMatchActive(short match);
|
||||
void InterpSectorSprites(short sectnum, bool state);
|
||||
|
||||
void ReverseVator(DSWActor* actor)
|
||||
{
|
||||
|
@ -107,7 +106,7 @@ void SetVatorActive(DSWActor* actor)
|
|||
else
|
||||
StartInterpolation(sp->sector(), Interp_Sect_Floorz);
|
||||
|
||||
InterpSectorSprites(sp->sectnum, true);
|
||||
InterpSectorSprites(sp->sector(), true);
|
||||
|
||||
// play activate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 1, SOUND_OBJECT_TYPE);
|
||||
|
@ -135,7 +134,7 @@ void SetVatorInactive(DSWActor* actor)
|
|||
else
|
||||
StopInterpolation(sp->sector(), Interp_Sect_Floorz);
|
||||
|
||||
InterpSectorSprites(sp->sectnum, false);
|
||||
InterpSectorSprites(sp->sector(), false);
|
||||
|
||||
// play inactivate sound
|
||||
DoSoundSpotMatch(SP_TAG2(sp), 2, SOUND_OBJECT_TYPE);
|
||||
|
@ -269,11 +268,11 @@ bool TestVatorMatchActive(short match)
|
|||
return false;
|
||||
}
|
||||
|
||||
void InterpSectorSprites(short sectnum, bool state)
|
||||
void InterpSectorSprites(sectortype* sect, bool state)
|
||||
{
|
||||
SPRITEp sp;
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
SWSectIterator it(sect);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &actor->s();
|
||||
|
|
|
@ -3173,7 +3173,7 @@ int SpawnShrap(DSWActor* parentActor, DSWActor* secondaryActor, int means, BREAK
|
|||
return 0;
|
||||
|
||||
// Don't spawn shrapnel in invalid sectors gosh dern it!
|
||||
if (!validSectorIndex(parent->sectnum))
|
||||
if (!parent->insector())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue