mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
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.
This commit is contained in:
parent
afe8efbc2a
commit
754c986e3d
@ -108,6 +108,7 @@
|
|||||||
#include "game/server/detour_impl.h"
|
#include "game/server/detour_impl.h"
|
||||||
#include "game/server/fairfight_impl.h"
|
#include "game/server/fairfight_impl.h"
|
||||||
#include "game/server/gameinterface.h"
|
#include "game/server/gameinterface.h"
|
||||||
|
#include "game/server/movehelper_server.h"
|
||||||
#endif // !CLIENT_DLL
|
#endif // !CLIENT_DLL
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
#include "game/client/viewrender.h"
|
#include "game/client/viewrender.h"
|
||||||
|
18
r5dev/game/server/movehelper_server.cpp
Normal file
18
r5dev/game/server/movehelper_server.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================//
|
||||||
|
#include "core/stdafx.h"
|
||||||
|
#include "movehelper_server.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Gets the server movehelper
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
IMoveHelper* MoveHelperServer()
|
||||||
|
{
|
||||||
|
return s_MoveHelperServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
CMoveHelperServer* s_MoveHelperServer = nullptr;
|
54
r5dev/game/server/movehelper_server.h
Normal file
54
r5dev/game/server/movehelper_server.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================//
|
||||||
|
|
||||||
|
#ifndef MOVEHELPER_SERVER_H
|
||||||
|
#define MOVEHELPER_SERVER_H
|
||||||
|
#include "game/shared/imovehelper.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
|
||||||
|
class CMoveHelperServer : public IMoveHelper
|
||||||
|
{
|
||||||
|
CBaseEntity* m_pHost;
|
||||||
|
|
||||||
|
// results, tallied on client and server, but only used by server to run SV_Impact.
|
||||||
|
// we store off our velocity in the trace_t structure so that we can determine results
|
||||||
|
// of shoving boxes etc. around.
|
||||||
|
struct touchlist_t
|
||||||
|
{
|
||||||
|
Vector3D deltavelocity;
|
||||||
|
//trace_t trace; // !TODO: Reverse CGameTrace!
|
||||||
|
};
|
||||||
|
|
||||||
|
CUtlVector<touchlist_t> m_TouchList;
|
||||||
|
};
|
||||||
|
|
||||||
|
IMoveHelper* MoveHelperServer();
|
||||||
|
extern CMoveHelperServer* s_MoveHelperServer;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class VMoveHelperServer : public IDetour
|
||||||
|
{
|
||||||
|
virtual void GetAdr(void) const
|
||||||
|
{
|
||||||
|
spdlog::debug("| VAR: s_MoveHelperServer : {:#18x} |\n", reinterpret_cast<uintptr_t>(s_MoveHelperServer));
|
||||||
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||||
|
}
|
||||||
|
virtual void GetFun(void) const { }
|
||||||
|
virtual void GetVar(void) const
|
||||||
|
{
|
||||||
|
CMemory pFunc = g_GameDll.FindPatternSIMD("E8 ?? ?? ?? ?? 85 C0 0F 84 ?? ?? ?? ?? 48 8B 47 10").FollowNearCallSelf();
|
||||||
|
s_MoveHelperServer = pFunc.FindPattern("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CMoveHelperServer*>();
|
||||||
|
}
|
||||||
|
virtual void GetCon(void) const { }
|
||||||
|
virtual void Attach(void) const { }
|
||||||
|
virtual void Detach(void) const { }
|
||||||
|
};
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
REGISTER(VMoveHelperServer);
|
||||||
|
|
||||||
|
#endif // MOVEHELPER_SERVER_H
|
78
r5dev/game/shared/imovehelper.h
Normal file
78
r5dev/game/shared/imovehelper.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
//====== 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
|
@ -236,6 +236,7 @@
|
|||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
<ClInclude Include="..\game\shared\ehandle.h" />
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shareddefs.h" />
|
<ClInclude Include="..\game\shared\shareddefs.h" />
|
||||||
|
@ -1934,6 +1934,9 @@
|
|||||||
<ClInclude Include="..\game\shared\usercmd.h">
|
<ClInclude Include="..\game\shared\usercmd.h">
|
||||||
<Filter>sdk\game\shared</Filter>
|
<Filter>sdk\game\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
@ -185,6 +185,7 @@
|
|||||||
<ClInclude Include="..\game\server\detour_impl.h" />
|
<ClInclude Include="..\game\server\detour_impl.h" />
|
||||||
<ClInclude Include="..\game\server\fairfight_impl.h" />
|
<ClInclude Include="..\game\server\fairfight_impl.h" />
|
||||||
<ClInclude Include="..\game\server\gameinterface.h" />
|
<ClInclude Include="..\game\server\gameinterface.h" />
|
||||||
|
<ClInclude Include="..\game\server\movehelper_server.h" />
|
||||||
<ClInclude Include="..\game\server\networkproperty.h" />
|
<ClInclude Include="..\game\server\networkproperty.h" />
|
||||||
<ClInclude Include="..\game\server\player.h" />
|
<ClInclude Include="..\game\server\player.h" />
|
||||||
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
||||||
@ -192,6 +193,7 @@
|
|||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
<ClInclude Include="..\game\shared\ehandle.h" />
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shareddefs.h" />
|
<ClInclude Include="..\game\shared\shareddefs.h" />
|
||||||
@ -552,6 +554,7 @@
|
|||||||
<ClCompile Include="..\game\server\ai_networkmanager.cpp" />
|
<ClCompile Include="..\game\server\ai_networkmanager.cpp" />
|
||||||
<ClCompile Include="..\game\server\ai_utility.cpp" />
|
<ClCompile Include="..\game\server\ai_utility.cpp" />
|
||||||
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
||||||
|
<ClCompile Include="..\game\server\movehelper_server.cpp" />
|
||||||
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
||||||
<ClCompile Include="..\game\server\player.cpp" />
|
<ClCompile Include="..\game\server\player.cpp" />
|
||||||
<ClCompile Include="..\game\shared\animation.cpp" />
|
<ClCompile Include="..\game\shared\animation.cpp" />
|
||||||
|
@ -1365,6 +1365,12 @@
|
|||||||
<ClInclude Include="..\game\shared\usercmd.h">
|
<ClInclude Include="..\game\shared\usercmd.h">
|
||||||
<Filter>sdk\game\shared</Filter>
|
<Filter>sdk\game\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\server\movehelper_server.h">
|
||||||
|
<Filter>sdk\game\server</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\common\opcodes.cpp">
|
<ClCompile Include="..\common\opcodes.cpp">
|
||||||
@ -1721,6 +1727,9 @@
|
|||||||
<ClCompile Include="..\public\baseentity.cpp">
|
<ClCompile Include="..\public\baseentity.cpp">
|
||||||
<Filter>sdk\public</Filter>
|
<Filter>sdk\public</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\game\server\movehelper_server.cpp">
|
||||||
|
<Filter>sdk\game\server</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\Dedicated.def" />
|
<None Include="..\Dedicated.def" />
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
<ClCompile Include="..\game\server\ai_networkmanager.cpp" />
|
<ClCompile Include="..\game\server\ai_networkmanager.cpp" />
|
||||||
<ClCompile Include="..\game\server\ai_utility.cpp" />
|
<ClCompile Include="..\game\server\ai_utility.cpp" />
|
||||||
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
<ClCompile Include="..\game\server\gameinterface.cpp" />
|
||||||
|
<ClCompile Include="..\game\server\movehelper_server.cpp" />
|
||||||
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
<ClCompile Include="..\game\server\networkproperty.cpp" />
|
||||||
<ClCompile Include="..\game\server\player.cpp" />
|
<ClCompile Include="..\game\server\player.cpp" />
|
||||||
<ClCompile Include="..\game\shared\ai_utility_shared.cpp" />
|
<ClCompile Include="..\game\shared\ai_utility_shared.cpp" />
|
||||||
@ -260,6 +261,7 @@
|
|||||||
<ClInclude Include="..\game\server\detour_impl.h" />
|
<ClInclude Include="..\game\server\detour_impl.h" />
|
||||||
<ClInclude Include="..\game\server\fairfight_impl.h" />
|
<ClInclude Include="..\game\server\fairfight_impl.h" />
|
||||||
<ClInclude Include="..\game\server\gameinterface.h" />
|
<ClInclude Include="..\game\server\gameinterface.h" />
|
||||||
|
<ClInclude Include="..\game\server\movehelper_server.h" />
|
||||||
<ClInclude Include="..\game\server\networkproperty.h" />
|
<ClInclude Include="..\game\server\networkproperty.h" />
|
||||||
<ClInclude Include="..\game\server\player.h" />
|
<ClInclude Include="..\game\server\player.h" />
|
||||||
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
||||||
@ -268,6 +270,7 @@
|
|||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
<ClInclude Include="..\game\shared\ehandle.h" />
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
<ClInclude Include="..\game\shared\entitylist_base.h" />
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shareddefs.h" />
|
<ClInclude Include="..\game\shared\shareddefs.h" />
|
||||||
|
@ -711,6 +711,9 @@
|
|||||||
<ClCompile Include="..\public\baseentity.cpp">
|
<ClCompile Include="..\public\baseentity.cpp">
|
||||||
<Filter>sdk\public</Filter>
|
<Filter>sdk\public</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\game\server\movehelper_server.cpp">
|
||||||
|
<Filter>sdk\game\server</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||||
@ -2078,6 +2081,12 @@
|
|||||||
<ClInclude Include="..\game\shared\usercmd.h">
|
<ClInclude Include="..\game\shared\usercmd.h">
|
||||||
<Filter>sdk\game\shared</Filter>
|
<Filter>sdk\game\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\server\movehelper_server.h">
|
||||||
|
<Filter>sdk\game\server</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\imovehelper.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user