Jump to content

Esthetic Ghost System


Recommended Posts

  • Silver

M2 Download Center

This is the hidden content, please
( Internal )

This is the hidden content, please
( GitHub )

072618Ghost.png

Maybe it's not a great thing now, but I think that it can be intersting so i post it.

 

Spoiler

 



Client/UserInterface/Locale_inc.h

#define ENABLE_GHOST_MODE

 


Client/GameLib/ActorInstanceRender.cpp

//search 

void CActorInstance::BeginDiffuseRender()

//add above

#ifdef ENABLE_GHOST_MODE

BOOL CActorInstance::IsGhostWeapon()
{
	DWORD ghost = GetPartItemID(CRaceData::PART_WEAPON);
	switch (ghost)
	{
		case 299:
		case 19:
			return TRUE;
	}
	return FALSE;
}
#endif

//search 

void CActorInstance::BeginDiffuseRender()
{
	STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1,	D3DTA_TEXTURE);
	STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2,	D3DTA_DIFFUSE);
	STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP,	D3DTOP_MODULATE);
	STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1,	D3DTA_TEXTURE);
	STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG2,	D3DTA_DIFFUSE);
	STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP,	D3DTOP_MODULATE);

	STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
	
//modify last line with

#ifdef ENABLE_GHOST_MODE

	if (IsGhostWeapon())
	{

		(STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE));
	}
	else
	{
		STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
	}
#else
	STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
#endif
}

 



Client/GameLib/ActorInstance.h

//Search

		// Rendering
		int						m_iRenderMode;
		D3DXCOLOR					m_AddColor;
		float						m_fAlphaValue;

//Add under

#ifdef ENABLE_GHOST_MODE
		BOOL						IsGhostWeapon();
#endif

 

 

Special thanks to @Finnis

 

 

  • Metin2 Dev 3
  • Love 6
  • Good 1
  • Scream 1
Link to comment
Share on other sites

  • Moderator

Thanks for release.

		case 19:
			return TRUE;
			break;

Just to know, that this it's called "dead code".

The break is not called anymore since you made a return... also some compilers will show "Unreachable code" warnings.

  • Love 1
Link to comment
Share on other sites

  • Silver
2 minutes ago, VegaS™ said:

Thanks for release.


		case 19:
			return TRUE;
			break;

Just to know, that this it's called "dead code".

The break is not called anymore since you made a return... also some compilers will show "Unreachable code" warnings.

Thanks. Yes I've fix it on my files but not on github and m2dev :V

 

Fixed now.

Edited by TokiSan
Link to comment
Share on other sites

  • Moderator
1 minute ago, TokiSan said:
#ifdef ENABLE_GHOST_MODE
	if (IsGhostWeapon())
	{
		(STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE));
	}
	else
	{
		STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
	}
#else
	STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
#endif

 

Also instead of that, you can simplify it:

#ifdef ENABLE_GHOST_MODE
	STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, IsGhostWeapon());
#else
	STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
#endif

 

  • Love 2
  • Good 1
Link to comment
Share on other sites



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