From 84aafd27dad40f4033561052164c21fe68cf78ad Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 11 Jul 2007 12:58:11 +0000 Subject: Weapon sprites are now (almost) threated like other equipment sprites through the equipment sprite database. (use -u to ignore updates) --- src/resources/equipmentdb.cpp | 46 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'src/resources/equipmentdb.cpp') diff --git a/src/resources/equipmentdb.cpp b/src/resources/equipmentdb.cpp index 64982ce3..9b963720 100644 --- a/src/resources/equipmentdb.cpp +++ b/src/resources/equipmentdb.cpp @@ -81,26 +81,46 @@ EquipmentDB::load() EquipmentInfo *currentInfo = new EquipmentInfo(); currentInfo->setSlot (XML::getProperty(equipmentNode, "slot", 0)); + currentInfo->setAttackType (XML::getProperty(equipmentNode, "attacktype", "")); - //iterate s + //iterate s and s for_each_xml_child_node(spriteNode, equipmentNode) { - if (!xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) + if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) { - continue; + std::string gender = XML::getProperty(spriteNode, "gender", "unisex"); + std::string filename = (const char*) spriteNode->xmlChildrenNode->content; + + if (gender == "male" || gender == "unisex") + { + currentInfo->setSprite(filename, 0); + } + + if (gender == "female" || gender == "unisex") + { + currentInfo->setSprite(filename, 1); + } } - std::string gender = XML::getProperty(spriteNode, "gender", "unisex"); - std::string filename = (const char*) spriteNode->xmlChildrenNode->content; - - if (gender == "male" || gender == "unisex") - { - currentInfo->setSprite(filename, 0); - } - - if (gender == "female" || gender == "unisex") + if (xmlStrEqual(spriteNode->name, BAD_CAST "sound")) { - currentInfo->setSprite(filename, 1); + std::string event = XML::getProperty(spriteNode, "event", ""); + const char *filename; + filename = (const char*) spriteNode->xmlChildrenNode->content; + + if (event == "hit") + { + currentInfo->addSound(EQUIP_EVENT_HIT, filename); + } + else if (event == "strike") + { + currentInfo->addSound(EQUIP_EVENT_STRIKE, filename); + } + else + { + logger->log("EquipmentDB: Warning, sound effect %s for unknown event %s", + filename, event.c_str()); + } } } -- cgit v1.2.3-70-g09d2