X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fminigames%2Fcl_minigames.qh;h=a0f6195d1232f6ec6ca994d4514de840b099c58a;hb=2183056a5b6e75d2e025aa6c718eeb6f87de31b6;hp=76d10986405891fa3d8e902983d33ce5ed6e0bb9;hpb=13b3855f3bb15ac77e0cf442158b2f005f8256ec;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/minigames/cl_minigames.qh b/qcsrc/common/minigames/cl_minigames.qh index 76d109864..a0f6195d1 100644 --- a/qcsrc/common/minigames/cl_minigames.qh +++ b/qcsrc/common/minigames/cl_minigames.qh @@ -1,7 +1,4 @@ -#ifndef CL_MINIGAMES_H -#define CL_MINIGAMES_H - -#include "../../dpdefs/keycodes.qh" +#pragma once // Get a square in the center of the avaliable area // \note macro to pass by reference pos and mySize @@ -87,53 +84,40 @@ entity active_minigame; // minigame_player representing this client entity minigame_self; -// Whethere there's an active minigame -float minigame_isactive() -{ - return active_minigame != world; -} - // Execute a minigame command #define minigame_cmd(...) minigame_cmd_workaround(0,__VA_ARGS__) void minigame_cmd_workaround(float dummy, string...cmdargc); -// Read a minigame entity from the server -void ent_read_minigame(); - // Prompt the player to play in the current minigame // (ie: it's their turn and they should get back to the minigame) void minigame_prompt(); float HUD_MinigameMenu_IsOpened(); -void HUD_MinigameMenu_Close(); -float HUD_Minigame_Showpanels(); +void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger); + // Adds a game-specific entry to the menu void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_arg); #define FOREACH_MINIGAME_ENTITY(entityvar) \ - entityvar=world; \ + entityvar=NULL; \ while( (entityvar = findentity(entityvar,owner,active_minigame)) ) -void RegisterMinigames(); -const int MINIGAMES_MAX = 24; -entity MINIGAMES[MINIGAMES_MAX], MINIGAMES_first, MINIGAMES_last; -int MINIGAMES_COUNT; +REGISTRY(Minigames, BITS(4)) +#define Minigames_from(i) _Minigames_from(i, NULL) +REGISTER_REGISTRY(Minigames) +REGISTRY_CHECK(Minigames) #define REGISTER_MINIGAME(name,nicename) \ - REGISTER(RegisterMinigames, MINIGAME, MINIGAMES, MINIGAMES_COUNT, name, m_id, spawn()); \ + REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \ void name##_hud_board(vector, vector); \ void name##_hud_status(vector, vector); \ int name##_client_event(entity, string, ...); \ - REGISTER_INIT_POST(MINIGAME, name) { \ - this.classname = "minigame_descriptor"; \ + REGISTER_INIT(MINIGAME_##name) { \ this.netname = strzone(strtolower(#name)); \ this.message = nicename; \ this.minigame_hud_board = name##_hud_board; \ this.minigame_hud_status = name##_hud_status; \ this.minigame_event = name##_client_event; \ } \ - REGISTER_INIT(MINIGAME, name) -REGISTER_REGISTRY(RegisterMinigames) - -#endif + REGISTER_INIT(MINIGAME_##name)