diff --git a/src/am_map.cpp b/src/am_map.cpp index 220c472e4..0c8293ebe 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2338,7 +2338,6 @@ void AM_drawKeys () // // //============================================================================= - void AM_drawThings () { AMColor color; @@ -2355,30 +2354,41 @@ void AM_drawThings () p.x = t->x >> FRACTOMAPBITS; p.y = t->y >> FRACTOMAPBITS; - if (am_showthingsprites > 0) + if (am_showthingsprites > 0 && t->sprite > 0) { - const spritedef_t& sprite = sprites[t->sprite]; - const size_t spriteIndex = sprite.spriteframes + (am_showthingsprites > 1 ? t->frame : 0); + FTexture *texture = NULL; + spriteframe_t *frame; + angle_t rotation = 0; - const spriteframe_t& frame = SpriteFrames[spriteIndex]; - angle_t angle = ANGLE_270 - t->angle; - if (frame.Texture[0] != frame.Texture[1]) angle += (ANGLE_180 / 16); - if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + // try all modes backwards until a valid texture has been found. + for(int show = am_showthingsprites; show > 0 && texture == NULL; show--) { - angle += players[consoleplayer].camera->angle - ANGLE_90; - } - const angle_t rotation = angle >> 28; + const spritedef_t& sprite = sprites[t->sprite]; + const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); - const FTextureID textureID = frame.Texture[am_showthingsprites > 2 ? rotation : 0]; - FTexture* texture = TexMan(textureID); + frame = &SpriteFrames[spriteIndex]; + angle_t angle = ANGLE_270 - t->angle; + if (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16); + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + { + angle += players[consoleplayer].camera->angle - ANGLE_90; + } + rotation = angle >> 28; + + const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0]; + texture = TexMan(textureID); + } + + if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. const fixed_t spriteScale = 10 * scale_mtof; - DrawMarker (texture, p.x, p.y, 0, !!(frame.Flip & (1 << rotation)), + DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)), spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); } else { + drawTriangle: angle = t->angle; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 5c5bb7eba..9dd055711 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -589,7 +589,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage += (pr_bfgspray() & 7) + 1; thingToHit = linetarget; - int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash)); + int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash), + spray != NULL && (spray->flags3 & MF3_FOILINVUL)? DMG_FOILINVUL : 0); P_TraceBleed (newdam > 0 ? newdam : damage, thingToHit, self->target); } } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 43499d353..919bd8654 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -965,7 +965,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { // actor is invulnerable if (target->player == NULL) { - if (inflictor == NULL || !(inflictor->flags3 & MF3_FOILINVUL)) + if (inflictor == NULL || (!(inflictor->flags3 & MF3_FOILINVUL) && !(flags & DMG_FOILINVUL))) { return -1; } diff --git a/src/p_local.h b/src/p_local.h index a4da0a04b..e7fb2cb7d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -554,6 +554,7 @@ enum EDmgFlags DMG_FORCED = 8, DMG_NO_FACTOR = 16, DMG_PLAYERATTACK = 32, + DMG_FOILINVUL = 64, };