1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Moved creature sounds to CCreature. Sound IDs are now stored as strings.

Creature parser is complete (untested).
This commit is contained in:
DjWarmonger
2012-09-17 19:00:26 +00:00
parent 061ed69c63
commit 9438cfc7e2
5 changed files with 153 additions and 81 deletions

View File

@ -165,21 +165,20 @@ CCreature * CModHandler::loadCreature (const JsonNode &node)
//we need to know creature id to add it
VLC->creh->idToProjectile[cre->idNumber] = value->String();
//TODO: sounds
//how to pass info to Client?
auto sounds = node["sound"];
//CreaturesBattleSounds cbs;
//cbs.attack = sounds["attack"].String();
//cbs.defend = sounds["defend"].String();
//cbs.killed = sounds["killed"].String(); // was killed or died
//cbs.move = sounds["move"].String();
//cbs.shoot = sounds["shoot"].String(); // range attack
//cbs.wince = sounds["wince"].String(); // attacked but did not die
//cbs.ext1 = ""; // creature specific extension
//cbs.ext2 = ""; // creature specific extension
//cbs.startMoving = sounds["moveStart"].String(); // usually same as ext1
//cbs.endMoving = sounds["moveEnd"].String(); // usually same as ext2
//CCS->soundh->CBattleSounds.push_back(cbs);
#define GET_SOUND_VALUE(value_name) do { value = &node[#value_name]; if (!value->isNull()) cre->sounds.value_name = sounds[#value_name].String(); } while(0)
GET_SOUND_VALUE(attack);
GET_SOUND_VALUE(defend);
GET_SOUND_VALUE(killed);
GET_SOUND_VALUE(move);
GET_SOUND_VALUE(shoot);
GET_SOUND_VALUE(wince);
GET_SOUND_VALUE(ext1);
GET_SOUND_VALUE(ext2);
GET_SOUND_VALUE(startMoving);
GET_SOUND_VALUE(endMoving);
#undef GET_SOUND_VALUE
creatures.push_back(cre);
return cre;