Modified the HUD's powerup display for color accessibility.
This commit is contained in:
parent
1d44d8e5f9
commit
825e6afae1
10
src/colors.c
10
src/colors.c
|
@ -27,10 +27,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
Uint32 red;
|
||||
Uint32 darkRed;
|
||||
Uint32 yellow;
|
||||
Uint32 lightYellow;
|
||||
Uint32 darkYellow;
|
||||
Uint32 green;
|
||||
Uint32 lightGreen;
|
||||
Uint32 darkGreen;
|
||||
Uint32 blue;
|
||||
Uint32 lightBlue;
|
||||
Uint32 lighterBlue;
|
||||
Uint32 darkBlue;
|
||||
Uint32 darkerBlue;
|
||||
Uint32 black;
|
||||
|
@ -49,13 +53,17 @@ void colors_init()
|
|||
darkRed = SDL_MapRGB(screen->format, 0x66, 0x00, 0x00);
|
||||
|
||||
yellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x00);
|
||||
lightYellow = SDL_MapRGB(screen->format, 0xff, 0xff, 0x80);
|
||||
darkYellow = SDL_MapRGB(screen->format, 0x66, 0x66, 0x00);
|
||||
|
||||
green = SDL_MapRGB(screen->format, 0x00, 0xff, 0x00);
|
||||
lightGreen = SDL_MapRGB(screen->format, 0x80, 0xff, 0x80);
|
||||
darkGreen = SDL_MapRGB(screen->format, 0x00, 0x66, 0x00);
|
||||
|
||||
blue = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
|
||||
darkBlue = SDL_MapRGB(screen->format, 0x00, 0x00, 0x99);
|
||||
lightBlue = SDL_MapRGB(screen->format, 0x99, 0x99, 0xff);
|
||||
lighterBlue = SDL_MapRGB(screen->format, 0xbb, 0xbb, 0xff);
|
||||
darkBlue = SDL_MapRGB(screen->format, 0x00, 0x00, 0xcc);
|
||||
darkerBlue = SDL_MapRGB(screen->format, 0x00, 0x00, 0x44);
|
||||
|
||||
black = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
|
||||
|
|
|
@ -28,10 +28,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
extern Uint32 red;
|
||||
extern Uint32 darkRed;
|
||||
extern Uint32 yellow;
|
||||
extern Uint32 lightYellow;
|
||||
extern Uint32 darkYellow;
|
||||
extern Uint32 green;
|
||||
extern Uint32 lightGreen;
|
||||
extern Uint32 darkGreen;
|
||||
extern Uint32 blue;
|
||||
extern Uint32 lightBlue;
|
||||
extern Uint32 lighterBlue;
|
||||
extern Uint32 darkBlue;
|
||||
extern Uint32 darkerBlue;
|
||||
extern Uint32 black;
|
||||
|
|
62
src/game.c
62
src/game.c
|
@ -1874,6 +1874,8 @@ static void game_doHud()
|
|||
static int last_arrow = -1;
|
||||
int shieldColor = 0;
|
||||
SDL_Rect bar;
|
||||
SDL_Rect bar_foutline;
|
||||
SDL_Rect bar_fcolor;
|
||||
int fontColor;
|
||||
int tTextIndex;
|
||||
char text[STRMAX_SHORT];
|
||||
|
@ -2128,16 +2130,31 @@ static void game_doHud()
|
|||
bar.x = screen->w / 32 + gfx_textSprites[TS_POWER].image->w + 10;
|
||||
bar.y = screen->h - 29;
|
||||
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_foutline.y = bar.y + 2;
|
||||
bar_foutline.w = bar.w - 4;
|
||||
bar_foutline.h = bar.h - 4;
|
||||
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
bar_fcolor.y = bar_foutline.y + 2;
|
||||
bar_fcolor.w = bar_foutline.w - 4;
|
||||
bar_fcolor.h = bar_foutline.h - 4;
|
||||
|
||||
for (int i = 1 ; i <= 5 ; i++)
|
||||
{
|
||||
if (weapons[W_PLAYER_WEAPON].damage >= i) {
|
||||
if(i <= game.maxPlasmaDamage || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
|
||||
{
|
||||
SDL_FillRect(screen, &bar, green);
|
||||
SDL_FillRect(screen, &bar, darkGreen);
|
||||
SDL_FillRect(screen, &bar_foutline, green);
|
||||
SDL_FillRect(screen, &bar_fcolor, lightGreen);
|
||||
}
|
||||
} else if (i <= game.maxPlasmaDamage)
|
||||
SDL_FillRect(screen, &bar, darkGreen);
|
||||
|
||||
bar.x += screen->w * 3 / 80;
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
}
|
||||
|
||||
screen_blitText(TS_OUTPUT, screen->w * 5 / 16, screen->h - 30);
|
||||
|
@ -2146,19 +2163,34 @@ static void game_doHud()
|
|||
bar.h = 12;
|
||||
bar.x = screen->w * 5 / 16 + gfx_textSprites[TS_OUTPUT].image->w + 10;
|
||||
bar.y = screen->h - 29;
|
||||
SDL_FillRect(screen, &bar, yellow);
|
||||
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_foutline.y = bar.y + 2;
|
||||
bar_foutline.w = bar.w - 4;
|
||||
bar_foutline.h = bar.h - 4;
|
||||
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
bar_fcolor.y = bar_foutline.y + 2;
|
||||
bar_fcolor.w = bar_foutline.w - 4;
|
||||
bar_fcolor.h = bar_foutline.h - 4;
|
||||
|
||||
for (int i = 1 ; i <= 5 ; i++)
|
||||
{
|
||||
if (weapons[W_PLAYER_WEAPON].ammo[0] >= i) {
|
||||
if (weapons[W_PLAYER_WEAPON].ammo[0] >= i)
|
||||
{
|
||||
if (i <= game.maxPlasmaOutput || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
|
||||
{
|
||||
SDL_FillRect(screen, &bar, yellow);
|
||||
SDL_FillRect(screen, &bar, darkYellow);
|
||||
SDL_FillRect(screen, &bar_foutline, yellow);
|
||||
SDL_FillRect(screen, &bar_fcolor, lightYellow);
|
||||
}
|
||||
}
|
||||
else if (i <= game.maxPlasmaOutput)
|
||||
SDL_FillRect(screen, &bar, darkYellow);
|
||||
|
||||
bar.x += screen->w * 3 / 80;
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
}
|
||||
|
||||
screen_blitText(TS_COOLER, screen->w * 97 / 160, screen->h - 30);
|
||||
|
@ -2168,17 +2200,33 @@ static void game_doHud()
|
|||
bar.x = screen->w * 97 / 160 + gfx_textSprites[TS_COOLER].image->w + 10;
|
||||
bar.y = screen->h - 29;
|
||||
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_foutline.y = bar.y + 2;
|
||||
bar_foutline.w = bar.w - 4;
|
||||
bar_foutline.h = bar.h - 4;
|
||||
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
bar_fcolor.y = bar_foutline.y + 2;
|
||||
bar_fcolor.w = bar_foutline.w - 4;
|
||||
bar_fcolor.h = bar_foutline.h - 4;
|
||||
|
||||
for (int i = 1 ; i <= 5 ; i++)
|
||||
{
|
||||
if (weapons[W_PLAYER_WEAPON].reload[0] <= rate2reload[i]) {
|
||||
if (weapons[W_PLAYER_WEAPON].reload[0] <= rate2reload[i])
|
||||
{
|
||||
if (i <= game.maxPlasmaRate || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
|
||||
{
|
||||
SDL_FillRect(screen, &bar, blue);
|
||||
SDL_FillRect(screen, &bar, darkBlue);
|
||||
SDL_FillRect(screen, &bar_foutline, lightBlue);
|
||||
SDL_FillRect(screen, &bar_fcolor, lighterBlue);
|
||||
}
|
||||
}
|
||||
else if (i <= game.maxPlasmaRate)
|
||||
SDL_FillRect(screen, &bar, darkerBlue);
|
||||
SDL_FillRect(screen, &bar, darkBlue);
|
||||
|
||||
bar.x += screen->w * 3 / 80;
|
||||
bar_foutline.x = bar.x + 2;
|
||||
bar_fcolor.x = bar_foutline.x + 2;
|
||||
}
|
||||
|
||||
screen_blitText(TS_SHIELD, screen->w / 32, screen->h - 50);
|
||||
|
|
Loading…
Reference in New Issue