Fixed inhook bug.
Fixed entity_set_size bug. Switched non-blocking forwards to POST.
This commit is contained in:
parent
42ff533d65
commit
d17945c087
@ -120,9 +120,24 @@ void ServerDeactivate()
|
||||
memset(glinfo.szRealLights, 0x0, 128);
|
||||
glinfo.bLights = false;
|
||||
glinfo.fNextLights = 0;
|
||||
Msg.clear();
|
||||
register int i = 0;
|
||||
for (i=0; i<256; i++) {
|
||||
msgHooks[i] = 0;
|
||||
msgBlocks[i] = 0;
|
||||
}
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
Msg.clear();
|
||||
register int i = 0;
|
||||
for (i=0; i<256; i++) {
|
||||
msgHooks[i] = 0;
|
||||
msgBlocks[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LightStyle(int style, char *val) {
|
||||
|
@ -1319,15 +1319,15 @@ static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
|
||||
edict_t *pEnt = INDEXENT(iEnt);
|
||||
|
||||
cell *cMin = MF_GetAmxAddr(amx, params[2]);
|
||||
REAL x1 = amx_ftoc(cMin[0]);
|
||||
REAL y1 = amx_ftoc(cMin[1]);
|
||||
REAL z1 = amx_ftoc(cMin[2]);
|
||||
REAL x1 = amx_ctof(cMin[0]);
|
||||
REAL y1 = amx_ctof(cMin[1]);
|
||||
REAL z1 = amx_ctof(cMin[2]);
|
||||
Vector vMin = Vector(x1, y1, z1);
|
||||
|
||||
cell *cMax = MF_GetAmxAddr(amx, params[3]);
|
||||
REAL x2 = amx_ftoc(cMax[0]);
|
||||
REAL y2 = amx_ftoc(cMax[1]);
|
||||
REAL z2 = amx_ftoc(cMax[2]);
|
||||
REAL x2 = amx_ctof(cMax[0]);
|
||||
REAL y2 = amx_ctof(cMax[1]);
|
||||
REAL z2 = amx_ctof(cMax[2]);
|
||||
Vector vMax = Vector(x2, y2, z2);
|
||||
|
||||
UTIL_SetSize(pEnt, vMin, vMax);
|
||||
|
@ -28,13 +28,13 @@ void DispatchUse(edict_t *pentUsed, edict_t *pentOther)
|
||||
}
|
||||
|
||||
int DispatchSpawn(edict_t *pEntity) {
|
||||
/* if (SpawnForward) {
|
||||
if (SpawnForward) {
|
||||
int retVal = 0;
|
||||
int id = ENTINDEX(pEntity);
|
||||
retVal = MF_ExecuteForward(SpawnForward, id);
|
||||
if (retVal)
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, 0);
|
||||
}*/
|
||||
}
|
||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ void KeyValue(edict_t *pEntity, KeyValueData *pkvd)
|
||||
}
|
||||
#endif
|
||||
|
||||
void StartFrame()
|
||||
void StartFrame_Post()
|
||||
{
|
||||
if (glinfo.bCheckLights) {
|
||||
if (!FStrEq((const char*)glinfo.szLastLights, "")) {
|
||||
@ -139,23 +139,15 @@ void ClientKill(edict_t *pEntity)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void PlayerPreThink(edict_t *pEntity)
|
||||
void PlayerPreThink_Post(edict_t *pEntity)
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
if (pfnTouchForward) {
|
||||
retVal = MF_ExecuteForward(PlayerPreThinkForward, ENTINDEX(pEntity));
|
||||
if (retVal)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
MF_ExecuteForward(PlayerPreThinkForward, ENTINDEX(pEntity));
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void PlayerPostThink(edict_t *pEntity)
|
||||
void PlayerPostThink_Post(edict_t *pEntity)
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
if(plinfo[ENTINDEX(pEntity)].pViewEnt) {
|
||||
edict_t *pCamEnt = plinfo[ENTINDEX(pEntity)].pViewEnt;
|
||||
|
||||
@ -193,11 +185,7 @@ void PlayerPostThink(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
if (pfnTouchForward) {
|
||||
retVal = MF_ExecuteForward(PlayerPostThinkForward, ENTINDEX(pEntity));
|
||||
if (retVal)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
MF_ExecuteForward(PlayerPostThinkForward, ENTINDEX(pEntity));
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
@ -215,15 +203,9 @@ void DispatchTouch(edict_t *pToucher, edict_t *pTouched)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void DispatchThink(edict_t *pent)
|
||||
void DispatchThink_Post(edict_t *pent)
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
if (pfnThinkForward) {
|
||||
retVal = MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent));
|
||||
if (retVal)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
MF_ExecuteForward(pfnThinkForward, ENTINDEX(pent));
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
#include "messages.h"
|
||||
#include "engine.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
std::vector<argMsg*> Msg;
|
||||
int msgHooks[256] = {0};
|
||||
int msgBlocks[256] = {0};
|
||||
int msgDest;
|
||||
int msgType;
|
||||
float *msgOrigin;
|
||||
edict_t *msgpEntity;
|
||||
int msgHooks[256] = {0};
|
||||
int msgBlocks[256] = {0};
|
||||
bool inhook = false;
|
||||
bool inblock = false;
|
||||
unsigned int msgCount = 0;
|
||||
@ -278,9 +278,8 @@ void MessageEnd(void)
|
||||
msgBlocks[msgType] = BLOCK_NOT;
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
} else if (inhook) {
|
||||
inhook = false;
|
||||
mres = MF_ExecuteForward(msgHooks[msgType], msgType, msgDest, ENTINDEX(msgpEntity));
|
||||
MF_Log("Executing forward: %d with retval %d", msgHooks[msgType], mres);
|
||||
inhook = false;
|
||||
if (mres & 1)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
MESSAGE_BEGIN(msgDest, msgType, msgOrigin, msgpEntity);
|
||||
@ -300,7 +299,7 @@ static cell AMX_NATIVE_CALL register_message(AMX *amx, cell *params)
|
||||
int len;
|
||||
if (params[1]>0 && params[1] < 256) {
|
||||
int id = MF_RegisterSPForwardByName(amx, MF_GetAmxString(amx, params[2], 0, &len), FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||
MF_Log("Registering message %d with result %d", params[1], id);
|
||||
// MF_Log("Registering message %d with result %d", params[1], id);
|
||||
msgHooks[params[1]] = id;
|
||||
return id;
|
||||
}
|
||||
@ -342,59 +341,59 @@ static cell AMX_NATIVE_CALL get_msg_args(AMX *amx, cell *params)
|
||||
|
||||
static cell AMX_NATIVE_CALL get_msg_argtype(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Msg[argn-1]->Type();
|
||||
return Msg[argn]->Type();
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iVal = Msg[argn-1]->iData;
|
||||
int iVal = Msg[argn]->iData;
|
||||
|
||||
return iVal;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Msg[argn-1]->iData = params[2];
|
||||
Msg[argn]->iData = params[2];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_msg_arg_float(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return amx_ftoc(Msg[argn-1]->fData);
|
||||
return amx_ftoc(Msg[argn]->fData);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
@ -403,28 +402,28 @@ static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
|
||||
|
||||
REAL fVal = amx_ctof(params[2]);
|
||||
|
||||
Msg[argn-1]->fData = fVal;
|
||||
Msg[argn]->fData = fVal;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *szVal = Msg[argn-1]->cData.c_str();
|
||||
const char *szVal = Msg[argn]->cData.c_str();
|
||||
|
||||
return MF_SetAmxString(amx, params[2], szVal, params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_msg_arg_string(AMX *amx, cell *params)
|
||||
{
|
||||
unsigned int argn = params[1];
|
||||
unsigned int argn = params[1]-1;
|
||||
int iLen;
|
||||
|
||||
if (!inhook || argn >= Msg.size()) {
|
||||
@ -434,7 +433,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_string(AMX *amx, cell *params)
|
||||
|
||||
char *szVal = MF_GetAmxString(amx, params[2], 0, &iLen);
|
||||
|
||||
Msg[argn-1]->cData.assign(szVal);
|
||||
Msg[argn]->cData.assign(szVal);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -41,5 +41,8 @@ public:
|
||||
};
|
||||
|
||||
extern AMX_NATIVE_INFO msg_Natives[];
|
||||
extern std::vector<argMsg*> Msg;
|
||||
extern int msgHooks[256];
|
||||
extern int msgBlocks[256];
|
||||
|
||||
#endif //_MSGS_INCLUDE_H
|
@ -55,7 +55,7 @@
|
||||
// - GetEntityAPI2 functions
|
||||
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
|
||||
#define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
|
||||
#define FN_DispatchThink DispatchThink /* pfnThink() */
|
||||
//#define FN_DispatchThink DispatchThink /* pfnThink() */
|
||||
#define FN_DispatchUse DispatchUse /* pfnUse() */
|
||||
#define FN_DispatchTouch DispatchTouch /* pfnTouch() */
|
||||
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
||||
@ -74,11 +74,11 @@
|
||||
// #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_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_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" */
|
||||
@ -107,7 +107,7 @@
|
||||
// - GetEntityAPI2_Post functions
|
||||
// #define FN_GameDLLInit_Post GameDLLInit_Post
|
||||
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
|
||||
// #define FN_DispatchThink_Post DispatchThink_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
|
||||
@ -128,9 +128,9 @@
|
||||
// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
|
||||
// #define FN_ServerActivate_Post ServerActivate_Post
|
||||
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
|
||||
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
|
||||
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
|
||||
// #define FN_StartFrame_Post StartFrame_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
|
||||
|
Loading…
Reference in New Issue
Block a user