Update Hamsandwich for Sven Coop 5.17 (#452)

* Remove dropped functions

* Update existing offsets

* Add some logic to prevent the use of removed functions.

* Add Ham_SC_AddPoints and Ham_SC_AddPointsToTeam

* Add Ham_SC_GiveAmmo

* Add Ham_SC_FVisibleFromPos

* Fix an old typos with CanPlaySentence for all mods

* Add Ham_SC_CanPlaySequence

* Add Ham_SC_PlayScriptSentence

* Add Ham_SC_StartPlayerFollowing

* Fix CanPlaySequence hamdata.ini (SC)

* Add Ham_SC_StopPlayerFollowing

* Fix handlers from previous commits

* Add Ham_SC_PreSpawn

* Add Ham_SC_PostSpawn

* Add Ham_SC_OnKeyValueUpdate

* Add Ham_SC_SetClassification

* Add Ham_SC_MyCustomPointer and Ham_SC_MyItemPointer

* Add Ham_SC_IsSneaking

* Add Ham_SC_IsAlive

* Add Ham_SC_IsBSPModel

* Add Ham_SC_ReflectGauss

* Add Ham_SC_HasTarget

* Add Ham_SC_IsInWorld

* Add Ham_SC_IsPlayer

* Add Ham_SC_IsNetClient

* Add Ham_SC_IsBreakable

* Fix Ham_SC_IsMonster, Ham_SC_IsPointEntity, Ham_SC_IsMachine and Ham_SC_CriticakRemove handlers

* Add Ham_SC_OnControls

* Fix Ham_SC_TakeHealth and Ham_SC_TakeArmor handlers

* Add Ham_SC_IsTriggered

* Add Ham_SC_RemovePlayerItem

* Fix typo

* Fix Ham_SC_IsMoving handler

* Add Ham_SC_SUB_UseTargets

* Ham_SC_IsLockedByMaster

* Add Ham_SC_FBecomeProne

* Fix Ham_SC_FVisible handler

* Add Ham_SC_FVecVisible

* Fix Ham_SC_FVisibleFromPos handler

* Fix Ham_SC_IsFacing handler

* Add Ham_SC_SetPlayerAlly

* Add Ham_SC_OnSetOriginByMap

* Add Ham_SC_IsRevivable

* Add Ham_SC_BeginRevive and Ham_SC_EndRevive

* Update offsets based on SvenCoop v5.17

* Add Ham_SC_Item_CanCollect and Ham_SC_Item_Collect

* Add Ham_SC_Item_AddToPlayer

* Add Ham_SC_Item_AddDuplicate

* Add Ham_SC_Item_AddAmmoFromItem

* Add Ham_SC_Item_GetItemInfo

* Add Ham_SC_Item_CanDeploy, Ham_SC_Item_Deploy and Ham_SC_Item_CanHolster

* Add Ham_SC_Item_UpdateClientData

* Add Ham_SC_Item_GetRespawnTime

* Add Ham_SC_Item_CanHaveDuplicates

* Add Ham_SC_Weapon_ExtractAmmoFromItem

* Add Ham_SC_Weapon_GetAmmo1Drop and Ham_SC_Weapon_GetAmmo2Drop

* Add Ham_SC_Weapon_FinishReload and Ham_SC_Weapon_ShouldReload

* Fix Ham_SC_IsMultiplayer, Ham_SC_FRunfuncs and Ham_SC_FCanRun handlers

* Add Ham_SC_Weapon_AddWeapon, _PlayEmptySound, _IsUsable, _ShouldWeaponIdle and _UseDecrement

* Add Ham_SC_Item_GetPickupSound

* Add Ham_SC_Item_InactiveItemPreFrame and Ham_SC_Item_InactiveItemPostFrame

* Add Ham_SC_Item_DetachFromPlayer

* Fix Ham_SC_Player_IsConnected handler

* Add Ham_SC_Player_EnteredObserver, Ham_SC_Player_LeftObserver and Ham_SC_Player_IsObserver

* Fix sc_postpawn typo (should be sc_postspawn)

* Add few more assert
This commit is contained in:
Vincent Herbet
2018-09-06 17:09:10 +02:00
committed by GitHub
parent 0894027cb5
commit 99ebd62653
13 changed files with 2388 additions and 559 deletions

View File

@@ -173,7 +173,22 @@ cell Call_Int_Float_Int_Int(AMX *amx, cell *params)
return reinterpret_cast<int (*)(void *, float, int, int)>(__func)(pv, f3, i4, i5);
#endif
}
cell Call_Bool_Float_Int_Int(AMX *amx, cell *params)
{
SETUP(3);
float f3 = amx_ctof(*MF_GetAmxAddr(amx, params[3]));
int i4 = *MF_GetAmxAddr(amx, params[4]);
int i5 = *MF_GetAmxAddr(amx, params[5]);
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, float, int, int)>(__func)(pv, 0, f3, i4, i5) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, float, int, int)>(__func)(pv, f3, i4, i5) ? TRUE : FALSE;
#endif
}
cell Call_Void_Entvar_Int(AMX *amx, cell *params)
{
SETUP(2);
@@ -248,6 +263,36 @@ cell Call_Void_Int_Int(AMX *amx, cell *params)
return 1;
}
cell Call_Void_Int_Bool(AMX *amx, cell *params)
{
SETUP(2);
int i3 = *MF_GetAmxAddr(amx, params[3]);
bool i4 = *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
reinterpret_cast<void(__fastcall *)(void*, int, int, bool)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, int, bool)>(__func)(pv, i3, i4);
#endif
return 1;
}
cell Call_Void_Bool_Bool(AMX *amx, cell *params)
{
SETUP(2);
bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
bool i4 = *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
reinterpret_cast<void(__fastcall *)(void*, int, bool, bool)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, bool, bool)>(__func)(pv, i3, i4);
#endif
return 1;
}
cell Call_Int_Int_Str_Int(AMX *amx, cell *params)
{
SETUP(3);
@@ -279,6 +324,22 @@ cell Call_Int_Int_Str_Int_Int(AMX *amx, cell *params)
#endif
}
cell Call_Int_Int_Str_Int_Bool(AMX *amx, cell *params)
{
SETUP(4);
int i3 = *MF_GetAmxAddr(amx, params[3]);
char *sz4 = MF_GetAmxString(amx, params[4], 0, NULL);
int i5 = *MF_GetAmxAddr(amx, params[5]);
bool i6 = *MF_GetAmxAddr(amx, params[6]) != 0;
#if defined(_WIN32)
return reinterpret_cast<int(__fastcall *)(void*, int, int, const char *, int, bool)>(__func)(pv, 0, i3, sz4, i5, i6);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, int, const char *, int, bool)>(__func)(pv, i3, sz4, i5, i6);
#endif
}
cell Call_Int_Int(AMX *amx, cell *params)
{
SETUP(1);
@@ -292,6 +353,19 @@ cell Call_Int_Int(AMX *amx, cell *params)
#endif
}
cell Call_Bool_Bool(AMX *amx, cell *params)
{
SETUP(1);
bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
#if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, bool)>(__func)(pv, 0, i3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, bool)>(__func)(pv, i3) ? TRUE : FALSE;
#endif
}
cell Call_Int_Entvar(AMX *amx, cell *params)
{
SETUP(1);
@@ -591,6 +665,29 @@ cell Call_Int_pVector(AMX *amx, cell *params)
return ret;
}
cell Call_Bool_pVector(AMX *amx, cell *params)
{
SETUP(1);
Vector v3;
float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
v3.x = fl3[0];
v3.y = fl3[1];
v3.z = fl3[2];
#if defined(_WIN32)
bool ret = reinterpret_cast<bool(__fastcall *)(void *, int, Vector*)>(__func)(pv, 0, &v3);
#elif defined(__linux__) || defined(__APPLE__)
bool ret = reinterpret_cast<bool(*)(void *, Vector*)>(__func)(pv, &v3);
#endif
fl3[0] = v3.x;
fl3[1] = v3.y;
fl3[2] = v3.z;
return ret ? TRUE : FALSE;
}
cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params)
{
SETUP(3);
@@ -683,6 +780,24 @@ cell Call_Int_ItemInfo(AMX *amx, cell *params)
#endif
}
cell Call_Bool_ItemInfo(AMX *amx, cell *params)
{
SETUP(1);
void *ptr = reinterpret_cast<void *>(*MF_GetAmxAddr(amx, params[3]));
if (!ptr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Null ItemInfo handle!");
return 0;
}
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, void *)>(__func)(pv, 0, ptr) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *)>(__func)(pv, ptr) ? TRUE : FALSE;
#endif
}
cell Call_Float_Void(AMX *amx, cell *params)
{
SETUP(1);
@@ -844,6 +959,34 @@ cell Call_Int_Int_Int(AMX *amx, cell *params)
#endif
}
cell Call_Bool_Bool_Int(AMX *amx, cell *params)
{
SETUP(2);
bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
int i4 = *MF_GetAmxAddr(amx, params[4]);
#if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, bool, int)>(__func)(pv, 0, i3, i4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, bool, int)>(__func)(pv, i3, i4) ? TRUE : FALSE;
#endif
}
cell Call_Int_Bool_Int(AMX *amx, cell *params)
{
SETUP(2);
bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
int i4 = *MF_GetAmxAddr(amx, params[4]);
#if defined(_WIN32)
return reinterpret_cast<int(__fastcall *)(void*, int, bool, int)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, bool, int)>(__func)(pv, i3, i4);
#endif
}
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params)
{
SETUP(4);
@@ -886,6 +1029,30 @@ cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params)
return 1;
}
cell Call_Void_Str_Float_Float_Float_Bool_Cbase(AMX *amx, cell *params)
{
SETUP(6);
char *sz3=MF_GetAmxString(amx, params[3], 0, NULL);
float f4=amx_ctof(*MF_GetAmxAddr(amx, params[4]));
float f5=amx_ctof(*MF_GetAmxAddr(amx, params[5]));
float f6=amx_ctof(*MF_GetAmxAddr(amx, params[6]));
bool i7=*MF_GetAmxAddr(amx, params[7]) != 0;
int id8=*MF_GetAmxAddr(amx, params[8]);
CHECK_ENTITY(id8);
void *p8 = TypeConversion.id_to_cbase(id8);
#if defined(_WIN32)
reinterpret_cast<void (__fastcall *)(void*, int, const char *, float, float, float, bool, void *)>(__func)(pv, 0, sz3, f4, f5, f6, i7, p8);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void (*)(void *, const char *, float, float, float, bool, void *)>(__func)(pv, sz3, f4, f5, f6, i7, p8);
#endif
return 1;
}
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params)
{
SETUP(4);
@@ -1143,6 +1310,24 @@ cell Call_Void_Str_Int(AMX *amx, cell *params)
return 1;
}
cell Call_Bool_Cbase_Int(AMX *amx, cell *params)
{
SETUP(2);
int id3 = *MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
void *p8 = TypeConversion.id_to_cbase(id3);
int i4 = *MF_GetAmxAddr(amx, params[4]);
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, void *, int)>(__func)(pv, 0, p8, i4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *, int)>(__func)(pv, p8, i4) ? TRUE : FALSE;
#endif
}
cell Call_Void_Cbase_Int(AMX *amx, cell *params)
{
SETUP(2);
@@ -1163,6 +1348,27 @@ cell Call_Void_Cbase_Int(AMX *amx, cell *params)
return 1;
}
cell Call_Void_Cbase_Int_Float(AMX *amx, cell *params)
{
SETUP(3);
int id3 = *MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
void *p8 = TypeConversion.id_to_cbase(id3);
int i4 = *MF_GetAmxAddr(amx, params[4]);
float f5 = amx_ctof(*MF_GetAmxAddr(amx, params[5]));
#if defined(_WIN32)
reinterpret_cast<void(__fastcall *)(void*, int, void *, int, float)>(__func)(pv, 0, p8, i4, f5);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, void *, int, float)>(__func)(pv, p8, i4, f5);
#endif
return 1;
}
cell Call_Void_Str(AMX *amx, cell *params)
{
SETUP(1);
@@ -1401,7 +1607,7 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3);
bool b4=*MF_GetAmxAddr(amx, params[4]) ? true : false;
bool b4= *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
return reinterpret_cast<int (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, pv1, b4);
@@ -1410,6 +1616,25 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
#endif
}
cell Call_Bool_Cbase_Bool(AMX *amx, cell *params)
{
SETUP(2);
int id3 = *MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
void *pv1 = TypeConversion.id_to_cbase(id3);
bool b4 = *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, pv1, b4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *, bool)>(__func)(pv, pv1, b4) ? TRUE : FALSE;
#endif
}
cell Call_Int_Vector_Vector(AMX *amx, cell *params)
{
SETUP(2);
@@ -1434,6 +1659,54 @@ cell Call_Int_Vector_Vector(AMX *amx, cell *params)
#endif
}
cell Call_Int_pVector_pVector(AMX *amx, cell *params)
{
SETUP(2);
Vector v3;
Vector v4;
float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
v3.x = fl3[0];
v3.y = fl3[1];
v3.z = fl3[2];
float *fl4 = (float *)MF_GetAmxAddr(amx, params[4]);
v4.x = fl4[0];
v4.y = fl4[1];
v4.z = fl4[2];
#if defined(_WIN32)
return reinterpret_cast<int(__fastcall *)(void *, int, Vector *, Vector *)>(__func)(pv, 0, &v3, &v4);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, Vector *, Vector *)>(__func)(pv, &v3, &v4);
#endif
}
cell Call_Bool_pVector_pVector(AMX *amx, cell *params)
{
SETUP(2);
Vector v3;
Vector v4;
float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
v3.x = fl3[0];
v3.y = fl3[1];
v3.z = fl3[2];
float *fl4 = (float *)MF_GetAmxAddr(amx, params[4]);
v4.x = fl4[0];
v4.y = fl4[1];
v4.z = fl4[2];
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void *, int, Vector *, Vector *)>(__func)(pv, 0, &v3, &v4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, Vector *, Vector *)>(__func)(pv, &v3, &v4) ? TRUE : FALSE;
#endif
}
cell Call_Int_Entvar_Float(AMX *amx, cell *params)
{
SETUP(2);
@@ -1453,6 +1726,25 @@ cell Call_Int_Entvar_Float(AMX *amx, cell *params)
#endif
}
cell Call_Bool_Entvar_Float(AMX *amx, cell *params)
{
SETUP(2);
int id3 = *MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
entvars_t *ev3 = TypeConversion.id_to_entvars(id3);
float f4 = amx_ctof(*MF_GetAmxAddr(amx, params[4]));
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void *, int, entvars_t *, float)>(__func)(pv, 0, ev3, f4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, entvars_t *, float)>(__func)(pv, ev3, f4) ? TRUE : FALSE;
#endif
}
cell Call_Float_Float(AMX *amx, cell *params)
{
SETUP(2);
@@ -1497,9 +1789,9 @@ cell Call_Bool_Void(AMX *amx, cell *params)
SETUP(0);
#if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int)>(__func)(pv, 0);
return reinterpret_cast<bool (__fastcall *)(void*, int)>(__func)(pv, 0) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *)>(__func)(pv);
return reinterpret_cast<bool (*)(void *)>(__func)(pv) ? TRUE : FALSE;
#endif
}
@@ -1665,9 +1957,9 @@ cell Call_Bool_Cbase(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3);
#if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, void*)>(__func)(pv, 0, pv1);
return reinterpret_cast<bool (__fastcall *)(void*, int, void*)>(__func)(pv, 0, pv1) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, void*)>(__func)(pv, pv1);
return reinterpret_cast<bool (*)(void *, void*)>(__func)(pv, pv1) ? TRUE : FALSE;
#endif
}
@@ -1678,9 +1970,24 @@ cell Call_Bool_Int(AMX *amx, cell *params)
int id3=*MF_GetAmxAddr(amx, params[3]);
#if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, int)>(__func)(pv, 0, id3);
return reinterpret_cast<bool (__fastcall *)(void*, int, int)>(__func)(pv, 0, id3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, int)>(__func)(pv, id3);
return reinterpret_cast<bool (*)(void *, int)>(__func)(pv, id3) ? TRUE : FALSE;
#endif
}
cell Call_Bool_Entvar(AMX *amx, cell *params)
{
SETUP(1);
int id3 = *MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
entvars_t *ev3 = TypeConversion.id_to_entvars(id3);
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, void*)>(__func)(pv, 0, ev3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void*)>(__func)(pv, ev3) ? TRUE : FALSE;
#endif
}
@@ -1711,7 +2018,7 @@ cell Call_Void_Cbase_Bool(AMX *amx, cell *params)
CHECK_ENTITY(id3);
void *p8 = TypeConversion.id_to_cbase(id3);
bool b4 = *MF_GetAmxAddr(amx, params[4]) ? true : false;
bool b4 = *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
reinterpret_cast<void (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, p8, b4);