X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fminigames%2Fsv_minigames.qh;h=06f16a9dc57cf6c667efae3093c4d099f2312f94;hb=bf25b11aa77e27433d9ec5e8ce5c51639e6754d3;hp=02c3c82fa32d399017de992346958fd8daa3273d;hpb=9e92e0e5bdad9052ff3463f67f3fb5a2ab812ed2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/minigames/sv_minigames.qh b/qcsrc/common/minigames/sv_minigames.qh index 02c3c82fa..06f16a9dc 100644 --- a/qcsrc/common/minigames/sv_minigames.qh +++ b/qcsrc/common/minigames/sv_minigames.qh @@ -1,5 +1,7 @@ -#ifndef SV_MINIGAMES_H -#define SV_MINIGAMES_H +#pragma once + +bool autocvar_sv_minigames; +bool autocvar_sv_minigames_observer; /// Create a new minigame session /// \return minigame session entity @@ -24,13 +26,13 @@ void end_minigames(); // Only sends entities to players who joined the minigame // Use on customizeentityforclient for gameplay entities -bool minigame_CheckSend(); +bool minigame_CheckSend(entity this, entity client); // Check for minigame impulses -bool MinigameImpulse(int imp); +bool MinigameImpulse(entity this, int imp); // Parse a client command ( cmd minigame ... ) -void ClientCommand_minigame(int request, int argc, string command); +void ClientCommand_minigame(entity caller, int request, int argc, string command); // Find the minigame_player entity for the given client entity entity minigame_find_player(entity client); @@ -46,18 +48,17 @@ entity minigame_sessions; bool minigame_SendEntity(entity this, entity to, int sf); -REGISTRY(Minigames, BITS(3)) -#define Minigames_from(i) _Minigames_from(i, NULL) -REGISTER_REGISTRY(RegisterMinigames) +REGISTRY(Minigames, BITS(4)) +REGISTER_REGISTRY(Minigames) +REGISTRY_CHECK(Minigames) + +REGISTRY_DEFINE_GET(Minigames, NULL) #define REGISTER_MINIGAME(name,nicename) \ - REGISTER(RegisterMinigames, MINIGAME, Minigames, name, m_id, spawn()); \ + REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \ int name##_server_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_event = name##_server_event; \ } \ - REGISTER_INIT(MINIGAME, name) - -#endif + REGISTER_INIT(MINIGAME_##name)