Skip to content

Commit

Permalink
-Add support for AG
Browse files Browse the repository at this point in the history
-Downgrade required REHLDS to 3.3+
  • Loading branch information
Garey Akhmetshin committed Apr 15, 2022
1 parent 4328f28 commit c963e70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 98 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Hitbox Fixer ![C/C++ CI](https://github.com/Garey27/hitbox_fixer/workflows/CMake/badge.svg)
This module fixes incorrect player server-side hitboxes in Counter-Strike 1.6.
This module fixes incorrect player server-side hitboxes in Counter-Strike 1.6, Half-Life and AG. (Create issue if want support for your mod).
## Requirements
* [REHLDS](https://github.com/dreamstalker/rehlds/releases) version 3.11 or above
* [REHLDS](https://github.com/dreamstalker/rehlds/releases) version 3.3 or above
## Fixes
- [x] Fixes absolutely broken hitboxes when numblends == 1 (ducking/standing in reload weapon or plant c4 animation).
- [x] Hitbox backtrack based on client-side position.
Expand Down
99 changes: 3 additions & 96 deletions include/cssdk/engine/rehlds_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "pr_dlls.h"

#define REHLDS_API_VERSION_MAJOR 3
#define REHLDS_API_VERSION_MINOR 11
#define REHLDS_API_VERSION_MINOR 4

//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
Expand Down Expand Up @@ -108,8 +108,8 @@ typedef IVoidHookChain<IGameClient*> IRehldsHook_ClientConnected;
typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_ClientConnected;

//HandleNetCommand
typedef IVoidHookChain<IGameClient*, uint8> IRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistry<IGameClient*, uint8> IRehldsHookRegistry_HandleNetCommand;
typedef IVoidHookChain<IGameClient*, int8> IRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistry<IGameClient*, int8> IRehldsHookRegistry_HandleNetCommand;

//Mod_LoadBrushModel
typedef IVoidHookChain<model_t*, void*> IRehldsHook_Mod_LoadBrushModel;
Expand Down Expand Up @@ -195,39 +195,6 @@ typedef IHookChainRegistry<bool, edict_t*, IGameClient*, int, const char*, float
typedef IHookChain<edict_t*, const char*> IRehldsHook_CreateFakeClient;
typedef IHookChainRegistry<edict_t*, const char*> IRehldsHookRegistry_CreateFakeClient;

//SV_CheckConnectionLessRateLimits
typedef IHookChain<bool, netadr_t&, const uint8_t*, int> IRehldsHook_SV_CheckConnectionLessRateLimits;
typedef IHookChainRegistry<bool, netadr_t&, const uint8_t*, int> IRehldsHookRegistry_SV_CheckConnectionLessRateLimits;

//SV_Frame hook
typedef IVoidHookChain<> IRehldsHook_SV_Frame;
typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Frame;

//SV_ShouldSendConsistencyList hook
typedef IHookChain<bool, IGameClient*, bool> IRehldsHook_SV_ShouldSendConsistencyList;
typedef IHookChainRegistry<bool, IGameClient*, bool> IRehldsHookRegistry_SV_ShouldSendConsistencyList;

//GetEntityInit hook
typedef IHookChain<ENTITYINIT, char*> IRehldsHook_GetEntityInit;
typedef IHookChainRegistry<ENTITYINIT, char*> IRehldsHookRegistry_GetEntityInit;

//SV_EmitPings hook
typedef IHookChain<void, IGameClient*, sizebuf_t*> IRehldsHook_SV_EmitPings;
typedef IHookChainRegistry<void, IGameClient*, sizebuf_t*> IRehldsHookRegistry_SV_EmitPings;

//ED_Alloc hook
typedef IHookChain<edict_t*> IRehldsHook_ED_Alloc;
typedef IHookChainRegistry<edict_t*> IRehldsHookRegistry_ED_Alloc;

//ED_Free hook
typedef IVoidHookChain<edict_t*> IRehldsHook_ED_Free;
typedef IVoidHookChainRegistry<edict_t*> IRehldsHookRegistry_ED_Free;

//Con_Printf hook
typedef IHookChain<void, const char*> IRehldsHook_Con_Printf;
typedef IHookChainRegistry<void, const char*> IRehldsHookRegistry_Con_Printf;


class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
Expand Down Expand Up @@ -271,14 +238,6 @@ class IRehldsHookchains {
virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0;
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0;
virtual IRehldsHookRegistry_SV_CheckConnectionLessRateLimits* SV_CheckConnectionLessRateLimits() = 0;
virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0;
virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0;
virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0;
virtual IRehldsHookRegistry_SV_EmitPings* SV_EmitPings() = 0;
virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc() = 0;
virtual IRehldsHookRegistry_ED_Free* ED_Free() = 0;
virtual IRehldsHookRegistry_Con_Printf* Con_Printf() = 0;
};

struct RehldsFuncs_t {
Expand Down Expand Up @@ -337,58 +296,6 @@ struct RehldsFuncs_t {
void(*RemoveExtDll)(void* hModule);
void(*RemoveCvarListener)(const char* var_name, cvar_callback_t func);
ENTITYINIT(*GetEntityInit)(char* pszClassName);

// Read functions
int(*MSG_ReadChar)();
int(*MSG_ReadByte)();
int(*MSG_ReadLong)();
float(*MSG_ReadFloat)();
char* (*MSG_ReadString)();
char* (*MSG_ReadStringLine)();
float(*MSG_ReadAngle)();
float(*MSG_ReadHiresAngle)();
void(*MSG_ReadUsercmd)(struct usercmd_s* to, struct usercmd_s* from);
float(*MSG_ReadCoord)();
void(*MSG_ReadVec3Coord)(sizebuf_t* sb, vec3_t fa);

// Read bit functions
bool(*MSG_IsBitReading)();
void(*MSG_StartBitReading)(sizebuf_t* buf);
void(*MSG_EndBitReading)(sizebuf_t* buf);
uint32(*MSG_PeekBits)(int numbits);
int(*MSG_ReadOneBit)();
uint32(*MSG_ReadBits)(int numbits);
int(*MSG_ReadSBits)(int numbits);
float(*MSG_ReadBitCoord)();
void(*MSG_ReadBitVec3Coord)(vec_t* fa);
float(*MSG_ReadBitAngle)(int numbits);
int(*MSG_ReadBitData)(void* dest, int length);
char* (*MSG_ReadBitString)();
int(*MSG_CurrentBit)();

// Write functions
void(*MSG_WriteLong)(sizebuf_t* sb, int c);
void(*MSG_WriteFloat)(sizebuf_t* sb, float f);
void(*MSG_WriteAngle)(sizebuf_t* sb, float f);
void(*MSG_WriteHiresAngle)(sizebuf_t* sb, float f);
void(*MSG_WriteUsercmd)(sizebuf_t* sb, struct usercmd_s* to, struct usercmd_s* from);
void(*MSG_WriteCoord)(sizebuf_t* sb, float f);
void(*MSG_WriteVec3Coord)(sizebuf_t* sb, const vec3_t fa);

// Write bit functions
bool(*MSG_IsBitWriting)();
void(*MSG_WriteOneBit)(int nValue);
void(*MSG_WriteSBits)(uint32 data, int numbits);
void(*MSG_WriteBitCoord)(float f);
void(*MSG_WriteBitAngle)(float fAngle, int numbits);
void(*MSG_WriteBitData)(void* src, int length);
void(*MSG_WriteBitString)(const char* p);
void(*SZ_Write)(sizebuf_t* buf, const void* data, int length);
void(*SZ_Print)(sizebuf_t* buf, const char* data);
void(*SZ_Clear)(sizebuf_t* buf);
void(*MSG_BeginReading)();
double(*GetHostFrameTime)();
struct cmd_function_s* (*GetFirstCmdFunctionHandle)();
};

class IRehldsApi {
Expand Down
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,12 @@ bool OnMetaAttach()
linux_game_library = "hl.so";
g_eGameType = GT_HL1;
}
else if (!strcmp(a, "ag"))
{
game_library = "ag.dll";
linux_game_library = "ag.so";
g_eGameType = GT_HL1;
}
else if (!strcmp(a, "cstrike") || !strcmp(a, "cstrike_beta"))
{
g_eGameType = GT_CStrike;
Expand Down

0 comments on commit c963e70

Please sign in to comment.