engine prediction dummy functions

This commit is contained in:
nullifiedcat 2017-05-01 20:17:21 +03:00
parent 847d80b1a7
commit ec48906f19
7 changed files with 166 additions and 2 deletions

View File

@ -195,7 +195,7 @@ bool CachedEntity::IsVisible() {
matrix3x4_t* CachedEntity::GetBones() {
if (!m_bBonesSetup) {
m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, 0); // gvars->curtime
m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, g_GlobalVars->curtime); // gvars->curtime
}
return m_Bones;
}

View File

@ -41,7 +41,7 @@ void EndConVars() {
RegisterCatVars();
RegisterCatCommands();
if (hConVarsFile) {
fprintf(hConVarsFile, "\nexec cat_autoexec\n");
//fprintf(hConVarsFile, "\nexec cat_autoexec\n");
fprintf(hConVarsFile, "cat_killsay_reload\ncat_spam_reload\n");
fclose(hConVarsFile);
}

View File

@ -37,6 +37,31 @@ static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump",
CatVar jointeam(CV_SWITCH, "fb_autoteam", "1", "Joins player team automatically (NYI)");
CatVar joinclass(CV_STRING, "fb_autoclass", "spy", "Class that will be picked after joining a team (NYI)");
namespace engine_prediction {
float o_curtime;
float o_frametime;
void Start() {
o_curtime = g_GlobalVars->curtime;
o_frametime = g_GlobalVars->frametime;
*g_PredictionRandomSeed = MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
g_GlobalVars->curtime = CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick;
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
g_IGameMovement->StartTrackPredictionErrors((CBasePlayer*)(RAW_ENT(LOCAL_E)));
CMoveData data;
}
void End() {
*g_PredictionRandomSeed = -1;
g_GlobalVars->curtime = o_curtime;
g_GlobalVars->frametime = o_frametime;
}
}
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN;

View File

@ -46,6 +46,7 @@ IVDebugOverlay* g_IVDebugOverlay = nullptr;
IMaterialSystemFixed* g_IMaterialSystem = nullptr;
IVRenderView* g_IVRenderView = nullptr;
IMaterialSystem* g_IMaterialSystemHL = nullptr;
IMoveHelperServer* g_IMoveHelperServer = nullptr;
template<typename T>
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start) {
@ -103,6 +104,9 @@ void CreateInterfaces() {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("FF 52 14 E9 E0 FE FF FF 8D 76 00 A1 ? ? ? ? 8B 5D F4 8B 75 F8 8B 7D FC 8B 10 C7 45 0C ? ? ? ? 89 45 08 8B 42 1C 89 EC 5D FF E0") + 12);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 28 85 C0 75 4B 8B 35 ? ? ? ? 85 F6 74 31 90 8B 5E 04 85 DB 74 22 8B 03 89 1C 24") + 27);
}
if (TF2) {
//g_IMoveHelper = *(reinterpret_cast<IMoveHelper**>(gSignatures.GetClientSignature("? ? ? ? 8B 10 89 04 24 FF 52 28 0F B7 CF 8B 10 89 4C 24 04 89 04 24 FF 52 1C 8B 13 89 1C 24 89 44 24 04 FF 92 74 05 00 00 8D 95 C8 FE FF FF C7 44 24 08 00 00 00 00")));
}
if (TF2) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
else if (TF2C) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
else if (HL2DM) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));

View File

@ -47,6 +47,7 @@ class IVModelRender;
class IVRenderView;
class IMaterialSystemFixed;
class IMaterialSystem;
class IMoveHelperServer;
extern ISteamClient* g_ISteamClient;
extern ISteamFriends* g_ISteamFriends;
@ -73,6 +74,7 @@ extern IMaterialSystemFixed* g_IMaterialSystem;
extern IMaterialSystem* g_IMaterialSystemHL;
extern IVModelRender* g_IVModelRender;
extern IVRenderView* g_IVRenderView;
extern IMoveHelperServer* g_IMoveHelperServer;
template<typename T>
T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start = 0);

View File

@ -51,10 +51,12 @@
#include <steam/steam_api.h>
#include <vgui/Cursor.h>
#include <engine/ivdebugoverlay.h>
#include <iprediction.h>
#include "sdk/in_buttons.h"
#include "sdk/imaterialsystemfixed.h"
#include "sdk/ScreenSpaceEffects.h"
#include "sdk/iinput.h"
#include "sdk/igamemovement.h"
#endif /* SDK_H_ */

131
src/sdk/igamemovement.h Normal file
View File

@ -0,0 +1,131 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#if !defined( IGAMEMOVEMENT_H )
#define IGAMEMOVEMENT_H
#ifdef _WIN32
#pragma once
#endif
class CBasePlayer;
#include "mathlib/vector.h"
#include "interface.h"
//#include "imovehelper.h"
#include "const.h"
//-----------------------------------------------------------------------------
// Name of the class implementing the game movement.
//-----------------------------------------------------------------------------
#define INTERFACENAME_GAMEMOVEMENT "GameMovement001"
//-----------------------------------------------------------------------------
// Forward declarations.
//-----------------------------------------------------------------------------
class IMoveHelper;
//-----------------------------------------------------------------------------
// Purpose: Encapsulated input parameters to player movement.
//-----------------------------------------------------------------------------
class CMoveData
{
public:
bool m_bFirstRunOfFunctions : 1;
bool m_bGameCodeMovedPlayer : 1;
CBaseHandle m_nPlayerHandle; // edict index on server, client entity handle on client
int m_nImpulseCommand; // Impulse command issued.
QAngle m_vecViewAngles; // Command view angles (local space)
QAngle m_vecAbsViewAngles; // Command view angles (world space)
int m_nButtons; // Attack buttons.
int m_nOldButtons; // From host_client->oldbuttons;
float m_flForwardMove;
float m_flSideMove;
float m_flUpMove;
float m_flMaxSpeed;
float m_flClientMaxSpeed;
// Variables from the player edict (sv_player) or entvars on the client.
// These are copied in here before calling and copied out after calling.
Vector m_vecVelocity; // edict::velocity // Current movement direction.
QAngle m_vecAngles; // edict::angles
QAngle m_vecOldAngles;
// Output only
float m_outStepHeight; // how much you climbed this move
Vector m_outWishVel; // This is where you tried
Vector m_outJumpVel; // This is your jump velocity
// Movement constraints (radius 0 means no constraint)
Vector m_vecConstraintCenter;
float m_flConstraintRadius;
float m_flConstraintWidth;
float m_flConstraintSpeedFactor;
void SetAbsOrigin( const Vector &vec );
const Vector &GetAbsOrigin() const;
private:
Vector m_vecAbsOrigin; // edict::origin
};
inline const Vector &CMoveData::GetAbsOrigin() const
{
return m_vecAbsOrigin;
}
#if !defined( CLIENT_DLL ) && defined( _DEBUG )
// We only ever want this code path on the server side in a debug build
// and you have to uncomment the code below and rebuild to have the test operate.
//#define PLAYER_GETTING_STUCK_TESTING
#endif
#if !defined( PLAYER_GETTING_STUCK_TESTING )
// This is implemented with a more exhaustive test in gamemovement.cpp. We check if the origin being requested is
// inside solid, which it never should be
inline void CMoveData::SetAbsOrigin( const Vector &vec )
{
m_vecAbsOrigin = vec;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: The basic player movement interface
//-----------------------------------------------------------------------------
abstract_class IGameMovement
{
public:
virtual ~IGameMovement( void ) {}
// Process the current movement command
virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove ) = 0;
virtual void StartTrackPredictionErrors( CBasePlayer *pPlayer ) = 0;
virtual void FinishTrackPredictionErrors( CBasePlayer *pPlayer ) = 0;
virtual void DiffPrint( PRINTF_FORMAT_STRING char const *fmt, ... ) = 0;
// Allows other parts of the engine to find out the normal and ducked player bbox sizes
virtual Vector GetPlayerMins( bool ducked ) const = 0;
virtual Vector GetPlayerMaxs( bool ducked ) const = 0;
virtual Vector GetPlayerViewOffset( bool ducked ) const = 0;
};
#endif // IGAMEMOVEMENT_H