Skip to content

Commit

Permalink
Sleep sounds #712
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Sep 23, 2024
1 parent 302fec6 commit a4cd7a5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
6 changes: 3 additions & 3 deletions data/.wolf3d/N3Ddata.cdogscpn/character_classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
"BloodColor": "ff00ff"
},
{
"Name": "Hans Grosse",
"Name": "Camel",
"HeadPics": {
"Type": "Directional",
"Sprites": "chars/heads/jones"
"Sprites": "chars/heads/sheep"
},
"Body": "big",
"Sounds": "hans"
"Sounds": "camel"
},
{
"Name": "Dr Schabbs",
Expand Down
3 changes: 1 addition & 2 deletions data/.wolf3d/N3Ddata.cdogscpn/characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@
"actionDelay": 15
},
{
"Class": "Hans Grosse",
"HairType": "flattop",
"Class": "Camel",
"Skin": "ffbf73ff",
"Arms": "0c08f0ff",
"Body": "0016ffff",
Expand Down
44 changes: 25 additions & 19 deletions src/cdogs/map_wolf.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ static const char *soundsN3D[] = {
// 0-9
"chars/alert/antelope", "chars/alert/bear", "pickup", "chars/alert/camel",
"door_close", "cantaloupe", "cantaloupe_feeder", "goat_kick", "hits/food",
"chars/die/animal",
"chars/die/antelope|chars/die/bear|chars/die/camel|chars/die/"
"elephant|chars/die/giraffe|chars/die/goat|chars/die/kangaroo|chars/die/"
"monkey|chars/die/ostrich|chars/die/ox|chars/die/sheep",
// 10-19
"chars/alert/elephant", "1up", "super_feeder", "chars/alert/giraffe",
"chars/alert/goat", "small_launcher", "ricochet", "chars/alert/kangaroo",
Expand All @@ -191,7 +193,6 @@ static const char *GetSound(const CWMapType type, const int i)
return soundsSOD[i];
case CWMAPTYPE_N3D:
return soundsN3D[i];
break;
default:
CASSERT(false, "unknown map type");
return NULL;
Expand Down Expand Up @@ -821,7 +822,6 @@ static void LoadSounds(const SoundDevice *s, const CWolfMap *map)
Mix_Chunk *data = LoadAdlibSoundData(map, i);
if (name[strlen(name) - 1] == '/')
{

AddRandomSound(s, name, data);
}
else
Expand All @@ -833,27 +833,33 @@ static void LoadSounds(const SoundDevice *s, const CWolfMap *map)
// Load digi sounds
for (int i = 0; i < map->vswap.nSounds; i++)
{
const char *name = GetSound(map->type, i);
if (name == NULL)
const char *names = GetSound(map->type, i);
if (names == NULL)
{
continue;
}
if (name[strlen(name) - 1] == '/')
continue;
Mix_Chunk *data = LoadSoundData(map, i);
if (data == NULL)
{
continue;
}
if (name[strlen(name) - 1] == '/')
{

AddRandomSound(s, name, data);
}
else
// Tokenise names
char *namesCopy;
CSTRDUP(namesCopy, names);
char *name = strtok(namesCopy, "|");
while (name != NULL)
{
AddNormalSound(s, name, data);
Mix_Chunk *data = LoadSoundData(map, i);
if (data == NULL)
{
continue;
}
if (name[strlen(name) - 1] == '/')
{
AddRandomSound(s, name, data);
}
else
{
AddNormalSound(s, name, data);
}
name = strtok(NULL, "|");
}
CFREE(namesCopy);
}
}
static Mix_Chunk *LoadSoundData(const CWolfMap *map, const int i)
Expand Down

0 comments on commit a4cd7a5

Please sign in to comment.