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");
156 string() ReadString_Raw = #366;
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!");
181 float sf = ReadByte();
194 if ( sf & MINIG_SF_CREATE )
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" )
209 if ( sf & MINIG_SF_CREATE )
213 float ent = ReadLong();
215 LOG_DEBUG(
"Player: ",entcs_GetName(ent-1));
220 minigame_ent = this.
owner;
223 this.
team = ReadByte();
235 minigame_ent.minigame_event(minigame_ent,
"network_receive",
this,sf);
237 if ( sf & MINIG_SF_CREATE )
261 if ( take_until >
strlen(s) )
265 for (
int i = 0; i < take_until; i++ )
273 if ( take_until > 0 || skip > 0 )
275 if ( skip == 0 && take_until <
strlen(s) )
277 int last_word = take_until;
278 while(last_word > 0 &&
substring(s, last_word, 1) !=
" ")
281 if ( last_word != 0 )
283 take_until = last_word;
291 else if (tw(
"^7", theFontSize) == 0)
312 mypos_x = pos_x + (maxwidth - stringwidth_nocolors(line, fontsize)) * align;
313 drawstring(mypos, line, fontsize, color, theAlpha, drawflags);
314 mypos_y += fontsize_y;
322 string text,
vector fontsize,
float theAlpha,
int drawflags,
float align )
331 mypos_x = pos_x + (maxwidth - stringwidth_colors(line, fontsize)) * align;
333 mypos_y += fontsize_y;
344 drawstring(pos, line, fontsize, color, theAlpha, drawflags);
348 vector fontsize,
float theAlpha,
int drawflags )
357 drawpic( pos-sz/2, texture, sz, color, thealpha, drawflags );
365 cmd =
"cmd minigame ";
367 for ( i = 0; i < cmdargc; i++ )
368 cmd =
strcat(cmd,...(i,
string));
379 _(
"It's your turn"),
"");
390 if(
argv(1) ==
"minigame")
string ReadString_Zoned()
float minigame_playerslot
string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
string find_last_color_code(string s)
string getWrappedLine_remaining
float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
vector minigame_hud_denormalize_size(vector v, vector pos, vector mySize)
void minigame_read_owner(entity this)
string minigame_texture_skin(string skinname, string name)
bool HUD_MinigameMenu_IsOpened()
void HUD_MinigameMenu_Open()
vector minigame_hud_normalize(vector v, vector pos, vector mySize)
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew)
const int MINIG_SF_UPDATE
void minigame_cmd_workaround(float dummy, string...cmdargc)
void minigame_player_entremove(entity this)
float(string s, vector size) textLengthUpToWidth_widthFunction_t
MUTATOR_HOOKFUNCTION(minigames, HUD_Command)
void deactivate_minigame()
void minigame_drawpic_centered(vector pos, string texture, vector sz, vector color, float thealpha, int drawflags)
string minigame_texture(string name)
#define MINIGAME_SIMPLELINKED_ENTITIES
How to create a minigame
const float BORDER_MULTIPLIER
vector minigame_drawcolorcodedstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
entity minigame_get_descriptor(string id)
string autocvar_menu_skin
void activate_minigame(entity minigame)
const float DRAWFLAG_NORMAL
#define MUTATOR_RETURNVALUE
void minigame_drawstring_trunc(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int MINIG_SF_CREATE
void minigame_entremove(entity this)
vector minigame_hud_denormalize(vector v, vector pos, vector mySize)
void HUD_MinigameMenu_CurrentButton()
void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags)
void HUD_Notify_Push(string icon, string attacker, string victim)
void minigame_hud_simpleboard(vector pos, vector mySize, string board_texture)
MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity(entity e)
bool minigame_hud_mouse_in(vector pos, vector sz)
entity descriptor
For minigame sessions: minigame descriptor object.
bool auto_close_minigamemenu
REGISTER_MUTATOR(minigames, true)
vector minigame_drawstring_wrapped(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align)
string msle_classname(int id)