- Duke: Interpolate camera sprite angle in animatecamsprite(). Fixes a "fixme".

This commit is contained in:
Mitchell Richters 2020-09-23 14:42:33 +10:00
parent 407b5346e3
commit 88608e0682
2 changed files with 5 additions and 4 deletions

View file

@ -1997,6 +1997,7 @@ void camera(int i)
if (s->hitag > 0) if (s->hitag > 0)
{ {
hittype[i].tempang = s->ang;
if (t[1] < s->hitag) if (t[1] < s->hitag)
s->ang += 8; s->ang += 8;
else if (t[1] < (s->hitag * 3)) else if (t[1] < (s->hitag * 3))

View file

@ -244,7 +244,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void animatecamsprite(int smoothRatio) void animatecamsprite(double smoothratio)
{ {
const int VIEWSCREEN_ACTIVE_DISTANCE = 8192; const int VIEWSCREEN_ACTIVE_DISTANCE = 8192;
@ -268,12 +268,12 @@ void animatecamsprite(int smoothRatio)
screen->RenderTextureView(canvas, [=](IntRect& rect) screen->RenderTextureView(canvas, [=](IntRect& rect)
{ {
// fixme: This needs to interpolate the camera's angle. Position is not relevant because cameras do not move.
auto camera = &sprite[sp->owner]; auto camera = &sprite[sp->owner];
auto ang = hittype[sp->owner].tempang + xs_CRoundToInt(fmulscale16(((camera->ang - hittype[sp->owner].tempang + 1024) & 2047) - 1024, smoothratio));
// Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself. // Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself.
drawrooms(camera->x, camera->y, camera->z, camera->ang, 100 + camera->shade, camera->sectnum); // why 'shade'...? drawrooms(camera->x, camera->y, camera->z, ang, 100 + camera->shade, camera->sectnum); // why 'shade'...?
display_mirror = 1; // should really be 'display external view'. display_mirror = 1; // should really be 'display external view'.
fi.animatesprites(camera->x, camera->y, camera->ang, smoothRatio); fi.animatesprites(camera->x, camera->y, ang, smoothratio);
display_mirror = 0; display_mirror = 0;
renderDrawMasks(); renderDrawMasks();
}); });