diff --git a/dlls/hamsandwich/DataHandler.cpp b/dlls/hamsandwich/DataHandler.cpp index fc11a4c7..33d5dab5 100644 --- a/dlls/hamsandwich/DataHandler.cpp +++ b/dlls/hamsandwich/DataHandler.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" #include "CVector.h" diff --git a/dlls/hamsandwich/DataHandler.h b/dlls/hamsandwich/DataHandler.h index be1ae95f..9a1b220d 100644 --- a/dlls/hamsandwich/DataHandler.h +++ b/dlls/hamsandwich/DataHandler.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef RETURNHANDLER_H #define RETURNHANDLER_H diff --git a/dlls/hamsandwich/Makefile b/dlls/hamsandwich/Makefile index 010bd183..f67723f7 100644 --- a/dlls/hamsandwich/Makefile +++ b/dlls/hamsandwich/Makefile @@ -48,9 +48,7 @@ else OPT_FLAGS = $(SANE_OPT_FLAGS) endif ifeq "$(GCC_VERSION)" "4" -# OPT_FLAGS += -fvisibility=hidden -#-fvisibility-inlines-hidden - OPT_FLAGS += -g -ggdb3 + OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden endif CFLAGS = $(OPT_FLAGS) endif diff --git a/dlls/hamsandwich/NEW_Util.h b/dlls/hamsandwich/NEW_Util.h index c2796a92..9712b45d 100644 --- a/dlls/hamsandwich/NEW_Util.h +++ b/dlls/hamsandwich/NEW_Util.h @@ -1,24 +1,23 @@ /* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team * - * by sawce - * - * - * This program is free software; you can redistribute it and/or modify it + * Ham Sandwich is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * - * This program is distributed in the hope that it will be useful, but + * Ham Sandwich is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, + * along with Ham Sandwich; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to - * link the code of this program with the Half-Life Game Engine ("HL + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs diff --git a/dlls/hamsandwich/amxx_api.cpp b/dlls/hamsandwich/amxx_api.cpp index 94dd35cf..d6616ae1 100644 --- a/dlls/hamsandwich/amxx_api.cpp +++ b/dlls/hamsandwich/amxx_api.cpp @@ -1,3 +1,32 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ + #include #include "sdk/amxxmodule.h" @@ -28,6 +57,12 @@ int ReadConfig(void); void OnAmxxAttach(void) { // Assert that the enum is aligned properly with the table + + assert(strcmp(hooklist[Ham_FVecVisible].name, "fvecvisible")==0); + assert(strcmp(hooklist[Ham_Player_UpdateClientData].name, "player_updateclientdata")==0); + assert(strcmp(hooklist[Ham_Item_AddToPlayer].name, "item_addtoplayer")==0); + 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); MF_AddNatives(pdata_natives_safe); diff --git a/dlls/hamsandwich/call_funcs.cpp b/dlls/hamsandwich/call_funcs.cpp index 2c168703..a096d611 100644 --- a/dlls/hamsandwich/call_funcs.cpp +++ b/dlls/hamsandwich/call_funcs.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" #include "offsets.h" @@ -581,3 +609,18 @@ cell Call_Void_ItemInfo(AMX *amx, cell *params) #endif return 1; } + +cell Call_Float_Void(AMX *amx, cell *params) +{ + SETUP(1); + +#ifdef _WIN32 + float ret=reinterpret_cast(__func)(pv, 0); +#elif defined __linux__ + float ret=reinterpret_cast(__func)(pv); +#endif + *MF_GetAmxAddr(amx, params[3])=amx_ftoc2(ret); + + return 1; + +} diff --git a/dlls/hamsandwich/call_funcs.h b/dlls/hamsandwich/call_funcs.h index ffdddbd3..b09f2c42 100644 --- a/dlls/hamsandwich/call_funcs.h +++ b/dlls/hamsandwich/call_funcs.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef HOOK_Call_H #define HOOK_Call_H @@ -56,4 +84,6 @@ cell Call_Void_Int_Int_Int(AMX *amx, cell *params); cell Call_Void_ItemInfo(AMX *amx, cell *params); +cell Call_Float_Void(AMX *amx, cell *params); + #endif diff --git a/dlls/hamsandwich/config/hamdata.ini b/dlls/hamsandwich/config/hamdata.ini index d60f3258..af921cfc 100644 --- a/dlls/hamsandwich/config/hamdata.ini +++ b/dlls/hamsandwich/config/hamdata.ini @@ -117,7 +117,6 @@ item_addduplicate 62 item_getiteminfo 63 item_candeploy 64 - item_candrop 65 item_deploy 66 item_canholster 68 item_holster 69 @@ -150,6 +149,8 @@ cstrike_restart 4 cstrike_roundrespawn 86 + cstrike_item_candrop 65 + cstrike_item_getmaxspeed 80 @end @section cstrike windows @@ -225,7 +226,6 @@ item_addduplicate 60 item_getiteminfo 61 item_candeploy 62 - item_candrop 63 item_deploy 64 item_canholster 66 item_holster 67 @@ -258,7 +258,8 @@ cstrike_restart 2 cstrike_roundrespawn 84 - + cstrike_item_candrop 63 + cstrike_item_getmaxspeed 78 @end @section dod linux pev 0 @@ -332,7 +333,6 @@ item_addduplicate 67 item_getiteminfo 68 item_candeploy 69 - item_candrop 72 item_deploy 70 item_canholster 75 item_holster 76 @@ -370,6 +370,8 @@ dod_areasendstatus 13 dod_getstate 17 dod_getstateent 18 + dod_item_candrop 72 + @end @section dod windows pev 4 @@ -443,7 +445,6 @@ item_addduplicate 65 item_getiteminfo 66 item_candeploy 67 - item_candrop 70 item_deploy 68 item_canholster 73 item_holster 74 @@ -481,6 +482,7 @@ dod_areasendstatus 11 dod_getstate 15 dod_getstateent 16 + dod_item_candrop 70 @end ; TFC Does not have the following "standard" entries in its vtable: diff --git a/dlls/hamsandwich/config_parser.cpp b/dlls/hamsandwich/config_parser.cpp index cd6a0d4c..340c43fd 100644 --- a/dlls/hamsandwich/config_parser.cpp +++ b/dlls/hamsandwich/config_parser.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" #include "ham_const.h" diff --git a/dlls/hamsandwich/forward.h b/dlls/hamsandwich/forward.h index 61bf7719..c524c6e1 100644 --- a/dlls/hamsandwich/forward.h +++ b/dlls/hamsandwich/forward.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" #ifndef FORWARD_H diff --git a/dlls/hamsandwich/ham_const.h b/dlls/hamsandwich/ham_const.h index 4f7caf63..9d7f667b 100644 --- a/dlls/hamsandwich/ham_const.h +++ b/dlls/hamsandwich/ham_const.h @@ -1,3 +1,32 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ + #ifndef HAM_CONST_H #define HAM_CONST_H @@ -80,7 +109,6 @@ enum Ham_Item_AddToPlayer, Ham_Item_AddDuplicate, - Ham_Item_GetItemInfo, Ham_Item_CanDeploy, Ham_Item_Deploy, Ham_Item_CanHolster, @@ -118,6 +146,8 @@ enum Ham_CS_Restart, Ham_CS_RoundRespawn, + Ham_CS_Item_CanDrop, + Ham_CS_Item_GetMaxSpeed, Ham_DOD_RoundRespawn, Ham_DOD_RoundRespawnEnt, @@ -126,6 +156,7 @@ enum Ham_DOD_AreaSendStatus, Ham_DOD_GetState, Ham_DOD_GetStateEnt, + Ham_DOD_Item_CanDrop, Ham_TFC_EngineerUse, Ham_TFC_Finished, diff --git a/dlls/hamsandwich/ham_utils.h b/dlls/hamsandwich/ham_utils.h index f4fca085..39a99f52 100644 --- a/dlls/hamsandwich/ham_utils.h +++ b/dlls/hamsandwich/ham_utils.h @@ -1,3 +1,32 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ + #ifndef HAM_UTILS_H #define HAM_UTILS_H diff --git a/dlls/hamsandwich/hook.h b/dlls/hamsandwich/hook.h index dcf45092..2d2c6ee4 100644 --- a/dlls/hamsandwich/hook.h +++ b/dlls/hamsandwich/hook.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef HOOK_H #define HOOK_H @@ -62,7 +90,7 @@ public: ivtable[entry]=(int *)func; #if defined _WIN32 - VirtualFree(tramp, 0, MEM_RELEASE); + VirtualFree(tramp, 0, MEM_RELEASE); #elif __linux__ free(tramp); #endif diff --git a/dlls/hamsandwich/hook_callbacks.cpp b/dlls/hamsandwich/hook_callbacks.cpp index 26b9cabf..4db15e63 100644 --- a/dlls/hamsandwich/hook_callbacks.cpp +++ b/dlls/hamsandwich/hook_callbacks.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include #include #include @@ -925,3 +953,29 @@ void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo) KILL_VECTOR() POP() } + +float Hook_Float_Void(Hook *hook, void *pthis) +{ + float ret=0.0; + float origret=0.0; + PUSH_FLOAT() + + MAKE_VECTOR() + + PRE_START() + PRE_END() +#if defined _WIN32 + origret=reinterpret_cast(hook->func)(pthis, 0); +#elif defined __linux__ + origret=reinterpret_cast(hook->func)(pthis); +#endif + + POST_START() + POST_END() + + KILL_VECTOR() + POP() + + CHECK_RETURN() + return ret; +} diff --git a/dlls/hamsandwich/hook_callbacks.h b/dlls/hamsandwich/hook_callbacks.h index 9e50dd6f..29dc0807 100644 --- a/dlls/hamsandwich/hook_callbacks.h +++ b/dlls/hamsandwich/hook_callbacks.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef HOOK_CALLBACKS_H #define HOOK_CALLBACKS_H @@ -141,4 +169,9 @@ const bool RT_Void_ItemInfo = true; const int PC_Void_ItemInfo = 1; void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo); + +const bool RT_Float_Void = true; +const int PC_Float_Void = 0; +float Hook_Float_Void(Hook *hook, void *pthis); + #endif diff --git a/dlls/hamsandwich/hook_create.cpp b/dlls/hamsandwich/hook_create.cpp index 375d7d0d..1b28a859 100644 --- a/dlls/hamsandwich/hook_create.cpp +++ b/dlls/hamsandwich/hook_create.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" int Create_Void_Void(AMX *amx, const char *func) @@ -135,3 +163,7 @@ int Create_Void_ItemInfo(AMX *amx, const char *func) { return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL); } +int Create_Float_Void(AMX *amx, const char *func) +{ + return MF_RegisterSPForwardByName(amx, func, FP_CELL); +} diff --git a/dlls/hamsandwich/hook_create.h b/dlls/hamsandwich/hook_create.h index 463170f7..1079e276 100644 --- a/dlls/hamsandwich/hook_create.h +++ b/dlls/hamsandwich/hook_create.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef HOOK_CREATE_H #define HOOK_CREATE_H @@ -56,4 +84,6 @@ int Create_Void_Int_Int_Int(AMX *amx, const char *func); int Create_Void_ItemInfo(AMX *amx, const char *func); +int Create_Float_Void(AMX *amx, const char *func); + #endif diff --git a/dlls/hamsandwich/hook_native.cpp b/dlls/hamsandwich/hook_native.cpp index 601244ca..f1204dd7 100644 --- a/dlls/hamsandwich/hook_native.cpp +++ b/dlls/hamsandwich/hook_native.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include #include #include @@ -52,7 +80,7 @@ hook_t hooklist[] = { V("addplayeritem", Int_Cbase) }, { V("removeplayeritem", Int_Cbase) }, { V("giveammo", Int_Int_Str_Int) }, - { V("getdelay", Int_Void) }, + { V("getdelay", Float_Void) }, { V("ismoving", Int_Void) }, { V("overridereset", Void_Void) }, { V("damagedecal", Int_Int) }, @@ -100,7 +128,6 @@ hook_t hooklist[] = /* CBasePlayerItem */ { V("item_addtoplayer", Int_Cbase) }, { V("item_addduplicate", Int_Cbase) }, - { V("item_getiteminfo", Void_ItemInfo) }, { V("item_candeploy", Int_Void) }, { V("item_deploy", Int_Void) }, { V("item_canholster", Int_Void) }, @@ -142,6 +169,8 @@ hook_t hooklist[] = /* Counter-Strike */ { V("cstrike_restart", Void_Void) }, { V("cstrike_roundrespawn", Void_Void) }, + { V("cstrike_item_candrop", Int_Void) }, + { V("cstrike_item_getmaxspeed", Float_Void) }, /* Day of Defeat */ { V("dod_roundrespawn", Void_Void) }, @@ -151,6 +180,7 @@ hook_t hooklist[] = { V("dod_areasendstatus", Void_Cbase) }, { V("dod_getstate", Int_Void) }, { V("dod_getstateent", Int_Cbase) }, + { V("dod_item_candrop", Int_Void) }, /* Team Fortress Classic */ @@ -192,8 +222,8 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params) CHECK_FUNCTION(func); - char *function=MF_GetAmxString(amx, params[2], 0, NULL); - char *classname=MF_GetAmxString(amx, params[3], 1, NULL); + char *function=MF_GetAmxString(amx, params[3], 0, NULL); + char *classname=MF_GetAmxString(amx, params[2], 1, NULL); // Check the entity diff --git a/dlls/hamsandwich/hooklist.h b/dlls/hamsandwich/hooklist.h index 96fded60..24263680 100644 --- a/dlls/hamsandwich/hooklist.h +++ b/dlls/hamsandwich/hooklist.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef HOOKLIST_T_H #define HOOKLIST_T_H diff --git a/dlls/hamsandwich/include/ham_const.inc b/dlls/hamsandwich/include/ham_const.inc index 1584be60..52ad8302 100644 --- a/dlls/hamsandwich/include/ham_const.inc +++ b/dlls/hamsandwich/include/ham_const.inc @@ -147,26 +147,59 @@ enum Ham */ Ham_BloodColor, - + /** + * Description: Traces where blood should appear. + * Forward params: function(this, Float:Damage, Float:Direction[3], trace_handle, damagebits); + * Return type: None. + * Execute params: ExecuteHam(Ham_TraceBleed, this, Float:damage, Float:direction[3], trace_handle, damagebits); + */ Ham_TraceBleed, + + /** + * Description: Returns whether an entity is activated. + * Forward params: function(this, idActivator); + * Return type: Integer. + * Execute params: ExecuteHam(Ham_IsTriggered, this, idActivator); + */ Ham_IsTriggered, + + /** + * Description: Returns the id of the entity if its class is derived off of CBaseMonster, -1 otherwise. + * Forward params: function(this) + * Return type: Entity. + * Execute params: ExecuteHam(Ham_MyMonsterPointer, this); + */ Ham_MyMonsterPointer, + + /** + * Description: Returns the id of the entity if its class is derived off of CBaseSquadMonster, -1 otherwise. + * Forward params: function(this) + * Return type: Entity. + * Execute params: ExecuteHam(Ham_MySquadMonsterPointer, this); + */ Ham_MySquadMonsterPointer, + + /** + * Description: Returns the toggle state of the entity. + * Forward params: function(this) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_GetToggleState, this); + */ 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); + * Execute params: ExecuteHam(Ham_AddPoints, this, points, bool:cangonegative); */ Ham_AddPoints, /** - * Description: Typically adds points to the entity's team. + * Description: Typically adds points to everybody on the entity's team. * Forward params: function(this, points, bool:cangonegative); * Return type: None. - * Execute params: ExecuteHam(Ham_BloodColor, this, points, bool:cangonegative); + * Execute params: ExecuteHam(Ham_AddPointsToTeam, this, points, bool:cangonegative); */ Ham_AddPointsToTeam, @@ -185,7 +218,21 @@ enum Ham * Execute params: ExecuteHam(Ham_RemovePlayerItem, this, idother); */ Ham_RemovePlayerItem, + + /** + * Description: Gives ammo to the entity. + * Forward params: function(this, Amount, const Name[], Max) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_GiveAmmo, this, amount, "type", max); + */ Ham_GiveAmmo, + + /** + * Description: Unsure, I believe this is the delay between activation for an entity. + * Forward params: function(this) + * Return type: Float. + * Execute params: ExecuteHam(Ham_GetDelay, this, Float:output) + */ Ham_GetDelay, /** @@ -195,8 +242,29 @@ enum Ham * Execute params: ExecuteHam(Ham_IsMoving, this); */ Ham_IsMoving, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_OverrideReset, this) + */ Ham_OverrideReset, + + /** + * Description: Returns the damage decal of the entity for the damage type. + * Forward params: function(this, damagebits) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_DamageDecal, this); + */ Ham_DamageDecal, + + /** + * Description: Sets the toggle state of the entity. + * Forward params: function(this, state) + * Return type: None. + * Execute params: ExecuteHam(Ham_SetToggleState, this, state); + */ Ham_SetToggleState, /** @@ -214,12 +282,19 @@ enum Ham * Execute params: ExecuteHam(Ham_StopSneaking, this); */ Ham_StopSneaking, + + /** + * Description: Not entirely sure. + * Forward params: function(this, idOn) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_OnControls, this, idOn); + */ Ham_OnControls, /** * Description: Whether or not the entity is sneaking. * Forward params: function(this); - * Return type: None. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsSneaking, this); */ Ham_IsSneaking, @@ -227,7 +302,7 @@ enum Ham /** * Description: Whether or not the entity is alive. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsAlive, this); */ Ham_IsAlive, @@ -235,7 +310,7 @@ enum Ham /** * Description: Whether or not the entity uses a BSP model. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsBSPModel, this); */ Ham_IsBSPModel, @@ -243,16 +318,26 @@ enum Ham /** * Description: Whether or not the entity can reflect gauss shots.. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_ReflectGauss, this); */ Ham_ReflectGauss, + + /** + * Description: Whether or not the target is the same as the one passed. + * Note the strindex parameter is a string passed that has been allocated by the engine. + * Use fakemeta's EngFunc_SzFromIndex to convert to a normal string, or fakemeta's + * EngFunc_AllocString to create a new string. + * Forward params: function(this, strindex). + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_HasTarget, this, strindex); + */ Ham_HasTarget, /** * Description: Whether or not the entity is in the world. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsInWorld, this); */ Ham_IsInWorld, @@ -260,7 +345,7 @@ enum Ham /** * Description: Whether or not the entity is a player. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsPlayer, this); */ Ham_IsPlayer, @@ -268,7 +353,7 @@ enum Ham /** * Description: Whether or not the entity is a net client. * Forward params: function(this); - * Return type: Integer. + * Return type: Integer (boolean). * Execute params: ExecuteHam(Ham_IsNetClient, this); */ Ham_IsNetClient, @@ -277,13 +362,14 @@ 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); + * Execute params: ExecuteHam(Ham_TeamId, this, buffer[], size); */ Ham_TeamId, /** * Description: Returns the next target of this. * Forward params: function(this); + * Return type: Entity. * Execute params: ExecuteHam(Ham_GetNextTarget, this); */ Ham_GetNextTarget, @@ -323,7 +409,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. + * Return type: Entity. * Execute params: ExecuteHam(Ham_Respawn, this); */ Ham_Respawn, @@ -375,68 +461,385 @@ enum Ham * Execute params: ExecuteHam(Ham_BodyTarget, Float:srcvector[3], Float:returnvector[3]) */ Ham_BodyTarget, + + /** + * Description: Returns the illumination of the entity. + * Forward params: function(this) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_Illumination, this); + */ Ham_Illumination, + + /** + * Description: Unsure, I assume it is whether or not the other entity is visible to this entity. + * Forward params: function(this, idOther); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_FVisible, this, idOther); + */ Ham_FVisible, + + /** + * Description: Unsure, I assume it is whether or not the target vector is visible to this entity. + * Forward params: function(this, const Float:origin[3]); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_FVecVisible, this, const Float:origin[3]); + */ Ham_FVecVisible, + + /** + * Players have all the attributes of normal entities, in addition to these. + */ + + /** + * Description: Typically called every frame when a player has jump held. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_Jump, this); + */ Ham_Player_Jump, + + /** + * Description: Typically called every frame when a player has duck held. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_Duck, this); + */ Ham_Player_Duck, + + /** + * Description: Typically called every frame during PlayerPreThink engine call. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_PreThink, this); + */ Ham_Player_PreThink, + + /** + * Description: Typically called every frame during PlayerPostThink engine call. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_PostThink, this); + */ Ham_Player_PostThink, + + /** + * Description: Returns a vector that tells the gun position. + * Forward params: function(this) + * Return type: Vector, byreffed in execute. + * Execute params: ExecuteHam(Ham_Player_GetGunPosition, this, Float:output[3]); + */ Ham_Player_GetGunPosition, + + /** + * Description: Whether or not the player should fade on death. + * Forward param: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Player_ShouldFadeOnDeath, this); + */ Ham_Player_ShouldFadeOnDeath, + + /** + * Description: Called whenever an impulse command is executed. + * Forward param: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_ImpulseComands, this); + */ Ham_Player_ImpulseCommands, + + /** + * Description: Updates the client's data for hud changes (such as ammo). Usually called every frame. + * Forward param: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Player_UpdateClientData, this); + */ Ham_Player_UpdateClientData, /** * Items have all the attributes of normal entities in addition to these. */ + + /** + * Description: Adds the item to the player. + * Forward params: function(this, idPlayer); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_AddToPlayer, this, idPlayer); + */ Ham_Item_AddToPlayer, + + /** + * Description: Unsure. + * Forward params: function(this, idOriginal); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_AddDuplicate, this, idOriginal); + */ Ham_Item_AddDuplicate, - Ham_Item_GetItemInfo, + + /** + * Description: Whether or not this entity can be deployed. + * Forward params: function(this); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_CanDeploy, this); + */ Ham_Item_CanDeploy, + + /** + * Description: Deploys the entity (usually a weapon). + * Forward params: function(this); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_Deploy, this); + */ Ham_Item_Deploy, + + /** + * Description: Whether or not the entity can be holstered. + * Forward params: function(this); + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_CanHolster, this); + */ Ham_Item_CanHolster, + + /** + * Description: Whether or not the entity (usually weapon) can be holstered. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Item_Holster, this); + */ Ham_Item_Holster, + + /** + * Description: Updates the HUD info about this item. + * Forward params: function(this); + * Return type: None. + * Execute params: ExecuteHam(Ham_UpdateItemInfo, this); + */ Ham_Item_UpdateItemInfo, + + /** + * Description: Called each frame for an item, normally only on active items. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Item_PreFrame, this); + */ Ham_Item_PreFrame, + + /** + * Description: Called each frame for an item, normally only on active items. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Item_PostFrame, this); + */ Ham_Item_PostFrame, + + /** + * Description: Called when an item gets dropped, normally on death only. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Item_Drop, this); + */ Ham_Item_Drop, + + /** + * Description: Normally called when an item gets deleted. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Item_Drop, this); + */ Ham_Item_Kill, + + /** + * Description: Called when an entity starts being attached to (normally invisible and "following") a player. + * Forward params: function(this, idPlayer) + * Return type: None. + * Execute params: ExecuteHam(Ham_Item_AttachToPlayer, this, idPlayer) + */ Ham_Item_AttachToPlayer, + + /** + * Description: Returns the ammo index of the item. + * Forward params: function(this) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_Item_PrimaryAmmoIndex, this); + */ Ham_Item_PrimaryAmmoIndex, + + /** + * Description: Returns the secondary ammo index of the item. + * Forward params: function(this) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_Item_SecondaryAmmoIndex, this); + */ Ham_Item_SecondaryAmmoIndex, + + /** + * Description: Updates item data for the client. + * Forward params: function(this, idPlayer) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_Item_UpdateClientData, this, idPlayer); + */ Ham_Item_UpdateClientData, + + /** + * Description: Returns the entity index if the item is a weapon, -1 otherwise. + * Forward params: function(this) + * Return type: Entity. + * Execute Params: ExecuteHam(Ham_Item_GetWeaponPtr, this) + */ Ham_Item_GetWeaponPtr, + + /** + * Description: Returns the item slot for the item. + * Forward params: function(this) + * Return type: Integer. + * Execute Params: ExecuteHam(Ham_Item_ItemSlot, this) + */ Ham_Item_ItemSlot, /** * Weapons have all the attributes to Ham_Item_*, in addition to these. */ + + /** + * Description: Gets ammo from the target weapon. + * Forward params: function(this, idTarget) + * Return type: Integer. + * Execute Params: ExecuteHam(Ham_Weapon_ExtractAmmo, this, idTarget) + */ Ham_Weapon_ExtractAmmo, + + /** + * Description: Gets clip ammo from the target weapon. + * Forward params: function(this, idTarget) + * Return type: Integer. + * Execute Params: ExecuteHam(Ham_Weapon_ExtractAmmo, this, idTarget) + */ Ham_Weapon_ExtractClipAmmo, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Weapon_AddWeapon, this); + */ Ham_Weapon_AddWeapon, + + /** + * Description: Plays the weapon's empty sound. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Weapon_PlayEmptySound, this); + */ Ham_Weapon_PlayEmptySound, + + /** + * Description: Sets the weapon so that it can play empty sound again. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_ResetEmptySound, this); + */ Ham_Weapon_ResetEmptySound, + + /** + * Description: Sends an animation event for the weapon. + * Forward params: function(this, iAnim, skiplocal, body); + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_SendWeaponAnim, this, iAnim, skiplocal, body); + */ Ham_Weapon_SendWeaponAnim, + + /** + * Description: Whether or not the weapon is usable (has ammo, etc.) + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Weapon_IsUsable, this) + */ Ham_Weapon_IsUsable, + + /** + * Description: Called when the main attack of a weapon is triggered. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_PrimaryAttack, this); + */ Ham_Weapon_PrimaryAttack, + + /** + * Description: Called when the secondary attack of a weapon is triggered. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_SecondaryAttack, this); + */ Ham_Weapon_SecondaryAttack, + + /** + * Description: Called when the weapon is reloaded. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_Reload, this); + */ Ham_Weapon_Reload, + + /** + * Description: Displays the idle animation for the weapon. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_Weapon_WeaponIdle, this); + */ Ham_Weapon_WeaponIdle, + + /** + * Description: There is no more ammo for this gun, so switch to the next best one. + * Forward params: function(this) + * Return type: None. + * ExecuteParams: ExecuteHam(Ham_Weapon_RetireWeapon, this) + */ Ham_Weapon_RetireWeapon, + + /** + * Description: Whether or not the weapon should idle. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute Params: ExecuteHam(Ham_Weapon_ShouldWeaponIdle, this) + */ Ham_Weapon_ShouldWeaponIdle, + + /** + * Description: Not sure. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_Weapon_UseDecrement, this); + */ Ham_Weapon_UseDecrement, - + /** + * Description: - + * Forward params: function(this, someboolvalue) + * Return type: None. + * Execute params: ExecuteHam(Ham_TS_BreakableRespawn, this, someboolvalue); + */ Ham_TS_BreakableRespawn, + + /** + * Description: - + * Forward params: function(this) + * Return type: Integer (boolean) + * Execute params: ExecuteHam(Ham_TS_CanUsedThroughWalls, this); + */ Ham_TS_CanUsedThroughWalls, + + /** + * Description: - + * Forward params: function(this) + * Return type: Integer (I think...) + * Execute params: ExecuteHam(Ham_TS_RespawnWait, this); + */ Ham_TS_RespawnWait, /** * Description: This is called on a map reset for most map based entities. * Forward params: function(this); + * Return type: None. * Execute params: ExecuteHam(Ham_CS_Restart, this); */ Ham_CS_Restart, @@ -444,33 +847,204 @@ enum Ham /** * Description: Respawn function for players/bots only! Do not use this on non player/bot entities! * Forward params: function(this); + * Return type: None. * Execute params: ExecuteHam(Ham_CS_RoundRespawn, this); */ Ham_CS_RoundRespawn, + /** + * Description: Whether or not the player can drop the specified item. + * Forward params: function(this) + * Return type: Integer + * Execute params: ExecuteHam(Ham_CS_Item_CanDrop, this); + */ + Ham_CS_Item_CanDrop, + + /** + * Description: Gets the maximum speed for whenever a player has the item deployed. + * Forward params: function(this); + * Return type: Float, byrefed in execute. + * Execute params: ExecuteHam(Ham_CS_Item_GetMaxSpeed, this, Float:output); + */ + Ham_CS_Item_GetMaxSpeed, + /** + * Description: I assume this spawns players at the start of a new round. + * Forward params: function(this) + * Return type: None. + * Execute Params: ExecuteHam(Ham_DOD_RoundRespawn, this); + */ Ham_DOD_RoundRespawn, - Ham_DOD_RoundRespawnEnt, - Ham_DOD_RoundStore, - Ham_DOD_AreaSetIndex, - Ham_DOD_AreaSendStatus, - Ham_DOD_GetState, - Ham_DOD_GetStateEnt, + /** + * Description: I assume this spawns entities (like func_breakables) at the start of a new round. + * Forward params: function(this) + * Return type: None. + * Execute Params: ExecuteHam(Ham_DOD_RoundRespawn, this); + */ + Ham_DOD_RoundRespawnEnt, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: None, I think... + * Execute params: ExecuteHam(Ham_DOD_RoundStore, this); + */ + Ham_DOD_RoundStore, + + /** + * Description: Unsure. + * Forward params: function(this, someintegervalue) + * Return type: None. + * Execute params: ExecuteHam(Ham_DOD_AreaSetIndex, this, someintegervalue) + */ + Ham_DOD_AreaSetIndex, + + /** + * Description: Unsure + * Forward params: function(this, idPlayer) + * Return type: None. + * Execute Params: ExecuteHam(Ham_DOD_AreaSendStatus, this, idPlayer); + */ + Ham_DOD_AreaSendStatus, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: Integer. + * Execute Params: ExecuteHam(Ham_DOD_GetState, this); + */ + Ham_DOD_GetState, + + /** + * Description: Unsure. + * Forward params: function(this, idtarget) + * Return type: Integer. + * Execute Params: ExecuteHam(Ham_DOD_GetStateEnt, this, idtarget); + */ + Ham_DOD_GetStateEnt, + + /** + * Description: Whether or not a player can drop this item. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute Params: ExecuteHam(Ham_DOD_Item_CanDrop, this); + */ + Ham_DOD_Item_CanDrop, + + /** + * Description: Unsure. + * Forward params: function(this, iduser) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_TFC_EngineerUse, this, iduser) + */ Ham_TFC_EngineerUse, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_Finished, this); + */ Ham_TFC_Finished, + + /** + * Description: Unsure. + * Forward params: function(this, entityid, Float:floata, Float:floatb) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_EmpExplode, this, entityid, Float:floata, Float:floatb) + */ Ham_TFC_EmpExplode, + + /** + * Description: Unsure. + * Forward params: function(this, Float:floata, Float:floatb) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_CalcEmpDmgRad, this, Float:floata, Float:floatb) + */ Ham_TFC_CalcEmpDmgRad, + + /** + * Description: Unsure. + * Forward params: function(this, entityid) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_TakeEmpBlast, this, entityid); + */ Ham_TFC_TakeEmpBlast, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_EmpRemove, this); + */ Ham_TFC_EmpRemove, + + + /** + * Description: Unsure. + * Forward params: function(this, entityid, Float:floata) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_TakeConcussionBlast, this, entityid, Float:floata); + */ Ham_TFC_TakeConcussionBlast, + + /** + * Description: Unsure. + * Forward params: function(this, entityid) + * Return type: None. + * Execute params: ExecuteHam(Ham_TFC_Concuss, this, entityid); + */ Ham_TFC_Concuss, - Ham_ESF_IsEnvModel, // Only valid in ESF Open Beta - Ham_ESF_TakeDamage2, // Only valid in ESF Open Beta + + /** + * Description: Unsure. + * Is only in ESF Open Beta. + * Forward params: function(this) + * Return type: Integer (boolean). + * Execute params: ExecuteHam(Ham_ESF_IsEnvModel, this); + */ + Ham_ESF_IsEnvModel, + + /** + * Description: Unsure. + * Is only in ESF Open Beta. + * Forward params: function(this, entityida, entityidb, Float:floata, Float:floatb, dmgbits) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_ESF_TakeDamage2, this, entityida, entityidb, Float:floata, Float:floatb, dmgbits); + */ + Ham_ESF_TakeDamage2, + /** + * Description: Returns how many points each entity is worth. + * Forward params: function(this) + * Return type: Integer. + * Execute params: ExecuteHam(Ham_NS_GetPointValue, this); + */ Ham_NS_GetPointValue, + + /** + * Description: Unsure. Probably awards this with the killing of idvictim. + * Forward params: function(this, idvictim) + * Return type: None. + * Execute params: ExecuteHam(Ham_NS_AwardKill, this, idvictim); + */ Ham_NS_AwardKill, + + /** + * Description: Unsure, probably whenever an entity resets after a new round. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_NS_ResetEntity, this); + */ Ham_NS_ResetEntity, + + /** + * Description: Unsure. + * Forward params: function(this) + * Return type: None. + * Execute params: ExecuteHam(Ham_NS_UpdateOnRemove, this) + */ Ham_NS_UpdateOnRemove, diff --git a/dlls/hamsandwich/include/hamsandwich.inc b/dlls/hamsandwich/include/hamsandwich.inc index 903b9193..8cce0395 100644 --- a/dlls/hamsandwich/include/hamsandwich.inc +++ b/dlls/hamsandwich/include/hamsandwich.inc @@ -64,7 +64,7 @@ * @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 callback[], const entity[], post=0); +native HamHook:RegisterHam(Ham:function, const EntityClassname[], const Callback[], Post=0); /** * Stops a ham forward from triggering. diff --git a/dlls/hamsandwich/msvc8/hamsandwich.vcproj b/dlls/hamsandwich/msvc8/hamsandwich.vcproj index 8147442c..30c4db7f 100644 --- a/dlls/hamsandwich/msvc8/hamsandwich.vcproj +++ b/dlls/hamsandwich/msvc8/hamsandwich.vcproj @@ -308,10 +308,6 @@ RelativePath="..\srvcmd.cpp" > - - diff --git a/dlls/hamsandwich/offsets.h b/dlls/hamsandwich/offsets.h index 98aec275..947b6ec6 100644 --- a/dlls/hamsandwich/offsets.h +++ b/dlls/hamsandwich/offsets.h @@ -1,3 +1,32 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ + #ifndef OFFSETS_H #define OFFSETS_H diff --git a/dlls/hamsandwich/pdata.cpp b/dlls/hamsandwich/pdata.cpp index b0911d6a..ad58a46c 100644 --- a/dlls/hamsandwich/pdata.cpp +++ b/dlls/hamsandwich/pdata.cpp @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #include "sdk/amxxmodule.h" #include "offsets.h" #include "NEW_Util.h" diff --git a/dlls/hamsandwich/srvcmd.cpp b/dlls/hamsandwich/srvcmd.cpp index 3efc3f7d..bac995bd 100644 --- a/dlls/hamsandwich/srvcmd.cpp +++ b/dlls/hamsandwich/srvcmd.cpp @@ -1,3 +1,32 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ + #include "sdk/amxxmodule.h" #include @@ -35,10 +64,10 @@ void HamCommand(void) if (strcmp(cmd, "list")==0) { unsigned int Total=0; - print_srvconsole("%-24s | %3s | %10s\n","Name","Set","Value"); - print_srvconsole("-------------------------------------------\n"); - print_srvconsole("%-24s | %s | %10d\n", "pev", Offsets.IsPevSet() == 0 ? "n" : "y", Offsets.GetPev()); - print_srvconsole("%-24s | %s | %10d\n", "base", Offsets.IsBaseSet() == 0 ? "n" : "y", Offsets.GetBase()); + print_srvconsole("%-24s | %10s\n","Name","Set","Value"); + print_srvconsole("------------------------------------\n"); + print_srvconsole("%-24s | %10d\n", "pev", Offsets.GetPev()); + print_srvconsole("%-24s | %10d\n", "base", Offsets.GetBase()); if (Offsets.IsPevSet()) { @@ -52,18 +81,19 @@ void HamCommand(void) int count=2; for (int i=0; i= 5) { count = 0; - print_srvconsole("-------------------------------------------\n"); + print_srvconsole("------------------------------------\n"); } diff --git a/dlls/hamsandwich/typetocell.h b/dlls/hamsandwich/typetocell.h index 5087ed64..0c376b20 100644 --- a/dlls/hamsandwich/typetocell.h +++ b/dlls/hamsandwich/typetocell.h @@ -1,3 +1,31 @@ +/* Ham Sandwich + * Copyright 2007 + * By the AMX Mod X Development Team + * + * Ham Sandwich is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Ham Sandwich is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ham Sandwich; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, the author gives permission to + * link the code of Ham Sandwich with the Half-Life Game Engine ("HL + * Engine") and Modified Game Libraries ("MODs") developed by Valve, + * L.L.C ("Valve"). You must obey the GNU General Public License in all + * respects for all of the code used other than the HL Engine and MODs + * from Valve. If you modify this file, you may extend this exception + * to your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. + */ #ifndef TYPETOCELL_H #define TYPETOCELL_H