From 659c11514bac6de25123ca79cf2312d9dbc49afb Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Sat, 21 Jan 2017 23:58:16 +0200 Subject: [PATCH] OpenGL: Added picnum override handling for actors --- src/gl/scene/gl_sprite.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 92416f88b..adbc626ed 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -646,8 +646,14 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) sector_t rs; sector_t * rendersector; + if (thing == nullptr) + return; + + // [ZZ] allow CustomSprite-style direct picnum specification + bool isPicnumOverride = thing->picnum.isValid(); + // Don't waste time projecting sprites that are definitely not visible. - if (thing == nullptr || thing->sprite == 0 || !thing->IsVisibleToPlayer() || !thing->IsInsideVisibleAngles()) + if ((thing->sprite == 0 && !isPicnumOverride) || !thing->IsVisibleToPlayer() || !thing->IsInsideVisibleAngles()) { return; } @@ -752,13 +758,19 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) z += fz; } - modelframe = gl_FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED)); + modelframe = isPicnumOverride ? nullptr : gl_FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED)); if (!modelframe) { bool mirror; DAngle ang = (thingpos - ViewPos).Angle(); FTextureID patch; - if (thing->flags7 & MF7_SPRITEANGLE) + // [ZZ] add direct picnum override + if (isPicnumOverride) + { + patch = thing->picnum; + mirror = false; + } + else if (thing->flags7 & MF7_SPRITEANGLE) { patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (thing->SpriteAngle).BAMs(), &mirror); } @@ -775,7 +787,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) if (!patch.isValid()) return; int type = thing->renderflags & RF_SPRITETYPEMASK; gltexture = FMaterial::ValidateTexture(patch, (type == RF_FACESPRITE), false); - if (!gltexture) return; + if (!gltexture) + return; vt = gltexture->GetSpriteVT(); vb = gltexture->GetSpriteVB();