From 11a5ebe38a83383970425baf53d4595ae56efe70 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Feb 2010 22:24:25 +0000 Subject: looped sound support for fx_sound model tags --- src/model/mapfile.cc | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/model') 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 -- cgit v1.2.3