mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- SpriteQueueDelete + DeleteNoSoundOwner.
This commit is contained in:
parent
6628ec9459
commit
8daa825aa1
12 changed files with 39 additions and 47 deletions
|
@ -831,7 +831,7 @@ int KillBreakSprite(DSWActor* breakActor)
|
|||
// IMPORTANT: Do not change the statnum if possible so that NEXTI in
|
||||
// SpriteControl loop traversals will maintain integrity.
|
||||
|
||||
SpriteQueueDelete(breakActor->GetSpriteIndex());
|
||||
SpriteQueueDelete(breakActor);
|
||||
|
||||
if (bu)
|
||||
{
|
||||
|
@ -867,7 +867,7 @@ int UserBreakSprite(DSWActor* breakActor)
|
|||
// its better than forcing everyone to have a ST1
|
||||
DoMatchEverything(nullptr, match, -1);
|
||||
// Kill sound if one is attached
|
||||
DeleteNoSoundOwner(BreakSprite);
|
||||
DeleteNoSoundOwner(breakActor);
|
||||
KillBreakSprite(breakActor);
|
||||
return true;
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ int UserBreakSprite(DSWActor* breakActor)
|
|||
if (SP_TAG8(sp) == 1)
|
||||
{
|
||||
// Kill sound if one is attached
|
||||
DeleteNoSoundOwner(BreakSprite);
|
||||
DeleteNoSoundOwner(breakActor);
|
||||
KillBreakSprite(breakActor);
|
||||
return true;
|
||||
}
|
||||
|
@ -981,7 +981,7 @@ int AutoBreakSprite(DSWActor* breakActor, short type)
|
|||
RESET(bp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
SET(bp->cstat, CSTAT_SPRITE_INVISIBLE);
|
||||
// Kill sound if one is attached
|
||||
DeleteNoSoundOwner(BreakSprite);
|
||||
DeleteNoSoundOwner(breakActor);
|
||||
KillBreakSprite(breakActor);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -141,23 +141,23 @@ void CopySectorMatch(short match)
|
|||
|
||||
#if 1
|
||||
// kill all sprites in the dest sector that need to be
|
||||
SectIterator itsec(dest_sp->sectnum);
|
||||
while ((kill = itsec.NextIndex()) >= 0)
|
||||
SWSectIterator itsec(dest_sp->sectnum);
|
||||
while (auto itActor = itsec.Next())
|
||||
{
|
||||
k = &sprite[kill];
|
||||
k = &itActor->s();
|
||||
|
||||
// kill anything not invisible
|
||||
if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE))
|
||||
{
|
||||
if (User[kill].Data())
|
||||
if (itActor->hasU())
|
||||
{
|
||||
// be safe with the killing
|
||||
//SetSuicide(kill);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpriteQueueDelete(kill); // new function to allow killing - hopefully
|
||||
KillSprite(kill);
|
||||
SpriteQueueDelete(itActor); // new function to allow killing - hopefully
|
||||
KillActor(itActor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ DoHornetDeath(DSWActor* actor)
|
|||
RESET(u->Flags, SPR_FALLING|SPR_SLIDING);
|
||||
RESET(sp->cstat, CSTAT_SPRITE_YFLIP); // If upside down, reset it
|
||||
NewStateGroup(actor, u->ActorActionSet->Dead);
|
||||
DeleteNoSoundOwner(SpriteNum);
|
||||
DeleteNoSoundOwner(actor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3396,7 +3396,7 @@ pRailRetract(PANEL_SPRITEp psp)
|
|||
{
|
||||
RESET(psp->PlayerP->Flags, PF_WEAPON_RETRACT);
|
||||
psp->PlayerP->Wpn[psp->WeaponType] = nullptr;
|
||||
DeleteNoSoundOwner(psp->PlayerP->PlayerSprite);
|
||||
DeleteNoSoundOwner(psp->PlayerP->Actor());
|
||||
pKillSprite(psp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2615,7 +2615,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
|
|||
if (sp->z < sop->crush_z)
|
||||
continue;
|
||||
|
||||
SpriteQueueDelete(actor->GetSpriteIndex());
|
||||
SpriteQueueDelete(actor);
|
||||
KillActor(actor);
|
||||
}
|
||||
}
|
||||
|
@ -2661,7 +2661,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
|
|||
if (sp->z < sop->crush_z)
|
||||
continue;
|
||||
|
||||
SpriteQueueDelete(actor->GetSpriteIndex());
|
||||
SpriteQueueDelete(actor);
|
||||
KillActor(actor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,15 +130,13 @@ void ProcessQuakeOn(void)
|
|||
|
||||
void ProcessQuakeSpot(void)
|
||||
{
|
||||
int i;
|
||||
SPRITEp sp;
|
||||
int rand_test;
|
||||
|
||||
// check timed quakes and random quakes
|
||||
StatIterator it(STAT_QUAKE_SPOT);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(STAT_QUAKE_SPOT);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &sprite[i];
|
||||
auto sp = &actor->s();
|
||||
|
||||
// not a timed quake
|
||||
if (!QUAKE_WaitSecs(sp))
|
||||
|
@ -154,8 +152,7 @@ void ProcessQuakeSpot(void)
|
|||
if ((int16_t)QUAKE_WaitTics(sp) < 0)
|
||||
{
|
||||
// reset timer - add in Duration of quake
|
||||
//QUAKE_WaitTics(sp) = ((QUAKE_WaitSecs(sp)*10L) + QUAKE_Duration(sp)) * 120L;
|
||||
SET_SP_TAG13(sp, (((QUAKE_WaitSecs(sp)*10L) + QUAKE_Duration(sp)) * 120L));
|
||||
SET_SP_TAG13(sp, (((QUAKE_WaitSecs(sp)*10) + QUAKE_Duration(sp)) * 120));
|
||||
|
||||
// spawn a quake if condition is met
|
||||
rand_test = QUAKE_RandomTest(sp);
|
||||
|
@ -167,8 +164,8 @@ void ProcessQuakeSpot(void)
|
|||
// kill quake spot if needed
|
||||
if (QUAKE_KillAfterQuake(sp))
|
||||
{
|
||||
DeleteNoSoundOwner(i);
|
||||
KillSprite(i);
|
||||
DeleteNoSoundOwner(actor);
|
||||
KillActor(actor);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1290,21 +1290,18 @@ DoSoundSpotMatch(short match, short sound_num, short sound_type)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
DoSoundSpotStopSound(short match)
|
||||
void DoSoundSpotStopSound(short match)
|
||||
{
|
||||
int sn;
|
||||
SPRITEp sp;
|
||||
|
||||
StatIterator it(STAT_SOUND_SPOT);
|
||||
while ((sn = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(STAT_SOUND_SPOT);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &sprite[sn];
|
||||
auto sp = &actor->s();
|
||||
|
||||
// found match and is a follow type
|
||||
if (SP_TAG2(sp) == match && TEST_BOOL2(sp))
|
||||
{
|
||||
DeleteNoSoundOwner(sn);
|
||||
DeleteNoSoundOwner(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1514,10 +1511,10 @@ void DoDeleteSpriteMatch(short match)
|
|||
|
||||
for (stat = 0; stat < SIZ(StatList); stat++)
|
||||
{
|
||||
StatIterator it(StatList[stat]);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
SWStatIterator it(StatList[stat]);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s();
|
||||
if (del_x == sp->x && del_y == sp->y)
|
||||
{
|
||||
// special case lighting delete of Fade On/off after fades
|
||||
|
@ -1526,14 +1523,12 @@ void DoDeleteSpriteMatch(short match)
|
|||
// set shade to darkest and then kill it
|
||||
sp->shade = int8_t(SP_TAG6(sp));
|
||||
sp->pal = 0;
|
||||
SectorLightShade(&sprite[i], sp->shade);
|
||||
DiffuseLighting(&sprite[i]);
|
||||
SectorLightShade(sp, sp->shade);
|
||||
DiffuseLighting(sp);
|
||||
}
|
||||
|
||||
////DSPRINTF(ds,"Delete Sprite stat %d, x %d, y %d",sp->statnum, sp->x, sp->y);
|
||||
//MONO_PRINT(ds);
|
||||
SpriteQueueDelete(i);
|
||||
KillSprite(i);
|
||||
SpriteQueueDelete(actor);
|
||||
KillActor(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -713,10 +713,10 @@ void COVER_SetReverb(int amt)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DeleteNoSoundOwner(short spritenum)
|
||||
void DeleteNoSoundOwner(DSWActor* actor)
|
||||
{
|
||||
if (!soundEngine) return;
|
||||
SPRITEp sp = &sprite[spritenum];
|
||||
SPRITEp sp = &actor->s();
|
||||
|
||||
soundEngine->EnumerateChannels([=](FSoundChan* chan)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ class DSWActor;
|
|||
|
||||
void Set3DSoundOwner(short spritenum);
|
||||
void PlaySpriteSound(DSWActor* actor, int attrib_ndx, Voc3D_Flags flags);
|
||||
void DeleteNoSoundOwner(short spritenum);
|
||||
void DeleteNoSoundOwner(DSWActor* actor);
|
||||
void DeleteNoFollowSoundOwner(short spritenum);
|
||||
|
||||
inline bool CacheSound(int num, int type) { return false; }
|
||||
|
|
|
@ -638,7 +638,7 @@ void KillSprite(int16_t SpriteNum)
|
|||
|
||||
//////////////////////////////////////////////
|
||||
// Check sounds list to kill attached sounds
|
||||
DeleteNoSoundOwner(SpriteNum);
|
||||
DeleteNoSoundOwner(actor);
|
||||
DeleteNoFollowSoundOwner(SpriteNum);
|
||||
//////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -20064,10 +20064,10 @@ DoBubble(DSWActor* actor)
|
|||
// this needs to be called before killsprite
|
||||
// whenever killing a sprite that you aren't completely sure what it is, like
|
||||
// with the drivables, copy sectors, break sprites, etc
|
||||
void
|
||||
SpriteQueueDelete(short SpriteNum)
|
||||
void SpriteQueueDelete(DSWActor* actor)
|
||||
{
|
||||
int i;
|
||||
int SpriteNum = actor->GetSpriteIndex();
|
||||
|
||||
for (i = 0; i < MAX_STAR_QUEUE; i++)
|
||||
if (StarQueue[i] == SpriteNum)
|
||||
|
|
|
@ -217,7 +217,7 @@ int InitVulcanBoulder(DSWActor* actor);
|
|||
int DoBladeDamage(short SpriteNum);
|
||||
int DoFindGround(int16_t SpriteNum);
|
||||
int DoFindGroundPoint(DSWActor* actor);
|
||||
void SpriteQueueDelete(short SpriteNum);
|
||||
void SpriteQueueDelete(DSWActor* actor);
|
||||
int HelpMissileLateral(int16_t Weapon,int dist);
|
||||
int AddSpriteToSectorObject(short SpriteNum,SECTOR_OBJECTp sop);
|
||||
void QueueReset(void);
|
||||
|
|
Loading…
Reference in a new issue