From b40f5e6637959be721f0751c07d116c0ecdb8e2d Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Fri, 19 May 2006 06:01:55 +0000 Subject: [PATCH] request at29928 New callable engine function: AlertMessage --- dlls/fakemeta/dllfunc.h | 2 +- dlls/fakemeta/engfunc.cpp | 7 +++++++ dlls/fakemeta/engfunc.h | 3 ++- plugins/include/fakemeta.inc | 2 +- plugins/include/fakemeta_const.inc | 15 +++++++++++++-- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/dlls/fakemeta/dllfunc.h b/dlls/fakemeta/dllfunc.h index 21c8d2e1..e581237f 100755 --- a/dlls/fakemeta/dllfunc.h +++ b/dlls/fakemeta/dllfunc.h @@ -52,7 +52,7 @@ enum 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 ) (idplayer) + 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 diff --git a/dlls/fakemeta/engfunc.cpp b/dlls/fakemeta/engfunc.cpp index 7237d3ff..835c1ddb 100755 --- a/dlls/fakemeta/engfunc.cpp +++ b/dlls/fakemeta/engfunc.cpp @@ -1054,6 +1054,13 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params) temp = (*g_engfuncs.pfnGetInfoKeyBuffer)((index == -1) ? NULL : INDEXENT2(index)); return reinterpret_cast(temp); + case EngFunc_AlertMessage: // void ) (ALERT_TYPE atype, char *szFmt, ...); + cRet = MF_GetAmxAddr(amx, params[2]); + iparam1 = cRet[0]; + temp = MF_FormatAmxString(amx, params, 3, &len); + + (*g_engfuncs.pfnAlertMessage)(static_cast(iparam1), temp); + return 1; default: MF_LogError(amx, AMX_ERR_NATIVE, "Unknown engfunc type %d", type); return 0; diff --git a/dlls/fakemeta/engfunc.h b/dlls/fakemeta/engfunc.h index 94d7a8d3..96393142 100755 --- a/dlls/fakemeta/engfunc.h +++ b/dlls/fakemeta/engfunc.h @@ -79,7 +79,8 @@ enum { 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_GetInfoKeyBuffer, // char*) (edict_t *e); + EngFunc_AlertMessage // void ) (ALERT_TYPE atype, char *szFmt, ...); }; #endif //_ENGFUNC_INCLUDE_H diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index a51811e0..1b0dcf69 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -71,7 +71,7 @@ native forward_return(type,{Float,Sql,Result,_}:...); */ native get_orig_retval({Float,_}:...) -native engfunc(type,{Float,Sql,Result,_}:...); +native engfunc(type,{Float,Sql,Result,AlertType,_}:...); native dllfunc(type,{Float,Sql,Result,_}:...); //only use this with functions that pass a Trace diff --git a/plugins/include/fakemeta_const.inc b/plugins/include/fakemeta_const.inc index cd4a2877..81ad3d9c 100755 --- a/plugins/include/fakemeta_const.inc +++ b/plugins/include/fakemeta_const.inc @@ -116,7 +116,8 @@ enum { EngFunc_CreateInstBaseline, // int ) (int classname, struct entity_state_s *baseline); // Returns pointer to info buffer that can be used with the infobuffer param of InfoKeyValue, SetKeyValue, and SetClientKeyValue - EngFunc_GetInfoKeyBuffer // char*) (edict_t *e); + EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e); + EngFunc_AlertMessage // void ) (ALERT_TYPE atype, char *szFmt, ...); }; /* Used with dllfunc() @@ -172,7 +173,7 @@ enum 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 ) (idplayer) + DLLFunc_ClientUserInfoChanged, // void ) (edict *pEntity, char *infobuffer); // You can pass in 0 for global cd handle or another cd 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 @@ -726,3 +727,13 @@ enum UserCmd UC_ImpactIndex, // int UC_ImpactPosition // float array[3] }; + +enum AlertType +{ + at_notice = 0, + at_console, // same as at_notice, but forces a ConPrintf, not a message box + at_aiconsole, // same as at_console, but only shown if developer level is 2! + at_warning, + at_error, + at_logged // Server print to console (only in multiplayer games) +};