From 504ddb4c2ff92ce8d088efe9f7739ea6ec65e3fd Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Sat, 12 May 2007 17:33:58 +0000 Subject: [PATCH] Expanded ESF entries (they had the Linux binary in a retarded location). Added vanilla HLDM support. Fixed a weird crash when compiled in release build for Linux. Expanded HamFilter error messages a tad. --- dlls/hamsandwich/Makefile | 6 +- dlls/hamsandwich/amxx_api.cpp | 20 +- dlls/hamsandwich/call_funcs.cpp | 23 + dlls/hamsandwich/call_funcs.h | 2 + dlls/hamsandwich/config/hamdata.ini | 600 ++++++++++++++++++++++- dlls/hamsandwich/ham_const.h | 3 + dlls/hamsandwich/ham_utils.h | 10 +- dlls/hamsandwich/hook_callbacks.cpp | 40 +- dlls/hamsandwich/hook_callbacks.h | 9 +- dlls/hamsandwich/hook_create.cpp | 5 + dlls/hamsandwich/hook_create.h | 2 + dlls/hamsandwich/hook_native.cpp | 4 + dlls/hamsandwich/include/hamsandwich.inc | 3 + 13 files changed, 712 insertions(+), 15 deletions(-) diff --git a/dlls/hamsandwich/Makefile b/dlls/hamsandwich/Makefile index 08a9fd90..704f30f7 100644 --- a/dlls/hamsandwich/Makefile +++ b/dlls/hamsandwich/Makefile @@ -48,12 +48,14 @@ else OPT_FLAGS = $(SANE_OPT_FLAGS) endif ifeq "$(GCC_VERSION)" "4" - OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden +# OPT_FLAGS += -fvisibility=hidden +#-fvisibility-inlines-hidden + OPT_FLAGS += -g -ggdb3 endif CFLAGS = $(OPT_FLAGS) endif -CFLAGS += -fPIC -Wall -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti +CFLAGS += -fPIC -Wall -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti -Werror BINARY = $(NAME)_$(BIN_SUFFIX) CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 diff --git a/dlls/hamsandwich/amxx_api.cpp b/dlls/hamsandwich/amxx_api.cpp index 748c6b43..edb4b4cc 100644 --- a/dlls/hamsandwich/amxx_api.cpp +++ b/dlls/hamsandwich/amxx_api.cpp @@ -7,6 +7,7 @@ #include "hook.h" #include "ham_const.h" #include "hooklist.h" +#include "offsets.h" #include edict_t *NEW_FirstEdict; @@ -28,8 +29,23 @@ void OnAmxxAttach(void) if (ReadConfig() > 0) { - MF_AddNatives(RegisterNatives); - MF_AddNatives(ReturnNatives); + if (Offsets.IsValid()) + { + MF_AddNatives(RegisterNatives); + MF_AddNatives(ReturnNatives); + } + else + { +#ifdef _WIN32 + MF_Log("Error: pev and base not set for section \"%s windows\", cannot register natives.", MF_GetModname()); +#elif defined __linux__ + MF_Log("Error: pev and base not set for section \"%s linux\", cannot register natives.", MF_GetModname()); +#endif + } + } + else + { + MF_Log("Error: Cannot read config file, natives not registered!"); } } diff --git a/dlls/hamsandwich/call_funcs.cpp b/dlls/hamsandwich/call_funcs.cpp index a24b4833..2c168703 100644 --- a/dlls/hamsandwich/call_funcs.cpp +++ b/dlls/hamsandwich/call_funcs.cpp @@ -277,6 +277,29 @@ cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params) #endif } +cell Call_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, cell *params) +{ + SETUP(5); + + int id3=*MF_GetAmxAddr(amx, params[3]); + int id4=*MF_GetAmxAddr(amx, params[4]); + float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5])); + float f6=amx_ctof2(*MF_GetAmxAddr(amx, params[6])); + int i7=*MF_GetAmxAddr(amx, params[7]); + + CHECK_ENTITY(id3); + CHECK_ENTITY(id4); + + entvars_t *ev3=&(INDEXENT_NEW(id3)->v); + entvars_t *ev4=&(INDEXENT_NEW(id4)->v); + +#ifdef _WIN32 + return reinterpret_cast(__func)(pv, 0, ev3, ev4, f5, f6, i7); +#elif defined __linux__ + return reinterpret_cast(__func)(pv, ev3, ev4, f5, f6, i7); +#endif +} + cell Call_Void_Int(AMX *amx, cell *params) { SETUP(1); diff --git a/dlls/hamsandwich/call_funcs.h b/dlls/hamsandwich/call_funcs.h index f5f5fef4..ffdddbd3 100644 --- a/dlls/hamsandwich/call_funcs.h +++ b/dlls/hamsandwich/call_funcs.h @@ -26,6 +26,8 @@ cell Call_Int_Entvar(AMX *amx, cell *params); cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params); +cell Call_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, cell *params); + cell Call_Void_Int(AMX *amx, cell *params); cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params); diff --git a/dlls/hamsandwich/config/hamdata.ini b/dlls/hamsandwich/config/hamdata.ini index 3309e0e9..d60f3258 100644 --- a/dlls/hamsandwich/config/hamdata.ini +++ b/dlls/hamsandwich/config/hamdata.ini @@ -42,7 +42,6 @@ @mirror cstrike czero @mirror ns nsp -@mirror esf esf_openbeta ; TODO: check these - all are estimates @section cstrike linux @@ -1146,11 +1145,604 @@ use 46 @end -; ESF also has no linux binaries. @section esf windows pev 4 base 0x0 - takedamage 12 - use 46 + spawn 0 + precache 1 + keyvalue 2 + objectcaps 5 + activate 6 + setobjectcollisionbox 7 + classify 8 + deathnotice 9 + traceattack 10 + takedamage 11 + takehealth 12 + killed 13 + bloodcolor 14 + tracebleed 15 + istriggered 16 + mymonsterpointer 17 + mysquadmonsterpointer 18 + gettogglestate 19 + addpoints 20 + addpointstoteam 21 + addplayeritem 22 + removeplayeritem 23 + getdelay 24 + ismoving 25 + overridereset 26 + damagedecal 27 + settogglestate 28 + startsneaking 29 + stopsneaking 30 + oncontrols 31 + issneaking 32 + isalive 33 + isbspmodel 34 + reflectgauss 35 + hastarget 36 + isinworld 37 + isplayer 38 + isnetclient 39 + teamid 40 + getnexttarget 41 + think 42 + touch 43 + use 44 + blocked 45 + respawn 46 + updateowner 47 + fbecomeprone 48 + center 49 + eyeposition 50 + earposition 51 + bodytarget 52 + illumination 53 + fvisible 54 + fvecvisible 55 + + player_jump 124 + player_prethink 125 + player_postthink 126 + player_getgunposition 118 + player_shouldfadeondeath 59 + player_impulsecommands 128 + player_updateclientdata 127 + + item_addtoplayer 57 + item_addduplicate 58 + item_getiteminfo 59 + item_candeploy 60 + item_deploy 61 + item_canholster 62 + item_holster 63 + item_updateiteminfo 64 + item_preframe 65 + item_postframe 66 + item_drop 67 + item_kill 68 + item_attachtoplayer 69 + item_primaryammoindex 70 + item_secondaryammoindex 71 + item_updateclientdata 72 + item_getweaponptr 73 + item_itemslot 74 + + weapon_playemptysound 75 + weapon_resetemptysound 76 + weapon_sendweaponanim 77 + weapon_primaryattack 78 + weapon_secondaryattack 79 + weapon_weaponidle 80 + weapon_retireweapon 81 + weapon_shouldweaponidle 82 + weapon_usedecrement 83 +@end +@section esf linux + pev 0 + base 0x60 + + spawn 2 + precache 3 + keyvalue 4 + objectcaps 7 + activate 8 + setobjectcollisionbox 9 + classify 10 + deathnotice 11 + traceattack 12 + takedamage 13 + takehealth 14 + killed 15 + bloodcolor 16 + tracebleed 17 + istriggered 18 + mymonsterpointer 19 + mysquadmonsterpointer 20 + gettogglestate 21 + addpoints 22 + addpointstoteam 23 + addplayeritem 24 + removeplayeritem 25 + getdelay 26 + ismoving 27 + overridereset 28 + damagedecal 29 + settogglestate 30 + startsneaking 31 + stopsneaking 32 + oncontrols 33 + issneaking 34 + isalive 35 + isbspmodel 36 + reflectgauss 37 + hastarget 38 + isinworld 39 + isplayer 40 + isnetclient 41 + teamid 42 + getnexttarget 43 + think 44 + touch 45 + use 46 + blocked 47 + respawn 48 + updateowner 49 + fbecomeprone 50 + center 51 + eyeposition 52 + earposition 53 + bodytarget 54 + illumination 55 + fvisible 56 + fvecvisible 57 + + player_jump 126 + player_prethink 127 + player_postthink 128 + player_getgunposition 120 + player_shouldfadeondeath 61 + player_impulsecommands 130 + player_updateclientdata 129 + + item_addtoplayer 59 + item_addduplicate 60 + item_getiteminfo 61 + item_candeploy 62 + item_deploy 63 + item_canholster 64 + item_holster 65 + item_updateiteminfo 66 + item_preframe 67 + item_postframe 68 + item_drop 69 + item_kill 70 + item_attachtoplayer 71 + item_primaryammoindex 72 + item_secondaryammoindex 73 + item_updateclientdata 74 + item_getweaponptr 75 + item_itemslot 76 + + weapon_playemptysound 77 + weapon_resetemptysound 78 + weapon_sendweaponanim 79 + weapon_primaryattack 80 + weapon_secondaryattack 81 + weapon_weaponidle 82 + weapon_retireweapon 83 + weapon_shouldweaponidle 84 + weapon_usedecrement 85 +@end + +; ESF Open Beta is built with GCC 3.x, and the VTable was slightly changed +@section esf_openbeta linux + pev 4 + base 0x0 + + spawn 0 + precache 1 + keyvalue 2 + objectcaps 5 + activate 6 + setobjectcollisionbox 7 + classify 8 + deathnotice 9 + traceattack 10 + takedamage 11 + takehealth 13 + killed 14 + bloodcolor 15 + tracebleed 16 + istriggered 17 + mymonsterpointer 18 + mysquadmonsterpointer 19 + gettogglestate 20 + addpoints 21 + addpointstoteam 22 + addplayeritem 23 + removeplayeritem 24 + getdelay 25 + ismoving 26 + overridereset 27 + damagedecal 28 + settogglestate 29 + startsneaking 30 + stopsneaking 31 + oncontrols 32 + issneaking 33 + isalive 34 + isbspmodel 35 + reflectgauss 36 + hastarget 37 + isinworld 38 + isplayer 39 + isnetclient 41 + teamid 42 + getnexttarget 43 + think 44 + touch 45 + use 46 + blocked 47 + respawn 48 + updateowner 49 + fbecomeprone 50 + center 51 + eyeposition 52 + earposition 53 + bodytarget 54 + illumination 55 + fvisible 56 + fvecvisible 57 + + player_jump 131 + player_prethink 132 + player_postthink 133 + player_getgunposition 120 + player_shouldfadeondeath 61 + player_impulsecommands 135 + player_updateclientdata 134 + + item_addtoplayer 59 + item_addduplicate 60 + item_getiteminfo 61 + item_candeploy 62 + item_deploy 63 + item_canholster 64 + item_holster 65 + item_updateiteminfo 66 + item_preframe 67 + item_postframe 68 + item_drop 69 + item_kill 70 + item_attachtoplayer 71 + item_primaryammoindex 72 + item_secondaryammoindex 73 + item_updateclientdata 74 + item_getweaponptr 75 + item_itemslot 76 + + weapon_playemptysound 77 + weapon_resetemptysound 78 + weapon_sendweaponanim 79 + weapon_primaryattack 80 + weapon_secondaryattack 81 + weapon_weaponidle 82 + weapon_retireweapon 83 + weapon_shouldweaponidle 84 + weapon_usedecrement 85 + + esf_isenvmodel 40 + esf_takedamage2 12 + +@end +@section esf_openbeta windows + pev 4 + base 0x0 + + spawn 0 + precache 1 + keyvalue 2 + objectcaps 5 + activate 6 + setobjectcollisionbox 7 + classify 8 + deathnotice 9 + traceattack 10 + takedamage 11 + takehealth 13 + killed 14 + bloodcolor 15 + tracebleed 16 + istriggered 17 + mymonsterpointer 18 + mysquadmonsterpointer 19 + gettogglestate 20 + addpoints 21 + addpointstoteam 22 + addplayeritem 23 + removeplayeritem 24 + getdelay 25 + ismoving 26 + overridereset 27 + damagedecal 28 + settogglestate 29 + startsneaking 30 + stopsneaking 31 + oncontrols 32 + issneaking 33 + isalive 34 + isbspmodel 35 + reflectgauss 36 + hastarget 37 + isinworld 38 + isplayer 39 + isnetclient 41 + teamid 42 + getnexttarget 43 + think 44 + touch 45 + use 46 + blocked 47 + respawn 48 + updateowner 49 + fbecomeprone 50 + center 51 + eyeposition 52 + earposition 53 + bodytarget 54 + illumination 55 + fvisible 56 + fvecvisible 57 + + player_jump 131 + player_prethink 132 + player_postthink 133 + player_getgunposition 120 + player_shouldfadeondeath 61 + player_impulsecommands 135 + player_updateclientdata 134 + + item_addtoplayer 59 + item_addduplicate 60 + item_getiteminfo 61 + item_candeploy 62 + item_deploy 63 + item_canholster 64 + item_holster 65 + item_updateiteminfo 66 + item_preframe 67 + item_postframe 68 + item_drop 69 + item_kill 70 + item_attachtoplayer 71 + item_primaryammoindex 72 + item_secondaryammoindex 73 + item_updateclientdata 74 + item_getweaponptr 75 + item_itemslot 76 + + weapon_playemptysound 77 + weapon_resetemptysound 78 + weapon_sendweaponanim 79 + weapon_primaryattack 80 + weapon_secondaryattack 81 + weapon_weaponidle 82 + weapon_retireweapon 83 + weapon_shouldweaponidle 84 + weapon_usedecrement 85 + + esf_isenvmodel 40 + esf_takedamage2 12 + +@end +@section valve linux + pev 0 + base 0x60 + + spawn 2 + precache 3 + keyvalue 4 + objectcaps 7 + activate 8 + setobjectcollisionbox 9 + classify 10 + deathnotice 11 + traceattack 12 + takedamage 13 + takehealth 14 + killed 15 + bloodcolor 16 + tracebleed 17 + istriggered 18 + mymonsterpointer 19 + mysquadmonsterpointer 20 + gettogglestate 21 + addpoints 22 + addpointstoteam 23 + addplayeritem 24 + removeplayeritem 25 + giveammo 26 + getdelay 27 + ismoving 28 + overridereset 29 + damagedecal 30 + settogglestate 31 + startsneaking 32 + stopsneaking 33 + oncontrols 34 + issneaking 35 + isalive 36 + isbspmodel 37 + reflectgauss 38 + hastarget 39 + isinworld 40 + isplayer 41 + isnetclient 42 + teamid 43 + getnexttarget 44 + think 45 + touch 46 + use 47 + blocked 48 + respawn 49 + updateowner 50 + fbecomeprone 51 + center 52 + eyeposition 53 + earposition 54 + bodytarget 55 + illumination 56 + fvisible 57 + fvecvisible 58 + + player_jump 127 + player_duck 128 + player_prethink 129 + player_postthink 130 + player_getgunposition 121 + player_shouldfadeondeath 62 + player_impulsecommands 132 + player_updateclientdata 131 + + item_addtoplayer 60 + item_addduplicate 61 + item_getiteminfo 62 + item_candeploy 63 + item_deploy 64 + item_canholster 65 + item_holster 66 + item_updateiteminfo 67 + item_preframe 68 + item_postframe 69 + item_drop 70 + item_kill 71 + item_attachtoplayer 72 + item_primaryammoindex 73 + item_secondaryammoindex 74 + item_updateclientdata 75 + item_getweaponptr 76 + item_itemslot 77 + + weapon_extractammo 78 + weapon_extractclipammo 79 + weapon_addweapon 80 + weapon_playemptysound 81 + weapon_resetemptysound 82 + weapon_sendweaponanim 83 + weapon_isusable 84 + weapon_primaryattack 85 + weapon_secondaryattack 86 + weapon_reload 87 + weapon_weaponidle 88 + weapon_retireweapon 89 + weapon_shouldweaponidle 90 + weapon_usedecrement 91 +@end +@section valve windows + pev 4 + base 0x0 + + spawn 0 + precache 1 + keyvalue 2 + objectcaps 5 + activate 6 + setobjectcollisionbox 7 + classify 8 + deathnotice 9 + traceattack 10 + takedamage 11 + takehealth 12 + killed 13 + bloodcolor 14 + tracebleed 15 + istriggered 16 + mymonsterpointer 17 + mysquadmonsterpointer 18 + gettogglestate 19 + addpoints 20 + addpointstoteam 21 + addplayeritem 22 + removeplayeritem 23 + giveammo 24 + getdelay 25 + ismoving 26 + overridereset 27 + damagedecal 28 + settogglestate 29 + startsneaking 30 + stopsneaking 31 + oncontrols 32 + issneaking 33 + isalive 34 + isbspmodel 35 + reflectgauss 36 + hastarget 37 + isinworld 38 + isplayer 39 + isnetclient 40 + teamid 41 + getnexttarget 42 + think 43 + touch 44 + use 45 + blocked 46 + respawn 47 + updateowner 48 + fbecomeprone 49 + center 50 + eyeposition 51 + earposition 52 + bodytarget 53 + illumination 54 + fvisible 55 + fvecvisible 56 + + player_jump 125 + player_duck 126 + player_prethink 127 + player_postthink 128 + player_getgunposition 119 + player_shouldfadeondeath 60 + player_impulsecommands 130 + player_updateclientdata 129 + + item_addtoplayer 58 + item_addduplicate 59 + item_getiteminfo 60 + item_candeploy 61 + item_deploy 62 + item_canholster 63 + item_holster 64 + item_updateiteminfo 65 + item_preframe 66 + item_postframe 67 + item_drop 68 + item_kill 69 + item_attachtoplayer 70 + item_primaryammoindex 71 + item_secondaryammoindex 72 + item_updateclientdata 73 + item_getweaponptr 74 + item_itemslot 75 + + weapon_extractammo 76 + weapon_extractclipammo 77 + weapon_addweapon 78 + weapon_playemptysound 79 + weapon_resetemptysound 80 + weapon_sendweaponanim 81 + weapon_isusable 82 + weapon_primaryattack 83 + weapon_secondaryattack 84 + weapon_reload 85 + weapon_weaponidle 86 + weapon_retireweapon 87 + weapon_shouldweaponidle 88 + weapon_usedecrement 89 + @end diff --git a/dlls/hamsandwich/ham_const.h b/dlls/hamsandwich/ham_const.h index 946a8b3a..4f7caf63 100644 --- a/dlls/hamsandwich/ham_const.h +++ b/dlls/hamsandwich/ham_const.h @@ -136,6 +136,9 @@ enum Ham_TFC_TakeConcussionBlast, Ham_TFC_Concuss, + Ham_ESF_IsEnvModel, // Only valid in ESF Open Beta + Ham_ESF_TakeDamage2, // Only valid in ESF Open Beta + Ham_NS_GetPointValue, Ham_NS_AwardKill, Ham_NS_ResetEntity, diff --git a/dlls/hamsandwich/ham_utils.h b/dlls/hamsandwich/ham_utils.h index 356873f1..f4fca085 100644 --- a/dlls/hamsandwich/ham_utils.h +++ b/dlls/hamsandwich/ham_utils.h @@ -6,11 +6,15 @@ #include "NEW_Util.h" #define CHECK_FUNCTION(x) \ - if (x < 0 || x > HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \ - FailPlugin(amx, x, HAM_INVALID_FUNC, "Function out of bounds."); \ + if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \ + char msg[1024]; \ + snprintf(msg, sizeof(msg)-1, "Function out of bounds. Got: %d Max: %d",x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \ + FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \ return 0; \ } else if (hooklist[x].isset == 0) { \ - FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, "Function not configured in hamdata.ini"); \ + char msg[1024]; \ + snprintf(msg, sizeof(msg)-1, "Function %s is not configured in hamdata.ini.",hooklist[x].name); \ + FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \ return 0; \ } diff --git a/dlls/hamsandwich/hook_callbacks.cpp b/dlls/hamsandwich/hook_callbacks.cpp index 31bdc443..26b9cabf 100644 --- a/dlls/hamsandwich/hook_callbacks.cpp +++ b/dlls/hamsandwich/hook_callbacks.cpp @@ -450,7 +450,6 @@ int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1) -// Takedamage int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis, entvars_t *inflictor, entvars_t *attacker, float damage, int damagebits) { int ret=0; @@ -485,6 +484,41 @@ int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis, entvars_t *inflict CHECK_RETURN() return ret; } +int Hook_Int_Entvar_Entvar_Float_Float_Int(Hook *hook, void *pthis, entvars_t *inflictor, entvars_t *attacker, float damage, float unknown, int damagebits) +{ + int ret=0; + int origret=0; + PUSH_INT() + int iInflictor=EntvarToIndex(inflictor); + int iAttacker=EntvarToIndex(attacker); + + MAKE_VECTOR() + P_ENTVAR(inflictor, iInflictor) + P_ENTVAR(attacker, iAttacker) + P_FLOAT(damage) + P_FLOAT(unknown) + P_INT(damagebits) + + PRE_START() + ,iInflictor, iAttacker, damage, unknown, damagebits + PRE_END() + + +#if defined _WIN32 + origret=reinterpret_cast(hook->func)(pthis, 0, inflictor, attacker, damage, unknown, damagebits); +#elif defined __linux__ + origret=reinterpret_cast(hook->func)(pthis, inflictor, attacker, damage, unknown, damagebits); +#endif + + POST_START() + ,iInflictor, iAttacker, damage, unknown, damagebits + POST_END() + + KILL_VECTOR() + POP() + CHECK_RETURN() + return ret; +} void Hook_Void_Int(Hook *hook, void *pthis, int i1) { @@ -675,7 +709,7 @@ void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis) #if defined _WIN32 reinterpret_cast(hook->func)(pthis, 0, &origret); #elif defined __linux__ - reinterpret_cast(hook->func)(&origret, pthis); + origret=reinterpret_cast(hook->func)(pthis); #endif POST_START() @@ -711,7 +745,7 @@ void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1) #if defined _WIN32 reinterpret_cast(hook->func)(pthis, 0, &origret, v1); #elif defined __linux__ - reinterpret_cast(hook->func)(&origret, pthis, v1); + origret=reinterpret_cast(hook->func)(pthis, v1); #endif POST_START() diff --git a/dlls/hamsandwich/hook_callbacks.h b/dlls/hamsandwich/hook_callbacks.h index 21a01674..9e50dd6f 100644 --- a/dlls/hamsandwich/hook_callbacks.h +++ b/dlls/hamsandwich/hook_callbacks.h @@ -59,6 +59,13 @@ int Hook_Int_Entvar_Entvar_Float_Int(Hook *hook, void *pthis, entvars_t *attacker, float damage, int damagebits); +const bool RT_Int_Entvar_Entvar_Float_Float_Int = false; +const int PC_Int_Entvar_Entvar_Float_Float_Int = 5; +int Hook_Int_Entvar_Entvar_Float_Float_Int(Hook *hook, void *pthis, + entvars_t *inflictor, + entvars_t *attacker, float damage, + float unknown, int damagebits); + const bool RT_Void_Int = true; const int PC_Void_Int = 1; void Hook_Void_Int(Hook *hook, void *pthis, int i1); @@ -91,7 +98,7 @@ void *Hook_Cbase_Void(Hook *hook, void *pthis); // HACK: I'm too lazy to fix up trampoline generator to deal with // special return values. this is so much easier. -const bool RT_Vector_Void = false; +const bool RT_Vector_Void = true; const int PC_Vector_Void = 1; #ifdef _WIN32 void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out); diff --git a/dlls/hamsandwich/hook_create.cpp b/dlls/hamsandwich/hook_create.cpp index 6ea3ceac..375d7d0d 100644 --- a/dlls/hamsandwich/hook_create.cpp +++ b/dlls/hamsandwich/hook_create.cpp @@ -63,6 +63,11 @@ int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func) return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE); } +int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func) +{ + return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE); +} + int Create_Void_Int(AMX *amx, const char *func) { return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE); diff --git a/dlls/hamsandwich/hook_create.h b/dlls/hamsandwich/hook_create.h index 286b3f56..463170f7 100644 --- a/dlls/hamsandwich/hook_create.h +++ b/dlls/hamsandwich/hook_create.h @@ -26,6 +26,8 @@ int Create_Int_Entvar(AMX *amx, const char *func); int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func); +int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func); + int Create_Void_Int(AMX *amx, const char *func); int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func); diff --git a/dlls/hamsandwich/hook_native.cpp b/dlls/hamsandwich/hook_native.cpp index d7257a67..601244ca 100644 --- a/dlls/hamsandwich/hook_native.cpp +++ b/dlls/hamsandwich/hook_native.cpp @@ -163,6 +163,10 @@ hook_t hooklist[] = { V("tfc_takeconcussionblast", Void_Entvar_Float) }, { V("tfc_concuss", Void_Entvar) }, + /* Earth's Special Forces */ + { V("esf_isenvmodel", Int_Void) }, + { V("esf_takedamage2", Int_Entvar_Entvar_Float_Float_Int) }, + /* Natural-Selection */ { V("ns_getpointvalue", Int_Void) }, { V("ns_awardkill", Void_Entvar) }, diff --git a/dlls/hamsandwich/include/hamsandwich.inc b/dlls/hamsandwich/include/hamsandwich.inc index 4fb511c5..ce3a6e48 100644 --- a/dlls/hamsandwich/include/hamsandwich.inc +++ b/dlls/hamsandwich/include/hamsandwich.inc @@ -501,6 +501,9 @@ enum Ham Ham_TFC_TakeConcussionBlast, Ham_TFC_Concuss, + Ham_ESF_IsEnvModel, // Only valid in ESF Open Beta + Ham_ESF_TakeDamage2, // Only valid in ESF Open Beta + Ham_NS_GetPointValue, Ham_NS_AwardKill, Ham_NS_ResetEntity,