Skip to content

Commit

Permalink
Added menu sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Radke committed Sep 5, 2018
1 parent 7533dab commit 7eaef36
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 5 deletions.
6 changes: 3 additions & 3 deletions assets/stages/Level1/Definition/Level1HouseStageDefinition.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PositionedEntityROMDef LEVEL1_HOUSE_STAGE_ST_ENTITIES[] =
{&CLOUDS_IM, {(194), (138), (LAYER_4), 0}, 0, NULL, NULL, NULL, false}, // Clouds
{&LEVEL_1_HOUSE_LIGHT_IM, {(196), (140), (LAYER_0_ITEMS - 1), 0}, 0, NULL, NULL, NULL, false}, // Light
{&COIN_AG, {(204), (146), LAYER_0_ITEMS, LAYER_0_ITEMS_DISPLACEMENT}, 26, NULL, NULL, NULL, false}, // Coin
{&FIRE_SMALL_AG, {(240), (155), (24), 0}, 0, NULL, NULL, NULL, false}, // Fire
{&FIRE_SMALL_AG, {(240), (155), (32), 0}, 0, NULL, NULL, NULL, false}, // Fire
{&COLLISION_TOP_CL, {(240), (152), (0), 0}, 0, NULL, NULL, (void*)&level1_house_stage_collision_24_24_8, false}, // Fireplace Collision
{&MOUND_BG_BACK_IM, {(255), (104), (LAYER_5), 0}, 0, NULL, NULL, NULL, false}, // Mountains
{&COLLISION_CL, {(264), (128), (0), 0}, 0, NULL, NULL, (void*)&level1_house_stage_collision_16_96_8, false}, // Right Collision
Expand Down Expand Up @@ -257,9 +257,9 @@ StageROMDef LEVEL1_HOUSE_STAGE_ST =
// __spt1
0,
// __spt2
0,
16,
// __spt3
0,
1,
},

// optical configuration values
Expand Down
2 changes: 1 addition & 1 deletion lib/release/release.bat.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SET LDT=%LDT:~0,4%-%LDT:~4,2%-%LDT:~6,2%
ECHO STARTING RELEASE PROCESS...
ECHO.

FOR %%M IN (debug, beta, tools) DO (
FOR %%M IN (release, tools, debug) DO (

::OUTPUT MODE
ECHO Mode: %%M
Expand Down
19 changes: 19 additions & 0 deletions source/states/OptionsScreenState/OptionsScreenState.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <LangSelectScreenState.h>
#include <TitleScreenState.h>
#include <KeypadManager.h>
#include <SoundManager.h>
#include "OptionsScreenState.h"


Expand All @@ -44,6 +45,8 @@
//---------------------------------------------------------------------------------------------------------

extern StageROMDef EMPTY_STAGE_ST;
extern const u16 SPLASH_SCREENS_OPTION_SELECT_SND[];
extern const u16 SPLASH_SCREENS_OPTION_CONFIRM_SND[];


//---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -184,6 +187,8 @@ void OptionsScreenState::processUserInput(UserInput userInput)
(void (*)(Object, Object))OptionsScreenState::onOptionSelectedFadeOutComplete, // callback function
Object::safeCast(this) // callback scope
);

OptionsScreenState::playConfirmSound(this);
}
else if((userInput.pressedKey & K_B) || (userInput.pressedKey & K_SEL))
{
Expand All @@ -204,13 +209,27 @@ void OptionsScreenState::processUserInput(UserInput userInput)
else if((userInput.pressedKey & K_LU) || (userInput.pressedKey & K_RU))
{
OptionsSelector::selectPrevious(this->optionsSelector);
OptionsScreenState::playMenuSound(this);
}
else if((userInput.pressedKey & K_LD) || (userInput.pressedKey & K_RD))
{
OptionsSelector::selectNext(this->optionsSelector);
OptionsScreenState::playMenuSound(this);
}
}

void OptionsScreenState::playMenuSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_SELECT_SND, position);
}

void OptionsScreenState::playConfirmSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_CONFIRM_SND, position);
}

// handle event
void OptionsScreenState::onFadeInComplete(Object eventFirer __attribute__ ((unused)))
{
Expand Down
11 changes: 10 additions & 1 deletion source/states/OverworldState/OverworldState.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
#include <ProgressManager.h>
#include <EventManager.h>
#include <KeypadManager.h>
#include <SoundManager.h>


//---------------------------------------------------------------------------------------------------------
// DECLARATIONS
//---------------------------------------------------------------------------------------------------------

extern StageROMDef OVERWORLD1_STAGE_ST;
extern const u16 SPLASH_SCREENS_OPTION_CONFIRM_SND[];


//---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -199,7 +201,14 @@ void OverworldState::processUserInput(UserInput userInput)
Object::safeCast(this) // callback scope
);

} else if(K_B & userInput.pressedKey) { // disable user input
// play sound
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_CONFIRM_SND, position);

}
else if(K_B & userInput.pressedKey)
{
// disable user input
Game::disableKeypad(Game::getInstance());

// start a fade out effect
Expand Down
26 changes: 26 additions & 0 deletions source/states/PauseScreenState/PauseScreenState.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <PlatformerLevelState.h>
#include <Languages.h>
#include <KeypadManager.h>
#include <SoundManager.h>
#include <Utilities.h>


Expand All @@ -46,6 +47,8 @@
//---------------------------------------------------------------------------------------------------------

extern StageROMDef PAUSE_SCREEN_STAGE_ST;
extern const u16 SPLASH_SCREENS_OPTION_SELECT_SND[];
extern const u16 SPLASH_SCREENS_OPTION_CONFIRM_SND[];


//---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -179,6 +182,9 @@ void PauseScreenState::processUserInput(UserInput userInput)
Object::safeCast(this) // callback scope
);

// play sound
PauseScreenState::playConfirmSound(this);

break;

case kPauseScreenOptionQuitLevel:
Expand All @@ -203,6 +209,10 @@ void PauseScreenState::processUserInput(UserInput userInput)

// set mode accordingly
this->mode = kPauseScreenModeShowConfirmQuit;

// play sound
PauseScreenState::playConfirmSound(this);

break;
}
}
Expand All @@ -222,6 +232,9 @@ void PauseScreenState::processUserInput(UserInput userInput)
(void (*)(Object, Object))PauseScreenState::onFadeOutComplete, // callback function
Object::safeCast(this) // callback scope
);

// play sound
PauseScreenState::playConfirmSound(this);
}
}
else if((this->mode == kPauseScreenModeShowConfirmQuit) && (userInput.pressedKey & K_B))
Expand All @@ -236,13 +249,26 @@ void PauseScreenState::processUserInput(UserInput userInput)
else if((this->mode == kPauseScreenModeShowOptions) && ((userInput.pressedKey & K_LU) || (userInput.pressedKey & K_RU)))
{
OptionsSelector::selectPrevious(this->optionsSelector);
PauseScreenState::playMenuSound(this);
}
else if((this->mode == kPauseScreenModeShowOptions) && ((userInput.pressedKey & K_LD) || (userInput.pressedKey & K_RD)))
{
OptionsSelector::selectNext(this->optionsSelector);
PauseScreenState::playMenuSound(this);
}
}

void PauseScreenState::playMenuSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_SELECT_SND, position);
}
void PauseScreenState::playConfirmSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_CONFIRM_SND, position);
}

// handle event
void PauseScreenState::onFadeInComplete(Object eventFirer __attribute__ ((unused)))
{
Expand Down
20 changes: 20 additions & 0 deletions source/states/TitleScreenState/TitleScreenState.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@
#include <EventManager.h>
#include <OverworldState.h>
#include <KeypadManager.h>
#include <SoundManager.h>


//---------------------------------------------------------------------------------------------------------
// DECLARATIONS
//---------------------------------------------------------------------------------------------------------

extern StageROMDef TITLE_SCREEN_STAGE_ST;
extern const u16 SPLASH_SCREENS_OPTION_SELECT_SND[];
extern const u16 SPLASH_SCREENS_OPTION_CONFIRM_SND[];


//---------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -308,6 +311,9 @@ void TitleScreenState::processUserInput(UserInput userInput)
Object::safeCast(this) // callback scope
);

// play sound
TitleScreenState::playConfirmSound(this);

break;

case kTitleScreenOptionNewGame:
Expand Down Expand Up @@ -385,10 +391,12 @@ void TitleScreenState::processUserInput(UserInput userInput)
else if((this->mode == kTitleScreenModeShowOptions) && ((userInput.pressedKey & K_LL) || (userInput.pressedKey & K_RL)))
{
OptionsSelector::selectPrevious(this->optionsSelector);
TitleScreenState::playMenuSound(this);
}
else if((this->mode == kTitleScreenModeShowOptions) && ((userInput.pressedKey & K_LR) || (userInput.pressedKey & K_RR)))
{
OptionsSelector::selectNext(this->optionsSelector);
TitleScreenState::playMenuSound(this);
}
else if((this->mode == kTitleScreenModeShowConfirmNewGame) && (userInput.pressedKey & K_B))
{
Expand All @@ -408,6 +416,18 @@ void TitleScreenState::processUserInput(UserInput userInput)
}
}

void TitleScreenState::playMenuSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_SELECT_SND, position);
}

void TitleScreenState::playConfirmSound()
{
Vector3D position = {192, 112, 0};
SoundManager::playFxSound(SoundManager::getInstance(), SPLASH_SCREENS_OPTION_CONFIRM_SND, position);
}

// handle event
void TitleScreenState::onSecondChange(Object eventFirer __attribute__ ((unused)))
{
Expand Down

0 comments on commit 7eaef36

Please sign in to comment.