נσναnz 5 Posted August 16, 2020 Share Posted August 16, 2020 (edited) Hey, i was wondering if there is a way to hide a specific property or object in metin2? I see that there is some systems that hides all the trees or objects, but what about a specific one only, maybe by CRC or the actual file name? Thanks ! Edited August 16, 2020 by נσναnz Link to comment Share on other sites More sharing options...
Forum Moderator Solution VegaS™ 10267 Posted August 16, 2020 Forum Moderator Solution Share Posted August 16, 2020 (edited) I'm sure that you saw my graphic mask from some years ago. Here you can hide the 'terrain', 'object', 'cloud', 'water', 'tree', and you can disable the effects and more too if you take a look inside of GameLib. That feature class allows you to hide specific effects, tree, bulding by property crc or name (not done yet). You''ll need also: This is the hidden content, please Sign In or Sign Up I'll not make a full how-to right now, just take a look, implement the class, call it and do some changes as you want, you've more than the basic idea. graphic_mask/building.txt general_obj_stone14 ob-b1-005-woodbarrel landmark_statuestone B_general_obj_40 general_obj_jar_yellow01 graphic_mask/effect.txt 8182371290 1003918098 volcano_greatsmoke.mse warpgate01 fall_7 fire_general_obj_charcoal.mse GameLib/Area.cpp This is the hidden content, please Sign In or Sign Up UserInterface/PythonGraphicMask.cpp Spoiler /********************************************************************* * title_name : Test Graphic Mask * date_created : 2018.04.21 * filename : PythonGraphicMask.cpp * author : VegaS * version_actual : Version 0.1 */ #include "stdafx.h" #if defined(ENABLE_GRAPHIC_MASK) #include "PythonGraphicMask.h" #include "PythonSystem.h" #include "../GameLib/MapOutdoor.h" #include "../GameLib/MapType.h" CPythonGraphicMask::CPythonGraphicMask() { Initialize(PROPERTY_TYPE_NONE, "graphic_mask/default.txt"); Initialize(PROPERTY_TYPE_TREE, "graphic_mask/tree.txt"); Initialize(PROPERTY_TYPE_BUILDING, "graphic_mask/building.txt"); Initialize(PROPERTY_TYPE_EFFECT, "graphic_mask/effect.txt"); } CPythonGraphicMask::~CPythonGraphicMask() { Destroy(); } void CPythonGraphicMask::Initialize(const BYTE bPropertyType, const char * c_pszFileName) { m_vecMaskObjectCRC[bPropertyType].clear(); if (bPropertyType == PROPERTY_TYPE_NONE) return; auto* fp = fopen(c_pszFileName, "r"); if (!fp) { Tracef("Can't open file %s.", c_pszFileName); return; } char line[256]; while (fgets(line, sizeof(line) - 1, fp)) { const auto& dwCRC = strtoul(line, nullptr, 0); m_vecMaskObjectCRC[bPropertyType].push_back(dwCRC); } } void CPythonGraphicMask::Destroy() { for (auto& i : m_vecMaskObjectCRC) i.clear(); } bool CPythonGraphicMask::IsEnabled(BYTE bPropertyType) const { if (bPropertyType >= PROPERTY_TYPE_MAX_NUM) return false; switch (bPropertyType) { case prt::PROPERTY_TYPE_TREE: bPropertyType = CMapOutdoor::PART_TREE; break; case prt::PROPERTY_TYPE_BUILDING: bPropertyType = CMapOutdoor::PART_OBJECT; break; case prt::PROPERTY_TYPE_EFFECT: bPropertyType = CMapOutdoor::PART_EFFECT; break; default: break; } static auto& rkSystem = CPythonSystem::Instance(); return rkSystem.GetGraphicMaskPart(bPropertyType); } bool CPythonGraphicMask::GetObjectByCRC(const BYTE bPropertyType, const DWORD dwCRC) const { if (bPropertyType >= PROPERTY_TYPE_MAX_NUM) return false; return std::count(m_vecMaskObjectCRC[bPropertyType].begin(), m_vecMaskObjectCRC[bPropertyType].end(), dwCRC) > 0; } #endif UserInterface/PythonGraphicMask.h Spoiler #pragma once class CPythonGraphicMask : public CSingleton<CPythonGraphicMask> { public: CPythonGraphicMask(); virtual ~CPythonGraphicMask(); enum { PROPERTY_TYPE_NONE, PROPERTY_TYPE_TREE, PROPERTY_TYPE_BUILDING, PROPERTY_TYPE_EFFECT, PROPERTY_TYPE_MAX_NUM, }; void Initialize(const BYTE bPropertyType, const char * c_pszFileName); void Destroy(); bool GetObjectByCRC(const BYTE bPropertyType, const DWORD dwCRC) const; bool IsEnabled(BYTE bPropertyType) const; protected: std::vector<DWORD> m_vecMaskObjectCRC[PROPERTY_TYPE_MAX_NUM]; }; UserInterface/PythonSystem.cpp Spoiler #if defined(ENABLE_GRAPHIC_MASK) bool CPythonSystem::GetGraphicMaskPart(const BYTE bPart) const { switch (bPart) { case CMapOutdoor::PART_TERRAIN: return m_Config.bGraphicMaskTerrain; case CMapOutdoor::PART_OBJECT: return m_Config.bGraphicMaskObject; case CMapOutdoor::PART_CLOUD: return m_Config.bGraphicMaskCloud; case CMapOutdoor::PART_WATER: return m_Config.bGraphicMaskWater; case CMapOutdoor::PART_TREE: return m_Config.bGraphicMaskTree; case CMapOutdoor::PART_EFFECT: return m_Config.bGraphicMaskEffect; } return false; } void CPythonSystem::SetGraphicMaskPart(const BYTE bPart, const bool bFlag) { switch (bPart) { case CMapOutdoor::PART_TERRAIN: m_Config.bGraphicMaskTerrain = bFlag; break; case CMapOutdoor::PART_OBJECT: m_Config.bGraphicMaskObject = bFlag; break; case CMapOutdoor::PART_CLOUD: m_Config.bGraphicMaskCloud = bFlag; break; case CMapOutdoor::PART_WATER: m_Config.bGraphicMaskWater = bFlag; break; case CMapOutdoor::PART_TREE: m_Config.bGraphicMaskTree = bFlag; break; case CMapOutdoor::PART_EFFECT: m_Config.bGraphicMaskEffect = bFlag; break; } } #endif Edited August 22, 2020 by VegaS™ 2 1 1 5 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
נσναnz 5 Posted August 17, 2020 Author Share Posted August 17, 2020 On 8/16/2020 at 10:59 PM, VegaS™ said: I'm sure that you saw my graphic mask from some years ago. Here you can hide the 'terrain', 'object', 'cloud', 'water', 'tree', and you can disable the effects and more too if you take a look inside of GameLib. That feature class allows you to hide specific effects, tree, bulding by property crc or name (not done yet). You''ll need also: This is the hidden content, please Sign In or Sign Up I'll not make a full how-to right now, just take a look, implement the class, call it and do some changes as you want, you've more than the basic idea. graphic_mask/building.txt general_obj_stone14 ob-b1-005-woodbarrel landmark_statuestone B_general_obj_40 general_obj_jar_yellow01 graphic_mask/effect.txt 8182371290 1003918098 volcano_greatsmoke.mse warpgate01 fall_7 fire_general_obj_charcoal.mse GameLib/Area.cpp void CArea::__SetObjectInstance(TObjectInstance * pObjectInstance, const TObjectData * c_pData) { CProperty * pProperty; if (!CPropertyManager::Instance().Get(c_pData->dwCRC, &pProperty)) return; #if defined(ENABLE_GRAPHIC_MASK) const char * c_pszPropertyName; if (!pProperty->GetString("PropertyName", &c_pszPropertyName)) return; static auto& rkGraphicMask = CPythonGraphicMask::Instance(); const auto& bPropertyType = prt::GetPropertyType(c_szPropertyType); // TODO: pProperty->GetFileName() || c_pszPropertyName if (rkGraphicMask.IsEnabled(bPropertyType) && rkGraphicMask.GetObjectByCRC(bPropertyType, c_pData->dwCRC)) return; #endif [...] } UserInterface/PythonGraphicMask.cpp Reveal hidden contents /********************************************************************* * title_name : Test Graphic Mask * date_created : 2018.04.21 * filename : PythonGraphicMask.cpp * author : VegaS * version_actual : Version 0.1 */ #include "stdafx.h" #if defined(ENABLE_GRAPHIC_MASK) #include "PythonGraphicMask.h" #include "PythonSystem.h" #include "../GameLib/MapOutdoor.h" #include "../GameLib/MapType.h" CPythonGraphicMask::CPythonGraphicMask() { Initialize(PROPERTY_TYPE_NONE, "graphic_mask/default.txt"); Initialize(PROPERTY_TYPE_TREE, "graphic_mask/tree.txt"); Initialize(PROPERTY_TYPE_BUILDING, "graphic_mask/building.txt"); Initialize(PROPERTY_TYPE_EFFECT, "graphic_mask/effect.txt"); } CPythonGraphicMask::~CPythonGraphicMask() { Destroy(); } void CPythonGraphicMask::Initialize(const BYTE bPropertyType, const char * c_pszFileName) { m_vecMaskObjectCRC[bPropertyType].clear(); if (bPropertyType == PROPERTY_TYPE_NONE) return; auto* fp = fopen(c_pszFileName, "r"); if (!fp) { Tracef("Can't open file %s.", c_pszFileName); return; } char line[256]; while (fgets(line, sizeof(line) - 1, fp)) { const auto& dwCRC = strtoul(line, nullptr, 0); m_vecMaskObjectCRC[bPropertyType].push_back(dwCRC); } } void CPythonGraphicMask::Destroy() { for (auto& i : m_vecMaskObjectCRC) i.clear(); } bool CPythonGraphicMask::IsEnabled(BYTE bPropertyType) const { if (bPropertyType >= PROPERTY_TYPE_MAX_NUM) return false; switch (bPropertyType) { case prt::PROPERTY_TYPE_TREE: bPropertyType = CMapOutdoor::PART_TREE; break; case prt::PROPERTY_TYPE_BUILDING: bPropertyType = CMapOutdoor::PART_OBJECT; break; case prt::PROPERTY_TYPE_EFFECT: bPropertyType = CMapOutdoor::PART_EFFECT; break; default: break; } static auto& rkSystem = CPythonSystem::Instance(); return rkSystem.GetGraphicMaskPart(bPropertyType); } bool CPythonGraphicMask::GetObjectByCRC(const BYTE bPropertyType, const DWORD dwCRC) const { if (bPropertyType >= PROPERTY_TYPE_MAX_NUM) return false; return std::count(m_vecMaskObjectCRC[bPropertyType].begin(), m_vecMaskObjectCRC[bPropertyType].end(), dwCRC) > 0; } #endif UserInterface/PythonGraphicMask.h Reveal hidden contents #pragma once class CPythonGraphicMask : public CSingleton<CPythonGraphicMask> { public: CPythonGraphicMask(); virtual ~CPythonGraphicMask(); enum { PROPERTY_TYPE_NONE, PROPERTY_TYPE_TREE, PROPERTY_TYPE_BUILDING, PROPERTY_TYPE_EFFECT, PROPERTY_TYPE_MAX_NUM, }; void Initialize(const BYTE bPropertyType, const char * c_pszFileName); void Destroy(); bool GetObjectByCRC(const BYTE bPropertyType, const DWORD dwCRC) const; bool IsEnabled(BYTE bPropertyType) const; protected: std::vector<DWORD> m_vecMaskObjectCRC[PROPERTY_TYPE_MAX_NUM]; }; UserInterface/PythonSystem.cpp Reveal hidden contents #if defined(ENABLE_GRAPHIC_MASK) bool CPythonSystem::GetGraphicMaskPart(const BYTE bPart) const { switch (bPart) { case CMapOutdoor::PART_TERRAIN: return m_Config.bGraphicMaskTerrain; case CMapOutdoor::PART_OBJECT: return m_Config.bGraphicMaskObject; case CMapOutdoor::PART_CLOUD: return m_Config.bGraphicMaskCloud; case CMapOutdoor::PART_WATER: return m_Config.bGraphicMaskWater; case CMapOutdoor::PART_TREE: return m_Config.bGraphicMaskTree; case CMapOutdoor::PART_EFFECT: return m_Config.bGraphicMaskEffect; } return false; } void CPythonSystem::SetGraphicMaskPart(const BYTE bPart, const bool bFlag) { switch (bPart) { case CMapOutdoor::PART_TERRAIN: m_Config.bGraphicMaskTerrain = bFlag; break; case CMapOutdoor::PART_OBJECT: m_Config.bGraphicMaskObject = bFlag; break; case CMapOutdoor::PART_CLOUD: m_Config.bGraphicMaskCloud = bFlag; break; case CMapOutdoor::PART_WATER: m_Config.bGraphicMaskWater = bFlag; break; case CMapOutdoor::PART_TREE: m_Config.bGraphicMaskTree = bFlag; break; case CMapOutdoor::PART_EFFECT: m_Config.bGraphicMaskEffect = bFlag; break; } } #endif Thank you man !! It worked Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now