Jump to content
×
×
  • Create New...

[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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Activity

    1. 36

      Destroy Item System

    2. 1

      Brillances

    3. 0

      Fusion.org is Looking for Staff Members

    4. 1

      Brillances

    5. 3

      ELONIA2 | PVM-MEDIUM | 11 LANGUAGES | INTERNATIONAL | A NEW STORY

    6. 4

      Spider Queen not spawining in spider dungeon v1

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.