From e9116bd23aa7f059cee2d38c2827667b67eb2eae Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 18 Apr 2019 17:25:30 +0000 Subject: [PATCH] Add SFLAG_QUEUEDFORDELETE, to handle detection and manipulation of things like decal sprites marked for deletion git-svn-id: https://svn.eduke32.com/eduke32@7604 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 9 +++++--- source/duke3d/src/actors.h | 1 + source/duke3d/src/gamedef.cpp | 39 ++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 9f1ab52be..a24d7ecaa 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -675,10 +675,13 @@ void A_AddToDeleteQueue(int spriteNum) return; } - if (SpriteDeletionQueue[g_spriteDeleteQueuePos] >= 0) - A_DeleteSprite(SpriteDeletionQueue[g_spriteDeleteQueuePos]); + auto &deleteSpriteNum = SpriteDeletionQueue[g_spriteDeleteQueuePos]; - SpriteDeletionQueue[g_spriteDeleteQueuePos] = spriteNum; + if (deleteSpriteNum >= 0 && actor[deleteSpriteNum].flags & SFLAG_QUEUEDFORDELETE) + A_DeleteSprite(deleteSpriteNum); + + deleteSpriteNum = spriteNum; + actor[spriteNum].flags |= SFLAG_QUEUEDFORDELETE; g_spriteDeleteQueuePos = (g_spriteDeleteQueuePos+1)%g_deleteQueueSize; } diff --git a/source/duke3d/src/actors.h b/source/duke3d/src/actors.h index 0f9c51334..fad3b234f 100644 --- a/source/duke3d/src/actors.h +++ b/source/duke3d/src/actors.h @@ -394,6 +394,7 @@ enum sflags_t SFLAG_WAKEUPBADGUYS = 0x02000000, SFLAG_DAMAGEEVENT = 0x04000000, SFLAG_NOWATERSECTOR = 0x08000000, + SFLAG_QUEUEDFORDELETE = 0x10000000, }; // Custom projectiles "workslike" flags. diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index cfe7bc356..458d6ae78 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -6000,25 +6000,26 @@ static void C_AddDefaultDefinitions(void) { "PROJ_XREPEAT", PROJ_XREPEAT }, { "PROJ_YREPEAT", PROJ_YREPEAT }, - { "SFLAG_BADGUY", SFLAG_BADGUY }, - { "SFLAG_DAMAGEEVENT", SFLAG_DAMAGEEVENT }, - { "SFLAG_GREENSLIMEFOOD", SFLAG_GREENSLIMEFOOD }, - { "SFLAG_HURTSPAWNBLOOD", SFLAG_HURTSPAWNBLOOD }, - { "SFLAG_NOCLIP", SFLAG_NOCLIP }, - { "SFLAG_NODAMAGEPUSH", SFLAG_NODAMAGEPUSH }, - { "SFLAG_NOEVENTS", SFLAG_NOEVENTCODE }, - { "SFLAG_NOLIGHT", SFLAG_NOLIGHT }, - { "SFLAG_NOPAL", SFLAG_NOPAL }, - { "SFLAG_NOSHADE", SFLAG_NOSHADE }, - { "SFLAG_NOTELEPORT", SFLAG_NOTELEPORT }, - { "SFLAG_NOWATERDIP", SFLAG_NOWATERDIP }, - { "SFLAG_NVG", SFLAG_NVG }, - { "SFLAG_REALCLIPDIST", SFLAG_REALCLIPDIST }, - { "SFLAG_SHADOW", SFLAG_SHADOW }, - { "SFLAG_SMOOTHMOVE", SFLAG_SMOOTHMOVE }, - { "SFLAG_USEACTIVATOR", SFLAG_USEACTIVATOR }, - { "SFLAG_WAKEUPBADGUYS", SFLAG_WAKEUPBADGUYS }, - { "SFLAG_NOWATERSECTOR", SFLAG_NOWATERSECTOR }, + { "SFLAG_BADGUY", SFLAG_BADGUY }, + { "SFLAG_DAMAGEEVENT", SFLAG_DAMAGEEVENT }, + { "SFLAG_GREENSLIMEFOOD", SFLAG_GREENSLIMEFOOD }, + { "SFLAG_HURTSPAWNBLOOD", SFLAG_HURTSPAWNBLOOD }, + { "SFLAG_NOCLIP", SFLAG_NOCLIP }, + { "SFLAG_NODAMAGEPUSH", SFLAG_NODAMAGEPUSH }, + { "SFLAG_NOEVENTS", SFLAG_NOEVENTCODE }, + { "SFLAG_NOLIGHT", SFLAG_NOLIGHT }, + { "SFLAG_NOPAL", SFLAG_NOPAL }, + { "SFLAG_NOSHADE", SFLAG_NOSHADE }, + { "SFLAG_NOTELEPORT", SFLAG_NOTELEPORT }, + { "SFLAG_NOWATERDIP", SFLAG_NOWATERDIP }, + { "SFLAG_NVG", SFLAG_NVG }, + { "SFLAG_REALCLIPDIST", SFLAG_REALCLIPDIST }, + { "SFLAG_SHADOW", SFLAG_SHADOW }, + { "SFLAG_SMOOTHMOVE", SFLAG_SMOOTHMOVE }, + { "SFLAG_USEACTIVATOR", SFLAG_USEACTIVATOR }, + { "SFLAG_WAKEUPBADGUYS", SFLAG_WAKEUPBADGUYS }, + { "SFLAG_NOWATERSECTOR", SFLAG_NOWATERSECTOR }, + { "SFLAG_QUEUEDFORDELETE", SFLAG_QUEUEDFORDELETE }, { "STAT_ACTIVATOR", STAT_ACTIVATOR }, { "STAT_ACTOR", STAT_ACTOR },