- added missing handling for Rotations to the hardware renderer.

Untested due to lack of material.
This commit is contained in:
Christoph Oelckers 2020-04-18 13:32:51 +02:00
parent 389892a079
commit 59cd049b77
1 changed files with 29 additions and 2 deletions

View File

@ -785,7 +785,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
modelframe = isPicnumOverride ? nullptr : FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED)); modelframe = isPicnumOverride ? nullptr : FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED));
if (!modelframe) if (!modelframe)
{ {
bool mirror; bool mirror = false;
DAngle ang = (thingpos - vp.Pos).Angle(); DAngle ang = (thingpos - vp.Pos).Angle();
FTextureID patch; FTextureID patch;
// [ZZ] add direct picnum override // [ZZ] add direct picnum override
@ -794,8 +794,35 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
// Animate picnum overrides. // Animate picnum overrides.
auto tex = TexMan.GetGameTexture(thing->picnum, true); auto tex = TexMan.GetGameTexture(thing->picnum, true);
if (tex == nullptr) return; if (tex == nullptr) return;
if (tex->GetRotations() != 0xFFFF)
{
// choose a different rotation based on player view
spriteframe_t* sprframe = &SpriteFrames[tex->GetRotations()];
DAngle sprang = thing->GetSpriteAngle(ang, vp.TicFrac);
angle_t rot;
if (sprframe->Texture[0] == sprframe->Texture[1])
{
if (thing->flags7 & MF7_SPRITEANGLE)
rot = (thing->SpriteAngle + 45.0 / 2 * 9).BAMs() >> 28;
else
rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + 45.0 / 2 * 9).BAMs() >> 28;
}
else
{
if (thing->flags7 & MF7_SPRITEANGLE)
rot = (thing->SpriteAngle + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28;
else
rot = (sprang - (thing->Angles.Yaw + thing->SpriteRotation) + (45.0 / 2 * 9 - 180.0 / 16)).BAMs() >> 28;
}
auto picnum = sprframe->Texture[rot];
if (sprframe->Flip & (1 << rot))
{
mirror = true;
}
}
patch = tex->GetID(); patch = tex->GetID();
mirror = false;
} }
else else
{ {