mirror of
https://github.com/cxong/cdogs-sdl.git
synced 2025-07-23 07:23:01 +02:00
Configurable switch sound (#136)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
"ReloadLead": 0,
|
||||
"Sound": "bang",
|
||||
"ReloadSound": "",
|
||||
"SwitchSound": "switch",
|
||||
"SoundLockLength": 0,
|
||||
"Recoil": 0,
|
||||
"SpreadCount": 1,
|
||||
|
BIN
sounds/switch.ogg
Normal file
BIN
sounds/switch.ogg
Normal file
Binary file not shown.
Binary file not shown.
@@ -211,8 +211,7 @@ void PickupPickup(TActor *a, const Pickup *p)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: gun-specific pickup sound
|
||||
sound = gSoundDevice.switchSound;
|
||||
sound = IdGunDescription(p->class->u.GunId)->SwitchSound;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -149,7 +149,6 @@ void SoundInitialize(SoundDevice *device, const char *path)
|
||||
// Look for commonly used sounds to set our pointers
|
||||
device->footstepSound = StrSound("footstep");
|
||||
device->slideSound = StrSound("slide");
|
||||
device->switchSound = StrSound("switch");
|
||||
device->pickupSound = StrSound("pickup");
|
||||
device->healthSound = StrSound("health");
|
||||
device->clickSound = StrSound("click");
|
||||
|
@@ -22,7 +22,7 @@
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2013-2014, Cong Xu
|
||||
Copyright (c) 2013-2015, Cong Xu
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -46,8 +46,7 @@
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef __SOUNDS
|
||||
#define __SOUNDS
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -93,7 +92,6 @@ typedef struct
|
||||
// Some commonly-used sounds, store them here for quick access
|
||||
Mix_Chunk *footstepSound;
|
||||
Mix_Chunk *slideSound;
|
||||
Mix_Chunk *switchSound;
|
||||
Mix_Chunk *pickupSound;
|
||||
Mix_Chunk *healthSound;
|
||||
Mix_Chunk *clickSound;
|
||||
@@ -142,5 +140,3 @@ void SoundPlayAtPlusDistance(
|
||||
|
||||
Mix_Chunk *StrSound(const char *s);
|
||||
Mix_Chunk *SoundGetRandomScream(SoundDevice *device);
|
||||
|
||||
#endif
|
||||
|
@@ -236,8 +236,8 @@ static void LoadGunDescription(
|
||||
LoadInt(&g->ReloadLead, node, "ReloadLead");
|
||||
|
||||
LoadSoundFromNode(&g->Sound, node, "Sound");
|
||||
|
||||
LoadSoundFromNode(&g->ReloadSound, node, "ReloadSound");
|
||||
LoadSoundFromNode(&g->SwitchSound, node, "SwitchSound");
|
||||
|
||||
LoadInt(&g->SoundLockLength, node, "SoundLockLength");
|
||||
|
||||
|
@@ -109,6 +109,7 @@ typedef struct
|
||||
int ReloadLead;
|
||||
Mix_Chunk *Sound;
|
||||
Mix_Chunk *ReloadSound;
|
||||
Mix_Chunk *SwitchSound;
|
||||
int SoundLockLength;
|
||||
double Recoil; // Random recoil for inaccurate weapons, in radians
|
||||
struct
|
||||
|
@@ -101,7 +101,7 @@ static void PlayerSpecialCommands(TActor *actor, const int cmd)
|
||||
{
|
||||
SoundPlayAt(
|
||||
&gSoundDevice,
|
||||
gSoundDevice.switchSound,
|
||||
ActorGetGun(actor)->Gun->SwitchSound,
|
||||
Vec2iNew(actor->tileItem.x, actor->tileItem.y));
|
||||
}
|
||||
}
|
||||
|
@@ -1310,11 +1310,11 @@ json_unescape (const char *text)
|
||||
char three = 0x80; /* 10 000000 */
|
||||
char four = 0x80; /* 10 000000 */
|
||||
|
||||
if (!text[++r] == '\\')
|
||||
if (text[++r] != '\\')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!text[++r] == 'u')
|
||||
if (text[++r] != 'u')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user