Added more virtual functions to the table, only have counter-strike disassembled currently.

This commit is contained in:
Steve Dudenhoeffer 2007-05-10 16:08:02 +00:00
parent 5fc89085d6
commit 0c56e2803e
14 changed files with 530 additions and 94 deletions

View File

@ -40,8 +40,8 @@ static const char *returntypes[] =
"string", "string",
"entity", "entity",
"entity", "entity",
"traceresult" "traceresult",
"" "iteminfo"
}; };
static cell AMX_NATIVE_CALL GetHamReturnInteger(AMX *amx, cell *params) static cell AMX_NATIVE_CALL GetHamReturnInteger(AMX *amx, cell *params)

View File

@ -15,7 +15,8 @@ enum
RET_STRING, RET_STRING,
RET_CBASE, RET_CBASE,
RET_ENTVAR, RET_ENTVAR,
RET_TRACE RET_TRACE,
RET_ITEMINFO
}; };
// Container for return and parameter data. // Container for return and parameter data.
// Contains a void pointer, and a flag telling what it contains. // Contains a void pointer, and a flag telling what it contains.

View File

@ -6,6 +6,8 @@
#include "forward.h" #include "forward.h"
#include "hook.h" #include "hook.h"
#include "ham_const.h" #include "ham_const.h"
#include "hooklist.h"
#include <assert.h>
edict_t *NEW_FirstEdict; edict_t *NEW_FirstEdict;
bool NEW_Initialized; bool NEW_Initialized;
@ -15,10 +17,15 @@ extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
extern AMX_NATIVE_INFO RegisterNatives[]; extern AMX_NATIVE_INFO RegisterNatives[];
extern AMX_NATIVE_INFO ReturnNatives[]; extern AMX_NATIVE_INFO ReturnNatives[];
extern hook_t hooklist[];
int ReadConfig(void); int ReadConfig(void);
void OnAmxxAttach(void) void OnAmxxAttach(void)
{ {
// Assert that the enum is aligned properly with the table
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
if (ReadConfig() > 0) if (ReadConfig() > 0)
{ {
MF_AddNatives(RegisterNatives); MF_AddNatives(RegisterNatives);

View File

@ -350,7 +350,7 @@ cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params)
return 1; return 1;
} }
cell Call_Void_Float_Vector_TraceResult_Int(AMX *amx, cell *params) cell Call_Void_Float_Vector_Trace_Int(AMX *amx, cell *params)
{ {
SETUP(4); SETUP(4);
@ -524,3 +524,37 @@ cell Call_Void_Entvar_Float(AMX *amx, cell *params)
#endif #endif
} }
cell Call_Void_Int_Int_Int(AMX *amx, cell *params)
{
SETUP(2);
int i3=*MF_GetAmxAddr(amx, params[3]);
int i4=*MF_GetAmxAddr(amx, params[4]);
int i5=*MF_GetAmxAddr(amx, params[5]);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, int, int, int)>(__func)(pv, 0, i3, i4, i5);
#elif defined __linux__
reinterpret_cast<void (*)(void *, int, int, int)>(__func)(pv, i3, i4, i5);
#endif
return 1;
}
cell Call_Void_ItemInfo(AMX *amx, cell *params)
{
SETUP(1);
void *ptr=reinterpret_cast<void *>(*MF_GetAmxAddr(amx, params[3]));
if (ptr==0)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Null ItemInfo handle!");
return 0;
}
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, void *)>(__func)(pv, 0, ptr);
#elif defined __linux__
reinterpret_cast<void (*)(void *, void *)>(__func)(pv, ptr);
#endif
return 1;
}

View File

@ -32,7 +32,7 @@ cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params); cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
cell Call_Void_Float_Vector_TraceResult_Int(AMX *amx, cell *params); cell Call_Void_Float_Vector_Trace_Int(AMX *amx, cell *params);
cell Call_Str_Void(AMX *amx, cell *params); cell Call_Str_Void(AMX *amx, cell *params);
@ -50,5 +50,8 @@ cell Call_Int_pFloat_pFloat(AMX *amx, cell *params);
cell Call_Void_Entvar_Float(AMX *amx, cell *params); cell Call_Void_Entvar_Float(AMX *amx, cell *params);
cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
cell Call_Void_ItemInfo(AMX *amx, cell *params);
#endif #endif

View File

@ -51,7 +51,6 @@
spawn 2 spawn 2
precache 3 precache 3
cstrike_restart 4
keyvalue 5 keyvalue 5
objectcaps 8 objectcaps 8
activate 9 activate 9
@ -65,6 +64,8 @@
bloodcolor 17 bloodcolor 17
tracebleed 18 tracebleed 18
istriggered 19 istriggered 19
mymonsterpointer 20
mysquadmonsterpointer 21
gettogglestate 22 gettogglestate 22
addpoints 23 addpoints 23
addpointstoteam 24 addpointstoteam 24
@ -103,6 +104,54 @@
illumination 57 illumination 57
fvisible 58 fvisible 58
fvecvisible 59 fvecvisible 59
player_jump 78
player_duck 79
player_prethink 80
player_postthink 81
player_getgunposition 82
player_shouldfadeondeath 68
player_impulsecommands 84
player_updateclientdata 83
item_addtoplayer 61
item_addduplicate 62
item_getiteminfo 63
item_candeploy 64
item_candrop 65
item_deploy 66
item_canholster 68
item_holster 69
item_updateiteminfo 70
item_preframe 71
item_postframe 72
item_drop 73
item_kill 74
item_attachtoplayer 75
item_primaryammoindex 76
item_secondaryammoindex 77
item_updateclientdata 78
item_getweaponptr 79
item_itemslot 80
weapon_extractammo 81
weapon_extractclipammo 82
weapon_addweapon 83
weapon_playemptysound 84
weapon_resetemptysound 85
weapon_sendweaponanim 86
weapon_isusable 87
weapon_primaryattack 88
weapon_secondaryattack 89
weapon_reload 90
weapon_weaponidle 91
weapon_retireweapon 92
weapon_shouldweaponidle 93
weapon_usedecrement 94
cstrike_restart 4
cstrike_roundrespawn 86
@end @end
@section cstrike windows @section cstrike windows
pev 4 pev 4
@ -110,7 +159,6 @@
spawn 0 spawn 0
precache 1 precache 1
cstrike_restart 2
keyvalue 3 keyvalue 3
objectcaps 6 objectcaps 6
activate 7 activate 7
@ -124,6 +172,8 @@
bloodcolor 15 bloodcolor 15
tracebleed 16 tracebleed 16
istriggered 17 istriggered 17
mymonsterpointer 18
mysquadmonsterpointer 19
gettogglestate 20 gettogglestate 20
addpoints 21 addpoints 21
addpointstoteam 22 addpointstoteam 22
@ -162,6 +212,54 @@
illumination 55 illumination 55
fvisible 56 fvisible 56
fvecvisible 57 fvecvisible 57
player_jump 76
player_duck 77
player_prethink 78
player_postthink 79
player_getgunposition 80
player_shouldfadeondeath 66
player_impulsecommands 82
player_updateclientdata 81
item_addtoplayer 59
item_addduplicate 60
item_getiteminfo 61
item_candeploy 62
item_candrop 63
item_deploy 64
item_canholster 66
item_holster 67
item_updateiteminfo 68
item_preframe 69
item_postframe 70
item_drop 71
item_kill 72
item_attachtoplayer 73
item_primaryammoindex 74
item_secondaryammoindex 75
item_updateclientdata 76
item_getweaponptr 77
item_itemslot 78
weapon_extractammo 79
weapon_extractclipammo 80
weapon_addweapon 81
weapon_playemptysound 82
weapon_resetemptysound 83
weapon_sendweaponanim 84
weapon_isusable 85
weapon_primaryattack 86
weapon_secondaryattack 87
weapon_reload 88
weapon_weaponidle 89
weapon_retireweapon 90
weapon_shouldweaponidle 91
weapon_usedecrement 92
cstrike_restart 2
cstrike_roundrespawn 84
@end @end
@section dod linux @section dod linux
pev 0 pev 0
@ -188,6 +286,8 @@
killed 22 killed 22
bloodcolor 23 bloodcolor 23
tracebleed 24 tracebleed 24
mymonsterpointer 25
mysquadmonsterpointer 26
gettogglestate 27 gettogglestate 27
addpoints 28 addpoints 28
addpointstoteam 29 addpointstoteam 29
@ -252,6 +352,8 @@
killed 20 killed 20
bloodcolor 21 bloodcolor 21
tracebleed 22 tracebleed 22
mymonsterpointer 23
mysquadmonsterpointer 24
gettogglestate 25 gettogglestate 25
addpoints 26 addpoints 26
addpointstoteam 27 addpointstoteam 27
@ -313,6 +415,8 @@
bloodcolor 17 bloodcolor 17
tracebleed 18 tracebleed 18
istriggered 19 istriggered 19
mymonsterpointer 20
mysquadmonsterpointer 21
gettogglestate 22 gettogglestate 22
addplayeritem 23 addplayeritem 23
removeplayeritem 24 removeplayeritem 24
@ -377,6 +481,8 @@
bloodcolor 15 bloodcolor 15
tracebleed 16 tracebleed 16
istriggered 17 istriggered 17
mymonsterpointer 18
mysquadmonsterpointer 19
gettogglestate 20 gettogglestate 20
addplayeritem 21 addplayeritem 21
removeplayeritem 22 removeplayeritem 22
@ -444,6 +550,8 @@
bloodcolor 17 bloodcolor 17
tracebleed 18 tracebleed 18
istriggered 19 istriggered 19
mymonsterpointer 20
mysquadmonsterpointer 21
gettogglestate 22 gettogglestate 22
addpoints 23 addpoints 23
addpointstoteam 24 addpointstoteam 24
@ -506,6 +614,8 @@
bloodcolor 16 bloodcolor 16
tracebleed 17 tracebleed 17
istriggered 18 istriggered 18
mymonsterpointer 19
mysquadmonsterpointer 20
gettogglestate 21 gettogglestate 21
addpoints 22 addpoints 22
addpointstoteam 23 addpointstoteam 23
@ -570,6 +680,8 @@
bloodcolor 19 bloodcolor 19
tracebleed 20 tracebleed 20
istriggered 21 istriggered 21
mymonsterpointer 22
mysquadmonsterpointer 23
gettogglestate 24 gettogglestate 24
addpoints 25 addpoints 25
addpointstoteam 26 addpointstoteam 26
@ -631,6 +743,8 @@
bloodcolor 17 bloodcolor 17
tracebleed 18 tracebleed 18
istriggered 19 istriggered 19
mymonsterpointer 20
mysquadmonsterpointer 21
gettogglestate 22 gettogglestate 22
addpoints 23 addpoints 23
addpointstoteam 24 addpointstoteam 24

View File

@ -132,7 +132,9 @@ static void trim_line(char *input)
char *start=input; char *start=input;
while ( *start==' ' || while ( *start==' ' ||
*start=='\t') *start=='\t' ||
*start=='\r' ||
*start=='\n')
{ {
start++; start++;
} }
@ -149,7 +151,7 @@ static void trim_line(char *input)
start+=strlen(start) - 1; start+=strlen(start) - 1;
while ( start > oldinput && while ( start >= oldinput &&
( *start == '\0' || ( *start == '\0' ||
*start == ' ' || *start == ' ' ||
*start == '\r' || *start == '\r' ||

View File

@ -28,6 +28,8 @@ enum
Ham_BloodColor, Ham_BloodColor,
Ham_TraceBleed, Ham_TraceBleed,
Ham_IsTriggered, Ham_IsTriggered,
Ham_MyMonsterPointer,
Ham_MySquadMonsterPointer,
Ham_GetToggleState, Ham_GetToggleState,
Ham_AddPoints, Ham_AddPoints,
Ham_AddPointsToTeam, Ham_AddPointsToTeam,
@ -67,11 +69,55 @@ enum
Ham_FVisible, Ham_FVisible,
Ham_FVecVisible, Ham_FVecVisible,
Ham_Player_Jump,
Ham_Player_Duck,
Ham_Player_PreThink,
Ham_Player_PostThink,
Ham_Player_GetGunPosition,
Ham_Player_ShouldFadeOnDeath,
Ham_Player_ImpulseCommands,
Ham_Player_UpdateClientData,
Ham_Item_AddToPlayer,
Ham_Item_AddDuplicate,
Ham_Item_GetItemInfo,
Ham_Item_CanDeploy,
Ham_Item_Deploy,
Ham_Item_CanHolster,
Ham_Item_Holster,
Ham_Item_UpdateItemInfo,
Ham_Item_PreFrame,
Ham_Item_PostFrame,
Ham_Item_Drop,
Ham_Item_Kill,
Ham_Item_AttachToPlayer,
Ham_Item_PrimaryAmmoIndex,
Ham_Item_SecondaryAmmoIndex,
Ham_Item_UpdateClientData,
Ham_Item_GetWeaponPtr,
Ham_Item_ItemSlot,
Ham_Weapon_ExtractAmmo,
Ham_Weapon_ExtractClipAmmo,
Ham_Weapon_AddWeapon,
Ham_Weapon_PlayEmptySound,
Ham_Weapon_ResetEmptySound,
Ham_Weapon_SendWeaponAnim,
Ham_Weapon_IsUsable,
Ham_Weapon_PrimaryAttack,
Ham_Weapon_SecondaryAttack,
Ham_Weapon_Reload,
Ham_Weapon_WeaponIdle,
Ham_Weapon_RetireWeapon,
Ham_Weapon_ShouldWeaponIdle,
Ham_Weapon_UseDecrement,
Ham_TS_BreakableRespawn, Ham_TS_BreakableRespawn,
Ham_TS_CanUsedThroughWalls, Ham_TS_CanUsedThroughWalls,
Ham_TS_RespawnWait, Ham_TS_RespawnWait,
Ham_CS_Restart, Ham_CS_Restart,
Ham_CS_RoundRespawn,
Ham_DOD_RoundRespawn, Ham_DOD_RoundRespawn,
Ham_DOD_RoundRespawnEnt, Ham_DOD_RoundRespawnEnt,

View File

@ -51,6 +51,7 @@ extern bool gDoForwards;
#define P_TRACE(__PARAM) __vec->push_back(new Data(RET_TRACE, (void *) (__PARAM))); #define P_TRACE(__PARAM) __vec->push_back(new Data(RET_TRACE, (void *) (__PARAM)));
#define P_PTRVECTOR(__PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) (__PARAM))); #define P_PTRVECTOR(__PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) (__PARAM)));
#define P_PTRFLOAT(__PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) (__PARAM))); #define P_PTRFLOAT(__PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) (__PARAM)));
#define P_ITEMINFO(__PARAM) __vec->push_back(new Data(RET_ITEMINFO, (void *) & (__PARAM)));
#define KILL_VECTOR() \ #define KILL_VECTOR() \
CVector<Data *>::iterator end=__vec->end(); \ CVector<Data *>::iterator end=__vec->end(); \
@ -570,7 +571,7 @@ void Hook_Void_Entvar_Float_Vector_Trace_Int(Hook *hook, void *pthis, entvars_t
POP() POP()
} }
void Hook_Void_Float_Vector_TraceResult_Int(Hook *hook, void *pthis, float f1, Vector v1, TraceResult *tr1, int i1) void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1, Vector v1, TraceResult *tr1, int i1)
{ {
PUSH_VOID() PUSH_VOID()
@ -833,3 +834,53 @@ void Hook_Void_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
POP() POP()
} }
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3)
{
PUSH_VOID()
MAKE_VECTOR()
P_INT(i1)
P_INT(i2)
P_INT(i3)
PRE_START()
,i1, i2, i3
PRE_END()
#if defined _WIN32
reinterpret_cast<void (__fastcall*)(void*, int, int, int, int)>(hook->func)(pthis, 0, i1, i2, i3);
#elif defined __linux__
reinterpret_cast<void (*)(void*, int, int, int)>(hook->func)(pthis, i1, i2, i3);
#endif
POST_START()
,i1, i2, i3
POST_END()
KILL_VECTOR()
POP()
}
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
{
PUSH_VOID()
MAKE_VECTOR()
P_ITEMINFO(iteminfo)
PRE_START()
,iteminfo
PRE_END()
#if defined _WIN32
reinterpret_cast<void (__fastcall*)(void*, int, void *)>(hook->func)(pthis, 0, iteminfo);
#elif defined __linux__
reinterpret_cast<void (*)(void*, void *)>(hook->func)(pthis, iteminfo);
#endif
POST_START()
,iteminfo
POST_END()
KILL_VECTOR()
POP()
}

View File

@ -2,66 +2,126 @@
#ifndef HOOK_CALLBACKS_H #ifndef HOOK_CALLBACKS_H
#define HOOK_CALLBACKS_H #define HOOK_CALLBACKS_H
// RT_<TYPE> is true if the function returns void, false otherwise
// (it also would be true for large return functions such as Vector)
// PC_<TYPE> is how many dwords get passed to the function (minus the "this" pointer)
// (it is one larger for large return functions such as Vector)
const bool RT_Void_Void = true;
const int PC_Void_Void = 0;
void Hook_Void_Void(Hook *hook, void *pthis); void Hook_Void_Void(Hook *hook, void *pthis);
const bool RT_Int_Void = false;
const int PC_Int_Void = 0;
int Hook_Int_Void(Hook *hook, void *pthis); int Hook_Int_Void(Hook *hook, void *pthis);
const bool RT_Void_Entvar = true;
const int PC_Void_Entvar = 1;
void Hook_Void_Entvar(Hook *hook, void *pthis, entvars_t *entvar); void Hook_Void_Entvar(Hook *hook, void *pthis, entvars_t *entvar);
const bool RT_Void_Cbase = true;
const int PC_Void_Cbase = 1;
void Hook_Void_Cbase(Hook *hook, void *pthis, void *other); void Hook_Void_Cbase(Hook *hook, void *pthis, void *other);
const bool RT_Int_Float_Int = false;
const int PC_Int_Float_Int = 2;
int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1); int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1);
const bool RT_Void_Entvar_Int = true;
const int PC_Void_Entvar_Int = 2;
void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1); void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1);
const bool RT_Int_Cbase = false;
const int PC_Int_Cbase = 1;
int Hook_Int_Cbase(Hook *hook, void *pthis, void *cb1); int Hook_Int_Cbase(Hook *hook, void *pthis, void *cb1);
const bool RT_Void_Int_Int = true;
const int PC_Void_Int_Int = 2;
void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2); void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2);
const bool RT_Int_Int_Str_Int = false;
const int PC_Int_Int_Str_Int = 3;
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1,
int i2); int i2);
const bool RT_Int_Int = false;
const int PC_Int_Int = 1;
int Hook_Int_Int(Hook *hook, void *pthis, int i1); int Hook_Int_Int(Hook *hook, void *pthis, int i1);
const bool RT_Int_Entvar = false;
const int PC_Int_Entvar = 1;
int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1); int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1);
const bool RT_Int_Entvar_Entvar_Float_Int = false;
const int PC_Int_Entvar_Entvar_Float_Int = 4;
int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis, int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis,
entvars_t *inflictor, entvars_t *inflictor,
entvars_t *attacker, float damage, entvars_t *attacker, float damage,
int damagebits); int damagebits);
const bool RT_Void_Int = true;
const int PC_Void_Int = 1;
void Hook_Void_Int(Hook *hook, void *pthis, int i1); void Hook_Void_Int(Hook *hook, void *pthis, int i1);
const bool RT_Void_Cbase_Cbase_Int_Float = true;
const int PC_Void_Cbase_Cbase_Int_Float = 4;
void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1, void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1,
void *cb2, int i1, float f1); void *cb2, int i1, float f1);
const bool RT_Void_Entvar_Float_Vector_Trace_Int = true;
const int PC_Void_Entvar_Float_Vector_Trace_Int = 7;
void Hook_Void_Entvar_Float_Vector_Trace_Int(Hook *hook, void *pthis, void Hook_Void_Entvar_Float_Vector_Trace_Int(Hook *hook, void *pthis,
entvars_t *ev1, float f1, entvars_t *ev1, float f1,
Vector v1, TraceResult *tr1, Vector v1, TraceResult *tr1,
int i1); int i1);
void Hook_Void_Float_Vector_TraceResult_Int(Hook *hook, void *pthis, float f1, const bool RT_Void_Float_Vector_Trace_Int = true;
const int PC_Void_Float_Vector_Trace_Int = 6;
void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1,
Vector v1, TraceResult *tr1, Vector v1, TraceResult *tr1,
int i1); int i1);
const bool RT_Str_Void = false;
const int PC_Str_Void = 0;
const char *Hook_Str_Void(Hook *hook, void *pthis); const char *Hook_Str_Void(Hook *hook, void *pthis);
const bool RT_Cbase_Void = false;
const int PC_Cbase_Void = 0;
void *Hook_Cbase_Void(Hook *hook, void *pthis); void *Hook_Cbase_Void(Hook *hook, void *pthis);
const bool RT_Vector_Void = true;
const int PC_Vector_Void = 1;
void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis); void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
const bool RT_Vector_pVector = true;
const int PC_Vector_pVector = 2;
void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1); void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1);
const bool RT_Int_pVector = false;
const int PC_Int_pVector = 1;
int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1); int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1);
const bool RT_Void_Entvar_Float_Float = true;
const int PC_Void_Entvar_Float_Float = 3;
void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1, void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1,
float f1, float f2); float f1, float f2);
const bool RT_Int_pFloat_pFloat = false;
const int PC_Int_pFloat_pFloat = 2;
int Hook_Int_pFloat_pFloat(Hook *hook, void *pthis, float *f1, int Hook_Int_pFloat_pFloat(Hook *hook, void *pthis, float *f1,
float *f2); float *f2);
const bool RT_Void_Entvar_Float = true;
const int PC_Void_Entvar_Float = 2;
void Hook_Void_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1); void Hook_Void_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
const bool RT_Void_Int_Int_Int = true;
const int PC_Void_Int_Int_Int = 3;
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3);
const bool RT_Void_ItemInfo = true;
const int PC_Void_ItemInfo = 1;
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
#endif #endif

View File

@ -78,7 +78,7 @@ int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
} }
int Create_Void_Float_Vector_TraceResult_Int(AMX *amx, const char *func) int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
} }
@ -122,4 +122,11 @@ int Create_Void_Entvar_Float(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
} }
int Create_Void_Int_Int_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
int Create_Void_ItemInfo(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL);
}

View File

@ -32,7 +32,7 @@ int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func);
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func); int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func);
int Create_Void_Float_Vector_TraceResult_Int(AMX *amx, const char *func); int Create_Void_Float_Vector_Trace_Int(AMX *amx, const char *func);
int Create_Str_Void(AMX *amx, const char *func); int Create_Str_Void(AMX *amx, const char *func);
@ -50,5 +50,8 @@ int Create_Int_pFloat_pFloat(AMX *amx, const char *func);
int Create_Void_Entvar_Float(AMX *amx, const char *func); int Create_Void_Entvar_Float(AMX *amx, const char *func);
int Create_Void_Int_Int_Int(AMX *amx, const char *func);
int Create_Void_ItemInfo(AMX *amx, const char *func);
#endif #endif

View File

@ -25,103 +25,151 @@ bool gDoForwards=true;
CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL]; CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
#define V(__STUFF__) reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__ #define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, RT_##__STUFF__, PC_##__STUFF__, reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
hook_t hooklist[] = hook_t hooklist[] =
{ {
{ 0, 0, "spawn", true, 0, V(Void_Void) }, // Spawn { V("spawn", Void_Void) },
{ 0, 0, "precache", true, 0, V(Void_Void) }, // Precache { V("precache", Void_Void) },
{ 0, 0, "keyvalue", true, 1, V(Void_Int) }, // Keyvalue { V("keyvalue", Void_Int) },
{ 0, 0, "objectcaps", false, 0, V(Int_Void) }, // ObjectCaps { V("objectcaps", Int_Void) },
{ 0, 0, "activate", true, 0, V(Void_Void) }, // Activate { V("activate", Void_Void) },
{ 0, 0, "setobjectcollisionbox", true, 0, V(Void_Void) }, // SetObjectCollisionBox { V("setobjectcollisionbox", Void_Void) },
{ 0, 0, "classify", false, 0, V(Int_Void) }, // Classify { V("classify", Int_Void) },
{ 0, 0, "deathnotice", true, 1, V(Void_Entvar) }, // DeathNotice { V("deathnotice", Void_Entvar) },
{ 0, 0, "traceattack", true, 7, V(Void_Entvar_Float_Vector_Trace_Int) }, // TraceAttack { V("traceattack", Void_Entvar_Float_Vector_Trace_Int) },
{ 0, 0, "takedamage", false, 4, V(Int_Entvar_Entvar_Float_Int) }, // Takedamage { V("takedamage", Int_Entvar_Entvar_Float_Int) },
{ 0, 0, "takehealth", false, 2, V(Int_Float_Int) }, // TakeHealth { V("takehealth", Int_Float_Int) },
{ 0, 0, "killed", true, 2, V(Void_Entvar_Int) }, // Killed { V("killed", Void_Entvar_Int) },
{ 0, 0, "bloodcolor", false, 0, V(Int_Void) }, // BloodColor { V("bloodcolor", Int_Void) },
{ 0, 0, "tracebleed", true, 6, V(Void_Float_Vector_TraceResult_Int) }, // TraceBleed { V("tracebleed", Void_Float_Vector_Trace_Int) },
{ 0, 0, "istriggered", false, 1, V(Int_Cbase) }, // IsTriggered { V("istriggered", Int_Cbase) },
{ 0, 0, "gettogglestate", false, 0, V(Int_Void) }, // GetToggleState { V("mymonsterpointer", Cbase_Void) },
{ 0, 0, "addpoints", true, 2, V(Void_Int_Int) }, // AddPoints { V("mysquadmonsterpointer", Cbase_Void) },
{ 0, 0, "addpointstoteam", true, 2, V(Void_Int_Int) }, // AddPointsToTeam { V("gettogglestate", Int_Void) },
{ 0, 0, "addplayeritem", false, 1, V(Int_Cbase) }, // AddPlayerItem { V("addpoints", Void_Int_Int) },
{ 0, 0, "removeplayeritem", false, 1, V(Int_Cbase) }, // RemovePlayerItem { V("addpointstoteam", Void_Int_Int) },
{ 0, 0, "giveammo", false, 3, V(Int_Int_Str_Int) }, // GiveAmmo { V("addplayeritem", Int_Cbase) },
{ 0, 0, "getdelay", false, 0, V(Int_Void) }, // GetDelay { V("removeplayeritem", Int_Cbase) },
{ 0, 0, "ismoving", false, 0, V(Int_Void) }, // IsMoving { V("giveammo", Int_Int_Str_Int) },
{ 0, 0, "overridereset", true, 0, V(Void_Void) }, // OverrideReset { V("getdelay", Int_Void) },
{ 0, 0, "damagedecal", false, 1, V(Int_Int) }, // DamageDecal { V("ismoving", Int_Void) },
{ 0, 0, "settogglestate", true, 1, V(Void_Int) }, // SetToggleState { V("overridereset", Void_Void) },
{ 0, 0, "startsneaking", true, 0, V(Void_Void) }, // StartSneaking { V("damagedecal", Int_Int) },
{ 0, 0, "stopsneaking", true, 0, V(Void_Void) }, // StopSneaking { V("settogglestate", Void_Int) },
{ 0, 0, "oncontrols", false, 1, V(Int_Entvar) }, // OnControls { V("startsneaking", Void_Void) },
{ 0, 0, "issneaking", false, 0, V(Int_Void) }, // IsSneaking { V("stopsneaking", Void_Void) },
{ 0, 0, "isalive", false, 0, V(Int_Void) }, // IsAlive { V("oncontrols", Int_Entvar) },
{ 0, 0, "isbspmodel", false, 0, V(Int_Void) }, // IsBSPModel { V("issneaking", Int_Void) },
{ 0, 0, "reflectgauss", false, 0, V(Int_Void) }, // ReflectGauss { V("isalive", Int_Void) },
{ 0, 0, "hastarget", false, 1, V(Int_Int) }, // HasTarget { V("isbspmodel", Int_Void) },
{ 0, 0, "isinworld", false, 0, V(Int_Void) }, // IsInWorld { V("reflectgauss", Int_Void) },
{ 0, 0, "isplayer", false, 0, V(Int_Void) }, // IsPlayer { V("hastarget", Int_Int) },
{ 0, 0, "isnetclient", false, 0, V(Int_Void) }, // IsNetClient { V("isinworld", Int_Void) },
{ 0, 0, "teamid", false, 0, V(Str_Void) }, // TeamID { V("isplayer", Int_Void) },
{ 0, 0, "getnexttarget", false, 0, V(Cbase_Void) }, // GetNextTarget { V("isnetclient", Int_Void) },
{ 0, 0, "think", true, 0, V(Void_Void) }, // Think { V("teamid", Str_Void) },
{ 0, 0, "touch", true, 1, V(Void_Cbase) }, // Touch { V("getnexttarget", Cbase_Void) },
{ 0, 0, "use", true, 4, V(Void_Cbase_Cbase_Int_Float) }, // Use { V("think", Void_Void) },
{ 0, 0, "blocked", true, 1, V(Void_Cbase) }, // Blocked { V("touch", Void_Cbase) },
{ 0, 0, "respawn", false, 0, V(Cbase_Void) }, // Respawn TODO: Cbase this { V("use", Void_Cbase_Cbase_Int_Float) },
{ 0, 0, "updateowner", true, 0, V(Void_Void) }, // UpdateOwner { V("blocked", Void_Cbase) },
{ 0, 0, "fbecomeprone", false, 0, V(Int_Void) }, // FBecomeProne { V("respawn", Cbase_Void) },
{ V("updateowner", Void_Void) },
{ V("fbecomeprone", Int_Void) },
{ V("center", Vector_Void) },
{ V("eyeposition", Vector_Void) },
{ V("earposition", Vector_Void) },
{ V("bodytarget", Vector_pVector) },
{ V("illumination", Int_Void) },
{ V("fvisible", Int_Cbase) },
{ V("fvecvisible", Int_pVector) },
/** Entity specific hooks **/
/* CBasePlayer */
{ V("player_jump", Void_Void) },
{ V("player_duck", Void_Void) },
{ V("player_prethink", Void_Void) },
{ V("player_postthink", Void_Void) },
{ V("player_getgunposition", Vector_Void) },
{ V("player_shouldfadeondeath", Int_Void) },
{ V("player_impulsecommands", Void_Void) },
{ V("player_updateclientdata", Void_Void) },
// Vectors are over 2 registers large, so they get passed weird /* CBasePlayerItem */
{ 0, 0, "center", true, 1, V(Vector_Void) }, // Center { V("item_addtoplayer", Int_Cbase) },
{ 0, 0, "eyeposition", true, 1, V(Vector_Void) }, // EyePosition { V("item_addduplicate", Int_Cbase) },
{ 0, 0, "earposition", true, 1, V(Vector_Void) }, // EarPosition { V("item_getiteminfo", Void_ItemInfo) },
{ 0, 0, "bodytarget", true, 2, V(Vector_pVector) }, // BodyTarget { V("item_candeploy", Int_Void) },
{ 0, 0, "illumination", false, 0, V(Int_Void) }, // Illumination { V("item_deploy", Int_Void) },
{ 0, 0, "fvisible", false, 1, V(Int_Cbase) }, // FVisible { V("item_canholster", Int_Void) },
{ 0, 0, "fvecvisible", false, 1, V(Int_pVector) }, // FVecVisible { V("item_holster", Void_Int) },
{ V("item_updateiteminfo", Void_Void) },
{ V("item_preframe", Void_Void) },
{ V("item_postframe", Void_Void) },
{ V("item_drop", Void_Void) },
{ V("item_kill", Void_Void) },
{ V("item_attachtoplayer", Void_Cbase) },
{ V("item_primaryammoindex", Int_Void) },
{ V("item_secondaryammoindex", Int_Void) },
{ V("item_updateclientdata", Int_Cbase) },
{ V("item_getweaponptr", Cbase_Void) },
{ V("item_itemslot", Int_Void) },
/* CBasePlayerWeapon */
{ V("weapon_extractammo", Int_Cbase) },
{ V("weapon_extractclipammo", Int_Cbase) },
{ V("weapon_addweapon", Int_Void) },
{ V("weapon_playemptysound", Int_Void) },
{ V("weapon_resetemptysound", Void_Void) },
{ V("weapon_sendweaponanim", Void_Int_Int_Int) },
{ V("weapon_isusable", Int_Void) },
{ V("weapon_primaryattack", Void_Void) },
{ V("weapon_secondaryattack", Void_Void) },
{ V("weapon_reload", Void_Void) },
{ V("weapon_weaponidle", Void_Void) },
{ V("weapon_retireweapon", Void_Void) },
{ V("weapon_shouldweaponidle", Int_Void) },
{ V("weapon_usedecrement", Int_Void) },
/** Mod specific hooks **/ /** Mod specific hooks **/
/* The Specialists */ /* The Specialists */
{ 0, 0, "ts_breakablerespawn", false, 1, V(Int_Int) }, // TS_BreakableRespawn { V("ts_breakablerespawn", Int_Int) },
{ 0, 0, "ts_canusedthroughwalls", false, 0, V(Int_Void) }, // TS_CanUsedThroughWalls { V("ts_canusedthroughwalls", Int_Void) },
{ 0, 0, "ts_respawnwait", false, 0, V(Int_Void) }, // TS_RespawnWait { V("ts_respawnwait", Int_Void) },
/* Counter-Strike */ /* Counter-Strike */
{ 0, 0, "cstrike_restart", true, 0, V(Void_Void) }, // CS_Restart { V("cstrike_restart", Void_Void) },
{ V("cstrike_roundrespawn", Void_Void) },
/* Day of Defeat */ /* Day of Defeat */
{ 0, 0, "dod_roundrespawn", true, 0, V(Void_Void) }, // DOD_RoundRespawn { V("dod_roundrespawn", Void_Void) },
{ 0, 0, "dod_roundrespawnent", true, 0, V(Void_Void) }, // DOD_RoundRespawnEnt { V("dod_roundrespawnent", Void_Void) },
{ 0, 0, "dod_roundstore", true, 0, V(Void_Void) }, // DOD_RoundStore { V("dod_roundstore", Void_Void) },
{ 0, 0, "dod_areasetindex", true, 1, V(Void_Int) }, // DOD_AreaSetIndex { V("dod_areasetindex", Void_Int) },
{ 0, 0, "dod_areasendstatus", true, 1, V(Void_Cbase) }, // DOD_AreaSendStatus { V("dod_areasendstatus", Void_Cbase) },
{ 0, 0, "dod_getstate", false, 0, V(Int_Void) }, // DOD_GetState { V("dod_getstate", Int_Void) },
{ 0, 0, "dod_getstateent", false, 1, V(Int_Cbase) }, // DOD_GetStateEnt { V("dod_getstateent", Int_Cbase) },
/* Team Fortress Classic */ /* Team Fortress Classic */
// This next one is just a huge guess // This next one is just a huge guess
{ 0, 0, "tfc_dbgetitemname", false, 0, V(Str_Void) }, // TFC_DbGetItemName { V("tfc_dbgetitemname", Str_Void) },
{ 0, 0, "tfc_engineeruse", false, 1, V(Int_Cbase) }, // TFC_EngineerUse { V("tfc_engineeruse", Int_Cbase) },
{ 0, 0, "tfc_finished", true, 0, V(Void_Void) }, // TFC_Finished { V("tfc_finished", Void_Void) },
{ 0, 0, "tfc_empexplode", true, 3, V(Void_Entvar_Float_Float) }, // TFC_EmpExplode { V("tfc_empexplode", Void_Entvar_Float_Float) },
{ 0, 0, "tfc_calcempdmgrad", false, 2, V(Int_pFloat_pFloat) }, // TFC_CalcEmpDmgRad { V("tfc_calcempdmgrad", Int_pFloat_pFloat) },
{ 0, 0, "tfc_takeempblast", true, 1, V(Void_Entvar) }, // TFC_TakeEmpBlast { V("tfc_takeempblast", Void_Entvar) },
{ 0, 0, "tfc_empremove", true, 0, V(Void_Void) }, // TFC_EmpRemove { V("tfc_empremove", Void_Void) },
{ 0, 0, "tfc_takeconcussionblast", true, 2, V(Void_Entvar_Float) }, // TFC_TakeConcussionBlast { V("tfc_takeconcussionblast", Void_Entvar_Float) },
{ 0, 0, "tfc_concuss", true, 1, V(Void_Entvar) }, // TFC_Concuss { V("tfc_concuss", Void_Entvar) },
/* Natural-Selection */ /* Natural-Selection */
{ 0, 0, "ns_getpointvalue", false, 0, V(Int_Void) }, // NS_GetPointValue { V("ns_getpointvalue", Int_Void) },
{ 0, 0, "ns_awardkill", true, 1, V(Void_Entvar) }, // NS_AwardKill { V("ns_awardkill", Void_Entvar) },
{ 0, 0, "ns_resetentity", true, 0, V(Void_Void) }, // NS_ResetEntity { V("ns_resetentity", Void_Void) },
{ 0, 0, "ns_updateonremove", true, 0, V(Void_Void) }, // NS_UpdateOnRemove { V("ns_updateonremove", Void_Void) },
}; };

View File

@ -186,6 +186,8 @@ enum Ham
Ham_TraceBleed, Ham_TraceBleed,
Ham_IsTriggered, Ham_IsTriggered,
Ham_MyMonsterPointer,
Ham_MySquadMonsterPointer,
Ham_GetToggleState, Ham_GetToggleState,
/** /**
@ -413,6 +415,57 @@ enum Ham
Ham_FVisible, Ham_FVisible,
Ham_FVecVisible, Ham_FVecVisible,
Ham_Player_Jump,
Ham_Player_Duck,
Ham_Player_PreThink,
Ham_Player_PostThink,
Ham_Player_GetGunPosition,
Ham_Player_ShouldFadeOnDeath,
Ham_Player_ImpulseCommands,
Ham_Player_UpdateClientData,
/**
* Items have all the attributes of normal entities in addition to these.
*/
Ham_Item_AddToPlayer,
Ham_Item_AddDuplicate,
Ham_Item_GetItemInfo,
Ham_Item_CanDeploy,
Ham_Item_Deploy,
Ham_Item_CanHolster,
Ham_Item_Holster,
Ham_Item_UpdateItemInfo,
Ham_Item_PreFrame,
Ham_Item_PostFrame,
Ham_Item_Drop,
Ham_Item_Kill,
Ham_Item_AttachToPlayer,
Ham_Item_PrimaryAmmoIndex,
Ham_Item_SecondaryAmmoIndex,
Ham_Item_UpdateClientData,
Ham_Item_GetWeaponPtr,
Ham_Item_ItemSlot,
/**
* Weapons have all the attributes to Ham_Item_*, in addition to these.
*/
Ham_Weapon_ExtractAmmo,
Ham_Weapon_ExtractClipAmmo,
Ham_Weapon_AddWeapon,
Ham_Weapon_PlayEmptySound,
Ham_Weapon_ResetEmptySound,
Ham_Weapon_SendWeaponAnim,
Ham_Weapon_IsUsable,
Ham_Weapon_PrimaryAttack,
Ham_Weapon_SecondaryAttack,
Ham_Weapon_Reload,
Ham_Weapon_WeaponIdle,
Ham_Weapon_RetireWeapon,
Ham_Weapon_ShouldWeaponIdle,
Ham_Weapon_UseDecrement,
Ham_TS_BreakableRespawn, Ham_TS_BreakableRespawn,
Ham_TS_CanUsedThroughWalls, Ham_TS_CanUsedThroughWalls,
Ham_TS_RespawnWait, Ham_TS_RespawnWait,
@ -420,9 +473,16 @@ enum Ham
/** /**
* Description: This is called on a map reset for most map based entities. * Description: This is called on a map reset for most map based entities.
* Forward params: function(this); * Forward params: function(this);
* Execute params: ExecuteHam(Ham_Respawn, this); * Execute params: ExecuteHam(Ham_CS_Restart, this);
*/ */
Ham_CS_Restart, Ham_CS_Restart,
/**
* Description: Respawn function for players/bots only! Do not use this on non player/bot entities!
* Forward params: function(this);
* Execute params: ExecuteHam(Ham_CS_RoundRespawn, this);
*/
Ham_CS_RoundRespawn,
Ham_DOD_RoundRespawn, Ham_DOD_RoundRespawn,
Ham_DOD_RoundRespawnEnt, Ham_DOD_RoundRespawnEnt,