Forgot to update SVN with TS3.0 and RegisterHamFromEntity changes
This commit is contained in:
parent
4b02ffa920
commit
2cbf7fca08
@ -64,6 +64,7 @@ void OnAmxxAttach(void)
|
||||
assert(strcmp(hooklist[Ham_Weapon_ExtractAmmo].name, "weapon_extractammo")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_BreakableRespawn].name, "ts_breakablerespawn")==0);
|
||||
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
||||
assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0);
|
||||
|
||||
MF_AddNatives(pdata_natives_safe);
|
||||
if (ReadConfig() > 0)
|
||||
|
@ -624,3 +624,20 @@ cell Call_Float_Void(AMX *amx, cell *params)
|
||||
return 1;
|
||||
|
||||
}
|
||||
cell Call_Void_Float_Int(AMX* amx, cell* params)
|
||||
{
|
||||
SETUP(2);
|
||||
|
||||
#ifdef _WIN32
|
||||
reinterpret_cast<void (__fastcall *)(void*, int, float, char)>(__func)(pv, 0, amx_ctof2(params[3]), static_cast<char>(params[4]));
|
||||
#elif defined __linux__
|
||||
reinterpret_cast<void (*)(void*, float, char)>(__func)(pv, amx_ctof2(params[3]), static_cast<char>(params[4]));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
cell Call_Deprecated(AMX *amx, cell *params)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Ham function is deprecated.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -86,4 +86,8 @@ cell Call_Void_ItemInfo(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Float_Void(AMX *amx, cell *params);
|
||||
|
||||
cell Call_Void_Float_Int(AMX* amx, cell* params);
|
||||
|
||||
cell Call_Deprecated(AMX* amx, cell* params);
|
||||
|
||||
#endif
|
||||
|
@ -922,220 +922,229 @@
|
||||
pev 0
|
||||
base 0x60
|
||||
|
||||
spawn 5
|
||||
precache 6
|
||||
keyvalue 7
|
||||
objectcaps 10
|
||||
activate 11
|
||||
setobjectcollisionbox 12
|
||||
classify 13
|
||||
deathnotice 14
|
||||
traceattack 15
|
||||
takedamage 16
|
||||
takehealth 17
|
||||
killed 18
|
||||
bloodcolor 19
|
||||
tracebleed 20
|
||||
istriggered 21
|
||||
mymonsterpointer 22
|
||||
mysquadmonsterpointer 23
|
||||
gettogglestate 24
|
||||
addpoints 25
|
||||
addpointstoteam 26
|
||||
addplayeritem 27
|
||||
removeplayeritem 28
|
||||
giveammo 29
|
||||
getdelay 30
|
||||
ismoving 31
|
||||
overridereset 32
|
||||
damagedecal 33
|
||||
settogglestate 34
|
||||
startsneaking 35
|
||||
stopsneaking 36
|
||||
oncontrols 37
|
||||
issneaking 38
|
||||
isalive 39
|
||||
isbspmodel 40
|
||||
reflectgauss 41
|
||||
hastarget 42
|
||||
isinworld 43
|
||||
isplayer 44
|
||||
isnetclient 45
|
||||
teamid 46
|
||||
getnexttarget 47
|
||||
think 48
|
||||
touch 49
|
||||
use 50
|
||||
blocked 51
|
||||
respawn 52
|
||||
updateowner 53
|
||||
fbecomeprone 54
|
||||
center 55
|
||||
eyeposition 56
|
||||
earposition 57
|
||||
bodytarget 58
|
||||
illumination 59
|
||||
fvisible 60
|
||||
fvecvisible 61
|
||||
spawn 9
|
||||
precache 10
|
||||
keyvalue 11
|
||||
objectcaps 14
|
||||
activate 15
|
||||
setobjectcollisionbox 18
|
||||
classify 19
|
||||
deathnotice 20
|
||||
traceattack 21
|
||||
takedamage 22
|
||||
takehealth 23
|
||||
killed 24
|
||||
bloodcolor 25
|
||||
tracebleed 26
|
||||
istriggered 27
|
||||
mymonsterpointer 28
|
||||
mysquadmonsterpointer 29
|
||||
gettogglestate 30
|
||||
addpoints 31
|
||||
addpointstoteam 32
|
||||
addplayeritem 33
|
||||
removeplayeritem 34
|
||||
giveammo 35
|
||||
getdelay 36
|
||||
ismoving 37
|
||||
overridereset 38
|
||||
damagedecal 39
|
||||
settogglestate 40
|
||||
startsneaking 41
|
||||
stopsneaking 42
|
||||
oncontrols 43
|
||||
issneaking 44
|
||||
isalive 45
|
||||
isbspmodel 46
|
||||
reflectgauss 47
|
||||
hastarget 48
|
||||
isinworld 49
|
||||
isplayer 50
|
||||
isnetclient 51
|
||||
teamid 52
|
||||
getnexttarget 53
|
||||
think 54
|
||||
touch 55
|
||||
use 56
|
||||
blocked 57
|
||||
respawn 59
|
||||
updateowner 60
|
||||
fbecomeprone 61
|
||||
center 62
|
||||
eyeposition 63
|
||||
earposition 64
|
||||
bodytarget 65
|
||||
illumination 66
|
||||
fvisible 67
|
||||
fvecvisible 68
|
||||
|
||||
player_jump 79
|
||||
player_duck 80
|
||||
player_prethink 81
|
||||
player_postthink 82
|
||||
player_getgunposition 83
|
||||
player_shouldfadeondeath 70
|
||||
player_impulsecommands 85
|
||||
player_updateclientdata 84
|
||||
player_jump 86
|
||||
player_duck 87
|
||||
player_prethink 88
|
||||
player_postthink 89
|
||||
player_getgunposition 90
|
||||
player_shouldfadeondeath 77
|
||||
player_impulsecommands 92
|
||||
player_updateclientdata 91
|
||||
|
||||
item_addtoplayer 63
|
||||
item_addduplicate 64
|
||||
item_getiteminfo 65
|
||||
item_candeploy 66
|
||||
item_deploy 67
|
||||
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
|
||||
item_addtoplayer 70
|
||||
item_addduplicate 71
|
||||
item_candeploy 73
|
||||
item_deploy 74
|
||||
item_canholster 75
|
||||
item_holster 76
|
||||
item_updateiteminfo 77
|
||||
item_preframe 78
|
||||
item_postframe 79
|
||||
item_drop 80
|
||||
item_kill 81
|
||||
item_attachtoplayer 82
|
||||
item_primaryammoindex 83
|
||||
item_secondaryammoindex 84
|
||||
item_updateclientdata 85
|
||||
item_getweaponptr 86
|
||||
item_itemslot 87
|
||||
|
||||
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 91
|
||||
weapon_weaponidle 92
|
||||
weapon_retireweapon 93
|
||||
weapon_shouldweaponidle 94
|
||||
weapon_usedecrement 95
|
||||
weapon_extractammo 88
|
||||
weapon_extractclipammo 89
|
||||
weapon_addweapon 90
|
||||
weapon_playemptysound 91
|
||||
weapon_resetemptysound 92
|
||||
weapon_sendweaponanim 93
|
||||
weapon_isusable 94
|
||||
weapon_primaryattack 95
|
||||
weapon_secondaryattack 96
|
||||
weapon_reload 98
|
||||
weapon_weaponidle 99
|
||||
weapon_retireweapon 100
|
||||
weapon_shouldweaponidle 101
|
||||
weapon_usedecrement 102
|
||||
|
||||
ts_breakablerespawn 2
|
||||
ts_canusedthroughwalls 3
|
||||
ts_respawnwait 4
|
||||
ts_weapon_alternateattack 90
|
||||
ts_giveslowmul 4
|
||||
ts_goslow 5
|
||||
ts_inslow 6
|
||||
ts_isobjective 7
|
||||
ts_enableobjective 8
|
||||
ts_onfreeentprivatedata 12
|
||||
ts_shouldcollide 13
|
||||
|
||||
ts_weapon_alternateattack 97
|
||||
@end
|
||||
@section ts windows
|
||||
pev 4
|
||||
base 0x0
|
||||
|
||||
ts_breakablerespawn 0
|
||||
ts_canusedthroughwalls 1
|
||||
ts_respawnwait 2
|
||||
spawn 3
|
||||
precache 4
|
||||
keyvalue 5
|
||||
objectcaps 8
|
||||
activate 9
|
||||
setobjectcollisionbox 10
|
||||
classify 11
|
||||
deathnotice 12
|
||||
traceattack 13
|
||||
takedamage 14
|
||||
takehealth 15
|
||||
killed 16
|
||||
bloodcolor 17
|
||||
tracebleed 18
|
||||
istriggered 19
|
||||
mymonsterpointer 20
|
||||
mysquadmonsterpointer 21
|
||||
gettogglestate 22
|
||||
addpoints 23
|
||||
addpointstoteam 24
|
||||
addplayeritem 25
|
||||
removeplayeritem 26
|
||||
giveammo 27
|
||||
getdelay 28
|
||||
ismoving 29
|
||||
overridereset 30
|
||||
damagedecal 31
|
||||
settogglestate 32
|
||||
startsneaking 33
|
||||
stopsneaking 34
|
||||
oncontrols 35
|
||||
issneaking 36
|
||||
isalive 37
|
||||
isbspmodel 38
|
||||
reflectgauss 39
|
||||
hastarget 40
|
||||
isinworld 41
|
||||
isplayer 42
|
||||
isnetclient 43
|
||||
teamid 44
|
||||
getnexttarget 45
|
||||
think 46
|
||||
touch 47
|
||||
use 48
|
||||
blocked 49
|
||||
respawn 50
|
||||
updateowner 51
|
||||
fbecomeprone 52
|
||||
center 53
|
||||
eyeposition 54
|
||||
earposition 55
|
||||
bodytarget 56
|
||||
illumination 57
|
||||
fvisible 58
|
||||
fvecvisible 59
|
||||
spawn 7
|
||||
precache 8
|
||||
keyvalue 9
|
||||
objectcaps 12
|
||||
activate 13
|
||||
setobjectcollisionbox 16
|
||||
classify 17
|
||||
deathnotice 18
|
||||
traceattack 19
|
||||
takedamage 20
|
||||
takehealth 21
|
||||
killed 22
|
||||
bloodcolor 23
|
||||
tracebleed 24
|
||||
istriggered 25
|
||||
mymonsterpointer 26
|
||||
mysquadmonsterpointer 27
|
||||
gettogglestate 28
|
||||
addpoints 29
|
||||
addpointstoteam 30
|
||||
addplayeritem 31
|
||||
removeplayeritem 32
|
||||
giveammo 33
|
||||
getdelay 34
|
||||
ismoving 35
|
||||
overridereset 36
|
||||
damagedecal 37
|
||||
settogglestate 38
|
||||
startsneaking 39
|
||||
stopsneaking 40
|
||||
oncontrols 41
|
||||
issneaking 42
|
||||
isalive 43
|
||||
isbspmodel 44
|
||||
reflectgauss 45
|
||||
hastarget 46
|
||||
isinworld 47
|
||||
isplayer 48
|
||||
isnetclient 49
|
||||
teamid 50
|
||||
getnexttarget 51
|
||||
think 52
|
||||
touch 53
|
||||
use 54
|
||||
blocked 55
|
||||
respawn 57
|
||||
updateowner 58
|
||||
fbecomeprone 59
|
||||
center 60
|
||||
eyeposition 61
|
||||
earposition 62
|
||||
bodytarget 63
|
||||
illumination 64
|
||||
fvisible 65
|
||||
fvecvisible 66
|
||||
|
||||
player_jump 77
|
||||
player_duck 78
|
||||
player_prethink 79
|
||||
player_postthink 80
|
||||
player_getgunposition 81
|
||||
player_shouldfadeondeath 68
|
||||
player_impulsecommands 83
|
||||
player_updateclientdata 82
|
||||
player_jump 84
|
||||
player_duck 85
|
||||
player_prethink 86
|
||||
player_postthink 87
|
||||
player_getgunposition 88
|
||||
player_shouldfadeondeath 75
|
||||
player_impulsecommands 90
|
||||
player_updateclientdata 89
|
||||
|
||||
item_addtoplayer 61
|
||||
item_addduplicate 62
|
||||
item_getiteminfo 63
|
||||
item_candeploy 64
|
||||
item_deploy 65
|
||||
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
|
||||
item_addtoplayer 68
|
||||
item_addduplicate 69
|
||||
item_candeploy 71
|
||||
item_deploy 72
|
||||
item_canholster 73
|
||||
item_holster 74
|
||||
item_updateiteminfo 75
|
||||
item_preframe 76
|
||||
item_postframe 77
|
||||
item_drop 78
|
||||
item_kill 79
|
||||
item_attachtoplayer 80
|
||||
item_primaryammoindex 81
|
||||
item_secondaryammoindex 82
|
||||
item_updateclientdata 83
|
||||
item_getweaponptr 84
|
||||
item_itemslot 85
|
||||
|
||||
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 89
|
||||
weapon_weaponidle 90
|
||||
weapon_retireweapon 91
|
||||
weapon_shouldweaponidle 92
|
||||
weapon_usedecrement 93
|
||||
weapon_extractammo 86
|
||||
weapon_extractclipammo 87
|
||||
weapon_addweapon 88
|
||||
weapon_playemptysound 89
|
||||
weapon_resetemptysound 90
|
||||
weapon_sendweaponanim 91
|
||||
weapon_isusable 92
|
||||
weapon_primaryattack 93
|
||||
weapon_secondaryattack 94
|
||||
weapon_reload 96
|
||||
weapon_weaponidle 97
|
||||
weapon_retireweapon 98
|
||||
weapon_shouldweaponidle 99
|
||||
weapon_usedecrement 100
|
||||
|
||||
ts_breakablerespawn 0
|
||||
ts_canusedthroughwalls 1
|
||||
ts_respawnwait 2
|
||||
ts_weapon_alternateattack 88
|
||||
ts_giveslowmul 2
|
||||
ts_goslow 3
|
||||
ts_inslow 4
|
||||
ts_isobjective 5
|
||||
ts_enableobjective 6
|
||||
ts_onfreeentprivatedata 10
|
||||
ts_shouldcollide 11
|
||||
|
||||
ts_weapon_alternateattack 95
|
||||
@end
|
||||
|
||||
; Sven-Coop has no linux binaries. This makes disassembly much harder.
|
||||
|
@ -175,6 +175,13 @@ enum
|
||||
Ham_NS_ResetEntity,
|
||||
Ham_NS_UpdateOnRemove,
|
||||
|
||||
Ham_TS_GiveSlowMul,
|
||||
Ham_TS_GoSlow,
|
||||
Ham_TS_InSlow,
|
||||
Ham_TS_IsObjective,
|
||||
Ham_TS_EnableObjective,
|
||||
Ham_TS_OnFreeEntPrivateData,
|
||||
Ham_TS_ShouldCollide,
|
||||
|
||||
HAM_LAST_ENTRY_DONT_USE_ME_LOL
|
||||
};
|
||||
|
@ -970,7 +970,6 @@ float Hook_Float_Void(Hook *hook, void *pthis)
|
||||
origret=reinterpret_cast<float (*)(void*)>(hook->func)(pthis);
|
||||
#endif
|
||||
|
||||
fflush(stdout);
|
||||
POST_START()
|
||||
POST_END()
|
||||
|
||||
@ -980,3 +979,30 @@ float Hook_Float_Void(Hook *hook, void *pthis)
|
||||
CHECK_RETURN()
|
||||
return ret;
|
||||
}
|
||||
void Hook_Void_Float_Int(Hook* hook, void* pthis, float f1, int i1)
|
||||
{
|
||||
PUSH_VOID()
|
||||
|
||||
MAKE_VECTOR()
|
||||
P_FLOAT(f1)
|
||||
P_INT(i1)
|
||||
|
||||
PRE_START()
|
||||
, f1, i1
|
||||
PRE_END()
|
||||
#if defined _WIN32
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, float, int)>(hook->func)(pthis, 0, f1, i1);
|
||||
#elif defined __linux__
|
||||
reinterpret_cast<void (*)(void*, float, int)>(hook->func)(pthis, f1, i1);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, f1, i1
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
POP()
|
||||
}
|
||||
void Hook_Deprecated(Hook* hook)
|
||||
{
|
||||
}
|
||||
|
@ -174,4 +174,14 @@ const bool RT_Float_Void = false;
|
||||
const int PC_Float_Void = 0;
|
||||
float Hook_Float_Void(Hook *hook, void *pthis);
|
||||
|
||||
const bool RT_Void_Float_Int = true;
|
||||
const int PC_Void_Float_Int = 2;
|
||||
void Hook_Void_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||
|
||||
const bool RT_Deprecated = true;
|
||||
const int PC_Deprecated = 0;
|
||||
void Hook_Deprecated(Hook* hook);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -167,3 +167,11 @@ int Create_Float_Void(AMX *amx, const char *func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||
}
|
||||
int Create_Void_Float_Int(AMX* amx, const char* func)
|
||||
{
|
||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||
}
|
||||
int Create_Deprecated(AMX* amx, const char* func)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -86,4 +86,9 @@ int Create_Void_ItemInfo(AMX *amx, const char *func);
|
||||
|
||||
int Create_Float_Void(AMX *amx, const char *func);
|
||||
|
||||
int Create_Void_Float_Int(AMX *amx, const char *func);
|
||||
|
||||
|
||||
int Create_Deprecated(AMX* amx, const char* func);
|
||||
|
||||
#endif
|
||||
|
@ -164,7 +164,7 @@ hook_t hooklist[] =
|
||||
/* The Specialists */
|
||||
{ V("ts_breakablerespawn", Int_Int) },
|
||||
{ V("ts_canusedthroughwalls", Int_Void) },
|
||||
{ V("ts_respawnwait", Int_Void) },
|
||||
{ V("ts_respawnwait", Deprecated) },
|
||||
|
||||
/* Counter-Strike */
|
||||
{ V("cstrike_restart", Void_Void) },
|
||||
@ -203,6 +203,14 @@ hook_t hooklist[] =
|
||||
{ V("ns_resetentity", Void_Void) },
|
||||
{ V("ns_updateonremove", Void_Void) },
|
||||
|
||||
{ V("ts_giveslowmul", Void_Void) },
|
||||
{ V("ts_goslow", Void_Float_Int) },
|
||||
{ V("ts_inslow", Int_Void) },
|
||||
{ V("ts_isobjective", Int_Void) },
|
||||
{ V("ts_enableobjective", Void_Int) },
|
||||
{ V("ts_onfreeentprivatedata", Void_Void) },
|
||||
{ V("ts_shouldcollide", Int_Cbase) },
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -307,6 +315,103 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
// RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
|
||||
{
|
||||
// Make sure the function we're requesting is within bounds
|
||||
int func=params[1];
|
||||
int post=params[4];
|
||||
|
||||
CHECK_FUNCTION(func);
|
||||
|
||||
char *function=MF_GetAmxString(amx, params[3], 0, NULL);
|
||||
int entid=params[2];
|
||||
char classname[64];
|
||||
|
||||
// Check the entity
|
||||
|
||||
edict_t *Entity=INDEXENT_NEW(entid);
|
||||
|
||||
|
||||
if (Entity->pvPrivateData == NULL)
|
||||
{
|
||||
|
||||
MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve classtype for entity id \"%d\", hook for \"%s\" not active.",entid,function);
|
||||
|
||||
return 0;
|
||||
}
|
||||
void **vtable=GetVTable(Entity->pvPrivateData, Offsets.GetBase());
|
||||
|
||||
|
||||
if (vtable == NULL)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve vtable for entity id \"%d\", hook for \"%s\" not active.",entid,function);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Verify that the function is valid
|
||||
// Don't fail the plugin if this fails, just emit a normal error
|
||||
int fwd=hooklist[func].makefunc(amx, function);
|
||||
|
||||
if (fwd == -1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Function %s not found.", function);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We've passed all tests...
|
||||
|
||||
int **ivtable=(int **)vtable;
|
||||
|
||||
void *vfunction=(void *)ivtable[hooklist[func].vtid];
|
||||
|
||||
// Check the list of this function's hooks, see if the function we have is a hook
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
}
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
}
|
||||
|
||||
// Note down the classname for the given class
|
||||
// It may very well be wrong (such as lots of TS weapons have the same classname)
|
||||
// but it's the best we can do, and better than nothing.
|
||||
// (only used for display)
|
||||
snprintf(classname, sizeof(classname) - 1, "%s", STRING(Entity->v.classname));
|
||||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook=new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
}
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
static cell AMX_NATIVE_CALL ExecuteHam(AMX *amx, cell *params)
|
||||
{
|
||||
int func=params[1];
|
||||
@ -369,6 +474,7 @@ static cell AMX_NATIVE_CALL EnableHamForward(AMX *amx, cell *params)
|
||||
AMX_NATIVE_INFO RegisterNatives[] =
|
||||
{
|
||||
{ "RegisterHam", RegisterHam },
|
||||
{ "RegisterHamFromEntity", RegisterHamFromEntity },
|
||||
{ "ExecuteHam", ExecuteHam },
|
||||
{ "ExecuteHamB", ExecuteHamB },
|
||||
{ "IsHamValid", IsHamValid },
|
||||
|
@ -30,6 +30,10 @@
|
||||
* - All functions and forwards (eg: {Register,Execute}Ham[B]) require
|
||||
* the mod to have the pev and base keys in addition to the function
|
||||
* keys for the corresponding mod/operating system in hamdata.ini
|
||||
*
|
||||
* - Some functions that return booleans may need to be logically ANDed
|
||||
* to get the results desired. e.g: if (ExecuteHam(Ham_TS_IsObjective, this) & 0x0000FFFF != 0) { // true.. }
|
||||
* because the module will return the full integer value.
|
||||
*/
|
||||
|
||||
enum Ham
|
||||
@ -830,7 +834,7 @@ enum Ham
|
||||
Ham_TS_CanUsedThroughWalls,
|
||||
|
||||
/**
|
||||
* Description: -
|
||||
* Description: Unsure - this was removed in TS 3.0 (and thus is deprecated).
|
||||
* Forward params: function(this)
|
||||
* Return type: Integer (I think...)
|
||||
* Execute params: ExecuteHam(Ham_TS_RespawnWait, this);
|
||||
@ -1049,6 +1053,65 @@ enum Ham
|
||||
Ham_NS_UpdateOnRemove,
|
||||
|
||||
|
||||
/** Virtual functions added to TS in TS 3 */
|
||||
|
||||
/**
|
||||
* Description: Unsure.
|
||||
* Forward params: function(this)
|
||||
* Return type: None.
|
||||
* Execute params: ExecuteHam(Ham_TS_GiveSlowMul, this)
|
||||
*/
|
||||
Ham_TS_GiveSlowMul,
|
||||
|
||||
/**
|
||||
* Description: Unsure. The second paramater is actually a char.
|
||||
* Forward params: function(this, Float:someval, someotherval)
|
||||
* Return type: None.
|
||||
* Execute params: ExecuteHam(Ham_TS_GoSlow, this, Float:someval, someotherval)
|
||||
*/
|
||||
Ham_TS_GoSlow,
|
||||
|
||||
/**
|
||||
* Description: Probably returns true if the user is in slow mo.
|
||||
* Forward params: function(this)
|
||||
* Return type: Integer (boolean).
|
||||
* Execute params: ExecuteHam(Ham_TS_InSlow, this)
|
||||
*/
|
||||
Ham_TS_InSlow,
|
||||
|
||||
/**
|
||||
* Description: Returns true if the entity is an objective.
|
||||
* Forward params: function(this)
|
||||
* Return type: Integer (boolean).
|
||||
* Execute params: ExecuteHam(Ham_TS_IsObjective, this)
|
||||
*/
|
||||
Ham_TS_IsObjective,
|
||||
|
||||
/**
|
||||
* Description: Unsure.
|
||||
* Forward params: function(this, bool:someval)
|
||||
* Return type: None.
|
||||
* Execute params: ExecuteHam(Ham_TS_EnableObjective, this, bool:someval)
|
||||
*/
|
||||
Ham_TS_EnableObjective,
|
||||
|
||||
/**
|
||||
* Description: Probably called when the engine call to OnEntFreePrivateData is called (the entity destructor.)
|
||||
* Forward params: function(this)
|
||||
* Return type: None.
|
||||
* Execute params: ExecuteHam(Ham_TS_OnEntFreePrivateData, this)
|
||||
*/
|
||||
Ham_TS_OnFreeEntPrivateData,
|
||||
|
||||
/**
|
||||
* Description: Probably called when the engine call to ShouldCollide is called.
|
||||
* Forward params: function(this, otherEntity)
|
||||
* Return type: Integer (boolean).
|
||||
* Execute params: ExecuteHam(Ham_TS_ShouldCollide, this, otherEntity)
|
||||
*/
|
||||
Ham_TS_ShouldCollide,
|
||||
|
||||
|
||||
/**
|
||||
* DONT USE ME LOL
|
||||
*/
|
||||
|
@ -55,16 +55,32 @@
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player_hurt", "player");
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityClass The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param entity The entity classname to hook.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClassname[], const Callback[], Post=0);
|
||||
native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
|
||||
|
||||
/**
|
||||
* Hooks the virtual table for the specified entity's class.
|
||||
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
|
||||
* Look at the Ham enum for parameter lists.
|
||||
* Note: This will cause hooks for the entire internal class that the entity is
|
||||
* not exclusively for the provided entity.
|
||||
*
|
||||
* @param function The function to hook.
|
||||
* @param EntityId The entity classname to hook.
|
||||
* @param callback The forward to call.
|
||||
* @param post Whether or not to forward this in post.
|
||||
* @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off.
|
||||
*/
|
||||
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
|
||||
|
||||
|
||||
/**
|
||||
* Stops a ham forward from triggering.
|
||||
|
Loading…
Reference in New Issue
Block a user