Skip to content

Commit

Permalink
- add actor flag +BILLBOARDNOFACECAMERA which forces sprite aimed at …
Browse files Browse the repository at this point in the history
…camera heading instead of camera position when gl_billboard_faces_camera is true

```
class ZombieManNoFaceCamera : Zombieman replaces Zombieman
{
	default
	{
		+BILLBOARDNOFACECAMERA;
	}
}
```
  • Loading branch information
madame-rachelle committed Dec 9, 2023
1 parent 97336cf commit b4d5c7d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ enum ActorRenderFlag2
RF2_INVISIBLEINMIRRORS = 0x0001, // [Nash] won't render in mirrors
RF2_ONLYVISIBLEINMIRRORS = 0x0002, // [Nash] only renders in mirrors
RF2_BILLBOARDFACECAMERA = 0x0004, // Sprite billboard face camera (override gl_billboard_faces_camera)
RF2_BILLBOARDNOFACECAMERA = 0x0008, // Sprite billboard face camera angle (override gl_billboard_faces_camera)
};

// This translucency value produces the closest match to Heretic's TINTTAB.
Expand Down
4 changes: 3 additions & 1 deletion src/rendering/hwrenderer/scene/hw_drawlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * s
const bool drawWithXYBillboard = ((ss->particle && gl_billboard_particles) || (!(ss->actor && ss->actor->renderflags & RF_FORCEYBILLBOARD)
&& (gl_billboard_mode == 1 || (ss->actor && ss->actor->renderflags & RF_FORCEXYBILLBOARD))));

const bool drawBillboardFacingCamera = gl_billboard_faces_camera || (ss->actor && ss->actor->renderflags2 & RF2_BILLBOARDFACECAMERA);
const bool drawBillboardFacingCamera = (gl_billboard_faces_camera && (ss->actor && !(ss->actor->renderflags2 & RF2_BILLBOARDNOFACECAMERA)))
|| (ss->actor && ss->actor->renderflags2 & RF2_BILLBOARDFACECAMERA);

// [Nash] has +ROLLSPRITE
const bool rotated = (ss->actor != nullptr && ss->actor->renderflags & (RF_ROLLSPRITE | RF_WALLSPRITE | RF_FLATSPRITE));

Expand Down
7 changes: 5 additions & 2 deletions src/rendering/hwrenderer/scene/hw_sprites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
//&& di->mViewActor != nullptr
&& (gl_billboard_mode == 1 || (actor && actor->renderflags & RF_FORCEXYBILLBOARD))));

const bool drawBillboardFacingCamera = gl_billboard_faces_camera || !!(actor && actor->renderflags2 & RF2_BILLBOARDFACECAMERA);
const bool drawBillboardFacingCamera = (gl_billboard_faces_camera && (actor && !(actor->renderflags2 & RF2_BILLBOARDNOFACECAMERA)))
|| !!(actor && actor->renderflags2 & RF2_BILLBOARDFACECAMERA);

// [Nash] has +ROLLSPRITE
const bool drawRollSpriteActor = (actor != nullptr && actor->renderflags & RF_ROLLSPRITE);

Expand Down Expand Up @@ -1136,7 +1138,8 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
trans = 1.f;

if (!gl_sprite_blend || modelframe ||
(thing->renderflags & (RF_FLATSPRITE | RF_WALLSPRITE)) || gl_billboard_faces_camera ||
(thing->renderflags & (RF_FLATSPRITE | RF_WALLSPRITE)) ||
(gl_billboard_faces_camera && !(thing->renderflags2 & RF2_BILLBOARDNOFACECAMERA)) ||
thing->renderflags2 & RF2_BILLBOARDFACECAMERA)
{
RenderStyle.SrcAlpha = STYLEALPHA_One;
Expand Down
1 change: 1 addition & 0 deletions src/scripting/thingdef_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(RF2, INVISIBLEINMIRRORS, AActor, renderflags2),
DEFINE_FLAG(RF2, ONLYVISIBLEINMIRRORS, AActor, renderflags2),
DEFINE_FLAG(RF2, BILLBOARDFACECAMERA, AActor, renderflags2),
DEFINE_FLAG(RF2, BILLBOARDNOFACECAMERA, AActor, renderflags2),

// Bounce flags
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),
Expand Down

0 comments on commit b4d5c7d

Please sign in to comment.