X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fminigames%2Fminigames.qc;h=71cf41a3aa44340d471491aad35b2e893ff19a0c;hb=46a44942030ee6350c6847bf0efe75a1e0d54c6b;hp=61ab9a6ba40a361cf72c974c7ba043be8217714a;hpb=86c9dc7c3696c329496b06375c1e79fb407401ce;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/minigames/minigames.qc b/qcsrc/common/minigames/minigames.qc index 61ab9a6ba..71cf41a3a 100644 --- a/qcsrc/common/minigames/minigames.qc +++ b/qcsrc/common/minigames/minigames.qc @@ -1,12 +1,11 @@ #include "minigames.qh" +REGISTER_NET_LINKED(ENT_CLIENT_MINIGAME) + entity minigame_get_descriptor(string id) { - entity e; - for ( e = minigame_descriptors; e != world; e = e.list_next ) - if ( e.netname == id ) - return e; - return world; + FOREACH(Minigames, it.netname == id, return it); + return NULL; } // Get letter index of a tile name @@ -17,7 +16,7 @@ int minigame_tile_letter(string id) // Get number index of a tile name // Note: this is 0 based, useful for mathematical operations -// Note: Since the tile notation starts from the bottom left, +// Note: Since the tile notation starts from the bottom left, // you may want to do number_of_rows - what_this_function_returns or something int minigame_tile_number(string id) { @@ -27,7 +26,7 @@ int minigame_tile_number(string id) // Get relative position of the center of a given tile vector minigame_tile_pos(string id, int rows, int columns) { - return eX*(minigame_tile_letter(id)+0.5)/columns + + return eX*(minigame_tile_letter(id)+0.5)/columns + eY - eY*(minigame_tile_number(id)+0.5)/rows; } @@ -56,7 +55,7 @@ string minigame_tile_name(vector pos, int rows, int columns) { if ( pos_x < 0 || pos_x > 1 || pos_y < 0 || pos_y > 1 ) return ""; // no tile - + int letter = floor(pos_x * columns); int number = floor((1-pos_y) * rows); return minigame_tile_buildname(letter, number); @@ -135,3 +134,10 @@ int minigame_count_players(entity minigame) pl_num++; return pl_num; } + +#ifdef CSQC +#include "cl_minigames.qc" +#endif +#ifdef SVQC +#include "sv_minigames.qc" +#endif