- use explicitly sized types for static const arrays.

This commit is contained in:
Christoph Oelckers 2021-11-07 13:30:32 +01:00
parent 1eeb8864a4
commit 15be44a931
2 changed files with 21 additions and 21 deletions

View file

@ -121,7 +121,7 @@ int animateknee(int gs, player_struct* p, double look_anghalf, double looking_ar
{
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
static const int8_t knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
looking_arc += knee_y[p->knee_incs];
@ -140,7 +140,7 @@ int animateknuckles(int gs, player_struct* p, double look_anghalf, double lookin
{
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 };
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);
@ -174,7 +174,7 @@ static int animatetip(int gs, player_struct* p, double look_anghalf, double look
{
if (p->tipincs == 0) return 0;
static const short tip_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16 };
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 };
hud_drawpal(170 + plravel - look_anghalf,
(tip_y[p->tipincs] >> 1) + looking_arc + 240 - horiz16th, TIP + ((26 - p->tipincs) >> 4), gs, 0, pal);
@ -192,7 +192,7 @@ int animateaccess(int gs, player_struct* p, double look_anghalf, double looking_
{
if(p->access_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
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};
looking_arc += access_y[p->access_incs];
@ -703,7 +703,7 @@ void displayweapon_d(int snum, double smoothratio)
{
if (*kb < 5)
{
short kb_frames[] = { 0,1,2,0,0 };
static const uint8_t kb_frames[] = { 0,1,2,0,0 };
double l = 195 - 12 + weapon_xoffset;

View file

@ -318,9 +318,9 @@ void displayweapon_r(int snum, double smoothratio)
auto displaycrowbar = [&]
{
static const short kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const short kb_ox[] = { 310,342,364,418,350,316,282,288,0,0 };
static const short kb_oy[] = { 300,362,320,268,248,248,277,420,0,0 };
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const uint16_t kb_ox[] = { 310,342,364,418,350,316,282,288,0,0 };
static const uint16_t kb_oy[] = { 300,362,320,268,248,248,277,420,0,0 };
double x;
short y;
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
@ -337,9 +337,9 @@ void displayweapon_r(int snum, double smoothratio)
auto displayslingblade = [&]
{
static const short kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const short kb_ox[] = { 580,676,310,491,356,210,310,614 };
static const short kb_oy[] = { 369,363,300,323,371,400,300,440 };
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7 };
static const uint16_t kb_ox[] = { 580,676,310,491,356,210,310,614 };
static const uint16_t kb_oy[] = { 369,363,300,323,371,400,300,440 };
double x;
short y;
x = weapon_xoffset + ((kb_ox[kb_frames[*kb]] >> 1) - 12);
@ -492,11 +492,11 @@ void displayweapon_r(int snum, double smoothratio)
{
double x;
short y;
static const short kb_frames3[] = { 0,0,1,1,2,2,5,5,6,6,7,7,8,8,0,0,0,0,0,0,0 };
static const short kb_frames2[] = { 0,0,3,3,4,4,5,5,6,6,7,7,8,8,0,0,20,20,21,21,21,21,20,20,20,20,0,0 };
static const short kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,0,0,20,20,21,21,21,21,20,20,20,20,0,0 };
static const short kb_ox[] = { 300,300,300,300,300,330,320,310,305,306,302 };
static const short kb_oy[] = { 315,300,302,305,302,302,303,306,302,404,384 };
static const uint8_t kb_frames3[] = { 0,0,1,1,2,2,5,5,6,6,7,7,8,8,0,0,0,0,0,0,0 };
static const uint8_t kb_frames2[] = { 0,0,3,3,4,4,5,5,6,6,7,7,8,8,0,0,20,20,21,21,21,21,20,20,20,20,0,0 };
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,0,0,20,20,21,21,21,21,20,20,20,20,0,0 };
static const uint16_t kb_ox[] = { 300,300,300,300,300,330,320,310,305,306,302 };
static const uint16_t kb_oy[] = { 315,300,302,305,302,302,303,306,302,404,384 };
short tm;
tm = 180;
if (p->shotgun_state[1])
@ -632,8 +632,8 @@ void displayweapon_r(int snum, double smoothratio)
if ((*kb) < 22)
{
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,3,3,4,4,6,6,6,6,5,5,4,4,3,3,0,0 };
static const short kb_ox[] = { 194,190,185,208,215,215,216,216,201,170 };
static const short kb_oy[] = { 256,249,248,238,228,218,208,256,245,258 };
static const uint16_t kb_ox[] = { 194,190,185,208,215,215,216,216,201,170 };
static const uint16_t kb_oy[] = { 256,249,248,238,228,218,208,256,245,258 };
double x;
short y;
@ -648,9 +648,9 @@ void displayweapon_r(int snum, double smoothratio)
}
else
{
static const short kb_frames[] = { 0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0 };
static const short kb_ox[] = { 244,244,244 };
static const short kb_oy[] = { 256,249,248 };
static const uint8_t kb_frames[] = { 0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0 };
static const uint16_t kb_ox[] = { 244,244,244 };
static const uint16_t kb_oy[] = { 256,249,248 };
double x;
short dx;
short y;