- Duke: Change a few return types from int to bool in HUD code.

This commit is contained in:
Mitchell Richters 2022-06-06 09:57:44 +10:00
parent f4b78dc3c7
commit 600776da2e
2 changed files with 19 additions and 22 deletions

View file

@ -61,7 +61,7 @@ inline static void hud_drawpal(double x, double y, int tilenum, int shade, int o
//
//---------------------------------------------------------------------------
void displayloogie(player_struct* p)
static void displayloogie(player_struct* p)
{
double a, y;
int z;
@ -86,17 +86,17 @@ void displayloogie(player_struct* p)
//
//---------------------------------------------------------------------------
int animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal, double const smoothratio)
static bool animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal, double const smoothratio)
{
const double fisti = min(interpolatedvaluef(p->ofist_incs, p->fist_incs, smoothratio), 32.);
if (fisti <= 0) return 0;
if (fisti <= 0) return false;
hud_drawsprite(
(-fisti + 222 + plravel),
(looking_arc + 194 + bsinf((6 + fisti) * 128., -9)),
clamp(65536. - bcosf(fisti * 64., 2), 40920., 90612.), 0, FIST, gs, fistpal, 2);
return 1;
return true;
}
//---------------------------------------------------------------------------
@ -105,18 +105,17 @@ int animatefist(int gs, player_struct* p, double look_anghalf, double looking_ar
//
//---------------------------------------------------------------------------
int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal, double const smoothratio)
static bool animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal, double const smoothratio)
{
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return false;
static const int8_t knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
const double kneei = interpolatedvaluef(knee_y[p->oknee_incs], knee_y[p->knee_incs], smoothratio);
looking_arc += kneei;
hud_drawpal(105 + plravel - look_anghalf + (kneei * 0.25), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
return 1;
return true;
}
//---------------------------------------------------------------------------
@ -125,15 +124,15 @@ int animateknee(int gs, player_struct* p, double look_anghalf, double looking_ar
//
//---------------------------------------------------------------------------
int animateknuckles(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
static bool animateknuckles(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
{
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->spr.extra <= 0) return false;
static const uint8_t knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 };
hud_drawpal(160 + plravel - look_anghalf, looking_arc + 180 - horiz16th, CRACKKNUCKLES + knuckle_frames[p->knuckle_incs >> 1], gs, 4, pal);
return 1;
return true;
}
@ -159,17 +158,16 @@ void displaymasks_d(int snum, int p, double)
//
//---------------------------------------------------------------------------
static int animatetip(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal, double const smoothratio)
static bool animatetip(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal, double const smoothratio)
{
if (p->tipincs == 0) return 0;
if (p->tipincs == 0) return false;
static const int8_t tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 };
const double tipi = interpolatedvaluef(tip_y[p->otipincs], tip_y[p->tipincs], smoothratio) * 0.5;
hud_drawpal(170 + plravel - look_anghalf, tipi + looking_arc + 240 - horiz16th, TIP + ((26 - p->tipincs) >> 4), gs, 0, pal);
return 1;
return true;
}
//---------------------------------------------------------------------------
@ -178,23 +176,22 @@ static int animatetip(int gs, player_struct* p, double look_anghalf, double look
//
//---------------------------------------------------------------------------
int animateaccess(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, double const smoothratio)
static bool animateaccess(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, double const smoothratio)
{
if(p->access_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
if (p->access_incs == 0 || p->GetActor()->spr.extra <= 0) return false;
static const int8_t access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
const double accessi = interpolatedvaluef(access_y[p->oaccess_incs], access_y[p->access_incs], smoothratio);
looking_arc += accessi;
const int pal = p->access_spritenum != nullptr ? p->access_spritenum->spr.pal : 0;
if((p->access_incs-3) > 0 && (p->access_incs-3)>>3)
if ((p->access_incs-3) > 0 && (p->access_incs-3)>>3)
hud_drawpal(170 + plravel - look_anghalf + (accessi * 0.25), looking_arc + 266 - horiz16th, HANDHOLDINGLASER + (p->access_incs >> 3), gs, 0, pal);
else
hud_drawpal(170 + plravel - look_anghalf + (accessi * 0.25), looking_arc + 266 - horiz16th, HANDHOLDINGACCESS, gs, 4, pal);
return 1;
return true;
}
//---------------------------------------------------------------------------

View file

@ -87,13 +87,13 @@ void displaymasks_r(int snum, int p, double smoothratio)
//
//---------------------------------------------------------------------------
void ShowMotorcycle(double x, double y, int tilenum, int shade, int orientation, int p, double a)
inline static void ShowMotorcycle(double x, double y, int tilenum, int shade, int orientation, int p, double a)
{
hud_drawsprite(x, y, 34816, a, tilenum, shade, p, 2 | orientation);
}
void ShowBoat(double x, double y, int tilenum, int shade, int orientation, int p, double a)
inline static void ShowBoat(double x, double y, int tilenum, int shade, int orientation, int p, double a)
{
hud_drawsprite(x, y, 66048, a, tilenum, shade, p, 2 | orientation);
}