Jump to content

נσναnz

Inactive Member
  • Posts

    11
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by נσναnz

  1. 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

  2. 4 hours ago, Finnael said:

    It is not really that hard to do actually. Inside CRenderTarget.cpp there is a function called RenderModel. And inside that function there is this call:

     

    
    camera_manager.GetCurrentCamera()->SetViewParams(
            D3DXVECTOR3{ 0.0f, -1500.0f, 600.0f },
            D3DXVECTOR3{ 0.0f, 0.0f, 95.0f },
            D3DXVECTOR3{0.0f, 0.0f, 1.0f}
        );

     

     

    The first parameter here is the position of our camera that looks at the target. Second paremeter is the position of our target. The third parameter here is not important for us. (Though it should be always D3DXVECTOR3{0.0f, 0.0f, 1.0f} otherwise we might get weird errors.)

     

    So if you want to zoom out you need to either change the position of the camera or the target. What can you do is have a member variable inside CRenderTarget class. Something like this :

     

    
    D3DXVECTOR3 m_cameraPosition;

    Initialize this variable inside CRenderTarget constructor like this:

     

    
    m_cameraPosition = D3DXVECTOR3{ 0.0f, -1500.0f, 600.0f };

     

    And change the above code to this:

     

    
     camera_manager.GetCurrentCamera()->SetViewParams(
            m_cameraPosition,
            D3DXVECTOR3{ 0.0f, 0.0f, 95.0f },
            D3DXVECTOR3{0.0f, 0.0f, 1.0f}
        );

     

     

    Now when you change the m_cameraPosition to whatever value you want the camera position will be changed instantly.

    You know i actually did not think this through, Thanks for the idea :D
    I managed to do it but also bind it to the model index. So that i can get the best camera for each monster.
    Thanks again?
     

  3. On 5/12/2019 at 4:47 PM, VegaS™ said:

    Your children item from dictionary is a tuple, not a list.

    
    #1.1) Replace:
    window["children"][0]["children"] = window["children"][0]["children"] + [
    #1.2) With:
    window["children"][0]["children"] += (
      
    #2.1) Replace:
    		},]
    #2.2) With:
    		},)

     

    Discontinued ?
    It was a nice idea tbh !

    • Love 1
  4. Hi, the system works perfectly.
    But a small issue is that some big mounts/monsters wont be displayed properly.(check the pic)

     

    https://metin2.download/picture/XL44lqQQ6xE0OLRWuEkLfyg5r5K8xlm1/.png


    I tried changing in the perspective camera  but that's also affecting normal renders (armors/weapons...) by getting smaller so that's not a good fix.

     

    Is there any fix for that? 

    • Metin2 Dev 4
  5. Hey guys,

    I've been working on some files a while back, been using txt files.
    tried to get back to my files recently, but i discovered that my sql item_proto and mob_proto are messed up somehow and are not that same as the txt, 
    I used to work on sql and generate the txt out from it.

    Is there anyway to generate an sql item_proto from the txt files that i have ? been trying hard but tbh i don't know how to work on txt files directly..

     

    thanks !

×
×
  • 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.