From: Mario Date: Mon, 28 Dec 2015 11:20:37 +0000 (+1000) Subject: Move minigame HUD command into minigame file X-Git-Tag: xonotic-v0.8.2~1374 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=322fd059ab536367167b2af916657715a886a068;p=xonotic%2Fxonotic-data.pk3dir.git Move minigame HUD command into minigame file --- diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index c99db9268..24833d834 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -284,15 +284,6 @@ void LocalCommand_hud(int request, int argc) return; } - case "minigame": - { - if (HUD_MinigameMenu_IsOpened()) - HUD_MinigameMenu_Close(); - else - HUD_MinigameMenu_Open(); - return; - } - case "save": { if (argv(2)) diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index ea5596f08..93147d404 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -382,3 +382,22 @@ void minigame_prompt() _("It's your turn"), ""); } } + +// handle commands etc. +REGISTER_MUTATOR(minigames, true); + +MUTATOR_HOOKFUNCTION(minigames, HUD_Command) +{ + if(MUTATOR_RETURNVALUE) { return false; } // command was already handled + + if(argv(1) == "minigame") + { + if (HUD_MinigameMenu_IsOpened()) + HUD_MinigameMenu_Close(); + else + HUD_MinigameMenu_Open(); + return true; + } + + return false; +}