- Build/Duke: Remove the only use case for drawrooms() inline wrapper and change getcamspriteang() to return binangle instead of a build angle.

This commit is contained in:
Mitchell Richters 2021-01-03 17:35:19 +11:00
parent 0cab84f17a
commit d3b95d4d70
2 changed files with 6 additions and 11 deletions

View file

@ -463,11 +463,6 @@ void renderCompleteMirror(void);
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int16_t dacursectnum); int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int16_t dacursectnum);
static FORCE_INLINE int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int16_t dahoriz, int16_t dacursectnum)
{
return renderDrawRoomsQ16(daposx, daposy, daposz, IntToFixed(daang), IntToFixed(dahoriz), dacursectnum);
}
void renderDrawMasks(void); void renderDrawMasks(void);
void videoInit(); void videoInit();
void videoClearViewableArea(int32_t dacol); void videoClearViewableArea(int32_t dacol);

View file

@ -259,9 +259,9 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static inline int16_t getcamspriteang(DDukeActor* newOwner, double const smoothratio) static inline binangle getcamspriteang(DDukeActor* newOwner, double const smoothratio)
{ {
return newOwner->tempang + xs_CRoundToInt(fmulscale16(((newOwner->s.ang - newOwner->tempang + 1024) & 2047) - 1024, smoothratio)); return buildfang(newOwner->tempang + fmulscale16(((newOwner->s.ang - newOwner->tempang + 1024) & 2047) - 1024, smoothratio));
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -295,9 +295,9 @@ void animatecamsprite(double smoothratio)
auto camera = &camsprite->GetOwner()->s; auto camera = &camsprite->GetOwner()->s;
auto ang = getcamspriteang(camsprite->GetOwner(), smoothratio); auto ang = getcamspriteang(camsprite->GetOwner(), 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, ang, camera->shade, camera->sectnum); // why 'shade'...? renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(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, ang, smoothratio); fi.animatesprites(camera->x, camera->y, ang.asbuild(), smoothratio);
display_mirror = 0; display_mirror = 0;
renderDrawMasks(); renderDrawMasks();
}); });
@ -517,7 +517,7 @@ void displayrooms(int snum, double smoothratio)
if (s->yvel < 0) s->yvel = -100; if (s->yvel < 0) s->yvel = -100;
else if (s->yvel > 199) s->yvel = 300; else if (s->yvel > 199) s->yvel = 300;
cang = buildang(ud.cameraactor->tempang + xs_CRoundToInt(fmulscale16(((s->ang + 1024 - ud.cameraactor->tempang) & 2047) - 1024, smoothratio))); cang = buildfang(ud.cameraactor->tempang + fmulscale16(((s->ang + 1024 - ud.cameraactor->tempang) & 2047) - 1024, smoothratio));
auto bh = buildhoriz(s->yvel); auto bh = buildhoriz(s->yvel);
se40code(s->x, s->y, s->z, cang, bh, smoothratio); se40code(s->x, s->y, s->z, cang, bh, smoothratio);
@ -581,7 +581,7 @@ void displayrooms(int snum, double smoothratio)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
auto spr = &p->newOwner->s; auto spr = &p->newOwner->s;
cang = buildang(getcamspriteang(p->newOwner, smoothratio)); cang = getcamspriteang(p->newOwner, smoothratio);
choriz = buildhoriz(spr->shade); choriz = buildhoriz(spr->shade);
cposx = spr->pos.x; cposx = spr->pos.x;
cposy = spr->pos.y; cposy = spr->pos.y;