1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Moved the spell sounds into a json file.

This commit is contained in:
Frank Zago 2011-08-20 01:57:03 +00:00
parent cf1d179acf
commit 3519cca2c9
3 changed files with 251 additions and 84 deletions

View File

@ -231,32 +231,22 @@ void CSoundHandler::initCreaturesSounds(const std::vector<ConstTransitivePtr< CC
void CSoundHandler::initSpellsSounds(const std::vector< ConstTransitivePtr<CSpell> > &spells) void CSoundHandler::initSpellsSounds(const std::vector< ConstTransitivePtr<CSpell> > &spells)
{ {
tlog5 << "\t\tReading config/sp_sounds.txt" << std::endl; class JsonNode config(DATA_DIR "/config/sp_sounds.json");
std::ifstream ifs(DATA_DIR "/config/sp_sounds.txt");
std::string line;
while(getline(ifs, line)) if (!config["spell_sounds"].isNull()) {
{ const JsonVector &vector = config["spell_sounds"].Vector();
int spellid;
std::string soundfile=""; for (JsonVector::const_iterator it = vector.begin(); it!=vector.end(); ++it) {
std::istringstream str(line); const JsonNode &node = *it;
int spellid = node["id"].Float();
str >> spellid >> soundfile;
if (str.good() || (str.eof() && soundfile != ""))
{
const CSpell *s = CGI->spellh->spells[spellid]; const CSpell *s = CGI->spellh->spells[spellid];
if (vstd::contains(spellSounds, s)) if (vstd::contains(spellSounds, s))
{
tlog1 << "Spell << " << spellid << " already has a sound" << std::endl; tlog1 << "Spell << " << spellid << " already has a sound" << std::endl;
}
spellSounds[s] = getSoundID(node["soundfile"].String());
spellSounds[s] = getSoundID(soundfile);
} }
} }
ifs.close();
ifs.clear();
} }
// Plays a sound, and return its channel so we can fade it out later // Plays a sound, and return its channel so we can fade it out later

242
config/sp_sounds.json Normal file
View File

@ -0,0 +1,242 @@
// Sounds associated with spells
// "name" is not currently used in game
{
"spell_sounds":
[
{
"id": 15,
"soundfile": "MAGICBLT.wav",
"name": "magic arrow"
},
{
"id": 16,
"soundfile": "ICERAY.wav",
"name": "ice bolt"
},
{
"id": 17,
"soundfile": "LIGHTBLT.wav",
"name": "lightning bolt"
},
{
"id": 20,
"soundfile": "FROSTING.wav",
"name": "frost ring"
},
{
"id": 21,
"soundfile": "FIREBALL.wav",
"name": "fireball"
},
{
"id": 23,
"soundfile": "METEOR.wav",
"name": "meteor shower"
},
{
"id": 24,
"soundfile": "DEATHRIP.wav",
"name": "death ripple"
},
{
"id": 26,
"soundfile": "ARMGEDN.wav",
"name": "armageddon"
},
{
"id": 27,
"soundfile": "SHIELD.wav",
"name": "shield "
},
{
"id": 28,
"soundfile": "AIRSHELD.wav",
"name": "air shield"
},
{
"id": 30,
"soundfile": "PROTECTA.wav",
"name": "protection from air"
},
{
"id": 31,
"soundfile": "PROTECTF.wav",
"name": "protection from fire"
},
{
"id": 32,
"soundfile": "PROTECTW.wav",
"name": "protection from water"
},
{
"id": 33,
"soundfile": "PROTECTE.wav",
"name": "protection from earth"
},
{
"id": 35,
"soundfile": "DISPELL.wav",
"name": "dispell"
},
{
"id": 41,
"soundfile": "BLESS.wav",
"name": "bless"
},
{
"id": 42,
"soundfile": "CURSE.wav",
"name": "curse"
},
{
"id": 43,
"soundfile": "BLOODLUS.wav",
"name": "bloodlust"
},
{
"id": 44,
"soundfile": "PRECISON.wav",
"name": "precision"
},
{
"id": 45,
"soundfile": "WEAKNESS.wav",
"name": "weakness"
},
{
"id": 46,
"soundfile": "TUFFSKIN.wav",
"name": "stone skin"
},
{
"id": 47,
"soundfile": "DISRUPTR.wav",
"name": "disrupting ray"
},
{
"id": 48,
"soundfile": "PRAYER.wav",
"name": "prayer"
},
{
"id": 49,
"soundfile": "MIRTH.wav",
"name": "mirth"
},
{
"id": 50,
"soundfile": "SORROW.wav",
"name": "sorrow"
},
{
"id": 51,
"soundfile": "FORTUNE.wav",
"name": "fortune"
},
{
"id": 52,
"soundfile": "MISFORT.wav",
"name": "misfortune"
},
{
"id": 53,
"soundfile": "HASTE.wav",
"name": "haste"
},
{
"id": 54,
"soundfile": "MUCKMIRE.wav",
"name": "slow"
},
{
"id": 55,
"soundfile": "SLAYER.wav",
"name": "slayer"
},
{
"id": 56,
"soundfile": "FRENZY.wav",
"name": "frenzy"
},
{
"id": 61,
"soundfile": "FORGET.wav",
"name": "forgetfulness"
},
{
"id": 70,
"soundfile": "PARALYZE.wav",
"name": "stone gaze - not sure"
},
{
"id": 71,
"soundfile": "POISON.wav",
"name": "poison"
},
{
"id": 72,
"soundfile": "BIND.wav",
"name": " bind"
},
{
"id": 73,
"soundfile": "DISEASE.wav",
"name": ""
},
{
"id": 74,
"soundfile": "PARALYZE.wav",
"name": ""
},
{
"id": 75,
"soundfile": "AGE.wav",
"name": "aging - already used (?)"
},
{
"id": 6,
"soundfile": "DEATHCLD.wav",
"name": "death cloud"
},
{
"id": 77,
"soundfile": "LIGHTBLT.wav",
"name": "thunder"
},
{
"id": 78,
"soundfile": "DISPELL.wav",
"name": "dispell helpful spells"
},
{
"id": 79,
"soundfile": "DEATHSTR.wav",
"name": "Death Stare"
},
{
"id": 80,
"soundfile": "ACID.wav",
"name": " Acid breath / defence piercing"
}
]
}
// Missing:
// 18 # implosion
// 22 # inferno
// 25 # destroy undead
// BLIND.wav
// CURE.wav
// HYPNOTIZ.wav
// DEATHBLO.wav
// DRAINLIF.wav
// DRGNSLAY.wav
// DISGUISE.wav
// QUIKSAND.wav
// FIRESHIE.wav fireshield when cast
// FIRESHLD.wav fireshield effect
// ANIMDEAD.wav
// ANTIMAGK.wav

View File

@ -1,65 +0,0 @@
# Sounds associated with spells
# Format is <spell number> <sound file name>
15 MAGICBLT.wav # magic arrow
16 ICERAY.wav # ice bolt
17 LIGHTBLT.wav # lightning bolt
#18 # implosion
20 FROSTING.wav # frost ring
21 FIREBALL.wav # fireball
#22 # inferno
23 METEOR.wav # meteor shower
24 DEATHRIP.wav # death ripple
#25 # destroy undead
26 ARMGEDN.wav # armageddon
27 SHIELD.wav # shield
28 AIRSHELD.wav # air shield
30 PROTECTA.wav # protection from air
31 PROTECTF.wav # protection from fire
32 PROTECTW.wav # protection from water
33 PROTECTE.wav # protection from earth
35 DISPELL.wav # dispell
41 BLESS.wav # bless
42 CURSE.wav # curse
43 BLOODLUS.wav # bloodlust
44 PRECISON.wav # precision
45 WEAKNESS.wav # weakness
46 TUFFSKIN.wav # stone skin
47 DISRUPTR.wav # disrupting ray
48 PRAYER.wav # prayer
49 MIRTH.wav # mirth
50 SORROW.wav # sorrow
51 FORTUNE.wav # fortune
52 MISFORT.wav # misfortune
53 HASTE.wav # haste
54 MUCKMIRE.wav # slow
55 SLAYER.wav # slayer
56 FRENZY.wav # frenzy
61 FORGET.wav # forgetfulness
70 PARALYZE.wav # stone gaze - not sure
71 POISON.wav # poison
72 BIND.wav # bind
73 DISEASE.wav #
74 PARALYZE.wav #
75 AGE.wav # aging - already used (?)
76 DEATHCLD.wav # death cloud
77 LIGHTBLT.wav # thunder
78 DISPELL.wav # dispell helpful spells
79 DEATHSTR.wav # Death Stare
80 ACID.wav # Acid breath / defence piercing
#BLIND.wav
#CURE.wav
#HYPNOTIZ.wav
#DEATHBLO.wav
#DRAINLIF.wav
#DRGNSLAY.wav
#DISGUISE.wav
#QUIKSAND.wav
#FIRESHIE.wav fireshield when cast
#FIRESHLD.wav fireshield effect
#ANIMDEAD.wav
#ANTIMAGK.wav