Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
cl_minigames.qc File Reference
#include "cl_minigames.qh"
Include dependency graph for cl_minigames.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FIELD(Flags, Type, Name)
#define FIELD(Flags, Type, Name)
#define MSLE(Name, Fields)
#define MSLE(Name, Fields)
#define MSLE_CLEAN_Angle(x)
#define MSLE_CLEAN_Byte(x)
#define MSLE_CLEAN_Char(x)
#define MSLE_CLEAN_Coord(x)
#define MSLE_CLEAN_Float(x)
#define MSLE_CLEAN_Long(x)
#define MSLE_CLEAN_Short(x)
#define MSLE_CLEAN_String(x)
#define MSLE_CLEAN_Vector(x)
#define MSLE_CLEAN_Vector2D(x)
#define ReadString   ReadString_Zoned

Functions

void activate_minigame (entity minigame)
void deactivate_minigame ()
void HUD_MinigameMenu_CurrentButton ()
MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity (entity e)
void minigame_cmd_workaround (float dummy, string...cmdargc)
void minigame_drawcolorcodedstring_trunc (float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags)
vector minigame_drawcolorcodedstring_wrapped (float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align)
void minigame_drawpic_centered (vector pos, string texture, vector sz, vector color, float thealpha, int drawflags)
void minigame_drawstring_trunc (float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags)
vector minigame_drawstring_wrapped (float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align)
void minigame_entremove (entity this)
string minigame_getWrappedLine (float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
vector minigame_hud_denormalize (vector v, vector pos, vector mySize)
vector minigame_hud_denormalize_size (vector v, vector pos, vector mySize)
bool minigame_hud_mouse_in (vector pos, vector sz)
vector minigame_hud_normalize (vector v, vector pos, vector mySize)
void minigame_hud_simpleboard (vector pos, vector mySize, string board_texture)
void minigame_player_entremove (entity this)
void minigame_prompt ()
void minigame_read_owner (entity this)
void minigame_show_allspecs (vector boardpos, vector boardsize)
string minigame_texture (string name)
string minigame_texture_skin (string skinname, string name)
 MUTATOR_HOOKFUNCTION (minigames, HUD_Command)
 NET_HANDLE (ENT_CLIENT_MINIGAME, bool isnew)
string ReadString_Zoned ()
 REGISTER_MUTATOR (minigames, true)
 string () ReadString_Raw = #501

Variables

bool auto_close_minigamemenu

Macro Definition Documentation

◆ FIELD [1/2]

#define FIELD ( Flags,
Type,
Name )
Value:
MSLE_CLEAN_##Type(this.Name)

Definition at line 57 of file cl_minigames.qc.

◆ FIELD [2/2]

#define FIELD ( Flags,
Type,
Name )
Value:
if ( sf & (Flags) ) this.Name = Read##Type();

Definition at line 57 of file cl_minigames.qc.

◆ MSLE [1/2]

#define MSLE ( Name,
Fields )
Value:
void msle_entremove_##Name(entity this) { strunzone(this.netname); Fields }
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string netname
Definition powerups.qc:20
void strunzone(string s)

Definition at line 69 of file cl_minigames.qc.

69#define MSLE(Name,Fields) \
70 void msle_entremove_##Name(entity this) { strunzone(this.netname); Fields }

◆ MSLE [2/2]

#define MSLE ( Name,
Fields )
Value:
else if ( this.classname == #Name ) { \
if ( sf & MINIG_SF_CREATE ) { \
minigame_read_owner(this); \
this.entremove = msle_entremove_##Name; \
} \
minigame_ent = this.owner; \
Fields \
}
entity owner
Definition main.qh:87
string classname
const int MINIG_SF_CREATE
Definition minigames.qh:108

Definition at line 69 of file cl_minigames.qc.

69#define MSLE(Name,Fields) \
70 void msle_entremove_##Name(entity this) { strunzone(this.netname); Fields }

◆ MSLE_CLEAN_Angle

#define MSLE_CLEAN_Angle ( x)

Definition at line 64 of file cl_minigames.qc.

◆ MSLE_CLEAN_Byte

#define MSLE_CLEAN_Byte ( x)

Definition at line 59 of file cl_minigames.qc.

◆ MSLE_CLEAN_Char

#define MSLE_CLEAN_Char ( x)

Definition at line 60 of file cl_minigames.qc.

◆ MSLE_CLEAN_Coord

#define MSLE_CLEAN_Coord ( x)

Definition at line 63 of file cl_minigames.qc.

◆ MSLE_CLEAN_Float

#define MSLE_CLEAN_Float ( x)

Definition at line 65 of file cl_minigames.qc.

◆ MSLE_CLEAN_Long

#define MSLE_CLEAN_Long ( x)

Definition at line 62 of file cl_minigames.qc.

◆ MSLE_CLEAN_Short

#define MSLE_CLEAN_Short ( x)

Definition at line 61 of file cl_minigames.qc.

◆ MSLE_CLEAN_String

#define MSLE_CLEAN_String ( x)
Value:

Definition at line 58 of file cl_minigames.qc.

◆ MSLE_CLEAN_Vector

#define MSLE_CLEAN_Vector ( x)

Definition at line 66 of file cl_minigames.qc.

◆ MSLE_CLEAN_Vector2D

#define MSLE_CLEAN_Vector2D ( x)

Definition at line 67 of file cl_minigames.qc.

◆ ReadString

Function Documentation

◆ activate_minigame()

void activate_minigame ( entity minigame)

Definition at line 114 of file cl_minigames.qc.

115{
116 if ( !minigame )
117 {
119 return;
120 }
121
122 if ( !minigame.descriptor || minigame.classname != "minigame" )
123 {
124 LOG_TRACE("Trying to activate unregistered minigame ",minigame.netname," in client");
125 return;
126 }
127
128 if ( minigame == active_minigame )
129 return;
130
131 if ( active_minigame )
132 {
134 }
135
136 if ( minigame_self.owner != minigame )
138 active_minigame = minigame;
139 active_minigame.minigame_event(active_minigame,"activate");
140
143 else
144 {
147 }
148}
void deactivate_minigame()
bool auto_close_minigamemenu
void HUD_MinigameMenu_CurrentButton()
entity minigame_self
entity active_minigame
bool HUD_MinigameMenu_IsOpened()
void HUD_MinigameMenu_Open()
#define LOG_TRACE(...)
Definition log.qh:76
#define NULL
Definition post.qh:14

References active_minigame, auto_close_minigamemenu, deactivate_minigame(), entity(), HUD_MinigameMenu_CurrentButton(), HUD_MinigameMenu_IsOpened(), HUD_MinigameMenu_Open(), LOG_TRACE, minigame_self, and NULL.

Referenced by NET_HANDLE().

◆ deactivate_minigame()

void deactivate_minigame ( )

Definition at line 83 of file cl_minigames.qc.

84{
85 if ( !active_minigame )
86 return;
87
88 active_minigame.minigame_event(active_minigame,"deactivate");
89 entity e = NULL;
90 while( (e = findentity(e, owner, active_minigame)) )
91 if ( e.minigame_autoclean )
92 {
94 }
95
98
100 {
103 }
104 else
106}
MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity(entity e)
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
entity findentity(entity start,.entity field, entity match)

References active_minigame, auto_close_minigamemenu, entity(), findentity(), HUD_MinigameMenu_Close(), HUD_MinigameMenu_CurrentButton(), minigame_autoclean_entity(), minigame_self, NULL, and owner.

Referenced by activate_minigame(), HUD_MinigameMenu_ClickQuit(), minigame_entremove(), minigame_player_entremove(), and Shutdown().

◆ HUD_MinigameMenu_CurrentButton()

void HUD_MinigameMenu_CurrentButton ( )

Definition at line 395 of file cl_minigames_hud.qc.

396{
397 entity e;
398 if ( active_minigame )
399 {
400 for ( e = HUD_MinigameMenu_last_entry; e != NULL; e = e.list_prev )
401 if ( e.classname == "hud_minigamemenu_exit" )
402 {
404 break;
405 }
406 entity currb = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_current),
407 _("Current Game"), '0 0 0', hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_ClickCurrentGame );
408 currb.model = strzone(minigame_texture(strcat(active_minigame.descriptor.netname,"/icon")));
411 }
412 else
413 {
414 entity p;
415 for ( e = HUD_MinigameMenu_last_entry; e != NULL; e = p.list_prev )
416 {
417 p = e;
418 if ( e.classname == "hud_minigamemenu_current" )
419 {
420 p = e.list_next;
421 if ( !p )
424 break;
425 }
426 }
427 for ( e = HUD_MinigameMenu_last_entry; e != NULL; e = e.list_prev )
428 if ( e.classname == "hud_minigamemenu_exit" )
429 return;
430 entity exit = HUD_MinigameMenu_SpawnEntry(new(hud_minigamemenu_exit),
431 _("Exit Menu"),'0 0 0',hud_fontsize*1.5,'0.7 0.84 1', HUD_MinigameMenu_Close);
433 }
434}
string minigame_texture(string name)
void HUD_MinigameMenu_EraseEntry(entity e)
entity HUD_MinigameMenu_last_entry
void HUD_MinigameMenu_Click(entity menuitem)
entity HUD_MinigameMenu_SpawnEntry(entity entry, string s, vector offset, vector fontsize, vector color, void(entity, entity, entity) click)
void HUD_MinigameMenu_ClickCurrentGame(entity this, entity actor, entity trigger)
void HUD_MinigameMenu_InsertEntry(entity newentry, entity prev)
vector hud_fontsize
Definition main.qh:77
string strzone(string s)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References active_minigame, entity(), hud_fontsize, HUD_MinigameMenu_Click(), HUD_MinigameMenu_ClickCurrentGame(), HUD_MinigameMenu_Close(), HUD_MinigameMenu_EraseEntry(), HUD_MinigameMenu_InsertEntry(), HUD_MinigameMenu_last_entry, HUD_MinigameMenu_SpawnEntry(), minigame_texture(), NULL, strcat(), and strzone().

Referenced by activate_minigame(), deactivate_minigame(), and HUD_MinigameMenu_Open().

◆ minigame_autoclean_entity()

MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity ( entity e)

Definition at line 75 of file cl_minigames.qc.

76{
77 LOG_DEBUG("CL Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")");
78 delete(e);
79}
#define LOG_DEBUG(...)
Definition log.qh:80
string ftos(float f)
#define etof(e)
Definition misc.qh:25

References entity(), etof, ftos(), and LOG_DEBUG.

Referenced by deactivate_minigame().

◆ minigame_cmd_workaround()

void minigame_cmd_workaround ( float dummy,
string... cmdargc )

Definition at line 407 of file cl_minigames.qc.

408{
409 string cmd;
410 cmd = "cmd minigame ";
411 float i;
412 for ( i = 0; i < cmdargc; ++i )
413 cmd = strcat(cmd,...(i,string));
414 localcmd(strcat(cmd,"\n"));
415}
void localcmd(string command,...)
void cmd(string command,...)

References cmd(), localcmd(), and strcat().

◆ minigame_drawcolorcodedstring_trunc()

void minigame_drawcolorcodedstring_trunc ( float maxwidth,
vector pos,
string text,
vector fontsize,
float theAlpha,
int drawflags )

Definition at line 392 of file cl_minigames.qc.

394{
395 string line = textShortenToWidth(text,maxwidth,fontsize,stringwidth_colors);
396 drawcolorcodedstring(pos, line, fontsize, theAlpha, drawflags);
397}
#define drawcolorcodedstring(position, text, scale, alpha, flag)
Definition draw.qh:30
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
Definition util.qc:1071
float stringwidth_colors(string s, vector theSize)
Definition string.qh:30

References drawcolorcodedstring, stringwidth_colors(), textShortenToWidth(), and vector.

Referenced by HUD_MinigameMenu_DrawColoredEntry().

◆ minigame_drawcolorcodedstring_wrapped()

vector minigame_drawcolorcodedstring_wrapped ( float maxwidth,
vector pos,
string text,
vector fontsize,
float theAlpha,
int drawflags,
float align )

Definition at line 366 of file cl_minigames.qc.

368{
370 vector mypos = pos;
372 {
373 string line = minigame_getWrappedLine(maxwidth,fontsize,stringwidth_colors);
374 if ( line == "" )
375 break;
376 mypos_x = pos_x + (maxwidth - stringwidth_colors(line, fontsize)) * align;
377 drawcolorcodedstring(mypos, line, fontsize, theAlpha, drawflags);
378 mypos_y += fontsize_y;
379 }
380 mypos_x = maxwidth;
381 mypos_y -= pos_y;
382 return mypos;
383}
string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string getWrappedLine_remaining
Definition util.qh:147
vector
Definition self.qh:92

References drawcolorcodedstring, getWrappedLine_remaining, minigame_getWrappedLine(), stringwidth_colors(), and vector.

Referenced by HUD_MinigameHelp(), and minigame_show_allspecs().

◆ minigame_drawpic_centered()

void minigame_drawpic_centered ( vector pos,
string texture,
vector sz,
vector color,
float thealpha,
int drawflags )

Definition at line 399 of file cl_minigames.qc.

401{
402 drawpic( pos-sz/2, texture, sz, color, thealpha, drawflags );
403}
#define drawpic(position, pic, size, rgb, alpha, flag)
Definition draw.qh:21
vector color
Definition dynlight.qc:15

References color, drawpic, and vector.

◆ minigame_drawstring_trunc()

void minigame_drawstring_trunc ( float maxwidth,
vector pos,
string text,
vector fontsize,
vector color,
float theAlpha,
int drawflags )

Definition at line 385 of file cl_minigames.qc.

387{
388 string line = textShortenToWidth(text,maxwidth,fontsize,stringwidth_nocolors);
389 drawstring(pos, line, fontsize, color, theAlpha, drawflags);
390}
#define drawstring(position, text, scale, rgb, alpha, flag)
Definition draw.qh:27
float stringwidth_nocolors(string s, vector theSize)
Definition string.qh:35

References color, drawstring, stringwidth_nocolors(), textShortenToWidth(), and vector.

Referenced by HUD_MinigameMenu_DrawEntry().

◆ minigame_drawstring_wrapped()

vector minigame_drawstring_wrapped ( float maxwidth,
vector pos,
string text,
vector fontsize,
vector color,
float theAlpha,
int drawflags,
float align )

Definition at line 347 of file cl_minigames.qc.

349{
351 vector mypos = pos;
353 {
354 string line = minigame_getWrappedLine(maxwidth,fontsize,stringwidth_nocolors);
355 if ( line == "" )
356 break;
357 mypos_x = pos_x + (maxwidth - stringwidth_nocolors(line, fontsize)) * align;
358 drawstring(mypos, line, fontsize, color, theAlpha, drawflags);
359 mypos_y += fontsize_y;
360 }
361 mypos_x = maxwidth;
362 mypos_y -= pos_y;
363 return mypos;
364}

References color, drawstring, getWrappedLine_remaining, minigame_getWrappedLine(), stringwidth_nocolors(), and vector.

Referenced by minigame_show_allspecs().

◆ minigame_entremove()

void minigame_entremove ( entity this)

Definition at line 108 of file cl_minigames.qc.

109{
110 if ( this == active_minigame )
112}

References active_minigame, deactivate_minigame(), and entity().

Referenced by NET_HANDLE().

◆ minigame_getWrappedLine()

string minigame_getWrappedLine ( float w,
vector theFontSize,
textLengthUpToWidth_widthFunction_t tw )

Definition at line 294 of file cl_minigames.qc.

295{
296 string s = getWrappedLine_remaining;
297
298 if(w <= 0)
299 {
301 return s; // the line has no size ANYWAY, nothing would be displayed.
302 }
303
304 int take_until = textLengthUpToWidth(s, w, theFontSize, tw);
305
306 if ( take_until > strlen(s) )
307 take_until = strlen(s);
308
309 int skip = 0;
310 for ( int i = 0; i < take_until; ++i )
311 if ( substring(s,i,1) == "\n" )
312 {
313 take_until = i;
314 skip = 1;
315 break;
316 }
317
318 if ( take_until > 0 || skip > 0 )
319 {
320 if ( skip == 0 && take_until < strlen(s) )
321 {
322 int last_word = take_until;
323 while(last_word > 0 && substring(s, last_word, 1) != " ")
324 --last_word;
325
326 if ( last_word != 0 )
327 {
328 take_until = last_word;
329 skip = 1;
330 }
331 }
332
333 getWrappedLine_remaining = substring(s, take_until+skip, strlen(s) - (take_until+skip));
336 else if (tw("^7", theFontSize) == 0)
338 return substring(s, 0, take_until);
339 }
340 else
341 {
343 return s;
344 }
345}
string find_last_color_code(string s)
Definition util.qc:960
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
Definition util.qc:888
#define strlen
string substring(string s, float start, float length)
string string_null
Definition nil.qh:9

References find_last_color_code(), getWrappedLine_remaining, strcat(), string_null, strlen, substring(), textLengthUpToWidth(), and vector.

Referenced by minigame_drawcolorcodedstring_wrapped(), and minigame_drawstring_wrapped().

◆ minigame_hud_denormalize()

vector minigame_hud_denormalize ( vector v,
vector pos,
vector mySize )

Definition at line 16 of file cl_minigames.qc.

17{
18 v_x = pos_x + v_x * mySize_x;
19 v_y = pos_y + v_y * mySize_y;
20 return v;
21}

References vector.

◆ minigame_hud_denormalize_size()

vector minigame_hud_denormalize_size ( vector v,
vector pos,
vector mySize )

Definition at line 23 of file cl_minigames.qc.

24{
25 v_x = v_x * mySize_x;
26 v_y = v_y * mySize_y;
27 return v;
28}

References vector.

◆ minigame_hud_mouse_in()

bool minigame_hud_mouse_in ( vector pos,
vector sz )

Definition at line 39 of file cl_minigames.qc.

40{
41 return mousepos_x >= pos_x && mousepos_x < pos_x + sz_x &&
42 mousepos_y >= pos_y && mousepos_y < pos_y + sz_y ;
43}

References vector.

◆ minigame_hud_normalize()

vector minigame_hud_normalize ( vector v,
vector pos,
vector mySize )

Definition at line 31 of file cl_minigames.qc.

32{
33 v_x = ( v_x - pos_x ) / mySize_x;
34 v_y = ( v_y - pos_y ) / mySize_y;
35 return v;
36}

References vector.

◆ minigame_hud_simpleboard()

void minigame_hud_simpleboard ( vector pos,
vector mySize,
string board_texture )

Definition at line 4 of file cl_minigames.qc.

5{
6 if(panel.current_panel_bg != "0" && panel.current_panel_bg != "")
8 panel.current_panel_bg,
9 mySize + '1 1 0' * 2 * panel_bg_border,
12 drawpic(pos, board_texture, mySize, '1 1 1', panel_bg_alpha, DRAWFLAG_NORMAL);
13}
const float DRAWFLAG_NORMAL
float panel_bg_border
Definition hud.qh:172
const float BORDER_MULTIPLIER
Definition hud.qh:110
float panel_bg_alpha
Definition hud.qh:170
vector panel_bg_color
Definition hud.qh:165
entity panel
Definition hud.qh:147
void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
Definition draw.qh:44

References BORDER_MULTIPLIER, draw_BorderPicture(), DRAWFLAG_NORMAL, drawpic, panel, panel_bg_alpha, panel_bg_border, panel_bg_color, and vector.

◆ minigame_player_entremove()

void minigame_player_entremove ( entity this)

Definition at line 150 of file cl_minigames.qc.

151{
154}
float minigame_playerslot
float player_localentnum

References active_minigame, deactivate_minigame(), entity(), minigame_playerslot, owner, and player_localentnum.

Referenced by NET_HANDLE().

◆ minigame_prompt()

void minigame_prompt ( )

Definition at line 419 of file cl_minigames.qc.

420{
422 {
423 HUD_Notify_Push(sprintf("minigames/%s/icon_notif",active_minigame.descriptor.netname),
424 _("It's your turn"), "");
425 }
426}
void HUD_Notify_Push(string icon, string attacker, string victim)
Definition notify.qc:19

References active_minigame, HUD_MinigameMenu_IsOpened(), and HUD_Notify_Push().

◆ minigame_read_owner()

void minigame_read_owner ( entity this)

Definition at line 169 of file cl_minigames.qc.

170{
171 string owner_name = ReadString_Raw();
172 this.owner = NULL;
173 do
174 this.owner = find(this.owner,netname,owner_name);
175 while ( this.owner && this.owner.classname != "minigame" );
176 if ( !this.owner )
177 LOG_TRACE("Got a minigame entity without a minigame!");
178}
entity find(entity start,.string field, string match)

References entity(), find(), LOG_TRACE, netname, NULL, and owner.

Referenced by NET_HANDLE().

◆ minigame_show_allspecs()

void minigame_show_allspecs ( vector boardpos,
vector boardsize )

Definition at line 249 of file cl_minigames.qc.

250{
251 string allspecs = "";
252 float allspecs_width = 0;
253 float max_allspecs_width = boardsize.x;
254 float max_current_spec_width = hud_fontsize.x * 5;
255 int allspecs_lines = 2;
256
257 entity e;
259 {
260 if (allspecs_width >= 0 && e.classname == "minigame_player" && e.team == C4_SPECTATOR_TEAM)
261 {
262 string current_spec = ColorTranslateRGB(entcs_GetName(e.minigame_playerslot - 1));
263 current_spec = textShortenToWidth(current_spec, max_current_spec_width, hud_fontsize, stringwidth_colors);
264 if (allspecs != "")
265 current_spec = strcat(", ", current_spec);
266 else
267 current_spec = current_spec;
268
269 allspecs_width = stringwidth(allspecs, true, hud_fontsize);
270
271 float max_width = max_allspecs_width * allspecs_lines - max_current_spec_width;
272 if (allspecs_width + stringwidth(current_spec, true, hud_fontsize) < max_width)
273 allspecs = strcat(allspecs, current_spec);
274 else
275 {
276 // current_spec doesn't fit in the list
277 allspecs = strcat(allspecs, ", ...");
278 allspecs_width = -1; // skip remaining spectators
279 }
280 }
281 }
282
283 if (allspecs != "")
284 {
285 vector pos = boardpos;
286 pos.y -= panel_bg_border + hud_fontsize.y * (1.25 + allspecs_lines + 0.5);
287 minigame_drawstring_wrapped(max_allspecs_width, pos, _("Spectators:"), hud_fontsize * 1.25, '0.85 0.47 0.42', panel_fg_alpha, DRAWFLAG_NORMAL, 0);
288
289 pos.y += hud_fontsize.y * 1.25;
291 }
292}
const int C4_SPECTATOR_TEAM
Definition c4.qc:21
vector minigame_drawstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align)
vector minigame_drawcolorcodedstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align)
#define FOREACH_MINIGAME_ENTITY(entityvar)
#define stringwidth
string entcs_GetName(int i)
Definition ent_cs.qh:151
float panel_fg_alpha
Definition hud.qh:169
ERASEABLE string ColorTranslateRGB(string s)
Definition string.qh:196

References C4_SPECTATOR_TEAM, ColorTranslateRGB(), DRAWFLAG_NORMAL, entcs_GetName(), entity(), FOREACH_MINIGAME_ENTITY, hud_fontsize, minigame_drawcolorcodedstring_wrapped(), minigame_drawstring_wrapped(), panel_bg_border, panel_fg_alpha, strcat(), stringwidth, stringwidth_colors(), textShortenToWidth(), and vector.

◆ minigame_texture()

string minigame_texture ( string name)

Definition at line 49 of file cl_minigames.qc.

50{
52 if ( precache_pic(path) == "" )
53 path = minigame_texture_skin("default", name);
54 return path;
55}
string minigame_texture_skin(string skinname, string name)
string autocvar_menu_skin
Definition mapvoting.qh:7
string name
Definition menu.qh:30
string precache_pic(string name,...)

References autocvar_menu_skin, minigame_texture_skin(), name, and precache_pic().

Referenced by HUD_MinigameMenu_ClickCreate(), HUD_MinigameMenu_ClickJoin(), and HUD_MinigameMenu_CurrentButton().

◆ minigame_texture_skin()

string minigame_texture_skin ( string skinname,
string name )

Definition at line 45 of file cl_minigames.qc.

46{
47 return sprintf("gfx/hud/%s/minigames/%s", skinname, name);
48}

References name.

Referenced by minigame_texture().

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( minigames ,
HUD_Command  )

Definition at line 431 of file cl_minigames.qc.

432{
433 if(MUTATOR_RETURNVALUE) { return false; } // command was already handled
434
435 if(argv(1) == "minigame")
436 {
437 if (isdemo())
438 return true; // minigames can't function properly in demo mode
441 else
443 return true;
444 }
445
446 return false;
447}
#define MUTATOR_RETURNVALUE
Definition base.qh:328
float isdemo()
string argv(float n)

References argv(), HUD_MinigameMenu_Close(), HUD_MinigameMenu_IsOpened(), HUD_MinigameMenu_Open(), isdemo(), MUTATOR_RETURNVALUE, and NULL.

◆ NET_HANDLE()

NET_HANDLE ( ENT_CLIENT_MINIGAME ,
bool isnew )

Definition at line 179 of file cl_minigames.qc.

180{
181 float sf = ReadByte();
182 if ( sf & MINIG_SF_CREATE )
183 {
184 this.classname = msle_classname(ReadShort());
185 this.netname = ReadString_Zoned();
186 }
187
188 entity minigame_ent = NULL;
189
190 if ( this.classname == "minigame" )
191 {
192 minigame_ent = this;
193
194 if ( sf & MINIG_SF_CREATE )
195 {
196 this.entremove = minigame_entremove;
197 this.descriptor = minigame_get_descriptor(ReadString_Raw());
198 if ( !this.descriptor )
199 LOG_TRACE("Got a minigame without a client-side descriptor!");
200 else
201 this.minigame_event = this.descriptor.minigame_event;
202 }
203 if ( sf & MINIG_SF_UPDATE )
204 this.minigame_flags = ReadLong();
205 }
206 else if ( this.classname == "minigame_player" )
207 {
208 float activate = 0;
209 if ( sf & MINIG_SF_CREATE )
210 {
211 this.entremove = minigame_player_entremove;
213 float ent = ReadLong();
214 this.minigame_playerslot = ent;
215 LOG_DEBUG("Player: ",entcs_GetName(ent-1));
216
217 activate = (ent == player_localnum+1 && this.owner && this.owner != active_minigame);
218
219 }
220 minigame_ent = this.owner;
221
222 if ( sf & MINIG_SF_UPDATE )
223 this.team = ReadByte();
224
225 if ( activate )
226 {
227 minigame_self = this;
229 minigame_self = this; // set it again (needed before, but may also be reset)
230 }
231 }
233
234 if ( minigame_ent )
235 minigame_ent.minigame_event(minigame_ent,"network_receive",this,sf);
236
237 if ( sf & MINIG_SF_CREATE )
238 {
239 LOG_DEBUG("CL Reading entity: ",ftos(etof(this)),
240 " classname:",this.classname," enttype:",ftos(this.enttype) );
241 LOG_DEBUG(" sf:",ftos(sf)," netname:",this.netname);
242 }
243 return true;
244}
void minigame_player_entremove(entity this)
void minigame_entremove(entity this)
void minigame_read_owner(entity this)
string ReadString_Zoned()
void activate_minigame(entity minigame)
int enttype
Definition main.qh:185
int team
Definition main.qh:188
float player_localnum
int ReadByte()
#define MINIGAME_SIMPLELINKED_ENTITIES
Set up automatic entity read/write functionality To ensure that everything is handled automatically,...
Definition all.qh:100
string msle_classname(int id)
Definition minigames.qc:110
entity minigame_get_descriptor(string id)
Definition minigames.qc:5
int minigame_flags
Definition minigames.qh:103
const int MINIG_SF_UPDATE
Definition minigames.qh:109
entity descriptor
For minigame sessions: minigame descriptor object.
Definition minigames.qh:45

References activate_minigame(), active_minigame, classname, descriptor, entcs_GetName(), entity(), enttype, etof, ftos(), LOG_DEBUG, LOG_TRACE, MINIG_SF_CREATE, MINIG_SF_UPDATE, minigame_entremove(), minigame_flags, minigame_get_descriptor(), minigame_player_entremove(), minigame_playerslot, minigame_read_owner(), minigame_self, MINIGAME_SIMPLELINKED_ENTITIES, msle_classname(), netname, NULL, owner, player_localnum, ReadByte(), ReadString_Zoned(), and team.

◆ ReadString_Zoned()

string ReadString_Zoned ( )

Definition at line 157 of file cl_minigames.qc.

157{ return strzone(ReadString_Raw()); }

References strzone().

Referenced by NET_HANDLE().

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( minigames ,
true  )

◆ string()

string ( ) = #501

Variable Documentation

◆ auto_close_minigamemenu

bool auto_close_minigamemenu

Definition at line 82 of file cl_minigames.qc.

Referenced by activate_minigame(), and deactivate_minigame().