- fall back to drawing triangles on automap when encountering actors with non-displayable sprites

This commit is contained in:
Christoph Oelckers 2013-07-28 10:14:46 +02:00
parent 992ba0bbf4
commit 775ecdeebb
1 changed files with 24 additions and 14 deletions

View File

@ -2338,7 +2338,6 @@ void AM_drawKeys ()
// //
// //
//============================================================================= //=============================================================================
void AM_drawThings () void AM_drawThings ()
{ {
AMColor color; AMColor color;
@ -2355,30 +2354,41 @@ void AM_drawThings ()
p.x = t->x >> FRACTOMAPBITS; p.x = t->x >> FRACTOMAPBITS;
p.y = t->y >> FRACTOMAPBITS; p.y = t->y >> FRACTOMAPBITS;
if (am_showthingsprites > 0) if (am_showthingsprites > 0 && t->sprite > 0)
{
FTexture *texture = NULL;
spriteframe_t *frame;
angle_t rotation = 0;
// try all modes backwards until a valid texture has been found.
for(int show = am_showthingsprites; show > 0 && texture == NULL; show--)
{ {
const spritedef_t& sprite = sprites[t->sprite]; const spritedef_t& sprite = sprites[t->sprite];
const size_t spriteIndex = sprite.spriteframes + (am_showthingsprites > 1 ? t->frame : 0); const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
const spriteframe_t& frame = SpriteFrames[spriteIndex]; frame = &SpriteFrames[spriteIndex];
angle_t angle = ANGLE_270 - t->angle; angle_t angle = ANGLE_270 - t->angle;
if (frame.Texture[0] != frame.Texture[1]) angle += (ANGLE_180 / 16); if (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16);
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
angle += players[consoleplayer].camera->angle - ANGLE_90; angle += players[consoleplayer].camera->angle - ANGLE_90;
} }
const angle_t rotation = angle >> 28; rotation = angle >> 28;
const FTextureID textureID = frame.Texture[am_showthingsprites > 2 ? rotation : 0]; const FTextureID textureID = frame->Texture[show > 2 ? rotation : 0];
FTexture* texture = TexMan(textureID); 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; 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]); spriteScale, spriteScale, 0, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]);
} }
else else
{ {
drawTriangle:
angle = t->angle; angle = t->angle;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))