Display all available weapons on HUD.

This commit is contained in:
Steve 2016-02-20 15:04:15 +00:00
parent da71c1d647
commit 5bf486ede6
7 changed files with 36 additions and 8 deletions

View File

@ -46,6 +46,10 @@ SOUND
321906__bruce965__walkie-talkie-roger-beep.ogg - Walkie Talkie - Roger Beep, by bruce965 - https://freesound.org/people/bruce965/sounds/321906/ 321906__bruce965__walkie-talkie-roger-beep.ogg - Walkie Talkie - Roger Beep, by bruce965 - https://freesound.org/people/bruce965/sounds/321906/
322603__clippysounds__glass-break.ogg - Glass Break, by clippysounds - https://freesound.org/people/clippysounds/sounds/322603/ 322603__clippysounds__glass-break.ogg - Glass Break, by clippysounds - https://freesound.org/people/clippysounds/sounds/322603/
276912__pauldihor__transform.ogg - transform, by PaulDihor - https://freesound.org/people/PaulDihor/sounds/276912/ 276912__pauldihor__transform.ogg - transform, by PaulDihor - https://freesound.org/people/PaulDihor/sounds/276912/
329359__bassoonrckr__reed-guillotine.ogg - Bassoon Reed Making Tool Sounds, by Reed Guillotine.wav - https://freesound.org/people/bassoonrckr/sounds/329359/
251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg - fusion-gun_flash0_by_OnlyTheGhosts.wav, by OnlyTheGhosts - https://freesound.org/people/OnlyTheGhosts/sounds/251431/
172591__timbre__zapitydooda.ogg - d1clsstf.wav, by wildweasel - https://freesound.org/people/wildweasel/sounds/39030/
39030__wildweasel__d1clsstf.ogg - push_button_switch_07.wav, by joedeshon - https://freesound.org/people/joedeshon/sounds/139061/
MUSIC MUSIC

Binary file not shown.

View File

@ -45,7 +45,7 @@ static SDL_Texture *ecm;
static SDL_Texture *boost; static SDL_Texture *boost;
static SDL_Texture *nextGun; static SDL_Texture *nextGun;
static int numMessages; static int numMessages;
static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon", "Rockets"}; static char *gunName[] = {"", "Particle Cannon", "Plasma Cannon", "Laser Cannon", "Mag Cannon", "Rockets", "Missiles"};
void initHud(void) void initHud(void)
{ {
@ -273,19 +273,31 @@ static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, in
static void drawWeaponInfo(void) static void drawWeaponInfo(void)
{ {
int w, h; int i, y;
if (!player->combinedGuns) if (!player->combinedGuns)
{ {
if (battle.numPlayerGuns) if (battle.numPlayerGuns)
{ {
drawText(30, 70, 14, TA_LEFT, colors.white, gunName[player->selectedGunType]); y = 70;
if (battle.numPlayerGuns > 1) for (i = 0 ; i < BT_MAX ; i++)
{ {
textSize(gunName[player->selectedGunType], 14, &w, &h); if (playerHasGun(i))
{
blit(nextGun, 24 + w, 81, 1); if (player->selectedGunType == i)
{
drawText(30, y, 14, TA_LEFT, colors.green, "%s", gunName[i]);
blit(nextGun, 8, y + 5, 0);
}
else
{
drawText(30, y, 14, TA_LEFT, colors.darkGrey, "%s", gunName[i]);
}
y += 20;
}
} }
} }
else else

View File

@ -32,6 +32,7 @@ extern void drawRadar(void);
extern void drawRadarRangeWarning(void); extern void drawRadarRangeWarning(void);
extern int getPercent(float current, float total); extern int getPercent(float current, float total);
extern void textSize(char *text, int size, int *w, int *h); extern void textSize(char *text, int size, int *w, int *h);
extern int playerHasGun(int type);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -421,7 +421,11 @@ static void switchGuns(void)
while (!availableGuns[i]); while (!availableGuns[i]);
} }
player->selectedGunType = i; if (player->selectedGunType != i)
{
playSound(SND_SELECT_WEAPON);
player->selectedGunType = i;
}
} }
static void selectTarget(void) static void selectTarget(void)
@ -526,3 +530,8 @@ static void cycleRadarZoom(void)
battle.radarRange++; battle.radarRange++;
battle.radarRange %= 3; battle.radarRange %= 3;
} }
int playerHasGun(int type)
{
return availableGuns[type];
}

View File

@ -195,6 +195,7 @@ enum
SND_GET_ITEM, SND_GET_ITEM,
SND_MISSILE, SND_MISSILE,
SND_INCOMING, SND_INCOMING,
SND_SELECT_WEAPON,
SND_JUMP, SND_JUMP,
SND_ECM, SND_ECM,
SND_MAG_HIT, SND_MAG_HIT,

View File

@ -111,6 +111,7 @@ static void loadSounds(void)
sounds[SND_ECM] = Mix_LoadWAV(getFileLocation("sound/251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg")); sounds[SND_ECM] = Mix_LoadWAV(getFileLocation("sound/251431__onlytheghosts__fusion-gun-flash0-by-onlytheghosts.ogg"));
sounds[SND_MAG_HIT] = Mix_LoadWAV(getFileLocation("sound/172591__timbre__zapitydooda.ogg")); sounds[SND_MAG_HIT] = Mix_LoadWAV(getFileLocation("sound/172591__timbre__zapitydooda.ogg"));
sounds[SND_POWER_DOWN] = Mix_LoadWAV(getFileLocation("sound/39030__wildweasel__d1clsstf.ogg")); sounds[SND_POWER_DOWN] = Mix_LoadWAV(getFileLocation("sound/39030__wildweasel__d1clsstf.ogg"));
sounds[SND_SELECT_WEAPON] = Mix_LoadWAV(getFileLocation("sound/329359__bassoonrckr__reed-guillotine.ogg"));
sounds[SND_GUI_CLICK] = Mix_LoadWAV(getFileLocation("sound/257786__xtrgamr__mouse-click.ogg")); sounds[SND_GUI_CLICK] = Mix_LoadWAV(getFileLocation("sound/257786__xtrgamr__mouse-click.ogg"));
sounds[SND_GUI_SELECT] = Mix_LoadWAV(getFileLocation("sound/321104__nsstudios__blip2.ogg")); sounds[SND_GUI_SELECT] = Mix_LoadWAV(getFileLocation("sound/321104__nsstudios__blip2.ogg"));