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