From 2696f0af0e23525589213ac47ef907d11507f697 Mon Sep 17 00:00:00 2001 From: xPaw Date: Thu, 5 Jun 2014 23:00:47 +0300 Subject: [PATCH 1/5] :fire: Remove compatibility stuff from the core --- amxmodx/AMBuilder | 1 - amxmodx/CLang.cpp | 19 +- amxmodx/Makefile | 2 +- amxmodx/amx.h | 2 +- amxmodx/amxmod_compat.cpp | 122 ------ amxmodx/amxmod_compat.h | 28 -- amxmodx/amxmodx.cpp | 75 ---- amxmodx/format.cpp | 19 - amxmodx/format.h | 1 - amxmodx/meta_api.cpp | 1 - amxmodx/modules.cpp | 23 +- amxmodx/msvc10/amxmodx_mm.vcxproj | 2 - amxmodx/msvc10/amxmodx_mm.vcxproj.filters | 6 - amxmodx/string.cpp | 76 +--- dlls/engine/AMBuilder | 1 - dlls/engine/Makefile | 3 +- dlls/engine/amxmod_compat.cpp | 453 ---------------------- dlls/engine/amxmod_compat.h | 25 -- dlls/engine/engine.cpp | 1 - dlls/engine/msvc10/engine.vcxproj | 2 - dlls/engine/msvc10/engine.vcxproj.filters | 6 - plugins/include/amxconst.inc | 2 +- 22 files changed, 17 insertions(+), 853 deletions(-) delete mode 100644 amxmodx/amxmod_compat.cpp delete mode 100644 amxmodx/amxmod_compat.h delete mode 100644 dlls/engine/amxmod_compat.cpp delete mode 100644 dlls/engine/amxmod_compat.h diff --git a/amxmodx/AMBuilder b/amxmodx/AMBuilder index 78389dcf..9f5fc5be 100644 --- a/amxmodx/AMBuilder +++ b/amxmodx/AMBuilder @@ -87,7 +87,6 @@ binary.sources = [ 'libraries.cpp', 'vector.cpp', 'sorting.cpp', - 'amxmod_compat.cpp', 'nongpl_matches.cpp', 'CFlagManager.cpp', 'datastructs.cpp', diff --git a/amxmodx/CLang.cpp b/amxmodx/CLang.cpp index 4b98041a..4f30c730 100755 --- a/amxmodx/CLang.cpp +++ b/amxmodx/CLang.cpp @@ -33,7 +33,6 @@ #include "amxmodx.h" #include "CLang.h" #include "format.h" -#include "amxmod_compat.h" #if defined(__linux__) || defined(__APPLE__) #define _snprintf snprintf @@ -289,23 +288,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) static char outbuf[4096]; cell *addr = get_amxaddr(amx, params[parm++]); - if (amx->flags & AMX_FLAG_OLDFILE) - { - if (*addr & BCOMPAT_TRANSLATE_BITS) - { - const char *key, *def; - if (!translate_bcompat(amx, addr, &key, &def)) - { - goto normal_string; - } - len = atcprintf(outbuf, sizeof(outbuf)-1, def, amx, params, &parm); - } else { - goto normal_string; - } - } else { -normal_string: - len = atcprintf(outbuf, sizeof(outbuf)-1, addr, amx, params, &parm); - } + len = atcprintf(outbuf, sizeof(outbuf)-1, addr, amx, params, &parm); return outbuf; } diff --git a/amxmodx/Makefile b/amxmodx/Makefile index 5c0422ec..42982f82 100755 --- a/amxmodx/Makefile +++ b/amxmodx/Makefile @@ -20,7 +20,7 @@ OBJECTS = meta_api.cpp CFile.cpp CVault.cpp vault.cpp float.cpp file.cpp modules amxxfile.cpp CLang.cpp md5.cpp emsg.cpp CForward.cpp CPlugin.cpp CModule.cpp \ CMenu.cpp util.cpp amx.cpp amxdbg.cpp natives.cpp newmenus.cpp debugger.cpp \ optimizer.cpp format.cpp messages.cpp libraries.cpp vector.cpp sorting.cpp \ - amxmod_compat.cpp nongpl_matches.cpp CFlagManager.cpp datastructs.cpp \ + nongpl_matches.cpp CFlagManager.cpp datastructs.cpp \ trie_natives.cpp CDataPack.cpp datapacks.cpp ############################################## diff --git a/amxmodx/amx.h b/amxmodx/amx.h index 05758e0c..fb8fe7e6 100755 --- a/amxmodx/amx.h +++ b/amxmodx/amx.h @@ -322,7 +322,7 @@ enum { #define AMX_FLAG_COMPACT 0x04 /* compact encoding */ #define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */ #define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */ -#define AMX_FLAG_OLDFILE 0x20 /* Old AMX Mod plugin */ +/* AMX_FLAG_OLDFILE 0x20 Old AMX Mod plugin */ #define AMX_FLAG_PRENIT 0x100 /* pre-initialized, do not check natives */ #define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */ #define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */ diff --git a/amxmodx/amxmod_compat.cpp b/amxmodx/amxmod_compat.cpp deleted file mode 100644 index f409bc36..00000000 --- a/amxmodx/amxmod_compat.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "amxmodx.h" -#include "amxmod_compat.h" -#include "format.h" - -bool GetTranslation(amxtrans_t trans, int &key, int &dest, int &lang) -{ - key = (trans & BCOMPAT_TRANSLATE_KEYMASK); - dest = (trans >> BCOMPAT_TRANSLATE_DESTRSH) & BCOMPAT_TRANSLATE_DESTMASK; - lang = (trans >> BCOMPAT_TRANSLATE_LANGRSH) & BCOMPAT_TRANSLATE_LANGMASK; - - if (dest == 0x3F) - { - dest = -1; - } - - if (lang == 0x1F) - { - lang = -1; - } - - return true; -} - -bool translate_bcompat(AMX *amx, cell *source, const char **_key, const char **_def) -{ - amxtrans_t trans = static_cast(*source); - int key, _dest, lang; - if (!GetTranslation(trans, key, _dest, lang)) - { - return false; - } - - //not optimized but it works, eh - //if someone cares they can make a translate() wrapper that takes the key # in directly - const char *r_key = g_langMngr.GetKey(key); - if (!r_key) - { - return false; - } - - cell amx_addr, *phys_addr; - if (amx_Allot(amx, 3, &amx_addr, &phys_addr) != AMX_ERR_NONE) - { - return false; - } - - if (_dest == -1) - { - *phys_addr = LANG_PLAYER; - } else if (_dest == 0) { - *phys_addr = LANG_SERVER; - } else if (lang >= 0 && lang < g_langMngr.GetLangsNum()) { - const char *name = g_langMngr.GetLangName(lang); - phys_addr[0] = static_cast(name[0]); - phys_addr[1] = static_cast(name[1]); - phys_addr[2] = static_cast('\0'); - } else { - *phys_addr = LANG_SERVER; - } - - const char *def = translate(amx, amx_addr, r_key); - if (!def) - { - def = r_key; - } - amx_Release(amx, amx_addr); - - *_key = g_langMngr.GetKey(key); - *_def = def; - - return true; -} - -static cell AMX_NATIVE_CALL amx_translate(AMX *amx, cell *params) -{ - int len; - char *key = get_amxstring(amx, params[1], 0, len); - - amxtrans_t trans; - - int suki = g_langMngr.GetKeyEntry(key); - //Some AMX Mod plugins do not register everything they need. Prevent a crash. - if (suki == -1) - { - suki = g_langMngr.AddKeyEntry(key); - } - - if (suki > BCOMPAT_TRANSLATE_KEYMASK) - { - LogError(amx, AMX_ERR_NATIVE, "Not enough translation space, aborting!"); - return 0; - } - - trans = suki & BCOMPAT_TRANSLATE_KEYMASK; - int dest = static_cast(params[2]); - int lang = static_cast(params[3]); - if (dest == -1) - { - trans |= (0x3F << BCOMPAT_TRANSLATE_DESTRSH); - } else { - trans |= (dest & BCOMPAT_TRANSLATE_DESTMASK) << BCOMPAT_TRANSLATE_DESTRSH; - } - - if (lang == -1) - { - trans |= (0x1F << BCOMPAT_TRANSLATE_LANGRSH); - } else { - trans |= (lang & BCOMPAT_TRANSLATE_LANGMASK) << BCOMPAT_TRANSLATE_LANGRSH; - } - - trans |= BCOMPAT_TRANSLATE_BITS; - - return static_cast(trans); -} - -AMX_NATIVE_INFO g_BcompatNatives[] = -{ - {"translate", amx_translate}, - - {NULL, NULL}, -}; - diff --git a/amxmodx/amxmod_compat.h b/amxmodx/amxmod_compat.h deleted file mode 100644 index 6a560331..00000000 --- a/amxmodx/amxmod_compat.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _INCLUDE_AMXMOD_CORE_COMPAT_H -#define _INCLUDE_AMXMOD_CORE_COMPAT_H - -/** - * New format for translation: - * Note that we only support: - * 4k keys - * 32 languages - * 0000 0000 0000 0000 0000 0000 0000 0000 - * | key id | - * | | <- dest id - * | | <- lang id - */ - -#define BCOMPAT_TRANSLATE_BITS 0xFF000000 -#define BCOMPAT_TRANSLATE_KEYMASK 0xFFF -#define BCOMPAT_TRANSLATE_DESTMASK 0x3F -#define BCOMPAT_TRANSLATE_DESTRSH 12 -#define BCOMPAT_TRANSLATE_LANGMASK 0x1F -#define BCOMPAT_TRANSLATE_LANGRSH 18 - -typedef unsigned int amxtrans_t; - -bool GetTranslation(amxtrans_t trans, int &key, int &dest, int &lang); - -extern AMX_NATIVE_INFO g_BcompatNatives[]; - -#endif //_INCLUDE_AMXMOD_CORE_COMPAT_H diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index d491be17..94c0b00c 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -1859,18 +1859,6 @@ static cell AMX_NATIVE_CALL server_cmd(AMX *amx, cell *params) /* 1 param */ g_langMngr.SetDefLang(LANG_SERVER); char* cmd = format_amxstring(amx, params, 1, len); - if (amx->flags & AMX_FLAG_OLDFILE) - { - if (strncmp("meta ",cmd,5)==0) - { - return len+1; - } - if (strncmp("quit", cmd,4)==0) - { - return len+1; - } - } - cmd[len++] = '\n'; cmd[len] = 0; @@ -1929,19 +1917,6 @@ static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params) /* 3 param * int ilen; char* sptemp = get_amxstring(amx, params[1], 0, ilen); - if (amx->flags & AMX_FLAG_OLDFILE) - { - /* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */ - char *cvar = sptemp; - for (unsigned int i=0; i<5; i++) - { - if (strcmp(cvar, invis_cvar_list[i]) == 0) - { - return 0; - } - } - } - const char *value = CVAR_GET_STRING(sptemp); return set_amxstring_utf8(amx, params[2], value, strlen(value), params[3] + 1); // + EOS } @@ -1964,19 +1939,6 @@ static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */ { int ilen; - if (amx->flags & AMX_FLAG_OLDFILE) - { - /* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */ - char *cvar = get_amxstring(amx, params[1], 0, ilen); - for (unsigned int i=0; i<5; i++) - { - if (strcmp(cvar, invis_cvar_list[i]) == 0) - { - return 0; - } - } - } - REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx, params[1], 0, ilen)); return amx_ftoc(pFloat); @@ -2019,18 +1981,6 @@ static cell AMX_NATIVE_CALL get_pcvar_num(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_cvar_num(AMX *amx, cell *params) /* 1 param */ { int ilen; - if (amx->flags & AMX_FLAG_OLDFILE) - { - /* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */ - char *cvar = get_amxstring(amx, params[1], 0, ilen); - for (unsigned int i=0; i<5; i++) - { - if (strcmp(cvar, invis_cvar_list[i]) == 0) - { - return 0; - } - } - } return (int)CVAR_GET_FLOAT(get_amxstring(amx, params[1], 0, ilen)); } @@ -2627,18 +2577,6 @@ static cell AMX_NATIVE_CALL task_exists(AMX *amx, cell *params) /* 1 param */ static cell AMX_NATIVE_CALL cvar_exists(AMX *amx, cell *params) /* 1 param */ { int ilen; - if (amx->flags & AMX_FLAG_OLDFILE) - { - /* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */ - char *cvar = get_amxstring(amx, params[1], 0, ilen); - for (unsigned int i=0; i<5; i++) - { - if (strcmp(cvar, invis_cvar_list[i]) == 0) - { - return 0; - } - } - } return (CVAR_GET_POINTER(get_amxstring(amx, params[1], 0, ilen)) ? 1 : 0); } @@ -3176,19 +3114,6 @@ static cell AMX_NATIVE_CALL get_cvar_flags(AMX *amx, cell *params) int ilen; char* sCvar = get_amxstring(amx, params[1], 0, ilen); - if (amx->flags & AMX_FLAG_OLDFILE) - { - /* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */ - char *cvar = sCvar; - for (unsigned int i=0; i<5; i++) - { - if (strcmp(cvar, invis_cvar_list[i]) == 0) - { - return 0; - } - } - } - cvar_t* pCvar = CVAR_GET_POINTER(sCvar); return pCvar ? pCvar->flags : 0; diff --git a/amxmodx/format.cpp b/amxmodx/format.cpp index 1ec60e2a..a7966387 100644 --- a/amxmodx/format.cpp +++ b/amxmodx/format.cpp @@ -1,7 +1,6 @@ #include "amxmodx.h" #include "format.h" #include "datastructs.h" -#include "amxmod_compat.h" //Adapted from Quake3's vsprintf // thanks to cybermind for linking me to this :) @@ -634,24 +633,6 @@ reswitch: } case 's': CHECK_ARGS(0); - if (amx->flags & AMX_FLAG_OLDFILE) - { - cell *addr = get_amxaddr(amx, params[arg]); - if (*addr & BCOMPAT_TRANSLATE_BITS) - { - const char *key, *def; - if (!translate_bcompat(amx, addr, &key, &def)) - { - goto break_to_normal_string; - } - arg++; - size_t written = atcprintf(buf_p, llen, def, amx, params, &arg); - buf_p += written; - llen -= written; - break; - } - } -break_to_normal_string: AddString(&buf_p, llen, get_amxaddr(amx, params[arg]), width, prec); arg++; break; diff --git a/amxmodx/format.h b/amxmodx/format.h index a9c6f630..3b4260ac 100644 --- a/amxmodx/format.h +++ b/amxmodx/format.h @@ -6,6 +6,5 @@ template size_t atcprintf(D *buffer, size_t maxlen, const S *format, AMX *amx, cell *params, int *param); const char *translate(AMX *amx, cell amxaddr, const char *key); -bool translate_bcompat(AMX *amx, cell *source, const char **_key, const char **_def); #endif //_INCLUDE_FORMATTING_H diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 67172920..f8793e0c 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -46,7 +46,6 @@ #include "optimizer.h" #include "libraries.h" #include "messages.h" -#include "amxmod_compat.h" #include "datastructs.h" #include "CFlagManager.h" diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index c220c012..627fafe8 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -51,7 +51,6 @@ #include "binlog.h" #include "libraries.h" #include "messages.h" -#include "amxmod_compat.h" #include "trie_natives.h" #include "CDataPack.h" @@ -171,7 +170,6 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64 *error = 0; size_t bufSize; *program = (void *)g_plugins.ReadIntoOrFromCache(filename, bufSize); - bool oldfile = false; if (!*program) { CAmxxReader reader(filename, PAWN_CELL_SIZE / 8); @@ -225,8 +223,6 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64 strcpy(error, "Unknown error"); return (amx->error = AMX_ERR_NOTFOUND); } - - oldfile = reader.IsOldFile(); } else { g_plugins.InvalidateFileInCache(filename, false); } @@ -381,17 +377,6 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64 } #endif - if (oldfile) - { - amx->flags |= AMX_FLAG_OLDFILE; - } else { - cell addr; - if (amx_FindPubVar(amx, "__b_old_plugin", &addr) == AMX_ERR_NONE) - { - amx->flags |= AMX_FLAG_OLDFILE; - } - } - CScript* aa = new CScript(amx, *program, filename); g_loadedscripts.put(aa); @@ -568,8 +553,7 @@ int set_amxnatives(AMX* amx, char error[128]) for (size_t i = 0; i < cm->m_NewNatives.size(); i++) { - if (!(amx->flags & AMX_FLAG_OLDFILE)) - amx_Register(amx, cm->m_NewNatives[i], -1); + amx_Register(amx, cm->m_NewNatives[i], -1); } } @@ -590,11 +574,6 @@ int set_amxnatives(AMX* amx, char error[128]) amx_Register(amx, trie_Natives, -1); amx_Register(amx, g_DatapackNatives, -1); - if (amx->flags & AMX_FLAG_OLDFILE) - { - amx_Register(amx, g_BcompatNatives, -1); - } - //we're not actually gonna check these here anymore amx->flags |= AMX_FLAG_PRENIT; diff --git a/amxmodx/msvc10/amxmodx_mm.vcxproj b/amxmodx/msvc10/amxmodx_mm.vcxproj index 5a2ac486..8fba2ec3 100644 --- a/amxmodx/msvc10/amxmodx_mm.vcxproj +++ b/amxmodx/msvc10/amxmodx_mm.vcxproj @@ -285,7 +285,6 @@ - @@ -350,7 +349,6 @@ - diff --git a/amxmodx/msvc10/amxmodx_mm.vcxproj.filters b/amxmodx/msvc10/amxmodx_mm.vcxproj.filters index 33d5c600..9f112d53 100644 --- a/amxmodx/msvc10/amxmodx_mm.vcxproj.filters +++ b/amxmodx/msvc10/amxmodx_mm.vcxproj.filters @@ -36,9 +36,6 @@ Source Files - - Source Files - Source Files @@ -185,9 +182,6 @@ Header Files - - Header Files - Header Files diff --git a/amxmodx/string.cpp b/amxmodx/string.cpp index 7d911099..bad81212 100755 --- a/amxmodx/string.cpp +++ b/amxmodx/string.cpp @@ -33,7 +33,6 @@ #include "amxmodx.h" #include "format.h" #include "binlog.h" -#include "amxmod_compat.h" const char* stristr(const char* str, const char* substr) { @@ -147,21 +146,8 @@ extern "C" size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, in register char *dest = destination; char *start = dest; - if ( (amx->flags & AMX_FLAG_OLDFILE) && - (*source & BCOMPAT_TRANSLATE_BITS) ) - { - const char *def, *key; - if (!translate_bcompat(amx, source, &key, &def)) - { - goto normal_string; - } - while (maxlen-- && *def) - *dest++=(*source++); - } else { -normal_string: - while (maxlen-- && *source) - *dest++=(char)(*source++); - } + while (maxlen-- && *source) + *dest++=(char)(*source++); *dest = '\0'; @@ -536,40 +522,16 @@ static cell AMX_NATIVE_CALL copy(AMX *amx, cell *params) /* 4 param */ cell *src = get_amxaddr(amx, params[3]); int c = params[2]; - if (amx->flags & AMX_FLAG_OLDFILE) + cell *dest = get_amxaddr(amx, params[1]); + cell *start = dest; + + while (c-- && *src) { - if (*src & BCOMPAT_TRANSLATE_BITS) - { - const char *key, *def; - if (!translate_bcompat(amx, src, &key, &def)) - { - goto normal_string; - } - cell *dest = get_amxaddr(amx, params[1]); - cell *start = dest; - while (c-- && *def) - { - *dest++ = static_cast(*def++); - } - *dest = '\0'; - - return dest-start; - } else { - goto normal_string; - } - } else { -normal_string: - cell *dest = get_amxaddr(amx, params[1]); - cell *start = dest; - - while (c-- && *src) - { - *dest++ = *src++; - } - *dest = '\0'; - - return (dest - start); + *dest++ = *src++; } + *dest = '\0'; + + return (dest - start); } static cell AMX_NATIVE_CALL copyc(AMX *amx, cell *params) /* 4 param */ @@ -688,23 +650,7 @@ static cell AMX_NATIVE_CALL format(AMX *amx, cell *params) /* 3 param */ int param = 4; size_t total = 0; - if (amx->flags & AMX_FLAG_OLDFILE) - { - if (*fmt & BCOMPAT_TRANSLATE_BITS) - { - const char *key, *def; - if (!translate_bcompat(amx, fmt, &key, &def)) - { - goto normal_string; - } - total = atcprintf(buf, maxlen, def, amx, params, ¶m); - } else { - goto normal_string; - } - } else { -normal_string: - total = atcprintf(buf, maxlen, fmt, amx, params, ¶m); - } + total = atcprintf(buf, maxlen, fmt, amx, params, ¶m); if (copy) { diff --git a/dlls/engine/AMBuilder b/dlls/engine/AMBuilder index a49bdc64..10468670 100644 --- a/dlls/engine/AMBuilder +++ b/dlls/engine/AMBuilder @@ -10,7 +10,6 @@ binary.sources = [ 'entity.cpp', 'globals.cpp', 'forwards.cpp', - 'amxmod_compat.cpp', ] AMXX.modules += [builder.Add(binary)] diff --git a/dlls/engine/Makefile b/dlls/engine/Makefile index ff0bbd2a..bbbbc64c 100755 --- a/dlls/engine/Makefile +++ b/dlls/engine/Makefile @@ -14,8 +14,7 @@ MM_ROOT = ../../../metamod/metamod PROJECT = engine -OBJECTS = sdk/amxxmodule.cpp amxxapi.cpp engine.cpp entity.cpp globals.cpp forwards.cpp \ - amxmod_compat.cpp +OBJECTS = sdk/amxxmodule.cpp amxxapi.cpp engine.cpp entity.cpp globals.cpp forwards.cpp ############################################## ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### diff --git a/dlls/engine/amxmod_compat.cpp b/dlls/engine/amxmod_compat.cpp deleted file mode 100644 index e1d341a6..00000000 --- a/dlls/engine/amxmod_compat.cpp +++ /dev/null @@ -1,453 +0,0 @@ -#include "engine.h" -#include - -static cvar_t *sv_knockback1 = NULL; -static cvar_t *sv_knockback2 = NULL; -static cvar_t *sv_friendlyfire = NULL; -static bool g_ff_check = false; -static bool g_kb1_check = false; -static bool g_kb2_check = false; -static int gmsgDamage = 0; -static int gmsgDeathMsg = 0; -static int gmsgScoreInfo = 0; - -//From VexdUM (AMX Mod 2006.2) -//This is not exposed, and is only provided as a compatibility helper. -BOOL is_breakable(edict_t* pBreak) -{ - if (FStrEq("func_breakable", STRING(pBreak->v.classname)) - || (FStrEq("func_pushable", STRING(pBreak->v.classname)) - && pBreak->v.spawnflags & SF_PUSH_BREAKABLE)) - { - return true; - } - - return false; -} - -//From VexdUM (AMX Mod 2006.2) -//This is not exposed, and is only provided as a compatibility helper. -BOOL is_monster(edict_t* pMonster) -{ - if(pMonster->v.flags & FL_MONSTER) - { - return true; - } - - return false; -} - -//From VexdUM (AMX Mod 2006.2) -// Damage Monsters -void hurt_monster(edict_t* pMonster, float dmg, int bit, const float *origin) -{ - int mdmg = (int)pMonster->v.health; - pMonster->v.health -= dmg; - - // No need to create a trigger_hurt unless we are going to kill the monster ;) - if((int)pMonster->v.health < 1) - { - int hurt = MAKE_STRING("trigger_hurt"); - char hbit[16]; - char horigin[16]; - snprintf(hbit, 15, "%i", bit); - snprintf(horigin, 15, "%f %f %f", origin[0], origin[1], origin[2]); - - edict_t* pEntity = CREATE_NAMED_ENTITY(hurt); - KeyValueData pkvd1; - pkvd1.szClassName = "trigger_hurt"; - pkvd1.szKeyName = "dmg"; - pkvd1.szValue = "1.0"; - pkvd1.fHandled = FALSE; - MDLL_KeyValue(pEntity, &pkvd1); - - KeyValueData pkvd2; - pkvd2.szClassName = "trigger_hurt"; - pkvd2.szKeyName = "damagetype"; - pkvd2.szValue = hbit; - pkvd2.fHandled = FALSE; - MDLL_KeyValue(pEntity, &pkvd2); - - KeyValueData pkvd3; - pkvd3.szClassName = "trigger_hurt"; - pkvd3.szKeyName = "origin"; - pkvd3.szValue = horigin; - pkvd3.fHandled = FALSE; - MDLL_KeyValue(pEntity, &pkvd3); - - MDLL_Spawn(pEntity); - MDLL_Touch(pEntity, pMonster); - REMOVE_ENTITY(pEntity); - } - mdmg -= (int)pMonster->v.health; - //~dvander - Note, not porting the forward until this function is known to be truly wrapped - //g_forwards.executeForward(FF_MonsterHurt, ENTINDEX(pMonster), ENTINDEX(pMonster->v.dmg_inflictor), mdmg); -} - -//From VexdUM (AMX Mod 2006.2) -//This appears to be from the HLSDK CBasePlayer::TakeDamage() function. -//This is not exposed, and is only provided as a compatibility helper. -float ArmorDamage(edict_t* pVictim, float dmg, int bit) -{ - float flRatio = 0.2; - float flBonus = 0.5; - if(bit & DMG_BLAST) - { - // blasts damage armor more. - flBonus *= 2; - } - if(pVictim->v.armorvalue && !(bit & (DMG_FALL | DMG_DROWN))) - { - // armor doesn't protect against fall or drown damage! - float flNew = dmg * flRatio; - float flArmor = (dmg - flNew) * flBonus; - - // Does this use more armor than we have? - if(flArmor > pVictim->v.armorvalue) - { - flArmor = pVictim->v.armorvalue; - flArmor *= (1/flBonus); - flNew = dmg - flArmor; - pVictim->v.armorvalue = 0; - } else { - pVictim->v.armorvalue -= flArmor; - } - dmg = flNew; - } - // Lets knock the view about abit - pVictim->v.punchangle.x = -4; - return dmg; -} - -// Death emulation -//This is not exposed, and is only provided as a compatibility helper. -void Death(edict_t* pVictim, edict_t* pKiller, const char* weapon, int hs) -{ - - if (!gmsgDeathMsg) - { - gmsgDeathMsg = GET_USER_MSG_ID(PLID, "DeathMsg", NULL); - } - - if (!gmsgScoreInfo) - { - gmsgScoreInfo = GET_USER_MSG_ID(PLID, "ScoreInfo", NULL); - } - - // Make sure an entity is allowed to take damage - if(pVictim->v.takedamage > DAMAGE_NO) - { - // Breakable Check - if(is_breakable(pVictim)) - { - MDLL_Use(pVictim, pKiller); - } - // Monster Check - if (is_monster(pVictim)) - { - pVictim->v.dmg_inflictor = pKiller; - float dmg = pVictim->v.health; - int bit = DMG_BULLET; - const float *origin = pVictim->v.origin; - hurt_monster(pVictim, dmg, bit, origin); - } - // Player Check - if (pVictim->v.flags & (FL_CLIENT | FL_FAKECLIENT)) - { - pVictim->v.dmg_inflictor = pKiller; - edict_t* inflictor = pKiller->v.owner; - int inflictorId = FNullEnt(inflictor) ? ENTINDEX(inflictor) : 0; - - // See if it is a player attacking with a default weapon - if (pKiller->v.flags & (FL_CLIENT | FL_FAKECLIENT)) - { - // We only modify the weapon if it = 0, otherwise its been specified - if(strcmp(weapon, "") == 0) - { - char view_weapon[64]; - // Get the name from the view model - weapon = STRING(pKiller->v.viewmodel); - - // Strip out the beginning of the viewmodel (models/v_) - if(strncmp(weapon, "models/v_", 9) == 0) - { - strcpy(view_weapon, weapon + 9); - } - - // Strip out the end of viewmodel (.mdl) - view_weapon[strlen(view_weapon) - 4] = '\0'; - weapon = view_weapon; - } - // See if its an entity attacking, if so lets find its owner - } else if (inflictorId >= 1 && inflictorId <= gpGlobals->maxClients) { - // We only modify the weapon if it = 0, otherwise its been specified - if(strcmp(weapon, "") == 0) - { - weapon = STRING(pKiller->v.classname); - // Strip out the default part of weapon name (HLSDK) - if(strncmp(weapon, "weapon_", 7) == 0) - { - weapon += 7; - } else if(strncmp(weapon, "monster_", 8) == 0) { - weapon += 8; - } else if(strncmp(weapon, "func_", 5) == 0) { - weapon += 5; - } - } - // Check to see if the victim is the owner - if(inflictor == pVictim) - { - pKiller = pVictim; - } else { - pKiller = inflictor; - } - } - // Send the Death Event - int killerId = ENTINDEX(pKiller); - int victimId = ENTINDEX(pVictim); - MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg ); - WRITE_BYTE( killerId > gpGlobals->maxClients ? 0 : killerId ); - WRITE_BYTE( victimId ); - WRITE_BYTE( hs ); - WRITE_STRING( weapon ); - MESSAGE_END(); - // Log this kill - if(pVictim == pKiller) - { - // killed self - UTIL_LogPrintf("\"%s<%i><%s><%s>\" killed self with \"%s\"\n", - STRING( pVictim->v.netname ), - GETPLAYERUSERID( pVictim ), - GETPLAYERAUTHID( pVictim ), - MF_GetPlayerTeam(victimId), - weapon ); - // Killed by another player - } else if(pKiller->v.flags & (FL_CLIENT | FL_FAKECLIENT)) { - UTIL_LogPrintf("\"%s<%i><%s><%s>\" killed \"%s<%i><%s><%s>\" with \"%s\"\n", - STRING( pKiller->v.netname ), - GETPLAYERUSERID( pKiller ), - GETPLAYERAUTHID( pKiller ), - MF_GetPlayerTeam(killerId), - STRING( pVictim->v.netname ), - GETPLAYERUSERID( pVictim ), - GETPLAYERAUTHID( pVictim ), - MF_GetPlayerTeam(victimId), - weapon); - - int killerTeam = MF_GetPlayerTeamID(killerId); - int victimTeam = MF_GetPlayerTeamID(victimId); - if (killerTeam != victimTeam) - { - // Give Killer credit for this kill - pKiller->v.frags += 1; - } else { - pKiller->v.frags -= 1; - } - // Update the scoreboard for the killer - if (gmsgScoreInfo) - { - MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo); - WRITE_BYTE( killerId ); - WRITE_SHORT( (int)pKiller->v.frags ); - WRITE_SHORT( MF_GetPlayerDeaths(killerId) ); - WRITE_SHORT( 0 ); - WRITE_SHORT( MF_GetPlayerTeamID(killerId) ); - MESSAGE_END(); - } - // Give Victim back 1 point since they didn't kill themselves - pVictim->v.frags += 1; - } - // Killed by something else? - else { - UTIL_LogPrintf( "\"%s<%i><%s><%s>\" killed by \"%s\"\n", - STRING( pVictim->v.netname ), - GETPLAYERUSERID( pVictim ), - GETPLAYERAUTHID( pVictim ), - MF_GetPlayerTeam(victimId), - weapon ); - // Give Victim back 1 point since they didn't commit suicide - pVictim->v.frags += 1; - } -#if 0 - //still a todo on this one - gInfo.logBlock = true; -#endif - int opt = BLOCK_ONCE; - MF_MessageBlock(MSGBLOCK_SET, gmsgDeathMsg, &opt); - // Kill the client, since the relevent logging blocks are in place - MDLL_ClientKill(pVictim); - // Restore the old message type - MF_MessageBlock(MSGBLOCK_SET, gmsgDeathMsg, &opt); - // Show the Victim the killing location - pVictim->v.iuser3 = (killerId > gpGlobals->maxClients) ? 0 : killerId; - } - } -} - -// Damage emulation -// From VexdUM (AMX Mod 2006.2) -//This is not exposed, and is only provided as a compatibility helper. -void Damage(edict_t *pVictim, - edict_t *pAttacker, - const float *origin, - float dmg, - int bit, - const char *weapon, - int hs) -{ - if (!g_ff_check && !sv_friendlyfire) - { - sv_friendlyfire = CVAR_GET_POINTER("sv_friendlyfire"); - g_ff_check = true; - } - - if (!gmsgDamage) - { - gmsgDamage = GET_USER_MSG_ID(PLID, "Damage", NULL); - } - - // Make sure an entity is allowed to take damage - if(pVictim->v.takedamage > DAMAGE_NO) - { - // Breakable Check - if(is_breakable(pVictim) && (int)dmg > 0) - { - MDLL_Use(pVictim, pAttacker); - } - // Monster Check - if(is_monster(pVictim) && (int)dmg > 0) - { - pVictim->v.dmg_inflictor = pAttacker; - hurt_monster(pVictim, dmg, bit, origin); - } - // Player Check - if(pVictim->v.flags & (FL_CLIENT | FL_FAKECLIENT)) - { - int AttackerId = ENTINDEX(pAttacker); - int AttackerOwnerId = ENTINDEX(pAttacker->v.owner); - int VictimId = ENTINDEX(pVictim); - int vTeam = MF_GetPlayerTeamID(VictimId); - int aTeam = 0; - if (AttackerId >= 1 && AttackerId <= gpGlobals->maxClients) - { - aTeam = MF_GetPlayerTeamID(AttackerId); - } else if (AttackerOwnerId >= 1 && AttackerOwnerId <= gpGlobals->maxClients) { - aTeam = MF_GetPlayerTeamID(AttackerOwnerId); - } - if((sv_friendlyfire && (int)sv_friendlyfire->value) || (vTeam != aTeam)) - { - // Recalculate the damage since we might have armor - dmg = ArmorDamage(pVictim, dmg, bit); - // Only allow damage to process if more than 0.5 - if((int)dmg > 0) - { - // Setting to externally flag who last attacked the Victim, pretty neat huh? - pVictim->v.dmg_inflictor = pAttacker; - pVictim->v.dmg_take += dmg; - // Register the Damage Event - MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pVictim ); - WRITE_BYTE( (int)pVictim->v.dmg_save ); - WRITE_BYTE( (int)pVictim->v.dmg_take ); - WRITE_LONG( bit ); - WRITE_COORD( origin[0] ); - WRITE_COORD( origin[1] ); - WRITE_COORD( origin[2] ); - MESSAGE_END(); - - if((int)dmg >= (int)pVictim->v.health) - { - // Kill the victim - pVictim->v.health = 0.0; - // Send info to Death system - Death(pVictim, pAttacker, weapon, hs); - }else { - // Take health away from victim - pVictim->v.health -= dmg; - } - } - } - } - } -} - -// Radius Damage emulation - -// From VexdUM (AMX Mod 2006.2) -//This is not exposed, and is only provided as a compatibility helper. -void RadiusDamage_AMXMod_Base(edict_t *pAttacker, - float dmg, - Vector vecSrc, - float rad, - int bit, - const char *weapon, - int hs) -{ - edict_t *pTarget = NULL; - TraceResult tr; - float falloff; - Vector vecSpot; - Vector vecSee; - - if (!g_kb1_check && !sv_knockback1) - { - sv_knockback1 = CVAR_GET_POINTER("sv_knockback1"); - g_kb1_check = true; - } - if (!g_kb2_check && !sv_knockback2) - { - sv_knockback2 = CVAR_GET_POINTER("sv_knockback2"); - g_kb2_check = true; - } - - if(rad > 0.0) - { - falloff = dmg / rad; - } else { - falloff = 1.0; - } - vecSrc.z += 1; // In case grenade is lying on the ground - - int hitId; - int targetId; - - while ((pTarget = UTIL_FindEntityInSphere(pTarget, vecSrc, rad)) != NULL) - { - // Make sure an entity is allowed to take damage - if (pTarget->v.takedamage > DAMAGE_NO) - { - //none of this code was working so I simplified it - //damage doesn't check for visibility now (it probably shouldn't anyway) - //for this to work it seems like an exception needs to be made for world OR - // the spot/see things aren't being calculated right. -#if 0 - vecSpot = (pTarget->v.absmin + pTarget->v.absmax) * 0.5; - vecSee = (pAttacker->v.absmin + pAttacker->v.absmax) * 0.5; - TRACE_LINE(vecSee, vecSpot, FALSE, pAttacker, &tr); - // Explosion can 'see' this entity, so hurt them! -#endif - TRACE_LINE(vecSrc, pTarget->v.origin, FALSE, pAttacker, &tr); - hitId = ENTINDEX(tr.pHit); - targetId = ENTINDEX(pTarget); - if(tr.flFraction < 1.0 || (hitId == targetId)) - { - // Work out the distance between impact and entity - float dist = (tr.vecEndPos - vecSrc).Length() * falloff; - // Damage algorithm, its just that easy :) - dmg -= dist; - // Knockback Effect - if(pTarget->v.flags & (FL_CLIENT | FL_FAKECLIENT) && (bit & (DMG_BLAST | DMG_CLUB | DMG_SHOCK | DMG_SONIC | DMG_ENERGYBEAM | DMG_MORTAR))) - { - Vector vecPush = (pTarget->v.origin - (pAttacker->v.absmin + pAttacker->v.absmax) * 0.5).Normalize(); - if(dmg < 60.0) - { - pTarget->v.velocity = pTarget->v.velocity + vecPush * dmg * (sv_knockback1 ? sv_knockback1->value : 1.0f); - } else { - pTarget->v.velocity = pTarget->v.velocity + vecPush * dmg * (sv_knockback2 ? sv_knockback2->value : 1.0f); - } - } - // Send info to Damage system - Damage(pTarget, pAttacker, vecSrc, dmg, bit, weapon, hs); - } - } - } - pTarget = NULL; -} diff --git a/dlls/engine/amxmod_compat.h b/dlls/engine/amxmod_compat.h deleted file mode 100644 index 5ae98424..00000000 --- a/dlls/engine/amxmod_compat.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _INCLUDE_ENGINE_AMXMOD_BCOMPAT_H_ -#define _INCLUDE_ENGINE_AMXMOD_BCOMPAT_H_ - -BOOL is_breakable(edict_t* pBreak); -BOOL is_monster(edict_t* pMonster); -void hurt_monster(edict_t* pMonster, float dmg, int bit, const float *origin); -float ArmorDamage(edict_t* pVictim, float dmg, int bit); -void Death(edict_t* pVictim, edict_t* pKiller, const char* weapon, int hs); -void Damage(edict_t *pVictim, - edict_t *pAttacker, - const float *origin, - float dmg, - int bit, - const char *weapon, - int hs); -void RadiusDamage_AMXMod_Base(edict_t *pAttacker, - float dmg, - Vector vecSrc, - float rad, - int bit, - const char *weapon, - int hs); - -#endif //_INCLUDE_ENGINE_AMXMOD_BCOMPAT_H_ - diff --git a/dlls/engine/engine.cpp b/dlls/engine/engine.cpp index 14ce6a48..18263d77 100755 --- a/dlls/engine/engine.cpp +++ b/dlls/engine/engine.cpp @@ -1,5 +1,4 @@ #include "engine.h" -#include "amxmod_compat.h" struct usercmd_s *g_cmd; struct PlayerInfo plinfo[33]; diff --git a/dlls/engine/msvc10/engine.vcxproj b/dlls/engine/msvc10/engine.vcxproj index 07d96890..8c66e015 100644 --- a/dlls/engine/msvc10/engine.vcxproj +++ b/dlls/engine/msvc10/engine.vcxproj @@ -94,7 +94,6 @@ - @@ -103,7 +102,6 @@ - diff --git a/dlls/engine/msvc10/engine.vcxproj.filters b/dlls/engine/msvc10/engine.vcxproj.filters index 98c48e5f..74ca7ed1 100644 --- a/dlls/engine/msvc10/engine.vcxproj.filters +++ b/dlls/engine/msvc10/engine.vcxproj.filters @@ -23,9 +23,6 @@ - - Source Files - Source Files @@ -46,9 +43,6 @@ - - Header Files - Header Files diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc index 8e7ce17c..16c66bac 100755 --- a/plugins/include/amxconst.inc +++ b/plugins/include/amxconst.inc @@ -262,7 +262,7 @@ enum { #define AMX_FLAG_COMPACT 0x04 /* compact encoding */ #define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */ #define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */ -#define AMX_FLAG_OLDFILE 0x20 /* Old AMX Mod plugin */ +/* AMX_FLAG_OLDFILE 0x20 Old AMX Mod plugin */ #define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */ #define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */ #define AMX_FLAG_BROWSE 0x4000 /* busy browsing */ From 9b1f4e01c774c1347cca94e635fb194627a55bfa Mon Sep 17 00:00:00 2001 From: xPaw Date: Thu, 5 Jun 2014 23:20:06 +0300 Subject: [PATCH 2/5] :fire: Remove backwards compatible RadiusDamage --- dlls/engine/engine.cpp | 48 ++++-------------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/dlls/engine/engine.cpp b/dlls/engine/engine.cpp index 18263d77..24e38bea 100755 --- a/dlls/engine/engine.cpp +++ b/dlls/engine/engine.cpp @@ -97,32 +97,10 @@ static cell AMX_NATIVE_CALL halflife_time(AMX *amx, cell *params) return amx_ftoc(fVal); } -//This is not exposed, and is only provided as a compatibility helper. -static cell AMX_NATIVE_CALL RadiusDamage_AMXMod(AMX *amx, cell *params) -{ - int ent = params[1]; - CHECK_ENTITY_SIMPLE(ent); - edict_t* pEntity = INDEXENT(ent); - float dmg = amx_ctof(params[2]); - cell *vInput = MF_GetAmxAddr(amx, params[3]); - float vOrig[3]; - - vOrig[0] = amx_ctof(vInput[0]); - vOrig[1] = amx_ctof(vInput[1]); - vOrig[2] = amx_ctof(vInput[2]); - - float rad = amx_ctof(params[4]); - int bit = params[5]; - int iLen; - char *vxWeapon = MF_GetAmxString(amx, params[6], 0, &iLen); - int hs = params[7]; - - RadiusDamage_AMXMod_Base(pEntity, dmg, vOrig, rad, bit, vxWeapon, hs); - - return 1; -} - -static cell AMX_NATIVE_CALL RadiusDamage_AMXModX(AMX *amx, cell *params) +// RadiusDamage. Damages players within a certain radius. ToDo: add the +// damage messaging so players know where the damage is coming from +// (the red arrow-like things on the screen). +static cell AMX_NATIVE_CALL RadiusDamage(AMX *amx, cell *params) { cell *cAddr = MF_GetAmxAddr(amx,params[1]); @@ -200,24 +178,6 @@ static cell AMX_NATIVE_CALL RadiusDamage_AMXModX(AMX *amx, cell *params) return 1; } -// RadiusDamage. Damages players within a certain radius. ToDo: add the -// damage messaging so players know where the damage is coming from -// (the red arrow-like things on the screen). -//(vexd) -static cell AMX_NATIVE_CALL RadiusDamage(AMX *amx, cell *params) -{ - cell numParams = params[0] / sizeof(cell); - - if (numParams == 3) - { - return RadiusDamage_AMXModX(amx, params); - } else if (numParams == 7) { - return RadiusDamage_AMXMod(amx, params); - } - - return 0; -} - static cell AMX_NATIVE_CALL PointContents(AMX *amx, cell *params) { cell *cAddr = MF_GetAmxAddr(amx, params[1]); From 2e6dc308a8659cfe977a38cb91107f4558977152 Mon Sep 17 00:00:00 2001 From: xPaw Date: Thu, 5 Jun 2014 23:33:45 +0300 Subject: [PATCH 3/5] :fire: Remove backwards compatible CreateMultiForwardEx --- amxmodx/CForward.cpp | 17 +++++------------ amxmodx/CForward.h | 10 +++------- amxmodx/amxmodx.cpp | 16 ---------------- plugins/include/amxconst.inc | 4 ---- plugins/include/amxmodx.inc | 8 -------- 5 files changed, 8 insertions(+), 47 deletions(-) diff --git a/amxmodx/CForward.cpp b/amxmodx/CForward.cpp index aa0c4230..1adb6acb 100755 --- a/amxmodx/CForward.cpp +++ b/amxmodx/CForward.cpp @@ -33,7 +33,7 @@ #include "debugger.h" #include "binlog.h" -CForward::CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam *paramTypes, int fwd_type) +CForward::CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam *paramTypes) { m_FuncName = name; m_ExecType = et; @@ -47,13 +47,6 @@ CForward::CForward(const char *name, ForwardExecType et, int numParams, const Fo for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter) { - if ((fwd_type != FORWARD_ALL) && - ((fwd_type == FORWARD_ONLY_NEW && ((*iter).getAMX()->flags & AMX_FLAG_OLDFILE)) - || (fwd_type == FORWARD_ONLY_OLD && !((*iter).getAMX()->flags & AMX_FLAG_OLDFILE)) - )) - { - continue; - } if ((*iter).isValid() && amx_FindPublic((*iter).getAMX(), name, &func) == AMX_ERR_NONE) { AMXForward tmp; @@ -367,10 +360,10 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays) return retVal; } -int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam * paramTypes, int fwd_type) +int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam * paramTypes) { int retVal = m_Forwards.size() << 1; - CForward *tmp = new CForward(funcName, et, numParams, paramTypes, fwd_type); + CForward *tmp = new CForward(funcName, et, numParams, paramTypes); if (!tmp) { @@ -590,7 +583,7 @@ int CForwardMngr::isSameSPForward(int id1, int id2) && (fwd1->m_NumParams == fwd2->m_NumParams)); } -int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num, int fwd_type) +int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num) { ForwardParam params[FORWARD_MAX_PARAMS]; @@ -599,7 +592,7 @@ int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_ params[i] = static_cast(list[i]); } - return g_forwards.registerForward(funcName, et, num, params, fwd_type); + return g_forwards.registerForward(funcName, et, num, params); } int registerForward(const char *funcName, ForwardExecType et, ...) diff --git a/amxmodx/CForward.h b/amxmodx/CForward.h index d69a7201..02c36174 100755 --- a/amxmodx/CForward.h +++ b/amxmodx/CForward.h @@ -51,10 +51,6 @@ const int FORWARD_MAX_PARAMS = 32; -#define FORWARD_ONLY_OLD 1 -#define FORWARD_ONLY_NEW 2 -#define FORWARD_ALL 3 - enum ForwardExecType { ET_IGNORE = 0, // Ignore return vaue @@ -111,7 +107,7 @@ class CForward ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS]; public: - CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes, int fwd_type=FORWARD_ALL); + CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes); CForward() {} // leaves everything unitialized' cell execute(cell *params, ForwardPreparedArray *preparedArrays); @@ -209,7 +205,7 @@ public: // Interface // Register normal forward - int registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam *paramTypes, int fwd_type=FORWARD_ALL); + int registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam *paramTypes); // Register single plugin forward int registerSPForward(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes); int registerSPForward(int func, AMX *amx, int numParams, const ForwardParam * paramTypes); @@ -235,7 +231,7 @@ public: // (un)register forward int registerForward(const char *funcName, ForwardExecType et, ...); -int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num, int fwd_type=FORWARD_ALL); +int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num); int registerSPForwardByName(AMX *amx, const char *funcName, ...); int registerSPForwardByNameC(AMX *amx, const char *funcName, cell *list, size_t num); int registerSPForward(AMX *amx, int func, ...); diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 94c0b00c..09f1ada4 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -4325,21 +4325,6 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params) return registerForwardC(funcname, static_cast(params[2]), ps, count-2); } -static cell AMX_NATIVE_CALL CreateMultiForwardEx(AMX *amx, cell *params) -{ - int len; - char *funcname = get_amxstring(amx, params[1], 0, len); - - cell ps[FORWARD_MAX_PARAMS]; - cell count = params[0] / sizeof(cell); - for (cell i=4; i<=count; i++) - { - ps[i-4] = *get_amxaddr(amx, params[i]); - } - - return registerForwardC(funcname, static_cast(params[2]), ps, count-3, params[3]); -} - static cell AMX_NATIVE_CALL CreateOneForward(AMX *amx, cell *params) { CPluginMngr::CPlugin *p = g_plugins.findPlugin(params[1]); @@ -5023,7 +5008,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] = {"CreateHudSyncObj", CreateHudSyncObj}, {"CreateLangKey", CreateLangKey}, {"CreateMultiForward", CreateMultiForward}, - {"CreateMultiForwardEx", CreateMultiForwardEx}, {"CreateOneForward", CreateOneForward}, {"DestroyForward", DestroyForward}, {"ExecuteForward", ExecuteForward}, diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc index 16c66bac..284e4281 100755 --- a/plugins/include/amxconst.inc +++ b/plugins/include/amxconst.inc @@ -302,10 +302,6 @@ enum { #define FP_STRING 2 #define FP_ARRAY 4 -#define FORWARD_ONLY_OLD 1 -#define FORWARD_ONLY_NEW 2 -#define FORWARD_ALL 3 - #define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients #define SND_STOP (1<<5) // stop sound #define SND_CHANGE_VOL (1<<6) // change sound vol diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 729b4c4e..674b0c99 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -1086,14 +1086,6 @@ native set_addr_val(addr, val); */ native CreateMultiForward(const name[], stop_type, ...); -/** - * Creates a multi-forward plugin that can filter between old/new plugins. - * Old plugins are used by the AMX Mod backwards compatibility layer. - * Stop type must be one of the ET_ values in amxconst.inc - * Forward type must be one of the FORWARD_ values in amxconst.inc. - */ -native CreateMultiForwardEx(const name[], stop_type, forward_type, ...); - /** * Creates a forward for one plugin. * Results will be > 0 for success. From d7a74ebb94580f323bca9723daa86447ac213a1e Mon Sep 17 00:00:00 2001 From: xPaw Date: Sat, 19 Jul 2014 18:12:15 +0300 Subject: [PATCH 4/5] :fire: Remove amxmod compat hack from the compiler --- compiler/libpc300/sclist.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compiler/libpc300/sclist.c b/compiler/libpc300/sclist.c index cf1f7d09..0875fd26 100755 --- a/compiler/libpc300/sclist.c +++ b/compiler/libpc300/sclist.c @@ -236,15 +236,6 @@ static stringlist includepaths = {NULL, NULL}; /* directory list for include fi SC_FUNC stringlist *insert_path(char *path) { - char *extra_path = malloc(strlen(path) + 16); - strcpy(extra_path, path); -#if defined __linux__ || defined __APPLE__ - strcat(extra_path, "/amxmod_compat/"); -#elif defined WIN32 || defined _WIN32 - strcat(extra_path, "\\amxmod_compat\\"); -#endif - insert_string(&includepaths, extra_path); - free(extra_path); return insert_string(&includepaths,path); } From 1a633ec9259f8ae3a8f12f16f7d747a55e026345 Mon Sep 17 00:00:00 2001 From: xPaw Date: Sat, 19 Jul 2014 18:19:01 +0300 Subject: [PATCH 5/5] :fire: Remove old file check --- amxmodx/CPlugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp index c9ecfa66..8c15629a 100755 --- a/amxmodx/CPlugin.cpp +++ b/amxmodx/CPlugin.cpp @@ -466,8 +466,7 @@ char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize) pl->file = new CAmxxReader(file, sizeof(cell)); pl->buffer = NULL; - if (pl->file->GetStatus() != CAmxxReader::Err_None || - pl->file->IsOldFile()) + if (pl->file->GetStatus() != CAmxxReader::Err_None) { delete pl->file; delete pl;