diff --git a/audit/history.jsonl b/audit/history.jsonl index cebccfe1..a6c8203e 100644 --- a/audit/history.jsonl +++ b/audit/history.jsonl @@ -536,3 +536,4 @@ {"time": "2026-09-24T09:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-d: PythonTextTail + textTail module", "ported": ["UserInterface/PythonTextTail.cpp", "UserInterface/PythonTextTailModule.cpp"], "adapted": ["EterLib/GrpScreen.cpp:CScreen::ProjectPosition", "EterLib/GrpScreen.cpp:CScreen::UnprojectPosition", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetString", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetStringz"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: ground item name tail registered, ALT frame projects it, CPythonTextTail::Pick returns the item VID, deleted on pickup", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["PythonMiniMap", "CEffectManager", "CPythonSkill"]} {"time": "2026-09-24T10:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-e: PythonMiniMap + miniMap module", "ported": ["UserInterface/PythonMiniMap.cpp", "UserInterface/PythonMiniMapModule.cpp", "PRTerrainLib/StdAfx.cpp"], "adapted": [], "divergent": ["GameLib/MapManager.cpp:CMapManager::IsMapOutdoor (false until CMapOutdoor is ported)"], "needs_live": [], "tests": ["port.login_flow: miniMap.isShow() after uiminimap, GetAtlasSize() not loaded", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["CMapOutdoor (minimap terrain textures, atlas)", "CEffectManager", "CPythonSkill"]} {"time": "2026-09-24T12:00:00Z", "event": "port_round", "unit": "batch 3-a: CPythonSkill + skill module + EterBase/Poly", "ported": ["UserInterface/PythonSkill.cpp", "EterBase/Poly/Base.cpp", "EterBase/Poly/Poly.cpp", "EterBase/Poly/SymTable.cpp", "EterBase/Poly/Symbol.cpp"], "adapted": ["PythonSkill.cpp: icon handle functions (Py_BuildPointer), skillGetGradeData (varargs struct)", "PythonItemModule.cpp: itemGetIconInstance/itemDeleteIconInstance (Py_BuildPointer)"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: skill 1 name/type/cooltime after LoadLocaleData; grade icon + icon instance in game", "port.login_live 192.168.21.203 passes", "ctest 19/19, python_game_render_test PASS", "port_map check 0 errors"], "todo": ["EffectLib", "CMapOutdoor", "default route switch"]} +{"time": "2026-09-24T14:00:00Z", "event": "port_round", "unit": "batch 3-b: EffectLib + EterBase/Utils platform bodies", "ported": ["EffectLib/*.cpp (17 units, 251 functions)"], "adapted": ["EffectLib/Type.h: comment line-splice fix", "EterBase/Utils.cpp (platform): 23 functions, 40250 bodies with POSIX swaps", "ScriptLib/Resource.cpp (platform): mde/mdatr resource types"], "divergent": [], "needs_live": [], "tests": ["port.utils: path/split/argv helpers", "port.login_flow: level_up.mse CreateEffect -> alpha-blended levelup_1 particle draws"]} diff --git a/audit/port-map/EffectLib/EffectData.cpp.json b/audit/port-map/EffectLib/EffectData.cpp.json new file mode 100644 index 00000000..de9960d7 --- /dev/null +++ b/audit/port-map/EffectLib/EffectData.cpp.json @@ -0,0 +1,152 @@ +{ + "reference": "EffectLib/EffectData.cpp", + "reference_sha256": "ff079844f94f62aae45ce755fe0676ededeb0a554ad847d425bda57cd1f27fc1", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectData::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::New" + ] + }, + "CEffectData::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::Delete" + ] + }, + "CEffectData::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::DestroySystem" + ] + }, + "CEffectData::LoadScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::LoadScript" + ] + }, + "CEffectData::LoadSoundScriptData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::LoadSoundScriptData" + ] + }, + "CEffectData::AllocParticle": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::AllocParticle" + ] + }, + "CEffectData::AllocMesh": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::AllocMesh" + ] + }, + "CEffectData::AllocLight": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::AllocLight" + ] + }, + "CEffectData::GetLightCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetLightCount" + ] + }, + "CEffectData::GetLightPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetLightPointer" + ] + }, + "CEffectData::GetParticleCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetParticleCount" + ] + }, + "CEffectData::GetParticlePointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetParticlePointer" + ] + }, + "CEffectData::GetMeshCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetMeshCount" + ] + }, + "CEffectData::GetMeshPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetMeshPointer" + ] + }, + "CEffectData::GetSoundInstanceVector": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetSoundInstanceVector" + ] + }, + "CEffectData::GetBoundingSphereRadius": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetBoundingSphereRadius" + ] + }, + "CEffectData::GetBoundingSpherePosition": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetBoundingSpherePosition" + ] + }, + "CEffectData::GetFileName": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::GetFileName" + ] + }, + "CEffectData::__ClearParticleDataVector": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::__ClearParticleDataVector" + ] + }, + "CEffectData::__ClearLightDataVector": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::__ClearLightDataVector" + ] + }, + "CEffectData::__ClearMeshDataVector": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::__ClearMeshDataVector" + ] + }, + "CEffectData::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::Clear" + ] + }, + "CEffectData::CEffectData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::CEffectData" + ] + }, + "CEffectData::~CEffectData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectData.cpp:CEffectData::~CEffectData" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectElementBase.cpp.json b/audit/port-map/EffectLib/EffectElementBase.cpp.json new file mode 100644 index 00000000..330777d7 --- /dev/null +++ b/audit/port-map/EffectLib/EffectElementBase.cpp.json @@ -0,0 +1,50 @@ +{ + "reference": "EffectLib/EffectElementBase.cpp", + "reference_sha256": "0922c49a1342a17ba88e51536c1c25468cf2ba5d41afde98a9809f5554c1cd87", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectElementBase::GetPosition": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::GetPosition" + ] + }, + "CEffectElementBase::isData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::isData" + ] + }, + "CEffectElementBase::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::Clear" + ] + }, + "CEffectElementBase::LoadScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::LoadScript" + ] + }, + "CEffectElementBase::GetStartTime": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::GetStartTime" + ] + }, + "CEffectElementBase::CEffectElementBase": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::CEffectElementBase" + ] + }, + "CEffectElementBase::~CEffectElementBase": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBase.cpp:CEffectElementBase::~CEffectElementBase" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectElementBaseInstance.cpp.json b/audit/port-map/EffectLib/EffectElementBaseInstance.cpp.json new file mode 100644 index 00000000..1d9b486e --- /dev/null +++ b/audit/port-map/EffectLib/EffectElementBaseInstance.cpp.json @@ -0,0 +1,74 @@ +{ + "reference": "EffectLib/EffectElementBaseInstance.cpp", + "reference_sha256": "4968fbccbb32d67c6c9eba745c5f9041ed312e4da9ef2e097e989255e0552998", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectElementBaseInstance::Update": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::Update" + ] + }, + "CEffectElementBaseInstance::Render": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::Render" + ] + }, + "CEffectElementBaseInstance::SetLocalMatrixPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::SetLocalMatrixPointer" + ] + }, + "CEffectElementBaseInstance::SetDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::SetDataPointer" + ] + }, + "CEffectElementBaseInstance::isActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::isActive" + ] + }, + "CEffectElementBaseInstance::SetActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::SetActive" + ] + }, + "CEffectElementBaseInstance::SetDeactive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::SetDeactive" + ] + }, + "CEffectElementBaseInstance::Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::Initialize" + ] + }, + "CEffectElementBaseInstance::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::Destroy" + ] + }, + "CEffectElementBaseInstance::CEffectElementBaseInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::CEffectElementBaseInstance" + ] + }, + "CEffectElementBaseInstance::~CEffectElementBaseInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectElementBaseInstance.cpp:CEffectElementBaseInstance::~CEffectElementBaseInstance" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectInstance.cpp.json b/audit/port-map/EffectLib/EffectInstance.cpp.json new file mode 100644 index 00000000..a6b054ef --- /dev/null +++ b/audit/port-map/EffectLib/EffectInstance.cpp.json @@ -0,0 +1,140 @@ +{ + "reference": "EffectLib/EffectInstance.cpp", + "reference_sha256": "e75a8a927168b34e55dfd11896895c53e153816f32cc951b25b59d407e125011", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectInstance::LessRenderOrder": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::LessRenderOrder" + ] + }, + "CEffectInstance::ResetRenderingEffectCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::ResetRenderingEffectCount" + ] + }, + "CEffectInstance::GetRenderingEffectCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::GetRenderingEffectCount" + ] + }, + "CEffectInstance::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::New" + ] + }, + "CEffectInstance::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::Delete" + ] + }, + "CEffectInstance::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::DestroySystem" + ] + }, + "CEffectInstance::UpdateSound": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::UpdateSound" + ] + }, + "CEffectInstance::OnUpdate": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::OnUpdate" + ] + }, + "CEffectInstance::OnRender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::OnRender" + ] + }, + "CEffectInstance::SetGlobalMatrix": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::SetGlobalMatrix" + ] + }, + "CEffectInstance::isAlive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::isAlive" + ] + }, + "CEffectInstance::SetActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::SetActive" + ] + }, + "CEffectInstance::SetDeactive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::SetDeactive" + ] + }, + "CEffectInstance::__SetParticleData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::__SetParticleData" + ] + }, + "CEffectInstance::__SetMeshData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::__SetMeshData" + ] + }, + "CEffectInstance::__SetLightData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::__SetLightData" + ] + }, + "CEffectInstance::SetEffectDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::SetEffectDataPointer" + ] + }, + "CEffectInstance::GetBoundingSphere": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::GetBoundingSphere" + ] + }, + "CEffectInstance::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::Clear" + ] + }, + "CEffectInstance::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::__Initialize" + ] + }, + "CEffectInstance::CEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::CEffectInstance" + ] + }, + "CEffectInstance::~CEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectInstance.cpp:CEffectInstance::~CEffectInstance" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectManager.cpp.json b/audit/port-map/EffectLib/EffectManager.cpp.json new file mode 100644 index 00000000..b16feb05 --- /dev/null +++ b/audit/port-map/EffectLib/EffectManager.cpp.json @@ -0,0 +1,194 @@ +{ + "reference": "EffectLib/EffectManager.cpp", + "reference_sha256": "07619941261d6e3b57aa71b17b470b3ef2aed0c906b2ff6f86549c607fc8e8d9", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectManager::GetInfo": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::GetInfo" + ] + }, + "CEffectManager::UpdateSound": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::UpdateSound" + ] + }, + "CEffectManager::IsAliveEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::IsAliveEffect" + ] + }, + "CEffectManager::Update": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::Update" + ] + }, + "CEffectManager::Render": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::Render" + ] + }, + "CEffectManager::RegisterEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::RegisterEffect" + ] + }, + "CEffectManager::RegisterEffect2": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::RegisterEffect2" + ] + }, + "CEffectManager::CreateEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::CreateEffect" + ] + }, + "CEffectManager::CreateEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::CreateEffectInstance" + ] + }, + "CEffectManager::DestroyEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::DestroyEffectInstance" + ] + }, + "CEffectManager::DeactiveEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::DeactiveEffectInstance" + ] + }, + "CEffectManager::CreateUnsafeEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::CreateUnsafeEffectInstance" + ] + }, + "CEffectManager::DestroyUnsafeEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::DestroyUnsafeEffectInstance" + ] + }, + "CEffectManager::SelectEffectInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::SelectEffectInstance" + ] + }, + "CEffectManager::SetEffectTextures": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::SetEffectTextures" + ] + }, + "CEffectManager::SetEffectInstancePosition": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::SetEffectInstancePosition" + ] + }, + "CEffectManager::SetEffectInstanceRotation": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::SetEffectInstanceRotation" + ] + }, + "CEffectManager::SetEffectInstanceGlobalMatrix": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::SetEffectInstanceGlobalMatrix" + ] + }, + "CEffectManager::ShowEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::ShowEffect" + ] + }, + "CEffectManager::HideEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::HideEffect" + ] + }, + "CEffectManager::GetEffectData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::GetEffectData" + ] + }, + "CEffectManager::GetRandomEffect": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::GetRandomEffect" + ] + }, + "CEffectManager::GetEmptyIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::GetEmptyIndex" + ] + }, + "CEffectManager::DeleteAllInstances": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::DeleteAllInstances" + ] + }, + "CEffectManager::__DestroyEffectInstanceMap": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::__DestroyEffectInstanceMap" + ] + }, + "CEffectManager::__DestroyEffectCacheMap": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::__DestroyEffectCacheMap" + ] + }, + "CEffectManager::__DestroyEffectDataMap": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::__DestroyEffectDataMap" + ] + }, + "CEffectManager::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::Destroy" + ] + }, + "CEffectManager::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::__Initialize" + ] + }, + "CEffectManager::CEffectManager": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::CEffectManager" + ] + }, + "CEffectManager::~CEffectManager": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectManager.cpp:CEffectManager::~CEffectManager" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectMesh.cpp.json b/audit/port-map/EffectLib/EffectMesh.cpp.json new file mode 100644 index 00000000..39e08d4e --- /dev/null +++ b/audit/port-map/EffectLib/EffectMesh.cpp.json @@ -0,0 +1,278 @@ +{ + "reference": "EffectLib/EffectMesh.cpp", + "reference_sha256": "a2818c93abbf2ea649738d7a9b76c8c491c9fef281d5e9e6c4c983fc56b094b5", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectMesh::SEffectMeshData::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::SEffectMeshData::New" + ] + }, + "CEffectMesh::SEffectMeshData::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::SEffectMeshData::Delete" + ] + }, + "CEffectMesh::SEffectMeshData::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::SEffectMeshData::DestroySystem" + ] + }, + "CEffectMesh::GetFrameCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetFrameCount" + ] + }, + "CEffectMesh::GetMeshCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetMeshCount" + ] + }, + "CEffectMesh::GetMeshDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetMeshDataPointer" + ] + }, + "CEffectMesh::GetTextureVectorPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetTextureVectorPointer" + ] + }, + "CEffectMesh::GetTextureVectorReference": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetTextureVectorReference" + ] + }, + "CEffectMesh::Type": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::Type" + ] + }, + "CEffectMesh::OnIsType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::OnIsType" + ] + }, + "CEffectMesh::OnLoad": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::OnLoad" + ] + }, + "CEffectMesh::__LoadData_Ver002": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::__LoadData_Ver002" + ] + }, + "CEffectMesh::__LoadData_Ver001": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::__LoadData_Ver001" + ] + }, + "CEffectMesh::GetMeshElementPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::GetMeshElementPointer" + ] + }, + "CEffectMesh::OnClear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::OnClear" + ] + }, + "CEffectMesh::OnIsEmpty": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::OnIsEmpty" + ] + }, + "CEffectMesh::CEffectMesh": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::CEffectMesh" + ] + }, + "CEffectMesh::~CEffectMesh": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMesh::~CEffectMesh" + ] + }, + "CEffectMeshScript::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::DestroySystem" + ] + }, + "CEffectMeshScript::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::New" + ] + }, + "CEffectMeshScript::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::Delete" + ] + }, + "CEffectMeshScript::ReserveMeshData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::ReserveMeshData" + ] + }, + "CEffectMeshScript::GetMeshFileName": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetMeshFileName" + ] + }, + "CEffectMeshScript::CheckMeshIndex": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::CheckMeshIndex" + ] + }, + "CEffectMeshScript::GetMeshDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetMeshDataPointer" + ] + }, + "CEffectMeshScript::GetMeshDataCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetMeshDataCount" + ] + }, + "CEffectMeshScript::GetBillboardType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetBillboardType" + ] + }, + "CEffectMeshScript::isBlendingEnable": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::isBlendingEnable" + ] + }, + "CEffectMeshScript::GetBlendingSrcType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetBlendingSrcType" + ] + }, + "CEffectMeshScript::GetBlendingDestType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetBlendingDestType" + ] + }, + "CEffectMeshScript::isTextureAlphaEnable": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::isTextureAlphaEnable" + ] + }, + "CEffectMeshScript::GetColorOperationType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetColorOperationType" + ] + }, + "CEffectMeshScript::GetColorFactor": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetColorFactor" + ] + }, + "CEffectMeshScript::GetTimeTableAlphaPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetTimeTableAlphaPointer" + ] + }, + "CEffectMeshScript::isMeshAnimationLoop": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::isMeshAnimationLoop" + ] + }, + "CEffectMeshScript::GetMeshAnimationLoopCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetMeshAnimationLoopCount" + ] + }, + "CEffectMeshScript::GetMeshAnimationFrameDelay": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetMeshAnimationFrameDelay" + ] + }, + "CEffectMeshScript::isTextureAnimationLoop": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::isTextureAnimationLoop" + ] + }, + "CEffectMeshScript::GetTextureAnimationFrameDelay": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetTextureAnimationFrameDelay" + ] + }, + "CEffectMeshScript::GetTextureAnimationStartFrame": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::GetTextureAnimationStartFrame" + ] + }, + "CEffectMeshScript::OnLoadScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::OnLoadScript" + ] + }, + "CEffectMeshScript::OnIsData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::OnIsData" + ] + }, + "CEffectMeshScript::OnClear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::OnClear" + ] + }, + "CEffectMeshScript::CEffectMeshScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::CEffectMeshScript" + ] + }, + "CEffectMeshScript::~CEffectMeshScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMesh.cpp:CEffectMeshScript::~CEffectMeshScript" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectMeshInstance.cpp.json b/audit/port-map/EffectLib/EffectMeshInstance.cpp.json new file mode 100644 index 00000000..57be6da3 --- /dev/null +++ b/audit/port-map/EffectLib/EffectMeshInstance.cpp.json @@ -0,0 +1,86 @@ +{ + "reference": "EffectLib/EffectMeshInstance.cpp", + "reference_sha256": "7ba17354c06127ebea369a2dba833692a88aaaaf93ecf1a8432590b7da4bac09", + "priority": "P4", + "contracts": [], + "functions": { + "CEffectMeshInstance::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::DestroySystem" + ] + }, + "CEffectMeshInstance::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::New" + ] + }, + "CEffectMeshInstance::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::Delete" + ] + }, + "CEffectMeshInstance::isActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::isActive" + ] + }, + "CEffectMeshInstance::OnUpdate": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::OnUpdate" + ] + }, + "CEffectMeshInstance::OnRender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::OnRender" + ] + }, + "CEffectMeshInstance::OnSetDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::OnSetDataPointer" + ] + }, + "CEffectMeshInstance_DeleteImageInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance_DeleteImageInstance" + ] + }, + "CEffectMeshInstance_DeleteTextureInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance_DeleteTextureInstance" + ] + }, + "CEffectMeshInstance::OnInitialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::OnInitialize" + ] + }, + "CEffectMeshInstance::OnDestroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::OnDestroy" + ] + }, + "CEffectMeshInstance::CEffectMeshInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::CEffectMeshInstance" + ] + }, + "CEffectMeshInstance::~CEffectMeshInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectMeshInstance.cpp:CEffectMeshInstance::~CEffectMeshInstance" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EffectUpdateDecorator.cpp.json b/audit/port-map/EffectLib/EffectUpdateDecorator.cpp.json new file mode 100644 index 00000000..16d30475 --- /dev/null +++ b/audit/port-map/EffectLib/EffectUpdateDecorator.cpp.json @@ -0,0 +1,44 @@ +{ + "reference": "EffectLib/EffectUpdateDecorator.cpp", + "reference_sha256": "55856ade9fb056fd7404a09ebd0c0688993ffe4a41c23572fdb0a7adc20ad3e5", + "priority": "P4", + "contracts": [], + "functions": { + "CAirResistanceDecorator::__Clone": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CAirResistanceDecorator::__Clone" + ] + }, + "CAirResistanceDecorator::__Excute": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CAirResistanceDecorator::__Excute" + ] + }, + "CGravityDecorator::__Clone": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CGravityDecorator::__Clone" + ] + }, + "CGravityDecorator::__Excute": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CGravityDecorator::__Excute" + ] + }, + "CRotationDecorator::__Clone": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CRotationDecorator::__Clone" + ] + }, + "CRotationDecorator::__Excute": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EffectUpdateDecorator.cpp:CRotationDecorator::__Excute" + ] + } + } +} diff --git a/audit/port-map/EffectLib/EmitterProperty.cpp.json b/audit/port-map/EffectLib/EmitterProperty.cpp.json new file mode 100644 index 00000000..6aabc652 --- /dev/null +++ b/audit/port-map/EffectLib/EmitterProperty.cpp.json @@ -0,0 +1,104 @@ +{ + "reference": "EffectLib/EmitterProperty.cpp", + "reference_sha256": "280a5bf2a7107754b7b959eb7371a1c1247b40ec581890a5c051da24a7a38bfb", + "priority": "P4", + "contracts": [], + "functions": { + "CEmitterProperty::GetEmitterShape": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmitterShape" + ] + }, + "CEmitterProperty::GetEmitterAdvancedType": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmitterAdvancedType" + ] + }, + "CEmitterProperty::isEmitFromEdge": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::isEmitFromEdge" + ] + }, + "CEmitterProperty::GetEmittingSize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingSize" + ] + }, + "CEmitterProperty::GetEmittingAngularVelocity": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingAngularVelocity" + ] + }, + "CEmitterProperty::GetEmittingDirectionX": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingDirectionX" + ] + }, + "CEmitterProperty::GetEmittingDirectionY": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingDirectionY" + ] + }, + "CEmitterProperty::GetEmittingDirectionZ": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingDirectionZ" + ] + }, + "CEmitterProperty::GetEmittingVelocity": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmittingVelocity" + ] + }, + "CEmitterProperty::GetEmissionCountPerSecond": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetEmissionCountPerSecond" + ] + }, + "CEmitterProperty::GetParticleLifeTime": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetParticleLifeTime" + ] + }, + "CEmitterProperty::GetParticleSizeX": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetParticleSizeX" + ] + }, + "CEmitterProperty::GetParticleSizeY": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::GetParticleSizeY" + ] + }, + "CEmitterProperty::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::Clear" + ] + }, + "CEmitterProperty::CEmitterProperty": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::CEmitterProperty" + ] + }, + "CEmitterProperty::~CEmitterProperty": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/EmitterProperty.cpp:CEmitterProperty::~CEmitterProperty" + ] + } + } +} diff --git a/audit/port-map/EffectLib/FrameController.cpp.json b/audit/port-map/EffectLib/FrameController.cpp.json new file mode 100644 index 00000000..f6004556 --- /dev/null +++ b/audit/port-map/EffectLib/FrameController.cpp.json @@ -0,0 +1,86 @@ +{ + "reference": "EffectLib/FrameController.cpp", + "reference_sha256": "3ea6bbd7bf3484ece70fc20d3d2f0f8ceeadbcf79362a87a130f5a9da4100add", + "priority": "P4", + "contracts": [], + "functions": { + "CFrameController::Update": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::Update" + ] + }, + "CFrameController::SetCurrentFrame": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetCurrentFrame" + ] + }, + "CFrameController::GetCurrentFrame": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::GetCurrentFrame" + ] + }, + "CFrameController::SetMaxFrame": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetMaxFrame" + ] + }, + "CFrameController::SetFrameTime": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetFrameTime" + ] + }, + "CFrameController::SetStartFrame": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetStartFrame" + ] + }, + "CFrameController::SetLoopFlag": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetLoopFlag" + ] + }, + "CFrameController::SetLoopCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetLoopCount" + ] + }, + "CFrameController::SetActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::SetActive" + ] + }, + "CFrameController::isActive": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::isActive" + ] + }, + "CFrameController::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::Clear" + ] + }, + "CFrameController::CFrameController": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::CFrameController" + ] + }, + "CFrameController::~CFrameController": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/FrameController.cpp:CFrameController::~CFrameController" + ] + } + } +} diff --git a/audit/port-map/EffectLib/ParticleInstance.cpp.json b/audit/port-map/EffectLib/ParticleInstance.cpp.json new file mode 100644 index 00000000..8803f79b --- /dev/null +++ b/audit/port-map/EffectLib/ParticleInstance.cpp.json @@ -0,0 +1,74 @@ +{ + "reference": "EffectLib/ParticleInstance.cpp", + "reference_sha256": "51e25b1fa4a91925a94e6b360850e6ed4396a3b856399b31dc3feb002c00291d", + "priority": "P4", + "contracts": [], + "functions": { + "CParticleInstance::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::DestroySystem" + ] + }, + "CParticleInstance::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::New" + ] + }, + "CParticleInstance::DeleteThis": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::DeleteThis" + ] + }, + "CParticleInstance::GetRadiusApproximation": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::GetRadiusApproximation" + ] + }, + "CParticleInstance::Update": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::Update" + ] + }, + "CParticleInstance::Transform": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::Transform" + ] + }, + "CParticleInstance::Destroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::Destroy" + ] + }, + "CParticleInstance::__Initialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::__Initialize" + ] + }, + "CParticleInstance::CParticleInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::CParticleInstance" + ] + }, + "CParticleInstance::~CParticleInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::~CParticleInstance" + ] + }, + "CParticleInstance::GetParticleMeshPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleInstance.cpp:CParticleInstance::GetParticleMeshPointer" + ] + } + } +} diff --git a/audit/port-map/EffectLib/ParticleProperty.cpp.json b/audit/port-map/EffectLib/ParticleProperty.cpp.json new file mode 100644 index 00000000..66fd9ac4 --- /dev/null +++ b/audit/port-map/EffectLib/ParticleProperty.cpp.json @@ -0,0 +1,38 @@ +{ + "reference": "EffectLib/ParticleProperty.cpp", + "reference_sha256": "b735cd2ee20aa9010185a7c5cc980c5d6ba7910ada23e093200a63658f0e454c", + "priority": "P4", + "contracts": [], + "functions": { + "CParticleProperty::InsertTexture": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleProperty.cpp:CParticleProperty::InsertTexture" + ] + }, + "CParticleProperty::SetTexture": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleProperty.cpp:CParticleProperty::SetTexture" + ] + }, + "CParticleProperty::Clear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleProperty.cpp:CParticleProperty::Clear" + ] + }, + "CParticleProperty::CParticleProperty": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleProperty.cpp:CParticleProperty::CParticleProperty" + ] + }, + "CParticleProperty::~CParticleProperty": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleProperty.cpp:CParticleProperty::~CParticleProperty" + ] + } + } +} diff --git a/audit/port-map/EffectLib/ParticleSystemData.cpp.json b/audit/port-map/EffectLib/ParticleSystemData.cpp.json new file mode 100644 index 00000000..570a6fc4 --- /dev/null +++ b/audit/port-map/EffectLib/ParticleSystemData.cpp.json @@ -0,0 +1,80 @@ +{ + "reference": "EffectLib/ParticleSystemData.cpp", + "reference_sha256": "2afa539808287dc28ef9dc62113d8f185940fd50cbf9fa10a0237ee3baa0f17c", + "priority": "P4", + "contracts": [], + "functions": { + "CParticleSystemData::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::DestroySystem" + ] + }, + "CParticleSystemData::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::New" + ] + }, + "CParticleSystemData::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::Delete" + ] + }, + "CParticleSystemData::GetEmitterPropertyPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::GetEmitterPropertyPointer" + ] + }, + "CParticleSystemData::GetParticlePropertyPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::GetParticlePropertyPointer" + ] + }, + "CParticleSystemData::OnLoadScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::OnLoadScript" + ] + }, + "CParticleSystemData::ChangeTexture": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::ChangeTexture" + ] + }, + "CParticleSystemData::OnClear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::OnClear" + ] + }, + "CParticleSystemData::OnIsData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::OnIsData" + ] + }, + "CParticleSystemData::BuildDecorator": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::BuildDecorator" + ] + }, + "CParticleSystemData::CParticleSystemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::CParticleSystemData" + ] + }, + "CParticleSystemData::~CParticleSystemData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemData.cpp:CParticleSystemData::~CParticleSystemData" + ] + } + } +} diff --git a/audit/port-map/EffectLib/ParticleSystemInstance.cpp.json b/audit/port-map/EffectLib/ParticleSystemInstance.cpp.json new file mode 100644 index 00000000..99971498 --- /dev/null +++ b/audit/port-map/EffectLib/ParticleSystemInstance.cpp.json @@ -0,0 +1,80 @@ +{ + "reference": "EffectLib/ParticleSystemInstance.cpp", + "reference_sha256": "477bee37308e060425d9e448e1338f02a2420edcfe1d81890aebb5c0d5516bd6", + "priority": "P4", + "contracts": [], + "functions": { + "CParticleSystemInstance::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::DestroySystem" + ] + }, + "CParticleSystemInstance::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::New" + ] + }, + "CParticleSystemInstance::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::Delete" + ] + }, + "CParticleSystemInstance::GetEmissionCount": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::GetEmissionCount" + ] + }, + "CParticleSystemInstance::CreateParticles": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::CreateParticles" + ] + }, + "CParticleSystemInstance::OnUpdate": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnUpdate" + ] + }, + "CParticleSystemInstance::OnRender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnRender" + ] + }, + "CParticleSystemInstance::OnSetDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnSetDataPointer" + ] + }, + "CParticleSystemInstance::OnInitialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnInitialize" + ] + }, + "CParticleSystemInstance::OnDestroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::OnDestroy" + ] + }, + "CParticleSystemInstance::CParticleSystemInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::CParticleSystemInstance" + ] + }, + "CParticleSystemInstance::~CParticleSystemInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/ParticleSystemInstance.cpp:CParticleSystemInstance::~CParticleSystemInstance" + ] + } + } +} diff --git a/audit/port-map/EffectLib/SimpleLightData.cpp.json b/audit/port-map/EffectLib/SimpleLightData.cpp.json new file mode 100644 index 00000000..f602d40b --- /dev/null +++ b/audit/port-map/EffectLib/SimpleLightData.cpp.json @@ -0,0 +1,74 @@ +{ + "reference": "EffectLib/SimpleLightData.cpp", + "reference_sha256": "7d3ffe48488162d42d81a623570a1d856eb1ac5ca0c29a5f9cad315fc0a7b68d", + "priority": "P4", + "contracts": [], + "functions": { + "CLightData::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::DestroySystem" + ] + }, + "CLightData::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::New" + ] + }, + "CLightData::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::Delete" + ] + }, + "CLightData::OnClear": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::OnClear" + ] + }, + "CLightData::GetRange": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::GetRange" + ] + }, + "CLightData::OnIsData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::OnIsData" + ] + }, + "CLightData::OnLoadScript": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::OnLoadScript" + ] + }, + "CLightData::CLightData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::CLightData" + ] + }, + "CLightData::~CLightData": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::~CLightData" + ] + }, + "CLightData::GetDuration": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::GetDuration" + ] + }, + "CLightData::InitializeLight": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightData.cpp:CLightData::InitializeLight" + ] + } + } +} diff --git a/audit/port-map/EffectLib/SimpleLightInstance.cpp.json b/audit/port-map/EffectLib/SimpleLightInstance.cpp.json new file mode 100644 index 00000000..79d828d0 --- /dev/null +++ b/audit/port-map/EffectLib/SimpleLightInstance.cpp.json @@ -0,0 +1,68 @@ +{ + "reference": "EffectLib/SimpleLightInstance.cpp", + "reference_sha256": "ff437ae1d3ae1414f291faefba6f08933d1c01889d5ee8197120b7195b141a92", + "priority": "P4", + "contracts": [], + "functions": { + "CLightInstance::DestroySystem": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::DestroySystem" + ] + }, + "CLightInstance::New": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::New" + ] + }, + "CLightInstance::Delete": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::Delete" + ] + }, + "CLightInstance::OnSetDataPointer": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::OnSetDataPointer" + ] + }, + "CLightInstance::OnUpdate": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::OnUpdate" + ] + }, + "CLightInstance::OnRender": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::OnRender" + ] + }, + "CLightInstance::OnInitialize": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::OnInitialize" + ] + }, + "CLightInstance::OnDestroy": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::OnDestroy" + ] + }, + "CLightInstance::CLightInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::CLightInstance" + ] + }, + "CLightInstance::~CLightInstance": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/SimpleLightInstance.cpp:CLightInstance::~CLightInstance" + ] + } + } +} diff --git a/audit/port-map/EffectLib/Type.cpp.json b/audit/port-map/EffectLib/Type.cpp.json new file mode 100644 index 00000000..84bf51bb --- /dev/null +++ b/audit/port-map/EffectLib/Type.cpp.json @@ -0,0 +1,20 @@ +{ + "reference": "EffectLib/Type.cpp", + "reference_sha256": "ff7be1137826ee9b1a17f694b963c0c3807c115362c0c9af3e1f034267d9c5c6", + "priority": "P4", + "contracts": [], + "functions": { + "GetTokenTimeEventFloat": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/Type.cpp:GetTokenTimeEventFloat" + ] + }, + "InsertItemTimeEventFloat": { + "status": "PORTED", + "impl": [ + "extension/src/port/EffectLib/Type.cpp:InsertItemTimeEventFloat" + ] + } + } +} diff --git a/audit/port-map/EterBase/Utils.cpp.json b/audit/port-map/EterBase/Utils.cpp.json index ed5a8d0e..2cc6998d 100644 --- a/audit/port-map/EterBase/Utils.cpp.json +++ b/audit/port-map/EterBase/Utils.cpp.json @@ -5,91 +5,212 @@ "contracts": [], "functions": { "CreateTempFileName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:CreateTempFileName" + ], + "note": "GetTempPath/GetTempFileName -> $TMPDIR + mkstemp (same unique-file contract).", + "test": "extension/tests/port_utils_test.cpp" }, "GetFilePathNameExtension": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetFilePathNameExtension" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetFileExtension": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetFileExtension" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetFileNameParts": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetFileNameParts" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetOldIndexingName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetOldIndexingName" + ], + "note": "_ecvt(Index,256) truncated at dec -> snprintf %u of |Index| (same digits).", + "test": "extension/tests/port_utils_test.cpp" }, "GetIndexingName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetIndexingName" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetOnlyFileName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetOnlyFileName" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetExceptionPathName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetExceptionPathName" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetOnlyPathName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetOnlyPathName" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetLocalFileName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetLocalFileName" + ], + "note": "40250 body; min -> std::min.", + "test": "extension/tests/port_utils_test.cpp" }, "GetWorkingFolder": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetWorkingFolder" + ], + "note": "_getcwd -> getcwd.", + "test": "extension/tests/port_utils_test.cpp" }, "StringLowers": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:StringLowers" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "StringPath": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:StringPath" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "PrintAsciiData": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:PrintAsciiData" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "fMIN": { "status": "ADAPTED", - "impl": ["extension/src/platform/EterBase/Utils.cpp:fMIN"], + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:fMIN" + ], "note": "Exact 40250 pure float comparison; platform unit retains its OS-specific functions.", "test": "extension/tests/port_utils_test.cpp" }, "fMAX": { "status": "ADAPTED", - "impl": ["extension/src/platform/EterBase/Utils.cpp:fMAX"], + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:fMAX" + ], "note": "Exact 40250 pure float comparison; fixes zero-distance camera when map becomes ready.", "test": "extension/tests/port_utils_test.cpp" }, "fMINMAX": { "status": "ADAPTED", - "impl": ["extension/src/platform/EterBase/Utils.cpp:fMINMAX"], + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:fMINMAX" + ], "note": "Exact 40250 pure float clamp in platform translation unit.", "test": "extension/tests/port_utils_test.cpp" }, "IsFile": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:IsFile" + ], + "note": "_access -> access.", + "test": "extension/tests/port_utils_test.cpp" }, "IsGlobalFileName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:IsGlobalFileName" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "MyCreateDirectory": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:MyCreateDirectory" + ], + "note": "40250 body; CreateDirectory -> mkdir(0755).", + "test": "extension/tests/port_utils_test.cpp" }, "RemoveAllDirectory": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:RemoveAllDirectory" + ], + "note": "CDirRemover (CDir walk + DeleteFile/RemoveDirectory) -> std::filesystem::remove_all.", + "test": "extension/tests/port_utils_test.cpp" }, "StringExceptCharacter": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:StringExceptCharacter" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "SplitLine": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:SplitLine" + ], + "note": "40250 body verbatim in the platform translation unit (PORT-PLAN §3: Utils pure functions copied).", + "test": "extension/tests/port_utils_test.cpp" }, "GetExcutedFileName": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:GetExcutedFileName" + ], + "note": "GetModuleFileName(NULL) has no platform equivalent; returns the working folder.", + "test": "extension/tests/port_utils_test.cpp" }, "_getf": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:_getf" + ], + "note": "_vsnprintf -> vsnprintf.", + "test": "extension/tests/port_utils_test.cpp" }, "CommandLineToArgv": { - "status": "TODO" + "status": "ADAPTED", + "impl": [ + "extension/src/platform/EterBase/Utils.cpp:CommandLineToArgv" + ], + "note": "40250 body; GlobalAlloc -> malloc, BOOLEAN/PUCHAR -> BOOL/unsigned char*.", + "test": "extension/tests/port_utils_test.cpp" } } } diff --git a/docs/PORT-PLAN.md b/docs/PORT-PLAN.md index a833c9ed..3090a2d2 100644 --- a/docs/PORT-PLAN.md +++ b/docs/PORT-PLAN.md @@ -445,6 +445,7 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 P3-e(2026-09-24):`PythonMiniMap.cpp` 与 `PythonMiniMapModule.cpp` 原样移植(无手改),删除 pending 替身与 miniMap 模块桩,`initMiniMap()` 按 40250 顺序在 `initnet()` 之后;`PRTerrainLib/StdAfx.cpp`(`PR_FCNV/PR_ICNV`)原样复制,UserInterface PCH 按 40250 补 `PRTerrainLib/StdAfx.h`,`TerrainType.h` 的 `PR_FLOAT_TO_INTASM` 在非 MSVC 下用 `lrintf`(x87 fistp 默认舍入)代替内联汇编;`D3DXMath.h` 补 `D3DXColorModulate`。缺口:`CMapOutdoor` 未移植(地形由 Godot 适配层绘制),pending `CMapManager::IsMapOutdoor()` 返回 false(记 DIVERGENT),`GetMapOutdoorRef` 与 pending `CMapOutdoor::GetTerrainPointer/GetBaseXY` 只为链接存在、不可达——小地图地形贴图、标记与大地图(atlas)因此走 40250「非室外地图」路径不显示,待 `CMapOutdoor` 移植后自然恢复。`port.login_flow` 验证 uiminimap 创建并显示 miniMap、`GetAtlasSize()` 报未载入。P3 物品链与三个 UI 单元至此完成;下一步候选:`CMapOutdoor`(解锁小地图/大地图)、`CEffectManager`/EffectLib、`CPythonSkill`。 批次 3-a CPythonSkill(2026-09-24):`UserInterface/PythonSkill.cpp`(含 skill 模块)与 `EterBase/Poly/`(技能公式解析器)原样移植,删除 pending 替身与 skill 模块桩,`initskill()` 按 40250 顺序在 `initfly()` 之后,实例按 `m_pySkill` 位置进 PythonBoot 的 `GameSingletons`;平台 `PythonApplication.cpp` 里重复的 `SKILL_EFFECT_UPGRADE_ENABLE` 删掉(40250 定义在 PythonSkill.cpp),`LoadLocaleData` 的 skilldesc/skilltable 现在真正载入。改动:技能图标/图标实例句柄用 `Py_BuildPointer`/`PyTuple_GetPointer`(item 模块的 `GetIconInstance/DeleteIconInstance` 同改),`skillGetGradeData` 把非平凡结构传进 varargs(clang 拒绝),改为显式读同样的前 4 字节(脚本不调用)。`port.login_flow`:选角阶段 skill 1 = Three-Way Cut、ACTIVE、冷却 12;进游戏后主动技能只有分等级图标(`GetIconImage` 为 0,与 40250 相同),`GetIconImageNew/GetIconInstanceNew` 可用;真服同样通过。 + 批次 3-b EffectLib(2026-09-24):`EffectLib/` 18 个 .cpp 原样移植(EffectManager、EffectData/Instance、EffectMesh、粒子系统、SimpleLight 等),删除 `platform/EffectLib` 生成的桩骨架;唯一改动是 `Type.h` 里 `BILLBOARD_TYPE_2FACE` 行尾注释的 `\` 被 clang 当作续行吞掉下一行,去掉反斜杠。`platform/EterBase/Utils.cpp` 剩下的 21 个桩按 §3 照抄 40250 函数体(`GetOnlyPathName`/`IsGlobalFileName` 缺失会让 .msf 以相对名挂的 .mse 丢目录,106 个 RegisterEffect 报错),Win32 调用换成 POSIX 的记 ADAPTED;平台 `CPythonResource` 补上 40250 的 `mde`(CEffectMesh)和 `mdatr`(CAttributeData)资源类型。`port.utils` 覆盖路径/分词/命令行辅助函数;`port.login_flow`:在主角脚下 `CreateEffect(level_up.mse)`,RenderGame 的 `CEffectManager::Render` 录出 levelup_1 贴图的 alpha 混合粒子绘制(dust、dropitem 同样出现)。40250 声明但未定义 `GetRenderingEffectCount`,测试不用。 每个切片都必须同时跑 legacy/port 双路回归;只有 2V3 稳定并把默认路由切到 `port` 后,才能删除总开关和剩余 legacy 宿主。 diff --git a/extension/src/platform/EffectLib/EffectData.cpp b/extension/src/platform/EffectLib/EffectData.cpp deleted file mode 100644 index 847326db..00000000 --- a/extension/src/platform/EffectLib/EffectData.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Platform skeleton for EffectLib/EffectData.h (40250 EffectLib/EffectData.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectData.h" - -#include "../PlatformStub.h" - -CEffectData::CEffectData() -{ - MT_PLATFORM_STUB(); -} - -CEffectData::~CEffectData() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::LoadScript(const char *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::LoadSoundScriptData(const char *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetParticleCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetParticlePointer(DWORD) -> CParticleSystemData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetMeshCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetMeshPointer(DWORD) -> CEffectMeshScript * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetLightCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetLightPointer(DWORD) -> CLightData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetSoundInstanceVector() -> NSound::TSoundInstanceVector * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetBoundingSphereRadius() -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetBoundingSpherePosition() -> D3DXVECTOR3 -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::GetFileName() const -> const char * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::__ClearParticleDataVector() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::__ClearLightDataVector() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::__ClearMeshDataVector() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::AllocParticle() -> CParticleSystemData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::AllocMesh() -> CEffectMeshScript * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::AllocLight() -> CLightData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectData::New() -> CEffectData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectData::Delete(CEffectData *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CEffectData::ms_kPool) CEffectData::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/EffectElementBase.cpp b/extension/src/platform/EffectLib/EffectElementBase.cpp deleted file mode 100644 index bcde4df5..00000000 --- a/extension/src/platform/EffectLib/EffectElementBase.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// Platform skeleton for EffectLib/EffectElementBase.h (40250 EffectLib/EffectElementBase.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectElementBase.h" - -#include "../PlatformStub.h" - -CEffectElementBase::CEffectElementBase() -{ - MT_PLATFORM_STUB(); -} - -CEffectElementBase::~CEffectElementBase() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBase::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBase::isData() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectElementBase::LoadScript(CTextFileLoader &) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectElementBase::GetPosition(float, D3DXVECTOR3 &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBase::GetStartTime() -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EffectLib/EffectElementBaseInstance.cpp b/extension/src/platform/EffectLib/EffectElementBaseInstance.cpp deleted file mode 100644 index d4150d5b..00000000 --- a/extension/src/platform/EffectLib/EffectElementBaseInstance.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Platform skeleton for EffectLib/EffectElementBaseInstance.h (40250 EffectLib/EffectElementBaseInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectElementBaseInstance.h" - -#include "../PlatformStub.h" - -CEffectElementBaseInstance::CEffectElementBaseInstance() -{ - MT_PLATFORM_STUB(); -} - -CEffectElementBaseInstance::~CEffectElementBaseInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::SetDataPointer(CEffectElementBase *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::Initialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::Destroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::SetLocalMatrixPointer(const D3DXMATRIX *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::Update(float) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectElementBaseInstance::Render() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::isActive() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectElementBaseInstance::SetActive() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectElementBaseInstance::SetDeactive() -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/platform/EffectLib/EffectInstance.cpp b/extension/src/platform/EffectLib/EffectInstance.cpp deleted file mode 100644 index f4c50551..00000000 --- a/extension/src/platform/EffectLib/EffectInstance.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// Platform skeleton for EffectLib/EffectInstance.h (40250 EffectLib/EffectInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectInstance.h" - -#include "../PlatformStub.h" - -auto CEffectInstance::GetBoundingSphere(D3DXVECTOR3 &, float &) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectInstance::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::New() -> CEffectInstance * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectInstance::Delete(CEffectInstance *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::ResetRenderingEffectCount() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::GetRenderingEffectCount() -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -CEffectInstance::CEffectInstance() -{ - MT_PLATFORM_STUB(); -} - -CEffectInstance::~CEffectInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::LessRenderOrder(CEffectInstance *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectInstance::SetEffectDataPointer(CEffectData *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::isAlive() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectInstance::SetActive() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::SetDeactive() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::SetGlobalMatrix(const D3DXMATRIX &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::UpdateSound() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::OnUpdate() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::OnRender() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::__Initialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::__SetParticleData(CParticleSystemData *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::__SetMeshData(CEffectMeshScript *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectInstance::__SetLightData(CLightData *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CEffectInstance::ms_kPool) CEffectInstance::ms_kPool{}; - -decltype(CEffectInstance::ms_iRenderingEffectCount) CEffectInstance::ms_iRenderingEffectCount{}; diff --git a/extension/src/platform/EffectLib/EffectManager.cpp b/extension/src/platform/EffectLib/EffectManager.cpp deleted file mode 100644 index 853d58a1..00000000 --- a/extension/src/platform/EffectLib/EffectManager.cpp +++ /dev/null @@ -1,189 +0,0 @@ -// Platform skeleton for EffectLib/EffectManager.h (40250 EffectLib/EffectManager.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectManager.h" - -#include "../PlatformStub.h" - -CEffectManager::CEffectManager() -{ - MT_PLATFORM_STUB(); -} - -CEffectManager::~CEffectManager() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::Destroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::UpdateSound() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::Update() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::Render() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::GetInfo(std::string *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::IsAliveEffect(DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::RegisterEffect(const char *, bool, bool) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::RegisterEffect2(const char *, DWORD *, bool) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::DeleteAllInstances() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::CreateEffect(DWORD, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::CreateEffect(const char *, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::CreateEffectInstance(DWORD, DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::SelectEffectInstance(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::DestroyEffectInstance(DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::DeactiveEffectInstance(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::SetEffectTextures(DWORD, std::vector) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::SetEffectInstancePosition(const D3DXVECTOR3 &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::SetEffectInstanceRotation(const D3DXVECTOR3 &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::SetEffectInstanceGlobalMatrix(const D3DXMATRIX &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::ShowEffect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::HideEffect() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::GetRandomEffect() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::GetEmptyIndex() -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::GetEffectData(DWORD, CEffectData **) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::GetEffectData(DWORD, const CEffectData **) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::CreateUnsafeEffectInstance(DWORD, CEffectInstance **) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::DestroyUnsafeEffectInstance(CEffectInstance *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::GetRenderingEffectCount() -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectManager::__Initialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::__DestroyEffectInstanceMap() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::__DestroyEffectCacheMap() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectManager::__DestroyEffectDataMap() -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/platform/EffectLib/EffectMesh.cpp b/extension/src/platform/EffectLib/EffectMesh.cpp deleted file mode 100644 index 4d6ae8a6..00000000 --- a/extension/src/platform/EffectLib/EffectMesh.cpp +++ /dev/null @@ -1,269 +0,0 @@ -// Platform skeleton for EffectLib/EffectMesh.h (40250 EffectLib/EffectMesh.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectMesh.h" - -#include "../PlatformStub.h" - -auto CEffectMesh::SEffectMeshData::New() -> SEffectMeshData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::SEffectMeshData::Delete(SEffectMeshData *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMesh::SEffectMeshData::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CEffectMesh::SEffectMeshData::ms_kPool) CEffectMesh::SEffectMeshData::ms_kPool{}; - -auto CEffectMesh::Type() -> TType -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -CEffectMesh::CEffectMesh(const char * c_szFileName) : CResource(c_szFileName) // initializers as in 40250 -{ - MT_PLATFORM_STUB(); -} - -CEffectMesh::~CEffectMesh() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMesh::GetFrameCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::GetMeshCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::GetMeshDataPointer(DWORD) -> TEffectMeshData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::GetTextureVectorPointer(DWORD) -> std::vector * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return *>(); -} - -auto CEffectMesh::GetTextureVectorReference(DWORD) -> std::vector & -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return &>(); -} - -auto CEffectMesh::GetMeshElementPointer(DWORD, TEffectMeshData **) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::OnLoad(int, const void *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::OnClear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMesh::OnIsEmpty() const -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::OnIsType(TType) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::__LoadData_Ver001(int, const BYTE *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMesh::__LoadData_Ver002(int, const BYTE *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -CEffectMeshScript::CEffectMeshScript() -{ - MT_PLATFORM_STUB(); -} - -CEffectMeshScript::~CEffectMeshScript() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshScript::GetMeshFileName() -> const char * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::ReserveMeshData(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshScript::CheckMeshIndex(DWORD) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetMeshDataPointer(DWORD, TMeshData **) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetMeshDataCount() -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetBillboardType(DWORD) -> int -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::isBlendingEnable(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetBlendingSrcType(DWORD) -> BYTE -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetBlendingDestType(DWORD) -> BYTE -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::isTextureAlphaEnable(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetColorOperationType(DWORD, BYTE *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetColorFactor(DWORD, D3DXCOLOR *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetTimeTableAlphaPointer(DWORD, TTimeEventTableFloat **) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::isMeshAnimationLoop() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetMeshAnimationLoopCount() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetMeshAnimationFrameDelay() -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::isTextureAnimationLoop(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetTextureAnimationFrameDelay(DWORD) -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::GetTextureAnimationStartFrame(DWORD) -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::OnClear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshScript::OnIsData() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::OnLoadScript(CTextFileLoader &) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshScript::New() -> CEffectMeshScript * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshScript::Delete(CEffectMeshScript *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CEffectMeshScript::ms_kPool) CEffectMeshScript::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/EffectMeshInstance.cpp b/extension/src/platform/EffectLib/EffectMeshInstance.cpp deleted file mode 100644 index f3bed6a7..00000000 --- a/extension/src/platform/EffectLib/EffectMeshInstance.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Platform skeleton for EffectLib/EffectMeshInstance.h (40250 EffectLib/EffectMeshInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectMeshInstance.h" - -#include "../PlatformStub.h" - -CEffectMeshInstance::CEffectMeshInstance() -{ - MT_PLATFORM_STUB(); -} - -CEffectMeshInstance::~CEffectMeshInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::New() -> CEffectMeshInstance * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshInstance::Delete(CEffectMeshInstance *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CEffectMeshInstance::ms_kPool) CEffectMeshInstance::ms_kPool{}; - -auto CEffectMeshInstance::OnSetDataPointer(CEffectElementBase *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::OnInitialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::OnDestroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::OnUpdate(float) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEffectMeshInstance::OnRender() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEffectMeshInstance::isActive() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EffectLib/EffectUpdateDecorator.cpp b/extension/src/platform/EffectLib/EffectUpdateDecorator.cpp deleted file mode 100644 index 1c4a01ca..00000000 --- a/extension/src/platform/EffectLib/EffectUpdateDecorator.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Platform skeleton for EffectLib/EffectUpdateDecorator.h (40250 EffectLib/EffectUpdateDecorator.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EffectUpdateDecorator.h" - -#include "../PlatformStub.h" - -auto NEffectUpdateDecorator::CAirResistanceDecorator::__Excute(const CDecoratorData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto NEffectUpdateDecorator::CAirResistanceDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto NEffectUpdateDecorator::CGravityDecorator::__Excute(const CDecoratorData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto NEffectUpdateDecorator::CGravityDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto NEffectUpdateDecorator::CRotationDecorator::__Excute(const CDecoratorData &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto NEffectUpdateDecorator::CRotationDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EffectLib/EmitterProperty.cpp b/extension/src/platform/EffectLib/EmitterProperty.cpp deleted file mode 100644 index 0f9b8733..00000000 --- a/extension/src/platform/EffectLib/EmitterProperty.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Platform skeleton for EffectLib/EmitterProperty.h (40250 EffectLib/EmitterProperty.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/EmitterProperty.h" - -#include "../PlatformStub.h" - -CEmitterProperty::CEmitterProperty() -{ - MT_PLATFORM_STUB(); -} - -CEmitterProperty::~CEmitterProperty() -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmitterShape() -> BYTE -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEmitterProperty::GetEmitterAdvancedType() -> BYTE -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEmitterProperty::isEmitFromEdge() -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CEmitterProperty::GetEmittingSize(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmittingAngularVelocity(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmittingDirectionX(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmittingDirectionY(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmittingDirectionZ(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmittingVelocity(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetEmissionCountPerSecond(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetParticleLifeTime(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetParticleSizeX(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CEmitterProperty::GetParticleSizeY(float, float *) -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/platform/EffectLib/FrameController.cpp b/extension/src/platform/EffectLib/FrameController.cpp deleted file mode 100644 index 899b7b8b..00000000 --- a/extension/src/platform/EffectLib/FrameController.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Platform skeleton for EffectLib/FrameController.h (40250 EffectLib/FrameController.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/FrameController.h" - -#include "../PlatformStub.h" - -CFrameController::CFrameController() -{ - MT_PLATFORM_STUB(); -} - -CFrameController::~CFrameController() -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::Update(float) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetCurrentFrame(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::GetCurrentFrame() -> BYTE -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CFrameController::SetMaxFrame(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetFrameTime(float) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetStartFrame(DWORD) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetLoopFlag(BOOL) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetLoopCount(int) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::SetActive(BOOL) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CFrameController::isActive(DWORD) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EffectLib/ParticleInstance.cpp b/extension/src/platform/EffectLib/ParticleInstance.cpp deleted file mode 100644 index a41af30b..00000000 --- a/extension/src/platform/EffectLib/ParticleInstance.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Platform skeleton for EffectLib/ParticleInstance.h (40250 EffectLib/ParticleInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/ParticleInstance.h" - -#include "../PlatformStub.h" - -CParticleInstance::CParticleInstance() -{ - MT_PLATFORM_STUB(); -} - -CParticleInstance::~CParticleInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::GetRadiusApproximation() -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleInstance::Update(float, float) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleInstance::New() -> CParticleInstance * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleInstance::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::Transform(const D3DXMATRIX *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::Transform(const D3DXMATRIX *, const float) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::GetParticleMeshPointer() -> TPTVertex * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleInstance::DeleteThis() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::Destroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleInstance::__Initialize() -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CParticleInstance::ms_kPool) CParticleInstance::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/ParticleProperty.cpp b/extension/src/platform/EffectLib/ParticleProperty.cpp deleted file mode 100644 index 0c7414e8..00000000 --- a/extension/src/platform/EffectLib/ParticleProperty.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Platform skeleton for EffectLib/ParticleProperty.h (40250 EffectLib/ParticleProperty.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/ParticleProperty.h" - -#include "../PlatformStub.h" - -CParticleProperty::CParticleProperty() -{ - MT_PLATFORM_STUB(); -} - -CParticleProperty::~CParticleProperty() -{ - MT_PLATFORM_STUB(); -} - -auto CParticleProperty::Clear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleProperty::InsertTexture(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleProperty::SetTexture(const char *) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleProperty::operator=(const CParticleProperty &) -> CParticleProperty & -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EffectLib/ParticleSystemData.cpp b/extension/src/platform/EffectLib/ParticleSystemData.cpp deleted file mode 100644 index 5fab56e4..00000000 --- a/extension/src/platform/EffectLib/ParticleSystemData.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Platform skeleton for EffectLib/ParticleSystemData.h (40250 EffectLib/ParticleSystemData.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/ParticleSystemData.h" - -#include "../PlatformStub.h" - -CParticleSystemData::~CParticleSystemData() -{ - MT_PLATFORM_STUB(); -} - -CParticleSystemData::CParticleSystemData() -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemData::GetEmitterPropertyPointer() -> CEmitterProperty * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemData::GetParticlePropertyPointer() -> CParticleProperty * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemData::ChangeTexture(const char *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemData::BuildDecorator(CParticleInstance *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemData::OnLoadScript(CTextFileLoader &) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemData::OnClear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemData::OnIsData() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemData::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemData::New() -> CParticleSystemData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemData::Delete(CParticleSystemData *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CParticleSystemData::ms_kPool) CParticleSystemData::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/ParticleSystemInstance.cpp b/extension/src/platform/EffectLib/ParticleSystemInstance.cpp deleted file mode 100644 index cee09402..00000000 --- a/extension/src/platform/EffectLib/ParticleSystemInstance.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Platform skeleton for EffectLib/ParticleSystemInstance.h (40250 EffectLib/ParticleSystemInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/ParticleSystemInstance.h" - -#include "../PlatformStub.h" - -auto CParticleSystemInstance::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::New() -> CParticleSystemInstance * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemInstance::Delete(CParticleSystemInstance *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CParticleSystemInstance::ms_kPool) CParticleSystemInstance::ms_kPool{}; - -CParticleSystemInstance::CParticleSystemInstance() -{ - MT_PLATFORM_STUB(); -} - -CParticleSystemInstance::~CParticleSystemInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::OnSetDataPointer(CEffectElementBase *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::CreateParticles(float) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::GetEmissionCount() -> DWORD -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemInstance::OnInitialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::OnDestroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CParticleSystemInstance::OnUpdate(float) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CParticleSystemInstance::OnRender() -> void -{ - MT_PLATFORM_STUB(); -} diff --git a/extension/src/platform/EffectLib/SimpleLightData.cpp b/extension/src/platform/EffectLib/SimpleLightData.cpp deleted file mode 100644 index 89ced17f..00000000 --- a/extension/src/platform/EffectLib/SimpleLightData.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Platform skeleton for EffectLib/SimpleLightData.h (40250 EffectLib/SimpleLightData.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/SimpleLightData.h" - -#include "../PlatformStub.h" - -CLightData::CLightData() -{ - MT_PLATFORM_STUB(); -} - -CLightData::~CLightData() -{ - MT_PLATFORM_STUB(); -} - -auto CLightData::GetRange(float, float &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightData::GetDuration() -> float -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightData::InitializeLight(D3DLIGHT8 &) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightData::OnClear() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightData::OnIsData() -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightData::OnLoadScript(CTextFileLoader &) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightData::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightData::New() -> CLightData * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightData::Delete(CLightData *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CLightData::ms_kPool) CLightData::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/SimpleLightInstance.cpp b/extension/src/platform/EffectLib/SimpleLightInstance.cpp deleted file mode 100644 index fcfd37ca..00000000 --- a/extension/src/platform/EffectLib/SimpleLightInstance.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Platform skeleton for EffectLib/SimpleLightInstance.h (40250 EffectLib/SimpleLightInstance.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/SimpleLightInstance.h" - -#include "../PlatformStub.h" - -CLightInstance::CLightInstance() -{ - MT_PLATFORM_STUB(); -} - -CLightInstance::~CLightInstance() -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::OnSetDataPointer(CEffectElementBase *) -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::OnInitialize() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::OnDestroy() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::OnUpdate(float) -> bool -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightInstance::OnRender() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::DestroySystem() -> void -{ - MT_PLATFORM_STUB(); -} - -auto CLightInstance::New() -> CLightInstance * -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} - -auto CLightInstance::Delete(CLightInstance *) -> void -{ - MT_PLATFORM_STUB(); -} - -decltype(CLightInstance::ms_kPool) CLightInstance::ms_kPool{}; diff --git a/extension/src/platform/EffectLib/Type.cpp b/extension/src/platform/EffectLib/Type.cpp deleted file mode 100644 index e060f0b2..00000000 --- a/extension/src/platform/EffectLib/Type.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Platform skeleton for EffectLib/Type.h (40250 EffectLib/Type.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. -#include "EffectLib/StdAfx.h" -#include "EffectLib/Type.h" - -#include "../PlatformStub.h" - -auto GetTokenTimeEventFloat(CTextFileLoader &, const char *, TTimeEventTableFloat *) -> BOOL -{ - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); -} diff --git a/extension/src/platform/EterBase/Utils.cpp b/extension/src/platform/EterBase/Utils.cpp index a0148542..a43038eb 100644 --- a/extension/src/platform/EterBase/Utils.cpp +++ b/extension/src/platform/EterBase/Utils.cpp @@ -1,73 +1,276 @@ -// Platform skeleton for EterBase/Utils.h (40250 EterBase/Utils.cpp), generated by platform_stub.py. -// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. Implemented -// bodies are the 40250 code (batch 2D: the path helpers EterPack uses); stl_lowers lives in EterBase/Stl.cpp. +// Platform implementation of EterBase/Utils.h (40250 EterBase/Utils.cpp). The pure string/path helpers are the +// 40250 bodies verbatim (PORT-PLAN §3); Win32 calls are swapped for POSIX ones where marked PORT. +// stl_lowers lives in EterBase/Stl.cpp. #include "EterBase/StdAfx.h" #include "EterBase/Utils.h" #include "EterBase/Stl.h" -#include "../PlatformStub.h" +#include +#include +#include +#include +#include -auto CreateTempFileName(const char *) -> const char * +#include +#include + +// PORT: GetTempPath/GetTempFileName -> $TMPDIR + mkstemp (same "XXXX" unique-file contract). +const char * CreateTempFileName(const char * c_pszPrefix) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + static char szTempName[MAX_PATH + 1]; + + const char * tmp = getenv("TMPDIR"); + snprintf(szTempName, sizeof(szTempName), "%s/%sXXXXXX", tmp && *tmp ? tmp : "/tmp", c_pszPrefix ? c_pszPrefix : "etb"); + int fd = mkstemp(szTempName); + if (fd >= 0) + close(fd); + + return (szTempName); } -auto GetFilePathNameExtension(const char *, int, std::string *, std::string *, std::string *) -> void +void GetFilePathNameExtension(const char * c_szFile, int len, std::string * pstPath, std::string * pstName, std::string * pstExt) { - MT_PLATFORM_STUB(); + assert(pstPath != NULL); + assert(pstName != NULL); + assert(pstExt != NULL); + + int ext = len; + int pos = len; + + while (pos > 0) + { + --pos; + char c = c_szFile[pos]; + + if (ext == len && c == '.') + { + ext = pos; + break; + } + + if (c == '/' || c == '\\') + break; + } + + while (pos > 0) + { + --pos; + char c = c_szFile[pos]; + + if (c == '/' || c == '\\') + break; + } + + if (pos) + { + ++pos; + pstPath->append(c_szFile, pos); + } + + if (ext > pos) + pstName->append(c_szFile + pos, ext - pos); + + ++ext; + + if (len > ext) + pstExt->append(c_szFile + ext, len - ext); } -auto GetFileExtension(const char *, int, std::string *) -> void +void GetFileExtension(const char* c_szFile, int len, std::string* pstExt) { - MT_PLATFORM_STUB(); + int ext = len; + int pos = len; + while (pos > 0) + { + --pos; + char c=c_szFile[pos]; + if (ext==len && c=='.') + { + ext=pos; + break; + } + + if (c=='/') break; + else if (c=='\\') break; + } + + ++ext; + if (len>ext) + pstExt->append(c_szFile+ext, len-ext); } -auto GetFileNameParts(const char *, int, char *, char *, char *) -> void +void GetFileNameParts(const char* c_szFile, int len, char* pszPath, char* pszName, char* pszExt) { - MT_PLATFORM_STUB(); + assert(pszPath!=NULL); + assert(pszName!=NULL); + assert(pszExt!=NULL); + + int ext=len; + int pos=len; + while (pos>0) + { + --pos; + char c=c_szFile[pos]; + if (ext==len && c=='.') + { + ext=pos; + break; + } + + if (c=='/') break; + else if (c=='\\') break; + } + + while (pos>0) + { + --pos; + char c=c_szFile[pos]; + + if (c=='/') break; + else if (c=='\\') break; + } + + if (pos) + { + ++pos; + for (int i = 0; i < pos; ++i) + { + pszPath[i] = c_szFile[i]; + } + pszPath[pos] = '\0'; + } + + if (ext>pos) + { + int count = 0; + for (int i = pos; i < ext; ++i) + { + pszName[count++] = c_szFile[i]; + } + pszName[count] = '\0'; + } + + ++ext; + if (len > ext) + { + int count = 0; + for (int i = ext; i < len; ++i) + { + pszExt[count++] = c_szFile[i]; + } + pszExt[count] = '\0'; + } } -auto GetOldIndexingName(char *, int) -> void +// PORT: _ecvt(Index, 256, &dec, &sign) truncated at dec is the unsigned decimal digits of Index. +void GetOldIndexingName(char * szName, int Index) { - MT_PLATFORM_STUB(); + char Temp[512]; + + snprintf(Temp, sizeof(Temp), "%u", Index < 0 ? 0u - (unsigned) Index : (unsigned) Index); + + strcat(szName, Temp); } -auto GetIndexingName(char *, DWORD) -> void +void GetIndexingName(char * szName, DWORD Index) { - MT_PLATFORM_STUB(); + sprintf(szName + strlen(szName), "%u", Index); } -auto GetOnlyFileName(const char *, std::string &) -> void +void GetOnlyFileName(const char * sz_Name, std::string & strFileName) { - MT_PLATFORM_STUB(); + strFileName = ""; + + int i; + for (i=strlen(sz_Name)-1; i>=0; --i) + { + if ('\\' == sz_Name[i] || '/' == sz_Name[i]) + { + ++i; + break; + } + } + + if (i == -1) + i = 0; + + for (size_t j = i; j < strlen(sz_Name); ++j) + { + strFileName += sz_Name[j]; + } + + strFileName += "\0"; } -auto GetOnlyPathName(const char *, std::string &) -> void +void GetOnlyPathName(const char * sz_Name, std::string & OnlyPathName) { - MT_PLATFORM_STUB(); + int i; + for (i = strlen(sz_Name) - 1; i >= 0; --i) + { + if ('\\' == sz_Name[i] || '/' == sz_Name[i]) + { + ++i; + break; + } + } + + if (i == -1) + i = 0; + + OnlyPathName.reserve(strlen(sz_Name)); + OnlyPathName = ""; + + for (int j=0; j const char * +const char * GetOnlyPathName(const char * c_szName) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + static std::string strPathName; + GetOnlyPathName(c_szName, strPathName); + + return strPathName.c_str(); } -auto GetLocalFileName(const char *, const char *, std::string *) -> bool +bool GetLocalFileName(const char * c_szGlobalPath, const char * c_szFullPathFileName, std::string * pstrLocalFileName) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + std::string strLocalFileName; + + std::string strGlobalPath; + std::string strFullPathFileName; + StringPath(c_szGlobalPath, strGlobalPath); + StringPath(c_szFullPathFileName, strFullPathFileName); + + if (strGlobalPath.length() >= strFullPathFileName.length()) + return false; + + DWORD length = std::min(strGlobalPath.length(), strFullPathFileName.length()); // PORT: min -> std::min + for (DWORD dwPos = 0; dwPos < length; ++dwPos) + { + if (strGlobalPath[dwPos] != strFullPathFileName[dwPos]) + return false; + } + + *pstrLocalFileName = &c_szFullPathFileName[length]; + + return true; } -auto GetExceptionPathName(const char *, std::string &) -> void +void GetExceptionPathName(const char * sz_Name, std::string & OnlyFileName) { - MT_PLATFORM_STUB(); + GetOnlyFileName(sz_Name, OnlyFileName); } -auto GetWorkingFolder(std::string &) -> void +void GetWorkingFolder(std::string & strFileName) { - MT_PLATFORM_STUB(); + char buf[128+1]; + if (!getcwd(buf, 128)) // PORT: _getcwd -> getcwd + buf[0] = '\0'; + strcat(buf, "/"); + strFileName = buf; } void StringLowers(char * String) @@ -125,21 +328,64 @@ void StringPath(const char * c_szSrc, std::string & rString) } } -auto PrintAsciiData(const void *, int) -> void +#define ishprint(x) ((((x) & 0xE0) > 0x90) || isprint(x)) + +void PrintAsciiData(const void* void_data, int bytes) { - MT_PLATFORM_STUB(); + int i, j, k; + const unsigned char* p; + const unsigned char* data; + + data = (const unsigned char*) void_data; + + fprintf(stdout, "------------------------------------------------------------------\n"); + j = bytes; + while (1) + { + k = j >= 16 ? 16 : j; + + p = data; + for (i = 0; i < 16; ++i) + { + if (i >= k) + fprintf(stdout, " "); + else + fprintf(stdout, "%02x ", *p); + p++; + } + + fprintf(stdout, "| "); + + p = data; + for (i = 0; i < k; ++i) + { + if (i >= k) + fprintf(stdout, " "); + else + fprintf(stdout, "%c", ishprint(*p) ? *p : '.'); + p++; + } + + fprintf(stdout, "\n"); + + j -= 16; + data += 16; + + if (j <= 0) + break; + } + + fprintf(stdout, "------------------------------------------------------------------\n"); } -auto IsFile(const char *) -> bool +bool IsFile(const char* filename) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + return access(filename, 0) == 0 ? true : false; // PORT: _access -> access } -auto IsGlobalFileName(const char *) -> bool +bool IsGlobalFileName(const char * c_szFileName) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + return strchr(c_szFileName, ':') != NULL; } auto MIN(int a, int b) -> int @@ -178,40 +424,193 @@ auto fMINMAX(float min, float value, float max) -> float return (max < tv) ? max : tv; } -auto MyCreateDirectory(const char *) -> void +void MyCreateDirectory(const char* path) { - MT_PLATFORM_STUB(); + if (!path || !*path) + return; + + char * dir; + const char * p; + + if (strlen(path) >= 3) + { + if (*(path + 1) == ':') // C:, D: drive prefix + path += 3; + } + + p = path; + + int len = strlen(path) + 1; + dir = new char[len]; + + while (*p) + { + if (*p == '/' || *p == '\\') + { + memset(dir, 0, len); + strncpy(dir, path, p - path); + mkdir(dir, 0755); // PORT: CreateDirectory(dir, NULL) -> mkdir + } + + ++p; + } + + delete [] dir; } -auto RemoveAllDirectory(const char *) -> void +// PORT: CDirRemover (CDir walk + DeleteFile/RemoveDirectory) -> std::filesystem::remove_all. +void RemoveAllDirectory(const char * c_szDirectoryName) { - MT_PLATFORM_STUB(); + std::error_code ec; + std::filesystem::remove_all(c_szDirectoryName, ec); } -auto SplitLine(const char *, const char *, std::vector *) -> bool +bool SplitLine(const char * c_szLine, const char * c_szDelimeter, std::vector * pkVec_strToken) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + pkVec_strToken->reserve(10); + pkVec_strToken->clear(); + + std::string strLine = c_szLine; + + DWORD basePos = 0; + + do + { + int beginPos = strLine.find_first_not_of(c_szDelimeter, basePos); + if (beginPos < 0) + return false; + + int endPos; + + if (strLine[beginPos] == '"') + { + ++beginPos; + endPos = strLine.find_first_of("\"", beginPos); + + if (endPos < 0) + return false; + + basePos = endPos + 1; + } + else + { + endPos = strLine.find_first_of(c_szDelimeter, beginPos); + basePos = endPos; + } + + pkVec_strToken->push_back(strLine.substr(beginPos, endPos - beginPos)); + } while (basePos < strLine.length()); + + return true; } -auto _getf(const char *, ...) -> const char * +const char * _getf(const char* c_szFormat, ...) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + static char szBuf[256]; + + va_list args; + va_start(args, c_szFormat); + vsnprintf(szBuf, sizeof(szBuf), c_szFormat, args); // PORT: _vsnprintf -> vsnprintf + va_end(args); + + return szBuf; } -auto CommandLineToArgv(PCHAR, int *) -> PCHAR * +PCHAR* CommandLineToArgv( PCHAR CmdLine, int* _argc ) { - MT_PLATFORM_STUB(); - return mt_platform_stub_return(); + PCHAR* argv; + PCHAR _argv; + ULONG len; + ULONG argc; + CHAR a; + ULONG i, j; + + BOOL in_QM; // PORT: BOOLEAN/PUCHAR -> BOOL/unsigned char * (not in the platform windows.h) + BOOL in_TEXT; + BOOL in_SPACE; + + len = strlen(CmdLine); + i = ((len+2)/2)*sizeof(PVOID) + sizeof(PVOID); + + argv = (PCHAR*)malloc( // PORT: GlobalAlloc(GMEM_FIXED, ...) -> malloc + i + (len+2)*sizeof(CHAR)); + + _argv = (PCHAR)(((unsigned char *)argv)+i); + + argc = 0; + argv[argc] = _argv; + in_QM = FALSE; + in_TEXT = FALSE; + in_SPACE = TRUE; + i = 0; + j = 0; + + while( (a = CmdLine[i]) ) { + if(in_QM) { + if(a == '\"') { + in_QM = FALSE; + } else { + _argv[j] = a; + j++; + } + } else { + switch(a) { + case '\"': + in_QM = TRUE; + in_TEXT = TRUE; + if(in_SPACE) { + argv[argc] = _argv+j; + argc++; + } + in_SPACE = FALSE; + break; + case ' ': + case '\t': + case '\n': + case '\r': + if(in_TEXT) { + _argv[j] = '\0'; + j++; + } + in_TEXT = FALSE; + in_SPACE = TRUE; + break; + default: + in_TEXT = TRUE; + if(in_SPACE) { + argv[argc] = _argv+j; + argc++; + } + _argv[j] = a; + j++; + in_SPACE = FALSE; + break; + } + } + i++; + } + _argv[j] = '\0'; + argv[argc] = NULL; + + (*_argc) = argc; + return argv; } -auto StringExceptCharacter(std::string *, const char *) -> void +void StringExceptCharacter(std::string * pstrString, const char * c_szCharacter) { - MT_PLATFORM_STUB(); + int icurPos = 0; + int iNextPos = 0; + + while((iNextPos = pstrString->find_first_of(c_szCharacter, icurPos)) >= 0) + { + std::string strFront = pstrString->substr(icurPos, iNextPos - icurPos); + std::string strBack = pstrString->substr(iNextPos+1, pstrString->length() - iNextPos - 1); + *pstrString = strFront + strBack; + } } -auto GetExcutedFileName(std::string &) -> void +// PORT: GetModuleFileName(NULL, ...) -> the platform has no executable-path query; report the working folder. +void GetExcutedFileName(std::string & r_str) { - MT_PLATFORM_STUB(); + GetWorkingFolder(r_str); } diff --git a/extension/src/platform/ScriptLib/Resource.cpp b/extension/src/platform/ScriptLib/Resource.cpp index 4cde29df..224b4dcc 100644 --- a/extension/src/platform/ScriptLib/Resource.cpp +++ b/extension/src/platform/ScriptLib/Resource.cpp @@ -3,7 +3,9 @@ #include "EterLib/GrpImage.h" #include "EterLib/GrpSubImage.h" #include "EterLib/GrpText.h" +#include "EterLib/AttributeData.h" #include "EterGrnLib/Thing.h" +#include "EffectLib/EffectMesh.h" namespace { CResource* NewUIImage(const char* name) { return new CGraphicImage(name); } @@ -11,6 +13,8 @@ CResource* NewUISubImage(const char* name) { return new CGraphicSubImage(name); // 40250 UserInterface/PythonApplication.cpp NewText: a ":[i].fnt" name is a CGraphicText. CResource* NewText(const char* name) { return new CGraphicText(name); } CResource* NewThing(const char* name) { return new CGraphicThing(name); } +CResource* NewEffectMesh(const char* name) { return new CEffectMesh(name); } +CResource* NewAttributeData(const char* name) { return new CAttributeData(name); } } CPythonResource::CPythonResource() { @@ -19,6 +23,8 @@ CPythonResource::CPythonResource() { m_resManager.RegisterResourceNewFunctionPointer("sub", NewUISubImage); m_resManager.RegisterResourceNewFunctionPointer("fnt", NewText); m_resManager.RegisterResourceNewFunctionPointer("gr2", NewThing); + m_resManager.RegisterResourceNewFunctionPointer("mde", NewEffectMesh); + m_resManager.RegisterResourceNewFunctionPointer("mdatr", NewAttributeData); } CPythonResource::~CPythonResource() { m_resManager.DestroyDeletingList(); } void CPythonResource::Destroy() { m_resManager.DestroyDeletingList(); m_resManager.Destroy(); } diff --git a/extension/src/platform/UserInterface/PythonApplication.cpp b/extension/src/platform/UserInterface/PythonApplication.cpp index 3094c725..25870202 100644 --- a/extension/src/platform/UserInterface/PythonApplication.cpp +++ b/extension/src/platform/UserInterface/PythonApplication.cpp @@ -122,8 +122,7 @@ bool CPythonApplication::Create(PyObject*, const char*, int, int, int) return false; } - // 40250 m_pyItem.Create() (PythonApplication.cpp:1253): registers dropitem.mse with CEffectManager, - // still a platform stub. + // 40250 m_pyItem.Create() (PythonApplication.cpp:1253): registers dropitem.mse with CEffectManager. CPythonItem::Instance().Create(); // 40250 PythonApplication.cpp:1260, after DefaultFont_Startup and the IME. diff --git a/extension/src/port/EffectLib/EffectData.cpp b/extension/src/port/EffectLib/EffectData.cpp new file mode 100644 index 00000000..41ca5d03 --- /dev/null +++ b/extension/src/port/EffectLib/EffectData.cpp @@ -0,0 +1,221 @@ +#include "StdAfx.h" +#include "EffectData.h" + +CDynamicPool CEffectData::ms_kPool; + +CEffectData* CEffectData::New() +{ + return ms_kPool.Alloc(); +} + +void CEffectData::Delete(CEffectData* pkData) +{ + pkData->Clear(); + ms_kPool.Free(pkData); +} + +void CEffectData::DestroySystem() +{ + ms_kPool.Destroy(); + + CParticleSystemData::DestroySystem(); + CEffectMeshScript::DestroySystem(); + CLightData::DestroySystem(); +} + +bool CEffectData::LoadScript(const char * c_szFileName) +{ + m_strFileName = c_szFileName; + CFileNameHelper::StringPath(m_strFileName); + + CTextFileLoader TextFileLoader; + if (!TextFileLoader.Load(c_szFileName)) + return false; + + TextFileLoader.SetTop(); + + if (!TextFileLoader.GetTokenFloat("boundingsphereradius", &m_fBoundingSphereRadius)) + { + m_fBoundingSphereRadius = 0.0f; + } + + if (!TextFileLoader.GetTokenVector3("boundingsphereposition", &m_v3BoundingSpherePosition)) + { + m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f; + } + + for (DWORD i = 0; i < TextFileLoader.GetChildNodeCount(); ++i) + { + if (!TextFileLoader.SetChildNode(i)) + continue; + + std::string strName; + + if (!TextFileLoader.GetCurrentNodeName(&strName)) + continue; + + if (0 == strName.compare("mesh")) + { + CEffectMeshScript * pMesh = AllocMesh(); + pMesh->Clear(); + pMesh->LoadScript(TextFileLoader); + } + else if (0 == strName.compare("particle")) + { + CParticleSystemData * pParticleSystemData = AllocParticle(); + pParticleSystemData->Clear(); + pParticleSystemData->LoadScript(TextFileLoader); + } + else if (0 == strName.compare("light")) + { + CLightData * pLightData = AllocLight(); + pLightData->Clear(); + pLightData->LoadScript(TextFileLoader); + } + + TextFileLoader.SetParentNode(); + } + + // Load Sound + std::string strPathHeader = "d:/ymir work/"; + std::string strNoExtensionName = CFileNameHelper::NoExtension(m_strFileName); + int iPos = strNoExtensionName.find(strPathHeader.c_str()); + if (iPos >= 0) + if (strNoExtensionName.size() > strPathHeader.size()) + { + std::string strSoundFileName; + strSoundFileName = "sound/"; + strSoundFileName += &strNoExtensionName[strPathHeader.size()]; + strSoundFileName += ".mss"; + + LoadSoundScriptData(strSoundFileName.c_str()); + } + + return true; +} + +bool CEffectData::LoadSoundScriptData(const char * c_szFileName) +{ + NSound::TSoundDataVector SoundDataVector; + + if (NSound::LoadSoundInformationPiece(c_szFileName, SoundDataVector)) + { + NSound::DataToInstance(SoundDataVector, &m_SoundInstanceVector); + return false; + } + + return true; +} + +CParticleSystemData * CEffectData::AllocParticle() +{ + CParticleSystemData * pParticle = CParticleSystemData::New(); + m_ParticleVector.push_back(pParticle); + return pParticle; +} + +CEffectMeshScript * CEffectData::AllocMesh() +{ + CEffectMeshScript * pMesh = CEffectMeshScript::New(); + m_MeshVector.push_back(pMesh); + return pMesh; +} + +CLightData * CEffectData::AllocLight() +{ + CLightData * pLight = CLightData::New(); + m_LightVector.push_back(pLight); + return pLight; +} + +DWORD CEffectData::GetLightCount() +{ + return m_LightVector.size(); +} + +CLightData * CEffectData::GetLightPointer(DWORD dwPosition) +{ + assert(dwPosition < m_LightVector.size()); + return m_LightVector[dwPosition]; +} + +DWORD CEffectData::GetParticleCount() +{ + return m_ParticleVector.size(); +} +CParticleSystemData * CEffectData::GetParticlePointer(DWORD dwPosition) +{ + if(dwPosition < m_ParticleVector.size()) + return m_ParticleVector[dwPosition]; + else + { + assert(false); + return NULL; + } +} + +DWORD CEffectData::GetMeshCount() +{ + return m_MeshVector.size(); +} +CEffectMeshScript * CEffectData::GetMeshPointer(DWORD dwPosition) +{ + assert(dwPosition < m_MeshVector.size()); + return m_MeshVector[dwPosition]; +} + +NSound::TSoundInstanceVector * CEffectData::GetSoundInstanceVector() +{ + return &m_SoundInstanceVector; +} + +float CEffectData::GetBoundingSphereRadius() +{ + return m_fBoundingSphereRadius; +} + +D3DXVECTOR3 CEffectData::GetBoundingSpherePosition() +{ + return m_v3BoundingSpherePosition; +} + +const char * CEffectData::GetFileName() const +{ + return m_strFileName.c_str(); +} + +void CEffectData::__ClearParticleDataVector() +{ + std::for_each(m_ParticleVector.begin(), m_ParticleVector.end(), CParticleSystemData::Delete); + m_ParticleVector.clear(); +} + +void CEffectData::__ClearLightDataVector() +{ + std::for_each(m_LightVector.begin(), m_LightVector.end(), CLightData::Delete); + m_LightVector.clear(); +} + +void CEffectData::__ClearMeshDataVector() +{ + std::for_each(m_MeshVector.begin(), m_MeshVector.end(), CEffectMeshScript::Delete); + m_MeshVector.clear(); +} + +void CEffectData::Clear() +{ + m_fBoundingSphereRadius = 0.0f; + m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f; + __ClearParticleDataVector(); + __ClearLightDataVector(); + __ClearMeshDataVector(); +} + +CEffectData::CEffectData() +{ + m_fBoundingSphereRadius = 0.0f; + m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f; +} +CEffectData::~CEffectData() +{ +} diff --git a/extension/src/port/EffectLib/EffectElementBase.cpp b/extension/src/port/EffectLib/EffectElementBase.cpp new file mode 100644 index 00000000..d8330dd7 --- /dev/null +++ b/extension/src/port/EffectLib/EffectElementBase.cpp @@ -0,0 +1,168 @@ +#include "StdAfx.h" +#include "EffectElementBase.h" + + +void CEffectElementBase::GetPosition(float fTime, D3DXVECTOR3 & rPosition) +{ + if (m_TimeEventTablePosition.empty()) + { + rPosition = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + return; + } + if (m_TimeEventTablePosition.size()==1) + { + rPosition = m_TimeEventTablePosition[0].m_vecPosition; + return; + } + if (m_TimeEventTablePosition.front().m_fTime > fTime) + { + rPosition = m_TimeEventTablePosition.front().m_vecPosition; + return; + } + if (m_TimeEventTablePosition.back().m_fTime < fTime) + { + rPosition = m_TimeEventTablePosition.back().m_vecPosition; + return; + } + + typedef TTimeEventTablePosition::iterator iterator; + iterator result = std::lower_bound( m_TimeEventTablePosition.begin(), m_TimeEventTablePosition.end(), fTime ); + + TEffectPosition & rEffectPosition = *result; + iterator rPrev = result; + if (m_TimeEventTablePosition.begin() != result) + { + rPrev = result-1; + } + else + { + rPosition = result->m_vecPosition; + return; + } + TEffectPosition & rPrevEffectPosition = *rPrev; + int iMovingType = rPrevEffectPosition.m_iMovingType; + + if (MOVING_TYPE_DIRECT == iMovingType) + { + float Head = fabs(rEffectPosition.m_fTime - fTime) / fabs(rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime); + float Tail = 1.0f - fabs(rEffectPosition.m_fTime - fTime) / fabs(rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime); + rPosition = (rPrevEffectPosition.m_vecPosition*Head) + (rEffectPosition.m_vecPosition*Tail); + } + else if (MOVING_TYPE_BEZIER_CURVE == iMovingType) + { + float ft = (fTime - rPrevEffectPosition.m_fTime) / (rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime); + + rPosition = rPrevEffectPosition.m_vecPosition * (1.0f - ft) * (1.0f - ft) + + (rPrevEffectPosition.m_vecPosition + rPrevEffectPosition.m_vecControlPoint) * (1.0f - ft) * ft * 2 + + rEffectPosition.m_vecPosition * ft * ft; + } +} + +/* +bool CEffectElementBase::isVisible(float fTime) +{ + for (DWORD i = 0; i < m_TimeEventTableVisible.size(); ++i) + { + float fPointTime = m_TimeEventTableVisible[i]; + + if (fTime < fPointTime) + { + if (1 == i % 2) + return true; + else + return false; + } + } + + return 1 == (m_TimeEventTableVisible.size() % 2); +} + +void CEffectElementBase::GetAlpha(float fTime, float * pAlpha) +{ + GetTimeEventBlendValue(fTime, m_TimeEventAlpha, pAlpha); +} + +void CEffectElementBase::GetScale(float fTime, float * pScale) +{ + GetTimeEventBlendValue(fTime, m_TimeEventScale, pScale); +} +*/ + +bool CEffectElementBase::isData() +{ + return OnIsData(); +} + +void CEffectElementBase::Clear() +{ + m_fStartTime = 0.0f; + + OnClear(); +} + +BOOL CEffectElementBase::LoadScript(CTextFileLoader & rTextFileLoader) +{ + CTokenVector * pTokenVector; + if (!rTextFileLoader.GetTokenFloat("starttime",&m_fStartTime)) + { + m_fStartTime = 0.0f; + } + if (rTextFileLoader.GetTokenVector("timeeventposition", &pTokenVector)) + { + m_TimeEventTablePosition.clear(); + + DWORD dwIndex = 0; + for (DWORD i = 0; i < pTokenVector->size(); ++dwIndex) + { + TEffectPosition EffectPosition; + EffectPosition.m_fTime = atof(pTokenVector->at(i++).c_str()); + if (pTokenVector->at(i)=="MOVING_TYPE_BEZIER_CURVE") + { + i++; + + EffectPosition.m_iMovingType = MOVING_TYPE_BEZIER_CURVE; + + EffectPosition.m_vecPosition.x = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecPosition.y = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecPosition.z = atof(pTokenVector->at(i++).c_str()); + + EffectPosition.m_vecControlPoint.x = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecControlPoint.y = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecControlPoint.z = atof(pTokenVector->at(i++).c_str()); + } + else if (pTokenVector->at(i) == "MOVING_TYPE_DIRECT") + { + i++; + + EffectPosition.m_iMovingType = MOVING_TYPE_DIRECT; + + EffectPosition.m_vecPosition.x = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecPosition.y = atof(pTokenVector->at(i++).c_str()); + EffectPosition.m_vecPosition.z = atof(pTokenVector->at(i++).c_str()); + + EffectPosition.m_vecControlPoint = D3DXVECTOR3(0.0f,0.0f,0.0f); + } + else + { + return FALSE; + } + + m_TimeEventTablePosition.push_back(EffectPosition); + } + } + + return OnLoadScript(rTextFileLoader); +} + +float CEffectElementBase::GetStartTime() +{ + return m_fStartTime; +} + +CEffectElementBase::CEffectElementBase() +{ + m_fStartTime = 0.0f; +} +CEffectElementBase::~CEffectElementBase() +{ +} diff --git a/extension/src/port/EffectLib/EffectElementBaseInstance.cpp b/extension/src/port/EffectLib/EffectElementBaseInstance.cpp new file mode 100644 index 00000000..80f64aa3 --- /dev/null +++ b/extension/src/port/EffectLib/EffectElementBaseInstance.cpp @@ -0,0 +1,97 @@ +#include "StdAfx.h" +#include "EffectElementBaseInstance.h" + +bool CEffectElementBaseInstance::Update(float fElapsedTime) +{ + if (m_bStart) + { + m_fElapsedTime = fElapsedTime; + m_fLocalTime += fElapsedTime; + + return OnUpdate(fElapsedTime); + } + else + { + m_fRemainingTime -= fElapsedTime; + if (m_fRemainingTime<=0.0f) + m_bStart = true; + return true; + } +} + +void CEffectElementBaseInstance::Render() +{ + if (!m_bStart) + return; + + assert(mc_pmatLocal); + + OnRender(); +} + +void CEffectElementBaseInstance::SetLocalMatrixPointer(const D3DXMATRIX * c_pMatrix) +{ + mc_pmatLocal = c_pMatrix; +} + +void CEffectElementBaseInstance::SetDataPointer(CEffectElementBase * pElement) +{ + m_pBase = pElement; + + m_dwStartTime = CTimer::Instance().GetCurrentMillisecond(); + + ////////////////////////////////////////////////////////////////////////// + //add by ipkn, start time management + + m_fRemainingTime = pElement->GetStartTime(); + if (m_fRemainingTime<=0.0f) + m_bStart = true; + else + m_bStart = false; + + ////////////////////////////////////////////////////////////////////////// + + OnSetDataPointer(pElement); +} + +bool CEffectElementBaseInstance::isActive() +{ + return m_isActive; +} +void CEffectElementBaseInstance::SetActive() +{ + m_isActive = true; +} +void CEffectElementBaseInstance::SetDeactive() +{ + m_isActive = false; +} + +void CEffectElementBaseInstance::Initialize() +{ + mc_pmatLocal = NULL; + + m_isActive = true; + + m_fLocalTime = 0.0f; + m_dwStartTime = 0; + m_fElapsedTime = 0.0f; + + m_bStart = false; + m_fRemainingTime = 0.0f; + + OnInitialize(); +} + +void CEffectElementBaseInstance::Destroy() +{ + OnDestroy(); + Initialize(); +} + +CEffectElementBaseInstance::CEffectElementBaseInstance() +{ +} +CEffectElementBaseInstance::~CEffectElementBaseInstance() +{ +} \ No newline at end of file diff --git a/extension/src/port/EffectLib/EffectInstance.cpp b/extension/src/port/EffectLib/EffectInstance.cpp new file mode 100644 index 00000000..0bce80fd --- /dev/null +++ b/extension/src/port/EffectLib/EffectInstance.cpp @@ -0,0 +1,288 @@ +#include "StdAfx.h" +#include "EffectInstance.h" +#include "ParticleSystemInstance.h" +#include "SimpleLightInstance.h" + +#include "../EterBase/Stl.h" +#include "../EterLib/StateManager.h" +#include "../MilesLib/SoundManager.h" + +CDynamicPool CEffectInstance::ms_kPool; +int CEffectInstance::ms_iRenderingEffectCount = 0; + +bool CEffectInstance::LessRenderOrder(CEffectInstance* pkEftInst) +{ + return (m_pkEftDatam_pkEftData); +} + +void CEffectInstance::ResetRenderingEffectCount() +{ + ms_iRenderingEffectCount = 0; +} + +int CEffectInstance::GetRenderingEffectCount() +{ + return ms_iRenderingEffectCount; +} + +CEffectInstance* CEffectInstance::New() +{ + CEffectInstance* pkEftInst=ms_kPool.Alloc(); + return pkEftInst; +} + +void CEffectInstance::Delete(CEffectInstance* pkEftInst) +{ + pkEftInst->Clear(); + ms_kPool.Free(pkEftInst); +} + +void CEffectInstance::DestroySystem() +{ + ms_kPool.Destroy(); + + CParticleSystemInstance::DestroySystem(); + CEffectMeshInstance::DestroySystem(); + CLightInstance::DestroySystem(); +} + +void CEffectInstance::UpdateSound() +{ + if (m_pSoundInstanceVector) + { + CSoundManager& rkSndMgr=CSoundManager::Instance(); + rkSndMgr.UpdateSoundInstance(m_matGlobal._41, m_matGlobal._42, m_matGlobal._43, m_dwFrame, m_pSoundInstanceVector); + // NOTE : 매트릭스에서 위치를 직접 얻어온다 - [levites] + } + ++m_dwFrame; +} + +struct FEffectUpdator +{ + BOOL isAlive; + float fElapsedTime; + FEffectUpdator(float fElapsedTime) + : isAlive(FALSE), fElapsedTime(fElapsedTime) + { + } + void operator () (CEffectElementBaseInstance * pInstance) + { + if (pInstance->Update(fElapsedTime)) + isAlive = TRUE; + } +}; + +void CEffectInstance::OnUpdate() +{ + Transform(); + +#ifdef WORLD_EDITOR + FEffectUpdator f(CTimer::Instance().GetElapsedSecond()); +#else + FEffectUpdator f(CTimer::Instance().GetCurrentSecond()-m_fLastTime); +#endif + f = std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(),f); + f = std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(),f); + f = std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(),f); + m_isAlive = f.isAlive; + + m_fLastTime = CTimer::Instance().GetCurrentSecond(); +} + +void CEffectInstance::OnRender() +{ + STATEMANAGER.SaveTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_NONE); + STATEMANAGER.SaveTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_NONE); + STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + STATEMANAGER.SaveRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + STATEMANAGER.SaveRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + STATEMANAGER.SaveRenderState(D3DRS_ALPHATESTENABLE, FALSE); + STATEMANAGER.SaveRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + STATEMANAGER.SaveRenderState(D3DRS_ZWRITEENABLE, FALSE); + ///// + + STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR); + STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TEXTURE); + STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); + STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR); + STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE); + STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); + STATEMANAGER.SetVertexShader(D3DFVF_XYZ|D3DFVF_TEX1); + std::for_each(m_ParticleInstanceVector.begin(),m_ParticleInstanceVector.end(),std::mem_fn(&CEffectElementBaseInstance::Render)); + std::for_each(m_MeshInstanceVector.begin(),m_MeshInstanceVector.end(),std::mem_fn(&CEffectElementBaseInstance::Render)); + + ///// + STATEMANAGER.RestoreTextureStageState(0, D3DTSS_MINFILTER); + STATEMANAGER.RestoreTextureStageState(0, D3DTSS_MAGFILTER); + STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE); + STATEMANAGER.RestoreRenderState(D3DRS_SRCBLEND); + STATEMANAGER.RestoreRenderState(D3DRS_DESTBLEND); + STATEMANAGER.RestoreRenderState(D3DRS_ALPHATESTENABLE); + STATEMANAGER.RestoreRenderState(D3DRS_CULLMODE); + STATEMANAGER.RestoreRenderState(D3DRS_ZWRITEENABLE); + + ++ms_iRenderingEffectCount; +} + +void CEffectInstance::SetGlobalMatrix(const D3DXMATRIX & c_rmatGlobal) +{ + m_matGlobal = c_rmatGlobal; +} + +BOOL CEffectInstance::isAlive() +{ + return m_isAlive; +} + +void CEffectInstance::SetActive() +{ + std::for_each( + m_ParticleInstanceVector.begin(), + m_ParticleInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetActive)); + std::for_each( + m_MeshInstanceVector.begin(), + m_MeshInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetActive)); + std::for_each( + m_LightInstanceVector.begin(), + m_LightInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetActive)); +} + +void CEffectInstance::SetDeactive() +{ + std::for_each( + m_ParticleInstanceVector.begin(), + m_ParticleInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetDeactive)); + std::for_each( + m_MeshInstanceVector.begin(), + m_MeshInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetDeactive)); + std::for_each( + m_LightInstanceVector.begin(), + m_LightInstanceVector.end(), + std::mem_fn(&CEffectElementBaseInstance::SetDeactive)); +} + +void CEffectInstance::__SetParticleData(CParticleSystemData * pData) +{ + CParticleSystemInstance * pInstance = CParticleSystemInstance::New(); + pInstance->SetDataPointer(pData); + pInstance->SetLocalMatrixPointer(&m_matGlobal); + + m_ParticleInstanceVector.push_back(pInstance); +} +void CEffectInstance::__SetMeshData(CEffectMeshScript * pMesh) +{ + CEffectMeshInstance * pMeshInstance = CEffectMeshInstance::New(); + pMeshInstance->SetDataPointer(pMesh); + pMeshInstance->SetLocalMatrixPointer(&m_matGlobal); + + m_MeshInstanceVector.push_back(pMeshInstance); +} + +void CEffectInstance::__SetLightData(CLightData* pData) +{ + CLightInstance * pInstance = CLightInstance::New(); + pInstance->SetDataPointer(pData); + pInstance->SetLocalMatrixPointer(&m_matGlobal); + + m_LightInstanceVector.push_back(pInstance); +} + +void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData) +{ + m_isAlive=true; + + m_pkEftData=pEffectData; + + m_fLastTime = CTimer::Instance().GetCurrentSecond(); + m_fBoundingSphereRadius = pEffectData->GetBoundingSphereRadius(); + m_v3BoundingSpherePosition = pEffectData->GetBoundingSpherePosition(); + + if (m_fBoundingSphereRadius > 0.0f) + CGraphicObjectInstance::RegisterBoundingSphere(); + + DWORD i; + + for (i = 0; i < pEffectData->GetParticleCount(); ++i) + { + CParticleSystemData * pParticle = pEffectData->GetParticlePointer(i); + + __SetParticleData(pParticle); + } + + for (i = 0; i < pEffectData->GetMeshCount(); ++i) + { + CEffectMeshScript * pMesh = pEffectData->GetMeshPointer(i); + + __SetMeshData(pMesh); + } + + for (i = 0; i < pEffectData->GetLightCount(); ++i) + { + CLightData * pLight = pEffectData->GetLightPointer(i); + + __SetLightData(pLight); + } + + m_pSoundInstanceVector = pEffectData->GetSoundInstanceVector(); +} + +bool CEffectInstance::GetBoundingSphere(D3DXVECTOR3 & v3Center, float & fRadius) +{ + v3Center.x = m_matGlobal._41 + m_v3BoundingSpherePosition.x; + v3Center.y = m_matGlobal._42 + m_v3BoundingSpherePosition.y; + v3Center.z = m_matGlobal._43 + m_v3BoundingSpherePosition.z; + fRadius = m_fBoundingSphereRadius; + return true; +} + +void CEffectInstance::Clear() +{ + if (!m_ParticleInstanceVector.empty()) + { + std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(), CParticleSystemInstance::Delete); + m_ParticleInstanceVector.clear(); + } + + if (!m_MeshInstanceVector.empty()) + { + std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(), CEffectMeshInstance::Delete); + m_MeshInstanceVector.clear(); + } + + if (!m_LightInstanceVector.empty()) + { + std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(), CLightInstance::Delete); + m_LightInstanceVector.clear(); + } + + __Initialize(); +} + +void CEffectInstance::__Initialize() +{ + m_isAlive = FALSE; + m_dwFrame = 0; + m_pSoundInstanceVector = NULL; + m_fBoundingSphereRadius = 0.0f; + m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f; + + m_pkEftData=NULL; + + D3DXMatrixIdentity(&m_matGlobal); +} + +CEffectInstance::CEffectInstance() +{ + __Initialize(); +} +CEffectInstance::~CEffectInstance() +{ + assert(m_ParticleInstanceVector.empty()); + assert(m_MeshInstanceVector.empty()); + assert(m_LightInstanceVector.empty()); +} diff --git a/extension/src/port/EffectLib/EffectManager.cpp b/extension/src/port/EffectLib/EffectManager.cpp new file mode 100644 index 00000000..dbf7401c --- /dev/null +++ b/extension/src/port/EffectLib/EffectManager.cpp @@ -0,0 +1,468 @@ +#include "StdAfx.h" +#include "../EterBase/Random.h" +#include "../EterLib/StateManager.h" +#include "EffectManager.h" + + + +void CEffectManager::GetInfo(std::string* pstInfo) +{ + char szInfo[256]; + + sprintf(szInfo, "Effect: Inst - ED %d, EI %d Pool - PSI %d, MI %d, LI %d, PI %d, EI %d, ED %d, PSD %d, EM %d, LD %d", + m_kEftDataMap.size(), + m_kEftInstMap.size(), + CParticleSystemInstance::ms_kPool.GetCapacity(), + CEffectMeshInstance::ms_kPool.GetCapacity(), + CLightInstance::ms_kPool.GetCapacity(), + CParticleInstance::ms_kPool.GetCapacity(), + //CRayParticleInstance::ms_kPool.GetCapacity(), + CEffectInstance::ms_kPool.GetCapacity(), + CEffectData::ms_kPool.GetCapacity(), + CParticleSystemData::ms_kPool.GetCapacity(), + CEffectMeshScript::ms_kPool.GetCapacity(), + CLightData::ms_kPool.GetCapacity() + ); + pstInfo->append(szInfo); +} + +void CEffectManager::UpdateSound() +{ + for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end(); ++itor) + { + CEffectInstance * pEffectInstance = itor->second; + + pEffectInstance->UpdateSound(); + } +} + +bool CEffectManager::IsAliveEffect(DWORD dwInstanceIndex) +{ + TEffectInstanceMap::iterator f = m_kEftInstMap.find(dwInstanceIndex); + if (m_kEftInstMap.end()==f) + return false; + + return f->second->isAlive() ? true : false; +} + +void CEffectManager::Update() +{ + + // 2004. 3. 1. myevan. 이펙트 모니터링 하는 코드 + /* + if (GetAsyncKeyState(VK_F9)) + { + Tracenf("CEffectManager::m_EffectInstancePool %d", m_EffectInstancePool.GetCapacity()); + Tracenf("CEffectManager::m_EffectDataPool %d", m_EffectDataPool.GetCapacity()); + Tracenf("CEffectInstance::ms_LightInstancePool %d", CEffectInstance::ms_LightInstancePool.GetCapacity()); + Tracenf("CEffectInstance::ms_MeshInstancePool %d", CEffectInstance::ms_MeshInstancePool.GetCapacity()); + Tracenf("CEffectInstance::ms_ParticleSystemInstancePool %d", CEffectInstance::ms_ParticleSystemInstancePool.GetCapacity()); + Tracenf("CParticleInstance::ms_ParticleInstancePool %d", CParticleInstance::ms_kPool.GetCapacity()); + Tracenf("CRayParticleInstance::ms_RayParticleInstancePool %d", CRayParticleInstance::ms_kPool.GetCapacity()); + Tracen("---------------------------------------------"); + } + */ + + for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end();) + { + CEffectInstance * pEffectInstance = itor->second; + + pEffectInstance->Update(/*fElapsedTime*/); + + if (!pEffectInstance->isAlive()) + { + itor = m_kEftInstMap.erase(itor); + + CEffectInstance::Delete(pEffectInstance); + } + else + { + ++itor; + } + } +} + + +struct CEffectManager_LessEffectInstancePtrRenderOrder +{ + bool operator() (CEffectInstance* pkLeft, CEffectInstance* pkRight) + { + return pkLeft->LessRenderOrder(pkRight); + } +}; + +struct CEffectManager_FEffectInstanceRender +{ + inline void operator () (CEffectInstance * pkEftInst) + { + pkEftInst->Render(); + } +}; + +void CEffectManager::Render() +{ + STATEMANAGER.SetTexture(0, NULL); + STATEMANAGER.SetTexture(1, NULL); + + if (m_isDisableSortRendering) + { + for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end();) + { + CEffectInstance * pEffectInstance = itor->second; + pEffectInstance->Render(); + ++itor; + } + } + else + { + static std::vector s_kVct_pkEftInstSort; + s_kVct_pkEftInstSort.clear(); + + TEffectInstanceMap& rkMap_pkEftInstSrc=m_kEftInstMap; + TEffectInstanceMap::iterator i; + for (i=rkMap_pkEftInstSrc.begin(); i!=rkMap_pkEftInstSrc.end(); ++i) + s_kVct_pkEftInstSort.push_back(i->second); + + std::sort(s_kVct_pkEftInstSort.begin(), s_kVct_pkEftInstSort.end(), CEffectManager_LessEffectInstancePtrRenderOrder()); + std::for_each(s_kVct_pkEftInstSort.begin(), s_kVct_pkEftInstSort.end(), CEffectManager_FEffectInstanceRender()); + } +} + +BOOL CEffectManager::RegisterEffect(const char * c_szFileName,bool isExistDelete,bool isNeedCache) +{ + std::string strFileName; + StringPath(c_szFileName, strFileName); + DWORD dwCRC = GetCaseCRC32(strFileName.c_str(), strFileName.length()); + + TEffectDataMap::iterator itor = m_kEftDataMap.find(dwCRC); + if (m_kEftDataMap.end() != itor) + { + if (isExistDelete) + { + CEffectData* pkEftData=itor->second; + CEffectData::Delete(pkEftData); + m_kEftDataMap.erase(itor); + } + else + { + //TraceError("CEffectManager::RegisterEffect - m_kEftDataMap.find [%s] Already Exist", c_szFileName); + return TRUE; + } + } + + CEffectData * pkEftData = CEffectData::New(); + + if (!pkEftData->LoadScript(c_szFileName)) + { + TraceError("CEffectManager::RegisterEffect - LoadScript(%s) Error", c_szFileName); + CEffectData::Delete(pkEftData); + return FALSE; + } + + m_kEftDataMap.insert(TEffectDataMap::value_type(dwCRC, pkEftData)); + + if (isNeedCache) + { + if (m_kEftCacheMap.find(dwCRC)==m_kEftCacheMap.end()) + { + CEffectInstance* pkNewEftInst=CEffectInstance::New(); + pkNewEftInst->SetEffectDataPointer(pkEftData); + m_kEftCacheMap.insert(TEffectInstanceMap::value_type(dwCRC, pkNewEftInst)); + } + } + + return TRUE; +} +// CEffectData 를 포인터형으로 리턴하게 하고.. +// CEffectData에서 CRC를 얻을수 있게 한다 +BOOL CEffectManager::RegisterEffect2(const char * c_szFileName, DWORD* pdwRetCRC, bool isNeedCache) +{ + std::string strFileName; + StringPath(c_szFileName, strFileName); + DWORD dwCRC = GetCaseCRC32(strFileName.c_str(), strFileName.length()); + *pdwRetCRC=dwCRC; + + return RegisterEffect(c_szFileName,false,isNeedCache); +} + +int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation) +{ + DWORD dwID = GetCaseCRC32(c_szFileName, strlen(c_szFileName)); + return CreateEffect(dwID, c_rv3Position, c_rv3Rotation); +} + +int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation) +{ + int iInstanceIndex = GetEmptyIndex(); + + CreateEffectInstance(iInstanceIndex, dwID); + SelectEffectInstance(iInstanceIndex); + D3DXMATRIX mat; + D3DXMatrixRotationYawPitchRoll(&mat,D3DXToRadian(c_rv3Rotation.x),D3DXToRadian(c_rv3Rotation.y),D3DXToRadian(c_rv3Rotation.z)); + mat._41 = c_rv3Position.x; + mat._42 = c_rv3Position.y; + mat._43 = c_rv3Position.z; + SetEffectInstanceGlobalMatrix(mat); + + return iInstanceIndex; +} + +void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID) +{ + if (!dwID) + return; + + CEffectData * pEffect; + if (!GetEffectData(dwID, &pEffect)) + { + Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwID); + return; + } + + CEffectInstance * pEffectInstance = CEffectInstance::New(); + pEffectInstance->SetEffectDataPointer(pEffect); + + m_kEftInstMap.insert(TEffectInstanceMap::value_type(dwInstanceIndex, pEffectInstance)); +} + +bool CEffectManager::DestroyEffectInstance(DWORD dwInstanceIndex) +{ + TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex); + + if (itor == m_kEftInstMap.end()) + return false; + + CEffectInstance * pEffectInstance = itor->second; + + m_kEftInstMap.erase(itor); + + CEffectInstance::Delete(pEffectInstance); + + return true; +} + +void CEffectManager::DeactiveEffectInstance(DWORD dwInstanceIndex) +{ + TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex); + + if (itor == m_kEftInstMap.end()) + return; + + CEffectInstance * pEffectInstance = itor->second; + pEffectInstance->SetDeactive(); +} + +void CEffectManager::CreateUnsafeEffectInstance(DWORD dwEffectDataID, CEffectInstance ** ppEffectInstance) +{ + CEffectData * pEffect; + if (!GetEffectData(dwEffectDataID, &pEffect)) + { + Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwEffectDataID); + return; + } + + CEffectInstance* pkEftInstNew=CEffectInstance::New(); + pkEftInstNew->SetEffectDataPointer(pEffect); + + *ppEffectInstance = pkEftInstNew; +} + +bool CEffectManager::DestroyUnsafeEffectInstance(CEffectInstance * pEffectInstance) +{ + if (!pEffectInstance) + return false; + + CEffectInstance::Delete(pEffectInstance); + + return true; +} + +BOOL CEffectManager::SelectEffectInstance(DWORD dwInstanceIndex) +{ + TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex); + + m_pSelectedEffectInstance = NULL; + + if (m_kEftInstMap.end() == itor) + return FALSE; + + m_pSelectedEffectInstance = itor->second; + + return TRUE; +} + +void CEffectManager::SetEffectTextures(DWORD dwID, std::vector textures) +{ + CEffectData * pEffectData; + if (!GetEffectData(dwID, &pEffectData)) + { + Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwID); + return; + } + + for(DWORD i = 0; i < textures.size(); i++) + { + CParticleSystemData * pParticle = pEffectData->GetParticlePointer(i); + pParticle->ChangeTexture(textures.at(i).c_str()); + } +} + +void CEffectManager::SetEffectInstancePosition(const D3DXVECTOR3 & c_rv3Position) +{ + if (!m_pSelectedEffectInstance) + { +// assert(!"Instance to use is not yet set!"); + return; + } + + m_pSelectedEffectInstance->SetPosition(c_rv3Position); +} + +void CEffectManager::SetEffectInstanceRotation(const D3DXVECTOR3 & c_rv3Rotation) +{ + if (!m_pSelectedEffectInstance) + { +// assert(!"Instance to use is not yet set!"); + return; + } + + m_pSelectedEffectInstance->SetRotation(c_rv3Rotation.x,c_rv3Rotation.y,c_rv3Rotation.z); +} + +void CEffectManager::SetEffectInstanceGlobalMatrix(const D3DXMATRIX & c_rmatGlobal) +{ + if (!m_pSelectedEffectInstance) + return; + + m_pSelectedEffectInstance->SetGlobalMatrix(c_rmatGlobal); +} + +void CEffectManager::ShowEffect() +{ + if (!m_pSelectedEffectInstance) + return; + + m_pSelectedEffectInstance->Show(); +} + +void CEffectManager::HideEffect() +{ + if (!m_pSelectedEffectInstance) + return; + + m_pSelectedEffectInstance->Hide(); +} + +bool CEffectManager::GetEffectData(DWORD dwID, CEffectData ** ppEffect) +{ + TEffectDataMap::iterator itor = m_kEftDataMap.find(dwID); + + if (itor == m_kEftDataMap.end()) + return false; + + *ppEffect = itor->second; + + return true; +} + +bool CEffectManager::GetEffectData(DWORD dwID, const CEffectData ** c_ppEffect) +{ + TEffectDataMap::iterator itor = m_kEftDataMap.find(dwID); + + if (itor == m_kEftDataMap.end()) + return false; + + *c_ppEffect = itor->second; + + return true; +} + +DWORD CEffectManager::GetRandomEffect() +{ + int iIndex = random() % m_kEftDataMap.size(); + + TEffectDataMap::iterator itor = m_kEftDataMap.begin(); + for (int i = 0; i < iIndex; ++i, ++itor); + + return itor->first; +} + +int CEffectManager::GetEmptyIndex() +{ + static int iMaxIndex=1; + + if (iMaxIndex>2100000000) + iMaxIndex = 1; + + int iNextIndex = iMaxIndex++; + while(m_kEftInstMap.find(iNextIndex) != m_kEftInstMap.end()) + iNextIndex++; + + return iNextIndex; +} + +void CEffectManager::DeleteAllInstances() +{ + __DestroyEffectInstanceMap(); +} + +void CEffectManager::__DestroyEffectInstanceMap() +{ + for (TEffectInstanceMap::iterator i = m_kEftInstMap.begin(); i != m_kEftInstMap.end(); ++i) + { + CEffectInstance * pkEftInst = i->second; + CEffectInstance::Delete(pkEftInst); + } + + m_kEftInstMap.clear(); +} + +void CEffectManager::__DestroyEffectCacheMap() +{ + for (TEffectInstanceMap::iterator i = m_kEftCacheMap.begin(); i != m_kEftCacheMap.end(); ++i) + { + CEffectInstance * pkEftInst = i->second; + CEffectInstance::Delete(pkEftInst); + } + + m_kEftCacheMap.clear(); +} + +void CEffectManager::__DestroyEffectDataMap() +{ + for (TEffectDataMap::iterator i = m_kEftDataMap.begin(); i != m_kEftDataMap.end(); ++i) + { + CEffectData * pData = i->second; + CEffectData::Delete(pData); + } + + m_kEftDataMap.clear(); +} + +void CEffectManager::Destroy() +{ + __DestroyEffectInstanceMap(); + __DestroyEffectCacheMap(); + __DestroyEffectDataMap(); + + __Initialize(); +} + +void CEffectManager::__Initialize() +{ + m_pSelectedEffectInstance = NULL; + m_isDisableSortRendering = false; +} + +CEffectManager::CEffectManager() +{ + __Initialize(); +} + +CEffectManager::~CEffectManager() +{ + Destroy(); +} + +// just for map effect + diff --git a/extension/src/port/EffectLib/EffectMesh.cpp b/extension/src/port/EffectLib/EffectMesh.cpp new file mode 100644 index 00000000..e1e78a35 --- /dev/null +++ b/extension/src/port/EffectLib/EffectMesh.cpp @@ -0,0 +1,699 @@ +#include "StdAfx.h" +#include "../EterLib/StateManager.h" +#include "../EterLib/ResourceManager.h" +#include "../EterPack/EterPackManager.h" +#include "EffectMesh.h" + +CDynamicPool CEffectMesh::SEffectMeshData::ms_kPool; + +CEffectMesh::SEffectMeshData* CEffectMesh::SEffectMeshData::New() +{ + return ms_kPool.Alloc(); +} + +void CEffectMesh::SEffectMeshData::Delete(SEffectMeshData* pkData) +{ + pkData->EffectFrameDataVector.clear(); + pkData->pImageVector.clear(); + + ms_kPool.Free(pkData); +} + +void CEffectMesh::SEffectMeshData::DestroySystem() +{ + ms_kPool.Destroy(); +} + + +DWORD CEffectMesh::GetFrameCount() +{ + return m_iFrameCount; +} + +DWORD CEffectMesh::GetMeshCount() +{ + return m_pEffectMeshDataVector.size(); +} + +CEffectMesh::TEffectMeshData * CEffectMesh::GetMeshDataPointer(DWORD dwMeshIndex) +{ + assert(dwMeshIndex < m_pEffectMeshDataVector.size()); + return m_pEffectMeshDataVector[dwMeshIndex]; +} + +std::vector* CEffectMesh::GetTextureVectorPointer(DWORD dwMeshIndex) +{ + if (dwMeshIndex>=m_pEffectMeshDataVector.size()) + return NULL; + + return &m_pEffectMeshDataVector[dwMeshIndex]->pImageVector; +} + +std::vector & CEffectMesh::GetTextureVectorReference(DWORD dwMeshIndex) +{ + return m_pEffectMeshDataVector[dwMeshIndex]->pImageVector; +} + +CEffectMesh::TType CEffectMesh::Type() +{ + static TType s_type = StringToType("CEffectMesh"); + return s_type; +} + +bool CEffectMesh::OnIsType(TType type) +{ + if (CEffectMesh::Type() == type) + return true; + + return CResource::OnIsType(type); +} + +bool CEffectMesh::OnLoad(int iSize, const void * c_pvBuf) +{ + if (!c_pvBuf) + return false; + + const BYTE * c_pbBuf = static_cast (c_pvBuf); + + char szHeader[10+1]; + memcpy(szHeader, c_pbBuf, 10+1); + c_pbBuf += 10+1; + + if (0 == strcmp("EffectData", szHeader)) + { + if (!__LoadData_Ver001(iSize, c_pbBuf)) + return false; + } + else if (0 == strcmp("MDEData002", szHeader)) + { + if (!__LoadData_Ver002(iSize, c_pbBuf)) + return false; + } + else + { + return false; + } + + m_isData = true; + return true; +} + +BOOL CEffectMesh::__LoadData_Ver002(int iSize, const BYTE * c_pbBuf) +{ + std::vector v3VertexVector; + std::vector iIndexVector; + std::vector v3TextureVertexVector; + std::vector iTextureIndexVector; + + m_iGeomCount = *(int *)c_pbBuf; + c_pbBuf += 4; + m_iFrameCount = *(int *)c_pbBuf; + c_pbBuf += 4; + + m_pEffectMeshDataVector.clear(); + m_pEffectMeshDataVector.resize(m_iGeomCount); + + for (short n = 0; n < m_iGeomCount; ++n) + { + SEffectMeshData * pMeshData = SEffectMeshData::New(); + + memcpy(pMeshData->szObjectName, c_pbBuf, 32); + c_pbBuf += 32; + memcpy(pMeshData->szDiffuseMapFileName, c_pbBuf, 128); + c_pbBuf += 128; + + pMeshData->EffectFrameDataVector.clear(); + pMeshData->EffectFrameDataVector.resize(m_iFrameCount); + + for(int i = 0; i < m_iFrameCount; ++i) + { + TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[i]; + + memcpy(&rFrameData.byChangedFrame, c_pbBuf, sizeof(BYTE)); + c_pbBuf += sizeof(BYTE); + + memcpy(&rFrameData.fVisibility, c_pbBuf, sizeof(float)); + c_pbBuf += sizeof(float); + + memcpy(&rFrameData.dwVertexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + memcpy(&rFrameData.dwIndexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + memcpy(&rFrameData.dwTextureVertexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + v3VertexVector.clear(); + v3VertexVector.resize(rFrameData.dwVertexCount); + iIndexVector.clear(); + iIndexVector.resize(rFrameData.dwIndexCount); + v3TextureVertexVector.clear(); + v3TextureVertexVector.resize(rFrameData.dwTextureVertexCount); + iTextureIndexVector.clear(); + iTextureIndexVector.resize(rFrameData.dwIndexCount); + + memcpy(&v3VertexVector[0], c_pbBuf, rFrameData.dwVertexCount*sizeof(D3DXVECTOR3)); + c_pbBuf += rFrameData.dwVertexCount*sizeof(D3DXVECTOR3); + memcpy(&iIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int)); + c_pbBuf += rFrameData.dwIndexCount*sizeof(int); + memcpy(&v3TextureVertexVector[0], c_pbBuf, rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2)); + c_pbBuf += rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2); + memcpy(&iTextureIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int)); + c_pbBuf += rFrameData.dwIndexCount*sizeof(int); + + /////////////////////////////// + + rFrameData.PDTVertexVector.clear(); + rFrameData.PDTVertexVector.resize(rFrameData.dwIndexCount); + for (DWORD j = 0; j < rFrameData.dwIndexCount; ++j) + { + TPTVertex & rVertex = rFrameData.PDTVertexVector[j]; + + DWORD dwIndex = iIndexVector[j]; + DWORD dwTextureIndex = iTextureIndexVector[j]; + + assert(dwIndex < v3VertexVector.size()); + assert(dwTextureIndex < v3TextureVertexVector.size()); + + rVertex.position = v3VertexVector[dwIndex]; + rVertex.texCoord = v3TextureVertexVector[dwTextureIndex]; + rVertex.texCoord.y *= -1; + } + } + + //////////////////////////////////// + + pMeshData->pImageVector.clear(); + + std::string strExtension; + GetFileExtension(pMeshData->szDiffuseMapFileName, strlen(pMeshData->szDiffuseMapFileName), &strExtension); + stl_lowers(strExtension); + + if (0 == strExtension.compare("ifl")) + { + LPCVOID pMotionData; + CMappedFile File; + + if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData)) + { + CMemoryTextFileLoader textFileLoader; + std::vector stTokenVector; + + textFileLoader.Bind(File.Size(), pMotionData); + + std::string strPathName; + GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName); + + std::string strTextureFileName; + for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i) + { + const std::string & c_rstrFileName = textFileLoader.GetLineString(i); + + if (c_rstrFileName.empty()) + continue; + + strTextureFileName = strPathName; + strTextureFileName += c_rstrFileName; + + CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strTextureFileName.c_str()); + + pMeshData->pImageVector.push_back(pImage); + } + } + } + else + { + CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(pMeshData->szDiffuseMapFileName); + + pMeshData->pImageVector.push_back(pImage); + } + + //////////////////////////////////// + + m_pEffectMeshDataVector[n] = pMeshData; + } + + return TRUE; +} + +BOOL CEffectMesh::__LoadData_Ver001(int iSize, const BYTE * c_pbBuf) +{ + std::vector v3VertexVector; + std::vector iIndexVector; + std::vector v3TextureVertexVector; + std::vector iTextureIndexVector; + + m_iGeomCount = *(int *)c_pbBuf; + c_pbBuf += 4; + m_iFrameCount = *(int *)c_pbBuf; + c_pbBuf += 4; + + m_pEffectMeshDataVector.clear(); + m_pEffectMeshDataVector.resize(m_iGeomCount); + + for (short n = 0; n < m_iGeomCount; ++n) + { + SEffectMeshData * pMeshData = SEffectMeshData::New(); + + memcpy(pMeshData->szObjectName, c_pbBuf, 32); + c_pbBuf += 32; + memcpy(pMeshData->szDiffuseMapFileName, c_pbBuf, 128); + c_pbBuf += 128; + + // + + DWORD dwVertexCount; + DWORD dwIndexCount; + DWORD dwTextureVertexCount; + + memcpy(&dwVertexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + memcpy(&dwIndexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + memcpy(&dwTextureVertexCount, c_pbBuf, sizeof(DWORD)); + c_pbBuf += sizeof(DWORD); + + pMeshData->EffectFrameDataVector.clear(); + pMeshData->EffectFrameDataVector.resize(m_iFrameCount); + + for(int i = 0; i < m_iFrameCount; ++i) + { + TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[i]; + + rFrameData.dwVertexCount = dwVertexCount; + rFrameData.dwIndexCount = dwIndexCount; + rFrameData.dwTextureVertexCount = dwTextureVertexCount; + + v3VertexVector.clear(); + v3VertexVector.resize(rFrameData.dwVertexCount); + iIndexVector.clear(); + iIndexVector.resize(rFrameData.dwIndexCount); + v3TextureVertexVector.clear(); + v3TextureVertexVector.resize(rFrameData.dwTextureVertexCount); + iTextureIndexVector.clear(); + iTextureIndexVector.resize(rFrameData.dwIndexCount); + + memcpy(&rFrameData.fVisibility, c_pbBuf, sizeof(float)); + c_pbBuf += sizeof(float); + memcpy(&v3VertexVector[0], c_pbBuf, rFrameData.dwVertexCount*sizeof(D3DXVECTOR3)); + c_pbBuf += rFrameData.dwVertexCount*sizeof(D3DXVECTOR3); + memcpy(&iIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int)); + c_pbBuf += rFrameData.dwIndexCount*sizeof(int); + memcpy(&v3TextureVertexVector[0], c_pbBuf, rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2)); + c_pbBuf += rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2); + memcpy(&iTextureIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int)); + c_pbBuf += rFrameData.dwIndexCount*sizeof(int); + + /////////////////////////////// + + rFrameData.PDTVertexVector.clear(); + rFrameData.PDTVertexVector.resize(rFrameData.dwIndexCount); + for (DWORD j = 0; j < rFrameData.dwIndexCount; ++j) + { + TPTVertex & rVertex = rFrameData.PDTVertexVector[j]; + + DWORD dwIndex = iIndexVector[j]; + DWORD dwTextureIndex = iTextureIndexVector[j]; + + assert(dwIndex < v3VertexVector.size()); + assert(dwTextureIndex < v3TextureVertexVector.size()); + + rVertex.position = v3VertexVector[dwIndex]; + rVertex.texCoord = v3TextureVertexVector[dwTextureIndex]; + rVertex.texCoord.y *= -1; + } + } + + //////////////////////////////////// + + pMeshData->pImageVector.clear(); + + std::string strExtension; + GetFileExtension(pMeshData->szDiffuseMapFileName, strlen(pMeshData->szDiffuseMapFileName), &strExtension); + stl_lowers(strExtension); + + if (0 == strExtension.compare("ifl")) + { + LPCVOID pMotionData; + CMappedFile File; + + if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData)) + { + CMemoryTextFileLoader textFileLoader; + std::vector stTokenVector; + + textFileLoader.Bind(File.Size(), pMotionData); + + std::string strPathName; + GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName); + + std::string strTextureFileName; + for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i) + { + const std::string & c_rstrFileName = textFileLoader.GetLineString(i); + + if (c_rstrFileName.empty()) + continue; + + strTextureFileName = strPathName; + strTextureFileName += c_rstrFileName; + + CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strTextureFileName.c_str()); + + pMeshData->pImageVector.push_back(pImage); + } + } + } + else + { + CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(pMeshData->szDiffuseMapFileName); + + pMeshData->pImageVector.push_back(pImage); + } + + //////////////////////////////////// + + m_pEffectMeshDataVector[n] = pMeshData; + } + + return TRUE; +} + +BOOL CEffectMesh::GetMeshElementPointer(DWORD dwMeshIndex, TEffectMeshData ** ppMeshData) +{ + if (dwMeshIndex >= m_pEffectMeshDataVector.size()) + return FALSE; + + *ppMeshData = m_pEffectMeshDataVector[dwMeshIndex]; + + return TRUE; +} + +void CEffectMesh::OnClear() +{ + if (!m_isData) + return; + + for (DWORD i = 0; i < m_pEffectMeshDataVector.size(); ++i) + { + m_pEffectMeshDataVector[i]->pImageVector.clear(); + m_pEffectMeshDataVector[i]->EffectFrameDataVector.clear(); + + SEffectMeshData::Delete(m_pEffectMeshDataVector[i]); + } + m_pEffectMeshDataVector.clear(); + + m_isData = false; +} + +bool CEffectMesh::OnIsEmpty() const +{ + return !m_isData; +} + +CEffectMesh::CEffectMesh(const char * c_szFileName) : CResource(c_szFileName) +{ + m_iGeomCount = 0; + m_iFrameCount = 0; + m_isData = false; +} + +CEffectMesh::~CEffectMesh() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////// + +CDynamicPool CEffectMeshScript::ms_kPool; + +void CEffectMeshScript::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CEffectMeshScript* CEffectMeshScript::New() +{ + return ms_kPool.Alloc(); +} + +void CEffectMeshScript::Delete(CEffectMeshScript* pkData) +{ + pkData->Clear(); + ms_kPool.Free(pkData); +} + +void CEffectMeshScript::ReserveMeshData(DWORD dwMeshCount) +{ + if (m_MeshDataVector.size() == dwMeshCount) + return; + + m_MeshDataVector.clear(); + m_MeshDataVector.resize(dwMeshCount); + + for (DWORD i = 0; i < m_MeshDataVector.size(); ++i) + { + TMeshData & rMeshData = m_MeshDataVector[i]; + + rMeshData.byBillboardType = MESH_BILLBOARD_TYPE_NONE; + rMeshData.bBlendingEnable = TRUE; + rMeshData.byBlendingSrcType = D3DBLEND_SRCCOLOR; + rMeshData.byBlendingDestType = D3DBLEND_ONE; + rMeshData.bTextureAlphaEnable = FALSE; + + rMeshData.byColorOperationType = D3DTOP_MODULATE; + rMeshData.ColorFactor = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); + + rMeshData.bTextureAnimationLoopEnable = true; + rMeshData.fTextureAnimationFrameDelay = 0.02f; + rMeshData.dwTextureAnimationStartFrame = 0; + } +} + +const char * CEffectMeshScript::GetMeshFileName() +{ + return m_strMeshFileName.c_str(); +} + +bool CEffectMeshScript::CheckMeshIndex(DWORD dwMeshIndex) +{ + if (dwMeshIndex >= m_MeshDataVector.size()) + return false; + + return true; +} + +bool CEffectMeshScript::GetMeshDataPointer(DWORD dwMeshIndex, TMeshData ** ppMeshData) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return false; + + *ppMeshData = &m_MeshDataVector[dwMeshIndex]; + + return true; +} + +int CEffectMeshScript::GetMeshDataCount() +{ + return m_MeshDataVector.size(); +} + +int CEffectMeshScript::GetBillboardType(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return 0; + + return m_MeshDataVector[dwMeshIndex].byBillboardType; +} +BOOL CEffectMeshScript::isBlendingEnable(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return FALSE; + + return m_MeshDataVector[dwMeshIndex].bBlendingEnable; +} +BYTE CEffectMeshScript::GetBlendingSrcType(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return false; + + return m_MeshDataVector[dwMeshIndex].byBlendingSrcType; +} +BYTE CEffectMeshScript::GetBlendingDestType(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return false; + + return m_MeshDataVector[dwMeshIndex].byBlendingDestType; +} +BOOL CEffectMeshScript::isTextureAlphaEnable(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return false; + + return m_MeshDataVector[dwMeshIndex].bTextureAlphaEnable; +} + +BOOL CEffectMeshScript::GetColorOperationType(DWORD dwMeshIndex, BYTE * pbyType) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return FALSE; + + *pbyType = m_MeshDataVector[dwMeshIndex].byColorOperationType; + + return TRUE; +} +BOOL CEffectMeshScript::GetColorFactor(DWORD dwMeshIndex, D3DXCOLOR * pColor) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return FALSE; + + *pColor = m_MeshDataVector[dwMeshIndex].ColorFactor; + + return TRUE; +} + +BOOL CEffectMeshScript::GetTimeTableAlphaPointer(DWORD dwMeshIndex, TTimeEventTableFloat ** pTimeEventAlpha) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return FALSE; + + *pTimeEventAlpha = &m_MeshDataVector[dwMeshIndex].TimeEventAlpha; + + return TRUE; +} + + +BOOL CEffectMeshScript::isMeshAnimationLoop() +{ + return m_isMeshAnimationLoop; +} +int CEffectMeshScript::GetMeshAnimationLoopCount() +{ + return m_iMeshAnimationLoopCount; +} +float CEffectMeshScript::GetMeshAnimationFrameDelay() +{ + return m_fMeshAnimationFrameDelay; +} + +BOOL CEffectMeshScript::isTextureAnimationLoop(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return 0.0f; + + return m_MeshDataVector[dwMeshIndex].bTextureAnimationLoopEnable; +} +float CEffectMeshScript::GetTextureAnimationFrameDelay(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return 0.0f; + + return m_MeshDataVector[dwMeshIndex].fTextureAnimationFrameDelay; +} + +DWORD CEffectMeshScript::GetTextureAnimationStartFrame(DWORD dwMeshIndex) +{ + if (!CheckMeshIndex(dwMeshIndex)) + return 0; + + return m_MeshDataVector[dwMeshIndex].dwTextureAnimationStartFrame; +} + +BOOL CEffectMeshScript::OnLoadScript(CTextFileLoader & rTextFileLoader) +{ + if (rTextFileLoader.GetTokenString("meshfilename", &m_strMeshFileName)) + { + if (!IsGlobalFileName(m_strMeshFileName.c_str())) + { + m_strMeshFileName = GetOnlyPathName(rTextFileLoader.GetFileName()) + m_strMeshFileName; + } + } + else + { + return FALSE; + } + + if (!rTextFileLoader.GetTokenInteger("meshanimationloopenable", &m_isMeshAnimationLoop)) + return FALSE; + if (!rTextFileLoader.GetTokenInteger("meshanimationloopcount", &m_iMeshAnimationLoopCount)) + { + m_iMeshAnimationLoopCount = 0; + } + if (!rTextFileLoader.GetTokenFloat("meshanimationframedelay", &m_fMeshAnimationFrameDelay)) + return FALSE; + + DWORD dwMeshElementCount; + if (!rTextFileLoader.GetTokenDoubleWord("meshelementcount", &dwMeshElementCount)) + return FALSE; + + m_MeshDataVector.clear(); + m_MeshDataVector.resize(dwMeshElementCount); + for (DWORD i = 0; i < m_MeshDataVector.size(); ++i) + { + CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, i); + + TMeshData & rMeshData = m_MeshDataVector[i]; + + if (!rTextFileLoader.GetTokenByte("billboardtype", &rMeshData.byBillboardType)) + return FALSE; + if (!rTextFileLoader.GetTokenBoolean("blendingenable", &rMeshData.bBlendingEnable)) + return FALSE; + if (!rTextFileLoader.GetTokenByte("blendingsrctype", &rMeshData.byBlendingSrcType)) + return FALSE; + if (!rTextFileLoader.GetTokenByte("blendingdesttype", &rMeshData.byBlendingDestType)) + return FALSE; + + if (!rTextFileLoader.GetTokenBoolean("textureanimationloopenable", &rMeshData.bTextureAnimationLoopEnable)) + return FALSE; + if (!rTextFileLoader.GetTokenFloat("textureanimationframedelay", &rMeshData.fTextureAnimationFrameDelay)) + return FALSE; + if (!rTextFileLoader.GetTokenDoubleWord("textureanimationstartframe", &rMeshData.dwTextureAnimationStartFrame)) + { + rMeshData.dwTextureAnimationStartFrame = 0; + } + + if (!rTextFileLoader.GetTokenByte("coloroperationtype", &rMeshData.byColorOperationType)) + { + rMeshData.byColorOperationType = D3DTOP_MODULATE; + } + if (!rTextFileLoader.GetTokenColor("colorfactor", &rMeshData.ColorFactor)) + { + rMeshData.ColorFactor = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); + } + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &rMeshData.TimeEventAlpha)) + { + rMeshData.TimeEventAlpha.clear(); + } + } + + return TRUE; +} + +bool CEffectMeshScript::OnIsData() +{ + if (0 == m_strMeshFileName.length()) + return false; + + return true; +} + +void CEffectMeshScript::OnClear() +{ + m_isMeshAnimationLoop = false; + m_iMeshAnimationLoopCount = 0; + m_fMeshAnimationFrameDelay = 0.02f; + + m_MeshDataVector.clear(); + m_strMeshFileName = ""; +} + +CEffectMeshScript::CEffectMeshScript() +{ +} +CEffectMeshScript::~CEffectMeshScript() +{ +} diff --git a/extension/src/port/EffectLib/EffectMeshInstance.cpp b/extension/src/port/EffectLib/EffectMeshInstance.cpp new file mode 100644 index 00000000..ecc8b5f0 --- /dev/null +++ b/extension/src/port/EffectLib/EffectMeshInstance.cpp @@ -0,0 +1,271 @@ +#include "StdAfx.h" +#include "../EterLib/StateManager.h" +#include "../EterLib/ResourceManager.h" +#include "EffectMeshInstance.h" +#include "../EterLib/GrpMath.h" + +CDynamicPool CEffectMeshInstance::ms_kPool; + +void CEffectMeshInstance::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CEffectMeshInstance* CEffectMeshInstance::New() +{ + return ms_kPool.Alloc(); +} + +void CEffectMeshInstance::Delete(CEffectMeshInstance* pkMeshInstance) +{ + pkMeshInstance->Destroy(); + ms_kPool.Free(pkMeshInstance); +} + +BOOL CEffectMeshInstance::isActive() +{ + if (!CEffectElementBaseInstance::isActive()) + return FALSE; + + if (!m_MeshFrameController.isActive()) + return FALSE; + + for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j) + { + int iCurrentFrame = m_MeshFrameController.GetCurrentFrame(); + if (m_TextureInstanceVector[j].TextureFrameController.isActive(iCurrentFrame)) + return TRUE; + } + + return FALSE; +} + +bool CEffectMeshInstance::OnUpdate(float fElapsedTime) +{ + if (!isActive()) + return false; + + if (m_MeshFrameController.isActive()) + m_MeshFrameController.Update(fElapsedTime); + + for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j) + { + int iCurrentFrame = m_MeshFrameController.GetCurrentFrame(); + if (m_TextureInstanceVector[j].TextureFrameController.isActive(iCurrentFrame)) + m_TextureInstanceVector[j].TextureFrameController.Update(fElapsedTime); + } + + return true; +} + +void CEffectMeshInstance::OnRender() +{ + if (!isActive()) + return; + + CEffectMesh * pEffectMesh = m_roMesh.GetPointer(); + + for (DWORD i = 0; i < pEffectMesh->GetMeshCount(); ++i) + { + assert(i < m_TextureInstanceVector.size()); + + CFrameController & rTextureFrameController = m_TextureInstanceVector[i].TextureFrameController; + if (!rTextureFrameController.isActive(m_MeshFrameController.GetCurrentFrame())) + continue; + + int iBillboardType = m_pMeshScript->GetBillboardType(i); + + D3DXMATRIX m_matWorld; + D3DXMatrixIdentity(&m_matWorld); + + switch(iBillboardType) + { + case MESH_BILLBOARD_TYPE_ALL: + { + D3DXMATRIX matTemp; + D3DXMatrixRotationX(&matTemp, 90.0f); + D3DXMatrixInverse(&m_matWorld, NULL, &CScreen::GetViewMatrix()); + + m_matWorld = matTemp * m_matWorld; + } + break; + + case MESH_BILLBOARD_TYPE_Y: + { + D3DXMATRIX matTemp; + D3DXMatrixIdentity(&matTemp); + + D3DXMatrixInverse(&matTemp, NULL, &CScreen::GetViewMatrix()); + m_matWorld._11 = matTemp._11; + m_matWorld._12 = matTemp._12; + m_matWorld._21 = matTemp._21; + m_matWorld._22 = matTemp._22; + } + break; + + case MESH_BILLBOARD_TYPE_MOVE: + { + D3DXVECTOR3 Position; + m_pMeshScript->GetPosition(m_fLocalTime, Position); + D3DXVECTOR3 LastPosition; + m_pMeshScript->GetPosition(m_fLocalTime-CTimer::Instance().GetElapsedSecond(), LastPosition); + Position -= LastPosition; + if (D3DXVec3LengthSq(&Position)>0.001f) + { + D3DXVec3Normalize(&Position,&Position); + D3DXQUATERNION q = SafeRotationNormalizedArc(D3DXVECTOR3(0.0f,-1.0f,0.0f),Position); + D3DXMatrixRotationQuaternion(&m_matWorld,&q); + } + } + break; + } + + if (!m_pMeshScript->isBlendingEnable(i)) + { + STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); + } + else + { + int iBlendingSrcType = m_pMeshScript->GetBlendingSrcType(i); + int iBlendingDestType = m_pMeshScript->GetBlendingDestType(i); + STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + STATEMANAGER.SetRenderState(D3DRS_SRCBLEND, iBlendingSrcType); + STATEMANAGER.SetRenderState(D3DRS_DESTBLEND, iBlendingDestType); + } + + D3DXVECTOR3 Position; + m_pMeshScript->GetPosition(m_fLocalTime, Position); + m_matWorld._41 = Position.x; + m_matWorld._42 = Position.y; + m_matWorld._43 = Position.z; + m_matWorld = m_matWorld * *mc_pmatLocal; + STATEMANAGER.SetTransform(D3DTS_WORLD, &m_matWorld); + + BYTE byType; + D3DXCOLOR Color(1.0f, 1.0f, 1.0f, 1.0f); + if (m_pMeshScript->GetColorOperationType(i, &byType)) + STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, byType); + m_pMeshScript->GetColorFactor(i, &Color); + + TTimeEventTableFloat * TableAlpha; + + float fAlpha = 1.0f; + if (m_pMeshScript->GetTimeTableAlphaPointer(i, &TableAlpha) && !TableAlpha->empty()) + GetTimeEventBlendValue(m_fLocalTime,*TableAlpha, &fAlpha); + + // Render // + CEffectMesh::TEffectMeshData * pMeshData = pEffectMesh->GetMeshDataPointer(i); + + assert(m_MeshFrameController.GetCurrentFrame() < pMeshData->EffectFrameDataVector.size()); + CEffectMesh::TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[m_MeshFrameController.GetCurrentFrame()]; + + DWORD dwcurTextureFrame = rTextureFrameController.GetCurrentFrame(); + if (dwcurTextureFrame < m_TextureInstanceVector[i].TextureInstanceVector.size()) + { + CGraphicImageInstance * pImageInstance = m_TextureInstanceVector[i].TextureInstanceVector[dwcurTextureFrame]; + STATEMANAGER.SetTexture(0, pImageInstance->GetTexturePointer()->GetD3DTexture()); + } + + Color.a = fAlpha * rFrameData.fVisibility; + STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, DWORD(Color)); + STATEMANAGER.SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLELIST, + rFrameData.dwIndexCount/3, + &rFrameData.PDTVertexVector[0], + sizeof(TPTVertex)); + // Render // + } +} + +void CEffectMeshInstance::OnSetDataPointer(CEffectElementBase * pElement) +{ + CEffectMeshScript * pMesh = (CEffectMeshScript *)pElement; + m_pMeshScript = pMesh; + + const char * c_szMeshFileName = pMesh->GetMeshFileName(); + + m_pEffectMesh = (CEffectMesh *) CResourceManager::Instance().GetResourcePointer(c_szMeshFileName); + + if (!m_pEffectMesh) + return; + + m_roMesh.SetPointer(m_pEffectMesh); + + m_MeshFrameController.Clear(); + m_MeshFrameController.SetMaxFrame(m_roMesh.GetPointer()->GetFrameCount()); + m_MeshFrameController.SetFrameTime(pMesh->GetMeshAnimationFrameDelay()); + m_MeshFrameController.SetLoopFlag(pMesh->isMeshAnimationLoop()); + m_MeshFrameController.SetLoopCount(pMesh->GetMeshAnimationLoopCount()); + m_MeshFrameController.SetStartFrame(0); + + m_TextureInstanceVector.clear(); + m_TextureInstanceVector.resize(m_pEffectMesh->GetMeshCount()); + for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j) + { + CEffectMeshScript::TMeshData * pMeshData; + if (!m_pMeshScript->GetMeshDataPointer(j, &pMeshData)) + continue; + + CEffectMesh* pkEftMesh=m_roMesh.GetPointer(); + + if (!pkEftMesh) + continue; + + std::vector* pTextureVector = pkEftMesh->GetTextureVectorPointer(j); + if (!pTextureVector) + continue; + + std::vector& rTextureVector = *pTextureVector; + + CFrameController & rFrameController = m_TextureInstanceVector[j].TextureFrameController; + rFrameController.Clear(); + rFrameController.SetMaxFrame(rTextureVector.size()); + rFrameController.SetFrameTime(pMeshData->fTextureAnimationFrameDelay); + rFrameController.SetLoopFlag(pMeshData->bTextureAnimationLoopEnable); + rFrameController.SetStartFrame(pMeshData->dwTextureAnimationStartFrame); + + std::vector & rImageInstanceVector = m_TextureInstanceVector[j].TextureInstanceVector; + rImageInstanceVector.clear(); + rImageInstanceVector.reserve(rTextureVector.size()); + for (std::vector::iterator itor = rTextureVector.begin(); itor != rTextureVector.end(); ++itor) + { + CGraphicImage * pImage = *itor; + CGraphicImageInstance * pImageInstance = CGraphicImageInstance::ms_kPool.Alloc(); + pImageInstance->SetImagePointer(pImage); + rImageInstanceVector.push_back(pImageInstance); + } + } +} + +void CEffectMeshInstance_DeleteImageInstance(CGraphicImageInstance * pkInstance) +{ + CGraphicImageInstance::ms_kPool.Free(pkInstance); +} + +void CEffectMeshInstance_DeleteTextureInstance(CEffectMeshInstance::TTextureInstance & rkInstance) +{ + std::vector & rVector = rkInstance.TextureInstanceVector; + for_each(rVector.begin(), rVector.end(), CEffectMeshInstance_DeleteImageInstance); + rVector.clear(); +} + +void CEffectMeshInstance::OnInitialize() +{ +} + +void CEffectMeshInstance::OnDestroy() +{ + for_each(m_TextureInstanceVector.begin(), m_TextureInstanceVector.end(), CEffectMeshInstance_DeleteTextureInstance); + m_TextureInstanceVector.clear(); + m_roMesh.SetPointer(NULL); +} + +CEffectMeshInstance::CEffectMeshInstance() +{ + Initialize(); +} + +CEffectMeshInstance::~CEffectMeshInstance() +{ + Destroy(); +} \ No newline at end of file diff --git a/extension/src/port/EffectLib/EffectUpdateDecorator.cpp b/extension/src/port/EffectLib/EffectUpdateDecorator.cpp new file mode 100644 index 00000000..c41b1eb6 --- /dev/null +++ b/extension/src/port/EffectLib/EffectUpdateDecorator.cpp @@ -0,0 +1,39 @@ +#include "StdAfx.h" +#include "EffectUpdateDecorator.h" +#include "ParticleInstance.h" +namespace NEffectUpdateDecorator +{ + + CBaseDecorator* CAirResistanceDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi) + { + pi->m_fAirResistance = pfi->m_fAirResistance; + return new CAirResistanceDecorator; + } + + void CAirResistanceDecorator::__Excute(const CDecoratorData & d) + { + d.pInstance->m_v3Velocity *= 1.0f-d.pInstance->m_fAirResistance; + } + CBaseDecorator* CGravityDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi) + { + pi->m_fGravity = pfi->m_fGravity; + return new CGravityDecorator; + } + + void CGravityDecorator::__Excute(const CDecoratorData& d) + { + d.pInstance->m_v3Velocity.z -= d.pInstance->m_fGravity * d.fElapsedTime; + } + + CBaseDecorator* CRotationDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi) + { + pi->m_fRotationSpeed = pfi->m_fRotationSpeed; + return new CRotationDecorator; + } + + void CRotationDecorator::__Excute(const CDecoratorData& d) + { + d.pInstance->m_fRotation += d.pInstance->m_fRotationSpeed * d.fElapsedTime; + } + +} \ No newline at end of file diff --git a/extension/src/port/EffectLib/EmitterProperty.cpp b/extension/src/port/EffectLib/EmitterProperty.cpp new file mode 100644 index 00000000..91b7fbb0 --- /dev/null +++ b/extension/src/port/EffectLib/EmitterProperty.cpp @@ -0,0 +1,102 @@ +#include "StdAfx.h" +#include "EmitterProperty.h" + +BYTE CEmitterProperty::GetEmitterShape() +{ + return m_byEmitterShape; +} +BYTE CEmitterProperty::GetEmitterAdvancedType() +{ + return m_byEmitterAdvancedType; +} +BOOL CEmitterProperty::isEmitFromEdge() +{ + return m_bEmitFromEdgeFlag; +} + +void CEmitterProperty::GetEmittingSize(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingSize, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingSize, pfValue); +} +void CEmitterProperty::GetEmittingAngularVelocity(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingAngularVelocity, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingAngularVelocity, pfValue); +} +void CEmitterProperty::GetEmittingDirectionX(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionX, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionX, pfValue); +} +void CEmitterProperty::GetEmittingDirectionY(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionY, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionY, pfValue); +} +void CEmitterProperty::GetEmittingDirectionZ(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionZ, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionZ, pfValue); +} +void CEmitterProperty::GetEmittingVelocity(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmittingVelocity, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmittingVelocity, pfValue); +} +void CEmitterProperty::GetEmissionCountPerSecond(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventEmissionCountPerSecond, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventEmissionCountPerSecond, pfValue); +} +void CEmitterProperty::GetParticleLifeTime(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventLifeTime, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventLifeTime, pfValue); +} +void CEmitterProperty::GetParticleSizeX(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventSizeX, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventSizeX, pfValue); +} +void CEmitterProperty::GetParticleSizeY(float fTime, float * pfValue) +{ + //GetTimeEventBlendValue(fTime, m_TimeEventSizeY, pfValue); + GetTimeEventBlendValue(fTime, m_TimeEventSizeY, pfValue); +} + +void CEmitterProperty::Clear() +{ + m_dwMaxEmissionCount = 0; + + m_fCycleLength = 0.0f; + m_bCycleLoopFlag = FALSE; + m_iLoopCount = 0; + + m_byEmitterShape = EMITTER_SHAPE_POINT; + m_byEmitterAdvancedType = EMITTER_ADVANCED_TYPE_FREE; + m_bEmitFromEdgeFlag = FALSE; + m_v3EmittingSize = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + m_fEmittingRadius = 0.0f; + + m_v3EmittingDirection = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + + m_TimeEventEmittingSize.clear(); + m_TimeEventEmittingDirectionX.clear(); + m_TimeEventEmittingDirectionY.clear(); + m_TimeEventEmittingDirectionZ.clear(); + m_TimeEventEmittingVelocity.clear(); + m_TimeEventEmissionCountPerSecond.clear(); + m_TimeEventLifeTime.clear(); + m_TimeEventSizeX.clear(); + m_TimeEventSizeY.clear(); + m_TimeEventEmittingAngularVelocity.clear(); +} + +CEmitterProperty::CEmitterProperty() +{ + Clear(); +} +CEmitterProperty::~CEmitterProperty() +{ +} diff --git a/extension/src/port/EffectLib/FrameController.cpp b/extension/src/port/EffectLib/FrameController.cpp new file mode 100644 index 00000000..c5b1cbc7 --- /dev/null +++ b/extension/src/port/EffectLib/FrameController.cpp @@ -0,0 +1,106 @@ +#include "StdAfx.h" +#include "FrameController.h" + +void CFrameController::Update(float fElapsedTime) +{ + m_fLastFrameTime -= fElapsedTime; + + for (int i = 0; i < 20; ++i) + { + if (m_fLastFrameTime < 0.0f) + { + m_fLastFrameTime += m_fFrameTime; + ++m_dwcurFrame; + + if (m_dwcurFrame >= m_dwMaxFrame) + { + if (m_isLoop && --m_iLoopCount!=0) + { + if (m_iLoopCount<0) + m_iLoopCount = 0; + m_dwcurFrame = 0; + } + else + { + m_iLoopCount = 1; + m_dwcurFrame = 0; + m_isActive = FALSE; + return; + } + } + } + else + { + break; + } + } +} + +void CFrameController::SetCurrentFrame(DWORD dwFrame) +{ + m_dwcurFrame = dwFrame; +} + +BYTE CFrameController::GetCurrentFrame() +{ + return m_dwcurFrame; +} + +void CFrameController::SetMaxFrame(DWORD dwMaxFrame) +{ + m_dwMaxFrame = dwMaxFrame; +} +void CFrameController::SetFrameTime(float fTime) +{ + m_fFrameTime = fTime; + m_fLastFrameTime = fTime; +} +void CFrameController::SetStartFrame(DWORD dwStartFrame) +{ + m_dwStartFrame = dwStartFrame; +} + +void CFrameController::SetLoopFlag(BOOL bFlag) +{ + m_isLoop = bFlag; +} + +void CFrameController::SetLoopCount(int iLoopCount) +{ + m_iLoopCount = iLoopCount; +} + +void CFrameController::SetActive(BOOL bFlag) +{ + m_isActive = bFlag; +} + +BOOL CFrameController::isActive(DWORD dwMainFrame) +{ + if (dwMainFrame < m_dwStartFrame) + return FALSE; + + return m_isActive; +} + +void CFrameController::Clear() +{ + m_isActive = TRUE; + m_dwcurFrame = 0; + m_fLastFrameTime = 0.0f; +} + +CFrameController::CFrameController() +{ + m_isActive = TRUE; + m_dwcurFrame = 0; + m_fLastFrameTime = 0.0f; + + m_isLoop = FALSE; + m_dwMaxFrame = 0; + m_fFrameTime = 0.0f; + m_dwStartFrame = 0; +} +CFrameController::~CFrameController() +{ +} diff --git a/extension/src/port/EffectLib/ParticleInstance.cpp b/extension/src/port/EffectLib/ParticleInstance.cpp new file mode 100644 index 00000000..5f31a3d3 --- /dev/null +++ b/extension/src/port/EffectLib/ParticleInstance.cpp @@ -0,0 +1,516 @@ +#include "StdAfx.h" +#include "ParticleInstance.h" +#include "ParticleProperty.h" + +#include "../EterBase/Random.h" +#include "../EterLib/Camera.h" +#include "../EterLib/StateManager.h" + +CDynamicPool CParticleInstance::ms_kPool; + +using namespace NEffectUpdateDecorator; + +void CParticleInstance::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CParticleInstance* CParticleInstance::New() +{ + return ms_kPool.Alloc(); +} + +void CParticleInstance::DeleteThis() +{ + Destroy(); + + ms_kPool.Free(this); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//CDynamicPool CRayParticleInstance::ms_kPool; + +/*void CRayParticleInstance::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CRayParticleInstance* CRayParticleInstance::New() +{ + return ms_kPool.Alloc(); +} + +void CRayParticleInstance::DeleteThis() +{ +#ifdef RAY_TO_AFTERIMAGE + m_PositionList.clear(); +#else + m_bStart = false; +#endif + ms_kPool.Free(this); +} +*/ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +float CParticleInstance::GetRadiusApproximation() +{ + return m_v2HalfSize.y*m_v2Scale.y + m_v2HalfSize.x*m_v2Scale.x; +} +/* +D3DXVECTOR3 CBaseParticleInstance::GetCenterApproximation() +{ + return D3DXVECTOR3( + m_v3Position.x + mc_pmatLocal._41, + m_v3Position.y + mc_pmatLocal._42, + m_v3Position.z + mc_pmatLocal._43 + ); +}*/ + + +BOOL CParticleInstance::Update(float fElapsedTime, float fAngle) +{ + m_fLastLifeTime -= fElapsedTime; + if (m_fLastLifeTime < 0.0f) + return FALSE; + + float fLifePercentage = (m_fLifeTime - m_fLastLifeTime) / m_fLifeTime; + + m_pDecorator->Excute(CDecoratorData(fLifePercentage,fElapsedTime,this)); + + m_v3LastPosition = m_v3Position; + m_v3Position += m_v3Velocity * fElapsedTime; + + if (fAngle) + { + if (m_pParticleProperty->m_bAttachFlag) + { + float fCos, fSin; + fAngle = D3DXToRadian(fAngle); + fCos = cos(fAngle); + fSin = sin(fAngle); + + float rx = m_v3Position.x - m_v3StartPosition.x; + float ry = m_v3Position.y - m_v3StartPosition.y; + + m_v3Position.x = fCos * rx + fSin * ry + m_v3StartPosition.x; + m_v3Position.y = - fSin * rx + fCos * ry + m_v3StartPosition.y; + } + else + { + D3DXQUATERNION q,qc; + D3DXQuaternionRotationAxis(&q,&m_pParticleProperty->m_v3ZAxis,D3DXToRadian(fAngle)); + D3DXQuaternionConjugate(&qc,&q); + + D3DXQUATERNION qr( + m_v3Position.x-m_v3StartPosition.x, + m_v3Position.y-m_v3StartPosition.y, + m_v3Position.z-m_v3StartPosition.z, + 0.0f); + D3DXQuaternionMultiply(&qr,&q,&qr); + D3DXQuaternionMultiply(&qr,&qr,&qc); + + m_v3Position.x = qr.x; + m_v3Position.y = qr.y; + m_v3Position.z = qr.z; + + m_v3Position += m_v3StartPosition; + } + } + + return TRUE; +} + +void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal) +{ +#ifdef WORLD_EDITOR + STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color); +#else + STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_dcColor); +#endif + + ///// + + D3DXVECTOR3 v3Up; + D3DXVECTOR3 v3Cross; + + if (!m_pParticleProperty->m_bStretchFlag) + { + CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera(); + const D3DXVECTOR3 & c_rv3Up = pCurrentCamera->GetUp(); + const D3DXVECTOR3 & c_rv3Cross = pCurrentCamera->GetCross(); + + D3DXVECTOR3 v3Rotation; + + switch(m_pParticleProperty->m_byBillboardType) { + case BILLBOARD_TYPE_LIE: + { + float fCos = cosf(D3DXToRadian(m_fRotation)), fSin = sinf(D3DXToRadian(m_fRotation)); + v3Up.x = fCos; + v3Up.y = -fSin; + v3Up.z = 0; + v3Cross.x = fSin; + v3Cross.y = fCos; + v3Cross.z = 0; + } + break; + case BILLBOARD_TYPE_2FACE: + case BILLBOARD_TYPE_3FACE: + // using setting with y, and local rotation at render + case BILLBOARD_TYPE_Y: + { + v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f); + //v3Up = D3DXVECTOR3(cosf(D3DXToRadian(m_fRotation)),0.0f,-sinf(D3DXToRadian(m_fRotation))); + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + if (v3Up.x * c_rv3View.y - v3Up.y * c_rv3View.x<0) + v3Up*=-1; + auto d3dd = D3DXVECTOR3(c_rv3View.x, c_rv3View.y, 0); + D3DXVec3Cross(&v3Cross, &v3Up, &d3dd); + D3DXVec3Normalize(&v3Cross, &v3Cross); + + if (m_fRotation) + { + float fCos = -sinf(D3DXToRadian(m_fRotation)); // + 90 + float fSin = cosf(D3DXToRadian(m_fRotation)); + + D3DXVECTOR3 v3Temp = v3Up * fCos - v3Cross * fSin; + v3Cross = v3Cross * fCos + v3Up * fSin; + v3Up = v3Temp; + } + + //D3DXVECTOR3 v3Rotation; + //D3DXVec3Cross(&v3Rotation, &v3Up, &v3Cross); + + } + break; + case BILLBOARD_TYPE_ALL: + default: + { + // NOTE : Rotation Routine. Camera의 Up Vector와 Cross Vector 자체를 View Vector 기준으로 + // Rotation 시킨다. + // FIXME : 반드시 최적화 할 것! + if (m_fRotation==0.0f) + { + v3Up = -c_rv3Cross; + v3Cross = c_rv3Up; + } + else + { + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + D3DXQUATERNION q,qc; + D3DXQuaternionRotationAxis(&q, &c_rv3View, D3DXToRadian(m_fRotation)); + D3DXQuaternionConjugate(&qc, &q); + + { + D3DXQUATERNION qr(-c_rv3Cross.x, -c_rv3Cross.y, -c_rv3Cross.z, 0); + D3DXQuaternionMultiply(&qr,&qc,&qr); + D3DXQuaternionMultiply(&qr,&qr,&q); + v3Up.x = qr.x; + v3Up.y = qr.y; + v3Up.z = qr.z; + } + { + D3DXQUATERNION qr(c_rv3Up.x, c_rv3Up.y, c_rv3Up.z, 0); + D3DXQuaternionMultiply(&qr,&qc,&qr); + D3DXQuaternionMultiply(&qr,&qr,&q); + v3Cross.x = qr.x; + v3Cross.y = qr.y; + v3Cross.z = qr.z; + } + + } + //D3DXMATRIX matRotation; + + //D3DXMatrixRotationAxis(&matRotation, &c_rv3View, D3DXToRadian(m_fRotation)); + + //D3DXVec3TransformCoord(&v3Up, &(-c_rv3Cross), &matRotation); + //D3DXVec3TransformCoord(&v3Cross, &c_rv3Up, &matRotation); + } + break; + } + + } + else + { + v3Up = m_v3Position - m_v3LastPosition; + + if (c_matLocal) + { + //if (!m_pParticleProperty->m_bAttachFlag) + D3DXVec3TransformNormal(&v3Up, &v3Up, c_matLocal); + } + + // NOTE: 속도가 길이에 주는 영향 : log(velocity)만큼 늘어난다. + float length = D3DXVec3Length(&v3Up); + if (length == 0.0f) + { + v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f); + } + else + v3Up *=(1+log(1+length))/length; + + CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera(); + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + D3DXVec3Cross(&v3Cross, &v3Up, &c_rv3View); + D3DXVec3Normalize(&v3Cross, &v3Cross); + + } + + v3Cross = -(m_v2HalfSize.x*m_v2Scale.x) * v3Cross; + v3Up = (m_v2HalfSize.y*m_v2Scale.y) * v3Up; + + if (c_matLocal && m_pParticleProperty->m_bAttachFlag) + { + D3DXVECTOR3 v3Position; + D3DXVec3TransformCoord(&v3Position, &m_v3Position, c_matLocal); + m_ParticleMesh[0].position = v3Position - v3Up + v3Cross; + m_ParticleMesh[1].position = v3Position - v3Up - v3Cross; + m_ParticleMesh[2].position = v3Position + v3Up + v3Cross; + m_ParticleMesh[3].position = v3Position + v3Up - v3Cross; + } + else + { + m_ParticleMesh[0].position = m_v3Position - v3Up + v3Cross; + m_ParticleMesh[1].position = m_v3Position - v3Up - v3Cross; + m_ParticleMesh[2].position = m_v3Position + v3Up + v3Cross; + m_ParticleMesh[3].position = m_v3Position + v3Up - v3Cross; + } +} + + +void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation) +{ +#ifdef WORLD_EDITOR + STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color); +#else + STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, (DWORD)m_dcColor); +#endif + + ///// + + D3DXVECTOR3 v3Up; + D3DXVECTOR3 v3Cross; + + if (!m_pParticleProperty->m_bStretchFlag) + { + CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera(); + const D3DXVECTOR3 & c_rv3Up = pCurrentCamera->GetUp(); + const D3DXVECTOR3 & c_rv3Cross = pCurrentCamera->GetCross(); + + D3DXVECTOR3 v3Rotation; + + switch(m_pParticleProperty->m_byBillboardType) { + case BILLBOARD_TYPE_LIE: + { + float fCos = cosf(D3DXToRadian(m_fRotation)), fSin = sinf(D3DXToRadian(m_fRotation)); + v3Up.x = fCos; + v3Up.y = -fSin; + v3Up.z = 0; + + v3Cross.x = fSin; + v3Cross.y = fCos; + v3Cross.z = 0; + } + break; + case BILLBOARD_TYPE_2FACE: + case BILLBOARD_TYPE_3FACE: + // using setting with y, and local rotation at render + case BILLBOARD_TYPE_Y: + { + v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f); + //v3Up = D3DXVECTOR3(cosf(D3DXToRadian(m_fRotation)),0.0f,-sinf(D3DXToRadian(m_fRotation))); + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + if (v3Up.x * c_rv3View.y - v3Up.y * c_rv3View.x<0) + v3Up*=-1; + auto d3dd = D3DXVECTOR3(c_rv3View.x, c_rv3View.y, 0); + D3DXVec3Cross(&v3Cross, &v3Up, &d3dd); + D3DXVec3Normalize(&v3Cross, &v3Cross); + + if (m_fRotation) + { + float fCos = -sinf(D3DXToRadian(m_fRotation)); // + 90 + float fSin = cosf(D3DXToRadian(m_fRotation)); + + D3DXVECTOR3 v3Temp = v3Up * fCos - v3Cross * fSin; + v3Cross = v3Cross * fCos + v3Up * fSin; + v3Up = v3Temp; + } + + //D3DXVECTOR3 v3Rotation; + //D3DXVec3Cross(&v3Rotation, &v3Up, &v3Cross); + + } + break; + case BILLBOARD_TYPE_ALL: + default: + { + // NOTE : Rotation Routine. Camera의 Up Vector와 Cross Vector 자체를 View Vector 기준으로 + // Rotation 시킨다. + // FIXME : 반드시 최적화 할 것! + if (m_fRotation==0.0f) + { + v3Up = -c_rv3Cross; + v3Cross = c_rv3Up; + } + else + { + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + D3DXMATRIX matRotation; + + D3DXMatrixRotationAxis(&matRotation, &c_rv3View, D3DXToRadian(m_fRotation)); + auto d3dd = (-c_rv3Cross); + D3DXVec3TransformCoord(&v3Up, &d3dd, &matRotation); + D3DXVec3TransformCoord(&v3Cross, &c_rv3Up, &matRotation); + } + } + break; + } + } + else + { + v3Up = m_v3Position - m_v3LastPosition; + + if (c_matLocal) + { + //if (!m_pParticleProperty->m_bAttachFlag) + D3DXVec3TransformNormal(&v3Up, &v3Up, c_matLocal); + } + + // NOTE: 속도가 길이에 주는 영향 : log(velocity)만큼 늘어난다. + float length = D3DXVec3Length(&v3Up); + if (length == 0.0f) + { + v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f); + } + else + v3Up *=(1+log(1+length))/length; + //D3DXVec3Normalize(&v3Up,&v3Up); + //v3Up *= 1+log(1+length); + + CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera(); + const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView(); + D3DXVec3Cross(&v3Cross, &v3Up, &c_rv3View); + D3DXVec3Normalize(&v3Cross, &v3Cross); + + } + + if (c_fZRotation) + { + float x, y; + float fCos = cosf(c_fZRotation); + float fSin = sinf(c_fZRotation); + + x = v3Up.x; + y = v3Up.y; + v3Up.x = x * fCos - y * fSin; + v3Up.y = y * fCos + x * fSin; + + x = v3Cross.x; + y = v3Cross.y; + v3Cross.x = x * fCos - y * fSin; + v3Cross.y = y * fCos + x * fSin; + } + + v3Cross = -(m_v2HalfSize.x*m_v2Scale.x) * v3Cross; + v3Up = (m_v2HalfSize.y*m_v2Scale.y) * v3Up; + + if (c_matLocal && m_pParticleProperty->m_bAttachFlag) + { + D3DXVECTOR3 v3Position; + D3DXVec3TransformCoord(&v3Position, &m_v3Position, c_matLocal); + m_ParticleMesh[0].position = v3Position - v3Up + v3Cross; + m_ParticleMesh[1].position = v3Position - v3Up - v3Cross; + m_ParticleMesh[2].position = v3Position + v3Up + v3Cross; + m_ParticleMesh[3].position = v3Position + v3Up - v3Cross; + } + else + { + m_ParticleMesh[0].position = m_v3Position - v3Up + v3Cross; + m_ParticleMesh[1].position = m_v3Position - v3Up - v3Cross; + m_ParticleMesh[2].position = m_v3Position + v3Up + v3Cross; + m_ParticleMesh[3].position = m_v3Position + v3Up - v3Cross; + } +} + +void CParticleInstance::Destroy() +{ + if (m_pDecorator) + m_pDecorator->DeleteThis(); + + __Initialize(); + +} + +void CParticleInstance::__Initialize() +{ + //* + m_pDecorator=NULL; + + m_v3Position = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + m_v3LastPosition = m_v3Position; + m_v3Velocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + + m_v2Scale = D3DXVECTOR2(1.0f, 1.0f); +#ifdef WORLD_EDITOR + m_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); +#else + m_dcColor.m_dwColor = 0xffffffff; +#endif + + m_byFrameIndex = 0; + m_ParticleMesh[0].texCoord = D3DXVECTOR2(0.0f, 1.0f); + m_ParticleMesh[1].texCoord = D3DXVECTOR2(0.0f, 0.0f); + m_ParticleMesh[2].texCoord = D3DXVECTOR2(1.0f, 1.0f); + m_ParticleMesh[3].texCoord = D3DXVECTOR2(1.0f, 0.0f); +} + +CParticleInstance::CParticleInstance() +{ + __Initialize(); +} + +CParticleInstance::~CParticleInstance() +{ + Destroy(); +} + +/*CRayParticleInstance::CRayParticleInstance() +{ +#ifdef RAY_TO_AFTERIMAGE + int i; + for(i=0;i 1) + { + assert(false); + return false; + } + m_ImageVector.clear(); +#ifdef WORLD_EDITOR + m_TextureNameVector.clear(); +#endif + InsertTexture(c_szFileName); + return true; +} + +void CParticleProperty::Clear() +{ + m_byRotationType = 0; + m_fRotationSpeed = 0.0f; + m_wRotationRandomStartingBegin = 0; + m_wRotationRandomStartingEnd = 0; + + m_bAttachFlag = FALSE; + m_bStretchFlag = FALSE; + + m_bySrcBlendType = D3DBLEND_SRCALPHA; + m_byDestBlendType = D3DBLEND_ONE; + m_byColorOperationType = D3DTOP_MODULATE; + + m_byBillboardType = BILLBOARD_TYPE_NONE; + + m_byTexAniType = TEXTURE_ANIMATION_TYPE_NONE; + m_fTexAniDelay = 0.05f; + m_bTexAniRandomStartFrameFlag = FALSE; + + //m_fGravity = 0.0f; + //m_fAirResistance = 0.0f; + + m_TimeEventGravity.clear(); + m_TimeEventAirResistance.clear(); + + m_TimeEventScaleX.clear(); + m_TimeEventScaleY.clear(); + //m_TimeEventScaleXY.clear(); +#ifdef WORLD_EDITOR + m_TimeEventColorRed.clear(); + m_TimeEventColorGreen.clear(); + m_TimeEventColorBlue.clear(); + m_TimeEventAlpha.clear(); + m_TextureNameVector.clear(); +#else + m_TimeEventColor.clear(); +#endif + m_TimeEventRotation.clear(); + + m_ImageVector.clear(); +} + +CParticleProperty::CParticleProperty() +{ +} +CParticleProperty::~CParticleProperty() +{ +} + +CParticleProperty & CParticleProperty::operator = ( const CParticleProperty& c_ParticleProperty ) +{ + m_byTexAniType = c_ParticleProperty.m_byTexAniType; + m_fTexAniDelay = c_ParticleProperty.m_fTexAniDelay; + m_bTexAniRandomStartFrameFlag = c_ParticleProperty.m_bTexAniRandomStartFrameFlag; + + m_bySrcBlendType = c_ParticleProperty.m_bySrcBlendType; + m_byDestBlendType = c_ParticleProperty.m_byDestBlendType; + m_byColorOperationType = c_ParticleProperty.m_byColorOperationType; + + m_byBillboardType = c_ParticleProperty.m_byBillboardType; + + m_byRotationType = c_ParticleProperty.m_byRotationType; + m_fRotationSpeed = c_ParticleProperty.m_fRotationSpeed; + m_wRotationRandomStartingBegin = c_ParticleProperty.m_wRotationRandomStartingBegin; + m_wRotationRandomStartingEnd = c_ParticleProperty.m_wRotationRandomStartingEnd; + + m_bAttachFlag = c_ParticleProperty.m_bAttachFlag; + m_bStretchFlag = c_ParticleProperty.m_bStretchFlag; + + m_TimeEventGravity = c_ParticleProperty.m_TimeEventGravity; + m_TimeEventAirResistance = c_ParticleProperty.m_TimeEventAirResistance; + + m_TimeEventScaleX = c_ParticleProperty.m_TimeEventScaleX; + m_TimeEventScaleY = c_ParticleProperty.m_TimeEventScaleY; + +#ifdef WORLD_EDITOR + m_TimeEventColorRed = c_ParticleProperty.m_TimeEventColorRed; + m_TimeEventColorGreen = c_ParticleProperty.m_TimeEventColorGreen; + m_TimeEventColorBlue = c_ParticleProperty.m_TimeEventColorBlue; + m_TimeEventAlpha = c_ParticleProperty.m_TimeEventAlpha; + + m_TextureNameVector = c_ParticleProperty.m_TextureNameVector; +#else + m_TimeEventColor = c_ParticleProperty.m_TimeEventColor; +#endif + m_TimeEventRotation = c_ParticleProperty.m_TimeEventRotation; + + m_ImageVector = c_ParticleProperty.m_ImageVector; + + return *this; +} \ No newline at end of file diff --git a/extension/src/port/EffectLib/ParticleSystemData.cpp b/extension/src/port/EffectLib/ParticleSystemData.cpp new file mode 100644 index 00000000..a759ce9e --- /dev/null +++ b/extension/src/port/EffectLib/ParticleSystemData.cpp @@ -0,0 +1,424 @@ +#include "StdAfx.h" +#include "ParticleSystemData.h" +#include "EffectUpdateDecorator.h" +#include "ParticleInstance.h" + +CDynamicPool CParticleSystemData::ms_kPool; + +void CParticleSystemData::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CParticleSystemData* CParticleSystemData::New() +{ + return ms_kPool.Alloc(); +} + +void CParticleSystemData::Delete(CParticleSystemData* pkData) +{ + pkData->Clear(); + ms_kPool.Free(pkData); +} + +CEmitterProperty * CParticleSystemData::GetEmitterPropertyPointer() +{ + return &m_EmitterProperty; +} +CParticleProperty * CParticleSystemData::GetParticlePropertyPointer() +{ + return &m_ParticleProperty; +} + +BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader) +{ + { + CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, "emitterproperty"); + + if (!rTextFileLoader.GetTokenDoubleWord("maxemissioncount", &m_EmitterProperty.m_dwMaxEmissionCount)) + return FALSE; + + if (!rTextFileLoader.GetTokenFloat("cyclelength", &m_EmitterProperty.m_fCycleLength)) + { + m_EmitterProperty.m_fCycleLength = 0.05f; + } + if (!rTextFileLoader.GetTokenBoolean("cycleloopenable", &m_EmitterProperty.m_bCycleLoopFlag)) + { + m_EmitterProperty.m_bCycleLoopFlag = FALSE; + } + if (!rTextFileLoader.GetTokenInteger("loopcount",&m_EmitterProperty.m_iLoopCount)) + { + m_EmitterProperty.m_iLoopCount = 0; + } + + if (!rTextFileLoader.GetTokenByte("emittershape", &m_EmitterProperty.m_byEmitterShape)) + return FALSE; + + if (!rTextFileLoader.GetTokenByte("emitteradvancedtype", &m_EmitterProperty.m_byEmitterAdvancedType)) + { + m_EmitterProperty.m_byEmitterShape = CEmitterProperty::EMITTER_ADVANCED_TYPE_FREE; + } + if (!rTextFileLoader.GetTokenPosition("emittingsize", &m_EmitterProperty.m_v3EmittingSize)) + { + m_EmitterProperty.m_v3EmittingSize = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + } + if (!rTextFileLoader.GetTokenFloat("emittingradius", &m_EmitterProperty.m_fEmittingRadius)) + { + m_EmitterProperty.m_fEmittingRadius = 0.0f; + } + + if (!rTextFileLoader.GetTokenBoolean("emitteremitfromedgeflag", &m_EmitterProperty.m_bEmitFromEdgeFlag)) + { + m_EmitterProperty.m_bEmitFromEdgeFlag = FALSE; + } + + if (!rTextFileLoader.GetTokenPosition("emittingdirection", &m_EmitterProperty.m_v3EmittingDirection)) + { + m_EmitterProperty.m_v3EmittingDirection = D3DXVECTOR3(0.0f, 0.0f, 0.0f); + } + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingsize", &m_EmitterProperty.m_TimeEventEmittingSize)) + { + m_EmitterProperty.m_TimeEventEmittingSize.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingSize.push_back(TimeEventFloat); + } + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingangularvelocity", &m_EmitterProperty.m_TimeEventEmittingAngularVelocity)) + { + m_EmitterProperty.m_TimeEventEmittingAngularVelocity.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingAngularVelocity.push_back(TimeEventFloat); + } + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectionx", &m_EmitterProperty.m_TimeEventEmittingDirectionX)) + { + m_EmitterProperty.m_TimeEventEmittingDirectionX.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingDirectionX.push_back(TimeEventFloat); + } + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectiony", &m_EmitterProperty.m_TimeEventEmittingDirectionY)) + { + m_EmitterProperty.m_TimeEventEmittingDirectionY.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingDirectionY.push_back(TimeEventFloat); + } + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectionz", &m_EmitterProperty.m_TimeEventEmittingDirectionZ)) + { + m_EmitterProperty.m_TimeEventEmittingDirectionZ.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingDirectionZ.push_back(TimeEventFloat); + } + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingvelocity", &m_EmitterProperty.m_TimeEventEmittingVelocity)) + { + m_EmitterProperty.m_TimeEventEmittingVelocity.clear(); + TTimeEventTypeFloat TimeEventFloat; + TimeEventFloat.m_fTime = 0.0f; + TimeEventFloat.m_Value = 0.0f; + m_EmitterProperty.m_TimeEventEmittingVelocity.push_back(TimeEventFloat); + } + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemissioncountpersecond", &m_EmitterProperty.m_TimeEventEmissionCountPerSecond)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventlifetime", &m_EmitterProperty.m_TimeEventLifeTime)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventsizex", &m_EmitterProperty.m_TimeEventSizeX)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventsizey", &m_EmitterProperty.m_TimeEventSizeY)) + return FALSE; + } + + { + CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, "particleproperty"); + + if (!rTextFileLoader.GetTokenByte("srcblendtype", &m_ParticleProperty.m_bySrcBlendType)) + { + m_ParticleProperty.m_bySrcBlendType = D3DBLEND_SRCALPHA; + } + if (!rTextFileLoader.GetTokenByte("destblendtype", &m_ParticleProperty.m_byDestBlendType)) + { + m_ParticleProperty.m_byDestBlendType = D3DBLEND_ONE; + } + if (!rTextFileLoader.GetTokenByte("coloroperationtype", &m_ParticleProperty.m_byColorOperationType)) + { + m_ParticleProperty.m_byColorOperationType = D3DTOP_MODULATE; + } + + if (!rTextFileLoader.GetTokenByte("billboardtype", &m_ParticleProperty.m_byBillboardType)) + return FALSE; + + if (!rTextFileLoader.GetTokenByte("rotationtype", &m_ParticleProperty.m_byRotationType)) + return FALSE; + if (!rTextFileLoader.GetTokenFloat("rotationspeed", &m_ParticleProperty.m_fRotationSpeed)) + return FALSE; + if (!rTextFileLoader.GetTokenWord("rotationrandomstartingbegin", &m_ParticleProperty.m_wRotationRandomStartingBegin)) + return FALSE; + if (!rTextFileLoader.GetTokenWord("rotationrandomstartingend", &m_ParticleProperty.m_wRotationRandomStartingEnd)) + return FALSE; + + if (!rTextFileLoader.GetTokenBoolean("attachenable", &m_ParticleProperty.m_bAttachFlag)) + { + m_ParticleProperty.m_bAttachFlag = FALSE; + } + if (!rTextFileLoader.GetTokenBoolean("stretchenable", &m_ParticleProperty.m_bStretchFlag)) + return FALSE; + + if (!rTextFileLoader.GetTokenByte("texanitype", &m_ParticleProperty.m_byTexAniType)) + return FALSE; + if (!rTextFileLoader.GetTokenFloat("texanidelay", &m_ParticleProperty.m_fTexAniDelay)) + return FALSE; + if (!rTextFileLoader.GetTokenBoolean("texanirandomstartframeenable", &m_ParticleProperty.m_bTexAniRandomStartFrameFlag)) + return FALSE; + + float fGravity; + + if (rTextFileLoader.GetTokenFloat("gravity", &fGravity)) + { + TTimeEventTypeFloat f; + f.m_fTime = 0.0f; + f.m_Value = fGravity; + m_ParticleProperty.m_TimeEventGravity.push_back(f); + } + else if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventgravity", &m_ParticleProperty.m_TimeEventGravity)) + { + m_ParticleProperty.m_TimeEventGravity.clear(); + } + + float fAirResistance; + if (rTextFileLoader.GetTokenFloat("airresistance", &fAirResistance)) + { + TTimeEventTypeFloat f; + f.m_fTime = 0.0f; + f.m_Value = fAirResistance; + m_ParticleProperty.m_TimeEventAirResistance.push_back(f); + } + else if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventairresistance", &m_ParticleProperty.m_TimeEventAirResistance)) + { + m_ParticleProperty.m_TimeEventAirResistance.clear(); + } + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscalex", &m_ParticleProperty.m_TimeEventScaleX)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscaley", &m_ParticleProperty.m_TimeEventScaleY)) + return FALSE; + +#ifdef WORLD_EDITOR + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorred", &m_ParticleProperty.m_TimeEventColorRed)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorgreen", &m_ParticleProperty.m_TimeEventColorGreen)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorblue", &m_ParticleProperty.m_TimeEventColorBlue)) + return FALSE; + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &m_ParticleProperty.m_TimeEventAlpha)) + return FALSE; +#else + TTimeEventTableFloat TimeEventR; + TTimeEventTableFloat TimeEventB; + TTimeEventTableFloat TimeEventG; + TTimeEventTableFloat TimeEventA; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorred", &TimeEventR)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorgreen", &TimeEventG)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorblue", &TimeEventB)) + return FALSE; + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &TimeEventA)) + return FALSE; + + m_ParticleProperty.m_TimeEventColor.clear(); + { + std::set times; + int i; + for(i=0;i::iterator it; + for(it = times.begin(); it != times.end(); ++it) + { + float fTime = *it; + float fR, fG, fB, fA; + GetTimeEventBlendValue(fTime, TimeEventR, &fR); + GetTimeEventBlendValue(fTime, TimeEventG, &fG); + GetTimeEventBlendValue(fTime, TimeEventB, &fB); + GetTimeEventBlendValue(fTime, TimeEventA, &fA); + TTimeEventTypeColor t; + t.m_fTime = fTime; + D3DXCOLOR c; + c.r = fR; + c.g = fG; + c.b = fB; + c.a = fA; + t.m_Value.m_dwColor = /*(DWORD)*/ (DWORD)c; + m_ParticleProperty.m_TimeEventColor.push_back(t); + } + } +#endif + + if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation)) + return FALSE; + + CTokenVector * pTextureVector; + + if (!rTextFileLoader.GetTokenVector("texturefiles", &pTextureVector)) + return FALSE; + + for (DWORD i = 0; i < pTextureVector->size(); ++i) + { + std::string strTextureFileName = pTextureVector->at(i).c_str(); + + if (!IsGlobalFileName(strTextureFileName.c_str())) + strTextureFileName = GetOnlyPathName(rTextFileLoader.GetFileName()) + strTextureFileName; + + m_ParticleProperty.InsertTexture(strTextureFileName.c_str()); + } + } + + return TRUE; +} + +void CParticleSystemData::ChangeTexture(const char * c_szFileName) +{ + m_ParticleProperty.SetTexture(c_szFileName); +} + +void CParticleSystemData::OnClear() +{ + m_EmitterProperty.Clear(); + m_ParticleProperty.Clear(); +} + +bool CParticleSystemData::OnIsData() +{ + return true; +} + +void CParticleSystemData::BuildDecorator(CParticleInstance * pInstance) +{ + using namespace NEffectUpdateDecorator; + + pInstance->m_pDecorator = new CNullDecorator; + + ////// + + if (m_ParticleProperty.m_TimeEventAirResistance.size()>1) + { + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CAirResistanceDecorator); + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CAirResistanceValueDecorator(m_ParticleProperty.m_TimeEventAirResistance, &pInstance->m_fAirResistance) + ); + } + else if (m_ParticleProperty.m_TimeEventAirResistance.size()==1) + { + pInstance->m_fAirResistance = m_ParticleProperty.m_TimeEventAirResistance[0].m_Value; + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CAirResistanceDecorator); + } + + if (m_ParticleProperty.m_TimeEventGravity.size() > 1) + { + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(new CGravityDecorator); + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CGravityValueDecorator(m_ParticleProperty.m_TimeEventGravity, &pInstance->m_fGravity) + ); + } + else if (m_ParticleProperty.m_TimeEventGravity.size() == 1) + { + pInstance->m_fGravity = m_ParticleProperty.m_TimeEventGravity[0].m_Value; + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(new CGravityDecorator); + } +#ifdef WORLD_EDITOR + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorRed, &pInstance->m_Color.r)); + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorGreen, &pInstance->m_Color.g)); + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorBlue, &pInstance->m_Color.b)); + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CColorValueDecorator(m_ParticleProperty.m_TimeEventAlpha, &pInstance->m_Color.a)); +#else + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CColorAllDecorator(m_ParticleProperty.m_TimeEventColor, &pInstance->m_dcColor)); +#endif + + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CScaleValueDecorator(m_ParticleProperty.m_TimeEventScaleX, &pInstance->m_v2Scale.x)); + pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront( + new CScaleValueDecorator(m_ParticleProperty.m_TimeEventScaleY, &pInstance->m_v2Scale.y)); + + if (m_ParticleProperty.GetTextureAnimationFrameCount()>1 &&m_ParticleProperty.GetTextureAnimationFrameDelay()>1e-6) + { + switch (pInstance->m_byTextureAnimationType) + { + case CParticleProperty::TEXTURE_ANIMATION_TYPE_CW: + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CTextureAnimationCWDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex)); + break; + case CParticleProperty::TEXTURE_ANIMATION_TYPE_CCW: + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CTextureAnimationCCWDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex)); + break; + case CParticleProperty::TEXTURE_ANIMATION_TYPE_RANDOM_FRAME: + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CTextureAnimationRandomDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex)); + break; + } + } + + BYTE byRotationType = m_ParticleProperty.m_byRotationType; + + if (m_ParticleProperty.m_fRotationSpeed==0.0f && byRotationType!=CParticleProperty::ROTATION_TYPE_TIME_EVENT) + { + byRotationType = CParticleProperty::ROTATION_TYPE_NONE; + } + else if (byRotationType==CParticleProperty::ROTATION_TYPE_RANDOM_DIRECTION) + { + byRotationType = (random()&1)?CParticleProperty::ROTATION_TYPE_CW:CParticleProperty::ROTATION_TYPE_CCW; + } + + switch(byRotationType) + { + case CParticleProperty::ROTATION_TYPE_TIME_EVENT: + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CRotationDecorator()); + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CRotationSpeedValueDecorator(m_ParticleProperty.m_TimeEventRotation,&pInstance->m_fRotationSpeed)); + break; + + case CParticleProperty::ROTATION_TYPE_CW: + pInstance->m_fRotationSpeed = m_ParticleProperty.m_fRotationSpeed; + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CRotationDecorator()); + break; + + case CParticleProperty::ROTATION_TYPE_CCW: + pInstance->m_fRotationSpeed = - m_ParticleProperty.m_fRotationSpeed; + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront( + new CRotationDecorator()); + break; + } + + ///// + + pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CHeaderDecorator); +} + +CParticleSystemData::CParticleSystemData() +{ +} +CParticleSystemData::~CParticleSystemData() +{ +} diff --git a/extension/src/port/EffectLib/ParticleSystemInstance.cpp b/extension/src/port/EffectLib/ParticleSystemInstance.cpp new file mode 100644 index 00000000..d75a7500 --- /dev/null +++ b/extension/src/port/EffectLib/ParticleSystemInstance.cpp @@ -0,0 +1,528 @@ +#include "StdAfx.h" +#include "../EterBase/Random.h" +#include "../EterLib/StateManager.h" +#include "ParticleSystemData.h" +#include "ParticleSystemInstance.h" +#include "ParticleInstance.h" + +CDynamicPool CParticleSystemInstance::ms_kPool; + +using namespace NEffectUpdateDecorator; + +void CParticleSystemInstance::DestroySystem() +{ + ms_kPool.Destroy(); + + CParticleInstance::DestroySystem(); + //CRayParticleInstance::DestroySystem(); +} + +CParticleSystemInstance* CParticleSystemInstance::New() +{ + return ms_kPool.Alloc(); +} + +void CParticleSystemInstance::Delete(CParticleSystemInstance* pkPSInst) +{ + pkPSInst->Destroy(); + ms_kPool.Free(pkPSInst); +} + + + +DWORD CParticleSystemInstance::GetEmissionCount() +{ + return m_dwCurrentEmissionCount; +} + +void CParticleSystemInstance::CreateParticles(float fElapsedTime) +{ + float fEmissionCount; + m_pEmitterProperty->GetEmissionCountPerSecond(m_fLocalTime, &fEmissionCount); + + float fCreatingValue = fEmissionCount * (fElapsedTime / 1.0f) + m_fEmissionResidue; + int iCreatingCount = int(fCreatingValue); + m_fEmissionResidue = fCreatingValue - iCreatingCount; + + int icurEmissionCount = GetEmissionCount(); + int iMaxEmissionCount = int(m_pEmitterProperty->GetMaxEmissionCount()); + int iNextEmissionCount = int(icurEmissionCount + iCreatingCount); + iCreatingCount -= max(0, iNextEmissionCount - iMaxEmissionCount); + + float fLifeTime = 0.0f; + float fEmittingSize = 0.0f; + D3DXVECTOR3 _v3TimePosition; + D3DXVECTOR3 _v3Velocity; + float fVelocity = 0.0f; + D3DXVECTOR2 v2HalfSize; + float fLieRotation = 0; + if (iCreatingCount) + { + m_pEmitterProperty->GetParticleLifeTime(m_fLocalTime, &fLifeTime); + if (fLifeTime==0.0f) + { + return; + } + + m_pEmitterProperty->GetEmittingSize(m_fLocalTime, &fEmittingSize); + + m_pData->GetPosition(m_fLocalTime, _v3TimePosition); + + m_pEmitterProperty->GetEmittingDirectionX(m_fLocalTime, &_v3Velocity.x); + m_pEmitterProperty->GetEmittingDirectionY(m_fLocalTime, &_v3Velocity.y); + m_pEmitterProperty->GetEmittingDirectionZ(m_fLocalTime, &_v3Velocity.z); + + m_pEmitterProperty->GetEmittingVelocity(m_fLocalTime, &fVelocity); + + m_pEmitterProperty->GetParticleSizeX(m_fLocalTime, &v2HalfSize.x); + m_pEmitterProperty->GetParticleSizeY(m_fLocalTime, &v2HalfSize.y); + + if (BILLBOARD_TYPE_LIE == m_pParticleProperty->m_byBillboardType && mc_pmatLocal) + { + float fsx = mc_pmatLocal->_32; + float fcx = sqrtf(1.0f - fsx * fsx); + + if (fcx >= 0.00001f) + fLieRotation = D3DXToDegree(atan2f(-mc_pmatLocal->_12, mc_pmatLocal->_22)); + } + + } + + CParticleInstance * pFirstInstance = 0; + + for (int i = 0; i < iCreatingCount; ++i) + { + CParticleInstance * pInstance; + + pInstance = CParticleInstance::New(); + pInstance->m_pParticleProperty = m_pParticleProperty; + pInstance->m_pEmitterProperty = m_pEmitterProperty; + + // LifeTime + pInstance->m_fLifeTime = fLifeTime; + pInstance->m_fLastLifeTime = fLifeTime; + + // Position + switch (m_pEmitterProperty->GetEmitterShape()) + { + case CEmitterProperty::EMITTER_SHAPE_POINT: + pInstance->m_v3Position.x = 0.0f; + pInstance->m_v3Position.y = 0.0f; + pInstance->m_v3Position.z = 0.0f; + break; + + case CEmitterProperty::EMITTER_SHAPE_ELLIPSE: + pInstance->m_v3Position.x = frandom(-500.0f, 500.0f); + pInstance->m_v3Position.y = frandom(-500.0f, 500.0f); + pInstance->m_v3Position.z = 0.0f; + D3DXVec3Normalize(&pInstance->m_v3Position, &pInstance->m_v3Position); + + if (m_pEmitterProperty->isEmitFromEdge()) + { + pInstance->m_v3Position *= (m_pEmitterProperty->m_fEmittingRadius + fEmittingSize); + } + else + { + pInstance->m_v3Position *= (frandom(0.0f, m_pEmitterProperty->m_fEmittingRadius) + fEmittingSize); + } + break; + + case CEmitterProperty::EMITTER_SHAPE_SQUARE: + pInstance->m_v3Position.x = (frandom(-m_pEmitterProperty->m_v3EmittingSize.x/2.0f, m_pEmitterProperty->m_v3EmittingSize.x/2.0f) + fEmittingSize); + pInstance->m_v3Position.y = (frandom(-m_pEmitterProperty->m_v3EmittingSize.y/2.0f, m_pEmitterProperty->m_v3EmittingSize.y/2.0f) + fEmittingSize); + pInstance->m_v3Position.z = (frandom(-m_pEmitterProperty->m_v3EmittingSize.z/2.0f, m_pEmitterProperty->m_v3EmittingSize.z/2.0f) + fEmittingSize); + break; + + case CEmitterProperty::EMITTER_SHAPE_SPHERE: + pInstance->m_v3Position.x = frandom(-500.0f, 500.0f); + pInstance->m_v3Position.y = frandom(-500.0f, 500.0f); + pInstance->m_v3Position.z = frandom(-500.0f, 500.0f); + D3DXVec3Normalize(&pInstance->m_v3Position, &pInstance->m_v3Position); + + if (m_pEmitterProperty->isEmitFromEdge()) + { + pInstance->m_v3Position *= (m_pEmitterProperty->m_fEmittingRadius + fEmittingSize); + } + else + { + pInstance->m_v3Position *= (frandom(0.0f, m_pEmitterProperty->m_fEmittingRadius) + fEmittingSize); + } + break; + } + + // Position + D3DXVECTOR3 v3TimePosition=_v3TimePosition; + + pInstance->m_v3Position += v3TimePosition; + + if (mc_pmatLocal && !m_pParticleProperty->m_bAttachFlag) + { + D3DXVec3TransformCoord(&pInstance->m_v3Position,&pInstance->m_v3Position,mc_pmatLocal); + D3DXVec3TransformCoord(&v3TimePosition, &v3TimePosition, mc_pmatLocal); + } + pInstance->m_v3StartPosition = v3TimePosition; + // NOTE : Update를 호출하지 않고 Rendering 되기 때문에 length가 0이 되는 문제가 있다. + // Velocity를 구한 후 그만큼 빼준 값으로 초기화 해주도록 바꿨음 - [levites] + //pInstance->m_v3LastPosition = pInstance->m_v3Position; + + // Direction & Velocity + pInstance->m_v3Velocity.x = 0.0f; + pInstance->m_v3Velocity.y = 0.0f; + pInstance->m_v3Velocity.z = 0.0f; + + if (CEmitterProperty::EMITTER_ADVANCED_TYPE_INNER == m_pEmitterProperty->GetEmitterAdvancedType()) + { + auto d3dd = (pInstance->m_v3Position - v3TimePosition); + D3DXVec3Normalize(&pInstance->m_v3Velocity, &d3dd); + pInstance->m_v3Velocity *= -100.0f; + } + else if (CEmitterProperty::EMITTER_ADVANCED_TYPE_OUTER == m_pEmitterProperty->GetEmitterAdvancedType()) + { + if (m_pEmitterProperty->GetEmitterShape() == CEmitterProperty::EMITTER_SHAPE_POINT) + { + pInstance->m_v3Velocity.x = frandom(-100.0f, 100.0f); + pInstance->m_v3Velocity.y = frandom(-100.0f, 100.0f); + pInstance->m_v3Velocity.z = frandom(-100.0f, 100.0f); + } + else + { + auto d3dd = (pInstance->m_v3Position - v3TimePosition); + D3DXVec3Normalize(&pInstance->m_v3Velocity, &d3dd); + pInstance->m_v3Velocity *= 100.0f; + } + } + + D3DXVECTOR3 v3Velocity = _v3Velocity; + if (mc_pmatLocal && !m_pParticleProperty->m_bAttachFlag) + { + D3DXVec3TransformNormal(&v3Velocity, &v3Velocity, mc_pmatLocal); + } + + pInstance->m_v3Velocity += v3Velocity; + if (m_pEmitterProperty->m_v3EmittingDirection.x > 0.0f) + pInstance->m_v3Velocity.x += frandom(-m_pEmitterProperty->m_v3EmittingDirection.x/2.0f, m_pEmitterProperty->m_v3EmittingDirection.x/2.0f) * 1000.0f; + if (m_pEmitterProperty->m_v3EmittingDirection.y > 0.0f) + pInstance->m_v3Velocity.y += frandom(-m_pEmitterProperty->m_v3EmittingDirection.y/2.0f, m_pEmitterProperty->m_v3EmittingDirection.y/2.0f) * 1000.0f; + if (m_pEmitterProperty->m_v3EmittingDirection.z > 0.0f) + pInstance->m_v3Velocity.z += frandom(-m_pEmitterProperty->m_v3EmittingDirection.z/2.0f, m_pEmitterProperty->m_v3EmittingDirection.z/2.0f) * 1000.0f; + + pInstance->m_v3Velocity *= fVelocity; + + // Size + pInstance->m_v2HalfSize = v2HalfSize; + + // Rotation + pInstance->m_fRotation = m_pParticleProperty->m_wRotationRandomStartingBegin; + pInstance->m_fRotation = frandom(m_pParticleProperty->m_wRotationRandomStartingBegin,m_pParticleProperty->m_wRotationRandomStartingEnd); + // Rotation - Lie 일 경우 LocalMatrix 의 Rotation 값을 Random 에 적용한다. + // 매번 할 필요는 없을듯. 어느 정도의 최적화가 필요. - [levites] + if (BILLBOARD_TYPE_LIE == m_pParticleProperty->m_byBillboardType && mc_pmatLocal) + { + pInstance->m_fRotation += fLieRotation; + } + + // Texture Animation + pInstance->m_byFrameIndex = 0; + pInstance->m_byTextureAnimationType = m_pParticleProperty->GetTextureAnimationType(); + + if (m_pParticleProperty->GetTextureAnimationFrameCount() > 1) + { + if (CParticleProperty::TEXTURE_ANIMATION_TYPE_RANDOM_DIRECTION == m_pParticleProperty->GetTextureAnimationType()) + { + if (random() & 1) + { + pInstance->m_byFrameIndex = 0; + pInstance->m_byTextureAnimationType = CParticleProperty::TEXTURE_ANIMATION_TYPE_CW; + } + else + { + pInstance->m_byFrameIndex = m_pParticleProperty->GetTextureAnimationFrameCount() - 1; + pInstance->m_byTextureAnimationType = CParticleProperty::TEXTURE_ANIMATION_TYPE_CCW; + } + } + if (m_pParticleProperty->m_bTexAniRandomStartFrameFlag) + { + pInstance->m_byFrameIndex = random_range(0,m_pParticleProperty->GetTextureAnimationFrameCount()-1); + } + } + + // Simple Update + { + pInstance->m_v3LastPosition = pInstance->m_v3Position - (pInstance->m_v3Velocity * fElapsedTime); + pInstance->m_v2Scale.x = m_pParticleProperty->m_TimeEventScaleX.front().m_Value; + pInstance->m_v2Scale.y= m_pParticleProperty->m_TimeEventScaleY.front().m_Value; + //pInstance->m_v2Scale = m_pParticleProperty->m_TimeEventScaleXY.front().m_Value; +#ifdef WORLD_EDITOR + pInstance->m_Color.r = m_pParticleProperty->m_TimeEventColorRed.front().m_Value; + pInstance->m_Color.g = m_pParticleProperty->m_TimeEventColorGreen.front().m_Value; + pInstance->m_Color.b = m_pParticleProperty->m_TimeEventColorBlue.front().m_Value; + pInstance->m_Color.a = m_pParticleProperty->m_TimeEventAlpha.front().m_Value; +#else + pInstance->m_dcColor = m_pParticleProperty->m_TimeEventColor.front().m_Value; +#endif + } + + if (!pFirstInstance) + { + m_pData->BuildDecorator(pInstance); + pFirstInstance = pInstance; + } + else + { + pInstance->m_pDecorator = pFirstInstance->m_pDecorator->Clone(pFirstInstance,pInstance); + } + + m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance); + m_dwCurrentEmissionCount++; + } +} + +bool CParticleSystemInstance::OnUpdate(float fElapsedTime) +{ + bool bMakeParticle = true; + + ///// + + if (m_fLocalTime >= m_pEmitterProperty->GetCycleLength()) + { + if (m_pEmitterProperty->isCycleLoop() && --m_iLoopCount!=0) + { + if (m_iLoopCount<0) + m_iLoopCount = 0; + m_fLocalTime = m_fLocalTime - m_pEmitterProperty->GetCycleLength(); + } + else + { + bMakeParticle = false; + m_iLoopCount=1; + if (GetEmissionCount()==0) + return false; + } + } + + ///// + + int dwFrameIndex; + int dwFrameCount = m_pParticleProperty->GetTextureAnimationFrameCount(); + + float fAngularVelocity; + m_pEmitterProperty->GetEmittingAngularVelocity(m_fLocalTime,&fAngularVelocity); + + if (fAngularVelocity && !m_pParticleProperty->m_bAttachFlag) + { + auto d3dd = D3DXVECTOR3(0.0f, 0.0f, 1.0f); + D3DXVec3TransformNormal(&m_pParticleProperty->m_v3ZAxis,&d3dd,mc_pmatLocal); + } + + for (dwFrameIndex = 0; dwFrameIndex < dwFrameCount; dwFrameIndex++) + { + TParticleInstanceList::iterator itor = m_ParticleInstanceListVector[dwFrameIndex].begin(); + for (; itor != m_ParticleInstanceListVector[dwFrameIndex].end();) + { + CParticleInstance * pInstance = *itor; + + if (!pInstance->Update(fElapsedTime,fAngularVelocity)) + { + pInstance->DeleteThis(); + + itor = m_ParticleInstanceListVector[dwFrameIndex].erase(itor); + m_dwCurrentEmissionCount--; + } + else + { + if (pInstance->m_byFrameIndex != dwFrameIndex) + { + m_ParticleInstanceListVector[dwFrameCount+pInstance->m_byFrameIndex].push_back(*itor); + itor = m_ParticleInstanceListVector[dwFrameIndex].erase(itor); + } + else + ++itor; + } + } + } + if (isActive() && bMakeParticle) + CreateParticles(fElapsedTime); + + for (dwFrameIndex = 0; dwFrameIndex < dwFrameCount; ++dwFrameIndex) + { + m_ParticleInstanceListVector[dwFrameIndex].splice(m_ParticleInstanceListVector[dwFrameIndex].end(),m_ParticleInstanceListVector[dwFrameIndex+dwFrameCount]); + m_ParticleInstanceListVector[dwFrameIndex+dwFrameCount].clear(); + } + + return true; +} + +namespace NParticleRenderer +{ + struct TwoSideRenderer + { + const D3DXMATRIX * pmat; + TwoSideRenderer(const D3DXMATRIX * pmat=NULL) + : pmat(pmat) + { + } + + inline void operator () (CParticleInstance * pInstance) + { + pInstance->Transform(pmat,D3DXToRadian(-30.0f)); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + + pInstance->Transform(pmat,D3DXToRadian(+30.0f)); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + } + }; + + struct ThreeSideRenderer + { + const D3DXMATRIX * pmat; + ThreeSideRenderer(const D3DXMATRIX * pmat=NULL) + : pmat(pmat) + { + } + + inline void operator () (CParticleInstance * pInstance) + { + pInstance->Transform(pmat); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + pInstance->Transform(pmat,D3DXToRadian(-60.0f)); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + pInstance->Transform(pmat,D3DXToRadian(+60.0f)); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + } + }; + + struct NormalRenderer + { + inline void operator () (CParticleInstance * pInstance) + { + pInstance->Transform(); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + } + }; + struct AttachRenderer + { + const D3DXMATRIX* pmat; + AttachRenderer(const D3DXMATRIX * pmat) + : pmat(pmat) + { + } + + inline void operator () (CParticleInstance * pInstance) + { + pInstance->Transform(pmat); + STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex)); + } + }; +} + +void CParticleSystemInstance::OnRender() +{ + CScreen::Identity(); + STATEMANAGER.SetRenderState(D3DRS_SRCBLEND, m_pParticleProperty->m_bySrcBlendType); + STATEMANAGER.SetRenderState(D3DRS_DESTBLEND, m_pParticleProperty->m_byDestBlendType); + STATEMANAGER.SetTextureStageState(0,D3DTSS_COLOROP,m_pParticleProperty->m_byColorOperationType); + if (m_pParticleProperty->m_byBillboardType < BILLBOARD_TYPE_2FACE) + { + if (!m_pParticleProperty->m_bAttachFlag) + { + auto obj = NParticleRenderer::NormalRenderer(); + ForEachParticleRendering(obj); + } + else + { + auto obj = NParticleRenderer::AttachRenderer(mc_pmatLocal); + ForEachParticleRendering(obj); + } + } + else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_2FACE) + { + if (!m_pParticleProperty->m_bAttachFlag) + { + auto obj = NParticleRenderer::TwoSideRenderer(); + ForEachParticleRendering(obj); + } + else + { + auto obj = NParticleRenderer::TwoSideRenderer(mc_pmatLocal); + ForEachParticleRendering(obj); + } + } + else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_3FACE) + { + if (!m_pParticleProperty->m_bAttachFlag) + { + auto obj = NParticleRenderer::ThreeSideRenderer(); + ForEachParticleRendering(obj); + } + else + { + auto obj = NParticleRenderer::ThreeSideRenderer(mc_pmatLocal); + ForEachParticleRendering(obj); + } + } +} + +void CParticleSystemInstance::OnSetDataPointer(CEffectElementBase * pElement) +{ + m_pData = (CParticleSystemData *)pElement; + + m_dwCurrentEmissionCount = 0; + m_pParticleProperty = m_pData->GetParticlePropertyPointer(); + m_pEmitterProperty = m_pData->GetEmitterPropertyPointer(); + m_iLoopCount = m_pEmitterProperty->GetLoopCount(); + m_ParticleInstanceListVector.resize(m_pParticleProperty->GetTextureAnimationFrameCount()*2+2); + + ///// + + assert(m_kVct_pkImgInst.empty()); + m_kVct_pkImgInst.reserve(m_pParticleProperty->m_ImageVector.size()); + for (DWORD i = 0; i < m_pParticleProperty->m_ImageVector.size(); ++i) + { + CGraphicImage * pImage = m_pParticleProperty->m_ImageVector[i]; + + CGraphicImageInstance* pkImgInstNew = CGraphicImageInstance::New(); + pkImgInstNew->SetImagePointer(pImage); + m_kVct_pkImgInst.push_back(pkImgInstNew); + } +} + +void CParticleSystemInstance::OnInitialize() +{ + m_dwCurrentEmissionCount = 0; + m_iLoopCount = 0; + m_fEmissionResidue = 0.0f; +} + +void CParticleSystemInstance::OnDestroy() +{ + // 2004. 3. 1. myevan. 파티클 제거 루틴 + TParticleInstanceListVector::iterator i; + for(i = m_ParticleInstanceListVector.begin(); i!=m_ParticleInstanceListVector.end(); ++i) + { + TParticleInstanceList& rkLst_kParticleInst=*i; + + TParticleInstanceList::iterator j; + for(j = rkLst_kParticleInst.begin(); j!=rkLst_kParticleInst.end(); ++j) + { + CParticleInstance* pkParticleInst=*j; + pkParticleInst->DeleteThis(); + } + + rkLst_kParticleInst.clear(); + } + m_ParticleInstanceListVector.clear(); + + std::for_each(m_kVct_pkImgInst.begin(), m_kVct_pkImgInst.end(), CGraphicImageInstance::Delete); + m_kVct_pkImgInst.clear(); +} + +CParticleSystemInstance::CParticleSystemInstance() +{ + Initialize(); +} + +CParticleSystemInstance::~CParticleSystemInstance() +{ + assert(m_ParticleInstanceListVector.empty()); + assert(m_kVct_pkImgInst.empty()); +} diff --git a/extension/src/port/EffectLib/SimpleLightData.cpp b/extension/src/port/EffectLib/SimpleLightData.cpp new file mode 100644 index 00000000..b3fedf47 --- /dev/null +++ b/extension/src/port/EffectLib/SimpleLightData.cpp @@ -0,0 +1,164 @@ +#include "StdAfx.h" +#include "SimpleLightData.h" + +CDynamicPool CLightData::ms_kPool; + +void CLightData::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CLightData* CLightData::New() +{ + return ms_kPool.Alloc(); +} + +void CLightData::Delete(CLightData* pkData) +{ + pkData->Clear(); + ms_kPool.Free(pkData); +} + + + +void CLightData::OnClear() +{ + m_fMaxRange = 300.0f; + + m_TimeEventTableRange.clear(); + + m_cAmbient.r = 0.5f; + m_cAmbient.g = 0.5f; + m_cAmbient.b = 0.5f; + m_cAmbient.a = 1.0f; + m_cDiffuse.r = 0.0f; + m_cDiffuse.g = 0.0f; + m_cDiffuse.b = 0.0f; + m_cDiffuse.a = 1.0f; + + m_fDuration = 1.0f; + + m_fAttenuation0 = 0.0f; + m_fAttenuation1 = 0.1f; + m_fAttenuation2 = 0.0f; + + m_bLoopFlag = false; + m_iLoopCount = 0; +} +void CLightData::GetRange(float fTime, float& rRange) +{ + if (m_TimeEventTableRange.empty()) + { + rRange = 1.0f * m_fMaxRange; + if (rRange<0.0f) + rRange = 0.0f; + return; + } + + GetTimeEventBlendValue(fTime, m_TimeEventTableRange, &rRange); + rRange *= m_fMaxRange; + if (rRange<0.0f) + rRange = 0.0f; + return; + /* + float vecLastRange = m_TimeEventTableRange[0].m_Value; + + for (DWORD dwIndex = 0; dwIndex < m_TimeEventTableRange.size(); ++dwIndex) + { + if(fTime < m_TimeEventTableRange[dwIndex].m_fTime) + { + break; + } + } + + if (dwIndex >= m_TimeEventTableRange.size()) + { + rRange = m_TimeEventTableRange[m_TimeEventTableRange.size()-1].m_Value * m_fMaxRange; + if (rRange<0.0f) + rRange = 0.0f; + return; + } + + TTimeEventTypeFloat & rEffectRange = m_TimeEventTableRange[dwIndex]; + TTimeEventTypeFloat & rPrevEffectRange = m_TimeEventTableRange[dwIndex-1]; + + float Head = fabs(rEffectRange.m_fTime - fTime) / fabs(rEffectRange.m_fTime - rPrevEffectRange.m_fTime); + float Tail = 1.0f - fabs(rEffectRange.m_fTime - fTime) / fabs(rEffectRange.m_fTime - rPrevEffectRange.m_fTime); + rRange = ((rPrevEffectRange.m_Value*Head) + (rEffectRange.m_Value*Tail) )*m_fMaxRange; + if (rRange<0.0f) + rRange = 0.0f; + */ +} + +bool CLightData::OnIsData() +{ + return true; +} + +BOOL CLightData::OnLoadScript(CTextFileLoader & rTextFileLoader) +{ + if (!rTextFileLoader.GetTokenFloat("duration",&m_fDuration)) + m_fDuration = 1.0f; + + if (!rTextFileLoader.GetTokenBoolean("loopflag",&m_bLoopFlag)) + m_bLoopFlag = false; + + if (!rTextFileLoader.GetTokenInteger("loopcount",&m_iLoopCount)) + m_iLoopCount = 0; + + if (!rTextFileLoader.GetTokenColor("ambientcolor",&m_cAmbient)) + return FALSE; + + if (!rTextFileLoader.GetTokenColor("diffusecolor",&m_cDiffuse)) + return FALSE; + + if (!rTextFileLoader.GetTokenFloat("maxrange",&m_fMaxRange)) + return FALSE; + + if (!rTextFileLoader.GetTokenFloat("attenuation0",&m_fAttenuation0)) + return FALSE; + + if (!rTextFileLoader.GetTokenFloat("attenuation1",&m_fAttenuation1)) + return FALSE; + + if (!rTextFileLoader.GetTokenFloat("attenuation2",&m_fAttenuation2)) + return FALSE; + + if (!GetTokenTimeEventFloat(rTextFileLoader,"timeeventrange",&m_TimeEventTableRange)) + { + m_TimeEventTableRange.clear(); + } + + return true; +} + +CLightData::CLightData() +{ + Clear(); +} + +CLightData::~CLightData() +{ +} + +float CLightData::GetDuration() +{ + return m_fDuration; +} +void CLightData::InitializeLight(D3DLIGHT8& light) +{ + light.Type = D3DLIGHT_POINT; + + light.Ambient = m_cAmbient; + light.Diffuse = m_cDiffuse; + light.Attenuation0 = m_fAttenuation0; + light.Attenuation1 = m_fAttenuation1; + light.Attenuation2 = m_fAttenuation2; + + + D3DXVECTOR3 position; + GetPosition( 0.0f, position); + light.Position = position; + + GetRange(0.0f, light.Range); +} \ No newline at end of file diff --git a/extension/src/port/EffectLib/SimpleLightInstance.cpp b/extension/src/port/EffectLib/SimpleLightInstance.cpp new file mode 100644 index 00000000..ab5629a3 --- /dev/null +++ b/extension/src/port/EffectLib/SimpleLightInstance.cpp @@ -0,0 +1,138 @@ +#include "StdAfx.h" +#include "../EterLib/GrpLightManager.h" + +#include "SimpleLightInstance.h" + +CDynamicPool CLightInstance::ms_kPool; + +void CLightInstance::DestroySystem() +{ + ms_kPool.Destroy(); +} + +CLightInstance* CLightInstance::New() +{ + return ms_kPool.Alloc(); +} + +void CLightInstance::Delete(CLightInstance* pkData) +{ + pkData->Destroy(); + ms_kPool.Free(pkData); +} + +void CLightInstance::OnSetDataPointer(CEffectElementBase * pElement) +{ + Destroy(); + + m_pData = ((CLightData*)pElement); + + m_iLoopCount = m_pData->GetLoopCount(); + + D3DLIGHT8 Light; + m_pData->InitializeLight(Light); + CLightManager::Instance().RegisterLight(LIGHT_TYPE_DYNAMIC, &m_LightID, Light); +} + +bool CLightInstance::OnUpdate(float fElapsedTime) +{ + if (!isActive()) + { + Destroy(); + return false; + } + + if (m_fLocalTime >= m_pData->GetDuration()) + { + if (m_pData->isLoop() && --m_iLoopCount!=0) + { + if (m_iLoopCount<0) + m_iLoopCount = 0; + m_fLocalTime -= m_pData->GetDuration(); + } + else + { + Destroy(); + m_iLoopCount = 1; + return false; + } + /* + if (!m_pData->isLoop()) + { + OnClear(); + return false; + } + m_fLocalTime -= m_pData->GetDuration(); + */ + } + + CLight * pLight = CLightManager::Instance().GetLight(m_LightID); + + if (pLight) + { + pLight->SetAmbientColor(m_pData->m_cAmbient.r, m_pData->m_cAmbient.g, m_pData->m_cAmbient.b, m_pData->m_cAmbient.a); + pLight->SetDiffuseColor(m_pData->m_cDiffuse.r, m_pData->m_cDiffuse.g, m_pData->m_cDiffuse.b, m_pData->m_cDiffuse.a); + + /*if (m_pData->m_TimeEventTableRange.size() + && m_fLocalTime>=m_pData->GetDuration()*m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime) + { + while(m_dwRangeIndexm_TimeEventTableRange.size() + && m_fLocalTime>=m_pData->GetDuration()*m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime) + m_dwRangeIndex++; + float fLastTime; + float fLastRange=m_pData->m_TimeEventTableRange[m_pData->m_TimeEventTableRange.size()-1].m_Value; + if (m_dwRangeIndex == m_pData->m_TimeEventTableRange.size()) + fLastTime = 1.0f; + else + { + fLastTime = m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime; + fLastRange = m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_Value; + } + m_dwRangeIndex--; + pLight->BlendRange(fLastRange*m_pData->m_fMaxRange, + (fLastTime-m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime)*m_pData->GetDuration()); + m_dwRangeIndex++; + }*/ + + float fRange; + m_pData->GetRange(m_fLocalTime, fRange); + pLight->SetRange(fRange); + + D3DXVECTOR3 pos; + m_pData->GetPosition(m_fLocalTime,pos); + D3DXVec3TransformCoord(&pos,&pos,mc_pmatLocal); + pLight->SetPosition(pos.x,pos.y,pos.z); + + } + + return true; +} + +void CLightInstance::OnRender() +{ + //OnUpdate(0); +} + +void CLightInstance::OnInitialize() +{ + m_LightID = 0; + m_dwRangeIndex = 0; +} + +void CLightInstance::OnDestroy() +{ + if (m_LightID) + { + CLightManager::Instance().DeleteLight(m_LightID); + } +} + +CLightInstance::CLightInstance() +{ + Initialize(); +} + +CLightInstance::~CLightInstance() +{ + Destroy(); +} diff --git a/extension/src/port/EffectLib/StdAfx.cpp b/extension/src/port/EffectLib/StdAfx.cpp new file mode 100644 index 00000000..45cf0e1b --- /dev/null +++ b/extension/src/port/EffectLib/StdAfx.cpp @@ -0,0 +1,2 @@ +#include "StdAfx.h" + diff --git a/extension/src/port/EffectLib/Type.cpp b/extension/src/port/EffectLib/Type.cpp new file mode 100644 index 00000000..354412ce --- /dev/null +++ b/extension/src/port/EffectLib/Type.cpp @@ -0,0 +1,38 @@ +#include "StdAfx.h" +#include "Type.h" + +BOOL GetTokenTimeEventFloat(CTextFileLoader & rTextFileLoader, const char * c_szKey, TTimeEventTableFloat * pTimeEventTableFloat) +{ + CTokenVector * pTokenVector; + if (!rTextFileLoader.GetTokenVector(c_szKey, &pTokenVector)) + return FALSE; + + pTimeEventTableFloat->clear(); + pTimeEventTableFloat->resize(pTokenVector->size() / 2); + + DWORD dwIndex = 0; + for (DWORD i = 0; i < pTokenVector->size(); i+=2, ++dwIndex) + { + pTimeEventTableFloat->at(dwIndex).m_fTime = atof(pTokenVector->at(i).c_str()); + pTimeEventTableFloat->at(dwIndex).m_Value = atof(pTokenVector->at(i+1).c_str()); + } + + return TRUE; +} + +void InsertItemTimeEventFloat(TTimeEventTableFloat * pTable, float fTime, float fValue) +{ + TTimeEventTableFloat::iterator itor = pTable->begin(); + for (; itor != pTable->end(); ++itor) + { + TTimeEventTypeFloat & rTimeEvent = *itor; + if (rTimeEvent.m_fTime > fTime) + break; + } + + TTimeEventTypeFloat TimeEvent; + TimeEvent.m_fTime = fTime; + TimeEvent.m_Value = fValue; + + pTable->insert(itor, TimeEvent); +} diff --git a/extension/src/port/EffectLib/Type.h b/extension/src/port/EffectLib/Type.h index 101c9476..2378d35b 100644 --- a/extension/src/port/EffectLib/Type.h +++ b/extension/src/port/EffectLib/Type.h @@ -73,7 +73,7 @@ enum EBillBoardType BILLBOARD_TYPE_LIE, // 바닥에 누은 형상 - BILLBOARD_TYPE_2FACE, // / and \ + BILLBOARD_TYPE_2FACE, // / and \ face // PORT: text after the backslash; clang reads "\ " as a line splice and drops BILLBOARD_TYPE_3FACE BILLBOARD_TYPE_3FACE, // / and \ and - //BILLBOARD_TYPE_RAY, // 잔상 diff --git a/extension/tests/port_login_flow_test.cpp b/extension/tests/port_login_flow_test.cpp index 646aee07..8cc5bc8f 100644 --- a/extension/tests/port_login_flow_test.cpp +++ b/extension/tests/port_login_flow_test.cpp @@ -47,6 +47,7 @@ #include "GameLib/RaceMotionData.h" #include "GameLib/FlyingData.h" #include "GameLib/FlyingObjectManager.h" +#include "EffectLib/EffectManager.h" #include "GameLib/ItemManager.h" #include "UserInterface/PythonItem.h" #include "UserInterface/StdAfx.h" @@ -503,6 +504,27 @@ int main(int argc, char** argv) CHECK(!CFlyingManager::Instance().RegisterFlyingData(msf)); } + // EffectLib: playersettingmodule.py registered the level-up effect (chrmgr.RegisterEffect → CEffectManager:: + // RegisterEffect2, including the .mse files the .msf fly data attach by relative name). Created at the + // actor, RenderGame's CEffectManager::Render draws its particles as textured, alpha-blended world draws. + if (main_instance) + { + const char* mse = "d:/ymir work/effect/etc/levelup_1/level_up.mse"; + TPixelPosition here = {}; + main_instance->NEW_GetPixelPosition(&here); + CEffectManager& effects = CEffectManager::Instance(); + const int index = effects.CreateEffect(mse, D3DXVECTOR3(here.x, -here.y, here.z), D3DXVECTOR3(0, 0, 0)); + CHECK(index >= 0 && effects.IsAliveEffect(index)); + auto effect_draw = [] { + for (const Render3DDraw& d : Render3DDraws()) + if (!d.pretransformed && d.alpha_blend && d.texture0.find("effect\\etc\\levelup_1\\") != std::string::npos) + return true; + return false; + }; + CHECK(pump_until(3, effect_draw)); + effects.DestroyEffectInstance(index); + } + // item module (PythonItemModule.cpp) over the loaded item_proto: SelectItem + the selected item's fields. CHECK(py("import item\n" "item.SelectItem(19)\n" diff --git a/extension/tests/port_utils_test.cpp b/extension/tests/port_utils_test.cpp index 0fbc2ebd..1ac9d8a9 100644 --- a/extension/tests/port_utils_test.cpp +++ b/extension/tests/port_utils_test.cpp @@ -2,6 +2,9 @@ #include "EterBase/Utils.h" #include +#include +#include +#include int main() { @@ -21,5 +24,38 @@ int main() check(fMAX(200.0f, 0.0f) == 200.0f, "fMAX camera floor"); check(fMINMAX(2.0f, -5.0f, 9.0f) == 2.0f, "fMINMAX lower"); check(fMINMAX(2.0f, 20.0f, 9.0f) == 9.0f, "fMINMAX upper"); + + // Path helpers (40250 bodies): CFlyingData::LoadScriptFile resolves a relative attach .mse against + // GetOnlyPathName of the .msf unless IsGlobalFileName (a drive letter) says it is already absolute. + check(std::string(GetOnlyPathName("d:/ymir work/effect/a.msf")) == "d:/ymir work/effect/", "GetOnlyPathName dir"); + check(std::string(GetOnlyPathName("a.msf")).empty(), "GetOnlyPathName bare"); + check(IsGlobalFileName("d:/ymir work/a.mse") && !IsGlobalFileName("etc/a.mse"), "IsGlobalFileName"); + std::string name; + GetOnlyFileName("d:\\ymir work\\a.mse", name); + check(name == "a.mse", "GetOnlyFileName backslash"); + std::string path, stem, ext; + GetFilePathNameExtension("d:/x/y.tar.gz", (int) strlen("d:/x/y.tar.gz"), &path, &stem, &ext); + check(path == "d:/x/" && stem == "y.tar" && ext == "gz", "GetFilePathNameExtension"); + ext.clear(); + GetFileExtension("a/b.mse", 7, &ext); + check(ext == "mse", "GetFileExtension"); + char p[64] = {}, n[64] = {}, e[64] = {}; + GetFileNameParts("d:/x/y.dds", 10, p, n, e); + check(!strcmp(p, "d:/x/") && !strcmp(n, "y") && !strcmp(e, "dds"), "GetFileNameParts"); + std::vector tokens; + check(SplitLine("a \"b c\" d", " ", &tokens) && tokens.size() == 3 && tokens[1] == "b c", "SplitLine quotes"); + std::string except = "a-b-c"; + StringExceptCharacter(&except, "-"); + check(except == "abc", "StringExceptCharacter"); + char indexed[32] = "tex"; + GetIndexingName(indexed, 12); + GetOldIndexingName(indexed, 7); + check(!strcmp(indexed, "tex127"), "GetIndexingName/GetOldIndexingName"); + std::string local; + check(GetLocalFileName("D:\\ymir\\", "d:/ymir/a.dds", &local) && local == "a.dds", "GetLocalFileName"); + int argc = 0; + PCHAR* argv = CommandLineToArgv(const_cast("x \"y z\" w"), &argc); + check(argc == 3 && !strcmp(argv[1], "y z"), "CommandLineToArgv"); + free(argv); return failures ? 1 : 0; }