Jump to content

Esthetic Ghost System


Recommended Posts

  • VIP

M2 Download Center

Download Here ( Internal )

Download Here ( 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

 

 

  • Love 5
Link to post
  • VIP
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 (see edit history)
Link to post
  • 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 post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



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