Jump to content

Recommended Posts

"extended version" to load a CRC list.. here is a diff. ChatGPT 3.5 powered

 

Spoiler
Subject: [PATCH] ENABLE_AUTO_LANTERN_EFFECT extend

extend for CRC list not a single CRC
---
 .../Srcs/Client/GameLib/Area.cpp              | 23 ++++++++++++++-----
 .../Srcs/Client/GameLib/PropertyManager.cpp   |  7 ++----
 .../Srcs/Client/GameLib/PropertyManager.h     |  8 +++----
 3 files changed, 23 insertions(+), 15 deletions(-)

diff --git Client/GameLib/Area.cpp Client/GameLib/Area.cpp
index 5ebaefba7..105d88fa5 100644
--- Client/GameLib/Area.cpp	
+++ Client/GameLib/Area.cpp	
@@ -879,14 +879,25 @@ bool CArea::__Load_LoadObject(const char * c_szFileName)
 
 		m_ObjectDataVector.push_back(ObjectData);
 #ifdef ENABLE_AUTO_LANTERN_EFFECT
-		if (ObjectData.dwCRC == CPropertyManager::Instance().GetLanternCRC())
+		const std::vector<DWORD>& lanternCRC = CPropertyManager::Instance().GetLanternCRC();
+		const std::vector<DWORD>& lanternEffectCRC = CPropertyManager::Instance().GetLanternEffectCRC();
+
+		for (size_t i = 0; i < lanternCRC.size(); ++i) 
 		{
-			ObjectData.dwCRC = CPropertyManager::Instance().GetLanternEffectCRC();
+			if (ObjectData.dwCRC == lanternCRC[i]) 
+				{
+				ObjectData.dwCRC = lanternEffectCRC[i];
 
-			if (!CPropertyManager::Instance().Get(ObjectData.dwCRC, &pProperty))
-				TraceError(" CArea::LoadObject Property(%u) Cannot Load Lantern Effect ERROR", ObjectData.dwCRC);
-			else
-				m_ObjectDataVector.push_back(ObjectData);
+				if (!CPropertyManager::Instance().Get(ObjectData.dwCRC, &pProperty))
+				{
+					TraceError(" CArea::LoadObject Property(%u) Cannot Load Lantern Effect ERROR", ObjectData.dwCRC);
+				}
+				else
+				{
+					m_ObjectDataVector.push_back(ObjectData);
+				}
+				break;
+			}
 		}
 #endif
 	}
diff --git Client/GameLib/PropertyManager.cpp Client/GameLib/PropertyManager.cpp
index 10af03eb1..596019b08 100644
--- Client/GameLib/PropertyManager.cpp	
+++ Client/GameLib/PropertyManager.cpp	
@@ -6,9 +6,6 @@
 
 CPropertyManager::CPropertyManager() : m_isFileMode(true)
 {
-#ifdef ENABLE_AUTO_LANTERN_EFFECT
-	m_dwLanternCRC = m_dwLanternEffectCRC = 0xffffffff;
-#endif
 }
 
 CPropertyManager::~CPropertyManager()
@@ -154,8 +151,8 @@ bool CPropertyManager::Register(const char* c_pszFileName, CProperty** ppPropert
 	DWORD dwCRC = pProperty->GetCRC();
 
 #ifdef ENABLE_AUTO_LANTERN_EFFECT
-	m_dwLanternCRC = 1678169896;
-	m_dwLanternEffectCRC = 1025956065;
+	m_dwLanternCRC = {2288483325, 1678169896, };
+	m_dwLanternEffectCRC = {3363030126, 1025956065, };
 #endif
 
 	TPropertyCRCMap::iterator itor = m_PropertyByCRCMap.find(dwCRC);
diff --git Client/GameLib/PropertyManager.h Client/GameLib/PropertyManager.h
index d5bc6d75b..45f517839 100644
--- Client/GameLib/PropertyManager.h	
+++ Client/GameLib/PropertyManager.h	
@@ -43,12 +43,12 @@ class CPropertyManager : public CSingleton<CPropertyManager>
 		CEterFileDict								m_fileDict;
 #ifdef ENABLE_AUTO_LANTERN_EFFECT
 	public:
-		DWORD	GetLanternCRC() const { return m_dwLanternCRC; }
-		DWORD	GetLanternEffectCRC() const { return m_dwLanternEffectCRC; }
+		const std::vector<DWORD>& GetLanternCRC() const { return m_dwLanternCRC; }
+		const std::vector<DWORD>& GetLanternEffectCRC() const { return m_dwLanternEffectCRC; }
 
 	private:
-		DWORD	m_dwLanternCRC;
-		DWORD	m_dwLanternEffectCRC;
+		std::vector<DWORD>	m_dwLanternCRC;
+		std::vector<DWORD>	m_dwLanternEffectCRC;
 #endif
 };

https://diffy.org/

 

Link to comment
https://metin2.dev/topic/31416-auto-lantern-effect/page/2/#findComment-165484
Share on other sites

  • 1 month later...
  • 7 months later...
  • Active+ Member
On 1/16/2024 at 2:32 AM, Gopinich said:

What exactly do we need to do to make it work on the other two maps? No one has written anything about this. If you can help me I would be glad.

  • Good 1
Link to comment
https://metin2.dev/topic/31416-auto-lantern-effect/page/2/#findComment-169642
Share on other sites

  • 1 month later...
  • 5 months later...

The way i made this work on the other maps C and A was like this:

In PropertyManager.cpp

Spoiler
#if defined(__BL_AUTO_LANTERN_EFFECT__)
	m_dwLanternCRC = m_dwLanternEffectCRC = 0xffffffff;
	m_dwLanternCRC2 = m_dwLanternEffectCRC2 = 0xffffffff;
#endif

/////////////////////////////

#if defined(__BL_AUTO_LANTERN_EFFECT__)
	const std::string strFileName(pProperty->GetFileName());

	if (m_dwLanternCRC == 0xffffffff && strFileName.find("ob-b1-013-lamp02.prb") != std::string::npos)
	{
		m_dwLanternCRC = dwCRC;
	}
	else if (m_dwLanternEffectCRC == 0xffffffff && strFileName.find("fire_ob-b1-013-lamp02.mse.pre") != std::string::npos)
	{
		m_dwLanternEffectCRC = dwCRC;
	}

	if (m_dwLanternCRC2 == 0xffffffff && strFileName.find("obj-0010.prb") != std::string::npos)
	{
		m_dwLanternCRC2 = dwCRC;
	}
	else if (m_dwLanternEffectCRC2 == 0xffffffff && strFileName.find("fire_obj-0010.mse.pre") != std::string::npos)
	{
		m_dwLanternEffectCRC2 = dwCRC;
	}
#endif

 

In PropertyManager.h

Spoiler
#if defined(__BL_AUTO_LANTERN_EFFECT__)
	public:
		DWORD	GetLanternCRC() const { return m_dwLanternCRC; }
		DWORD	GetLanternEffectCRC() const { return m_dwLanternEffectCRC; }

		DWORD	GetLanternCRC2() const { return m_dwLanternCRC2; }
		DWORD	GetLanternEffectCRC2() const { return m_dwLanternEffectCRC2; }

	private:
		DWORD	m_dwLanternCRC;
		DWORD	m_dwLanternEffectCRC;

		DWORD	m_dwLanternCRC2;
		DWORD	m_dwLanternEffectCRC2;
#endif

 

In Area.cpp

Spoiler
#if defined(__BL_AUTO_LANTERN_EFFECT__)
		if (ObjectData.dwCRC == CPropertyManager::Instance().GetLanternCRC())
		{
			ObjectData.dwCRC = CPropertyManager::Instance().GetLanternEffectCRC();

			if (!CPropertyManager::Instance().Get(ObjectData.dwCRC, &pProperty))
				TraceError(" CArea::LoadObject Property(%u) Cannot Load Lantern Effect ERROR", ObjectData.dwCRC);
			else
				m_ObjectDataVector.push_back(ObjectData);
		}

		if (ObjectData.dwCRC == CPropertyManager::Instance().GetLanternCRC2())
		{
			ObjectData.dwCRC = CPropertyManager::Instance().GetLanternEffectCRC2();

			if (!CPropertyManager::Instance().Get(ObjectData.dwCRC, &pProperty))
				TraceError(" CArea::LoadObject Property(%u) Cannot Load Lantern Effect ERROR", ObjectData.dwCRC);
			else
				m_ObjectDataVector.push_back(ObjectData);
		}
#endif

 

 

Edited by ShadowsPR0
Link to comment
https://metin2.dev/topic/31416-auto-lantern-effect/page/2/#findComment-171974
Share on other sites

  • 1 month later...

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

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.