Changeset 25320
- Timestamp:
- Apr 26, 2021, 4:57:13 PM (3 years ago)
- Location:
- ps/trunk/source/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/graphics/ObjectBase.cpp
r25308 r25320 78 78 } 79 79 80 voidCObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)80 CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root) 81 81 { 82 82 // Define all the elements used in the XML file … … 134 134 continue; 135 135 136 LoadVariant(XeroFile, variant, currentGroup.emplace_back()); 136 if (!LoadVariant(XeroFile, variant, currentGroup.emplace_back())) 137 return false; 137 138 } 138 139 139 140 if (currentGroup.size() == 0) 141 140 142 LOGERROR("Actor group has zero variants ('%s')", m_Identifier); 143 144 141 145 } 142 146 else if (child_name == el_castshadow) … … 150 154 if (m_Material.empty()) 151 155 m_Material = VfsPath("art/materials/default.xml"); 152 } 153 154 void CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& variant, Variant& currentVariant) 156 157 return true; 158 } 159 160 bool CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& variant, Variant& currentVariant) 155 161 { 156 162 #define EL(x) int el_##x = XeroFile.GetElementID(#x) … … 191 197 { 192 198 LOGERROR("Invalid variant format (unrecognised root element '%s')", XeroFile.GetElementString(variant.GetNodeName()).c_str()); 193 return ;199 return; 194 200 } 195 201 … … 206 212 { 207 213 XMBElement variantRoot = XeroVariant.GetRoot(); 208 LoadVariant(XeroVariant, variantRoot, currentVariant); 214 if (!LoadVariant(XeroVariant, variantRoot, currentVariant)) 215 return false; 209 216 } 210 217 else 218 211 219 LOGERROR("Could not open path %s", attr.Value); 220 221 212 222 // Continue loading extra definitions in this variant to allow nested files 213 223 } … … 234 244 XERO_ITER_EL(option, textures_element) 235 245 { 236 ENSURE(textures_element.GetNodeName() == el_texture); 246 if (textures_element.GetNodeName() != el_texture) 247 { 248 LOGERROR("<textures> can only contain <texture> elements."); 249 return false; 250 } 237 251 238 252 Samp samp; … … 276 290 XERO_ITER_EL(option, anim_element) 277 291 { 278 ENSURE(anim_element.GetNodeName() == el_animation); 292 if (anim_element.GetNodeName() != el_animation) 293 { 294 LOGERROR("<animations> can only contain <animations> elements."); 295 return false; 296 } 279 297 280 298 Anim anim; … … 325 343 } 326 344 } 345 327 346 } 328 347 … … 812 831 { 813 832 std::unique_ptr<CObjectBase> base = std::make_unique<CObjectBase>(m_ObjectManager, *this, MAX_QUALITY); 814 base->Load(XeroFile, root); 833 if (!base->Load(XeroFile, root)) 834 { 835 LOGERROR("Invalid actor (actor '%s')", pathname.string8()); 836 return false; 837 } 815 838 m_ObjectBases.emplace_back(std::move(base)); 816 839 } … … 877 900 return false; 878 901 } 879 base->Load(XeroFile, inlineActor); 902 if (!base->Load(XeroFile, inlineActor)) 903 { 904 LOGERROR("Invalid inline actor (actor '%s')", pathname.string8()); 905 return false; 906 } 907 880 908 } 881 909 else if (file.empty()) 882 base->Load(XeroFile, actor); 910 { 911 if (!base->Load(XeroFile, actor)) 912 { 913 LOGERROR("Invalid actor (actor '%s')", pathname.string8()); 914 return false; 915 } 916 } 883 917 else 884 918 { … … 897 931 return false; 898 932 } 899 base->Load(XeroActor, root); 933 if (!base->Load(XeroActor, root)) 934 { 935 LOGERROR("Invalid actor (actor '%s' loaded from '%s')", file, pathname.string8()); 936 return false; 937 } 900 938 } 901 939 else -
ps/trunk/source/graphics/ObjectBase.h
r25308 r25320 196 196 void GetQualitySplits(std::vector<u8>& splits) const; 197 197 198 voidLoad(const CXeromyces& XeroFile, const XMBElement& base);199 voidLoadVariant(const CXeromyces& XeroFile, const XMBElement& variant, Variant& currentVariant);198 Load(const CXeromyces& XeroFile, const XMBElement& base); 199 LoadVariant(const CXeromyces& XeroFile, const XMBElement& variant, Variant& currentVariant); 200 200 201 201 private:
Note:
See TracChangeset
for help on using the changeset viewer.