mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Make 360. / 2048.
a constant expression and replace all uses throughout code.
This commit is contained in:
parent
aa35b6a479
commit
029f8807df
10 changed files with 12 additions and 12 deletions
|
@ -60,6 +60,7 @@ enum
|
|||
|
||||
constexpr double BAngRadian = pi::pi() * (1. / 1024.);
|
||||
constexpr double BRadAngScale = 1. / BAngRadian;
|
||||
constexpr double BAngToDegree = 360. / 2048.;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -154,8 +154,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
int const keymove = gi->playerKeyMove() << running;
|
||||
int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1;
|
||||
float const mousevelscale = keymove / 160.f;
|
||||
double const angtodegscale = 360. / 2048.;
|
||||
double const hidspeed = ((running ? 1585. : 867.5) / GameTicRate) * angtodegscale;
|
||||
double const hidspeed = ((running ? 1585. : 867.5) / GameTicRate) * BAngToDegree;
|
||||
|
||||
// process mouse and initial controller input.
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe)
|
||||
|
@ -199,7 +198,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
// allow Exhumed to use its legacy values given the drastic difference from the other games.
|
||||
if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn)
|
||||
{
|
||||
preambleturn = turnamount = (running ? 12 : 8) * angtodegscale;
|
||||
preambleturn = turnamount = (running ? 12 : 8) * BAngToDegree;
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe))
|
||||
|
|
|
@ -46,7 +46,7 @@ void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int p
|
|||
{
|
||||
auto tex = tileGetTexture(pTile->picnum);
|
||||
double scale = pTile->z/65536.;
|
||||
double angle = pTile->angle * (360./2048);
|
||||
double angle = pTile->angle * BAngToDegree;
|
||||
int renderstyle = (stat & RS_NOMASK)? STYLE_Normal : STYLE_Translucent;
|
||||
double alpha = (stat & RS_TRANS1)? glblend[0].def[!!(stat & RS_TRANS2)].alpha : 1.;
|
||||
int pin = (stat & kQavOrientationLeft)? -1 : (stat & RS_ALIGN_R)? 1:0;
|
||||
|
|
|
@ -882,7 +882,7 @@ FString GameInterface::GetCoordString()
|
|||
FString out;
|
||||
|
||||
out.Format("pos= %d, %d, %d - angle = %2.3f",
|
||||
gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang * (360./2048));
|
||||
gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang * BAngToDegree);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -577,7 +577,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
else if (j > (65536 << 1)) j = (65536 << 1);
|
||||
|
||||
DrawTexture(twod, tileGetTexture(i), xdim / 2. + spos.x / 4096., ydim / 2. + spos.y / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
DTA_Rotate, daang * -BAngToDegree, DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -755,7 +755,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
|
|||
}
|
||||
|
||||
input.fvel = xs_CRoundToInt(p->MotoSpeed);
|
||||
input.avel *= (45. / 256.);
|
||||
input.avel *= BAngToDegree;
|
||||
loc.avel += input.avel;
|
||||
}
|
||||
|
||||
|
|
|
@ -413,8 +413,8 @@ public:
|
|||
p->drunkang = 400;
|
||||
}
|
||||
|
||||
DrawRotated(tileGetTexture(GUTMETER), 256, top + 15, DI_ITEM_RELCENTER, p->drunkang * (-360. / 2048), 1, scale, scale, 0xffffffff, 0);
|
||||
DrawRotated(tileGetTexture(GUTMETER), 292, top + 15, DI_ITEM_RELCENTER, p->eatang * (-360. / 2048), 1, scale, scale, 0xffffffff, 0);
|
||||
DrawRotated(tileGetTexture(GUTMETER), 256, top + 15, DI_ITEM_RELCENTER, p->drunkang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0);
|
||||
DrawRotated(tileGetTexture(GUTMETER), 292, top + 15, DI_ITEM_RELCENTER, p->eatang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0);
|
||||
|
||||
if (p->drink_amt >= 0 && p->drink_amt <= 30)
|
||||
{
|
||||
|
|
|
@ -250,7 +250,7 @@ public:
|
|||
{
|
||||
twod->ClearScreen();
|
||||
DrawTexture(twod, decoder.animTex().GetFrame(), 160, 100, DTA_FullscreenScale, FSMode_Fit320x200,
|
||||
DTA_CenterOffset, true, DTA_FlipY, true, DTA_ScaleX, z / 65536., DTA_ScaleY, z / 65536., DTA_Rotate, (-angle - 512) * (360. / 2048.), TAG_DONE);
|
||||
DTA_CenterOffset, true, DTA_FlipY, true, DTA_ScaleX, z / 65536., DTA_ScaleY, z / 65536., DTA_Rotate, (-angle - 512) * BAngToDegree, TAG_DONE);
|
||||
}
|
||||
|
||||
lastclock = clock;
|
||||
|
|
|
@ -1825,7 +1825,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
|
|||
double sc = MulScale(czoom * (spr->yrepeat), yxaspect, 16) / 32768.;
|
||||
if (spnum >= 0)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * (-360. / 2048),
|
||||
DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * -BAngToDegree,
|
||||
DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, spr->pal), DTA_Color, shadeToLight(spr->shade),
|
||||
DTA_Alpha, (spr->cstat & 2) ? 0.33 : 1., TAG_DONE);
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dasha
|
|||
DTA_FlipX, !!(dastat & RS_XFLIPHUD),
|
||||
DTA_FlipY, !!(dastat & RS_YFLIPHUD),
|
||||
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
|
||||
DTA_Rotate, a * (-360./2048),
|
||||
DTA_Rotate, a * -BAngToDegree,
|
||||
DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)),
|
||||
DTA_Alpha, alpha,
|
||||
TAG_DONE);
|
||||
|
|
Loading…
Reference in a new issue