mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
Work around for amb228 - amxmod_compat caused set_user_hitzones to stop functioning.
Any plugins being emulated by amxmod_compat that still use the traceline forward will still cause the issue, but if no plugins use that forward it won't interfere. (also, plugin_flags() can now specify a plid)
This commit is contained in:
parent
e045e2fdb6
commit
b09bf4c532
@ -3792,6 +3792,9 @@ static cell AMX_NATIVE_CALL register_dictionary(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL plugin_flags(AMX *amx, cell *params)
|
||||
{
|
||||
if ((params[0] / sizeof(cell)) == 1 || // compiled with old include file
|
||||
params[2] < 0) // specifically want calling plugin's flags
|
||||
{
|
||||
if (params[1])
|
||||
{
|
||||
@ -3802,6 +3805,24 @@ static cell AMX_NATIVE_CALL plugin_flags(AMX *amx, cell *params)
|
||||
|
||||
return amx->flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
CPluginMngr::CPlugin* a = g_plugins.findPlugin((int)params[2]);
|
||||
|
||||
if (a == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (params[1])
|
||||
{
|
||||
AMX_HEADER *hdr;
|
||||
hdr = (AMX_HEADER *)a->getAMX()->base;
|
||||
return hdr->flags;
|
||||
}
|
||||
|
||||
return a->getAMX()->flags;
|
||||
}
|
||||
}
|
||||
|
||||
// lang_exists(const name[]);
|
||||
static cell AMX_NATIVE_CALL lang_exists(AMX *amx, cell *params)
|
||||
|
@ -34,7 +34,6 @@ VexdUM_Register()
|
||||
register_forward(FM_EmitSound, "Hook_FM_EmitSound")
|
||||
register_forward(FM_EmitAmbientSound, "Hook_FM_EmitAmbientSound")
|
||||
register_forward(FM_SetModel, "Hook_FM_SetModel")
|
||||
register_forward(FM_TraceLine, "Hook_FM_TraceLine")
|
||||
register_forward(FM_SetClientKeyValue, "Hook_FM_SetClientKeyValue")
|
||||
register_forward(FM_KeyValue, "Hook_FM_KeyValue")
|
||||
register_forward(FM_Touch, "Hook_FM_Touch")
|
||||
@ -44,6 +43,20 @@ VexdUM_Register()
|
||||
register_forward(FM_PlayerPostThink, "Hook_FM_PlayerPostThink")
|
||||
register_forward(FM_ClientUserInfoChanged, "Hook_ClientUserInfoChanged")
|
||||
|
||||
// Only register the traceline forward if there actually is a plugin
|
||||
// that needs it. Otherwise this will mess with set_user_hitzones
|
||||
|
||||
new pluginnum = get_pluginsnum();
|
||||
for (new i = 0; i < pluginnum; i++)
|
||||
{
|
||||
if (plugin_flags(0, i) & AMX_FLAG_OLDFILE && // plugin is an AMX plugin being emulated
|
||||
get_func_id("traceline", i) != -1) // plugin needs traceline
|
||||
{
|
||||
register_forward(FM_TraceLine, "Hook_FM_TraceLine")
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
/* Global Forwards */
|
||||
g_FwdTouch = CreateMultiForwardEx("entity_touch", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_CELL)
|
||||
g_FwdThink = CreateMultiForwardEx("entity_think", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
|
@ -238,6 +238,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 */
|
||||
#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 */
|
||||
|
@ -716,15 +716,17 @@ native md5(const szString[], md5buffer[34]);
|
||||
/* Calculates the md5 keysum of a file */
|
||||
native md5_file(const file[], md5buffer[34]);
|
||||
|
||||
/* Returns the internal flags set on the called plugin's state
|
||||
/* Returns the internal flags set on the plugin's state
|
||||
* If hdr is 1, it will return the pcode flags rather than state flags.
|
||||
*
|
||||
* Use a plid of -1 to get the flags for the calling plugin.
|
||||
*/
|
||||
native plugin_flags(hdr=0);
|
||||
native plugin_flags(hdr=0, plid=-1);
|
||||
|
||||
/* When using modules that aren't part of AMX Mod X base package, do
|
||||
* a require_module("modulename") for each of them within the plugin_modules()
|
||||
* forward. Module name is the one listed when doing "amxx modules" in server
|
||||
* console. */
|
||||
/**
|
||||
* @deprecated
|
||||
* Do not use!
|
||||
*/
|
||||
forward plugin_modules();
|
||||
|
||||
native require_module(const module[]);
|
||||
|
Loading…
Reference in New Issue
Block a user