Added AlertMessage to fakemeta

This commit is contained in:
David Anderson 2004-10-03 07:04:08 +00:00
parent ef90960121
commit f3cfd31668
5 changed files with 42 additions and 23 deletions

View File

@ -153,9 +153,11 @@ void LogEventsMngr::executeLogEvents()
{
int err;
bool valid;
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next){
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next)
{
valid = true;
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next){
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next)
{
valid = false;
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
@ -163,27 +165,15 @@ void LogEventsMngr::executeLogEvents()
break;
}
}
if (!valid) break;
if (!valid)
break;
}
#ifdef ENABLEEXEPTIONS
try
if (valid)
{
#endif
if (valid){
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
LogError(a->plugin->getAMX(), err, "");
}
#ifdef ENABLEEXEPTIONS
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
LogError(a->plugin->getAMX(), err, "");
}
catch( ... )
{
AMXXLOG_Log( "[AMXX] fatal error at log forward function execution");
}
#endif
}
}

View File

@ -281,7 +281,7 @@ int C_Spawn( edict_t *pent ) {
FF_ClientPutInServer = registerForward("client_putinserver", ET_IGNORE, FP_CELL, FP_DONE);
FF_PluginCfg = registerForward("plugin_cfg", ET_IGNORE, FP_DONE);
FF_PluginPrecache = registerForward("plugin_precache", ET_IGNORE, FP_DONE);
FF_PluginLog = registerForward("plugin_log", ET_IGNORE, FP_DONE);
FF_PluginLog = registerForward("plugin_log", ET_STOP, FP_DONE);
FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE);
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
@ -985,7 +985,9 @@ void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
g_logevents.parseLogString( );
if (g_logevents.logEventsExist())
g_logevents.executeLogEvents( );
executeForwards(FF_PluginLog);
cell retVal = executeForwards(FF_PluginLog);
if (retVal)
RETURN_META(MRES_HANDLED);
}
RETURN_META(MRES_IGNORED);

View File

@ -111,6 +111,28 @@ void TraceLine_post(const float *v1, const float *v2, int fNoMonsters, edict_t *
RETURN_META(MRES_IGNORED);
}
void AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
{
static char buf[2048];
va_list ap;
va_start(ap, szFmt);
vsprintf(buf, szFmt, ap);
va_end(ap);
FM_ENG_HANDLE(FM_AlertMessage, (Engine[FM_AlertMessage].at(i), atype, buf));
RETURN_META(mswi(lastFmRes));
}
void AlertMessage_post(ALERT_TYPE atype, char *szFmt, ...)
{
static char buf[2048];
va_list ap;
va_start(ap, szFmt);
vsprintf(buf, szFmt, ap);
va_end(ap);
FM_ENG_HANDLE(FM_AlertMessage, (Engine[FM_AlertMessage].at(i), atype, buf));
RETURN_META(MRES_IGNORED);
}
// pfnModelIndex
SIMPLE_INT_HOOK_CONSTSTRING(ModelIndex);
@ -872,7 +894,10 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
ENGHOOK(IsMapValid);
break;
case FM_AlertMessage:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
ENGHOOK(AlertMessage);
break;
/*
* Begin of DLLFuncs

View File

@ -1,7 +1,7 @@
#ifndef _INCLUDE_FORWARD_H
#define _INCLUDE_FORWARD_H
#define ENGFUNC_NUM 108
#define ENGFUNC_NUM 118
#define FMV_STRING 1
#define FMV_FLOAT 2
@ -148,6 +148,7 @@ enum {
// Create baselines for certain "unplaced" items.
FM_CreateInstancedBaselines, // done
FM_AllowLagCompensation, // done
FM_AlertMessage,
};
extern CVector<int> Engine[];

View File

@ -436,6 +436,7 @@ enum {
// Create baselines for certain "unplaced" items.
FM_CreateInstancedBaseline, // done
FM_AllowLagCompensation, // done
FM_AlertMessage, //done (at_type, message[])
};
enum TraceResult