MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / LoadDecalDescriptionFromXML

Function LoadDecalDescriptionFromXML

Source/Game/EntityDescription.cpp:761–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761void LoadDecalDescriptionFromXML(EntityDescription& desc, const TiXmlElement* el) {
762 desc.AddEntityType(EDF_ENTITY_TYPE, _decal_object);
763 const char* ename = el->Attribute("name");
764 if (ename) {
765 desc.AddString(EDF_NAME, ename);
766 }
767
768 std::string type_file = SanitizePath(el->Attribute("type_file"));
769 desc.AddString(EDF_FILE_PATH, type_file);
770
771 vec3 projected_dir;
772 double dval;
773 char name[4];
774 for (int i = 0; i < 3; i++) {
775 name[0] = 'p';
776 name[1] = '0' + i;
777 name[2] = '\0';
778 if (el->QueryDoubleAttribute(name, &dval) == TIXML_SUCCESS)
779 projected_dir[i] = (float)dval;
780 else
781 projected_dir[i] = 0;
782 }
783 desc.AddVec3(EDF_DIRECTION, projected_dir);
784
785 ColorTintComponent::LoadDescriptionFromXML(desc, el);
786
787 int display_mode = 0;
788 int pmode;
789 if (el->QueryIntAttribute("p_mode", &pmode) == TIXML_SUCCESS) {
790 display_mode = pmode;
791 }
792 desc.AddInt(EDF_DISPLAY_MODE, display_mode);
793
794 GetTSRIinfo(desc, el);
795
796 // load object miss list
797 std::vector<int> miss_list;
798 int miss_list_val;
799 std::string curr_num;
800 while (1) {
801 std::stringstream num;
802 curr_num = num.str();
803 if (el->QueryIntAttribute(("o" + curr_num).c_str(), &miss_list_val) == TIXML_SUCCESS) {
804 miss_list.push_back(miss_list_val);
805 } else
806 break;
807 }
808
809 desc.AddIntVec(EDF_DECAL_MISS_LIST, miss_list);
810
811 int isolation_id = -1;
812 int isolation_state = 0;
813 if (el->QueryIntAttribute("i", &isolation_state) == TIXML_SUCCESS) {
814 if (isolation_state) {
815 int read_isolation_id;
816 if (el->QueryIntAttribute("io", &read_isolation_id) == TIXML_SUCCESS) {
817 isolation_id = read_isolation_id;
818 }

Callers 1

Calls 13

SanitizePathFunction · 0.85
GetTSRIinfoFunction · 0.85
AddEntityTypeMethod · 0.80
QueryDoubleAttributeMethod · 0.80
AddVec3Method · 0.80
QueryIntAttributeMethod · 0.80
AddIntMethod · 0.80
AddIntVecMethod · 0.80
AttributeMethod · 0.45
AddStringMethod · 0.45
strMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected