From 897ed0cb10cf8713a06f7a3b4738bd65f5d1f8e9 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Mon, 30 Apr 2007 18:29:33 +0000 Subject: [PATCH] Implemented request amb237 - added ServerPrint to Fakemeta --- dlls/fakemeta/engfunc.cpp | 5 +++++ dlls/fakemeta/engfunc.h | 3 ++- dlls/fakemeta/forward.cpp | 6 ++++++ dlls/fakemeta/forward.h | 1 + plugins/include/fakemeta_const.inc | 10 +++++++--- plugins/include/fakemeta_stocks.inc | 2 ++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/dlls/fakemeta/engfunc.cpp b/dlls/fakemeta/engfunc.cpp index 0d733026..9dbd108f 100755 --- a/dlls/fakemeta/engfunc.cpp +++ b/dlls/fakemeta/engfunc.cpp @@ -1072,6 +1072,11 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params) (*g_engfuncs.pfnClientPrintf)(INDEXENT2(index), static_cast(iparam1), temp); return 1; + case EngFunc_ServerPrint: // void ) (const char *szMsg); + temp = MF_GetAmxString(amx, params[2], 0, &len); + + (*g_engfuncs.pfnServerPrint)(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 4038d222..5063a3e5 100755 --- a/dlls/fakemeta/engfunc.h +++ b/dlls/fakemeta/engfunc.h @@ -81,7 +81,8 @@ enum { 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_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg); + EngFunc_ServerPrint // void ) (const char *szMsg); }; #endif //_ENGFUNC_INCLUDE_H diff --git a/dlls/fakemeta/forward.cpp b/dlls/fakemeta/forward.cpp index 72609751..feb76388 100755 --- a/dlls/fakemeta/forward.cpp +++ b/dlls/fakemeta/forward.cpp @@ -652,6 +652,8 @@ void ClientPrintf_post(edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg) RETURN_META(MRES_IGNORED); } +SIMPLE_VOID_HOOK_CONSTSTRING(ServerPrint); + /* * Beginning of Engine->Game DLL hooks */ @@ -1481,6 +1483,10 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params) fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_DONE); ENGHOOK(ClientPrintf); break; + case FM_ServerPrint: + fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE); + ENGHOOK(ServerPrint); + break; #if 0 // I know this does not fit with DLLFUNC(), but I dont want another native just for it. diff --git a/dlls/fakemeta/forward.h b/dlls/fakemeta/forward.h index 43361a4c..a804a3e8 100755 --- a/dlls/fakemeta/forward.h +++ b/dlls/fakemeta/forward.h @@ -164,6 +164,7 @@ enum { FM_CreateBaseline, FM_GetInfoKeyBuffer, FM_ClientPrintf, + FM_ServerPrint, FM_LAST_DONT_USE_ME }; diff --git a/plugins/include/fakemeta_const.inc b/plugins/include/fakemeta_const.inc index fdb05f5c..851bcb80 100755 --- a/plugins/include/fakemeta_const.inc +++ b/plugins/include/fakemeta_const.inc @@ -119,7 +119,8 @@ enum { // 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_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...); - EngFunc_ClientPrintf // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg); + EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg); + EngFunc_ServerPrint // void ) (const char *szMsg); }; /* Used with dllfunc() @@ -529,7 +530,7 @@ enum { FM_GameShutdown, FM_ShouldCollide, - //LATE ADDITIONS (v1.71) + // LATE ADDITIONS (v1.71) FM_ClientUserInfoChanged, // LATE ADDITIONS (v1.75) @@ -540,7 +541,10 @@ enum { FM_CreateInstBaseline, FM_CreateBaseline, FM_GetInfoKeyBuffer, - FM_ClientPrintf + FM_ClientPrintf, + + // LATE ADDITIONS (v1.80) + FM_ServerPrint }; enum TraceResult diff --git a/plugins/include/fakemeta_stocks.inc b/plugins/include/fakemeta_stocks.inc index 0eb6fa0b..ec3b206e 100755 --- a/plugins/include/fakemeta_stocks.inc +++ b/plugins/include/fakemeta_stocks.inc @@ -193,6 +193,8 @@ stock EF_GetInfoKeyBuffer(const ENTITY) return engfunc(EngFunc_GetInfoKeyBuffer, ENTITY); stock EF_ClientPrintf(const ENTITY, const printType, const MESSAGE[]) return engfunc(EngFunc_ClientPrintf, ENTITY, printType, MESSAGE); +stock EF_ServerPrint(const MESSAGE[]) + return engfunc(EngFunc_ServerPrint, MESSAGE); // DLLFuncs stock DF_GameInit()