Move dlls/ to modules/

This commit is contained in:
xPaw
2015-03-13 15:18:47 +02:00
parent 54c978addb
commit e09f434ed8
365 changed files with 2233 additions and 2233 deletions

View File

@ -0,0 +1,27 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os.path
binary = AMXX.MetaModule(builder, 'fakemeta')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [
'../../public/sdk/amxxmodule.cpp',
'dllfunc.cpp',
'engfunc.cpp',
'fakemeta_amxx.cpp',
'pdata.cpp',
'forward.cpp',
'fm_tr.cpp',
'pev.cpp',
'glb.cpp',
'fm_tr2.cpp',
'misc.cpp',
]
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
AMXX.modules += [builder.Add(binary)]

126
modules/fakemeta/Makefile Normal file
View File

@ -0,0 +1,126 @@
# (C)2004-2013 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson
###########################################
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
###########################################
HLSDK = ../../../hlsdk
MM_ROOT = ../../../metamod/metamod
PUBLIC_ROOT = ../../public
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
#####################################
PROJECT = fakemeta
OBJECTS = amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \
fm_tr.cpp pev.cpp glb.cpp fm_tr2.cpp misc.cpp
##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
##############################################
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
C_GCC4_FLAGS = -fvisibility=hidden
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
CPP = gcc
CPP_OSX = clang
LINK =
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared \
-I$(MM_ROOT)
################################################
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
################################################
OS := $(shell uname -s)
ifeq "$(OS)" "Darwin"
CPP = $(CPP_OSX)
LIB_EXT = dylib
LIB_SUFFIX = _amxx
CFLAGS += -DOSX
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
else
LIB_EXT = so
LIB_SUFFIX = _amxx_i386
CFLAGS += -DLINUX
LINK += -shared
endif
LINK += -m32 -lm -ldl
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror \
-Wno-invalid-offsetof
CPPFLAGS += -fno-exceptions -fno-rtti
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS += $(C_DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS += $(C_OPT_FLAGS)
LINK += -s
endif
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
ifeq "$(IS_CLANG)" "1"
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
else
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
endif
# Clang || GCC >= 4
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
CFLAGS += $(C_GCC4_FLAGS)
CPPFLAGS += $(CPP_GCC4_FLAGS)
endif
# Clang >= 3 || GCC >= 4.7
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
CPPFLAGS += -Wno-delete-non-virtual-dtor
endif
# OS is Linux and not using clang
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
LINK += -static-libgcc
endif
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
# This will break if we include other Makefiles, but is fine for now. It allows
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
# or other changes without mucking up the original.
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
$(PROJECT): $(OBJ_BIN)
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
debug:
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
default: all
clean:
rm -rf $(BIN_DIR)/*.o
rm -f $(BIN_DIR)/$(BINARY)

View File

@ -0,0 +1,385 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
//by mahnsawce from his NS module
static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
{
int type;
int index;
int indexb;
unsigned char *pset;
const char *temp = "";
const char *temp2 = "";
const char *temp3 = "";
vec3_t Vec1;
vec3_t Vec2;
int iparam1;
int iparam2;
int iparam3;
entity_state_t *es;
int len;
cell *cRet;
type = params[1];
switch(type)
{
// pfnGameInit
case DLLFunc_GameInit: // void) ( void );
gpGamedllFuncs->dllapi_table->pfnGameInit();
return 1;
// pfnSpawn
case DLLFunc_Spawn: // int ) ( edict_t *pent );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
return gpGamedllFuncs->dllapi_table->pfnSpawn(INDEXENT2(index));
// pfnThink
case DLLFunc_Think: // void ) ( edict_t *pent );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnThink(INDEXENT2(index));
return 1;
// pfnUse
case DLLFunc_Use: // void ) ( edict_t *pentUsed, edict_t *pentOther );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx,params[3]);
indexb=cRet[0];
CHECK_ENTITY(indexb);
gpGamedllFuncs->dllapi_table->pfnUse(INDEXENT2(index),INDEXENT2(indexb));
return 1;
case DLLFunc_KeyValue:
{
cRet = MF_GetAmxAddr(amx, params[2]);
index=cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx, params[3]);
KVD_Wrapper *kvdw;
if (*cRet == 0)
kvdw = &g_kvd_glb;
else
kvdw = reinterpret_cast<KVD_Wrapper *>(*cRet);
gpGamedllFuncs->dllapi_table->pfnKeyValue(INDEXENT2(index), kvdw->kvd);
return 1;
}
// pfnTouch
case DLLFunc_Touch: // void ) ( edict_t *pentTouched, edict_t *pentOther );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx,params[3]);
indexb=cRet[0];
CHECK_ENTITY(indexb);
gpGamedllFuncs->dllapi_table->pfnTouch(INDEXENT2(index),INDEXENT2(indexb));
return 1;
case DLLFunc_Blocked: // void ) ( edict_t *pentBlocked, edict_t *pentOther );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx,params[3]);
indexb=cRet[0];
CHECK_ENTITY(indexb);
gpGamedllFuncs->dllapi_table->pfnBlocked(INDEXENT2(index),INDEXENT2(indexb));
return 1;
case DLLFunc_SetAbsBox: // void ) ( edict_t *pent );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnSetAbsBox(INDEXENT2(index));
return 1;
case DLLFunc_ClientConnect: // bool) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
// index,szName,szAddress,szRetRejectReason,size
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
temp = MF_GetAmxString(amx,params[3],0,&len);
temp2 = MF_GetAmxString(amx,params[4],1,&len);
//temp3 = GET_AMXSTRING(amx,params[5],2,len);
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),(char *)temp3);
cRet = MF_GetAmxAddr(amx,params[6]);
MF_SetAmxString(amx,params[5],temp3,cRet[0]);
return iparam1;
case DLLFunc_ClientDisconnect: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnClientDisconnect(INDEXENT2(index));
return 1;
case DLLFunc_ClientKill: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnClientKill(INDEXENT2(index));
return 1;
case DLLFunc_ClientPutInServer: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnClientPutInServer(INDEXENT2(index));
return 1;
case DLLFunc_ServerDeactivate: // void) ( void );
gpGamedllFuncs->dllapi_table->pfnServerDeactivate();
return 1;
case DLLFunc_PlayerPreThink: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnPlayerPreThink(INDEXENT2(index));
return 1;
case DLLFunc_PlayerPostThink: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnPlayerPostThink(INDEXENT2(index));
return 1;
case DLLFunc_StartFrame: // void ) ( void );
gpGamedllFuncs->dllapi_table->pfnStartFrame();
return 1;
case DLLFunc_ParmsNewLevel: // void ) ( void );
gpGamedllFuncs->dllapi_table->pfnParmsNewLevel();
return 1;
case DLLFunc_ParmsChangeLevel: // void ) ( void );
gpGamedllFuncs->dllapi_table->pfnParmsChangeLevel();
return 1;
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
case DLLFunc_GetGameDescription: // const char * )( void );
temp = (char*)gpGamedllFuncs->dllapi_table->pfnGetGameDescription();
cRet = MF_GetAmxAddr(amx,params[3]);
MF_SetAmxString(amx,params[2],temp,cRet[0]);
return 1;
// Spectator funcs
case DLLFunc_SpectatorConnect: // void) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnSpectatorConnect(INDEXENT2(index));
return 1;
case DLLFunc_SpectatorDisconnect: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnSpectatorDisconnect(INDEXENT2(index));
return 1;
case DLLFunc_SpectatorThink: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]);
index=cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnSpectatorThink(INDEXENT2(index));
return 1;
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
case DLLFunc_Sys_Error: // void ) ( const char *error_string );
temp = MF_GetAmxString(amx,params[2],0,&len);
gpGamedllFuncs->dllapi_table->pfnSys_Error(STRING(ALLOC_STRING(temp)));
return 1;
case DLLFunc_PM_FindTextureType: // char )( char *name );
temp = MF_GetAmxString(amx,params[2],0,&len);
return gpGamedllFuncs->dllapi_table->pfnPM_FindTextureType(temp);
case DLLFunc_RegisterEncoders: // void ) ( void );
gpGamedllFuncs->dllapi_table->pfnRegisterEncoders();
return 1;
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
case DLLFunc_GetHullBounds: // int) ( int hullnumber, float *mins, float *maxs );
cRet = MF_GetAmxAddr(amx,params[2]);
iparam1 = gpGamedllFuncs->dllapi_table->pfnGetHullBounds(cRet[0],Vec1,Vec2);
cRet = MF_GetAmxAddr(amx,params[3]);
cRet[0]=amx_ftoc(Vec1[0]);
cRet[1]=amx_ftoc(Vec1[1]);
cRet[2]=amx_ftoc(Vec1[2]);
cRet = MF_GetAmxAddr(amx,params[4]);
cRet[0]=amx_ftoc(Vec2[0]);
cRet[1]=amx_ftoc(Vec2[1]);
cRet[2]=amx_ftoc(Vec2[2]);
return iparam1;
// Create baselines for certain "unplaced" items.
case DLLFunc_CreateInstancedBaselines: // void ) ( void );
gpGamedllFuncs->dllapi_table->pfnCreateInstancedBaselines();
return 1;
case DLLFunc_pfnAllowLagCompensation: // int )( void );
return gpGamedllFuncs->dllapi_table->pfnAllowLagCompensation();
// I know this doesn't fit with dllfunc, but I don't want to create another native JUST for this.
case MetaFunc_CallGameEntity: // bool (plid_t plid, const char *entStr,entvars_t *pev);
temp = MF_GetAmxString(amx,params[2],0,&len);
cRet = MF_GetAmxAddr(amx,params[3]);
index = cRet[0];
CHECK_ENTITY(index);
iparam1 = gpMetaUtilFuncs->pfnCallGameEntity(PLID,STRING(ALLOC_STRING(temp)),VARS(INDEXENT2(index)));
return iparam1;
case DLLFunc_ClientUserInfoChanged: // void ) (edict_t *pEntity, char *infobuffer)
cRet = MF_GetAmxAddr(amx,params[2]);
index = cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnClientUserInfoChanged(INDEXENT2(index),(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)));
return 1;
case DLLFunc_UpdateClientData: // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd)
cRet = MF_GetAmxAddr(amx, params[2]);
index = cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx, params[3]);
iparam1 = cRet[0];
clientdata_t *cd;
if ((params[0] / sizeof(cell)) == 4)
{
cell *ptr = MF_GetAmxAddr(amx, params[4]);
if (*ptr == 0)
cd = &g_cd_glb;
else
cd = reinterpret_cast<clientdata_s *>(*ptr);
}
else
cd = &g_cd_glb;
gpGamedllFuncs->dllapi_table->pfnUpdateClientData(INDEXENT2(index), iparam1, cd);
return 1;
case DLLFunc_AddToFullPack: // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet)
cRet = MF_GetAmxAddr(amx, params[2]);
if (*cRet == 0)
es = &g_es_glb;
else
es = reinterpret_cast<entity_state_t *>(*cRet);
// int e
cRet = MF_GetAmxAddr(amx, params[3]);
iparam1 = cRet[0];
// edict_t *ent
cRet = MF_GetAmxAddr(amx, params[4]);
index = cRet[0];
CHECK_ENTITY(index);
// edict_t *host
cRet = MF_GetAmxAddr(amx, params[5]);
indexb = cRet[0];
CHECK_ENTITY(indexb);
// int hostflags
cRet = MF_GetAmxAddr(amx, params[6]);
iparam2 = cRet[0];
// int player
cRet = MF_GetAmxAddr(amx, params[7]);
iparam3 = cRet[0];
// unsigned char *pSet
cRet = MF_GetAmxAddr(amx, params[8]);
pset = reinterpret_cast<unsigned char *>(*cRet);
return gpGamedllFuncs->dllapi_table->pfnAddToFullPack(es, iparam1, INDEXENT2(index), INDEXENT2(indexb), iparam2, iparam3, pset);
case DLLFunc_CmdStart: // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed)
cRet = MF_GetAmxAddr(amx, params[2]);
index = cRet[0];
CHECK_ENTITY(index);
usercmd_t *uc;
cRet = MF_GetAmxAddr(amx, params[3]);
if (*cRet == 0)
uc = &g_uc_glb;
else
uc = reinterpret_cast<usercmd_t *>(*cRet);
cRet = MF_GetAmxAddr(amx, params[4]);
iparam1 = cRet[0];
gpGamedllFuncs->dllapi_table->pfnCmdStart(INDEXENT2(index), uc, iparam1);
return 1;
case DLLFunc_CmdEnd: // void ) (const edict_t *player)
cRet = MF_GetAmxAddr(amx, params[2]);
index = cRet[0];
CHECK_ENTITY(index);
gpGamedllFuncs->dllapi_table->pfnCmdEnd(INDEXENT2(index));
return 1;
case DLLFunc_CreateBaseline: // void ) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
cRet = MF_GetAmxAddr(amx, params[2]);
iparam1 = cRet[0];
cRet = MF_GetAmxAddr(amx, params[3]);
iparam2 = cRet[0];
cRet = MF_GetAmxAddr(amx, params[4]);
if (*cRet == 0)
es = &g_es_glb;
else
es = reinterpret_cast<entity_state_t *>(*cRet);
cRet = MF_GetAmxAddr(amx, params[5]);
index = cRet[0];
cRet = MF_GetAmxAddr(amx, params[6]);
iparam3 = cRet[0];
CHECK_ENTITY(index);
cRet = MF_GetAmxAddr(amx, params[7]);
Vec1.x = amx_ctof(cRet[0]);
Vec1.y = amx_ctof(cRet[1]);
Vec1.z = amx_ctof(cRet[2]);
cRet = MF_GetAmxAddr(amx, params[8]);
Vec2.x = amx_ctof(cRet[0]);
Vec2.y = amx_ctof(cRet[1]);
Vec2.z = amx_ctof(cRet[2]);
gpGamedllFuncs->dllapi_table->pfnCreateBaseline(iparam1, iparam2, es, INDEXENT2(index), iparam3, Vec1, Vec2);
return 1;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown dllfunc entry %d", type);
return 0;
}
}
AMX_NATIVE_INFO dllfunc_natives[] = {
{"dllfunc", dllfunc},
{NULL, NULL},
};

View File

@ -0,0 +1,80 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _INCLUDE_DLLFUNC_H
#define _INCLUDE_DLLFUNC_H
enum
{
DLLFunc_GameInit, // void ) ( void );
DLLFunc_Spawn, // int ) (edict_t *pent);
DLLFunc_Think, // void ) (edict_t *pent);
DLLFunc_Use, // void ) (edict_t *pentUsed, edict_t *pentOther);
DLLFunc_Touch, // void ) (edict_t *pentTouched, edict_t *pentOther);
DLLFunc_Blocked, // void ) (edict_t *pentBlocked, edict_t *pentOther);
//You can pass in 0 for glb kvd handle or a kvd handle here
DLLFunc_KeyValue, // void ) (edict_t *pentKeyvalue, KeyValueData *pkvd);
DLLFunc_SetAbsBox, // void ) (edict_t *pent);
DLLFunc_ClientConnect, // bool ) (edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]);
DLLFunc_ClientDisconnect, // void ) (edict_t *pEntity);
DLLFunc_ClientKill, // void ) (edict_t *pEntity);
DLLFunc_ClientPutInServer, // void ) (edict_t *pEntity);
DLLFunc_ClientCommand, // void ) (edict_t *pEntity);
DLLFunc_ServerDeactivate, // void ) ( void );
DLLFunc_PlayerPreThink, // void ) (edict_t *pEntity);
DLLFunc_PlayerPostThink, // void ) (edict_t *pEntity);
DLLFunc_StartFrame, // void ) ( void );
DLLFunc_ParmsNewLevel, // void ) ( void );
DLLFunc_ParmsChangeLevel, // void ) ( void );
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
// This also gets called when the server is queried for information (for example, by a server browser tool)
DLLFunc_GetGameDescription, // const char *) ( void );
// Spectator funcs
DLLFunc_SpectatorConnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorDisconnect, // void ) (edict_t *pEntity);
DLLFunc_SpectatorThink, // void ) (edict_t *pEntity);
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
DLLFunc_Sys_Error, // void ) (const char *error_string);
DLLFunc_PM_FindTextureType, // char ) (char *name);
DLLFunc_RegisterEncoders, // void ) ( void );
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
DLLFunc_GetHullBounds, // int ) (int hullnumber, float *mins, float *maxs);
// Create baselines for certain "unplaced" items.
DLLFunc_CreateInstancedBaselines, // void ) ( void );
DLLFunc_pfnAllowLagCompensation, // int ) ( void );
// I know this does not fit with DLLFUNC(), but I don't want another native just for it.
MetaFunc_CallGameEntity, // bool ) (plid_t plid, const char *entStr,entvars_t *pev);
DLLFunc_ClientUserInfoChanged, // void ) (edict *pEntity, char *infobuffer);
// You can pass in 0 for global client data handle or another client data handle here
DLLFunc_UpdateClientData, // void ) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
// You can pass in 0 for global entity state handle or another entity state handle here
DLLFunc_AddToFullPack, // int ) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
// You can pass in 0 for global usercmd handle or another usercmd handle here
DLLFunc_CmdStart, // void ) (const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
DLLFunc_CmdEnd, // void ) (const edict_t *player);
DLLFunc_CreateBaseline // void ) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs);
};
#endif //_INCLUDE_DLLFUNC_H

1103
modules/fakemeta/engfunc.cpp Normal file

File diff suppressed because it is too large Load Diff

102
modules/fakemeta/engfunc.h Normal file
View File

@ -0,0 +1,102 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _ENGFUNC_INCLUDE_H
#define _ENGFUNC_INCLUDE_H
enum {
EngFunc_PrecacheModel, // int ) (char *s);
EngFunc_PrecacheSound, // int ) (char *s);
EngFunc_SetModel, // void ) (edict_t *e, const char *m);
EngFunc_ModelIndex, // int ) (const char *m);
EngFunc_ModelFrames, // int ) (int modelIndex);
EngFunc_SetSize, // void ) (edict_t *e, const float *rgflMin, const float *rgflMax);
EngFunc_ChangeLevel, // void ) (char* s1, char* s2);
EngFunc_VecToYaw, // float) (const float *rgflVector);
EngFunc_VecToAngles, // void ) (const float *rgflVectorIn, float *rgflVectorOut);
EngFunc_MoveToOrigin, // void ) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
EngFunc_ChangeYaw, // void ) (edict_t* ent);
EngFunc_ChangePitch, // void ) (edict_t* ent);
EngFunc_FindEntityByString, // edict) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
EngFunc_GetEntityIllum, // int ) (edict_t* pEnt);
EngFunc_FindEntityInSphere, // edict) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
EngFunc_FindClientInPVS, // edict) (edict_t *pEdict);
EngFunc_EntitiesInPVS, // edict) (edict_t *pplayer);
EngFunc_MakeVectors, // void ) (const float *rgflVector);
EngFunc_AngleVectors, // void ) (const float *rgflVector, float *forward, float *right, float *up);
EngFunc_CreateEntity, // edict) (void);
EngFunc_RemoveEntity, // void ) (edict_t *e);
EngFunc_CreateNamedEntity, // edict) (int className);
EngFunc_MakeStatic, // void ) (edict_t *ent);
EngFunc_EntIsOnFloor, // int ) (edict_t *e);
EngFunc_DropToFloor, // int ) (edict_t *e);
EngFunc_WalkMove, // int ) (edict_t *ent, float yaw, float dist, int iMode);
EngFunc_SetOrigin, // void ) (edict_t *e, const float *rgflOrigin);
EngFunc_EmitSound, // void ) (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
EngFunc_EmitAmbientSound, // void ) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
EngFunc_TraceLine, // void ) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceToss, // void ) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
EngFunc_TraceMonsterHull, // int ) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceHull, // void ) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_TraceModel, // void ) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
EngFunc_TraceTexture, // const char *) (edict_t *pTextureEntity, const float *v1, const float *v2 );
EngFunc_TraceSphere, // void ) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
EngFunc_GetAimVector, // void ) (edict_t *ent, float speed, float *rgflReturn);
EngFunc_ParticleEffect, // void ) (const float *org, const float *dir, float color, float count);
EngFunc_LightStyle, // void ) (int style, const char *val);
EngFunc_DecalIndex, // int ) (const char *name);
EngFunc_PointContents, // int ) (const float *rgflVector);
EngFunc_FreeEntPrivateData, // void ) (edict_t *pEdict);
EngFunc_SzFromIndex, // const char *) (int iString);
EngFunc_AllocString, // int ) (const char *szValue);
EngFunc_RegUserMsg, // int ) (const char *pszName, int iSize);
EngFunc_AnimationAutomove, // void ) (const edict_t *pEdict, float flTime);
EngFunc_GetBonePosition, // void ) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles);
EngFunc_GetAttachment, // void ) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles);
EngFunc_SetView, // void ) (const edict_t *pClient, const edict_t *pViewent);
EngFunc_Time, // float) ( void );
EngFunc_CrosshairAngle, // void ) (const edict_t *pClient, float pitch, float yaw);
EngFunc_FadeClientVolume, // void ) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
EngFunc_SetClientMaxspeed, // void ) (const edict_t *pEdict, float fNewMaxspeed);
EngFunc_CreateFakeClient, // edict) (const char *netname); // returns NULL if fake client can't be created
EngFunc_RunPlayerMove, // void ) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
EngFunc_NumberOfEntities, // int ) ( void );
EngFunc_StaticDecal, // void ) (const float *origin, int decalIndex, int entityIndex, int modelIndex);
EngFunc_PrecacheGeneric, // int ) (char* s);
EngFunc_BuildSoundMsg, // void ) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
EngFunc_GetPhysicsKeyValue, // const char *) (const edict_t *pClient, const char *key);
EngFunc_SetPhysicsKeyValue, // void ) (const edict_t *pClient, const char *key, const char *value);
EngFunc_GetPhysicsInfoString, // const char *) (const edict_t *pClient);
EngFunc_PrecacheEvent, // unsigned short) (int type, const char*psz);
EngFunc_PlaybackEvent, // void ) (int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
EngFunc_CheckVisibility, // int ) (const edict_t *entity, unsigned char *pset);
EngFunc_GetCurrentPlayer, // int ) ( void );
EngFunc_CanSkipPlayer, // int ) (const edict_t *player);
EngFunc_SetGroupMask, // void ) (int mask, int op);
EngFunc_GetClientListening, // bool ) (int iReceiver, int iSender)
EngFunc_SetClientListening, // bool ) (int iReceiver, int iSender, bool Listen)
EngFunc_MessageBegin, // void ) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
EngFunc_WriteCoord, // void ) (float flValue)
EngFunc_WriteAngle, // void ) (float flValue)
EngFunc_InfoKeyValue, // char*) (char *infobuffer, char *key);
EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value);
EngFunc_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value);
EngFunc_CreateInstancedBaseline, // int ) (int classname, struct entity_state_s *baseline);
EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e);
EngFunc_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...);
EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ServerPrint // void ) (const char *szMsg);
};
#endif //_ENGFUNC_INCLUDE_H

View File

@ -0,0 +1,222 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
#include "sh_stack.h"
edict_t *g_player_edicts[33]; // Used for INDEXENT() forward.
void OnAmxxAttach()
{
initialze_offsets();
initialize_glb_offsets();
MF_AddNatives(engfunc_natives);
MF_AddNatives(dllfunc_natives);
MF_AddNatives(pev_natives);
MF_AddNatives(forward_natives);
MF_AddNatives(pdata_natives);
MF_AddNatives(tr_Natives);
MF_AddNatives(glb_natives);
MF_AddNatives(ext2_natives);
MF_AddNatives(misc_natives);
g_kvd_2.szClassName = "";
g_kvd_2.szKeyName = "";
g_kvd_2.szValue = "";
g_kvd_glb.kvd = &g_kvd_2;
}
extern CStack<TraceResult *> g_FreeTRs;
void OnAmxxDetach()
{
while (!g_FreeTRs.empty())
{
delete g_FreeTRs.front();
g_FreeTRs.pop();
}
}
int GetHullBounds(int hullnumber, float *mins, float *maxs);
// sawce: Do not null out the forward for ServerActivate. It's required for the INDEXENT() fix. (I don't think ServerActivate is planned on being forwarded anyway)
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
for(int i = 1; i <= gpGlobals->maxClients;i++)
g_player_edicts[i]=pEdictList + i;
g_pFunctionTable_Post->pfnServerDeactivate = FMH_ServerDeactivate_Post;
RETURN_META(MRES_IGNORED);
}
#define RESETD(tcall) \
g_pFunctionTable->pfn##tcall =0; \
g_pFunctionTable_Post->pfn##tcall =NULL; \
Engine[FM_##tcall].clear(); \
EnginePost[FM_##tcall].clear(); \
EngineAddrs[FM_##tcall] = NULL; \
EngineAddrsPost[FM_##tcall] = NULL;
#define RESETE(call) \
g_pengfuncsTable->pfn##call = NULL; \
g_pengfuncsTable_Post->pfn##call = NULL; \
Engine[FM_##call].clear(); \
EnginePost[FM_##call].clear(); \
EngineAddrs[FM_##call] = NULL; \
EngineAddrsPost[FM_##call] = NULL;
#define RESETN(call) \
g_pNewFunctionsTable->pfn##call = NULL; \
g_pNewFunctionsTable_Post->pfn##call = NULL; \
Engine[FM_##call].clear(); \
EnginePost[FM_##call].clear(); \
EngineAddrs[FM_##call] = NULL; \
EngineAddrsPost[FM_##call] = NULL;
void FMH_ServerDeactivate_Post()
{
// Reset all call lists here.
// NULL all function tables
RESETE(PrecacheModel);
RESETE(PrecacheSound);
RESETE(SetModel);
RESETE(ModelIndex);
RESETE(ModelFrames);
RESETE(SetSize);
RESETE(ChangeLevel);
RESETE(VecToYaw);
RESETE(VecToAngles);
RESETE(MoveToOrigin);
RESETE(ChangeYaw);
RESETE(ChangePitch);
RESETE(FindEntityByString);
RESETE(GetEntityIllum);
RESETE(FindEntityInSphere);
RESETE(FindClientInPVS);
RESETE(EntitiesInPVS);
RESETE(MakeVectors);
RESETE(AngleVectors);
RESETE(CreateEntity);
RESETE(RemoveEntity);
RESETE(CreateNamedEntity);
RESETE(MakeStatic);
RESETE(EntIsOnFloor);
RESETE(DropToFloor);
RESETE(WalkMove);
RESETE(SetOrigin);
RESETE(EmitSound);
RESETE(EmitAmbientSound);
RESETE(TraceLine);
RESETE(TraceToss);
RESETE(TraceMonsterHull);
RESETE(TraceHull);
RESETE(TraceModel);
RESETE(TraceTexture);
RESETE(TraceSphere);
RESETE(GetAimVector);
RESETE(ParticleEffect);
RESETE(LightStyle);
RESETE(DecalIndex);
RESETE(PointContents);
RESETE(FreeEntPrivateData);
RESETE(SzFromIndex);
RESETE(AllocString);
RESETE(RegUserMsg);
RESETE(AnimationAutomove);
RESETE(GetBonePosition);
RESETE(GetAttachment);
RESETE(SetView);
RESETE(Time);
RESETE(CrosshairAngle);
RESETE(FadeClientVolume);
RESETE(SetClientMaxspeed);
RESETE(CreateFakeClient);
RESETE(RunPlayerMove);
RESETE(NumberOfEntities);
RESETE(StaticDecal);
RESETE(PrecacheGeneric);
RESETE(BuildSoundMsg);
RESETE(GetPhysicsKeyValue);
RESETE(SetPhysicsKeyValue);
RESETE(GetPhysicsInfoString);
RESETE(PrecacheEvent);
RESETE(PlaybackEvent);
RESETE(CheckVisibility);
RESETE(GetCurrentPlayer);
RESETE(CanSkipPlayer);
RESETE(SetGroupMask);
RESETE(Voice_GetClientListening);
RESETE(Voice_SetClientListening);
RESETE(InfoKeyValue);
RESETE(SetKeyValue);
RESETE(SetClientKeyValue);
RESETE(MessageBegin);
RESETE(MessageEnd);
RESETE(WriteByte);
RESETE(WriteChar);
RESETE(WriteShort);
RESETE(WriteLong);
RESETE(WriteAngle);
RESETE(WriteCoord);
RESETE(WriteString);
RESETE(WriteEntity);
RESETE(CVarGetFloat);
RESETE(CVarGetString);
RESETE(CVarSetFloat);
RESETE(CVarSetString);
RESETE(AlertMessage);
RESETE(CreateInstancedBaseline);
RESETE(GetInfoKeyBuffer);
RESETE(ClientPrintf);
RESETE(GetPlayerAuthId);
RESETE(GetPlayerWONId);
RESETE(IsMapValid);
RESETE(ServerPrint);
RESETD(Spawn);
RESETD(Think);
RESETD(Use);
RESETD(Touch);
RESETD(Blocked);
RESETD(KeyValue);
RESETD(SetAbsBox);
RESETD(ClientConnect);
RESETD(ClientDisconnect);
RESETD(ClientKill);
RESETD(ClientPutInServer);
RESETD(ClientCommand);
RESETD(ServerDeactivate);
RESETD(PlayerPreThink);
RESETD(PlayerPostThink);
RESETD(StartFrame);
RESETD(ParmsNewLevel);
RESETD(ParmsChangeLevel);
RESETD(GetGameDescription);
RESETD(SpectatorConnect);
RESETD(SpectatorDisconnect);
RESETD(SpectatorThink);
RESETD(Sys_Error);
RESETD(PM_FindTextureType);
RESETD(RegisterEncoders);
RESETD(CreateInstancedBaselines);
RESETD(AllowLagCompensation);
RESETD(ClientUserInfoChanged);
RESETD(UpdateClientData);
RESETD(AddToFullPack);
RESETD(CmdStart);
RESETD(CmdEnd);
RESETD(CreateBaseline);
RESETN(OnFreeEntPrivateData);
RESETN(GameShutdown);
RESETN(ShouldCollide);
g_pFunctionTable->pfnServerActivate = ServerActivate;
RETURN_META(MRES_IGNORED);
}

View File

@ -0,0 +1,84 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _FAKEMETA_INCLUDE_H
#define _FAKEMETA_INCLUDE_H
#include "amxxmodule.h"
#include <entity_state.h>
#include <usercmd.h>
#include "engfunc.h"
#include "dllfunc.h"
#include "pev.h"
#include "forward.h"
#include "fm_tr.h"
#include "glb.h"
#include <am-string.h>
#include <am-vector.h>
extern edict_t *g_player_edicts[33];
inline edict_t* INDEXENT2( int iEdictNum )
{
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
return MF_GetPlayerEdict(iEdictNum);
else
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
}
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
#define CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
if (x <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
} \
}
#endif
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity"); return 0; }
#define CHECK_OFFSET(x) if (x < 0) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset"); return 0; }
extern AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[];
extern AMX_NATIVE_INFO forward_natives[];
extern AMX_NATIVE_INFO pdata_natives[];
extern AMX_NATIVE_INFO tr_Natives[];
extern AMX_NATIVE_INFO pev_natives[];
extern AMX_NATIVE_INFO glb_natives[];
extern AMX_NATIVE_INFO misc_natives[];
extern TraceResult g_tr;
/* Wouldnt modifying the table AFTER it's memcpy'd be ... pointless?
extern enginefuncs_t g_EngineFuncs_Table;
extern enginefuncs_t g_EngineFuncs_Post_Table;
*/
// mark down pointers when the calls are made instead (this means amxxmodule.cpp needs to be changed slightly for this module)
extern DLL_FUNCTIONS *g_pFunctionTable;
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
extern enginefuncs_t *g_pengfuncsTable;
extern enginefuncs_t *g_pengfuncsTable_Post;
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
#endif //_FAKEMETA_INCLUDE_H

196
modules/fakemeta/fm_tr.cpp Normal file
View File

@ -0,0 +1,196 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
TraceResult *gfm_tr;
KeyValueData *g_fm_keyValueData;
static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
{
int type = params[1];
if (*params / sizeof(cell) < 2)
{
MF_LogError(amx, AMX_ERR_NATIVE, "No data passed");
return 0;
}
cell *ptr = MF_GetAmxAddr(amx, params[2]);
edict_t *e = 0;
switch (type)
{
case TR_AllSolid:
{
gfm_tr->fAllSolid = *ptr;
return 1;
break;
}
case TR_StartSolid:
{
gfm_tr->fStartSolid = *ptr;
return 1;
break;
}
case TR_InOpen:
{
gfm_tr->fInOpen = *ptr;
return 1;
break;
}
case TR_InWater:
{
gfm_tr->fInWater = *ptr;
return 1;
break;
}
case TR_flFraction:
{
gfm_tr->flFraction = amx_ctof(*ptr);
return 1;
break;
}
case TR_vecEndPos:
{
gfm_tr->vecEndPos.x = amx_ctof(ptr[0]);
gfm_tr->vecEndPos.y = amx_ctof(ptr[1]);
gfm_tr->vecEndPos.z = amx_ctof(ptr[2]);
return 1;
break;
}
case TR_flPlaneDist:
{
gfm_tr->flPlaneDist = amx_ctof(*ptr);
return 1;
break;
}
case TR_vecPlaneNormal:
{
gfm_tr->vecPlaneNormal.x = amx_ctof(ptr[0]);
gfm_tr->vecPlaneNormal.y = amx_ctof(ptr[1]);
gfm_tr->vecPlaneNormal.z = amx_ctof(ptr[2]);
return 1;
break;
}
case TR_pHit:
{
e = INDEXENT(*ptr);
if (!e || FNullEnt(e))
return 0; //TODO: return error
gfm_tr->pHit = e;
return 1;
break;
}
case TR_iHitgroup:
{
gfm_tr->iHitgroup = *ptr;
return 1;
break;
}
default:
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0;
}
}
}
static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
{
int type = params[1];
cell *ptr = 0;
switch (type)
{
case TR_AllSolid:
{
return gfm_tr->fAllSolid;
break;
}
case TR_StartSolid:
{
return gfm_tr->fStartSolid;
break;
}
case TR_InOpen:
{
return gfm_tr->fInOpen;
break;
}
case TR_InWater:
{
return gfm_tr->fInWater;
break;
}
case TR_flFraction:
{
ptr = MF_GetAmxAddr(amx, params[2]);
*ptr = amx_ftoc(gfm_tr->flFraction);
return 1;
break;
}
case TR_vecEndPos:
{
ptr = MF_GetAmxAddr(amx, params[2]);
ptr[0] = amx_ftoc(gfm_tr->vecEndPos.x);
ptr[1] = amx_ftoc(gfm_tr->vecEndPos.y);
ptr[2] = amx_ftoc(gfm_tr->vecEndPos.z);
return 1;
break;
}
case TR_flPlaneDist:
{
ptr = MF_GetAmxAddr(amx, params[2]);
*ptr = amx_ftoc(gfm_tr->flPlaneDist);
return 1;
break;
}
case TR_vecPlaneNormal:
{
ptr = MF_GetAmxAddr(amx, params[2]);
ptr[0] = amx_ftoc(gfm_tr->vecPlaneNormal.x);
ptr[1] = amx_ftoc(gfm_tr->vecPlaneNormal.y);
ptr[2] = amx_ftoc(gfm_tr->vecPlaneNormal.z);
return 1;
break;
}
case TR_pHit:
{
if (gfm_tr->pHit == NULL || FNullEnt(gfm_tr->pHit))
return -1;
return ENTINDEX(gfm_tr->pHit);
break;
}
case TR_iHitgroup:
{
return gfm_tr->iHitgroup;
break;
}
default:
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0;
}
}
}
AMX_NATIVE_INFO tr_Natives[] =
{
{"get_tr", get_tr},
{"set_tr", set_tr},
{NULL, NULL},
};

227
modules/fakemeta/fm_tr.h Normal file
View File

@ -0,0 +1,227 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _INCLUDE_TR_H
#define _INCLUDE_TR_H
#include <am-string.h>
extern TraceResult *gfm_tr;
//these also don't fit in here but gaben does not care. GABEN DOES NOT CARE!!!
extern TraceResult g_tr_2;
extern KeyValueData g_kvd_2;
extern clientdata_t g_cd_glb;
extern clientdata_t *g_cd_hook;
extern entity_state_t g_es_glb;
extern entity_state_t *g_es_hook;
extern usercmd_t g_uc_glb;
extern usercmd_t *g_uc_hook;
struct KVD_Wrapper
{
KeyValueData *kvd;
ke::AString cls;
ke::AString key;
ke::AString val;
};
extern KVD_Wrapper g_kvd_glb;
extern KVD_Wrapper g_kvd_hook;
enum
{
TR_AllSolid,
TR_StartSolid,
TR_InOpen,
TR_InWater,
TR_flFraction,
TR_vecEndPos,
TR_flPlaneDist,
TR_vecPlaneNormal,
TR_pHit,
TR_iHitgroup,
};
enum KeyValue
{
KV_ClassName,
KV_KeyName,
KV_Value,
KV_fHandled
};
enum ClientData
{
CD_Origin,
CD_Velocity,
CD_ViewModel,
CD_PunchAngle,
CD_Flags,
CD_WaterLevel,
CD_WaterType,
CD_ViewOfs,
CD_Health,
CD_bInDuck,
CD_Weapons,
CD_flTimeStepSound,
CD_flDuckTime,
CD_flSwimTime,
CD_WaterJumpTime,
CD_MaxSpeed,
CD_FOV,
CD_WeaponAnim,
CD_ID,
CD_AmmoShells,
CD_AmmoNails,
CD_AmmoCells,
CD_AmmoRockets,
CD_flNextAttack,
CD_tfState,
CD_PushMsec,
CD_DeadFlag,
CD_PhysInfo,
CD_iUser1,
CD_iUser2,
CD_iUser3,
CD_iUser4,
CD_fUser1,
CD_fUser2,
CD_fUser3,
CD_fUser4,
CD_vUser1,
CD_vUser2,
CD_vUser3,
CD_vUser4
};
enum EntityState
{
// Fields which are filled in by routines outside of delta compression
ES_EntityType,
// Index into cl_entities array for this entity
ES_Number,
ES_MsgTime,
// Message number last time the player/entity state was updated
ES_MessageNum,
// Fields which can be transitted and reconstructed over the network stream
ES_Origin,
ES_Angles,
ES_ModelIndex,
ES_Sequence,
ES_Frame,
ES_ColorMap,
ES_Skin,
ES_Solid,
ES_Effects,
ES_Scale,
ES_eFlags,
// Render information
ES_RenderMode,
ES_RenderAmt,
ES_RenderColor,
ES_RenderFx,
ES_MoveType,
ES_AnimTime,
ES_FrameRate,
ES_Body,
ES_Controller,
ES_Blending,
ES_Velocity,
// Send bbox down to client for use during prediction
ES_Mins,
ES_Maxs,
ES_AimEnt,
// If owned by a player, the index of that player (for projectiles)
ES_Owner,
// Friction, for prediction
ES_Friction,
// Gravity multiplier
ES_Gravity,
// PLAYER SPECIFIC
ES_Team,
ES_PlayerClass,
ES_Health,
ES_Spectator,
ES_WeaponModel,
ES_GaitSequence,
// If standing on conveyor, e.g.
ES_BaseVelocity,
// Use the crouched hull, or the regular player hull
ES_UseHull,
// Latched buttons last time state updated
ES_OldButtons,
// -1 = in air, else pmove entity number
ES_OnGround,
ES_iStepLeft,
// How fast we are falling
ES_flFallVelocity,
ES_FOV,
ES_WeaponAnim,
// Parametric movement overrides
ES_StartPos,
ES_EndPos,
ES_ImpactTime,
ES_StartTime,
// For mods
ES_iUser1,
ES_iUser2,
ES_iUser3,
ES_iUser4,
ES_fUser1,
ES_fUser2,
ES_fUser3,
ES_fUser4,
ES_vUser1,
ES_vUser2,
ES_vUser3,
ES_vUser4
};
enum UserCmd
{
UC_LerpMsec, // Interpolation time on client
UC_Msec, // Duration in ms of command
UC_ViewAngles, // Command view angles
// Intended velocities
UC_ForwardMove, // Forward velocity
UC_SideMove, // Sideways velocity
UC_UpMove, // Upward velocity
UC_LightLevel, // Light level at spot where we are standing
UC_Buttons, // Attack buttons
UC_Impulse, // Impulse command issued
UC_WeaponSelect, // Current weapon id
// Experimental player impact stuff
UC_ImpactIndex,
UC_ImpactPosition
};
extern AMX_NATIVE_INFO tr_Natives[];
extern AMX_NATIVE_INFO ext2_natives[];
#endif //_INCLUDE_TR_H

1276
modules/fakemeta/fm_tr2.cpp Normal file

File diff suppressed because it is too large Load Diff

1553
modules/fakemeta/forward.cpp Normal file

File diff suppressed because it is too large Load Diff

200
modules/fakemeta/forward.h Normal file
View File

@ -0,0 +1,200 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _INCLUDE_FORWARD_H
#define _INCLUDE_FORWARD_H
#include <am-vector.h>
#define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 131
#define FMV_STRING 1
#define FMV_FLOAT 2
#define FMV_CELL 3
#define FMRES_HANDLED 2
#define FMRES_SUPERCEDE 4
#define FMRES_IGNORED 1
#define FMRES_OVERRIDE 3
enum {
FM_FIRST_DONT_USE_ME = 0,
FM_PrecacheModel ,
FM_PrecacheSound,
FM_SetModel,
FM_ModelIndex,
FM_ModelFrames,
FM_SetSize,
FM_ChangeLevel,
FM_VecToYaw,
FM_VecToAngles,
FM_MoveToOrigin,
FM_ChangeYaw,
FM_ChangePitch,
FM_FindEntityByString,
FM_GetEntityIllum,
FM_FindEntityInSphere,
FM_FindClientInPVS,
FM_EntitiesInPVS,
FM_MakeVectors,
FM_AngleVectors,
FM_CreateEntity,
FM_RemoveEntity,
FM_CreateNamedEntity,
FM_MakeStatic,
FM_EntIsOnFloor,
FM_DropToFloor,
FM_WalkMove,
FM_SetOrigin,
FM_EmitSound,
FM_EmitAmbientSound,
FM_TraceLine,
FM_TraceToss,
FM_TraceMonsterHull,
FM_TraceHull,
FM_TraceModel,
FM_TraceTexture,
FM_TraceSphere,
FM_GetAimVector,
FM_ParticleEffect,
FM_LightStyle,
FM_DecalIndex,
FM_PointContents,
FM_MessageBegin,
FM_MessageEnd,
FM_WriteByte,
FM_WriteChar,
FM_WriteShort,
FM_WriteLong,
FM_WriteAngle,
FM_WriteCoord,
FM_WriteString,
FM_WriteEntity,
FM_CVarGetFloat,
FM_CVarGetString,
FM_CVarSetFloat,
FM_CVarSetString,
FM_FreeEntPrivateData,
FM_SzFromIndex,
FM_AllocString,
FM_RegUserMsg,
FM_AnimationAutomove,
FM_GetBonePosition,
FM_GetAttachment,
FM_SetView,
FM_Time,
FM_CrosshairAngle,
FM_FadeClientVolume,
FM_SetClientMaxspeed,
FM_CreateFakeClient,
FM_RunPlayerMove,
FM_NumberOfEntities,
FM_StaticDecal,
FM_PrecacheGeneric,
FM_BuildSoundMsg,
FM_GetPhysicsKeyValue,
FM_SetPhysicsKeyValue,
FM_GetPhysicsInfoString,
FM_PrecacheEvent,
FM_PlaybackEvent,
FM_CheckVisibility,
FM_GetCurrentPlayer,
FM_CanSkipPlayer,
FM_SetGroupMask,
FM_Voice_GetClientListening,
FM_Voice_SetClientListening,
FM_InfoKeyValue,
FM_SetKeyValue,
FM_SetClientKeyValue,
FM_GetPlayerAuthId,
FM_GetPlayerWONId,
FM_IsMapValid,
FM_Spawn,
FM_Think,
FM_Use,
FM_Touch,
FM_Blocked,
FM_KeyValue,
FM_SetAbsBox,
FM_ClientConnect,
FM_ClientDisconnect,
FM_ClientKill,
FM_ClientPutInServer,
FM_ClientCommand,
FM_ServerDeactivate,
FM_PlayerPreThink,
FM_PlayerPostThink,
FM_StartFrame,
FM_ParmsNewLevel,
FM_ParmsChangeLevel,
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
// This also gets called when the server is queried for information (for example, by a server browser tool)
FM_GetGameDescription,
// Spectator funcs
FM_SpectatorConnect,
FM_SpectatorDisconnect,
FM_SpectatorThink,
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
FM_Sys_Error,
FM_PM_FindTextureType,
FM_RegisterEncoders,
// Create baselines for certain "unplaced" items.
FM_CreateInstancedBaselines,
FM_AllowLagCompensation,
FM_AlertMessage,
// NEW_DLL_FUNCTIONS:
FM_OnFreeEntPrivateData,
FM_GameShutdown,
FM_ShouldCollide,
FM_ClientUserInfoChanged, //passes id only
FM_UpdateClientData,
FM_AddToFullPack,
FM_CmdStart,
FM_CmdEnd,
FM_CreateInstancedBaseline,
FM_CreateBaseline,
FM_GetInfoKeyBuffer,
FM_ClientPrintf,
FM_ServerPrint,
FM_LAST_DONT_USE_ME
};
extern ke::Vector<int> Engine[];
extern ke::Vector<int> EnginePost[];
extern void *EngineAddrs[ENGFUNC_NUM+10];
extern void *EngineAddrsPost[ENGFUNC_NUM+10];
extern cell mCellResult;
extern float mFloatResult;
extern const char *mStringResult;
extern cell mlCellResult;
extern float mlFloatResult;
extern const char *mlStringResult;
extern int lastFmRes;
extern int retType;
#endif //_INCLUDE_FORWARD_H

View File

@ -0,0 +1,963 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef FORWARDMACROS_H
#define FORWARDMACROS_H
#define SIMPLE_CONSTSTRING_HOOK_VOID(call) \
const char* call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post () \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_INT(call) \
const char* call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (int v) \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTEDICT(call) \
const char* call (const edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e))); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (const edict_t *e) \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTEDICT_CONSTSTRING(call) \
const char* call (const edict_t *e, const char *c) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c)); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (const edict_t *e, const char *c) \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c)); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_INT_INT_INT_INT(call) \
void call (const edict_t *e, int v, int vb, int vc, int vd) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),(cell)v,(cell)vb,(cell)vc,(cell)vd)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *e, int v, int vb, int vc, int vd) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),(cell)v,(cell)vb,(cell)vc,(cell)vd)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT_STRING_STRING_STRING(call) \
void call (int v,char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v,c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v,c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT_STRING_CONSTSTRING_CONSTSTRING(call) \
void call (int v,char *c, const char *cb, const char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v,c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, char *c, const char *cb, const char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v,c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_STRING_STRING_STRING(call) \
void call (char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (char *c, char *cb, char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_STRING_CONSTSTRING_CONSTSTRING(call) \
void call (char *c, const char *cb, const char *cc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb,cc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (char *c, const char *cb, const char *cc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb,cc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_STRING_HOOK_STRING_STRING(call) \
char* call (char *c, char *cb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(mswi(lastFmRes), (char*)mlStringResult); \
} \
char* call##_post (char *c, char *cb) \
{ \
origStringRet = META_RESULT_ORIG_RET(char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
}
#define SIMPLE_STRING_HOOK_STRING_CONSTSTRING(call) \
char* call (char *c, const char *cb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(mswi(lastFmRes), (char*)mlStringResult); \
} \
char* call##_post (char *c, const char *cb) \
{ \
origStringRet = META_RESULT_ORIG_RET(char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_EDICT(call) \
const char* call (edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(mswi(lastFmRes), mlStringResult); \
} \
const char* call##_post (edict_t *e) \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED, mlStringResult); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_CONSTSTRING_CONSTSTRING(call) \
void call (const edict_t *e, const char *c, const char *cb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c,cb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *e, const char *c, const char *cb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX((edict_t*)e),c,cb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_STRING(call) \
int call (char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (char *s) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_CONSTSTRING(call) \
int call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const char *s) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_EDICT_HOOK_CONSTSTRING(call) \
edict_t* call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (const char *s) \
{ \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_CHAR_HOOK_STRING(call) \
char call (char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (char)mlCellResult); \
} \
char call##_post (char *s) \
{ \
origCellRet = META_RESULT_ORIG_RET(char); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (char)mlCellResult); \
}
#define SIMPLE_CHAR_HOOK_CONSTSTRING(call) \
char call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes), (char)mlCellResult); \
} \
char call##_post (const char *s) \
{ \
origCellRet = META_RESULT_ORIG_RET(char); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED, (char)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_CONSTSTRING(call) \
void call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_STRING_STRING(call) \
void call (char *s, char *sb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, sb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (char *s, char *sb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, sb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT_CONSTSTRING(call) \
void call (int v, const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, s)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v,const char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, s)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTSTRING_FLOAT(call) \
void call (const char *s, float f) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, f)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const char *s, float f) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, f)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_CONSTSTRING_INT(call) \
int call (const char *s, int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, (cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes),(int)mlCellResult); \
} \
int call##_post (const char *s, int v) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_CONSTSTRING_CONSTSTRING(call) \
void call (const char *s,const char *sb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s, sb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const char *s, const char *sb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s, sb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_USHORT_HOOK_INT_CONSTSTRING(call) \
unsigned short call (int v, const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, s)); \
RETURN_META_VALUE(mswi(lastFmRes),(unsigned short)mlCellResult); \
} \
unsigned short call##_post (int v,const char *s) \
{ \
origCellRet = META_RESULT_ORIG_RET(unsigned short); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v, s)); \
RETURN_META_VALUE(MRES_IGNORED,(unsigned short)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_INT_STRING(call) \
void call (int v, char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, s)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v,char *s) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, s)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_INT(call) \
void call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_FLOAT(call) \
void call (float v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), v)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (float v) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), v)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT(call) \
void call (const edict_t *ent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(ent))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ent))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(call) \
void call (const edict_t *ent, float blah) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), blah)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent, float blah) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), blah)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT_FLOAT(call) \
void call (const edict_t *ent, float blah, float blahb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), blah, blahb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent, float blah, float blahb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), blah, blahb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT(call) \
void call (edict_t *ent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(ent))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *ent) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ent))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_EDICT_HOOK_VOID(call) \
edict_t* call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post () \
{ \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_EDICT_HOOK_INT(call) \
edict_t* call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (int v) \
{ \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v)); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_EDICT_HOOK_EDICT(call) \
edict_t* call (edict_t *e) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(mswi(lastFmRes),INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (edict_t *e) \
{ \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)ENTINDEX(e))); \
RETURN_META_VALUE(MRES_IGNORED,INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_EDICT_HOOK_EDICT_CONSTVECT_FLOAT(call) \
edict_t* call (edict_t *ed, const float *vec, float fla) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \
RETURN_META_VALUE(mswi(lastFmRes), INDEXENT2((int)mlCellResult)); \
} \
edict_t* call##_post (edict_t *ed, const float *vec, float fla) \
{ \
PREPARE_VECTOR(vec); \
origCellRet = ENTINDEX(META_RESULT_ORIG_RET(edict_t *)); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ed), p_vec, fla)); \
RETURN_META_VALUE(MRES_IGNORED, INDEXENT2((int)mlCellResult)); \
}
#define SIMPLE_VOID_HOOK_EDICT_EDICT(call) \
void call (edict_t *ent,edict_t *entb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(ent), (cell)ENTINDEX(entb))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *ent,edict_t *entb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(ent), (cell)ENTINDEX(entb))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTEDICT_CONSTEDICT(call) \
void call (const edict_t *ent,const edict_t *entb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), (cell)ENTINDEX((edict_t*)entb))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const edict_t *ent,const edict_t *entb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)ent), (cell)ENTINDEX((edict_t*)entb))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_VOID(call) \
void call (void) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (void) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_EDICT(call) \
int call (edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (edict_t *pent) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_UINT_HOOK_EDICT(call) \
unsigned int call (edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (unsigned int)mlCellResult); \
} \
unsigned int call##_post (edict_t *pent) \
{ \
origCellRet = META_RESULT_ORIG_RET(unsigned int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent))); \
RETURN_META_VALUE(MRES_IGNORED, (unsigned int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_CONSTEDICT(call) \
int call (const edict_t *pent) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX((edict_t*)pent))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const edict_t *pent) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX((edict_t*)pent))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_INT(call) \
int call (int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (int v) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_INT_INT(call) \
void call (int v, int vb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, int vb) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_BOOL_HOOK_INT_INT(call) \
qboolean call (int v, int vb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult > 0 ? 1 : 0); \
} \
qboolean call##_post (int v, int vb) \
{ \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
}
#define SIMPLE_BOOL_HOOK_INT_INT_BOOL(call) \
qboolean call (int v, int vb, qboolean bah) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell) v, (cell)vb, (cell)(bah > 0 ? 1 : 0))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult > 0 ? 1 : 0); \
} \
qboolean call##_post (int v, int vb, qboolean bah) \
{ \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb, (cell)(bah > 0 ? 1 : 0))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult > 0 ? 1 : 0); \
}
#define SIMPLE_INT_HOOK_VOID(call) \
int call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post () \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_FLOAT_HOOK_VOID(call) \
float call () \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \
RETURN_META_VALUE(mswi(lastFmRes), (float)mFloatResult); \
} \
float call##_post () \
{ \
origFloatRet = META_RESULT_ORIG_RET(float); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \
RETURN_META_VALUE(MRES_IGNORED, (float)mFloatResult); \
}
#define SIMPLE_INT_HOOK_CONSTVECT(call) \
int call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_VOID_HOOK_EDICT_CONSTVECT(call) \
void call (edict_t *e, const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_FLOAT_VECT(call) \
void call (edict_t *e, float f, float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), f, p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, float f, float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), f, p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT(call) \
void call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT_VECT_VECT_VECT(call) \
void call (const float *vec, float *vecb, float *vecc, float *vecd) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
PREPARE_VECTOR(vecc); \
PREPARE_VECTOR(vecd); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec, p_vecb, p_vecc, p_vecd)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec, float *vecb, float *vecc, float *vecd) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
PREPARE_VECTOR(vecc); \
PREPARE_VECTOR(vecd); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec, p_vecb, p_vecc, p_vecd)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_CONSTVECT_CONSTVECT(call) \
void call (edict_t *e, const float *vec, const float *vecb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), p_vec, p_vecb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, const float *vec, const float *vecb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), p_vec, p_vecb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_FLOAT_HOOK_CONSTVECT(call) \
float call (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(mswi(lastFmRes),mlFloatResult); \
} \
float call##_post (const float *vec) \
{ \
PREPARE_VECTOR(vec); \
origFloatRet = META_RESULT_ORIG_RET(float); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec)); \
RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
}
#define SIMPLE_FLOAT_HOOK_CONSTSTRING(call) \
float call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes),mlFloatResult); \
} \
float call##_post (const char *s) \
{ \
origFloatRet = META_RESULT_ORIG_RET(float); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED,mlFloatResult); \
}
#define SIMPLE_CONSTSTRING_HOOK_CONSTSTRING(call) \
const char* call (const char *s) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
RETURN_META_VALUE(mswi(lastFmRes),mlStringResult); \
} \
const char* call##_post (const char *s) \
{ \
origStringRet = META_RESULT_ORIG_RET(const char *); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
RETURN_META_VALUE(MRES_IGNORED,mlStringResult); \
}
#define SIMPLE_VOID_HOOK_INT_INT_CONSTVECT_EDICT(call) \
void call (int v, int vb, const float *vec, edict_t *e) \
{ \
if (vec) { \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb, p_vec, (cell)ENTINDEX(e))); \
} else { \
const float b[3]={0.0,0.0,0.0}; \
PREPARE_VECTOR(b); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb, p_b, (cell)ENTINDEX(e))); \
} \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, int vb, const float *vec, edict_t *e) \
{ \
if (vec) { \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb, p_vec, (cell)ENTINDEX(e))); \
} else { \
const float b[3]={0.0,0.0,0.0}; \
PREPARE_VECTOR(b); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)vb, p_b, (cell)ENTINDEX(e))); \
} \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_BOOL_HOOK_EDICT_CONSTSTRING_CONSTSTRING_STRING128(call) \
qboolean call (edict_t *e, const char *sza, const char *szb, char blah[128]) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), sza, szb, blah)); \
RETURN_META_VALUE(mswi(lastFmRes),(int)mlCellResult > 0 ? 0 : 1); \
} \
qboolean call##_post (edict_t *e, const char *sza, const char *szb, char blah[128]) \
{ \
origCellRet = META_RESULT_ORIG_RET(qboolean); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), sza, szb, blah)); \
RETURN_META_VALUE(MRES_IGNORED,(int)mlCellResult > 0 ? 0 : 1); \
}
#define SIMPLE_VOID_HOOK_EDICT_INT_CONSTSTRING_FLOAT_FLOAT_INT_INT(call) \
void call (edict_t *e, int v, const char *sz, float f, float fb, int vb, int vc) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), (cell)v, sz, f, fb, (cell)vb, (cell)vc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, int v, const char *sz, float f, float fb, int vb, int vc) \
{ \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), (cell)v, sz, f, fb, (cell)vb, (cell)vc)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_EDICT_VECT_CONSTSTRING_FLOAT_FLOAT_INT_INT(call) \
void call (edict_t *e, float *vec, const char *sz, float f, float fb, int vb, int vc) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(e), p_vec, sz, f, fb, (cell)vb, (cell)vc)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (edict_t *e, float *vec, const char *sz, float f, float fb, int vb, int vc) \
{ \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(e), p_vec, sz, f, fb, (cell)vb, (cell)vc)); \
RETURN_META(MRES_IGNORED); \
}
//int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
#define HOOK_PLAYBACK_EVENT(call) \
void call (int v, const edict_t *e, unsigned short eb, float f, float *vec, float *vecb, float fb, float fc, int vb, int vc, int vd, int ve) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)ENTINDEX((edict_t*)e), (cell)eb, f, p_vec, p_vecb, fb, fc, (cell)vb, (cell)vc, (cell)vd, (cell)ve)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, const edict_t *e, unsigned short eb, float f, float *vec, float *vecb, float fb, float fc, int vb, int vc, int vd, int ve) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)v, (cell)ENTINDEX((edict_t*)e),(cell)eb, f, p_vec, p_vecb, fb, fc, (cell)vb, (cell)vc, (cell)vd, (cell)ve)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_VOID_HOOK_CONSTVECT_CONSTVECT_FLOAT_FLOAT(call) \
void call (const float *vec,const float *vecb, float fla, float flb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), p_vec, p_vecb, fla, flb)); \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (const float *vec,const float *vecb, float fla, float flb) \
{ \
PREPARE_VECTOR(vec); \
PREPARE_VECTOR(vecb); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), p_vec, p_vecb, fla, flb)); \
RETURN_META(MRES_IGNORED); \
}
#define SIMPLE_INT_HOOK_EDICT_EDICT(call) \
int call (edict_t *pent,edict_t *pentb) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(pent), (cell)ENTINDEX(pentb))); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (edict_t *pent,edict_t *pentb) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent), (cell)ENTINDEX(pentb))); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
}
#define SIMPLE_INT_HOOK_EDICT_FLOAT_FLOAT_INT(call) \
int call (edict_t *pent, float f, float fb, int v) \
{ \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)ENTINDEX(pent), f, fb, (cell)v)); \
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
} \
int call##_post (edict_t *pent, float f, float fb, int v) \
{ \
origCellRet = META_RESULT_ORIG_RET(int); \
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), (cell)ENTINDEX(pent), f, fb, (cell)v)); \
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
} \
#define ENGHOOK(pfnCall) \
if (post) \
{ \
EngineAddrsPost[FM_##pfnCall] = &engtable->pfn##pfnCall; \
if (engtable->pfn##pfnCall == NULL) \
engtable->pfn##pfnCall = pfnCall##_post; \
} \
else \
{ \
EngineAddrs[FM_##pfnCall] = &engtable->pfn##pfnCall; \
if (engtable->pfn##pfnCall == NULL) \
engtable->pfn##pfnCall = pfnCall; \
}
#define DLLHOOK(pfnCall) \
if (post) \
{ \
EngineAddrsPost[FM_##pfnCall] = &dlltable->pfn##pfnCall; \
if (dlltable->pfn##pfnCall == NULL) \
dlltable->pfn##pfnCall = pfnCall##_post; \
} \
else \
{ \
EngineAddrs[FM_##pfnCall] = &dlltable->pfn##pfnCall; \
if (dlltable->pfn##pfnCall == NULL) \
dlltable->pfn##pfnCall = pfnCall; \
}
#define NEWDLLHOOK(pfnCall) \
if (post) \
{ \
if (newdlltable->pfn##pfnCall == NULL) \
newdlltable->pfn##pfnCall = pfnCall##_post; \
} \
else \
{ \
if (newdlltable->pfn##pfnCall == NULL) \
newdlltable->pfn##pfnCall = pfnCall; \
}
#define PREPARE_VECTOR(vector_name) \
cell vector_name##_cell[3] = {amx_ftoc(vector_name[0]), amx_ftoc(vector_name[1]), amx_ftoc(vector_name[2])}; \
cell p_##vector_name = MF_PrepareCellArray(vector_name##_cell, 3) \
#define PREPARE_FLOAT(float_name) \
cell c_##float_name = amx_ftoc(float_name);
#define BYREF_FLOAT(float_name) \
float_name = amx_ctof(c_##float_name);
#define FM_ENG_HANDLE(pfnCall, pfnArgs) \
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
for (i=0; i<Engine[pfnCall].length(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \
if (fmres >= lastFmRes) { \
if (retType == FMV_STRING) \
mlStringResult = mStringResult; \
else if (retType == FMV_CELL) \
mlCellResult = mCellResult; \
else if (retType == FMV_FLOAT) \
mlFloatResult = mFloatResult; \
lastFmRes = fmres; \
} \
}
#define FM_ENG_HANDLE_POST(pfnCall, pfnArgs) \
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
for (i=0; i<EnginePost[pfnCall].length(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \
if (fmres >= lastFmRes) { \
if (retType == FMV_STRING) \
mlStringResult = mStringResult; \
else if (retType == FMV_CELL) \
mlCellResult = mCellResult; \
else if (retType == FMV_FLOAT) \
mlFloatResult = mFloatResult; \
lastFmRes = fmres; \
} \
} \
origCellRet = 0; \
origFloatRet = 0.0; \
origStringRet = "";
#endif // FORWARDMACROS_H

190
modules/fakemeta/glb.cpp Normal file
View File

@ -0,0 +1,190 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
static int g_glob_offset_table[glb_end_pchar] = {-1};
#define DO_OFFSET_GLB(offset) g_glob_offset_table[offset] = offsetof(globalvars_t, offset)
void initialize_glb_offsets()
{
DO_OFFSET_GLB(trace_hitgroup);
DO_OFFSET_GLB(trace_flags);
DO_OFFSET_GLB(msg_entity);
DO_OFFSET_GLB(cdAudioTrack);
DO_OFFSET_GLB(maxClients);
DO_OFFSET_GLB(maxEntities);
g_glob_offset_table[gl_time] = offsetof(globalvars_t, time);
DO_OFFSET_GLB(frametime);
DO_OFFSET_GLB(force_retouch);
DO_OFFSET_GLB(deathmatch);
DO_OFFSET_GLB(coop);
DO_OFFSET_GLB(teamplay);
DO_OFFSET_GLB(serverflags);
DO_OFFSET_GLB(found_secrets);
DO_OFFSET_GLB(trace_allsolid);
DO_OFFSET_GLB(trace_startsolid);
DO_OFFSET_GLB(trace_fraction);
DO_OFFSET_GLB(trace_plane_dist);
DO_OFFSET_GLB(trace_inopen);
DO_OFFSET_GLB(trace_inwater);
DO_OFFSET_GLB(trace_ent);
DO_OFFSET_GLB(v_forward);
DO_OFFSET_GLB(v_up);
DO_OFFSET_GLB(v_right);
DO_OFFSET_GLB(trace_endpos);
DO_OFFSET_GLB(trace_plane_normal);
DO_OFFSET_GLB(vecLandmarkOffset);
DO_OFFSET_GLB(mapname);
DO_OFFSET_GLB(startspot);
DO_OFFSET_GLB(pStringBase);
}
#define GET_OFFS(v,o) ((char *)v + o)
static cell AMX_NATIVE_CALL amx_glb(AMX *amx, cell *params)
{
int iSwitch = params[1];
if (iSwitch <= glb_start_int || iSwitch >= glb_end_pchar)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined global index: %d", iSwitch);
return 0;
}
int offset = g_glob_offset_table[iSwitch];
if (offset == -1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined global index: %d", iSwitch);
return 0;
}
enum
{
Ret_Int = (1<<0),
Ret_Float = (1<<1),
Ret_Vec = (1<<2),
Ret_Edict = (1<<3),
Ret_PChar = (1<<4)
};
union
{
int i;
float f;
const char *c;
} rets;
Vector vec;
rets.i = 0;
int Valtype = 0;
if (iSwitch > glb_start_int && iSwitch < glb_end_int)
{
rets.i = *(int *)GET_OFFS(gpGlobals, offset);
Valtype = Ret_Int;
}
else if (iSwitch > glb_start_float && iSwitch < glb_end_float)
{
rets.f = *(float *)GET_OFFS(gpGlobals, offset);
Valtype = Ret_Float;
}
else if (iSwitch > glb_start_edict && iSwitch < glb_end_edict)
{
edict_t *e = *(edict_t **)GET_OFFS(gpGlobals, offset);
rets.i = ENTINDEX(e);
Valtype = Ret_Int | Ret_Edict;
}
else if (iSwitch > glb_start_vector && iSwitch < glb_end_vector)
{
vec = *(vec3_t *)GET_OFFS(gpGlobals, offset);
Valtype = Ret_Vec;
}
else if (iSwitch > glb_start_string && iSwitch < glb_end_string)
{
rets.c = STRING(*(string_t *)GET_OFFS(gpGlobals, offset));
Valtype = Ret_PChar;
}
else if (iSwitch > glb_start_pchar && iSwitch < glb_end_pchar)
{
rets.c = *(const char **)GET_OFFS(gpGlobals, offset);
Valtype = Ret_PChar;
}
size_t paramnum = params[0] / sizeof(cell) - 1;
if (paramnum == 0)
{
//return an int
if (Valtype & Ret_Int)
{
return rets.i;
} else {
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
return 0;
}
}
else if (paramnum == 1)
{
//return a byref float - usually
cell *addr = MF_GetAmxAddr(amx, params[2]);
if (Valtype == Ret_Float)
{
*addr = amx_ftoc(rets.f);
}
else if (Valtype == Ret_Vec)
{
addr[0] = amx_ftoc(vec.x);
addr[1] = amx_ftoc(vec.y);
addr[2] = amx_ftoc(vec.z);
} else {
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
return 0;
}
return 1;
}
else if (paramnum == 2)
{
cell size = *(MF_GetAmxAddr(amx, params[3]));
if (Valtype == Ret_PChar)
{
const char *str = rets.c;
if (!str)
str = "";
return MF_SetAmxString(amx, params[2], str, size);
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}
else if (paramnum == 3)
{
cell size = *(MF_GetAmxAddr(amx, params[4]));
if (Valtype == Ret_PChar)
{
cell *str = MF_GetAmxAddr(amx, params[2]);
return MF_SetAmxString(amx, params[3], STRING((int)*str), size);
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}
//if we got here, something happened
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown global index or return combination %d", iSwitch);
return 0;
}
AMX_NATIVE_INFO glb_natives[] =
{
{"global_get", amx_glb},
{NULL, NULL},
};

66
modules/fakemeta/glb.h Normal file
View File

@ -0,0 +1,66 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _INCLUDE_GLB_H
#define _INCLUDE_GLB_H
enum glb_pointers
{
glb_start_int = 0,
trace_hitgroup,
trace_flags,
msg_entity,
cdAudioTrack,
maxClients,
maxEntities,
glb_end_int,
glb_start_float,
gl_time,
frametime,
force_retouch,
deathmatch,
coop,
teamplay,
serverflags,
found_secrets,
trace_allsolid,
trace_startsolid,
trace_fraction,
trace_plane_dist,
trace_inopen,
trace_inwater,
glb_end_float,
glb_start_edict,
trace_ent,
glb_end_edict,
glb_start_vector,
v_forward,
v_up,
v_right,
trace_endpos,
trace_plane_normal,
vecLandmarkOffset,
glb_end_vector,
glb_start_string,
mapname,
startspot,
glb_end_string,
glb_start_pchar,
pStringBase,
glb_end_pchar
};
void initialize_glb_offsets();
#endif /* _INCLUDE_GLB_H */

343
modules/fakemeta/misc.cpp Normal file
View File

@ -0,0 +1,343 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
#include <studio.h> // HLSDK, for the animation natives
static cell AMX_NATIVE_CALL copy_infokey_buffer(AMX *amx, cell *params)
{
char *infobuffer = reinterpret_cast<char *>(params[1]);
return MF_SetAmxString(amx, params[2], infobuffer, params[3]);
}
int UTIL_stricmp(const char *s1, const char *s2)
{
unsigned char c1, c2;
for (;;) {
c1 = *s1++;
c2 = *s2++;
if (!c1 || !c2)
break;
if (c1 == c2)
continue;
if ((c1 = tolower(c1)) != (c2 = tolower(c2)))
break;
}
return (int)c1 - (int)c2;
}
// lookup_sequence(entid, "sequence name", &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
static cell AMX_NATIVE_CALL lookup_sequence(AMX* amx, cell* params)
{
int index = params[1];
CHECK_ENTITY(index);
edict_t* ent = INDEXENT(index);
studiohdr_t* pstudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(ent));
if (pstudiohdr == NULL)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not retrieve the model pointer from the entity provided.");
return 0;
}
mstudioseqdesc_t* pseqdesc;
pseqdesc = reinterpret_cast<mstudioseqdesc_t*>(
reinterpret_cast<char*>(pstudiohdr) + pstudiohdr->seqindex);
char* label = MF_GetAmxString(amx, params[2], 0, NULL);
for (int i = 0; i < pstudiohdr->numseq; i++)
{
if (UTIL_stricmp( pseqdesc[i].label, label ) == 0)
{
REAL* FrameRate = reinterpret_cast<REAL*>(MF_GetAmxAddr(amx, params[3]));
cell* Loops = MF_GetAmxAddr(amx, params[4]);
REAL* GroundSpeed = reinterpret_cast<REAL*>(MF_GetAmxAddr(amx, params[5]));
// Taken from HLSDK: animation & animating.cpp
pseqdesc = &pseqdesc[i];
*FrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1);
*GroundSpeed = sqrt( pseqdesc->linearmovement[0]*pseqdesc->linearmovement[0]+ pseqdesc->linearmovement[1]*pseqdesc->linearmovement[1]+ pseqdesc->linearmovement[2]*pseqdesc->linearmovement[2] );
*GroundSpeed = *GroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
*Loops = pseqdesc->flags & STUDIO_LOOPING;
return i;
}
}
return -1;
};
// Float:set_controller(entid, controllerid, Float:value);
static cell AMX_NATIVE_CALL set_controller(AMX* amx, cell* params)
{
// From animation.cpp from the HLSDK
// SetController( void *pmodel, entvars_t *pev, int iController, float flValue )
int entindex = params[1];
CHECK_ENTITY(entindex);
edict_t* entity = INDEXENT(entindex);
int iController = params[2];
if (iController < 0 || iController > 3)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid controller id passed. Expected 0 through 3, got %d.", iController);
return 0;
}
entvars_t* pev = &entity->v;
float flValue = amx_ctof(params[3]);
studiohdr_t* pstudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(entity));
if (! pstudiohdr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
return amx_ftoc(flValue);
}
mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex);
int i = 0;
// find first controller that matches the index
for (i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++)
{
if (pbonecontroller->index == iController)
break;
}
if (i >= pstudiohdr->numbonecontrollers)
return amx_ftoc(flValue);
// wrap 0..360 if it's a rotational controller
if (pbonecontroller->type & (STUDIO_XR | STUDIO_YR | STUDIO_ZR))
{
// ugly hack, invert value if end < start
if (pbonecontroller->end < pbonecontroller->start)
flValue = -flValue;
// does the controller not wrap?
if (pbonecontroller->start + 359.0 >= pbonecontroller->end)
{
if (flValue > ((pbonecontroller->start + pbonecontroller->end) / 2.0) + 180)
flValue = flValue - 360;
if (flValue < ((pbonecontroller->start + pbonecontroller->end) / 2.0) - 180)
flValue = flValue + 360;
}
else
{
if (flValue > 360)
flValue = flValue - (int)(flValue / 360.0) * 360.0;
else if (flValue < 0)
flValue = flValue + (int)((flValue / -360.0) + 1) * 360.0;
}
}
int setting = static_cast<int>(255 * (flValue - pbonecontroller->start) / (pbonecontroller->end - pbonecontroller->start));
if (setting < 0) setting = 0;
if (setting > 255) setting = 255;
pev->controller[iController] = setting;
return amx_ftoc(setting * (1.0 / 255.0) * (pbonecontroller->end - pbonecontroller->start) + pbonecontroller->start);
}
enum
{
Model_DefaultSize = -2,
Model_CurrentSequence = -1,
};
// GetModelCollisionBox( index, Float:mins[3], Float:maxs[3] );
static cell AMX_NATIVE_CALL GetModelCollisionBox(AMX *amx, cell *params)
{
int entityIndex = params[1];
CHECK_ENTITY(entityIndex);
edict_t *pEdict = INDEXENT2(entityIndex);
if (!FNullEnt(pEdict))
{
studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pEdict));
if (!pStudiohdr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
return 0;
}
cell *cmins = MF_GetAmxAddr(amx, params[2]);
cell *cmaxs = MF_GetAmxAddr(amx, params[3]);
cmins[0] = amx_ftoc(pStudiohdr->bbmin.x);
cmins[1] = amx_ftoc(pStudiohdr->bbmin.y);
cmins[2] = amx_ftoc(pStudiohdr->bbmin.z);
cmaxs[0] = amx_ftoc(pStudiohdr->bbmax.x);
cmaxs[1] = amx_ftoc(pStudiohdr->bbmax.y);
cmaxs[2] = amx_ftoc(pStudiohdr->bbmax.z);
return 1;
}
return 0;
};
// GetModelBoundingBox( index, Float:mins[3], Float:maxs[3], sequence = Model_DefaultSize );
static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params)
{
int entityIndex = params[1];
CHECK_ENTITY(entityIndex);
edict_t *pentModel = INDEXENT2(entityIndex);
if (!FNullEnt(pentModel))
{
studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pentModel));
if (!pStudiohdr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
return 0;
}
cell *bbmins = MF_GetAmxAddr(amx, params[2]);
cell *bbmaxs = MF_GetAmxAddr(amx, params[3]);
int sequence = params[4];
if (sequence <= Model_DefaultSize)
{
bbmins[0] = amx_ftoc(pStudiohdr->min.x);
bbmins[1] = amx_ftoc(pStudiohdr->min.y);
bbmins[2] = amx_ftoc(pStudiohdr->min.z);
bbmaxs[0] = amx_ftoc(pStudiohdr->max.x);
bbmaxs[1] = amx_ftoc(pStudiohdr->max.y);
bbmaxs[2] = amx_ftoc(pStudiohdr->max.z);
}
else
{
if (sequence <= Model_CurrentSequence || sequence >= pStudiohdr->numseq)
sequence = pentModel->v.sequence;
mstudioseqdesc_t *pSeqdesc;
pSeqdesc = (mstudioseqdesc_t*)((byte*)pStudiohdr + pStudiohdr->seqindex);
bbmins[0] = amx_ftoc(pSeqdesc[sequence].bbmin.x);
bbmins[1] = amx_ftoc(pSeqdesc[sequence].bbmin.y);
bbmins[2] = amx_ftoc(pSeqdesc[sequence].bbmin.z);
bbmaxs[0] = amx_ftoc(pSeqdesc[sequence].bbmax.x);
bbmaxs[1] = amx_ftoc(pSeqdesc[sequence].bbmax.y);
bbmaxs[2] = amx_ftoc(pSeqdesc[sequence].bbmax.z);
}
return 1;
}
return 0;
};
// SetModelCollisionBox( index );
static cell AMX_NATIVE_CALL SetModelCollisionBox(AMX *amx, cell *params)
{
int entityIndex = params[1];
CHECK_ENTITY(entityIndex);
edict_t *pentModel = INDEXENT2(entityIndex);
if (!FNullEnt(pentModel))
{
studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pentModel));
if (!pStudiohdr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
return 0;
}
SET_SIZE(pentModel, pStudiohdr->bbmin, pStudiohdr->bbmax);
return 1;
}
return 0;
};
// SetModelBoudingBox( index, sequence = Model_DefaultSize );
static cell AMX_NATIVE_CALL SetModelBoundingBox(AMX *amx, cell *params)
{
int entityIndex = params[1];
CHECK_ENTITY(entityIndex);
edict_t *pentModel = INDEXENT2(entityIndex);
if (!FNullEnt(pentModel))
{
studiohdr_t *pStudiohdr = static_cast<studiohdr_t*>(GET_MODEL_PTR(pentModel));
if (!pStudiohdr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
return 0;
}
int sequence = params[2];
if (sequence <= Model_DefaultSize)
{
SET_SIZE(pentModel, pStudiohdr->min, pStudiohdr->max);
}
else
{
if (sequence <= Model_CurrentSequence || sequence >= pStudiohdr->numseq)
sequence = pentModel->v.sequence;
mstudioseqdesc_t *pSeqdesc;
pSeqdesc = (mstudioseqdesc_t*)((byte*)pStudiohdr + pStudiohdr->seqindex);
SET_SIZE(pentModel, pSeqdesc[sequence].bbmin, pSeqdesc[sequence].bbmax);
return 1;
}
}
return 0;
}
AMX_NATIVE_INFO misc_natives[] = {
{ "copy_infokey_buffer", copy_infokey_buffer },
{ "lookup_sequence", lookup_sequence },
{ "set_controller", set_controller },
{ "GetModelCollisionBox", GetModelCollisionBox },
{ "SetModelCollisionBox", SetModelCollisionBox },
{ "GetModelBoundingBox", GetModelBoundingBox },
{ "SetModelBoundingBox", SetModelBoundingBox },
{NULL, NULL},
};

View File

@ -0,0 +1,505 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Module Config
//
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include <amxmodx_version.h>
// Module info
#define MODULE_NAME "FakeMeta"
#define MODULE_VERSION AMXX_VERSION
#define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "FAKEMETA"
#define MODULE_LIBRARY "fakemeta"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
#define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
#else // __DATE__
#define MODULE_DATE "Unknown"
#endif // __DATE__
// metamod plugin?
#define USE_METAMOD
// use memory manager/tester?
// note that if you use this, you cannot construct/allocate
// anything before the module attached (OnAmxxAttach).
// be careful of default constructors using new/malloc!
// #define MEMORY_TEST
// Unless you use STL or exceptions, keep this commented.
// It allows you to compile without libstdc++.so as a dependency
// #define NO_ALLOC_OVERRIDES
// Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself
// #define NO_MSVC8_AUTO_COMPAT
/**
* AMXX Init functions
* Also consider using FN_META_*
*/
/** AMXX query */
//#define FN_AMXX_QUERY OnAmxxQuery
/** AMXX attach
* Do native functions init here (MF_AddNatives)
*/
#define FN_AMXX_ATTACH OnAmxxAttach
/** AMXX Detach (unload) */
#define FN_AMXX_DETACH OnAmxxDetach
/** All plugins loaded
* Do forward functions init here (MF_RegisterForward)
*/
//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
/** All plugins are about to be unloaded */
//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading
/** All plugins are now unloaded */
//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded
/**** METAMOD ****/
// If your module doesn't use metamod, you may close the file now :)
#ifdef USE_METAMOD
// ----
// Hook Functions
// Uncomment these to be called
// You can also change the function name
// - Metamod init functions
// Also consider using FN_AMXX_*
// Meta query
//#define FN_META_QUERY OnMetaQuery
// Meta attach
//#define FN_META_ATTACH OnMetaAttach
// Meta detach
//#define FN_META_DETACH OnMetaDetach
// (wd) are Will Day's notes
// - GetEntityAPI2 functions
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
// #define FN_DispatchThink DispatchThink /* pfnThink() */
// #define FN_DispatchUse DispatchUse /* pfnUse() */
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
// #define FN_DispatchSave DispatchSave /* pfnSave() */
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
// #define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
// - GetEntityAPI2_Post functions
// #define FN_GameDLLInit_Post GameDLLInit_Post
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
// #define FN_DispatchThink_Post DispatchThink_Post
// #define FN_DispatchUse_Post DispatchUse_Post
// #define FN_DispatchTouch_Post DispatchTouch_Post
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post
// #define FN_DispatchSave_Post DispatchSave_Post
// #define FN_DispatchRestore_Post DispatchRestore_Post
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
// #define FN_SaveReadFields_Post SaveReadFields_Post
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
// #define FN_ClientConnect_Post ClientConnect_Post
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
// #define FN_ClientKill_Post ClientKill_Post
// #define FN_ClientPutInServer_Post ClientPutInServer_Post
// #define FN_ClientCommand_Post ClientCommand_Post
// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
// #define FN_ServerActivate_Post ServerActivate_Post
#define FN_ServerDeactivate_Post FMH_ServerDeactivate_Post
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
// #define FN_StartFrame_Post StartFrame_Post
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
// #define FN_GetGameDescription_Post GetGameDescription_Post
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
// #define FN_SpectatorThink_Post SpectatorThink_Post
// #define FN_Sys_Error_Post Sys_Error_Post
// #define FN_PM_Move_Post PM_Move_Post
// #define FN_PM_Init_Post PM_Init_Post
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
// #define FN_SetupVisibility_Post SetupVisibility_Post
// #define FN_UpdateClientData_Post UpdateClientData_Post
// #define FN_AddToFullPack_Post AddToFullPack_Post
// #define FN_CreateBaseline_Post CreateBaseline_Post
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
// #define FN_GetWeaponData_Post GetWeaponData_Post
// #define FN_CmdStart_Post CmdStart_Post
// #define FN_CmdEnd_Post CmdEnd_Post
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
// #define FN_GetHullBounds_Post GetHullBounds_Post
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
// #define FN_InconsistentFile_Post InconsistentFile_Post
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
// - GetEngineAPI functions
// #define FN_PrecacheModel PrecacheModel
// #define FN_PrecacheSound PrecacheSound
// #define FN_SetModel SetModel
// #define FN_ModelIndex ModelIndex
// #define FN_ModelFrames ModelFrames
// #define FN_SetSize SetSize
// #define FN_ChangeLevel ChangeLevel
// #define FN_GetSpawnParms GetSpawnParms
// #define FN_SaveSpawnParms SaveSpawnParms
// #define FN_VecToYaw VecToYaw
// #define FN_VecToAngles VecToAngles
// #define FN_MoveToOrigin MoveToOrigin
// #define FN_ChangeYaw ChangeYaw
// #define FN_ChangePitch ChangePitch
// #define FN_FindEntityByString FindEntityByString
// #define FN_GetEntityIllum GetEntityIllum
// #define FN_FindEntityInSphere FindEntityInSphere
// #define FN_FindClientInPVS FindClientInPVS
// #define FN_EntitiesInPVS EntitiesInPVS
// #define FN_MakeVectors MakeVectors
// #define FN_AngleVectors AngleVectors
// #define FN_CreateEntity CreateEntity
// #define FN_RemoveEntity RemoveEntity
// #define FN_CreateNamedEntity CreateNamedEntity
// #define FN_MakeStatic MakeStatic
// #define FN_EntIsOnFloor EntIsOnFloor
// #define FN_DropToFloor DropToFloor
// #define FN_WalkMove WalkMove
// #define FN_SetOrigin SetOrigin
// #define FN_EmitSound EmitSound
// #define FN_EmitAmbientSound EmitAmbientSound
// #define FN_TraceLine TraceLine
// #define FN_TraceToss TraceToss
// #define FN_TraceMonsterHull TraceMonsterHull
// #define FN_TraceHull TraceHull
// #define FN_TraceModel TraceModel
// #define FN_TraceTexture TraceTexture
// #define FN_TraceSphere TraceSphere
// #define FN_GetAimVector GetAimVector
// #define FN_ServerCommand ServerCommand
// #define FN_ServerExecute ServerExecute
// #define FN_engClientCommand engClientCommand
// #define FN_ParticleEffect ParticleEffect
// #define FN_LightStyle LightStyle
// #define FN_DecalIndex DecalIndex
// #define FN_PointContents PointContents
// #define FN_MessageBegin MessageBegin
// #define FN_MessageEnd MessageEnd
// #define FN_WriteByte WriteByte
// #define FN_WriteChar WriteChar
// #define FN_WriteShort WriteShort
// #define FN_WriteLong WriteLong
// #define FN_WriteAngle WriteAngle
// #define FN_WriteCoord WriteCoord
// #define FN_WriteString WriteString
// #define FN_WriteEntity WriteEntity
// #define FN_CVarRegister CVarRegister
// #define FN_CVarGetFloat CVarGetFloat
// #define FN_CVarGetString CVarGetString
// #define FN_CVarSetFloat CVarSetFloat
// #define FN_CVarSetString CVarSetString
// #define FN_AlertMessage AlertMessage
// #define FN_EngineFprintf EngineFprintf
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
// #define FN_PvEntPrivateData PvEntPrivateData
// #define FN_FreeEntPrivateData FreeEntPrivateData
// #define FN_SzFromIndex SzFromIndex
// #define FN_AllocString AllocString
// #define FN_GetVarsOfEnt GetVarsOfEnt
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
// #define FN_IndexOfEdict IndexOfEdict
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
// #define FN_FindEntityByVars FindEntityByVars
// #define FN_GetModelPtr GetModelPtr
// #define FN_RegUserMsg RegUserMsg
// #define FN_AnimationAutomove AnimationAutomove
// #define FN_GetBonePosition GetBonePosition
// #define FN_FunctionFromName FunctionFromName
// #define FN_NameForFunction NameForFunction
// #define FN_ClientPrintf ClientPrintf
// #define FN_ServerPrint ServerPrint
// #define FN_Cmd_Args Cmd_Args
// #define FN_Cmd_Argv Cmd_Argv
// #define FN_Cmd_Argc Cmd_Argc
// #define FN_GetAttachment GetAttachment
// #define FN_CRC32_Init CRC32_Init
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
// #define FN_CRC32_Final CRC32_Final
// #define FN_RandomLong RandomLong
// #define FN_RandomFloat RandomFloat
// #define FN_SetView SetView
// #define FN_Time Time
// #define FN_CrosshairAngle CrosshairAngle
// #define FN_LoadFileForMe LoadFileForMe
// #define FN_FreeFile FreeFile
// #define FN_EndSection EndSection
// #define FN_CompareFileTime CompareFileTime
// #define FN_GetGameDir GetGameDir
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
// #define FN_FadeClientVolume FadeClientVolume
// #define FN_SetClientMaxspeed SetClientMaxspeed
// #define FN_CreateFakeClient CreateFakeClient
// #define FN_RunPlayerMove RunPlayerMove
// #define FN_NumberOfEntities NumberOfEntities
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
// #define FN_InfoKeyValue InfoKeyValue
// #define FN_SetKeyValue SetKeyValue
// #define FN_SetClientKeyValue SetClientKeyValue
// #define FN_IsMapValid IsMapValid
// #define FN_StaticDecal StaticDecal
// #define FN_PrecacheGeneric PrecacheGeneric
// #define FN_GetPlayerUserId GetPlayerUserId
// #define FN_BuildSoundMsg BuildSoundMsg
// #define FN_IsDedicatedServer IsDedicatedServer
// #define FN_CVarGetPointer CVarGetPointer
// #define FN_GetPlayerWONId GetPlayerWONId
// #define FN_Info_RemoveKey Info_RemoveKey
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
// #define FN_PrecacheEvent PrecacheEvent
// #define FN_PlaybackEvent PlaybackEvent
// #define FN_SetFatPVS SetFatPVS
// #define FN_SetFatPAS SetFatPAS
// #define FN_CheckVisibility CheckVisibility
// #define FN_DeltaSetField DeltaSetField
// #define FN_DeltaUnsetField DeltaUnsetField
// #define FN_DeltaAddEncoder DeltaAddEncoder
// #define FN_GetCurrentPlayer GetCurrentPlayer
// #define FN_CanSkipPlayer CanSkipPlayer
// #define FN_DeltaFindField DeltaFindField
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
// #define FN_SetGroupMask SetGroupMask
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
// #define FN_Cvar_DirectSet Cvar_DirectSet
// #define FN_ForceUnmodified ForceUnmodified
// #define FN_GetPlayerStats GetPlayerStats
// #define FN_AddServerCommand AddServerCommand
// #define FN_Voice_GetClientListening Voice_GetClientListening
// #define FN_Voice_SetClientListening Voice_SetClientListening
// #define FN_GetPlayerAuthId GetPlayerAuthId
// - GetEngineAPI_Post functions
// #define FN_PrecacheModel_Post PrecacheModel_Post
// #define FN_PrecacheSound_Post PrecacheSound_Post
// #define FN_SetModel_Post SetModel_Post
// #define FN_ModelIndex_Post ModelIndex_Post
// #define FN_ModelFrames_Post ModelFrames_Post
// #define FN_SetSize_Post SetSize_Post
// #define FN_ChangeLevel_Post ChangeLevel_Post
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
// #define FN_VecToYaw_Post VecToYaw_Post
// #define FN_VecToAngles_Post VecToAngles_Post
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
// #define FN_ChangeYaw_Post ChangeYaw_Post
// #define FN_ChangePitch_Post ChangePitch_Post
// #define FN_FindEntityByString_Post FindEntityByString_Post
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
// #define FN_MakeVectors_Post MakeVectors_Post
// #define FN_AngleVectors_Post AngleVectors_Post
// #define FN_CreateEntity_Post CreateEntity_Post
// #define FN_RemoveEntity_Post RemoveEntity_Post
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
// #define FN_MakeStatic_Post MakeStatic_Post
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
// #define FN_DropToFloor_Post DropToFloor_Post
// #define FN_WalkMove_Post WalkMove_Post
// #define FN_SetOrigin_Post SetOrigin_Post
// #define FN_EmitSound_Post EmitSound_Post
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
// #define FN_TraceLine_Post TraceLine_Post
// #define FN_TraceToss_Post TraceToss_Post
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
// #define FN_TraceHull_Post TraceHull_Post
// #define FN_TraceModel_Post TraceModel_Post
// #define FN_TraceTexture_Post TraceTexture_Post
// #define FN_TraceSphere_Post TraceSphere_Post
// #define FN_GetAimVector_Post GetAimVector_Post
// #define FN_ServerCommand_Post ServerCommand_Post
// #define FN_ServerExecute_Post ServerExecute_Post
// #define FN_engClientCommand_Post engClientCommand_Post
// #define FN_ParticleEffect_Post ParticleEffect_Post
// #define FN_LightStyle_Post LightStyle_Post
// #define FN_DecalIndex_Post DecalIndex_Post
// #define FN_PointContents_Post PointContents_Post
// #define FN_MessageBegin_Post MessageBegin_Post
// #define FN_MessageEnd_Post MessageEnd_Post
// #define FN_WriteByte_Post WriteByte_Post
// #define FN_WriteChar_Post WriteChar_Post
// #define FN_WriteShort_Post WriteShort_Post
// #define FN_WriteLong_Post WriteLong_Post
// #define FN_WriteAngle_Post WriteAngle_Post
// #define FN_WriteCoord_Post WriteCoord_Post
// #define FN_WriteString_Post WriteString_Post
// #define FN_WriteEntity_Post WriteEntity_Post
// #define FN_CVarRegister_Post CVarRegister_Post
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
// #define FN_CVarGetString_Post CVarGetString_Post
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
// #define FN_CVarSetString_Post CVarSetString_Post
// #define FN_AlertMessage_Post AlertMessage_Post
// #define FN_EngineFprintf_Post EngineFprintf_Post
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
// #define FN_SzFromIndex_Post SzFromIndex_Post
// #define FN_AllocString_Post AllocString_Post
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
// #define FN_GetModelPtr_Post GetModelPtr_Post
// #define FN_RegUserMsg_Post RegUserMsg_Post
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
// #define FN_GetBonePosition_Post GetBonePosition_Post
// #define FN_FunctionFromName_Post FunctionFromName_Post
// #define FN_NameForFunction_Post NameForFunction_Post
// #define FN_ClientPrintf_Post ClientPrintf_Post
// #define FN_ServerPrint_Post ServerPrint_Post
// #define FN_Cmd_Args_Post Cmd_Args_Post
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
// #define FN_GetAttachment_Post GetAttachment_Post
// #define FN_CRC32_Init_Post CRC32_Init_Post
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
// #define FN_CRC32_Final_Post CRC32_Final_Post
// #define FN_RandomLong_Post RandomLong_Post
// #define FN_RandomFloat_Post RandomFloat_Post
// #define FN_SetView_Post SetView_Post
// #define FN_Time_Post Time_Post
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
// #define FN_FreeFile_Post FreeFile_Post
// #define FN_EndSection_Post EndSection_Post
// #define FN_CompareFileTime_Post CompareFileTime_Post
// #define FN_GetGameDir_Post GetGameDir_Post
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
// #define FN_SetKeyValue_Post SetKeyValue_Post
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
// #define FN_IsMapValid_Post IsMapValid_Post
// #define FN_StaticDecal_Post StaticDecal_Post
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
// #define FN_SetFatPVS_Post SetFatPVS_Post
// #define FN_SetFatPAS_Post SetFatPAS_Post
// #define FN_CheckVisibility_Post CheckVisibility_Post
// #define FN_DeltaSetField_Post DeltaSetField_Post
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
// #define FN_DeltaFindField_Post DeltaFindField_Post
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
// #define FN_SetGroupMask_Post SetGroupMask_Post
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
// #define FN_AddServerCommand_Post AddServerCommand_Post
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
// #define FN_GameShutdown GameShutdown
// #define FN_ShouldCollide ShouldCollide
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
// #define FN_GameShutdown_Post GameShutdown_Post
// #define FN_ShouldCollide_Post ShouldCollide_Post
#endif // USE_METAMOD
#endif // __MODULECONFIG_H__

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fakemeta", "fakemeta.vcxproj", "{5E393C37-22F2-4CA2-9022-6400DC582447}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5E393C37-22F2-4CA2-9022-6400DC582447}.Debug|Win32.ActiveCfg = Debug|Win32
{5E393C37-22F2-4CA2-9022-6400DC582447}.Debug|Win32.Build.0 = Debug|Win32
{5E393C37-22F2-4CA2-9022-6400DC582447}.Release|Win32.ActiveCfg = Release|Win32
{5E393C37-22F2-4CA2-9022-6400DC582447}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{5E393C37-22F2-4CA2-9022-6400DC582447}</ProjectGuid>
<RootNamespace>fakemeta</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_amxx</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_amxx</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)fakemeta.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(OutDir)fakemeta.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<IgnoreSpecificDefaultLibraries>LIBCMT;</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl\include;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEMETA_EXPORTS;HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(OutDir)fakemeta.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\fakemeta_amxx.cpp" />
<ClCompile Include="..\fm_tr.cpp" />
<ClCompile Include="..\fm_tr2.cpp" />
<ClCompile Include="..\misc.cpp" />
<ClCompile Include="..\pdata.cpp" />
<ClCompile Include="..\dllfunc.cpp" />
<ClCompile Include="..\engfunc.cpp" />
<ClCompile Include="..\pev.cpp" />
<ClCompile Include="..\forward.cpp" />
<ClCompile Include="..\glb.cpp" />
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\fakemeta_amxx.h" />
<ClInclude Include="..\fm_tr.h" />
<ClInclude Include="..\dllfunc.h" />
<ClInclude Include="..\engfunc.h" />
<CustomBuildStep Include="pev.h" />
<ClInclude Include="..\forward.h" />
<ClInclude Include="..\forwardmacros.h" />
<ClInclude Include="..\glb.h" />
<ClInclude Include="..\moduleconfig.h" />
<ClInclude Include="..\sdk\CString.h" />
<ClInclude Include="..\sdk\CVector.h" />
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\plugins\include\fakemeta.inc" />
<None Include="..\..\..\plugins\include\fakemeta_const.inc" />
<None Include="..\..\..\plugins\include\fakemeta_stocks.inc" />
<None Include="..\..\..\plugins\include\hlsdk_const.inc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{bbbfe9e0-f131-4ea2-ab5d-e1e647fe971d}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Engine Funcs">
<UniqueIdentifier>{f9ab36af-ee07-4b74-89c4-241e4368e345}</UniqueIdentifier>
</Filter>
<Filter Include="PEV">
<UniqueIdentifier>{e73c46ee-9f31-4845-9edb-0a99dada88f8}</UniqueIdentifier>
</Filter>
<Filter Include="Forwards">
<UniqueIdentifier>{ac3972cf-c432-4412-958d-6ecba616e88d}</UniqueIdentifier>
</Filter>
<Filter Include="Globals">
<UniqueIdentifier>{14135037-e6ef-477a-914a-d327d205b618}</UniqueIdentifier>
</Filter>
<Filter Include="Module SDK">
<UniqueIdentifier>{8ac4a2a8-af79-4207-ba9c-911de9d010e0}</UniqueIdentifier>
</Filter>
<Filter Include="Module SDK\AMXX STL">
<UniqueIdentifier>{0adc8b80-c155-4485-b120-f53f3d5720d6}</UniqueIdentifier>
</Filter>
<Filter Include="Module SDK\SDK Base">
<UniqueIdentifier>{0344b160-2b56-480c-adda-7cd9f399a546}</UniqueIdentifier>
</Filter>
<Filter Include="Pawn Includes">
<UniqueIdentifier>{65d8835f-89cd-44ab-b2ac-83617ab4d7b3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\fakemeta_amxx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\fm_tr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\fm_tr2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\misc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\pdata.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\dllfunc.cpp">
<Filter>Engine Funcs</Filter>
</ClCompile>
<ClCompile Include="..\engfunc.cpp">
<Filter>Engine Funcs</Filter>
</ClCompile>
<ClCompile Include="..\pev.cpp">
<Filter>PEV</Filter>
</ClCompile>
<ClCompile Include="..\forward.cpp">
<Filter>Forwards</Filter>
</ClCompile>
<ClCompile Include="..\glb.cpp">
<Filter>Globals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
<Filter>Module SDK\SDK Base</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\fakemeta_amxx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\fm_tr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\dllfunc.h">
<Filter>Engine Funcs</Filter>
</ClInclude>
<ClInclude Include="..\engfunc.h">
<Filter>Engine Funcs</Filter>
</ClInclude>
<ClInclude Include="..\forward.h">
<Filter>Forwards</Filter>
</ClInclude>
<ClInclude Include="..\forwardmacros.h">
<Filter>Forwards</Filter>
</ClInclude>
<ClInclude Include="..\glb.h">
<Filter>Globals</Filter>
</ClInclude>
<ClInclude Include="..\sdk\CString.h">
<Filter>Module SDK\AMXX STL</Filter>
</ClInclude>
<ClInclude Include="..\sdk\CVector.h">
<Filter>Module SDK\AMXX STL</Filter>
</ClInclude>
<ClInclude Include="..\moduleconfig.h">
<Filter>Module SDK</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
<Filter>Module SDK\SDK Base</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\plugins\include\fakemeta.inc">
<Filter>Pawn Includes</Filter>
</None>
<None Include="..\..\..\plugins\include\fakemeta_const.inc">
<Filter>Pawn Includes</Filter>
</None>
<None Include="..\..\..\plugins\include\fakemeta_stocks.inc">
<Filter>Pawn Includes</Filter>
</None>
<None Include="..\..\..\plugins\include\hlsdk_const.inc">
<Filter>Pawn Includes</Filter>
</None>
</ItemGroup>
<ItemGroup>
<CustomBuildStep Include="pev.h">
<Filter>PEV</Filter>
</CustomBuildStep>
</ItemGroup>
</Project>

577
modules/fakemeta/pdata.cpp Normal file
View File

@ -0,0 +1,577 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
#if defined PAWN_CELL_SIZE
# if PAWN_CELL_SIZE == 16
# define CELL_MIN SHRT_MIN
# elif PAWN_CELL_SIZE == 32
# define CELL_MIN INT_MIN
# elif PAWN_CELL_SIZE == 64
# define CELL_MIN _I64_MIN
# endif
#else
# define CELL_MIN _I32_MIN
#endif
#if defined WIN32
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#else
//implement these with setjmp later.
bool IsBadReadPtr(void *l, size_t size)
{
return false;
}
bool IsBadWritePtr(void *l, size_t size)
{
return false;
}
#endif
static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[4];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
iOffset += params[4];
else
iOffset += params[5];
#endif
int iValue=params[3];
*((int *)INDEXENT2(index)->pvPrivateData + iOffset) = iValue;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[3];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
iOffset += params[3];
else
iOffset += params[4];
#endif
return *((int *)INDEXENT2(index)->pvPrivateData + iOffset);
}
// Float
static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[4];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
iOffset += params[4];
else
iOffset += params[5];
#endif
float fValue=amx_ctof(params[3]);
*((float *)INDEXENT2(index)->pvPrivateData + iOffset) = fValue;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[3];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
iOffset += params[3];
else
iOffset += params[4];
#endif
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset));
}
static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[6];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 6 || params[7] == CELL_MIN)
iOffset += params[6];
else
iOffset += params[7];
#endif
edict_t *pEdict = INDEXENT2(index);
char *szData;
if (params[5])
{
szData = *((char **)pEdict->pvPrivateData + iOffset);
} else {
szData = (char *)pEdict->pvPrivateData + iOffset;
}
if (IsBadReadPtr(szData, 1))
{
return 0;
}
MF_SetAmxString(amx, params[3], szData, params[4]);
return 1;
}
static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[5];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 5 || params[6] == CELL_MIN)
iOffset += params[5];
else
iOffset += params[6];
#endif
edict_t *pEdict = INDEXENT2(index);
char *szData;
int len;
char *data = MF_GetAmxString(amx, params[3], 0, &len);
if (params[4] == -1)
{
szData = (char *)pEdict->pvPrivateData + iOffset;
if (IsBadWritePtr(szData, 1))
return 0;
strcpy(szData, data);
} else {
szData = *((char **)pEdict->pvPrivateData + iOffset);
if (IsBadWritePtr(szData, 1))
return 0;
if (params[4] == 1)
{
free(szData);
szData = (char *)malloc(len + 1);
} else if (params[4] == 2) {
delete [] szData;
szData = new char[len + 1];
}
strcpy(szData, data);
*((char **)pEdict->pvPrivateData + iOffset) = szData;
}
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
{
int index=params[1];
CHECK_ENTITY(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
#if defined( __linux__ )
iOffset += params[3];
#elif defined( __APPLE__ )
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
iOffset += params[3];
else
iOffset += params[4];
#endif
edict_t *pEdict = *(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + iOffset);
if (pEdict == NULL)
{
return -1;
}
edict_t *pWorld = INDEXENT(0);
int ent = pEdict - pWorld;
if (ent < 0 || ent > gpGlobals->maxEntities)
{
return -2;
}
if (pEdict->free || pEdict->pvPrivateData == NULL)
{
return -1;
}
return ent;
}
static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
int entity = params[3];
CHECK_ENTITY(entity);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + offset) = INDEXENT2(entity);
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[3];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return *(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) ? TRUE : FALSE;
}
static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
bool value = params[3] ? true : false;
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*(bool *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[3];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return static_cast<cell>(*((byte *)INDEXENT2(index)->pvPrivateData + offset));
}
static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
byte value = static_cast<byte>(params[3]);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*((byte *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[3];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
return static_cast<cell>(*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset));
}
static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
short value = static_cast<short>(params[3]);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
*(short *)((char *)INDEXENT2(index)->pvPrivateData + offset) = value;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
cell *cpvec = MF_GetAmxAddr(amx, params[3]);
Vector vec = *(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset);
cpvec[0] = amx_ftoc(vec.x);
cpvec[1] = amx_ftoc(vec.y);
cpvec[2] = amx_ftoc(vec.z);
return 1;
}
static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
cell *pcvec = MF_GetAmxAddr(amx, params[3]);
Vector vec(amx_ctof(pcvec[0]), amx_ctof(pcvec[1]), amx_ctof(pcvec[2]));
*(Vector *)((char *)INDEXENT2(index)->pvPrivateData + offset) = vec;
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
#if defined(__linux__)
offset += params[3];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 3)
offset += params[3];
else
offset += params[4];
#endif
edict_t *pEdict = *(edict_t **)((char * )(INDEXENT2(index)->pvPrivateData) + offset);
if (pEdict == NULL)
{
return -1;
}
edict_t *pWorld = INDEXENT(0);
int ent = pEdict - pWorld;
if (ent < 0 || ent > gpGlobals->maxEntities)
{
return -2;
}
if (pEdict->free || pEdict->pvPrivateData == NULL)
{
return -1;
}
int serialnumber = *(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4);
if (pEdict->serialnumber != serialnumber)
{
return 0;
}
return ent;
}
static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
int offset = params[2];
CHECK_OFFSET(offset);
int entity = params[3];
CHECK_ENTITY(entity);
#if defined(__linux__)
offset += params[4];
#elif defined(__APPLE__)
// Use Linux offset in older plugins
if (params[0] / sizeof(cell) == 4)
offset += params[4];
else
offset += params[5];
#endif
edict_t *pEntity = INDEXENT2(entity);
*(edict_t **)((char* )(INDEXENT2(index)->pvPrivateData) + offset) = pEntity;
if (pEntity)
{
*(int *)((char *)INDEXENT2(index)->pvPrivateData + offset + 4) = pEntity->serialnumber;
}
return 1;
}
AMX_NATIVE_INFO pdata_natives[] =
{
{ "get_pdata_int", get_pdata_int },
{ "set_pdata_int", set_pdata_int },
{ "get_pdata_float", get_pdata_float },
{ "set_pdata_float", set_pdata_float },
{ "set_pdata_string", set_pdata_string },
{ "get_pdata_string", get_pdata_string },
{ "get_pdata_ent", get_pdata_ent },
{ "set_pdata_ent", set_pdata_ent },
{ "get_pdata_bool", get_pdata_bool },
{ "set_pdata_bool", set_pdata_bool },
{ "get_pdata_byte", get_pdata_byte },
{ "set_pdata_byte", set_pdata_byte },
{ "get_pdata_short", get_pdata_short },
{ "set_pdata_short", set_pdata_short },
{ "get_pdata_vector", get_pdata_vector },
{ "set_pdata_vector", set_pdata_vector },
{ "get_pdata_ehandle", get_pdata_ehandle },
{ "set_pdata_ehandle", set_pdata_ehandle },
{ NULL, NULL }
};

484
modules/fakemeta/pev.cpp Normal file
View File

@ -0,0 +1,484 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#include "fakemeta_amxx.h"
/** Optimizations for Fakemeta. In the end we'll do this for other things too.
*/
static int g_offset_table[pev_absolute_end] = {-1};
#define DO_OFFSET(offs) g_offset_table[offs] = offsetof(entvars_t, offs)
#define DO_OFFSET_R(named, real, offs) g_offset_table[named] = offsetof(entvars_t, real) + offs
void initialze_offsets()
{
DO_OFFSET(fixangle);
DO_OFFSET(modelindex);
DO_OFFSET(viewmodel);
DO_OFFSET(weaponmodel);
DO_OFFSET(movetype);
DO_OFFSET(solid);
DO_OFFSET(skin);
DO_OFFSET(body);
DO_OFFSET(effects);
DO_OFFSET(light_level);
DO_OFFSET(sequence);
DO_OFFSET(gaitsequence);
DO_OFFSET(rendermode);
DO_OFFSET(renderfx);
DO_OFFSET(weapons);
DO_OFFSET(deadflag);
DO_OFFSET(button);
DO_OFFSET(impulse);
DO_OFFSET(spawnflags);
DO_OFFSET(flags);
DO_OFFSET(colormap);
DO_OFFSET(team);
DO_OFFSET(waterlevel);
DO_OFFSET(watertype);
DO_OFFSET(playerclass);
DO_OFFSET(weaponanim);
DO_OFFSET(pushmsec);
DO_OFFSET(bInDuck);
DO_OFFSET(flTimeStepSound);
DO_OFFSET(flSwimTime);
DO_OFFSET(flDuckTime);
DO_OFFSET(iStepLeft);
DO_OFFSET(gamestate);
DO_OFFSET(oldbuttons);
DO_OFFSET(groupinfo);
DO_OFFSET(iuser1);
DO_OFFSET(iuser2);
DO_OFFSET(iuser3);
DO_OFFSET(iuser4);
DO_OFFSET(impacttime);
DO_OFFSET(starttime);
DO_OFFSET(idealpitch);
DO_OFFSET(ideal_yaw);
DO_OFFSET(pitch_speed);
DO_OFFSET(yaw_speed);
DO_OFFSET(ltime);
DO_OFFSET(nextthink);
DO_OFFSET(gravity);
DO_OFFSET(friction);
DO_OFFSET(frame);
DO_OFFSET(animtime);
DO_OFFSET(framerate);
DO_OFFSET(scale);
DO_OFFSET(renderamt);
DO_OFFSET(health);
DO_OFFSET(frags);
DO_OFFSET(takedamage);
DO_OFFSET(max_health);
DO_OFFSET(teleport_time);
DO_OFFSET(armortype);
DO_OFFSET(armorvalue);
DO_OFFSET(dmg_take);
DO_OFFSET(dmg_save);
DO_OFFSET(dmg);
DO_OFFSET(dmgtime);
DO_OFFSET(speed);
DO_OFFSET(air_finished);
DO_OFFSET(pain_finished);
DO_OFFSET(radsuit_finished);
DO_OFFSET(maxspeed);
DO_OFFSET(fov);
DO_OFFSET(flFallVelocity);
DO_OFFSET(fuser1);
DO_OFFSET(fuser2);
DO_OFFSET(fuser3);
DO_OFFSET(fuser4);
DO_OFFSET(classname);
DO_OFFSET(globalname);
DO_OFFSET(model);
DO_OFFSET(target);
DO_OFFSET(targetname);
DO_OFFSET(netname);
DO_OFFSET(message);
DO_OFFSET(noise);
DO_OFFSET(noise1);
DO_OFFSET(noise2);
DO_OFFSET(noise3);
DO_OFFSET(chain);
DO_OFFSET(dmg_inflictor);
DO_OFFSET(enemy);
DO_OFFSET(aiment);
DO_OFFSET(owner);
DO_OFFSET(groundentity);
DO_OFFSET(euser1);
DO_OFFSET(euser2);
DO_OFFSET(euser3);
DO_OFFSET(euser4);
DO_OFFSET(origin);
DO_OFFSET(oldorigin);
DO_OFFSET(velocity);
DO_OFFSET(basevelocity);
DO_OFFSET(clbasevelocity);
DO_OFFSET(movedir);
DO_OFFSET(angles);
DO_OFFSET(avelocity);
DO_OFFSET(v_angle);
DO_OFFSET(endpos);
DO_OFFSET(startpos);
DO_OFFSET(absmin);
DO_OFFSET(absmax);
DO_OFFSET(mins);
DO_OFFSET(maxs);
DO_OFFSET(size);
DO_OFFSET(rendercolor);
DO_OFFSET(view_ofs);
DO_OFFSET(vuser1);
DO_OFFSET(vuser2);
DO_OFFSET(vuser3);
DO_OFFSET(vuser4);
DO_OFFSET(punchangle);
DO_OFFSET(controller);
DO_OFFSET_R(controller_0, controller, 0);
DO_OFFSET_R(controller_1, controller, 1);
DO_OFFSET_R(controller_2, controller, 2);
DO_OFFSET_R(controller_3, controller, 3);
DO_OFFSET(blending);
DO_OFFSET_R(blending_0, blending, 0);
DO_OFFSET_R(blending_1, blending, 1);
DO_OFFSET_R(pev_weaponmodel2, weaponmodel, 0);
DO_OFFSET_R(pev_viewmodel2, viewmodel, 0);
DO_OFFSET(pContainingEntity);
}
#define EDICT_OFFS(v,o) ((char *)v + o)
// originally by mahnsawce
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
{
int index = params[1];
CHECK_ENTITY(index);
edict_t *pEdict = INDEXENT2(index);
int iSwitch = params[2];
//onto normal cases - sanity check
if (iSwitch <= pev_string_start || iSwitch >= pev_absolute_end)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
int offs = g_offset_table[iSwitch];
//sanity check #2
if (offs == -1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
enum
{
Ret_Int = (1<<0),
Ret_Float = (1<<1),
Ret_Vec = (1<<2),
Ret_ByteArray = (1<<3),
Ret_String = (1<<4),
Ret_Edict = (1<<5),
Ret_Bytes2 = (1<<6),
Ret_Bytes4 = (1<<7)
};
union
{
int i;
float f;
byte b;
string_t s;
byte ba[4];
} rets;
Vector vr;
int ValType = 0;
entvars_t *v = &(pEdict->v);
//get primitive data types
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
{
rets.i = *(int *)EDICT_OFFS(v, offs);
ValType = Ret_Int;
} else if (iSwitch > pev_float_start && iSwitch < pev_float_end) {
rets.f = *(float *)EDICT_OFFS(v, offs);
ValType = Ret_Float;
} else if (iSwitch > pev_vecarray_start && iSwitch < pev_vecarray_end) {
vr = *(vec3_t *)EDICT_OFFS(v, offs);
ValType = Ret_Vec;
} else if (iSwitch > pev_bytearray_start && iSwitch < pev_bytearray_end) {
if (iSwitch == controller)
{
rets.ba[0] = v->controller[0];
rets.ba[1] = v->controller[1];
rets.ba[2] = v->controller[2];
rets.ba[3] = v->controller[3];
ValType = Ret_Bytes4;
} else {
rets.ba[0] = v->blending[0];
rets.ba[1] = v->blending[1];
ValType = Ret_Bytes2;
}
} else if (iSwitch > pev_byte_start && iSwitch < pev_byte_end) {
rets.b = *(byte *)EDICT_OFFS(v, offs);
ValType = Ret_Int;
} else if ( (iSwitch > pev_string_start && iSwitch < pev_string_end)
|| (iSwitch > pev_string2_begin && iSwitch < pev_string2_end) ) {
rets.s = *(string_t *)EDICT_OFFS(v, offs);
ValType = Ret_String;
} else if ( (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|| (iSwitch > pev_edict2_start && iSwitch < pev_absolute_end) ) {
edict_t *e = *(edict_t **)EDICT_OFFS(v, offs);
rets.i = ENTINDEX(e);
ValType = Ret_Int;
ValType |= Ret_Edict;
}
size_t count = params[0] / sizeof(cell) - 2;
if (count == 0)
{
//return an int
if (ValType & Ret_Int)
{
return rets.i;
} else if (ValType == Ret_Float) {
return (cell)rets.f;
} else if (ValType == Ret_String) {
return (cell)rets.s;
} else {
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
return 0;
}
} else if (count == 1) {
//return a byref float - usually
cell *addr = MF_GetAmxAddr(amx, params[3]);
if (ValType == Ret_Float)
{
*addr = amx_ftoc(rets.f);
} else if (ValType == Ret_Int) {
REAL f = (REAL)rets.i;
*addr = amx_ftoc(f);
} else if (ValType == Ret_Vec) {
addr[0] = amx_ftoc(vr.x);
addr[1] = amx_ftoc(vr.y);
addr[2] = amx_ftoc(vr.z);
} else if (ValType == Ret_Bytes2) {
addr[0] = rets.ba[0];
addr[1] = rets.ba[1];
} else if (ValType == Ret_Bytes4) {
addr[0] = rets.ba[0];
addr[1] = rets.ba[1];
addr[2] = rets.ba[2];
addr[3] = rets.ba[3];
} else {
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
return 0;
}
return 1;
} else if (count == 2) {
cell size = *(MF_GetAmxAddr(amx, params[4]));
if (ValType == Ret_String)
{
const char *str = STRING(rets.s);
if (!str)
str = "";
int num = MF_SetAmxString(amx, params[3], str, size);
return num;
} else if (ValType & Ret_Int) {
char temp[32];
UTIL_Format(temp, sizeof(temp)-1, "%d", rets.i);
return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Float) {
char temp[32];
UTIL_Format(temp, sizeof(temp)-1, "%f", rets.f);
return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Vec) {
char temp[32];
UTIL_Format(temp, sizeof(temp)-1, "%f %f %f", vr.x, vr.y, vr.z);
return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Bytes2) {
char temp[32];
UTIL_Format(temp, sizeof(temp)-1, "%d %d", rets.ba[0], rets.ba[1]);
return MF_SetAmxString(amx, params[3], temp, size);
} else if (ValType == Ret_Bytes4) {
char temp[32];
UTIL_Format(temp, sizeof(temp)-1, "%d %d %d %d", rets.ba[0], rets.ba[1], rets.ba[2], rets.ba[3]);
return MF_SetAmxString(amx, params[3], temp, size);
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
} else if (count == 3) {
cell size = *(MF_GetAmxAddr(amx, params[5]));
if (ValType == Ret_String)
{
const char *str = STRING(rets.s);
cell *addr = MF_GetAmxAddr(amx, params[3]);
*addr = (cell)rets.s;
if (!str)
str = "";
int num = MF_SetAmxString(amx, params[4], str, size);
return num;
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}
//if we got here, something happened
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown pev index or return combination %d", iSwitch);
return 0;
}
static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
{
// index, pevdata
int index = params[1];
CHECK_ENTITY(index);
edict_t *pEdict = INDEXENT2(index);
int iSwitch = params[2];
//onto normal cases - sanity check
if (iSwitch <= pev_string_start || iSwitch >= pev_absolute_end)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
int offs = g_offset_table[iSwitch];
//sanity check #2
if (offs == -1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
cell *blah = MF_GetAmxAddr(amx,params[3]);
entvars_t *v = &(pEdict->v);
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
{
*(int *)EDICT_OFFS(v, offs) = (int)*blah;
} else if (iSwitch > pev_float_start && iSwitch < pev_float_end) {
*(float *)EDICT_OFFS(v, offs) = (float)amx_ctof(blah[0]);
} else if ( (iSwitch > pev_string_start && iSwitch < pev_string_end)
|| (iSwitch > pev_string2_begin && iSwitch < pev_string2_end) ) {
int len;
char *string = MF_GetAmxString(amx, params[3], 0, &len);
string_t value = ALLOC_STRING(string);
*(string_t *)EDICT_OFFS(v, offs) = value;
} else if ( (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|| (iSwitch > pev_edict2_start && iSwitch < pev_absolute_end) ) {
edict_t *e = INDEXENT((int)*blah);
*(edict_t **)EDICT_OFFS(v, offs) = e;
} else if (iSwitch > pev_vecarray_start && iSwitch < pev_vecarray_end) {
vec3_t vec;
vec[0] = amx_ctof(blah[0]);
vec[1] = amx_ctof(blah[1]);
vec[2] = amx_ctof(blah[2]);
*(vec3_t *)EDICT_OFFS(v, offs) = vec;
} else if (iSwitch > pev_byte_start && iSwitch < pev_byte_end) {
byte b = static_cast<byte>(blah[0]);
*(byte *)EDICT_OFFS(v, offs) = b;
} else if (iSwitch > pev_bytearray_start && iSwitch < pev_bytearray_end) {
switch(iSwitch)
{
case controller:
pEdict->v.controller[0]=blah[0];
pEdict->v.controller[1]=blah[1];
pEdict->v.controller[2]=blah[2];
pEdict->v.controller[3]=blah[3];
return 1;
case blending:
pEdict->v.blending[0]=blah[0];
pEdict->v.blending[1]=blah[1];
return 1;
}
}
return 0;
}
static cell AMX_NATIVE_CALL amx_set_pev_string(AMX *amx, cell *params)
{
// index, pevdata
int index = params[1];
CHECK_ENTITY(index);
edict_t *pEdict = INDEXENT2(index);
int iSwitch = params[2];
//onto normal cases - sanity check
if (iSwitch <= pev_string_start || iSwitch >= pev_absolute_end)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
int offs = g_offset_table[iSwitch];
//sanity check #2
if (offs == -1)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Undefined pev index: %d", iSwitch);
return 0;
}
entvars_t *v = &(pEdict->v);
if ( (iSwitch > pev_string_start && iSwitch < pev_string_end)
|| (iSwitch > pev_string2_begin && iSwitch < pev_string2_end) )
{
*(string_t *)EDICT_OFFS(v, offs) = params[3];
}
else
{
MF_LogError(amx, AMX_ERR_NATIVE, "Non-string field passed to set_pev_string!");
return 0;
}
return 0;
}
static cell AMX_NATIVE_CALL amx_pev_valid(AMX *amx, cell *params)
{
int idx = static_cast<int>(params[1]);
edict_t *e = INDEXENT(idx);
if (FNullEnt(e))
return 0;
if (e->pvPrivateData)
return 2;
return 1;
}
static cell AMX_NATIVE_CALL amx_pev_serial(AMX* amx, cell* params)
{
int id = static_cast<int>(params[1]);
CHECK_ENTITY(id);
edict_t* ent = INDEXENT(id);
return ent->serialnumber;
}
AMX_NATIVE_INFO pev_natives[] = {
{ "pev", amx_pev },
{ "set_pev", amx_set_pev },
{ "set_pev_string", amx_set_pev_string },
{ "pev_valid", amx_pev_valid },
{ "pev_serial", amx_pev_serial },
{NULL, NULL},
};

173
modules/fakemeta/pev.h Normal file
View File

@ -0,0 +1,173 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Fakemeta Module
//
#ifndef _INCLUDE_PEV_H
#define _INCLUDE_PEV_H
enum pev_pointers
{
pev_string_start = 0,
classname,
globalname,
model,
target,
targetname,
netname,
message,
noise,
noise1,
noise2,
noise3,
pev_string_end,
pev_edict_start,
chain,
dmg_inflictor,
enemy,
aiment,
owner,
groundentity,
euser1,
euser2,
euser3,
euser4,
pev_edict_end,
pev_float_start,
impacttime,
starttime,
idealpitch,
ideal_yaw,
pitch_speed,
yaw_speed,
ltime,
nextthink,
gravity,
friction,
frame,
animtime,
framerate,
scale,
renderamt,
health,
frags,
takedamage,
max_health,
teleport_time,
armortype,
armorvalue,
dmg_take,
dmg_save,
dmg,
dmgtime,
speed,
air_finished,
pain_finished,
radsuit_finished,
maxspeed,
fov,
flFallVelocity,
fuser1,
fuser2,
fuser3,
fuser4,
pev_float_end,
pev_int_start,
fixangle,
modelindex,
viewmodel,
weaponmodel,
movetype,
solid,
skin,
body,
effects,
light_level,
sequence,
gaitsequence,
rendermode,
renderfx,
weapons,
deadflag,
button,
impulse,
spawnflags,
flags,
colormap,
team,
waterlevel,
watertype,
playerclass,
weaponanim,
pushmsec,
bInDuck,
flTimeStepSound,
flSwimTime,
flDuckTime,
iStepLeft,
gamestate,
oldbuttons,
groupinfo,
iuser1,
iuser2,
iuser3,
iuser4,
pev_int_end,
pev_byte_start,
controller_0,
controller_1,
controller_2,
controller_3,
blending_0,
blending_1,
pev_byte_end,
pev_bytearray_start,
controller,
blending,
pev_bytearray_end,
pev_vecarray_start,
origin,
oldorigin,
velocity,
basevelocity,
clbasevelocity,
movedir,
angles,
avelocity,
v_angle,
endpos,
startpos,
absmin,
absmax,
mins,
maxs,
size,
rendercolor,
view_ofs,
vuser1,
vuser2,
vuser3,
vuser4,
punchangle,
pev_vecarray_end,
pev_string2_begin, /* anything after here are string corrections */
pev_weaponmodel2,
pev_viewmodel2,
pev_string2_end,
pev_edict2_start, /* edict corrections */
pContainingEntity,
pev_absolute_end
};
void initialze_offsets();
#endif //_INCLUDE_PEV_H

101
modules/fakemeta/version.rc Normal file
View File

@ -0,0 +1,101 @@
// Microsoft Visual C++ generated resource script.
//
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <winresrc.h>
#include <moduleconfig.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION AMXX_VERSION_FILE
PRODUCTVERSION AMXX_VERSION_FILE
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "AMX Mod X"
VALUE "FileDescription", "AMX Mod X"
VALUE "FileVersion", AMXX_VERSION
VALUE "InternalName", MODULE_LIBRARY
VALUE "LegalCopyright", "Copyright (c) AMX Mod X Dev Team"
VALUE "OriginalFilename", MODULE_LIBRARY "_amxx.dll"
VALUE "ProductName", MODULE_NAME
VALUE "ProductVersion", AMXX_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED