6 if(
panel.current_panel_bg !=
"0" &&
panel.current_panel_bg !=
"")
8 panel.current_panel_bg,
18 v_x = pos_x + v_x * mySize_x;
19 v_y = pos_y + v_y * mySize_y;
33 v_x = ( v_x - pos_x ) / mySize_x;
34 v_y = ( v_y - pos_y ) / mySize_y;
41 return mousepos_x >= pos_x && mousepos_x < pos_x + sz_x &&
42 mousepos_y >= pos_y && mousepos_y < pos_y + sz_y ;
47 return sprintf(
"gfx/hud/%s/minigames/%s", skinname,
name);
57#define FIELD(Flags, Type, Name) MSLE_CLEAN_##Type(this.Name)
58#define MSLE_CLEAN_String(x) strunzone(x);
59#define MSLE_CLEAN_Byte(x)
60#define MSLE_CLEAN_Char(x)
61#define MSLE_CLEAN_Short(x)
62#define MSLE_CLEAN_Long(x)
63#define MSLE_CLEAN_Coord(x)
64#define MSLE_CLEAN_Angle(x)
65#define MSLE_CLEAN_Float(x)
66#define MSLE_CLEAN_Vector(x)
67#define MSLE_CLEAN_Vector2D(x)
69#define MSLE(Name,Fields) \
70 void msle_entremove_##Name(entity this) { strunzone(this.netname); Fields }
91 if ( e.minigame_autoclean )
122 if ( !minigame.descriptor || minigame.classname !=
"minigame" )
124 LOG_TRACE(
"Trying to activate unregistered minigame ",minigame.netname,
" in client");
158#define ReadString ReadString_Zoned
159#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) this.Name = Read##Type();
160#define MSLE(Name,Fields) \
161 else if ( this.classname == #Name ) { \
162 if ( sf & MINIG_SF_CREATE ) { \
163 minigame_read_owner(this); \
164 this.entremove = msle_entremove_##Name; \
166 minigame_ent = this.owner; \
171 string owner_name = ReadString_Raw();
175 while ( this.
owner && this.
owner.classname !=
"minigame" );
177 LOG_TRACE(
"Got a minigame entity without a minigame!");
199 LOG_TRACE(
"Got a minigame without a client-side descriptor!");
201 this.minigame_event = this.
descriptor.minigame_event;
206 else if ( this.
classname ==
"minigame_player" )
213 float ent = ReadLong();
220 minigame_ent = this.
owner;
235 minigame_ent.minigame_event(minigame_ent,
"network_receive",
this,sf);
251 string allspecs =
"";
252 float allspecs_width = 0;
253 float max_allspecs_width = boardsize.x;
255 int allspecs_lines = 2;
260 if (allspecs_width >= 0 && e.classname ==
"minigame_player" && e.team ==
C4_SPECTATOR_TEAM)
265 current_spec =
strcat(
", ", current_spec);
267 current_spec = current_spec;
271 float max_width = max_allspecs_width * allspecs_lines - max_current_spec_width;
273 allspecs =
strcat(allspecs, current_spec);
277 allspecs =
strcat(allspecs,
", ...");
306 if ( take_until >
strlen(s) )
310 for (
int i = 0; i < take_until; ++i )
318 if ( take_until > 0 || skip > 0 )
320 if ( skip == 0 && take_until <
strlen(s) )
322 int last_word = take_until;
323 while(last_word > 0 &&
substring(s, last_word, 1) !=
" ")
326 if ( last_word != 0 )
328 take_until = last_word;
336 else if (tw(
"^7", theFontSize) == 0)
359 mypos_y += fontsize_y;
367 string text,
vector fontsize,
float theAlpha,
int drawflags,
float align )
378 mypos_y += fontsize_y;
393 vector fontsize,
float theAlpha,
int drawflags )
402 drawpic( pos-sz/2, texture, sz,
color, thealpha, drawflags );
410 cmd =
"cmd minigame ";
412 for ( i = 0; i < cmdargc; ++i )
424 _(
"It's your turn"),
"");
435 if(
argv(1) ==
"minigame")
#define REGISTER_MUTATOR(...)
#define MUTATOR_HOOKFUNCTION(...)
#define MUTATOR_RETURNVALUE
const int C4_SPECTATOR_TEAM
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags)
void minigame_show_allspecs(vector boardpos, vector boardsize)
vector minigame_drawstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align)
void minigame_cmd_workaround(float dummy, string...cmdargc)
bool minigame_hud_mouse_in(vector pos, vector sz)
void minigame_hud_simpleboard(vector pos, vector mySize, string board_texture)
void deactivate_minigame()
string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string minigame_texture_skin(string skinname, string name)
string minigame_texture(string name)
bool auto_close_minigamemenu
vector minigame_hud_denormalize_size(vector v, vector pos, vector mySize)
vector minigame_drawcolorcodedstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align)
MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity(entity e)
void minigame_drawstring_trunc(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags)
void HUD_MinigameMenu_CurrentButton()
void minigame_player_entremove(entity this)
vector minigame_hud_denormalize(vector v, vector pos, vector mySize)
void minigame_entremove(entity this)
vector minigame_hud_normalize(vector v, vector pos, vector mySize)
void minigame_read_owner(entity this)
string ReadString_Zoned()
void activate_minigame(entity minigame)
void minigame_drawpic_centered(vector pos, string texture, vector sz, vector color, float thealpha, int drawflags)
#define FOREACH_MINIGAME_ENTITY(entityvar)
float minigame_playerslot
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
bool HUD_MinigameMenu_IsOpened()
void HUD_MinigameMenu_Open()
#define drawcolorcodedstring(position, text, scale, alpha, flag)
#define drawstring(position, text, scale, rgb, alpha, flag)
#define drawpic(position, pic, size, rgb, alpha, flag)
string autocvar_menu_skin
string find_last_color_code(string s)
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
string getWrappedLine_remaining
float(string s, vector size) textLengthUpToWidth_widthFunction_t
const float DRAWFLAG_NORMAL
string entcs_GetName(int i)
void HUD_Notify_Push(string icon, string attacker, string victim)
const float BORDER_MULTIPLIER
void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
#define NET_HANDLE(id, param)
#define MINIGAME_SIMPLELINKED_ENTITIES
Set up automatic entity read/write functionality To ensure that everything is handled automatically,...
string msle_classname(int id)
entity minigame_get_descriptor(string id)
const int MINIG_SF_UPDATE
const int MINIG_SF_CREATE
entity descriptor
For minigame sessions: minigame descriptor object.
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
ERASEABLE string ColorTranslateRGB(string s)
float stringwidth_nocolors(string s, vector theSize)
float stringwidth_colors(string s, vector theSize)