#include "pch.h" #include "MapInfo.h" #include "GameInstance.h" #include "InfoInstance.h" #include "BuildingContainer.h" #include "StreetContainer.h" #include "MAPPartObject.h" #include "MapObject_Render.h" #include "MapObject_Collision.h" #include "MapElement_Light.h" #include "MapElement_Interactable.h" #include "MapElement_Lake.h" #include "MapElement_Door.h" #include "MapElement_Chest.h" #include "MapElement_Static.h" #include "WorldDecal.h" #include "PointLight.h" #include "InstancedProp_Light.h" #include "Layer.h" #include "EffectParts.h" #include "RandomNpc.h" #include "MapElement_Cave.h" #include "ReparoObject.h" #include "Goblin.h" #include "Goblin_Mage.h" #include "Goblin_Assassin.h" CMapInfo::CMapInfo() { } void CMapInfo::Update(_float fTimeDelta) { #ifdef _DEBUG Describe_Entity(); #endif // _DEBUG /*static _bool s_bConverted = { false }; static _bool s_bReadyToCreate = { false }; if (true != s_bConverted || true != s_bReadyToCreate) { CLayer* pLayer = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_BACKGROUND); if (nullptr == pLayer) { return; } const list* pObjects = pLayer->Get_Objects(); if (false == s_bReadyToCreate) { s_bReadyToCreate = true; list::const_iterator iter = pObjects->begin(); for (; iter != pObjects->end(); ++iter) { CMapContainer* pContainer = dynamic_cast(*iter); if (nullptr != pContainer) { pContainer->ReadyForPhysX(); } } } else if (false == s_bConverted) { s_bConverted = true; list::const_iterator iter = pObjects->begin(); for (; iter != pObjects->end(); ++iter) { CMapContainer* pContainer = dynamic_cast(*iter); if (nullptr != pContainer) { pContainer->ConvertToPhysX(); } } } }*/ } void CMapInfo::Change_Level() { } HRESULT CMapInfo::Load_MapObjects(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Land"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } /* Container */ for (auto* Container = root->FirstChildElement("Container"); Container; Container = Container->NextSiblingElement("Container")) { _bool hasCollisionMesh = false; const _char* pName = {}; _uint iMapContainerType = {}; Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType); Container->FirstChildElement("MapContainerType")->QueryUnsignedAttribute("type", &iMapContainerType); CMapContainer* pContainerObject = nullptr; if (0 == iMapContainerType) { Load_BuildingContainer(Container, &pContainerObject, pLayerTag); } else if (1 == iMapContainerType) { Load_StreetContainer(Container, &pContainerObject, pLayerTag); } else if (2 == iMapContainerType) { hasCollisionMesh = true; Load_BuildingContainer(Container, &pContainerObject, pLayerTag); } else { return E_FAIL; } if (FAILED(Load_MapRenderObjects(Container, pContainerObject, pLayerTag, hasCollisionMesh))){ return E_FAIL; } if (FAILED(Load_MapCollisionObjects(Container, pContainerObject, pLayerTag))){ return E_FAIL; } } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement::MAPELEMENT_DESC Desc = {}; MAPOBJECT_TYPE eType = {}; Desc.bVisible = true; Object->QueryUnsignedAttribute("Type", (_uint*)(&eType)); Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } if (MAPOBJECT_TYPE::ELEMENT_STATIC == eType) m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc); else if (MAPOBJECT_TYPE::ELEMENT_COLLIDER == eType) { Desc.bVisible = false; m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc); } else if (MAPOBJECT_TYPE::ELEMENT_CAVE == eType) { m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc); } /*else if (MAPOBJECT_TYPE::ELEMENT_INTERACT == eType) m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interact"), &Desc);*/ } return S_OK; } HRESULT CMapInfo::Load_MapRenderObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject, const _wchar* pLayerTag, _bool hasCollisionMesh) { #pragma region ADD_PARTOBJECT for (auto* PartObject = Container->FirstChildElement("PartObject"); PartObject; PartObject = PartObject->NextSiblingElement("PartObject")) { _uint iLodLevel = {}; _uint iKeyIndex = {}; PartObject->QueryUnsignedAttribute("Lod_Level", &iLodLevel); PartObject->QueryUnsignedAttribute("Key_Index", &iKeyIndex); #pragma region MAPOBJECT_RENDER CMapPartObject::MAPOBJECT_DESC Desc = {}; string strTag = {}; for (auto* PrototypeTag = PartObject->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } Desc.hasCollisionMesh = hasCollisionMesh; Desc.iMaxLodLevel = iLodLevel; Desc.pParentTransform = pContainerObject->Get_Component(); const string strKey = CMyTools::ToString(Desc.ModelPrototypeTags.front()) + to_string(iKeyIndex); /* Position */ tinyxml2::XMLElement* Position = PartObject->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); /* Scale */ tinyxml2::XMLElement* Scale = PartObject->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); /* Rotation */ tinyxml2::XMLElement* Rotation = PartObject->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); if (FAILED(pContainerObject->Add_Part(strKey, g_iStaticLevel, nullptr, &Desc))){ return E_FAIL; } #pragma endregion } return S_OK; } HRESULT CMapInfo::Load_LightElements(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Light/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement_Light::MAPELEMENT_LIGHT_DESC Desc = {}; /* Model Prototypes */ Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); /* Light Desc */ auto* Diffuse = Object->FirstChildElement("Diffuse"); Diffuse->QueryFloatAttribute("x", &Desc.vDiffuse.x); Diffuse->QueryFloatAttribute("y", &Desc.vDiffuse.y); Diffuse->QueryFloatAttribute("z", &Desc.vDiffuse.z); auto* Ambient = Object->FirstChildElement("Ambient"); Ambient->QueryFloatAttribute("x", &Desc.vAmbient.x); Ambient->QueryFloatAttribute("y", &Desc.vAmbient.y); Ambient->QueryFloatAttribute("z", &Desc.vAmbient.z); auto* Specular = Object->FirstChildElement("Specular"); Specular->QueryFloatAttribute("x", &Desc.vSpecular.x); Specular->QueryFloatAttribute("y", &Desc.vSpecular.y); Specular->QueryFloatAttribute("z", &Desc.vSpecular.z); auto* PosOffset = Object->FirstChildElement("PosOffset"); PosOffset->QueryFloatAttribute("x", &Desc.vPosOffset.x); PosOffset->QueryFloatAttribute("y", &Desc.vPosOffset.y); PosOffset->QueryFloatAttribute("z", &Desc.vPosOffset.z); auto* Info = Object->FirstChildElement("Info"); Info->QueryUnsignedAttribute("GlassIndex", &Desc.iGlassMeshIndex); Info->QueryFloatAttribute("BloomStrength", &Desc.fBloomStregth); Info->QueryFloatAttribute("Range", &Desc.fRange); _uint iPow = {}; Info->QueryUnsignedAttribute("Pow", &iPow); Desc.isPow = 0 == iPow ? false : true; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_InteractableElements(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Interactable/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Element_Interactable"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement_Interactable::ELEMENT_INTERACTABLE_DESC Desc = {}; /* Model Prototypes */ Desc.isPooled = false; Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); Object->QueryUnsignedAttribute("ID", &Desc.iInteractableID); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } //MSG_BOX("Successed to Create Interactalbe Element"); return S_OK; } HRESULT CMapInfo::Load_WaterElemet(const _char* pFileName) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Water/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapObjects_Water"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement_Lake::MAPOBJECT_LAKE_DESC Desc = {}; /* Model Prototypes */ Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } for (auto* PrototypeTag = Object->FirstChildElement("ShollowPrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("ShollowPrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ShallowModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); auto* Radius = Object->FirstChildElement("Radius"); Radius->QueryFloatAttribute("value", &Desc.fRadius); auto* TimeSpeed = Object->FirstChildElement("TimeSpeed"); TimeSpeed->QueryFloatAttribute("value", &Desc.fTimeSpeed); auto* RefractionStrength = Object->FirstChildElement("RefractionStrength"); RefractionStrength->QueryFloatAttribute("value", &Desc.fRefractionStrength); auto* RefractionPow = Object->FirstChildElement("RefractionPow"); RefractionPow->QueryFloatAttribute("value", &Desc.fRefractionPow); auto* UVValue1 = Object->FirstChildElement("UVValue1"); UVValue1->QueryFloatAttribute("value", &Desc.fUVValue1); auto* UVValue2 = Object->FirstChildElement("UVValue2"); UVValue2->QueryFloatAttribute("value", &Desc.fUVValue2); auto* UVValue3 = Object->FirstChildElement("UVValue3"); UVValue3->QueryFloatAttribute("value", &Desc.fUVValue3); // float2 값들 auto* UVSpeed = Object->FirstChildElement("UVSpeed"); UVSpeed->QueryFloatAttribute("x", &Desc.vUVSpeed.x); UVSpeed->QueryFloatAttribute("y", &Desc.vUVSpeed.y); auto* LargeUVSpeed = Object->FirstChildElement("LargeUVSpeed"); LargeUVSpeed->QueryFloatAttribute("x", &Desc.vLargeUVSpeed.x); LargeUVSpeed->QueryFloatAttribute("y", &Desc.vLargeUVSpeed.y); auto* SubUVSpeed3 = Object->FirstChildElement("SubUVSpeed3"); SubUVSpeed3->QueryFloatAttribute("x", &Desc.vSubUVSpeed3.x); SubUVSpeed3->QueryFloatAttribute("y", &Desc.vSubUVSpeed3.y); // float4 값들 auto* RefractionColor = Object->FirstChildElement("RefractionColor"); RefractionColor->QueryFloatAttribute("x", &Desc.vRefractionColor.x); RefractionColor->QueryFloatAttribute("y", &Desc.vRefractionColor.y); RefractionColor->QueryFloatAttribute("z", &Desc.vRefractionColor.z); RefractionColor->QueryFloatAttribute("w", &Desc.vRefractionColor.w); auto* SurfaceColor = Object->FirstChildElement("SurfaceColor"); SurfaceColor->QueryFloatAttribute("x", &Desc.vSurfaceColor.x); SurfaceColor->QueryFloatAttribute("y", &Desc.vSurfaceColor.y); SurfaceColor->QueryFloatAttribute("z", &Desc.vSurfaceColor.z); SurfaceColor->QueryFloatAttribute("w", &Desc.vSurfaceColor.w); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Lake"), &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_DoorElemet(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Door/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Doors"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement_Door::ELEMENT_DOOR_DESC Desc = {}; /* Model Prototypes */ Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); //auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); //HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); //HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); //HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); //auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); //LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); //LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); //LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_ChestElemet(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Hiden/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Chests"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMapElement_Chest::ELEMENT_CHEST_DESC Desc = {}; /* Model Prototypes */ Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX); string strTag = {}; for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); } /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo"); HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x); HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y); HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z); auto* LocalTranslation = Object->FirstChildElement("LocalTranslation"); LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x); LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y); LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z); auto* RimLight = Object->FirstChildElement("RimLight"); RimLight->QueryFloatAttribute("pow", &Desc.fRimLightPow); RimLight->QueryFloatAttribute("strength", &Desc.fRimLightStrength); RimLight->QueryFloatAttribute("colorR", &Desc.vRimLightColor.x); RimLight->QueryFloatAttribute("colorG", &Desc.vRimLightColor.y); RimLight->QueryFloatAttribute("colorB", &Desc.vRimLightColor.z); RimLight->QueryFloatAttribute("colorA", &Desc.vRimLightColor.w); auto* Lid = Object->FirstChildElement("Lid"); Lid->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel_Lid); for (auto* PrototypeTag = Lid->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { strTag = PrototypeTag->GetText(); Desc.ModelPrototypeTags_Lid.push_back(CMyTools::ToWstring(strTag)); } auto* LidPosition = Lid->FirstChildElement("Position"); LidPosition->QueryFloatAttribute("x", &Desc.vLid_Offset.x); LidPosition->QueryFloatAttribute("y", &Desc.vLid_Offset.y); LidPosition->QueryFloatAttribute("z", &Desc.vLid_Offset.z); auto* RotationAngle = Lid->FirstChildElement("RotationAngle"); RotationAngle->QueryFloatAttribute("RotationAngle", &Desc.fRotaitionAngle); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_HIDDEN, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_WorldDecal(const _char* pFileName, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Decal/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Decal"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CWorldDecal::WORLD_DECAL_DESC Desc = {}; /* Transform */ auto* Rotation = Object->FirstChildElement("Scale"); Rotation->QueryFloatAttribute("x", &Desc.vScale.x); Rotation->QueryFloatAttribute("y", &Desc.vScale.y); Rotation->QueryFloatAttribute("z", &Desc.vScale.z); auto* Scale = Object->FirstChildElement("Rotation"); Scale->QueryFloatAttribute("x", &Desc.vRotation.x); Scale->QueryFloatAttribute("y", &Desc.vRotation.y); Scale->QueryFloatAttribute("z", &Desc.vRotation.z); auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); /* Decal Desc */ auto* Shader_Value = Object->FirstChildElement("Shader_Value"); Shader_Value->QueryFloatAttribute("UVTiling", &Desc.fUVTiling); Shader_Value->QueryFloatAttribute("UVSpeedX", &Desc.vUVSpeed.x); Shader_Value->QueryFloatAttribute("UVSpeedY", &Desc.vUVSpeed.y); /* MaskRed */ auto* MaskRed = Object->FirstChildElement("MaskRed"); MaskRed->QueryFloatAttribute("r", &Desc.vMaskRed.x); MaskRed->QueryFloatAttribute("g", &Desc.vMaskRed.y); MaskRed->QueryFloatAttribute("b", &Desc.vMaskRed.z); MaskRed->QueryFloatAttribute("a", &Desc.vMaskRed.w); /* MaskGreen */ auto* MaskGreen = Object->FirstChildElement("MaskGreen"); MaskGreen->QueryFloatAttribute("r", &Desc.vMaskGreen.x); MaskGreen->QueryFloatAttribute("g", &Desc.vMaskGreen.y); MaskGreen->QueryFloatAttribute("b", &Desc.vMaskGreen.z); MaskGreen->QueryFloatAttribute("a", &Desc.vMaskGreen.w); /* MaskBlue */ auto* MaskBlue = Object->FirstChildElement("MaskBlue"); MaskBlue->QueryFloatAttribute("r", &Desc.vMaskBlue.x); MaskBlue->QueryFloatAttribute("g", &Desc.vMaskBlue.y); MaskBlue->QueryFloatAttribute("b", &Desc.vMaskBlue.z); MaskBlue->QueryFloatAttribute("a", &Desc.vMaskBlue.w); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(NEXT_LEVEL, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_PointLights(const _char* pFilePath, const _wchar* pLayerTag) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Light/" + string(pFilePath) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CPointLight::POINTLIGHT_DESC Desc = {}; /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); /* Light Desc */ auto* Diffuse = Object->FirstChildElement("Diffuse"); Diffuse->QueryFloatAttribute("x", &Desc.vDiffuse.x); Diffuse->QueryFloatAttribute("y", &Desc.vDiffuse.y); Diffuse->QueryFloatAttribute("z", &Desc.vDiffuse.z); auto* Ambient = Object->FirstChildElement("Ambient"); Ambient->QueryFloatAttribute("x", &Desc.vAmbient.x); Ambient->QueryFloatAttribute("y", &Desc.vAmbient.y); Ambient->QueryFloatAttribute("z", &Desc.vAmbient.z); auto* Specular = Object->FirstChildElement("Specular"); Specular->QueryFloatAttribute("x", &Desc.vSpecular.x); Specular->QueryFloatAttribute("y", &Desc.vSpecular.y); Specular->QueryFloatAttribute("z", &Desc.vSpecular.z); auto* PosOffset = Object->FirstChildElement("PosOffset"); PosOffset->QueryFloatAttribute("x", &Desc.vPosOffset.x); PosOffset->QueryFloatAttribute("y", &Desc.vPosOffset.y); PosOffset->QueryFloatAttribute("z", &Desc.vPosOffset.z); auto* Info = Object->FirstChildElement("Info"); Info->QueryFloatAttribute("LightAttRange", &Desc.fLightAttRange); Info->QueryFloatAttribute("LightAttSpeed", &Desc.fLightAttSpeed); Info->QueryFloatAttribute("Range", &Desc.fRange); _uint iPow = {}; Info->QueryUnsignedAttribute("Pow", &iPow); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(NEXT_LEVEL, NEXT_LEVEL, pLayerTag, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_EffectParts(const _char* pFileName, const _char* pEffectrFilePath) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/EffectPart/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("EffectParts"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } CPartObject::PARTOBJECT_DESC PartsDesc{}; PartsDesc.pParentTransform = nullptr; for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { _float3 vScale = {}; _float3 vRotation = {}; _float3 vPosition = {}; /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &vPosition.x); Position->QueryFloatAttribute("y", &vPosition.y); Position->QueryFloatAttribute("z", &vPosition.z); auto* Scale = Object->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &vScale.x); Scale->QueryFloatAttribute("y", &vScale.y); Scale->QueryFloatAttribute("z", &vScale.z); auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &vRotation.x); Rotation->QueryFloatAttribute("y", &vRotation.y); Rotation->QueryFloatAttribute("z", &vRotation.z); CEffectParts* pEffect = { nullptr }; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_BACKGROUND, &PartsDesc, nullptr, &pEffect))) return E_FAIL; if (nullptr == pEffect) return E_FAIL; CTransform* pTransformCom = pEffect->Get_Component(); pTransformCom->Set_Scale(vScale); pTransformCom->Rotation(XMConvertToRadians(vRotation.x), XMConvertToRadians(vRotation.y), XMConvertToRadians(vRotation.z)); pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&vPosition), 1.f)); pEffect->Load(pEffectrFilePath, static_cast(g_iStaticLevel)); pEffect->Set_Visible(true); } return S_OK; } HRESULT CMapInfo::Load_ReparoObjects(const _char* pFileName) { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Reparo/" + string(pFileName) + ".xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Reparo"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CReparoObject::REPARO_OBJECT_DESC Desc = {}; Object->QueryUnsignedAttribute("Type", &Desc.iModelID); Object->QueryFloatAttribute("Radius", &Desc.fRadius); /* Transform */ auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_REPARO, &Desc))) return E_FAIL; } return S_OK; } HRESULT CMapInfo::Load_DADA_INT() { if (FAILED(Load_MapObjects("DATA_INT_Data", LAYER_DADA_INT))) return E_FAIL; if (FAILED(Load_PointLights("DATA_INT_PointLight_Data", LAYER_DADA_INT))) return E_FAIL; CInstancedProp_Light::INSTANCE_PROP_LIGHT_DESC LightDesc = {}; /* LightFixture_Base_D */ LightDesc.isShake = false; LightDesc.bEnableRigidbody = false; LightDesc.iGlassMeshIndex = 1; LightDesc.vRadius = _float2(0.f, 0.f); LightDesc.vSpeed = _float2(0.f, 0.f); LightDesc.strPrototypeTag = L"Prototype_Component_VIBuffer_Model_Instancel_LightFixture_Base_D"; LightDesc.strInstanceDataPath = "../Bin/Resources/Data/Map/Instance/SM_HW_LightFixture_Base_D.bin"; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_DADA_INT, &LightDesc))) return E_FAIL; return S_OK; } HRESULT CMapInfo::Load_Npc() { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/NPC/DummyNPC_Data.xml"; if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("NPC"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return S_OK; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CRandomNpc::NPCDESC NPCDesc{}; Object->QueryIntAttribute("Index", &NPCDesc.iIndex); /* Transform */ auto* Position = Object->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &NPCDesc.vPos.x); Position->QueryFloatAttribute("y", &NPCDesc.vPos.y); Position->QueryFloatAttribute("z", &NPCDesc.vPos.z); NPCDesc.vPos.w = 1.f; auto* Rotation = Object->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &NPCDesc.vRotQ.x); Rotation->QueryFloatAttribute("y", &NPCDesc.vRotQ.y); Rotation->QueryFloatAttribute("z", &NPCDesc.vRotQ.z); NPCDesc.vRotQ.w = 1.f; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_NPC, &NPCDesc))) { return E_FAIL; } } return S_OK; } HRESULT CMapInfo::Load_Goblin() { tinyxml2::XMLDocument xmlDoc; string strPath = "../Bin/Resources/Data/Map/Monster/Goblin_Data.xml"; if (tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())) return E_FAIL; tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("GOBLIN"); if (nullptr == root) { MSG_BOX("Failed to Find root"); return E_FAIL; } for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) { CMonster::MONSTERDESC MonsterDesc{}; const char* pName = Object->Attribute("Name"); if (nullptr == pName) continue; string strName = pName; if (auto* Rotation = Object->FirstChildElement("RotQ")) { Rotation->QueryFloatAttribute("X", &MonsterDesc.vRotQ.x); Rotation->QueryFloatAttribute("Y", &MonsterDesc.vRotQ.y); Rotation->QueryFloatAttribute("Z", &MonsterDesc.vRotQ.z); MonsterDesc.vRotQ.w = 1.f; } if (auto* Position = Object->FirstChildElement("Trans")) { Position->QueryFloatAttribute("X", &MonsterDesc.vPos.x); Position->QueryFloatAttribute("Y", &MonsterDesc.vPos.y); Position->QueryFloatAttribute("Z", &MonsterDesc.vPos.z); MonsterDesc.vPos.w = 1.f; } if (strName == "Goblin_Mage") { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer( g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &MonsterDesc))) return E_FAIL; } else if (strName == "Goblin_Assassin") { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer( g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &MonsterDesc))) return E_FAIL; } else if (strName == "Goblin") { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer( g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &MonsterDesc))) return E_FAIL; } } return S_OK; } HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { m_pGameInstance = CGameInstance::GetInstance(); m_pInfoInstance = CInfoInstance::GetInstance(); m_pDevice = pDevice; m_pContext = pContex; SAFE_ADDREF(m_pGameInstance); SAFE_ADDREF(m_pInfoInstance); SAFE_ADDREF(m_pDevice); SAFE_ADDREF(m_pContext); return S_OK; } HRESULT CMapInfo::Load_BuildingContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject, const _wchar* pLayerTag) { CBuildingContainer::MAP_CONTAINER_DESC ContainerDesc = {}; auto* ContainerPosition = Container->FirstChildElement("Position"); ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); auto* ContainerScale = Container->FirstChildElement("Scale"); ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); auto* ContainerRotation = Container->FirstChildElement("Rotation"); ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); auto* BoundingBox_Min = Container->FirstChildElement("BoundingBox_Min"); BoundingBox_Min->QueryFloatAttribute("x", &ContainerDesc.vContainerMin.x); BoundingBox_Min->QueryFloatAttribute("y", &ContainerDesc.vContainerMin.y); BoundingBox_Min->QueryFloatAttribute("z", &ContainerDesc.vContainerMin.z); auto* BoundingBox_Max = Container->FirstChildElement("BoundingBox_Max"); BoundingBox_Max->QueryFloatAttribute("x", &ContainerDesc.vContainerMax.x); BoundingBox_Max->QueryFloatAttribute("y", &ContainerDesc.vContainerMax.y); BoundingBox_Max->QueryFloatAttribute("z", &ContainerDesc.vContainerMax.z); m_pGameInstance->Add_GameObject_ToLayer( g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), pLayerTag, &ContainerDesc, nullptr, reinterpret_cast(ppContainerObject)); return S_OK; } HRESULT CMapInfo::Load_StreetContainer(tinyxml2::XMLElement* Container, CMapContainer** ppContainerObject, const _wchar* pLayerTag) { CMapContainer::MAP_CONTAINER_DESC ContainerDesc = {}; auto* ContainerPosition = Container->FirstChildElement("Position"); ContainerPosition->QueryFloatAttribute("x", &ContainerDesc.vPosition.x); ContainerPosition->QueryFloatAttribute("y", &ContainerDesc.vPosition.y); ContainerPosition->QueryFloatAttribute("z", &ContainerDesc.vPosition.z); auto* ContainerScale = Container->FirstChildElement("Scale"); ContainerScale->QueryFloatAttribute("x", &ContainerDesc.vScale.x); ContainerScale->QueryFloatAttribute("y", &ContainerDesc.vScale.y); ContainerScale->QueryFloatAttribute("z", &ContainerDesc.vScale.z); auto* ContainerRotation = Container->FirstChildElement("Rotation"); ContainerRotation->QueryFloatAttribute("x", &ContainerDesc.vRotation.x); ContainerRotation->QueryFloatAttribute("y", &ContainerDesc.vRotation.y); ContainerRotation->QueryFloatAttribute("z", &ContainerDesc.vRotation.z); m_pGameInstance->Add_GameObject_ToLayer( g_iStaticLevel, ENUM_CLASS(LEVEL::GAMEPLAY), pLayerTag, &ContainerDesc, nullptr, reinterpret_cast(ppContainerObject)); return S_OK; } HRESULT CMapInfo::Load_MapCollisionObjects(tinyxml2::XMLElement* Container, CMapContainer* pContainerObject, const _wchar* pLayerTag) { #pragma region ADD_COLLISION for (auto* Collision = Container->FirstChildElement("Collision"); Collision; Collision = Collision->NextSiblingElement("Collision")) { _uint iLodLevel = {}; _uint iKeyIndex = {}; Collision->QueryUnsignedAttribute("Lod_Level", &iLodLevel); Collision->QueryUnsignedAttribute("Key_Index", &iKeyIndex); #pragma region MAPOBJECT_LOD CMapPartObject::MAPOBJECT_DESC Desc = {}; string strTag = {}; for (auto* PrototypeTag = Collision->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) { Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(PrototypeTag->GetText())); } Desc.iMaxLodLevel = iLodLevel; Desc.pParentTransform = pContainerObject->Get_Component(); /* Position */ tinyxml2::XMLElement* Position = Collision->FirstChildElement("Position"); Position->QueryFloatAttribute("x", &Desc.vPosition.x); Position->QueryFloatAttribute("y", &Desc.vPosition.y); Position->QueryFloatAttribute("z", &Desc.vPosition.z); /* Scale */ tinyxml2::XMLElement* Scale = Collision->FirstChildElement("Scale"); Scale->QueryFloatAttribute("x", &Desc.vScale.x); Scale->QueryFloatAttribute("y", &Desc.vScale.y); Scale->QueryFloatAttribute("z", &Desc.vScale.z); /* Rotation */ tinyxml2::XMLElement* Rotation = Collision->FirstChildElement("Rotation"); Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); pContainerObject->Add_Collision(g_iStaticLevel, &Desc); #pragma endregion } #pragma endregion return S_OK; } CMapInfo* CMapInfo::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) { CMapInfo* pInstance = new CMapInfo(); if (FAILED(pInstance->Initialize(pDevice, pContex))) { SAFE_RELEASE(pInstance); } return pInstance; } void CMapInfo::Free() { __super::Free(); SAFE_RELEASE(m_pGameInstance); SAFE_RELEASE(m_pInfoInstance); SAFE_RELEASE(m_pDevice); SAFE_RELEASE(m_pContext); } #ifdef _DEBUG void CMapInfo::Describe_Entity() { GUI::Begin("CLIENT_SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG); if (GUI::CollapsingHeader("MapInfoDesc")) { CLayer* pLayer = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_BACKGROUND); if (nullptr == pLayer) { return; } static _bool s_bConverted = { false }; static _bool s_bReadyToCreate = { false }; const list* pObjects = pLayer->Get_Objects(); GUI::SetNextItemWidth(80.f); GUI::BeginChild("CollisonPartObjects"); if (false == s_bReadyToCreate) { if (GUI::Button("Ready_StaticMeshesForPhyX_ALL")) { s_bReadyToCreate = true; list::const_iterator iter = pObjects->begin(); for (; iter != pObjects->end(); ++iter) { CMapContainer* pContainer = dynamic_cast(*iter); if (nullptr != pContainer) { pContainer->ReadyForPhysX(); } } } } else if (false == s_bConverted) { if (GUI::Button("Convert_StaticMeshesForPhyX_ALL")) { s_bConverted = true; list::const_iterator iter = pObjects->begin(); for (; iter != pObjects->end(); ++iter) { CMapContainer* pContainer = dynamic_cast(*iter); if (nullptr != pContainer) { pContainer->ConvertToPhysX(); } } } } GUI::EndChild(); } GUI::End(); } #endif // _DEBUG