diff --git a/README.md b/README.md index 259c2cd..022e726 100644 --- a/README.md +++ b/README.md @@ -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/ 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/ +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 diff --git a/sound/329359__bassoonrckr__reed-guillotine.ogg b/sound/329359__bassoonrckr__reed-guillotine.ogg new file mode 100644 index 0000000..db975ba Binary files /dev/null and b/sound/329359__bassoonrckr__reed-guillotine.ogg differ diff --git a/src/battle/hud.c b/src/battle/hud.c index 0ce66d7..4a6ab56 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -45,7 +45,7 @@ static SDL_Texture *ecm; static SDL_Texture *boost; static SDL_Texture *nextGun; 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) { @@ -273,19 +273,31 @@ static void drawBoostECMBar(int current, int max, int x, int y, int r, int g, in static void drawWeaponInfo(void) { - int w, h; + int i, y; if (!player->combinedGuns) { 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); - - blit(nextGun, 24 + w, 81, 1); + if (playerHasGun(i)) + { + 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 diff --git a/src/battle/hud.h b/src/battle/hud.h index 605c636..02b3e4f 100644 --- a/src/battle/hud.h +++ b/src/battle/hud.h @@ -32,6 +32,7 @@ extern void drawRadar(void); extern void drawRadarRangeWarning(void); extern int getPercent(float current, float total); extern void textSize(char *text, int size, int *w, int *h); +extern int playerHasGun(int type); extern App app; extern Battle battle; diff --git a/src/battle/player.c b/src/battle/player.c index 21418f8..39957d9 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -421,7 +421,11 @@ static void switchGuns(void) while (!availableGuns[i]); } - player->selectedGunType = i; + if (player->selectedGunType != i) + { + playSound(SND_SELECT_WEAPON); + player->selectedGunType = i; + } } static void selectTarget(void) @@ -526,3 +530,8 @@ static void cycleRadarZoom(void) battle.radarRange++; battle.radarRange %= 3; } + +int playerHasGun(int type) +{ + return availableGuns[type]; +} diff --git a/src/defs.h b/src/defs.h index ac77a62..aee7edf 100644 --- a/src/defs.h +++ b/src/defs.h @@ -195,6 +195,7 @@ enum SND_GET_ITEM, SND_MISSILE, SND_INCOMING, + SND_SELECT_WEAPON, SND_JUMP, SND_ECM, SND_MAG_HIT, diff --git a/src/system/sound.c b/src/system/sound.c index 142b94d..e0addbd 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -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_MAG_HIT] = Mix_LoadWAV(getFileLocation("sound/172591__timbre__zapitydooda.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_SELECT] = Mix_LoadWAV(getFileLocation("sound/321104__nsstudios__blip2.ogg"));