mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- Blood: Replace all uses of binangle
with DAngle
objects.
This commit is contained in:
parent
0b33f39fcd
commit
6167448f27
8 changed files with 56 additions and 55 deletions
|
@ -467,10 +467,10 @@ void dragpoint(walltype* startwall, const DVector2& pos)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, binangle angle)
|
||||
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, DAngle angle)
|
||||
{
|
||||
auto cosang = g_cosbam(angle.asbam());
|
||||
auto sinang = g_sinbam(angle.asbam());
|
||||
auto cosang = angle.Cos();
|
||||
auto sinang = angle.Sin();
|
||||
auto p = point - pivot;
|
||||
return {
|
||||
p.X * cosang - p.Y * sinang + pivot.X,
|
||||
|
|
|
@ -172,7 +172,7 @@ void checkRotatedWalls();
|
|||
bool sectorsConnected(int sect1, int sect2);
|
||||
void dragpoint(walltype* wal, int newx, int newy);
|
||||
void dragpoint(walltype* wal, const DVector2& pos);
|
||||
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, binangle angle);
|
||||
DVector2 rotatepoint(const DVector2& pivot, const DVector2& point, DAngle angle);
|
||||
int32_t inside(double x, double y, const sectortype* sect);
|
||||
void getcorrectzsofslope(int sectnum, int dax, int day, int* ceilz, int* florz);
|
||||
int getceilzofslopeptr(const sectortype* sec, int dax, int day);
|
||||
|
|
|
@ -43,7 +43,8 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
|
|||
|
||||
if (ang != INT_MIN)
|
||||
{
|
||||
pPlayer->angle.oang = pPlayer->angle.ang = pView->angle = gView->angle.ang = buildang(ang);
|
||||
pPlayer->angle.oang = pPlayer->angle.ang = gView->angle.ang = buildang(ang);
|
||||
pView->angle = DAngle::fromBuild(ang);
|
||||
}
|
||||
|
||||
if (horz != INT_MIN)
|
||||
|
|
|
@ -855,12 +855,12 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6
|
|||
|
||||
DVector2 pivot = { a4 * inttoworld, a5 * inttoworld };
|
||||
DVector2 offset = { (vc - a4) * inttoworld, (v8 - a5) * inttoworld };
|
||||
auto angle = buildang(ang);
|
||||
auto angle = DAngle::fromBuild(ang);
|
||||
|
||||
auto rotatewall = [=](walltype* wal, binangle angle, const DVector2& offset)
|
||||
auto rotatewall = [=](walltype* wal, DAngle angle, const DVector2& offset)
|
||||
{
|
||||
auto vec = wal->baseWall;
|
||||
if (angle.asbam() != 0)
|
||||
if (angle.Degrees() != 0)
|
||||
vec = rotatepoint(pivot, vec, angle);
|
||||
vec += offset;
|
||||
|
||||
|
|
|
@ -53,8 +53,6 @@ int gViewIndex;
|
|||
|
||||
double gInterpolate;
|
||||
|
||||
int gScreenTilt;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -65,7 +63,7 @@ void viewBackupView(int nPlayer)
|
|||
{
|
||||
PLAYER* pPlayer = &gPlayer[nPlayer];
|
||||
VIEW* pView = &gPrevView[nPlayer];
|
||||
pView->angle = pPlayer->angle.ang;
|
||||
pView->angle = DAngle::fromBam(pPlayer->angle.ang.asbam());
|
||||
pView->x = pPlayer->actor->int_pos().X;
|
||||
pView->y = pPlayer->actor->int_pos().Y;
|
||||
pView->viewz = pPlayer->zView;
|
||||
|
@ -77,8 +75,8 @@ void viewBackupView(int nPlayer)
|
|||
pView->bobWidth = pPlayer->bobWidth;
|
||||
pView->shakeBobY = pPlayer->swayHeight;
|
||||
pView->shakeBobX = pPlayer->swayWidth;
|
||||
pView->look_ang = pPlayer->angle.look_ang;
|
||||
pView->rotscrnang = pPlayer->angle.rotscrnang;
|
||||
pView->look_ang = DAngle::fromBam(pPlayer->angle.look_ang.asbam());
|
||||
pView->rotscrnang = DAngle::fromBam(pPlayer->angle.rotscrnang.asbam());
|
||||
pPlayer->angle.backup();
|
||||
pPlayer->horizon.backup();
|
||||
}
|
||||
|
@ -374,8 +372,10 @@ void UpdateBlend()
|
|||
|
||||
// int gVisibility;
|
||||
|
||||
int deliriumTilt, deliriumTurn, deliriumPitch;
|
||||
int gScreenTiltO, deliriumTurnO, deliriumPitchO;
|
||||
int deliriumTilt, deliriumPitch;
|
||||
int deliriumPitchO;
|
||||
DAngle deliriumTurnO, deliriumTurn;
|
||||
DAngle gScreenTiltO, gScreenTilt;
|
||||
|
||||
int gShowFrameRate = 1;
|
||||
|
||||
|
@ -404,25 +404,25 @@ void viewUpdateDelirium(void)
|
|||
}
|
||||
int sin2 = Sin(2 * timer) >> 1;
|
||||
int sin3 = Sin(3 * timer) >> 1;
|
||||
gScreenTilt = MulScale(sin2 + sin3, tilt1, 30);
|
||||
gScreenTilt = DAngle::fromBuild(MulScale(sin2 + sin3, tilt1, 30));
|
||||
int sin4 = Sin(4 * timer) >> 1;
|
||||
deliriumTurn = MulScale(sin3 + sin4, tilt2, 30);
|
||||
deliriumTurn = DAngle::fromBuild(MulScale(sin3 + sin4, tilt2, 30));
|
||||
int sin5 = Sin(5 * timer) >> 1;
|
||||
deliriumPitch = MulScale(sin4 + sin5, pitch, 30);
|
||||
return;
|
||||
}
|
||||
gScreenTilt = ((gScreenTilt + 1024) & 2047) - 1024;
|
||||
if (gScreenTilt > 0)
|
||||
gScreenTilt = gScreenTilt.Normalized180();
|
||||
if (gScreenTilt > DAngle::fromDeg(0.))
|
||||
{
|
||||
gScreenTilt -= 8;
|
||||
if (gScreenTilt < 0)
|
||||
gScreenTilt = 0;
|
||||
gScreenTilt -= DAngle::fromBuild(8);
|
||||
if (gScreenTilt < DAngle::fromDeg(0.))
|
||||
gScreenTilt = DAngle::fromDeg(0.);
|
||||
}
|
||||
else if (gScreenTilt < 0)
|
||||
else if (gScreenTilt < DAngle::fromDeg(0.))
|
||||
{
|
||||
gScreenTilt += 8;
|
||||
if (gScreenTilt >= 0)
|
||||
gScreenTilt = 0;
|
||||
gScreenTilt += DAngle::fromBuild(8);
|
||||
if (gScreenTilt >= DAngle::fromDeg(0.))
|
||||
gScreenTilt = DAngle::fromDeg(0.);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ void viewUpdateDelirium(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void viewUpdateShake(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
||||
void viewUpdateShake(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
||||
{
|
||||
auto doEffect = [&](const int& effectType)
|
||||
{
|
||||
|
@ -440,7 +440,7 @@ void viewUpdateShake(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, do
|
|||
{
|
||||
int nValue = ClipHigh(effectType * 8, 2000);
|
||||
cH += buildhoriz(QRandom2(nValue >> 8));
|
||||
cA += buildang(QRandom2(nValue >> 8));
|
||||
cA += DAngle::fromBuild(QRandom2(nValue >> 8));
|
||||
cX += QRandom2(nValue >> 4);
|
||||
cY += QRandom2(nValue >> 4);
|
||||
cZ += QRandom2(nValue);
|
||||
|
@ -486,7 +486,7 @@ static void DrawMap(DBloodActor* view)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void SetupView(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, binangle& rotscrnang)
|
||||
void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, DAngle& rotscrnang)
|
||||
{
|
||||
int bobWidth, bobHeight;
|
||||
|
||||
|
@ -532,15 +532,15 @@ void SetupView(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectorty
|
|||
|
||||
if (!SyncInput())
|
||||
{
|
||||
cA = gView->angle.sum();
|
||||
cA = DAngle::fromBam(gView->angle.sum().asbam());
|
||||
cH = gView->horizon.sum();
|
||||
rotscrnang = gView->angle.rotscrnang;
|
||||
rotscrnang = DAngle::fromBam(gView->angle.rotscrnang.asbam());
|
||||
}
|
||||
else
|
||||
{
|
||||
cA = gView->angle.interpolatedsum(gInterpolate);
|
||||
cA = DAngle::fromBam(gView->angle.interpolatedsum(gInterpolate).asbam());
|
||||
cH = gView->horizon.interpolatedsum(gInterpolate);
|
||||
rotscrnang = gView->angle.interpolatedrotscrn(gInterpolate);
|
||||
rotscrnang = DAngle::fromBam(gView->angle.interpolatedrotscrn(gInterpolate).asbam());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,8 +550,8 @@ void SetupView(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectorty
|
|||
{
|
||||
if (cl_viewhbob)
|
||||
{
|
||||
cX -= MulScale(bobWidth, Sin(cA.asbuild()), 30) >> 4;
|
||||
cY += MulScale(bobWidth, Cos(cA.asbuild()), 30) >> 4;
|
||||
cX -= MulScale(bobWidth, Sin(cA.Buildang()), 30) >> 4;
|
||||
cY += MulScale(bobWidth, Cos(cA.Buildang()), 30) >> 4;
|
||||
}
|
||||
if (cl_viewvbob)
|
||||
{
|
||||
|
@ -563,7 +563,7 @@ void SetupView(int& cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectorty
|
|||
}
|
||||
else
|
||||
{
|
||||
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->actor, &pSector, DAngle::fromBam(cA.asbam()), cH, gInterpolate);
|
||||
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->actor, &pSector, cA, cH, gInterpolate);
|
||||
}
|
||||
if (pSector != nullptr)
|
||||
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &pSector);
|
||||
|
@ -681,20 +681,19 @@ void viewDrawScreen(bool sceneonly)
|
|||
UpdateBlend();
|
||||
|
||||
int cX, cY, cZ;
|
||||
binangle cA;
|
||||
DAngle cA, rotscrnang;
|
||||
fixedhoriz cH;
|
||||
sectortype* pSector;
|
||||
double zDelta;
|
||||
double shakeX, shakeY;
|
||||
binangle rotscrnang;
|
||||
SetupView(cX, cY, cZ, cA, cH, pSector, zDelta, shakeX, shakeY, rotscrnang);
|
||||
|
||||
binangle tilt = interpolatedangle(buildang(gScreenTiltO), buildang(gScreenTilt), gInterpolate);
|
||||
DAngle tilt = interpolatedangle(gScreenTiltO, gScreenTilt, gInterpolate);
|
||||
bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0;
|
||||
static bool bDeliriumOld = false;
|
||||
//int tiltcs, tiltdim;
|
||||
uint8_t otherview = powerupCheck(gView, kPwUpCrystalBall) > 0;
|
||||
if (tilt.asbam() || bDelirium)
|
||||
if (tilt.Degrees() || bDelirium)
|
||||
{
|
||||
rotscrnang = tilt;
|
||||
}
|
||||
|
@ -712,7 +711,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
if (!bDelirium)
|
||||
{
|
||||
deliriumTilt = 0;
|
||||
deliriumTurn = 0;
|
||||
deliriumTurn = DAngle::fromDeg(0.);
|
||||
deliriumPitch = 0;
|
||||
}
|
||||
int brightness = 0;
|
||||
|
@ -738,7 +737,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
}
|
||||
g_relvisibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - brightness, 0)) - g_visibility;
|
||||
cA += interpolatedangle(buildang(deliriumTurnO), buildang(deliriumTurn), gInterpolate);
|
||||
cA += interpolatedangle(deliriumTurnO, deliriumTurn, gInterpolate);
|
||||
|
||||
if (pSector != nullptr)
|
||||
{
|
||||
|
@ -756,7 +755,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
|
||||
cH = q16horiz(ClipRange(cH.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||
|
||||
if ((tilt.asbam() || bDelirium) && !sceneonly)
|
||||
if ((tilt.Degrees() || bDelirium) && !sceneonly)
|
||||
{
|
||||
if (gDeliriumBlur)
|
||||
{
|
||||
|
@ -772,7 +771,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
fixedhoriz deliriumPitchI = q16horiz(interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
|
||||
auto bakCstat = gView->actor->spr.cstat;
|
||||
gView->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(gView->actor, { cX, cY, cZ }, sectnum(pSector), DAngle::fromBam(cA.asbam()), cH + deliriumPitchI, DAngle::fromBam(rotscrnang.asbam()), gInterpolate);
|
||||
render_drawrooms(gView->actor, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
gView->actor->spr.cstat = bakCstat;
|
||||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ struct VIEW {
|
|||
fixedhoriz horiz; // horiz
|
||||
fixedhoriz horizoff; // horizoff
|
||||
int at2c;
|
||||
binangle angle; // angle
|
||||
DAngle angle; // angle
|
||||
int weaponZ; // weapon z
|
||||
int viewz; // view z
|
||||
int at3c;
|
||||
|
@ -70,8 +70,8 @@ struct VIEW {
|
|||
uint8_t at72; // underwater
|
||||
int16_t at73; // sprite flags
|
||||
SPRITEHIT at75;
|
||||
binangle look_ang;
|
||||
binangle rotscrnang;
|
||||
DAngle look_ang;
|
||||
DAngle rotscrnang;
|
||||
};
|
||||
|
||||
extern VIEW gPrevView[kMaxPlayers];
|
||||
|
@ -131,9 +131,10 @@ enum { kFontNum = 5 };
|
|||
extern FFont* gFont[kFontNum];
|
||||
extern VIEWPOS gViewPos;
|
||||
extern int gViewIndex;
|
||||
extern int gScreenTilt;
|
||||
extern int deliriumTilt, deliriumTurn, deliriumPitch;
|
||||
extern int gScreenTiltO, deliriumTurnO, deliriumPitchO;
|
||||
extern int deliriumTilt, deliriumPitch;
|
||||
extern int deliriumPitchO;
|
||||
extern DAngle deliriumTurnO, deliriumTurn;
|
||||
extern DAngle gScreenTiltO, gScreenTilt;
|
||||
extern int gShowFrameRate;
|
||||
extern int gLastPal;
|
||||
extern double gInterpolate;
|
||||
|
|
|
@ -286,7 +286,7 @@ void ms(DDukeActor* const actor)
|
|||
|
||||
for(auto& wal : wallsofsector(actor->sector()))
|
||||
{
|
||||
auto t = rotatepoint({ 0, 0 }, { msx[j] * inttoworld, msy[j] * inttoworld }, buildang(k & 2047));
|
||||
auto t = rotatepoint({ 0, 0 }, { msx[j] * inttoworld, msy[j] * inttoworld }, DAngle::fromBuild(k & 2047));
|
||||
|
||||
dragpoint(&wal, actor->spr.pos.XY() + t);
|
||||
j++;
|
||||
|
@ -2683,7 +2683,7 @@ void handle_se00(DDukeActor* actor)
|
|||
|
||||
ps[p].player_add_int_z(zchange);
|
||||
|
||||
auto result = rotatepoint(Owner->spr.pos, ps[p].pos.XY(), buildang(q * l));
|
||||
auto result = rotatepoint(Owner->spr.pos, ps[p].pos.XY(), DAngle::fromBuild(q * l));
|
||||
|
||||
ps[p].bobpos += (result - ps[p].pos.XY());
|
||||
|
||||
|
@ -2713,7 +2713,7 @@ void handle_se00(DDukeActor* actor)
|
|||
|
||||
act2->add_int_z(zchange);
|
||||
|
||||
auto pos = rotatepoint(Owner->spr.pos.XY(), act2->spr.pos.XY(), buildang(q* l));
|
||||
auto pos = rotatepoint(Owner->spr.pos.XY(), act2->spr.pos.XY(), DAngle::fromBuild(q* l));
|
||||
act2->spr.pos.X = pos.X;
|
||||
act2->spr.pos.Y = pos.Y;
|
||||
}
|
||||
|
@ -2861,7 +2861,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
|
||||
if (actor->sector() == psp->sector())
|
||||
{
|
||||
auto result = rotatepoint(actor->spr.pos.XY(), ps[p].pos.XY(), buildang(q));
|
||||
auto result = rotatepoint(actor->spr.pos.XY(), ps[p].pos.XY(), DAngle::fromBuild(q));
|
||||
|
||||
ps[p].pos.X = result.X + mm;
|
||||
ps[p].pos.Y = result.Y + xx;
|
||||
|
|
|
@ -1633,7 +1633,7 @@ void MovePoints(SECTOR_OBJECT* sop, short delta_ang, int nx, int ny)
|
|||
if ((wal.extra & WALLFX_LOOP_SPIN_4X))
|
||||
rot_ang = NORM_ANGLE(rot_ang * 4);
|
||||
|
||||
auto vec = rotatepoint(pivot, wal.pos, buildang(rot_ang));
|
||||
auto vec = rotatepoint(pivot, wal.pos, DAngle::fromBuild(rot_ang));
|
||||
|
||||
if (wal.extra && (wal.extra & WALLFX_LOOP_OUTER))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue