diff options
author | Stijn Buys <ingar@osirion.org> | 2010-02-25 22:24:25 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-02-25 22:24:25 +0000 |
commit | 11a5ebe38a83383970425baf53d4595ae56efe70 (patch) | |
tree | 99c59f3cd07c829122c2673563a8e32388aefdd5 /src/model | |
parent | 90fbc4c5caf5afd54920894319448b74967399ba (diff) |
looped sound support for fx_sound model tags
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/mapfile.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index aa0cb37..6bac44e 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1274,12 +1274,37 @@ Model * MapFile::load(std::string const &name) // sound attributes if (mapfile.got_key_vector3f("origin", location)) { - tag_sound->get_location().assign(location * SCALE); + tag_sound->get_location().assign(location * SCALE); continue; - } else { + + } else if (mapfile.got_key_string("name", str)) { + // remove sounds/ prefix + if (str.substr(0, 7).compare("sounds/") == 0) + str.erase(0, 7); + // remove extension + if (str[str.size()-4] == '.') { + str.erase(str.size() - 4); + } + tag_sound->set_name(str); + continue; + + } else if (mapfile.got_key_string("noise", str)) { + // remove sounds/ prefix + if (str.substr(0, 7).compare("sounds/") == 0) + str.erase(0, 7); + // remove extension + if (str[str.size()-4] == '.') { + str.erase(str.size() - 4); + } + tag_sound->set_name(str); + continue; + + } else if (mapfile.got_key()) { mapfile.unknown_key(); + } + } else if (mapfile.got_classname("misc_model")) { // new submodel tag @@ -1316,8 +1341,13 @@ Model * MapFile::load(std::string const &name) } else { tag_submodel->set_scale(1.0f); } + + } else if (mapfile.got_key()) { + mapfile.unknown_key(); + } + } else if (mapfile.got_classname("location_dock")) { // new docking location |