diff --git a/dlls/hamsandwich/call_funcs.cpp b/dlls/hamsandwich/call_funcs.cpp index 6e488dc8..dfc83f34 100644 --- a/dlls/hamsandwich/call_funcs.cpp +++ b/dlls/hamsandwich/call_funcs.cpp @@ -12,9 +12,28 @@ extern CVector hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL]; void FailPlugin(AMX *amx, int id, int err, const char *reason); -inline void *GetFunction(void *pthis, int id) +extern bool gDoForwards; + +inline void *GetFunction(void *pthis, int id, bool &istramp) { - return GetVTableEntry(pthis, hooklist[id].vtid, Offsets.GetBase()); + istramp=false; + void *func=GetVTableEntry(pthis, hooklist[id].vtid, Offsets.GetBase()); + + // Check to see if it's a trampoline + CVector::iterator end=hooks[id].end(); + + for (CVector::iterator i=hooks[id].begin(); + i!=end; + ++i) + { + if (func==(*i)->tramp) + { + istramp=true; + return func; + } + } + + return func; } inline void *_GetFunction(void *pthis, int id) { @@ -54,7 +73,13 @@ inline void *_GetFunction(void *pthis, int id) int id=params[2]; \ CHECK_FUNCTION(func); \ CHECK_ENTITY(id); \ - void *pv=IndexToPrivate(id); + void *pv=IndexToPrivate(id); \ + bool istramp; \ + void *__func=GetFunction(pv, func, istramp); \ + if (!istramp && !gDoForwards) \ + { \ + gDoForwards=true; \ + } cell Call_Void_Void(AMX *amx, cell *params) @@ -62,9 +87,9 @@ cell Call_Void_Void(AMX *amx, cell *params) SETUP(0); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0); + reinterpret_cast(__func)(pv, 0); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv); + reinterpret_cast(__func)(pv); #endif return 1; } @@ -74,9 +99,9 @@ cell Call_Int_Void(AMX *amx, cell *params) SETUP(0); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0); + return reinterpret_cast(__func)(pv, 0); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv); + return reinterpret_cast(__func)(pv); #endif } @@ -91,9 +116,9 @@ cell Call_Void_Entvar(AMX *amx, cell *params) entvars_t *ev1=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, ev1); + reinterpret_cast(__func)(pv, 0, ev1); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, ev1); + reinterpret_cast(__func)(pv, ev1); #endif return 1; } @@ -110,9 +135,9 @@ cell Call_Void_Cbase(AMX *amx, cell *params) void *pv1=(INDEXENT_NEW(id3)->pvPrivateData); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, pv1); + reinterpret_cast(__func)(pv, 0, pv1); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, pv1); + reinterpret_cast(__func)(pv, pv1); #endif return 1; } @@ -125,9 +150,9 @@ cell Call_Int_Float_Int(AMX *amx, cell *params) int i4=*MF_GetAmxAddr(amx, params[4]); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, f3, i4); + return reinterpret_cast(__func)(pv, 0, f3, i4); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, f3, i4); + return reinterpret_cast(__func)(pv, f3, i4); #endif } @@ -144,9 +169,9 @@ cell Call_Void_Entvar_Int(AMX *amx, cell *params) entvars_t *ev3=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3, i4); + reinterpret_cast(__func)(pv, 0, ev3, i4); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, ev3, i4); + reinterpret_cast(__func)(pv, ev3, i4); #endif return 1; } @@ -163,9 +188,9 @@ cell Call_Int_Cbase(AMX *amx, cell *params) void *pv1=(INDEXENT_NEW(id3)->pvPrivateData); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, pv1); + return reinterpret_cast(__func)(pv, 0, pv1); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, pv1); + return reinterpret_cast(__func)(pv, pv1); #endif } @@ -177,9 +202,9 @@ cell Call_Void_Int_Int(AMX *amx, cell *params) int i4=*MF_GetAmxAddr(amx, params[4]); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, i3, i4); + reinterpret_cast(__func)(pv, 0, i3, i4); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, i3, i4); + reinterpret_cast(__func)(pv, i3, i4); #endif return 1; } @@ -194,9 +219,9 @@ cell Call_Int_Int_Str_Int(AMX *amx, cell *params) int i5=*MF_GetAmxAddr(amx, params[5]); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, i3, sz4, i5); + return reinterpret_cast(__func)(pv, 0, i3, sz4, i5); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, i3, sz4, i5); + return reinterpret_cast(__func)(pv, i3, sz4, i5); #endif } @@ -207,9 +232,9 @@ cell Call_Int_Int(AMX *amx, cell *params) int i3=*MF_GetAmxAddr(amx, params[3]); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, i3); + return reinterpret_cast(__func)(pv, 0, i3); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, i3); + return reinterpret_cast(__func)(pv, i3); #endif } @@ -224,9 +249,9 @@ cell Call_Int_Entvar(AMX *amx, cell *params) entvars_t *ev3=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3); + return reinterpret_cast(__func)(pv, 0, ev3); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, ev3); + return reinterpret_cast(__func)(pv, ev3); #endif } @@ -246,9 +271,9 @@ cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params) entvars_t *ev4=&(INDEXENT_NEW(id4)->v); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3, ev4, f5, i6); + return reinterpret_cast(__func)(pv, 0, ev3, ev4, f5, i6); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, ev3, ev4, f5, i6); + return reinterpret_cast(__func)(pv, ev3, ev4, f5, i6); #endif } @@ -259,9 +284,9 @@ cell Call_Void_Int(AMX *amx, cell *params) int i3=*MF_GetAmxAddr(amx, params[3]); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, i3); + reinterpret_cast(__func)(pv, 0, i3); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, i3); + reinterpret_cast(__func)(pv, i3); #endif return 1; @@ -283,9 +308,9 @@ cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params) void *p4=IndexToPrivate(id4); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, p3, p4, i5, f6); + reinterpret_cast(__func)(pv, 0, p3, p4, i5, f6); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, p3, p4, i5, f6); + reinterpret_cast(__func)(pv, p3, p4, i5, f6); #endif return 1; @@ -317,9 +342,9 @@ cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params) entvars_t *ev3=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3, f4, v5, tr6, i7); + reinterpret_cast(__func)(pv, 0, ev3, f4, v5, tr6, i7); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, ev3, f4, v5, tr6, i7); + reinterpret_cast(__func)(pv, ev3, f4, v5, tr6, i7); #endif return 1; @@ -347,9 +372,9 @@ cell Call_Void_Float_Vector_TraceResult_Int(AMX *amx, cell *params) } #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, f3, v4, tr5, i6); + reinterpret_cast(__func)(pv, 0, f3, v4, tr5, i6); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, f3, v4, tr5, i6); + reinterpret_cast(__func)(pv, f3, v4, tr5, i6); #endif return 1; @@ -360,9 +385,9 @@ cell Call_Str_Void(AMX *amx, cell *params) SETUP(2); #ifdef _WIN32 - char *v=reinterpret_cast(GetFunction(pv, func))(pv, 0); + char *v=reinterpret_cast(__func)(pv, 0); #elif defined __linux__ - char *v=reinterpret_cast(GetFunction(pv, func))(pv); + char *v=reinterpret_cast(__func)(pv); #endif return MF_SetAmxString(amx, params[3], v == NULL ? "" : v, *MF_GetAmxAddr(amx, params[4])); @@ -372,9 +397,9 @@ cell Call_Cbase_Void(AMX *amx, cell *params) { SETUP(0); #ifdef _WIN32 - void *ret=reinterpret_cast(GetFunction(pv, func))(pv, 0); + void *ret=reinterpret_cast(__func)(pv, 0); #elif defined __linux__ - void *ret=reinterpret_cast(GetFunction(pv, func))(pv); + void *ret=reinterpret_cast(__func)(pv); #endif return PrivateToIndex(ret); } @@ -383,9 +408,9 @@ cell Call_Vector_Void(AMX *amx, cell *params) { SETUP(1); #ifdef _WIN32 - Vector ret=reinterpret_cast(GetFunction(pv, func))(pv, 0); + Vector ret=reinterpret_cast(__func)(pv, 0); #elif defined __linux__ - Vector ret=reinterpret_cast(GetFunction(pv, func))(pv); + Vector ret=reinterpret_cast(__func)(pv); #endif float *out=(float *)MF_GetAmxAddr(amx, params[3]); out[0]=ret.x; @@ -406,9 +431,9 @@ cell Call_Vector_pVector(AMX *amx, cell *params) v3.z=fl3[2]; #ifdef _WIN32 - Vector ret=reinterpret_cast(GetFunction(pv, func))(pv, 0, &v3); + Vector ret=reinterpret_cast(__func)(pv, 0, &v3); #elif defined __linux__ - Vector ret=reinterpret_cast(GetFunction(pv, func))(pv, &v3); + Vector ret=reinterpret_cast(__func)(pv, &v3); #endif float *out=(float *)MF_GetAmxAddr(amx, params[4]); out[0]=ret.x; @@ -433,9 +458,9 @@ cell Call_Int_pVector(AMX *amx, cell *params) v3.z=fl3[2]; #ifdef _WIN32 - int ret=reinterpret_cast(GetFunction(pv, func))(pv, 0, &v3); + int ret=reinterpret_cast(__func)(pv, 0, &v3); #elif defined __linux__ - int ret=reinterpret_cast(GetFunction(pv, func))(pv, &v3); + int ret=reinterpret_cast(__func)(pv, &v3); #endif fl3[0]=v3.x; @@ -458,9 +483,9 @@ cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params) entvars_t *ev3=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3, f4, f5); + reinterpret_cast(__func)(pv, 0, ev3, f4, f5); #elif defined __linux__ - reinterpret_cast(GetFunction(pv, func))(pv, ev3, f4, f5); + reinterpret_cast(__func)(pv, ev3, f4, f5); #endif return 1; @@ -474,9 +499,9 @@ cell Call_Int_pFloat_pFloat(AMX *amx, cell *params) float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4])); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, &f3, &f4); + return reinterpret_cast(__func)(pv, 0, &f3, &f4); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, &f3, &f4); + return reinterpret_cast(__func)(pv, &f3, &f4); #endif } @@ -493,9 +518,9 @@ cell Call_Void_Entvar_Float(AMX *amx, cell *params) entvars_t *ev3=&(INDEXENT_NEW(id3)->v); #ifdef _WIN32 - return reinterpret_cast(GetFunction(pv, func))(pv, 0, ev3, f4); + return reinterpret_cast(__func)(pv, 0, ev3, f4); #elif defined __linux__ - return reinterpret_cast(GetFunction(pv, func))(pv, ev3, f4); + return reinterpret_cast(__func)(pv, ev3, f4); #endif } diff --git a/dlls/hamsandwich/config_parser.cpp b/dlls/hamsandwich/config_parser.cpp index 702e7da4..589341ed 100644 --- a/dlls/hamsandwich/config_parser.cpp +++ b/dlls/hamsandwich/config_parser.cpp @@ -255,6 +255,10 @@ void process_key(char *data) size++; } + if (size==0) + { + return; + } int set=0; for (int i=0; i< HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++) { diff --git a/dlls/hamsandwich/hook.h b/dlls/hamsandwich/hook.h index c676aa59..dcf45092 100644 --- a/dlls/hamsandwich/hook.h +++ b/dlls/hamsandwich/hook.h @@ -61,8 +61,11 @@ public: #endif ivtable[entry]=(int *)func; - +#if defined _WIN32 + VirtualFree(tramp, 0, MEM_RELEASE); +#elif __linux__ free(tramp); +#endif delete[] ent; @@ -74,6 +77,15 @@ public: { delete (*i); } + end=post.end(); + for (CVector::iterator i=post.begin(); + i!=end; + ++i) + { + delete (*i); + } + pre.clear(); + post.clear(); } }; diff --git a/dlls/hamsandwich/hook_native.cpp b/dlls/hamsandwich/hook_native.cpp index d4099933..7965bf95 100644 --- a/dlls/hamsandwich/hook_native.cpp +++ b/dlls/hamsandwich/hook_native.cpp @@ -20,7 +20,7 @@ OffsetManager Offsets; -bool gDoForwards=false; +bool gDoForwards=true; CVector hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL]; diff --git a/dlls/hamsandwich/include/hamsandwich.inc b/dlls/hamsandwich/include/hamsandwich.inc index bdc92b00..69cd3f32 100644 --- a/dlls/hamsandwich/include/hamsandwich.inc +++ b/dlls/hamsandwich/include/hamsandwich.inc @@ -62,6 +62,10 @@ * * - All functions take (and pass) a "this" index as the first param. * This is the entity from which the function is being executed on. + * + * - 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 */ enum Ham @@ -69,7 +73,9 @@ enum Ham /** * Description: This is typically called whenever an entity is created. * It is the virtual equivilent of spawn from the engine. + * Some mods call this on player spawns too. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_Spawn, this); */ Ham_Spawn = 0, @@ -78,6 +84,7 @@ enum Ham * Description: This is typically called on map change. * This will typically precache all assets required by the entity. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_Precache, this); */ Ham_Precache, @@ -87,12 +94,15 @@ enum Ham * Use the kvd natives from fakemeta to handle the kvd_handle passed. * NOTE: Do not pass handle 0 to this! Use get_kvd_handle(0) from fakemeta instead! * Forward params: function(this, kvd_handle); + * Return type: None. + * Execute params: ExecuteHam(Ham_Keyvalue, this, kvd_handle); */ Ham_Keyvalue, /** * Description: Returns flags for how an entity can be used (FCAP_* constants in hlsdk_const.inc) * Forward params: function(this) + * Return type: Integer. * Execute params: ExecuteHam(Ham_ObjectCaps, this); */ Ham_ObjectCaps, @@ -100,6 +110,7 @@ enum Ham /** * Description: Usually called to activate some objects. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_Activate, this); */ Ham_Activate, @@ -107,6 +118,7 @@ enum Ham /** * Description: Usually called after the engine call with the same name. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_SetObjectCollisionBox, this); */ Ham_SetObjectCollisionBox, @@ -114,6 +126,7 @@ enum Ham /** * Description: Returns an integer number that corresponds with what type of entity this is. * Forward params: function(this) + * Return type: Integer. * Execute params: ExecuteHam(Ham_Classify, this); */ Ham_Classify, @@ -121,6 +134,7 @@ enum Ham /** * Description: Typically called when an entity dies to notify any children entities about the death. * Forward params: function(this, idchild) + * Return type: None. * Execute params: ExecuteHam(Ham_DeathNotice, this, idchild) */ Ham_DeathNotice, @@ -130,6 +144,7 @@ enum Ham * Use the get/set tr2 natives in fakemeta to handle the traceresult data. * Do not use a handle of 0 as a traceresult in execution, use get_tr_handle(0) instead. * Forward params: function(this, idattacker, Float:damage, Float:direction[3], traceresult, damagebits) + * Return type: None. * Execute params: ExecuteHam(Ham_TraceAttack, this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits); */ Ham_TraceAttack, @@ -139,6 +154,7 @@ enum Ham * Inflictor is the entity that caused the damage (such as a gun). * Attacker is the entity that tirggered the damage (such as the gun's owner). * Forward params: function(this, idinflictor, idattacker, Float:damage, damagebits); + * Return type: Integer. * Execute params: ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits); */ Ham_TakeDamage, @@ -146,6 +162,7 @@ enum Ham /** * Description: Usually called whenever an entity gets a form of a heal. * Forward params: function(this, Float:health, damagebits); + * Return type: Integer. * Execute params: ExecuteHam(Ham_TakeHealth, this, Float:health, damagebits); */ Ham_TakeHealth, @@ -153,6 +170,7 @@ enum Ham /** * Description: Normally called whenever an entity dies. * Forward params: function(this, idattacker, shouldgib) + * Return type: None. * Execute params: ExecuteHam(Ham_Killed, this, idattacker, shouldgib); */ Ham_Killed, @@ -160,6 +178,7 @@ enum Ham /** * Description: Normally returns the blood color of the entity. * Forward params: function(this) + * Return type: Integer. * Execute params: ExecuteHam(Ham_BloodColor, this) */ Ham_BloodColor, @@ -168,9 +187,37 @@ enum Ham Ham_TraceBleed, Ham_IsTriggered, Ham_GetToggleState, + + /** + * Description: Typically adds points to the entity. + * Forward params: function(this, points, bool:cangonegative); + * Return type: None. + * Execute params: ExecuteHam(Ham_BloodColor, this, points, bool:cangonegative); + */ Ham_AddPoints, + + /** + * Description: Typically adds points to the entity's team. + * Forward params: function(this, points, bool:cangonegative); + * Return type: None. + * Execute params: ExecuteHam(Ham_BloodColor, this, points, bool:cangonegative); + */ Ham_AddPointsToTeam, + + /** + * Description: Adds an item to the player's inventory. + * Forward params: function(this, idother); + * Return type: Integer. + * Execute params: ExecuteHam(Ham_AddPlayerItem, this, idother); + */ Ham_AddPlayerItem, + + /** + * Description: Removes an item to the player's inventory. + * Forward params: function(this, idother); + * Return type: Integer. + * Execute params: ExecuteHam(Ham_RemovePlayerItem, this, idother); + */ Ham_RemovePlayerItem, Ham_GiveAmmo, Ham_GetDelay, @@ -178,6 +225,7 @@ enum Ham /** * Description: Whether or not the entity is moving. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsMoving, this); */ Ham_IsMoving, @@ -188,6 +236,7 @@ enum Ham /** * Description: Not entirely sure what this does. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_StartSneaking, this); */ Ham_StartSneaking, @@ -195,6 +244,7 @@ enum Ham /** * Description: Not entirely sure what this does. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_StopSneaking, this); */ Ham_StopSneaking, @@ -203,6 +253,7 @@ enum Ham /** * Description: Whether or not the entity is sneaking. * Forward params: function(this); + * Return type: None. * Execute params: ExecuteHam(Ham_IsSneaking, this); */ Ham_IsSneaking, @@ -210,6 +261,7 @@ enum Ham /** * Description: Whether or not the entity is alive. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsAlive, this); */ Ham_IsAlive, @@ -217,6 +269,7 @@ enum Ham /** * Description: Whether or not the entity uses a BSP model. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsBSPModel, this); */ Ham_IsBSPModel, @@ -224,6 +277,7 @@ enum Ham /** * Description: Whether or not the entity can reflect gauss shots.. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_ReflectGauss, this); */ Ham_ReflectGauss, @@ -232,6 +286,7 @@ enum Ham /** * Description: Whether or not the entity is in the world. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsInWorld, this); */ Ham_IsInWorld, @@ -239,6 +294,7 @@ enum Ham /** * Description: Whether or not the entity is a player. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsPlayer, this); */ Ham_IsPlayer, @@ -246,6 +302,7 @@ enum Ham /** * Description: Whether or not the entity is a net client. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_IsNetClient, this); */ Ham_IsNetClient, @@ -253,6 +310,7 @@ enum Ham /** * Description: Get the entity's team id. * Forward params: function(this); + * Return type: String (string length returned and string byref'd in ExecuteHam). * Execute params: ExecuteHam(Ham_IsPlayer, this, buffer[], size); */ Ham_TeamId, @@ -267,6 +325,7 @@ enum Ham /** * Description: Called whenever an entity thinks. * Forward params: function(this) + * Return type: None. * Execute params: ExecuteHam(Ham_Think, this); */ Ham_Think, @@ -274,6 +333,7 @@ enum Ham /** * Description: Called whenever two entities touch. * Forward params: function(this, idother); + * Return type: None. * Execute params: ExecuteHam(Ham_Touch, this, idother); */ Ham_Touch, @@ -281,6 +341,7 @@ enum Ham /** * Description: Called whenver one entity uses another. * Forward params: function(this, idcaller, idactivator, use_type, Float:value) + * Return type: None. * Execute params: ExecuteHam(Ham_Use, this, idcaller, idactivator, use_type, Float:value); */ Ham_Use, @@ -288,6 +349,7 @@ enum Ham /** * Description: Normally called whenever one entity blocks another from moving. * Forward params: function(this, idother); + * Return type: None. * Execute params: ExecuteHam(Ham_Blocked, this, idother); */ Ham_Blocked, @@ -295,6 +357,7 @@ enum Ham /** * Description: Normally called when a map-based item respawns, such as a health kit or something. * Forward params: function(this); + * Return type: CBaseEntity. * Execute params: ExecuteHam(Ham_Respawn, this); */ Ham_Respawn, @@ -302,6 +365,7 @@ enum Ham /** * Description: Used in Half-Life to update a monster's owner. * Forward params: function(this); + * Return type: None. * Execute params: ExecuteHam(Ham_UpdateOwner, this); */ Ham_UpdateOwner, @@ -309,6 +373,7 @@ enum Ham /** * Description: Normally called whenever a barnacle grabs the entity. * Forward params: function(this); + * Return type: Integer. * Execute params: ExecuteHam(Ham_FBecomeProne, this); */ Ham_FBecomeProne, @@ -316,6 +381,7 @@ enum Ham /** * Description: Returns the center of the entity. * Forward params: function(this); + * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_Center, this, Float:output[3]); */ Ham_Center, @@ -323,6 +389,7 @@ enum Ham /** * Description: Returns the eye position of the entity. * Forward params: function(this); + * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_EyePosition, this, Float:output[3]); */ Ham_EyePosition, @@ -330,9 +397,17 @@ enum Ham /** * Description: Returns the ear position of the entity. * Forward params: function(this); + * Return type: Vector (byref'd in Execute). * Execute params: ExecuteHam(Ham_EarPosition, this, Float:output[3]); */ Ham_EarPosition, + + /** + * Description: Position to shoot at. + * Forward params: function(this, Float:srcvector[3]); + * Return type: Vector (byref'd in Execute). + * Execute params: ExecuteHam(Ham_BodyTarget, Float:srcvector[3], Float:returnvector[3]) + */ Ham_BodyTarget, Ham_Illumination, Ham_FVisible, @@ -390,8 +465,6 @@ enum Ham * @param entity The entity classname to hook. * @param post Whether or not to forward this in post. */ - - native RegisterHam(Ham:function, const callback[], const entity[], post=0); /** @@ -425,6 +498,37 @@ native ExecuteHamB(Ham:function, this, any:...); */ native bool:IsHamValid(Ham:function); +/** + * This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}. + * This requires the mod to have the pev field set in hamdata.ini. + * Note this dereferences memory! Improper use of this will crash the server. + * This will return an index of the corresponding cbase field in private data. + * + * @param id The entity to examine the private data. + * @param offset The windows offset of the data. + * @param linuxdiff The linux difference of the data. + * @return The index of the corresponding pdata field. -1 for none set. + */ +native get_pdata_cbase(id, offset, linuxdiff=5); + +/** + * This is used to compliment fakemeta's {get,set}_pdata_{int,float,string}. + * This requires the mod to have the pev field set in hamdata.ini. + * Note this dereferences memory! Improper use of this will crash the server. + * This will set the corresponding cbase field in private data with the index. + * + * @param id The entity to examine the private data. + * @param offset The windows offset of the data. + * @param value The index to store. + * @param linuxdiff The linux difference of the data. + * @return The index of the corresponding pdata field. -1 for none set. + */ +native set_pdata_cbase(id, offset, value, linuxdiff=5); + + + + + enum HamError { diff --git a/dlls/hamsandwich/msvc8/hamsandwich.vcproj b/dlls/hamsandwich/msvc8/hamsandwich.vcproj index 9c731541..e9614d3d 100644 --- a/dlls/hamsandwich/msvc8/hamsandwich.vcproj +++ b/dlls/hamsandwich/msvc8/hamsandwich.vcproj @@ -94,6 +94,7 @@ /> - - - - @@ -259,10 +252,6 @@ > - -