From: Mario Date: Wed, 28 Oct 2015 06:26:04 +0000 (+1000) Subject: Add some more useful hooks X-Git-Tag: xonotic-v0.8.2~1770 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=966c85bec0b767c4f8d5bf4654e3c71b156dd257;p=xonotic%2Fxonotic-data.pk3dir.git Add some more useful hooks --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index e20557fa7..2ad1c67c1 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -1,10 +1,20 @@ #include "announcer.qh" +#include "mutators/events.qh" + #include "../common/notifications.qh" #include "../common/stats.qh" bool announcer_1min; bool announcer_5min; +string AnnouncerOption() +{ + if(MUTATOR_CALLHOOK(AnnouncerOption, ret_string)) + return ret_string; + + return autocvar_cl_announcer; +} + void Announcer_Countdown() { SELFPARAM(); diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 0f84b7fd8..9d20c4061 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1037,6 +1037,8 @@ void Ent_Init() g_trueaim_minrange = ReadCoord(); g_balance_porto_secondary = ReadByte(); + MUTATOR_CALLHOOK(Ent_Init); + if(!postinit) PostInit(); } diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 678d7ca66..2fbeaaa7c 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -129,4 +129,11 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump); /**/ MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase); +#define EV_AnnouncerOption(i, o) \ + /**/ i(string, ret_string) \ + /**/ o(string, ret_string) \ + /**/ +MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption); + +MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS); #endif diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 811e7007c..9a83eebb5 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -595,7 +595,7 @@ void Create_Notification_Entity( { if(notif.nent_enabled) { - precache_sound(sprintf("announcer/%s/%s.wav", autocvar_cl_announcer, snd)); + precache_sound(sprintf("announcer/%s/%s.wav", AnnouncerOption(), snd)); notif.nent_channel = channel; notif.nent_snd = strzone(snd); notif.nent_vol = vol; @@ -1276,7 +1276,7 @@ void Local_Notification_sound( soundchannel, sprintf( "announcer/%s/%s.wav", - autocvar_cl_announcer, + AnnouncerOption(), soundfile ), soundvolume, @@ -1289,7 +1289,7 @@ void Local_Notification_sound( soundchannel, sprintf( "announcer/%s/%s.wav", - autocvar_cl_announcer, + AnnouncerOption(), soundfile ), soundvolume, @@ -1311,7 +1311,7 @@ void Local_Notification_sound( soundchannel, sprintf( "announcer/%s/%s.wav", - autocvar_cl_announcer, + AnnouncerOption(), soundfile ), soundvolume, diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d6522285b..cfc058b84 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -650,6 +650,8 @@ bool ClientInit_SendEntity(entity this, entity to, int sf) WriteByte(MSG_ENTITY, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange); WriteByte(MSG_ENTITY, WEP_CVAR(porto, secondary)); // WEAPONTODO + + MUTATOR_CALLHOOK(Ent_Init); return true; } diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 2d9e75b94..50021ae2d 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -811,4 +811,6 @@ MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget); /**/ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(TurretThink, EV_TurretThink); + +MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS); #endif