diff --git a/README.md b/README.md index f0c8d91..1d0b1d4 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ All other data files are CC BY-NC-SA 3.0, with the following attribution: Copyri * 254174__kwahmah-02__s.ogg - s.wav, by kwahmah_02 (CC-0) - https://freesound.org/people/kwahmah_02/sounds/254174/ * 172870__escortmarius__carbidexplosion.ogg - carbidexplosion.wav, by escortmarius (CC-BY) - https://freesound.org/people/escortmarius/sounds/172870/ * 320181__dland__hint.ogg - hint.wav, by dland (CC-0) - https://freesound.org/people/dland/sounds/320181/ +* 62491__benboncan__dslr-click.ogg - DSLR Click.wav, by Benboncan (CC-BY) - https://freesound.org/people/Benboncan/sounds/62491/ +* 154934__klawykogut__empty-gun-shot.ogg - Empty Gun Shot, by KlawyKogut (CC-0) - https://freesound.org/people/KlawyKogut/sounds/154934/ +* 107786__leviclaassen__beepbeep.ogg - beepbeep.wav, by leviclaassen (CC-BY) - https://freesound.org/people/leviclaassen/sounds/107786/ +* 33785__jobro__4-beep-b.ogg - 4 beep b.wav, by jobro (CC-BY) - https://freesound.org/people/jobro/sounds/33785/ + ### MUSIC diff --git a/data/credits/credits.json b/data/credits/credits.json index ad5a588..0835658 100644 --- a/data/credits/credits.json +++ b/data/credits/credits.json @@ -207,6 +207,22 @@ "0 24 hint.wav, by dland (CC-0)", "0 24 https://freesound.org/people/dland/sounds/320181/", + "30 24 62491__benboncan__dslr-click.ogg", + "0 24 DSLR Click.wav, by Benboncan (CC-BY)", + "0 24 https://freesound.org/people/Benboncan/sounds/62491/", + + "30 24 154934__klawykogut__empty-gun-shot.ogg", + "0 24 Empty Gun Shot, by KlawyKogut (CC-0)", + "0 24 https://freesound.org/people/KlawyKogut/sounds/154934/", + + "30 24 107786__leviclaassen__beepbeep.ogg", + "0 24 beepbeep.wav, by leviclaassen (CC-BY)", + "0 24 https://freesound.org/people/leviclaassen/sounds/107786/", + + "30 24 33785__jobro__4-beep-b.ogg", + "0 24 4 beep b.wav, by jobro (CC-BY)", + "0 24 https://freesound.org/people/jobro/sounds/33785/", + "75 30 MUSIC", "30 24 Battle in the winter.mp3", diff --git a/sound/107786__leviclaassen__beepbeep.ogg b/sound/107786__leviclaassen__beepbeep.ogg new file mode 100644 index 0000000..eabfefd Binary files /dev/null and b/sound/107786__leviclaassen__beepbeep.ogg differ diff --git a/sound/154934__klawykogut__empty-gun-shot.ogg b/sound/154934__klawykogut__empty-gun-shot.ogg new file mode 100644 index 0000000..12b7553 Binary files /dev/null and b/sound/154934__klawykogut__empty-gun-shot.ogg differ diff --git a/sound/33785__jobro__4-beep-b.ogg b/sound/33785__jobro__4-beep-b.ogg new file mode 100644 index 0000000..f2b214f Binary files /dev/null and b/sound/33785__jobro__4-beep-b.ogg differ diff --git a/sound/62491__benboncan__dslr-click.ogg b/sound/62491__benboncan__dslr-click.ogg new file mode 100644 index 0000000..7d94c5e Binary files /dev/null and b/sound/62491__benboncan__dslr-click.ogg differ diff --git a/src/battle/objectives.c b/src/battle/objectives.c index 87cffaa..43c7d38 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -248,6 +248,9 @@ void activateObjectives(char *objectives) { char *token; Objective *o; + int activated; + + activated = 0; token = strtok(objectives, ";"); @@ -264,11 +267,18 @@ void activateObjectives(char *objectives) { updateObjective(o->targetName, o->targetType); } + + activated = 1; } } token = strtok(NULL, ";"); } + + if (activated) + { + playSound(SND_NEW_OBJECTIVE); + } } void loadObjectives(cJSON *node) diff --git a/src/battle/objectives.h b/src/battle/objectives.h index 5d75820..01e3d49 100644 --- a/src/battle/objectives.h +++ b/src/battle/objectives.h @@ -28,6 +28,7 @@ extern void failMission(void); extern char *getTranslatedString(char *string); extern int getJSONValue(cJSON *node, char *name, int defValue); extern long lookup(char *name); +extern void playSound(int id); extern Battle battle; extern Colors colors; diff --git a/src/battle/player.c b/src/battle/player.c index 860f893..7e61100 100644 --- a/src/battle/player.c +++ b/src/battle/player.c @@ -36,6 +36,7 @@ static void preFireMissile(void); static void applyRestrictions(void); static int isPriorityMissionTarget(Entity *e, int dist, int closest); static int targetOutOfRange(void); +static void rechargeBoostECM(void); static void setPilotName(void); static int selectedPlayerIndex; @@ -119,8 +120,7 @@ static void setPilotName(void) void doPlayer(void) { - battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_RECHARGE_TIME); - battle.ecmTimer = MIN(battle.ecmTimer + 1, ECM_RECHARGE_TIME); + rechargeBoostECM(); self = player; @@ -196,6 +196,25 @@ void doPlayer(void) } } +static void rechargeBoostECM(void) +{ + int boostTimer, ecmTimer; + + boostTimer = battle.boostTimer; + battle.boostTimer = MIN(battle.boostTimer + 1, BOOST_RECHARGE_TIME); + if (boostTimer < BOOST_RECHARGE_TIME && battle.boostTimer == BOOST_RECHARGE_TIME) + { + playSound(SND_RECHARGED); + } + + ecmTimer = battle.ecmTimer; + battle.ecmTimer = MIN(battle.ecmTimer + 1, ECM_RECHARGE_TIME); + if (ecmTimer < ECM_RECHARGE_TIME && battle.ecmTimer == ECM_RECHARGE_TIME) + { + playSound(SND_RECHARGED); + } +} + static int targetOutOfRange(void) { return (app.gameplay.autoSwitchPlayerTarget && getDistance(player->x, player->y, player->target->x, player->target->y) > SCREEN_WIDTH * 2); @@ -384,9 +403,17 @@ static void preFireMissile(void) } else { + playSound(SND_GUI_DENIED); + addHudMessage(colors.white, _("Target not in range")); } } + else if (!player->missiles) + { + addHudMessage(colors.white, _("Out of missiles")); + + playSound(SND_NO_MISSILES); + } } void initPlayerSelect(void) @@ -650,6 +677,8 @@ static int isPriorityMissionTarget(Entity *e, int dist, int closest) static void cycleRadarZoom(void) { battle.radarRange = (battle.radarRange + 1) % 3; + + playSound(SND_ZOOM); } int playerHasGun(int type) diff --git a/src/defs.h b/src/defs.h index 6d5aecb..e817196 100644 --- a/src/defs.h +++ b/src/defs.h @@ -279,6 +279,10 @@ enum SND_GUI_SELECT, SND_GUI_CLOSE, SND_GUI_DENIED, + SND_ZOOM, + SND_NEW_OBJECTIVE, + SND_NO_MISSILES, + SND_RECHARGED, SND_MAX }; diff --git a/src/system/sound.c b/src/system/sound.c index 1b3f568..d680c11 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -122,6 +122,10 @@ static void loadSounds(void) sounds[SND_MINE_WARNING] = loadSound("sound/254174__kwahmah-02__s.ogg"); sounds[SND_TIME_WARNING] = loadSound("sound/320181__dland__hint.ogg"); sounds[SND_CAP_DEATH] = loadSound("sound/000000_large_explosion.ogg"); + sounds[SND_ZOOM] = loadSound("sound/62491__benboncan__dslr-click.ogg"); + sounds[SND_NO_MISSILES] = loadSound("sound/154934__klawykogut__empty-gun-shot.ogg"); + sounds[SND_NEW_OBJECTIVE] = loadSound("sound/107786__leviclaassen__beepbeep.ogg"); + sounds[SND_RECHARGED] = loadSound("sound/33785__jobro__4-beep-b.ogg"); sounds[SND_GUI_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg"); sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");