r5sdk/r5dev/game/shared/imovehelper.h
Kawe Mazidjatari 754c986e3d Add server movehelper to SDK
Initial implementation of server movehelper. IMoveHelper interface class is fully reversed and aligns with implementation in engine. CMoveHelperServer is also reversed, excect for CGameTrace, though this isn't necessary for now.
2023-01-19 18:52:46 +01:00

79 lines
2.4 KiB
C++
Raw Blame History

//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IMOVEHELPER_H
#define IMOVEHELPER_H
#ifdef _WIN32
#pragma once
#endif
#include "tier0/annotations.h"
#include "public/baseentity.h"
typedef CBaseHandle EntityHandle_t;
class IPhysicsSurfaceProps; // !TODO: reverse vtable.
//-----------------------------------------------------------------------------
// Functions the engine provides to IGameMovement to assist in its movement.
//-----------------------------------------------------------------------------
abstract_class IMoveHelper
{
public:
// Call this to set the singleton
static IMoveHelper * GetSingleton() { return sm_pSingleton; }
// Methods associated with a particular entity
virtual char const* GetName(EntityHandle_t handle) const = 0;
// sets the entity being moved
virtual void SetHost(CBaseEntity* host) = 0;
virtual CBaseEntity* GetHost(void) = 0;
virtual void ResetTouchList(void) = 0;
virtual bool AddToTouched(const /*CGameTrace&*/void* tr, const Vector3D& impactvelocity) = 0;
// Adds the trace result to touch list, if contact is not already in list.
virtual void ProcessImpacts(void) = 0;
// Numbered line printf
virtual void Con_NPrintf(int idx, PRINTF_FORMAT_STRING char const* fmt, ...) = 0;
virtual IPhysicsSurfaceProps* GetSurfaceProps(void) = 0;
virtual bool IsWorldEntity(const CBaseHandle& handle) = 0;
// These has separate server vs client implementations
virtual void StartSound(const Vector3D& origin, const char* soundname) = 0;
protected:
// Inherited classes can call this to set the singleton
static void SetSingleton(IMoveHelper* pMoveHelper) { sm_pSingleton = pMoveHelper; }
// The global instance
static IMoveHelper* sm_pSingleton;
};
//-----------------------------------------------------------------------------
// Add this to the CPP file that implements the IMoveHelper
//-----------------------------------------------------------------------------
#define IMPLEMENT_MOVEHELPER() \
IMoveHelper* IMoveHelper::sm_pSingleton = 0
//-----------------------------------------------------------------------------
// Call this to set the singleton
//-----------------------------------------------------------------------------
inline IMoveHelper* MoveHelper()
{
return IMoveHelper::GetSingleton();
}
#endif // IMOVEHELPER_H