From d481ba7b5a6ec90234b8ea6ca7fef0e8d6e447d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Mar 2015 22:11:16 +0200 Subject: [PATCH 1/4] - fixed: The replacement actors for A_SetTelefog should not require inheriting from TeleportFog. --- wadsrc/static/actors/actor.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index d85717ead..7d8fad5bf 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -325,7 +325,7 @@ ACTOR Actor native //: Thinker action native A_GiveToSiblings(class itemtype, int amount = 0); action native A_TakeFromChildren(class itemtype, int amount = 0); action native A_TakeFromSiblings(class itemtype, int amount = 0); - action native A_SetTeleFog(class oldpos, class newpos); + action native A_SetTeleFog(class oldpos, class newpos); action native A_SwapTeleFog(); action native A_SetFloatBobPhase(int bob); action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); From d940c6a2eecb2b4897433791d897a8712cfe8e3b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 31 Mar 2015 23:15:43 +0200 Subject: [PATCH 2/4] - fixed: With the recent changes to the damage code, the check for MF5_NODAMAGE was too early. Putting it into AActor::TakeSpecialDamage is also not the best idea because that limits that function's potential. --- src/p_interaction.cpp | 5 +++++ src/p_mobj.cpp | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index a16069c7b..a309360c4 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1038,6 +1038,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // Invulnerable, and won't wake up return -1; } + if (damage < TELEFRAG_DAMAGE) // TELEFRAG_DAMAGE may not be reduced at all or it may not guarantee its effect. { player = target->player; @@ -1116,6 +1117,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } + if (target->flags5 & MF5_NODAMAGE) + { + damage = 0; + } } } if (damage < 0) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 23fb9cf3c..c12bd53db 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6159,11 +6159,6 @@ int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FN { FState *death; - if (flags5 & MF5_NODAMAGE) - { - return 0; - } - // If the actor does not have a corresponding death state, then it does not take damage. // Note that DeathState matches every kind of damagetype, so an actor has that, it can // be hurt with any type of damage. Exception: Massacre damage always succeeds, because From 34aeb428a1cd8be2558b532fc85136928e7bac20 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Apr 2015 10:01:48 +0200 Subject: [PATCH 3/4] - Removed the check for this flag from P_RadiusAttack because MF7_CAUSEPAIN cannot be used for radius attacks. Their logic is too different from regular attacks. --- src/p_interaction.cpp | 2 ++ src/p_map.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index a309360c4..74bfc56f4 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -950,6 +950,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int fakeDamage = 0; int holdDamage = 0; + if (damage < 0) damage = 0; + if (target == NULL || !((target->flags & MF_SHOOTABLE) || (target->flags6 & MF6_VULNERABLE))) { // Shouldn't happen return -1; diff --git a/src/p_map.cpp b/src/p_map.cpp index f858b8a4a..2362fbd12 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4790,7 +4790,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo points *= thing->GetClass()->Meta.GetMetaFixed(AMETA_RDFactor, FRACUNIT) / (double)FRACUNIT; // points and bombdamage should be the same sign - if (((bombspot->flags7 & MF7_CAUSEPAIN) || (points * bombdamage) > 0) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) + if (((points * bombdamage) > 0) && P_CheckSight(thing, bombspot, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)) { // OK to damage; target is in direct path double velz; double thrust; From ad9e4413fa3a4b9458d39bf9183db2de0d26a05f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 Apr 2015 11:48:47 +0200 Subject: [PATCH 4/4] - made the texture precaching code a bit more self-descriptive after finding a discrepancy in handling between ZDoom and GZDoom's versions. --- src/r_swrenderer.cpp | 2 +- src/textures/texturemanager.cpp | 2 +- src/textures/textures.h | 10 ++++++++++ src/v_video.cpp | 10 +++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/r_swrenderer.cpp b/src/r_swrenderer.cpp index fb54b6f0a..df928b25e 100644 --- a/src/r_swrenderer.cpp +++ b/src/r_swrenderer.cpp @@ -84,7 +84,7 @@ void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache) { if (tex != NULL) { - if (cache & 1) + if (cache & FTextureManager::HIT_Columnmode) { const FTexture::Span *spanp; tex->GetColumn(0, &spanp); diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index be0426e98..2944e4200 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1246,7 +1246,7 @@ void FTextureManager::PrecacheLevel (void) for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++) { - hitlist[level.info->PrecacheTextures[i].GetIndex()] |= 1; + hitlist[level.info->PrecacheTextures[i].GetIndex()] |= FTextureManager::HIT_Wall; } for (int i = cnt - 1; i >= 0; i--) diff --git a/src/textures/textures.h b/src/textures/textures.h index aa8505d4e..cb3680ead 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -365,6 +365,16 @@ public: TEXMAN_DontCreate = 32 }; + enum + { + HIT_Wall = 1, + HIT_Flat = 2, + HIT_Sky = 4, + HIT_Sprite = 8, + + HIT_Columnmode = HIT_Wall|HIT_Sky|HIT_Sprite + }; + FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny); FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0); int ListTextures (const char *name, TArray &list); diff --git a/src/v_video.cpp b/src/v_video.cpp index 453772886..aaf1aec3d 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1245,7 +1245,7 @@ void DFrameBuffer::GetHitlist(BYTE *hitlist) FTextureID pic = frame->Texture[k]; if (pic.isValid()) { - hitlist[pic.GetIndex()] = 1; + hitlist[pic.GetIndex()] = HIT_Sprite; } } } @@ -1257,14 +1257,14 @@ void DFrameBuffer::GetHitlist(BYTE *hitlist) for (i = numsectors - 1; i >= 0; i--) { hitlist[sectors[i].GetTexture(sector_t::floor).GetIndex()] = - hitlist[sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= 2; + hitlist[sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= HIT_Flat; } for (i = numsides - 1; i >= 0; i--) { hitlist[sides[i].GetTexture(side_t::top).GetIndex()] = hitlist[sides[i].GetTexture(side_t::mid).GetIndex()] = - hitlist[sides[i].GetTexture(side_t::bottom).GetIndex()] |= 1; + hitlist[sides[i].GetTexture(side_t::bottom).GetIndex()] |= HIT_Wall; } // Sky texture is always present. @@ -1276,11 +1276,11 @@ void DFrameBuffer::GetHitlist(BYTE *hitlist) if (sky1texture.isValid()) { - hitlist[sky1texture.GetIndex()] |= 1; + hitlist[sky1texture.GetIndex()] |= HIT_Sky; } if (sky2texture.isValid()) { - hitlist[sky2texture.GetIndex()] |= 1; + hitlist[sky2texture.GetIndex()] |= HIT_Sky; } }