From 20737337619f8c608a508e0e18e3aabcef97dade Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 26 Mar 2005 00:22:42 +0000 Subject: [PATCH] Fixed support for extra-new actor format. Updated binaries. This was SVN commit r2050. --- .../mods/official/art/actors/test_dude.xml | 430 +++++++----------- .../official/entities/units/test_dude.xml | 2 +- source/graphics/ObjectBase.cpp | 60 +-- source/graphics/ObjectEntry.cpp | 4 +- 4 files changed, 193 insertions(+), 303 deletions(-) diff --git a/binaries/data/mods/official/art/actors/test_dude.xml b/binaries/data/mods/official/art/actors/test_dude.xml index 275b668186..69e8f7daff 100644 --- a/binaries/data/mods/official/art/actors/test_dude.xml +++ b/binaries/data/mods/official/art/actors/test_dude.xml @@ -1,272 +1,158 @@ - - - true - - - - Base - 100 - art/meshes/skeletal/m_dress_a.pmd - art/materials/player_trans.xml - art/textures/skins/skeletal/plac_rome_e.dds - - - Idle - art/animation/biped/dudeidle.psa - 200 - - - Walk - art/animation/biped/dudewalk_swordshield.psa - 700 - - - Build - art/animation/biped/dudebuild.psa - 150 - - - Chop - art/animation/biped/dudechop.psa - 150 - - - Death - art/animation/biped/dudedeath_sword.psa - 200 - - - Decay - art/animation/biped/dudedecay_sword.psa - 100 - - - Attack - art/animation/biped/dudeattack.psa - 300 - - - Attack1 - art/animation/biped/dudeattack1.psa - 300 - - - - - - - - - Helmet - - - helmet - Elite Helmet - - - - - None - - - - - - Head - 50 - - - head - Dude Head - - - - - None - 1 - - - - - - - - l_hand - Axe B - - - - - None - - - - - - - - l_forearm - Left Glove - - - - - None - - - - - - - - l_shoulder - Left Shoulder - - - - - None - - - - - - - - r_hand - Axe A - - - - - None - - - - - - - - r_forearm - Right Glove - - - - - None - - - - - - - - r_shoulder - Right Shoulder - - - - - None - - - - - - - - chest - Breastplate - - - - - None - - - - - - - - back - Quiver - - - - - None - - - - - - - - shoulders - Cape - - - - - None - - - - - - - - l_leg - Left Boot - - - - - None - - - - - - - - r_leg - Right Boot - - - - - None - - - - - - - - l_hip - Left Sheath - - - - - None - - - - - - - - r_hip - Right Sheath - - - - - None - - - - + + + + + + + + + + + + + + + + + + skeletal/m_dress_a.pmd + skeletal/plac_rome_e.dds + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binaries/data/mods/official/entities/units/test_dude.xml b/binaries/data/mods/official/entities/units/test_dude.xml index 4f031458f9..291374933c 100644 --- a/binaries/data/mods/official/entities/units/test_dude.xml +++ b/binaries/data/mods/official/entities/units/test_dude.xml @@ -1,6 +1,6 @@ - test_dude + test_dude.xml diff --git a/source/graphics/ObjectBase.cpp b/source/graphics/ObjectBase.cpp index be1edc175a..ce7d640be0 100644 --- a/source/graphics/ObjectBase.cpp +++ b/source/graphics/ObjectBase.cpp @@ -140,22 +140,24 @@ bool CObjectBase::Load(const char* filename) // Define all the elements used in the XML file #define EL(x) int el_##x = XeroFile.getElementID(#x) + #define AT(x) int at_##x = XeroFile.getAttributeID(#x) EL(castshadow); EL(material); EL(group); EL(variant); EL(animations); EL(animation); - EL(file); - EL(name); - EL(speed); EL(props); EL(prop); - EL(attachpoint); - EL(model); - EL(frequency); EL(mesh); EL(texture); + AT(file); + AT(name); + AT(speed); + AT(attachpoint); + AT(actor); + AT(frequency); + #undef AT #undef EL // (This code is rather worryingly verbose...) @@ -172,21 +174,25 @@ bool CObjectBase::Load(const char* filename) { m_Variants.back().resize(m_Variants.back().size()+1); + XERO_ITER_ATTR(variant, attr) + { + if (attr.Name == at_name) + m_Variants.back().back().m_VariantName = attr.Value; + + else if (attr.Name == at_frequency) + m_Variants.back().back().m_Frequency = CStr(attr.Value).ToInt(); + } + + XERO_ITER_EL(variant, option) { int option_name = option.getNodeName(); - if (option_name == el_name) - m_Variants.back().back().m_VariantName = option.getText(); - - else if (option_name == el_frequency) - m_Variants.back().back().m_Frequency = CStr(option.getText()).ToInt(); - - else if (option_name == el_mesh) + if (option_name == el_mesh) m_Variants.back().back().m_ModelFilename = "art/meshes/" + CStr(option.getText()); else if (option_name == el_texture) - m_Variants.back().back().m_TextureFilename = "art/textures/" + CStr(option.getText()); + m_Variants.back().back().m_TextureFilename = "art/textures/skins/" + CStr(option.getText()); else if (option_name == el_animations) { @@ -194,16 +200,15 @@ bool CObjectBase::Load(const char* filename) { Anim anim; - XERO_ITER_EL(anim_element, ae) + XERO_ITER_ATTR(anim_element, ae) { - int ae_name = ae.getNodeName(); - if (ae_name == el_name) - anim.m_AnimName = ae.getText(); - else if (ae_name == el_file) - anim.m_FileName = "art/animation/" + CStr(ae.getText()); - else if (ae_name == el_speed) + if (ae.Name == at_name) + anim.m_AnimName = ae.Value; + else if (ae.Name == at_file) + anim.m_FileName = "art/animation/" + CStr(ae.Value); + else if (ae.Name == at_speed) { - anim.m_Speed = CStr(ae.getText()).ToInt() / 100.f; + anim.m_Speed = CStr(ae.Value).ToInt() / 100.f; if (anim.m_Speed <= 0.0) anim.m_Speed = 1.0f; } else @@ -219,13 +224,12 @@ bool CObjectBase::Load(const char* filename) { Prop prop; - XERO_ITER_EL(prop_element, pe) + XERO_ITER_ATTR(prop_element, pe) { - int pe_name = pe.getNodeName(); - if (pe_name == el_attachpoint) - prop.m_PropPointName = pe.getText(); - else if (pe_name == el_model) - prop.m_ModelName = pe.getText(); + if (pe.Name == at_attachpoint) + prop.m_PropPointName = pe.Value; + else if (pe.Name == at_actor) + prop.m_ModelName = pe.Value; else ; // unrecognised element } diff --git a/source/graphics/ObjectEntry.cpp b/source/graphics/ObjectEntry.cpp index 2c4c324077..56235d834c 100755 --- a/source/graphics/ObjectEntry.cpp +++ b/source/graphics/ObjectEntry.cpp @@ -124,11 +124,11 @@ bool CObjectEntry::BuildModel() m_Model->AddProp(proppoint,propmodel); if (oe->m_WalkAnim) propmodel->SetAnimation(oe->m_WalkAnim); } else { - LOG(ERROR, LOG_CATEGORY, "Failed to build prop model \"%s\" on actor \"%s\"",(const char*) m_Base->m_Name,(const char*) prop.m_ModelName); + LOG(ERROR, LOG_CATEGORY, "Failed to build prop model \"%s\" on actor \"%s\"", (const char*)prop.m_ModelName, (const char*)m_Base->m_Name); } } } else { - LOG(ERROR, LOG_CATEGORY, "Failed to matching prop point called \"%s\" in model \"%s\"", (const char*)prop.m_PropPointName, modelfilename); + LOG(ERROR, LOG_CATEGORY, "Failed to find matching prop point called \"%s\" in model \"%s\" on actor \"%s\"", (const char*)prop.m_PropPointName, modelfilename, (const char*)prop.m_ModelName); } }