mirror of
https://github.com/cxong/cdogs-sdl.git
synced 2025-07-23 07:23:01 +02:00
Fix and update menu sounds #676
This commit is contained in:
8
sounds/menu.txt
Normal file
8
sounds/menu.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
menu_back
|
||||
menu_enter
|
||||
menu_error
|
||||
menu_start
|
||||
menu_switch
|
||||
Derived from Hi-Tech Button Sound Pack I (Non Themed) by Circlerun
|
||||
https://opengameart.org/content/hi-tech-button-sound-pack-i-non-themed
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
BIN
sounds/menu_back.ogg
Normal file
BIN
sounds/menu_back.ogg
Normal file
Binary file not shown.
BIN
sounds/menu_enter.ogg
Normal file
BIN
sounds/menu_enter.ogg
Normal file
Binary file not shown.
BIN
sounds/menu_error.ogg
Normal file
BIN
sounds/menu_error.ogg
Normal file
Binary file not shown.
BIN
sounds/menu_start.ogg
Normal file
BIN
sounds/menu_start.ogg
Normal file
Binary file not shown.
BIN
sounds/menu_switch.ogg
Normal file
BIN
sounds/menu_switch.ogg
Normal file
Binary file not shown.
@@ -81,7 +81,7 @@ static void CampaignIntroOnExit(GameLoopData *data)
|
||||
const ScreenCampaignIntroData *sData = data->Data;
|
||||
if (sData->waitResult != EVENT_WAIT_CANCEL)
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
MenuPlaySound(MENU_SOUND_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,7 +240,7 @@ static void MissionBriefingOnExit(GameLoopData *data)
|
||||
|
||||
if (mData->waitResult == EVENT_WAIT_OK)
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
MenuPlaySound(MENU_SOUND_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -370,8 +370,8 @@ static void OnConnect(NetServer *n, ENetEvent event)
|
||||
LOG(LM_NET, LL_DEBUG, "NetServer: sending campaign entry");
|
||||
NCampaignDef def = NMakeCampaignDef(&gCampaign);
|
||||
NetServerSendMsg(n, peerId, GAME_EVENT_CAMPAIGN_DEF, &def);
|
||||
|
||||
SoundPlay(&gSoundDevice, StrSound("hahaha"));
|
||||
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_start"));
|
||||
LOG(LM_NET, LL_DEBUG, "NetServer: client connection complete");
|
||||
|
||||
NetServerFlush(n);
|
||||
|
@@ -439,6 +439,7 @@ static void RunGameInput(GameLoopData *data)
|
||||
// Pause the game
|
||||
rData->pausingDevice = firstPausingDevice;
|
||||
rData->isMap = false;
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_error"));
|
||||
}
|
||||
else if (pausingDevice != INPUT_DEVICE_UNSET)
|
||||
{
|
||||
@@ -453,12 +454,14 @@ static void RunGameInput(GameLoopData *data)
|
||||
rData->controllerUnplugged = false;
|
||||
// Don't skip exiting the game
|
||||
data->SkipNextFrame = false;
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_back"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pause the game
|
||||
rData->pausingDevice = pausingDevice;
|
||||
rData->isMap = false;
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_back"));
|
||||
}
|
||||
}
|
||||
|
||||
|
17
src/menu.c
17
src/menu.c
@@ -301,8 +301,11 @@ GameLoopResult MenuUpdate(MenuSystem *ms)
|
||||
const Rect2i bounds = MenuGetSubmenuBounds(ms, i);
|
||||
if (Rect2iIsInside(bounds, ms->handlers->mouse.currentPos))
|
||||
{
|
||||
menu->u.normal.index = i;
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
if (menu->u.normal.index != i)
|
||||
{
|
||||
menu->u.normal.index = i;
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -901,19 +904,19 @@ void MenuPlaySound(MenuSound s)
|
||||
switch (s)
|
||||
{
|
||||
case MENU_SOUND_ENTER:
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_enter"));
|
||||
break;
|
||||
case MENU_SOUND_BACK:
|
||||
SoundPlay(&gSoundDevice, StrSound("pickup"));
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_back"));
|
||||
break;
|
||||
case MENU_SOUND_SWITCH:
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_switch"));
|
||||
break;
|
||||
case MENU_SOUND_START:
|
||||
SoundPlay(&gSoundDevice, StrSound("hahaha"));
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_start"));
|
||||
break;
|
||||
case MENU_SOUND_ERROR:
|
||||
SoundPlay(&gSoundDevice, StrSound("aargh/man"));
|
||||
SoundPlay(&gSoundDevice, StrSound("menu_error"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -154,11 +154,11 @@ static void EnterCodeScreenOnExit(GameLoopData *data)
|
||||
if (eData->Mission > 0)
|
||||
{
|
||||
gCampaign.MissionIndex = eData->Mission;
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
MenuPlaySound(MENU_SOUND_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("switch"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
}
|
||||
#define PASSWORD_ENTRY_COLS 10
|
||||
@@ -198,7 +198,7 @@ static GameLoopResult EnterCodeScreenUpdate(GameLoopData *data, LoopRunner *l)
|
||||
if (eData->Mission == 0)
|
||||
{
|
||||
// Password doesn't work; play a bad sound
|
||||
SoundPlay(&gSoundDevice, StrSound("aargh/man"));
|
||||
MenuPlaySound(MENU_SOUND_ERROR);
|
||||
return UPDATE_RESULT_OK;
|
||||
}
|
||||
|
||||
@@ -226,12 +226,12 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
// enter a letter
|
||||
data->Buffer[strlen(data->Buffer)] =
|
||||
PASSWORD_LETTERS[data->Selection];
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
MenuPlaySound(MENU_SOUND_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Too many letters entered
|
||||
SoundPlay(&gSoundDevice, StrSound("aargh/man"));
|
||||
MenuPlaySound(MENU_SOUND_ERROR);
|
||||
}
|
||||
}
|
||||
else if (cmd & CMD_BUTTON2)
|
||||
@@ -240,12 +240,12 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
{
|
||||
// Delete a letter
|
||||
data->Buffer[strlen(data->Buffer) - 1] = 0;
|
||||
SoundPlay(&gSoundDevice, StrSound("bang"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No letters to delete
|
||||
SoundPlay(&gSoundDevice, StrSound("aargh/man"));
|
||||
MenuPlaySound(MENU_SOUND_ERROR);
|
||||
}
|
||||
}
|
||||
else if (cmd & CMD_LEFT)
|
||||
@@ -253,7 +253,7 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
if (data->Selection > 0)
|
||||
{
|
||||
data->Selection--;
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
}
|
||||
else if (cmd & CMD_RIGHT)
|
||||
@@ -261,7 +261,7 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
if (data->Selection < (int)strlen(PASSWORD_LETTERS))
|
||||
{
|
||||
data->Selection++;
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
}
|
||||
else if (cmd & CMD_UP)
|
||||
@@ -269,7 +269,7 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
if (data->Selection >= PASSWORD_ENTRY_COLS)
|
||||
{
|
||||
data->Selection -= PASSWORD_ENTRY_COLS;
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
}
|
||||
else if (cmd & CMD_DOWN)
|
||||
@@ -278,7 +278,7 @@ static bool PasswordEntry(EnterCodeScreenData *data, const int cmd)
|
||||
(int)strlen(PASSWORD_LETTERS) - PASSWORD_ENTRY_COLS)
|
||||
{
|
||||
data->Selection += PASSWORD_ENTRY_COLS;
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -276,14 +276,14 @@ static void AssignPlayerInputDevices(EventHandlers *handlers)
|
||||
if (KeyIsPressed(&handlers->keyboard, ConfigGetInt(&gConfig, buf)) &&
|
||||
PlayerTrySetUnusedInputDevice(p, INPUT_DEVICE_KEYBOARD, j))
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("hahaha"));
|
||||
MenuPlaySound(MENU_SOUND_START);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (MouseIsPressed(&handlers->mouse, SDL_BUTTON_LEFT) &&
|
||||
PlayerTrySetUnusedInputDevice(p, INPUT_DEVICE_MOUSE, 0))
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("hahaha"));
|
||||
MenuPlaySound(MENU_SOUND_START);
|
||||
continue;
|
||||
}
|
||||
for (int j = 0; j < (int)handlers->joysticks.size; j++)
|
||||
@@ -292,7 +292,7 @@ static void AssignPlayerInputDevices(EventHandlers *handlers)
|
||||
if (JoyIsPressed(joy->id, CMD_BUTTON1) &&
|
||||
PlayerTrySetUnusedInputDevice(p, INPUT_DEVICE_JOYSTICK, joy->id))
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("hahaha"));
|
||||
MenuPlaySound(MENU_SOUND_START);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ static void PlayerListOnEnter(GameLoopData *data)
|
||||
static void PlayerListOnExit(GameLoopData *data)
|
||||
{
|
||||
UNUSED(data);
|
||||
SoundPlay(&gSoundDevice, StrSound("mg"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
}
|
||||
static GameLoopResult PlayerListUpdate(GameLoopData *data, LoopRunner *l)
|
||||
{
|
||||
@@ -301,17 +301,17 @@ static int PlayerListInput(int cmd, void *data)
|
||||
|
||||
if (cmd == CMD_DOWN)
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
pl->scroll++;
|
||||
}
|
||||
else if (cmd == CMD_UP)
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("door"));
|
||||
MenuPlaySound(MENU_SOUND_SWITCH);
|
||||
pl->scroll--;
|
||||
}
|
||||
else if (AnyButton(cmd))
|
||||
{
|
||||
SoundPlay(&gSoundDevice, StrSound("pickup"));
|
||||
MenuPlaySound(MENU_SOUND_BACK);
|
||||
return 1;
|
||||
}
|
||||
// Scroll wrap-around
|
||||
|
Reference in New Issue
Block a user