Jump to content
×
×
  • Create New...
  • 0

Hiding a specific object


נσναnz

Question

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 by נσναnz
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1
  • Moderator

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:

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

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 by VegaS™
  • Metin2 Dev 1
  • Eyes 1
  • Love 5
  • Good 1
Link to comment
Share on other sites

  • 0
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:

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Activity

    1. 36

      Destroy Item System

    2. 1

      Brillances

    3. 0

      Fusion.org is Looking for Staff Members

    4. 1

      Brillances

    5. 3

      ELONIA2 | PVM-MEDIUM | 11 LANGUAGES | INTERNATIONAL | A NEW STORY

    6. 4

      Spider Queen not spawining in spider dungeon v1

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.