diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index a16069c7b..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; @@ -1038,6 +1040,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 +1119,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_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; 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 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 fe01f13a5..83eda0bb6 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1248,7 +1248,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 c6eedfb83..6192da835 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -433,6 +433,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 e70c72cfd..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()] = 5; + 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()] |= 3; + 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()] |= 3; + hitlist[sky1texture.GetIndex()] |= HIT_Sky; } if (sky2texture.isValid()) { - hitlist[sky2texture.GetIndex()] |= 3; + hitlist[sky2texture.GetIndex()] |= HIT_Sky; } } 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);