Jump to content

[RE] GF: MotionEventTypes for Wolfman


Recommended Posts

  • Honorable Member

Hello everybody.

 

Long time ago I reversed this codes from the official binary and I would like to share it with you.

These are the official new motion event types for the wolfman class.

You might have an alternative way for this, in that case you need to take care how you install this, and how you replace the old one.

 

Spoiler

GameLib/RaceMotionData.h

Spoiler

1.1.) Extend the EMotionEventType enum with these:


#ifdef ENABLE_WOLFMAN_CHARACTER
			MOTION_EVENT_TYPE_RELATIVE_MOVE_ON,
			MOTION_EVENT_TYPE_RELATIVE_MOVE_OFF,
#endif

1.2.) A bit below declare the new types:


#ifdef ENABLE_WOLFMAN_CHARACTER
		typedef struct NMotionEvent::SMotionEventDataRelativeMoveOn		TMotionRelativeMoveOn;
		typedef struct NMotionEvent::SMotionEventDataRelativeMoveOff	TMotionRelativeMoveOff;
#endif

 

GameLib/RaceMotionDataEvent.h

Spoiler

1.1.) Add the following to the bottom of the NMotionEvent namespace:


#ifdef ENABLE_WOLFMAN_CHARACTER
	// RelativeMoveOn
	typedef struct SMotionEventDataRelativeMoveOn : public SMotionEventData
	{
		int baseVelocity;

		SMotionEventDataRelativeMoveOn() : baseVelocity(0)
		{}
		virtual ~SMotionEventDataRelativeMoveOn() {}

		void Save(FILE* File, int iTabs){}
		bool Load(CTextFileLoader& rTextFileLoader)
		{
			if (!rTextFileLoader.GetTokenInteger("basevelocity", &baseVelocity))
			{
				return false;
			}

			return true;
		}
	} TMotionEventDataRelativeMoveOn;

	// RelativeMoveOff
	typedef struct SMotionEventDataRelativeMoveOff : public SMotionEventData
	{
		SMotionEventDataRelativeMoveOff() {}
		virtual ~SMotionEventDataRelativeMoveOff() {}

		void Save(FILE* File, int iTabs) {}
		bool Load(CTextFileLoader& rTextFileLoader) { return true; }
	} TMotionEventDataRelativeMoveOff;
#endif

 

GameLib/RaceMotionData.cpp

Spoiler

1.1.) In the CRaceMotionData::LoadMotionData function extend the switch of the motion event types with the followings:


#ifdef ENABLE_WOLFMAN_CHARACTER
					case MOTION_EVENT_TYPE_RELATIVE_MOVE_ON:
						pData = new TMotionRelativeMoveOn;
						break;
					case MOTION_EVENT_TYPE_RELATIVE_MOVE_OFF:
						pData = new TMotionRelativeMoveOff;
						break;
#endif

 

GameLib/ActorInstanceMotionEvent.cpp

Spoiler

1.1.) In the CActorInstance::MotionEventProcess function extend the switch with the followings:


#ifdef ENABLE_WOLFMAN_CHARACTER
		case CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_ON:
			ProcessMotionEventRelativeMoveOn(c_pData);
			break;

		case CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_OFF:
			ProcessMotionEventRelativeMoveOff(c_pData);
			break;
#endif

1.2.) Add the following functions anywhere you want:


#ifdef ENABLE_WOLFMAN_CHARACTER
void CActorInstance::ProcessMotionEventRelativeMoveOn(const CRaceMotionData::TMotionEventData * c_pData)
{
	if (CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_ON != c_pData->iType)
		return;

	const CRaceMotionData::TMotionRelativeMoveOn * c_pRelativeMoveOnData = (const CRaceMotionData::TMotionRelativeMoveOn *)c_pData;

	static const float sc_fDistanceFromTarget = 270.0f;

	if (m_kFlyTarget.IsValidTarget())
	{
		D3DXVECTOR3 v3MainPosition(m_x, m_y, m_z);
		const D3DXVECTOR3 & c_rv3TargetPosition = __GetFlyTargetPosition();
		D3DXVECTOR3 v3Distance = c_rv3TargetPosition - v3MainPosition;
		D3DXVECTOR3 v3DistanceNormal(0.0f, 0.0f, 0.0f);
		D3DXVec3Normalize(&v3DistanceNormal, &v3Distance);
		float fDot = D3DXVec3Dot(&v3DistanceNormal, &v3Distance);
		m_fRelativeMoveMul = (fDot - sc_fDistanceFromTarget) / static_cast<float>(c_pRelativeMoveOnData->baseVelocity);
		m_bIsRelativeMoveMode = true;
	}
}

void CActorInstance::ProcessMotionEventRelativeMoveOff(const CRaceMotionData::TMotionEventData * c_pData)
{
	if (CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_OFF != c_pData->iType)
		return;

	m_bIsRelativeMoveMode = false;
}
#endif

 

GameLib/ActorInstanceMotion.cpp

Spoiler

1.1.) In the CActorInstance::__IsNeedFlyTargetMotion function add the following into the for-cycle:


#ifdef ENABLE_WOLFMAN_CHARACTER
		if (c_pData->iType == CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_ON)
			return true;
#endif

1.2.) Do the same in the CActorInstance::__HasMotionFlyEvent with this:


#ifdef ENABLE_WOLFMAN_CHARACTER
		if (c_pData->iType == CRaceMotionData::MOTION_EVENT_TYPE_RELATIVE_MOVE_ON)
			return true;
#endif

1.3.) Make the changes in the CActorInstance::__MotionEventProcess function like this:


void CActorInstance::__MotionEventProcess(BOOL isPC)
{
	if (isAttacking())
	{
		// [...]
	}
	else
	{
#ifdef ENABLE_WOLFMAN_CHARACTER
		m_bIsRelativeMoveMode = false;
#endif
		// [...]
	}
}

 

GameLib/ActorInstance.h

Spoiler

1.1.) Add the following declarations at the bottom of the CActorInstance class:


#ifdef ENABLE_WOLFMAN_CHARACTER
	protected:
		bool	m_bIsRelativeMoveMode;
		float	m_fRelativeMoveMul;
	protected:
		void	ProcessMotionEventRelativeMoveOn(const CRaceMotionData::TMotionEventData* c_pData);
		void	ProcessMotionEventRelativeMoveOff(const CRaceMotionData::TMotionEventData* c_pData);
#endif

 

GameLib/ActorInstance.cpp

Spoiler

1.1.) Make the changes in the CActorInstance::__AccumulationMovement function like this way:


void CActorInstance::__AccumulationMovement(float fRot)
{
	// [...]
#ifdef ENABLE_WOLFMAN_CHARACTER
	if (m_bIsRelativeMoveMode)
		AddMovement(m_fRelativeMoveMul * s_matRotationZ._41, m_fRelativeMoveMul * s_matRotationZ._42, m_fRelativeMoveMul * s_matRotationZ._43);
	else
#endif
		AddMovement(s_matRotationZ._41, s_matRotationZ._42, s_matRotationZ._43);
}

1.2.) Add the followings into the CActorInstance::__InitializeMotionData function:


#ifdef ENABLE_WOLFMAN_CHARACTER
	m_fRelativeMoveMul = 0.0f;
	m_bIsRelativeMoveMode = false;
#endif

 

 

 

IDA demo:

Spoiler

 

 

  • Love 15
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.