- Replace calcSinTableValue() with game's native bsin() export.

* Also repair light for Duke's `DrawCursor()` with a multiply and shift down to get the `bsin()` output up to 24 and not 21.33 etc
This commit is contained in:
Mitchell Richters 2021-07-26 17:28:32 +10:00
parent ced8a83331
commit 1685890bc5
3 changed files with 4 additions and 9 deletions

View file

@ -65,7 +65,7 @@ class DukeMenuDelegate : RazeMenuDelegate
String picname;
if (!right) picname= String.Format("SPINNINGNUKEICON%d", ((mclock >> 3) % frames));
else picname = String.Format("SPINNINGNUKEICON%d", frames - 1 - ((frames - 1 + (mclock >> 3)) % frames));
int light = 231 + (Raze.calcSinTableValue(mclock<<5) / 768.);
int light = 231 + ((Raze.bsin(mclock<<5) * 3) >> 11);
let pe = color(255, light, light, light);
Screen.DrawTexture(TexMan.CheckForTexture(picname), false, x, y, DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_Color, pe, DTA_CenterOffsetRel, true);
}
@ -137,7 +137,7 @@ class ListMenuItemDukeLogo : ListMenuItem
if (gameinfo.gametype & GAMEFLAG_PLUTOPAK)
{
int mclock = MSTime() * 120 / 1000;
int light = 223 + (Raze.calcSinTableValue(mclock<<4) / 512.);
int light = 223 + (Raze.bsin(mclock<<4) >> 9);
let pe = Color(255, light, light, light);
Screen.DrawTexture(TexMan.CheckForTexture("MENUPLUTOPAKSPRITE"), false, x + 100, 36, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_Color, pe, DTA_CenterOffsetRel, true);
}
@ -176,7 +176,7 @@ class ListMenuItemDukeTextItem : ListMenuItemTextItem
if (selected)
{
int mclock = MSTime() * 120 / 1000;
int light = 231 + (Raze.calcSinTableValue(mclock<<5) / 512.);
int light = 231 + (Raze.bsin(mclock<<5) >> 9);
pe = Color(255, light, light, light);
}
else

View file

@ -101,7 +101,7 @@ class ListMenuItemExhumedTextItem : ListMenuItemTextItem
double y = mYpos + v.y / 2;
int shade;
if (selected) shade = Raze.CalcSinTableValue(MSTime() * 16 * 120 / 1000) >> 9;
if (selected) shade = Raze.bsin(MSTime() * 16 * 120 / 1000) >> 9;
else if (Selectable()) shade = 0;
else shade = 25;
let color = Raze.shadeToLight(shade);

View file

@ -135,11 +135,6 @@ struct Raze
{
const kAngleMask = 0x7FF;
const BAngToDegree = 360. / 2048.;
static int calcSinTableValue(int ang)
{
return int(16384 * sin((360./2048) * ang));
}
native static Color shadeToLight(int shade);
native static String PlayerName(int i);