mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- Duke: Replace all uses of binangle
with DAngle
objects.
This commit is contained in:
parent
aee102ba73
commit
0b33f39fcd
5 changed files with 34 additions and 21 deletions
|
@ -434,6 +434,18 @@ inline constexpr binangle interpolatedangle(binangle oang, binangle ang, int con
|
|||
return bamang(oang.asbam() + MulScale(((ang.asbam() + 0x80000000 - oang.asbam()) & 0xFFFFFFFF) - 0x80000000, smoothratio, scale));
|
||||
}
|
||||
|
||||
// FIXME: Can't rely on overloading this to functions we're trying to deprecate. OK for now.
|
||||
inline constexpr DAngle interpolatedangle(DAngle oang, DAngle ang, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return DAngle::fromBam(interpolatedangle(bamang(oang.BAMs()), bamang(ang.BAMs()), int(smoothratio), scale).asbam());
|
||||
}
|
||||
|
||||
// FIXME: Can't rely on overloading this to functions we're trying to deprecate. OK for now.
|
||||
inline constexpr DAngle interpolatedangle(DAngle oang, DAngle ang, int const smoothratio, int const scale = 16)
|
||||
{
|
||||
return DAngle::fromBam(interpolatedangle(bamang(oang.BAMs()), bamang(ang.BAMs()), smoothratio, scale).asbam());
|
||||
}
|
||||
|
||||
inline constexpr fixedhoriz interpolatedhorizon(fixedhoriz oval, fixedhoriz val, double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return q16horiz(oval.asq16() + MulScale((val - oval).asq16(), int(smoothratio), scale));
|
||||
|
|
|
@ -237,7 +237,8 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4])
|
|||
void drawoverlays(double smoothratio)
|
||||
{
|
||||
player_struct* pp;
|
||||
int cposx, cposy, cang;
|
||||
int cposx, cposy;
|
||||
DAngle cang;
|
||||
|
||||
pp = &ps[screenpeek];
|
||||
// set palette here, in case the 3D view is off.
|
||||
|
@ -275,22 +276,22 @@ void drawoverlays(double smoothratio)
|
|||
{
|
||||
cposx = interpolatedvalue(omyx, myx, smoothratio);
|
||||
cposy = interpolatedvalue(omyy, myy, smoothratio);
|
||||
cang = (!SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio)).asbuild();
|
||||
cang = !SyncInput() ? myang : interpolatedangle(omyang, myang, smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = interpolatedvalue(pp->player_int_opos().X, pp->player_int_pos().X, smoothratio);
|
||||
cposy = interpolatedvalue(pp->player_int_opos().Y, pp->player_int_pos().Y, smoothratio);
|
||||
cang = (!SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio)).asbuild();
|
||||
cang = DAngle::fromBam((!SyncInput() ? pp->angle.ang : interpolatedangle(pp->angle.oang, pp->angle.ang, smoothratio)).asbam());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cposx = pp->player_int_opos().X;
|
||||
cposy = pp->player_int_opos().Y;
|
||||
cang = pp->angle.oang.asbuild();
|
||||
cang = DAngle::fromBam(pp->angle.oang.asbam());
|
||||
}
|
||||
DrawOverheadMap(cposx, cposy, cang, smoothratio);
|
||||
DrawOverheadMap(cposx, cposy, cang.Buildang(), smoothratio);
|
||||
RestoreInterpolations();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
int globalskillsound;
|
||||
binangle myang, omyang;
|
||||
DAngle myang, omyang;
|
||||
fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
||||
int mycursectnum, myjumpingcounter;
|
||||
uint8_t myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||
|
@ -54,7 +54,7 @@ void resetmys()
|
|||
myy = omyy = ps[myconnectindex].pos.Y;
|
||||
myz = omyz = ps[myconnectindex].pos.Z;
|
||||
myxvel = myyvel = myzvel = 0;
|
||||
myang = ps[myconnectindex].angle.ang;
|
||||
myang = DAngle::fromBam(ps[myconnectindex].angle.ang.asbam());
|
||||
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;
|
||||
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
|
||||
mycursectnum = sectnum(ps[myconnectindex].cursector);
|
||||
|
|
|
@ -5,7 +5,7 @@ BEGIN_DUKE_NS
|
|||
extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
extern int globalskillsound;
|
||||
extern int mycursectnum, myjumpingcounter;
|
||||
extern binangle myang, omyang;
|
||||
extern DAngle myang, omyang;
|
||||
extern fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
||||
extern uint8_t myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||
extern int fakemovefifoplc;
|
||||
|
|
|
@ -59,10 +59,10 @@ BEGIN_DUKE_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, double smoothratio, bool sceneonly, float fov)
|
||||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, DAngle a, fixedhoriz h, DAngle rotscrnang, double smoothratio, bool sceneonly, float fov)
|
||||
{
|
||||
if (!sceneonly) drawweapon(smoothratio);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum(sect), DAngle::fromBam(a.asbam()), h, DAngle::fromBam(rotscrnang.asbam()), smoothratio, fov);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum(sect), a, h, rotscrnang, smoothratio, fov);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -223,7 +223,7 @@ static int getdrugmode(player_struct *p, int oyrepeat)
|
|||
void displayrooms(int snum, double smoothratio, bool sceneonly)
|
||||
{
|
||||
int cposx, cposy, cposz, fz, cz;
|
||||
binangle cang, rotscrnang;
|
||||
DAngle cang, rotscrnang;
|
||||
fixedhoriz choriz;
|
||||
player_struct* p;
|
||||
|
||||
|
@ -258,12 +258,12 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
if (act->spr.yvel < 0) act->spr.yvel = -100;
|
||||
else if (act->spr.yvel > 199) act->spr.yvel = 300;
|
||||
|
||||
cang = buildang(interpolatedangle(ud.cameraactor->tempang, act->int_ang(), smoothratio));
|
||||
cang = DAngle::fromBuild(interpolatedangle(ud.cameraactor->tempang, act->int_ang(), smoothratio));
|
||||
|
||||
auto bh = buildhoriz(act->spr.yvel);
|
||||
auto cstat = act->spr.cstat;
|
||||
act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||
renderView(act, act->sector(), act->int_pos().X, act->int_pos().Y, act->int_pos().Z - (4 << 8), cang, bh, buildang(0), smoothratio, sceneonly, fov);
|
||||
renderView(act, act->sector(), act->int_pos().X, act->int_pos().Y, act->int_pos().Z - (4 << 8), cang, bh, DAngle::fromDeg(0.), smoothratio, sceneonly, fov);
|
||||
act->spr.cstat = cstat;
|
||||
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
setgamepalette(setpal(p));
|
||||
|
||||
// set screen rotation.
|
||||
rotscrnang = !SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
|
||||
rotscrnang = DAngle::fromBam((!SyncInput() ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio)).asbam());
|
||||
|
||||
#if 0
|
||||
if ((snum == myconnectindex) && (numplayers > 1))
|
||||
|
@ -310,13 +310,13 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
if (SyncInput())
|
||||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
cang = DAngle::fromBam(p->angle.interpolatedsum(smoothratio).asbam());
|
||||
choriz = p->horizon.interpolatedsum(smoothratio);
|
||||
cang = p->angle.interpolatedsum(smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is for real time updating of the view direction.
|
||||
cang = p->angle.sum();
|
||||
cang = DAngle::fromBam(p->angle.sum().asbam());
|
||||
choriz = p->horizon.sum();
|
||||
}
|
||||
}
|
||||
|
@ -326,13 +326,13 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
if (p->newOwner != nullptr)
|
||||
{
|
||||
auto act = p->newOwner;
|
||||
cang = buildang(act->interpolatedang(smoothratio));
|
||||
cang = DAngle::fromBuild(act->interpolatedang(smoothratio));
|
||||
choriz = buildhoriz(act->spr.shade);
|
||||
cposx = act->int_pos().X;
|
||||
cposy = act->int_pos().Y;
|
||||
cposz = act->int_pos().Z;
|
||||
sect = act->sector();
|
||||
rotscrnang = buildang(0);
|
||||
rotscrnang = DAngle::fromDeg(0.);
|
||||
smoothratio = MaxSmoothRatio;
|
||||
viewer = act;
|
||||
camview = true;
|
||||
|
@ -347,10 +347,10 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
cposz -= isRR() ? 3840 : 3072;
|
||||
|
||||
viewer = p->GetActor();
|
||||
if (!calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, DAngle::fromBam(cang.asbam()), choriz, smoothratio))
|
||||
if (!calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio))
|
||||
{
|
||||
cposz += isRR() ? 3840 : 3072;
|
||||
calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, DAngle::fromBam(cang.asbam()), choriz, smoothratio);
|
||||
calcChaseCamPos(&cposx, &cposy, &cposz, viewer, §, cang, choriz, smoothratio);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
if (earthquaketime > 0 && p->on_ground == 1)
|
||||
{
|
||||
cposz += 256 - (((earthquaketime) & 1) << 9);
|
||||
cang += buildang((2 - ((earthquaketime) & 2)) << 2);
|
||||
cang += DAngle::fromBuild((2 - ((earthquaketime) & 2)) << 2);
|
||||
}
|
||||
|
||||
if (p->GetActor()->spr.pal == 1) cposz -= (18 << 8);
|
||||
|
|
Loading…
Reference in a new issue