request at29928

New callable engine function: AlertMessage
This commit is contained in:
Scott Ehlert 2006-05-19 06:01:55 +00:00
parent e0bed163ac
commit b40f5e6637
5 changed files with 24 additions and 5 deletions

View File

@ -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

View File

@ -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<cell>(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<ALERT_TYPE>(iparam1), temp);
return 1;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown engfunc type %d", type);
return 0;

View File

@ -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

View File

@ -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

View File

@ -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)
};