From 647e23d9f0565eb51615aee7f27cb4bfb955af66 Mon Sep 17 00:00:00 2001 From: TimePath Date: Wed, 16 Sep 2015 15:25:05 +1000 Subject: [PATCH] Run whitespace.sh --- qcsrc/client/quickmenu.qc | 2 +- qcsrc/client/view.qc | 2 +- qcsrc/common/minigames/cl_minigames.qc | 58 +++++----- qcsrc/common/minigames/cl_minigames.qh | 14 +-- qcsrc/common/minigames/cl_minigames_hud.qc | 122 ++++++++++----------- qcsrc/common/minigames/minigame/all.qh | 6 +- qcsrc/common/minigames/minigame/c4.qc | 54 ++++----- qcsrc/common/minigames/minigame/nmm.qc | 86 +++++++-------- qcsrc/common/minigames/minigame/pong.qc | 98 ++++++++--------- qcsrc/common/minigames/minigame/pp.qc | 56 +++++----- qcsrc/common/minigames/minigame/ps.qc | 42 +++---- qcsrc/common/minigames/minigame/qto.qc | 32 +++--- qcsrc/common/minigames/minigame/ttt.qc | 96 ++++++++-------- qcsrc/common/minigames/minigames.qc | 6 +- qcsrc/common/minigames/minigames.qh | 4 +- qcsrc/common/minigames/sv_minigames.qc | 68 ++++++------ qcsrc/common/monsters/spawn.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 22 ++-- qcsrc/common/weapons/weapon/vaporizer.qc | 14 +-- qcsrc/server/cl_client.qc | 6 +- qcsrc/server/cl_player.qc | 2 +- qcsrc/server/mutators/mutator_instagib.qc | 2 +- 22 files changed, 397 insertions(+), 397 deletions(-) diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 484653263..01667366e 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -117,7 +117,7 @@ bool QuickMenu_Open(string mode, string submenu) { if(argv(1) == "") continue; - QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0)); + QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0)); ++QuickMenu_Buffer_Size; QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1)); } diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 1e4d666e9..146d322fc 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -560,7 +560,7 @@ void UpdateCrosshair() CSQC_common_hud(); // crosshair goes VERY LAST - if(!scoreboard_active && !camera_active && intermission != 2 && + if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL && !csqcplayer.viewloc && !HUD_MinigameMenu_IsOpened() ) { diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 83150d7d2..b88d21991 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -4,10 +4,10 @@ void minigame_hud_simpleboard(vector pos, vector mySize, string board_texture) { if(panel.current_panel_bg != "0" && panel.current_panel_bg != "") - draw_BorderPicture(pos - '1 1 0' * panel_bg_border, - panel.current_panel_bg, - mySize + '1 1 0' * 2 * panel_bg_border, - panel_bg_color, panel_bg_alpha, + draw_BorderPicture(pos - '1 1 0' * panel_bg_border, + panel.current_panel_bg, + mySize + '1 1 0' * 2 * panel_bg_border, + panel_bg_color, panel_bg_alpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER)); drawpic(pos, board_texture, mySize, '1 1 1', panel_bg_alpha, DRAWFLAG_NORMAL); } @@ -57,9 +57,9 @@ void initialize_minigames() if ( !last_minig ) minigame_descriptors = minig; \ else last_minig.list_next = minig; \ last_minig = minig; - + REGISTERED_MINIGAMES - + #undef MINIGAME } @@ -139,26 +139,26 @@ void activate_minigame(entity minigame) deactivate_minigame(); return; } - + if ( !minigame.descriptor || minigame.classname != "minigame" ) { LOG_TRACE("Trying to activate unregistered minigame ",minigame.netname," in client\n"); return; } - + if ( minigame == active_minigame ) return; - + if ( active_minigame ) { deactivate_minigame(); } - + if ( minigame_self.owner != minigame ) minigame_self = world; active_minigame = minigame; active_minigame.minigame_event(active_minigame,"activate"); - + if ( HUD_MinigameMenu_IsOpened() ) HUD_MinigameMenu_CurrentButton(); else @@ -207,13 +207,13 @@ void ent_read_minigame() self.classname = msle_classname(ReadShort()); self.netname = ReadString_Zoned(); } - + entity minigame_ent = world; - + if ( self.classname == "minigame" ) { minigame_ent = self; - + if ( sf & MINIG_SF_CREATE ) { self.entremove = minigame_entremove; @@ -236,15 +236,15 @@ void ent_read_minigame() float ent = ReadLong(); self.minigame_playerslot = ent; LOG_TRACE("Player: ",GetPlayerName(ent-1),"\n"); - + activate = (ent == player_localnum+1 && self.owner && self.owner != active_minigame); - + } minigame_ent = self.owner; - + if ( sf & MINIG_SF_UPDATE ) self.team = ReadByte(); - + if ( activate ) { minigame_self = self; @@ -252,7 +252,7 @@ void ent_read_minigame() } } MINIGAME_SIMPLELINKED_ENTITIES - + if ( minigame_ent ) minigame_ent.minigame_event(minigame_ent,"network_receive",self,sf); @@ -283,7 +283,7 @@ string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_ } take_until = textLengthUpToWidth(s, w, theFontSize, tw); - + if ( take_until > strlen(s) ) take_until = strlen(s); @@ -294,7 +294,7 @@ string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_ skip = 1; break; } - + if ( take_until > 0 || skip > 0 ) { if ( skip == 0 && take_until < strlen(s) ) @@ -309,7 +309,7 @@ string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_ skip = 1; } } - + getWrappedLine_remaining = substring(s, take_until+skip, strlen(s) - (take_until+skip)); if(getWrappedLine_remaining == "") getWrappedLine_remaining = string_null; @@ -324,9 +324,9 @@ string minigame_getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_ } } -vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text, +vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align ) -{ +{ getWrappedLine_remaining = text; vector mypos = pos; while ( getWrappedLine_remaining ) @@ -343,7 +343,7 @@ vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text, return mypos; } -vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos, +vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align ) { getWrappedLine_remaining = text; @@ -362,21 +362,21 @@ vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos, return mypos; } -void minigame_drawstring_trunc(float maxwidth, vector pos, string text, +void minigame_drawstring_trunc(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags ) { string line = textShortenToWidth(text,maxwidth,fontsize,stringwidth_nocolors); drawstring(pos, line, fontsize, color, theAlpha, drawflags); } -void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, +void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags ) { string line = textShortenToWidth(text,maxwidth,fontsize,stringwidth_colors); drawcolorcodedstring(pos, line, fontsize, theAlpha, drawflags); } -void minigame_drawpic_centered( vector pos, string texture, vector sz, +void minigame_drawpic_centered( vector pos, string texture, vector sz, vector color, float thealpha, int drawflags ) { drawpic( pos-sz/2, texture, sz, color, thealpha, drawflags ); @@ -394,7 +394,7 @@ void minigame_cmd_workaround(float dummy, string...cmdargc) localcmd(strcat(cmd,"\n")); } -// Prompt the player to play in the current minigame +// Prompt the player to play in the current minigame // (ie: it's their turn and they should get back to the minigame) void minigame_prompt() { diff --git a/qcsrc/common/minigames/cl_minigames.qh b/qcsrc/common/minigames/cl_minigames.qh index 0c1740127..a839b1106 100644 --- a/qcsrc/common/minigames/cl_minigames.qh +++ b/qcsrc/common/minigames/cl_minigames.qh @@ -48,25 +48,25 @@ bool minigame_hud_mouse_in(vector pos, vector sz); // Like drawstring, but wrapping words to fit maxwidth // returns the size of the drawn area // align selects the string alignment (0 = left, 0.5 = center, 1 = right) -vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text, +vector minigame_drawstring_wrapped( float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags, float align ); // Like drawcolorcodedstring, but wrapping words to fit maxwidth // returns the size of the drawn area // align selects the string alignment (0 = left, 0.5 = center, 1 = right) -vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos, +vector minigame_drawcolorcodedstring_wrapped( float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags, float align ); // Like drawstring but truncates the text to fit maxwidth -void minigame_drawstring_trunc(float maxwidth, vector pos, string text, +void minigame_drawstring_trunc(float maxwidth, vector pos, string text, vector fontsize, vector color, float theAlpha, int drawflags ); // Like drawcolorcodedstring but truncates the text to fit maxwidth -void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, +void minigame_drawcolorcodedstring_trunc(float maxwidth, vector pos, string text, vector fontsize, float theAlpha, int drawflags ); // like drawpic but pos represent the center rather than the topleft corner -void minigame_drawpic_centered( vector pos, string texture, vector sz, +void minigame_drawpic_centered( vector pos, string texture, vector sz, vector color, float thealpha, int drawflags ); // Get full path of a minigame texture @@ -103,7 +103,7 @@ void minigame_cmd_workaround(float dummy, string...cmdargc); // Read a minigame entity from the server void ent_read_minigame(); -// Prompt the player to play in the current minigame +// Prompt the player to play in the current minigame // (ie: it's their turn and they should get back to the minigame) void minigame_prompt(); @@ -116,6 +116,6 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_ar #define FOREACH_MINIGAME_ENTITY(entityvar) \ entityvar=world; \ - while( (entityvar = findentity(entityvar,owner,active_minigame)) ) + while( (entityvar = findentity(entityvar,owner,active_minigame)) ) #endif diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 51155f236..11470ec13 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -6,7 +6,7 @@ bool HUD_mouse_over(entity somepanel) { vector pos = stov(cvar_string(strcat("hud_panel_", somepanel.panel_name, "_pos"))); vector sz = stov(cvar_string(strcat("hud_panel_", somepanel.panel_name, "_size"))); - return mousepos_x >= pos_x*vid_conwidth && mousepos_x <= (pos_x+sz_x)*vid_conwidth && + return mousepos_x >= pos_x*vid_conwidth && mousepos_x <= (pos_x+sz_x)*vid_conwidth && mousepos_y >= pos_y*vid_conheight && mousepos_y <= (pos_y+sz_y)*vid_conheight ; } @@ -18,22 +18,22 @@ bool HUD_mouse_over(entity somepanel) void HUD_MinigameBoard () { entity hud_minigame = world; - + if(!autocvar__hud_configure) hud_minigame = active_minigame.descriptor; else hud_minigame = minigame_get_descriptor("nmm"); - + if ( !hud_minigame ) return; - + HUD_Panel_UpdateCvars(); - - + + vector pos, mySize; pos = panel_pos; mySize = panel_size; - + hud_minigame.minigame_hud_board(pos,mySize); } @@ -44,28 +44,28 @@ void HUD_MinigameBoard () void HUD_MinigameStatus () { entity hud_minigame = world; - + if(!autocvar__hud_configure) hud_minigame = active_minigame.descriptor; else hud_minigame = minigame_get_descriptor("nmm"); - + if ( !hud_minigame ) return; - + HUD_Panel_UpdateCvars(); - - + + vector pos, mySize; pos = panel_pos; mySize = panel_size; - + if(panel_bg_padding) { pos += '1 1 0' * panel_bg_padding; mySize -= '2 2 0' * panel_bg_padding; } - + hud_minigame.minigame_hud_status(pos,mySize); } @@ -87,7 +87,7 @@ void HUD_MinigameMenu_InsertEntry(entity newentry, entity prev) HUD_MinigameMenu_last_entry = newentry; return; } - + newentry.list_prev = prev; newentry.list_next = prev.list_next; if ( prev.list_next ) @@ -95,7 +95,7 @@ void HUD_MinigameMenu_InsertEntry(entity newentry, entity prev) else HUD_MinigameMenu_last_entry = newentry; prev.list_next = newentry; - + } @@ -120,20 +120,20 @@ void HUD_MinigameMenu_EraseEntry ( entity e ) { HUD_MinigameMenu_Click(e); } - + if ( e.list_prev ) e.list_prev.list_next = e.list_next; else HUD_MinigameMenu_entries = e.list_next; - + if ( e.list_next ) e.list_next.list_prev = e.list_prev; else HUD_MinigameMenu_last_entry = e.list_prev; - + if ( HUD_MinigameMenu_activeitem == e ) HUD_MinigameMenu_activeitem = world; - + remove(e); } @@ -175,7 +175,7 @@ bool HUD_MinigameMenu_Click_ExpandCollapse() entity e; if ( self.flags & 2 ) { - if ( HUD_MinigameMenu_activeitem && + if ( HUD_MinigameMenu_activeitem && HUD_MinigameMenu_activeitem.owner == self ) HUD_MinigameMenu_activeitem = world; self.flags &= ~2; @@ -198,9 +198,9 @@ bool HUD_MinigameMenu_Click_ExpandCollapse() if ( e.flags & 2 && e.origin_x == self.origin_x) HUD_MinigameMenu_Click(e); } - + self.flags |= 2; - + return true; } return false; @@ -323,9 +323,9 @@ void HUD_MinigameMenu_ClickCurrentGame() { HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry( _("Quit"), HUD_MinigameMenu_ClickQuit, self ), self); - + active_minigame.minigame_event(active_minigame,"menu_show",self); - + HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry( _("Invite"), HUD_MinigameMenu_ClickInvite, self), self); } @@ -375,7 +375,7 @@ void HUD_MinigameMenu_CurrentButton() HUD_MinigameMenu_InsertEntry(currb,HUD_MinigameMenu_last_entry); HUD_MinigameMenu_Click(currb); } - else + else { entity p; for ( e = HUD_MinigameMenu_last_entry; e != world; e = p.list_prev ) @@ -430,11 +430,11 @@ void HUD_MinigameMenu_MouseInput() panel_pos += '1 1 0' * panel_bg_padding; panel_size -= '2 2 0' * panel_bg_padding; } - + entity e; - + panel_pos_y += hud_fontsize_y*2; - + HUD_MinigameMenu_activeitem = world; vector sz; for ( e = HUD_MinigameMenu_entries; e != world; e = e.list_next ) @@ -465,14 +465,14 @@ void HUD_MinigameMenu_DrawColoredEntry(vector pos, string s, vector fontsize) // Minigame menu panel UI void HUD_MinigameMenu () -{ +{ if ( !HUD_MinigameMenu_IsOpened() ) return; - + HUD_Panel_UpdateCvars(); - + HUD_Panel_DrawBg(1); - + if(panel_bg_padding) { panel_pos += '1 1 0' * panel_bg_padding; @@ -489,16 +489,16 @@ void HUD_MinigameMenu () for ( entity e = HUD_MinigameMenu_entries; e != world; e = e.list_next ) { color = e.colormod; - + offset = e.origin; itemh = e.size_y; - + if ( e.model ) itemh = imgsz_y; - + if ( e.flags & 2 ) { - drawfill(panel_pos, eX*panel_size_x + eY*itemh, e.colormod, + drawfill(panel_pos, eX*panel_size_x + eY*itemh, e.colormod, panel_fg_alpha, DRAWFLAG_NORMAL); color = '0 0 0'; } @@ -509,15 +509,15 @@ void HUD_MinigameMenu () offset_x += imgsz_x; offset_y = (imgsz_y-e.size_y) / 2; } - + if ( e.flags & 1 ) HUD_MinigameMenu_DrawColoredEntry(panel_pos+offset,e.message,e.size); else HUD_MinigameMenu_DrawEntry(panel_pos+offset,e.message,e.size,color); - + if ( e == HUD_MinigameMenu_activeitem ) drawfill(panel_pos, eX*panel_size_x + eY*itemh,'1 1 1', 0.25, DRAWFLAG_ADDITIVE); - + panel_pos_y += itemh; } } @@ -529,29 +529,29 @@ void HUD_MinigameMenu () void HUD_MinigameHelp() { string help_message; - + if(!autocvar__hud_configure) help_message = active_minigame.message; else help_message = "Minigame message"; - + if ( !help_message ) return; - + HUD_Panel_UpdateCvars(); - - + + vector pos, mySize; pos = panel_pos; mySize = panel_size; - + if(panel_bg_padding) { pos += '1 1 0' * panel_bg_padding; mySize -= '2 2 0' * panel_bg_padding; } - - minigame_drawcolorcodedstring_wrapped( mySize_x, pos, help_message, + + minigame_drawcolorcodedstring_wrapped( mySize_x, pos, help_message, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5 ); } @@ -560,7 +560,7 @@ void HUD_MinigameHelp() // ==================================================================== float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary) { - + if( !HUD_MinigameMenu_IsOpened() || autocvar__hud_configure ) return false; @@ -571,7 +571,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary if ( minigame_isactive() && HUD_mouse_over(HUD_PANEL(MINIGAME_BOARD)) ) active_minigame.minigame_event(active_minigame,"mouse_moved",mousepos); return true; - + } else { @@ -589,7 +589,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary if(nPrimary == K_MOUSE1) mouseClicked -= (mouseClicked & S_MOUSE1); if(nPrimary == K_MOUSE2) mouseClicked -= (mouseClicked & S_MOUSE2); } - + // allow some binds string con_keys; con_keys = findkeysforcommand("toggleconsole", 0); @@ -599,7 +599,7 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary if(nPrimary == stof(argv(i))) return false; } - + if ( minigame_isactive() && ( bInputType == 0 || bInputType == 1 ) ) { string device = ""; @@ -611,14 +611,14 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary } else device = "key"; - + if ( device && active_minigame.minigame_event( active_minigame,strcat(device,"_",action),nPrimary) ) return true; - + /// TODO: bInputType == 2? } - + if ( bInputType == 0 ) { if ( nPrimary == K_MOUSE1 && HUD_MinigameMenu_activeitem && @@ -665,16 +665,16 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary } } } - + return false; } void HUD_Minigame_Mouse() -{ +{ if( !HUD_MinigameMenu_IsOpened() || autocvar__hud_configure || mv_active ) return; - + if(!autocvar_hud_cursormode) { mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; @@ -682,12 +682,12 @@ void HUD_Minigame_Mouse() mousepos_x = bound(0, mousepos_x, vid_conwidth); mousepos_y = bound(0, mousepos_y, vid_conheight); } - + if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) ) HUD_MinigameMenu_MouseInput(); - + vector cursorsize = '32 32 0'; - drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), + drawpic(mousepos-'8 4 0', strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } diff --git a/qcsrc/common/minigames/minigame/all.qh b/qcsrc/common/minigames/minigame/all.qh index d1899e759..afcc93d48 100644 --- a/qcsrc/common/minigames/minigame/all.qh +++ b/qcsrc/common/minigames/minigame/all.qh @@ -47,7 +47,7 @@ used as send flags for minigame entities: * MINIG_SF_UPDATE A miscellaneous update, can be safely used if the entity has just a few fields * MINIG_SF_CUSTOM - Starting value for custom flags, since there are bit-wise flags, + Starting value for custom flags, since there are bit-wise flags, the following values shall be MINIG_SF_CUSTOM*2, MINIG_SF_CUSTOM*4 and MINIG_SF_CUSTOM*8. * MINIG_SF_MAX Maximum flag value that will be networked @@ -89,7 +89,7 @@ that .owner is set to the minigame session entity and .minigame_autoclean is tru * Set up automatic entity read/write functionality * To ensure that everything is handled automatically, spawn on the server using msle_spawn * Syntax: - * MSLE(classname,Field...) \ + * MSLE(classname,Field...) \ * classname: Identifier used to recognize the type of the entity * (must be set as .classname on the sent entities) * Field... : List of FIELD calls @@ -116,4 +116,4 @@ that .owner is set to the minigame session entity and .minigame_autoclean is tru MSLE(pong_paddle,FIELD(MINIG_SF_CREATE,Byte,team) FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(MINIG_SF_UPDATE,Vector2D,origin)) \ MSLE(pong_ball,FIELD(MINIG_SF_CREATE,Float,pong_length) FIELD(PONG_SF_BALLTEAM,Byte,team) FIELD(MINIG_SF_UPDATE, Vector2D, velocity) FIELD(MINIG_SF_UPDATE, Vector2D, origin)) \ MSLE(pong_ai, FIELD(MINIG_SF_CREATE,Byte,team) FIELD(PONG_SF_PLAYERSCORE, Long, pong_score)) \ - /*empty line*/ + /*empty line*/ diff --git a/qcsrc/common/minigames/minigame/c4.qc b/qcsrc/common/minigames/minigame/c4.qc index a153b3993..31388d0f3 100644 --- a/qcsrc/common/minigames/minigame/c4.qc +++ b/qcsrc/common/minigames/minigame/c4.qc @@ -120,7 +120,7 @@ bool c4_winning_piece(entity piece) if(found >= C4_WIN_CNT) return true; - + return false; } @@ -222,15 +222,15 @@ int c4_server_event(entity minigame, string event, ...) { switch(argv(0)) { - case "move": - c4_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); + case "move": + c4_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); return true; } return false; } } - + return false; } @@ -248,7 +248,7 @@ void c4_hud_board(vector pos, vector mySize) minigame_hud_fitsqare(pos, mySize); c4_boardpos = pos; c4_boardsize = mySize; - + minigame_hud_simpleboard(pos,mySize,minigame_texture("c4/board_under")); drawpic(pos, minigame_texture("c4/board_over"), mySize, '1 1 1', 1, 0); @@ -261,11 +261,11 @@ void c4_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(c4_curr_pos,C4_NUM_CNT,C4_LET_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("c4/piece",ftos(minigame_self.team))), tile_size, '1 1 1', panel_fg_alpha/2, DRAWFLAG_NORMAL ); } - + entity e; FOREACH_MINIGAME_ENTITY(e) { @@ -273,11 +273,11 @@ void c4_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(e.netname,C4_NUM_CNT,C4_LET_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - + if ( active_minigame.minigame_flags & C4_TURN_WIN ) if ( !e.c4_checkwin ) e.c4_checkwin = c4_winning_piece(e) ? 1 : -1; - + float icon_color = 1; if ( e.c4_checkwin == -1 ) icon_color = 0.4; @@ -287,8 +287,8 @@ void c4_hud_board(vector pos, vector mySize) minigame_drawpic_centered( tile_pos, minigame_texture("c4/winglow"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE ); } - - minigame_drawpic_centered( tile_pos, + + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("c4/piece",ftos(e.team))), tile_size, '1 1 1'*icon_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -299,20 +299,20 @@ void c4_hud_board(vector pos, vector mySize) vector winfs = hud_fontsize*2; string playername = ""; FOREACH_MINIGAME_ENTITY(e) - if ( e.classname == "minigame_player" && + if ( e.classname == "minigame_player" && e.team == (active_minigame.minigame_flags & C4_TURN_TEAM) ) playername = GetPlayerName(e.minigame_playerslot-1); - + vector win_pos = pos+eY*(mySize_y-winfs_y)/2; vector win_sz; win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, 0, DRAWFLAG_NORMAL, 0.5); - + drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); - + minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } } @@ -325,10 +325,10 @@ void c4_hud_status(vector pos, vector mySize) vector ts; ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); - + pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; @@ -353,12 +353,12 @@ void c4_hud_status(vector pos, vector mySize) minigame_drawcolorcodedstring_trunc(mySize_x,mypos, GetPlayerName(e.minigame_playerslot-1), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + mypos_y += player_fontsize_y; - drawpic( mypos, + drawpic( mypos, minigame_texture(strcat("c4/piece",ftos(e.team))), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); - + mypos_x += tile_size_x; } } @@ -369,20 +369,20 @@ string c4_turn_to_string(int turnflags) { if ( turnflags & C4_TURN_DRAW ) return _("Draw"); - + if ( turnflags & C4_TURN_WIN ) { if ( (turnflags&C4_TURN_TEAM) != minigame_self.team ) return _("You lost the game!"); return _("You win!"); } - + if ( (turnflags & C4_TURN_TEAM) != minigame_self.team ) return _("Wait for your opponent to make their move"); - + if ( turnflags & C4_TURN_PLACE ) return _("Click on the game board to place your piece"); - + return ""; } @@ -502,4 +502,4 @@ int c4_client_event(entity minigame, string event, ...) return false; } -#endif \ No newline at end of file +#endif diff --git a/qcsrc/common/minigames/minigame/nmm.qc b/qcsrc/common/minigames/minigame/nmm.qc index 5b9dd1ffe..2bd4a4267 100644 --- a/qcsrc/common/minigames/minigame/nmm.qc +++ b/qcsrc/common/minigames/minigame/nmm.qc @@ -72,7 +72,7 @@ string nmm_tile_build_vmill(entity tile) // Create an new tile // \param id Tile index (eg: a1) -// \param minig Owner minigame instance +// \param minig Owner minigame instance // \param distance Distance from adjacent tiles void nmm_spawn_tile(string id, entity minig, int distance) { @@ -89,7 +89,7 @@ void nmm_spawn_tile(string id, entity minig, int distance) } // Create a tile square and recursively create inner squares -// \param minig Owner minigame instance +// \param minig Owner minigame instance // \param offset Index offset (eg: 1 to start the square at b2, 0 at a1 etc.) // \param skip Number of indices to skip between tiles (eg 1: a1, a3) void nmm_spawn_tile_square( entity minig, int offset, int skip ) @@ -107,7 +107,7 @@ void nmm_spawn_tile_square( entity minig, int offset, int skip ) } letter += skip+1; } - + if ( skip > 0 ) nmm_spawn_tile_square(minig,offset+1,skip-1); } @@ -145,10 +145,10 @@ entity nmm_find_tile(entity minig, string id) // Check whether two tiles are adjacent bool nmm_tile_adjacent(entity tile1, entity tile2) { - + int dnumber = fabs ( minigame_tile_number(tile1.netname) - minigame_tile_number(tile2.netname) ); int dletter = fabs ( minigame_tile_letter(tile1.netname) - minigame_tile_letter(tile2.netname) ); - + return ( dnumber == 0 && ( dletter == 1 || dletter == tile1.nmm_tile_distance ) ) || ( dletter == 0 && ( dnumber == 1 || dnumber == tile1.nmm_tile_distance ) ); } @@ -158,7 +158,7 @@ bool nmm_tile_canmove(entity tile) { entity e = world; while ( ( e = findentity(e,owner,tile.owner) ) ) - if ( e.classname == "minigame_nmm_tile" && !e.nmm_tile_piece + if ( e.classname == "minigame_nmm_tile" && !e.nmm_tile_piece && nmm_tile_adjacent(e,tile) ) { return true; @@ -182,7 +182,7 @@ bool nmm_in_mill_string(entity tile, string s) // Check if a tile is in a mill bool nmm_in_mill(entity tile) { - return tile.nmm_tile_piece && ( + return tile.nmm_tile_piece && ( nmm_in_mill_string(tile,tile.nmm_tile_hmill) || nmm_in_mill_string(tile,tile.nmm_tile_vmill) ); } @@ -194,7 +194,7 @@ entity nmm_find_piece(entity start, entity minigame, int teamn, int pieceflags) { entity e = start; while ( ( e = findentity(e,owner,minigame) ) ) - if ( e.classname == "minigame_board_piece" && + if ( e.classname == "minigame_board_piece" && (e.minigame_flags & pieceflags) && e.team == teamn ) return e; return world; @@ -227,7 +227,7 @@ int nmm_server_event(entity minigame, string event, ...) e.team = 2; e.minigame_flags = NMM_PIECE_HOME; } - + return 1; } else if ( event == "end" ) @@ -253,8 +253,8 @@ int nmm_server_event(entity minigame, string event, ...) entity tile = world; entity piece = world; bool move_ok = false; - - if ( e && argc >= 2 && argv(0) == "move" && + + if ( e && argc >= 2 && argv(0) == "move" && ( minigame.minigame_flags & NMM_TURN_TEAM ) == e.team ) { tile = nmm_find_tile(minigame,argv(1)); @@ -290,7 +290,7 @@ int nmm_server_event(entity minigame, string event, ...) move_ok = true; } } - + } else if ( minigame.minigame_flags & NMM_TURN_FLY ) { @@ -308,7 +308,7 @@ int nmm_server_event(entity minigame, string event, ...) move_ok = true; } } - + } else if ( minigame.minigame_flags & NMM_TURN_TAKE ) { @@ -321,10 +321,10 @@ int nmm_server_event(entity minigame, string event, ...) move_ok = true; } } - + int nextteam = e.team % 2 + 1; int npieces = nmm_count_pieces(minigame,nextteam,NMM_PIECE_HOME|NMM_PIECE_BOARD); - + if ( npieces < 3 ) { minigame.minigame_flags = NMM_TURN_WIN | e.team; @@ -431,7 +431,7 @@ void nmm_hud_board(vector pos, vector mySize) nmm_boardpos = pos; nmm_boardsize = mySize; minigame_hud_simpleboard(pos,mySize,minigame_texture("nmm/board")); - + vector tile_size = minigame_hud_denormalize_size('1 1 0'/7,pos,mySize); vector tile_pos; entity e; @@ -440,7 +440,7 @@ void nmm_hud_board(vector pos, vector mySize) if ( e.classname == "minigame_nmm_tile" ) { tile_pos = minigame_hud_denormalize(e.origin,pos,mySize); - + if ( e == nmm_fromtile ) { minigame_drawpic_centered( tile_pos, minigame_texture("nmm/tile_active"), @@ -451,43 +451,43 @@ void nmm_hud_board(vector pos, vector mySize) minigame_drawpic_centered( tile_pos, minigame_texture("nmm/tile_available"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); } - + if ( e == nmm_currtile ) { minigame_drawpic_centered( tile_pos, minigame_texture("nmm/tile_selected"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE ); } - + if ( e.nmm_tile_piece ) { - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("nmm/piece",ftos(e.nmm_tile_piece.team))), tile_size*0.8, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); } - + //drawstring(tile_pos, e.netname, hud_fontsize, '1 0 0', 1, DRAWFLAG_NORMAL); } } - + if ( active_minigame.minigame_flags & NMM_TURN_WIN ) { vector winfs = hud_fontsize*2; string playername = ""; FOREACH_MINIGAME_ENTITY(e) - if ( e.classname == "minigame_player" && + if ( e.classname == "minigame_player" && e.team == (active_minigame.minigame_flags & NMM_TURN_TEAM) ) playername = GetPlayerName(e.minigame_playerslot-1); - + vector win_pos = pos+eY*(mySize_y-winfs_y)/2; vector win_sz; win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, 0, DRAWFLAG_NORMAL, 0.5); - + drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); - + minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } } @@ -497,16 +497,16 @@ void nmm_hud_status(vector pos, vector mySize) { HUD_Panel_DrawBg(1); vector ts; - + ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; - + float player1x = 0; float player2x = 0; vector piece_sz = '48 48 0'; @@ -514,14 +514,14 @@ void nmm_hud_status(vector pos, vector mySize) vector mypos; float piece_light = 1; entity e = world; - + mypos = pos; if ( (active_minigame.minigame_flags&NMM_TURN_TEAM) == 2 ) mypos_y += player_fontsize_y + ts_y; drawfill(mypos,eX*mySize_x+eY*player_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); mypos_y += player_fontsize_y; drawfill(mypos,eX*mySize_x+eY*piece_sz_y,'1 1 1',0.25,DRAWFLAG_ADDITIVE); - + FOREACH_MINIGAME_ENTITY(e) { if ( e.classname == "minigame_player" ) @@ -554,7 +554,7 @@ void nmm_hud_status(vector pos, vector mySize) piece_light = 1; else piece_light = 0.15; - + drawpic(mypos, minigame_texture(strcat("nmm/piece",ftos(e.team))), piece_sz, '1 1 1'*piece_light, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -600,7 +600,7 @@ string nmm_turn_to_string(int turnflags) return _("You lost the game!"); return _("You win!"); } - + if ( (turnflags&NMM_TURN_TEAM) != minigame_self.team ) return _("Wait for your opponent to make their move"); if ( turnflags & NMM_TURN_PLACE ) @@ -611,7 +611,7 @@ string nmm_turn_to_string(int turnflags) return _("You can select one of your pieces to move it anywhere on the board"); if ( turnflags & NMM_TURN_TAKE ) return _("You can take one of the opponent's pieces"); - + return ""; } @@ -640,7 +640,7 @@ int nmm_client_event(entity minigame, string event, ...) else { string tileid = nmm_currtile.netname; - nmm_currtile = world; + nmm_currtile = world; while ( !nmm_currtile ) { tileid = minigame_relative_tile(tileid,1,0,7,7); @@ -655,7 +655,7 @@ int nmm_client_event(entity minigame, string event, ...) else { string tileid = nmm_currtile.netname; - nmm_currtile = world; + nmm_currtile = world; while ( !nmm_currtile ) { tileid = minigame_relative_tile(tileid,-1,0,7,7); @@ -670,7 +670,7 @@ int nmm_client_event(entity minigame, string event, ...) else { string tileid = nmm_currtile.netname; - nmm_currtile = world; + nmm_currtile = world; while ( !nmm_currtile ) { tileid = minigame_relative_tile(tileid,0,1,7,7); @@ -685,7 +685,7 @@ int nmm_client_event(entity minigame, string event, ...) else { string tileid = nmm_currtile.netname; - nmm_currtile = world; + nmm_currtile = world; while ( !nmm_currtile ) { tileid = minigame_relative_tile(tileid,0,-1,7,7); @@ -745,15 +745,15 @@ int nmm_client_event(entity minigame, string event, ...) } } } - else if ( self.classname == "minigame" && ( ...(1,int) & MINIG_SF_UPDATE ) ) + else if ( self.classname == "minigame" && ( ...(1,int) & MINIG_SF_UPDATE ) ) { self.message = nmm_turn_to_string(self.minigame_flags); if ( self.minigame_flags & minigame_self.team ) minigame_prompt(); } } - + return 0; } -#endif +#endif diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 0049fc93f..e295c7cd6 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -74,13 +74,13 @@ void pong_add_score(entity minigame, int team_thrower, int team_receiver, int de { if ( !minigame ) return; - + if ( team_thrower == 0 ) team_thrower = team_receiver; - + if ( team_thrower == team_receiver ) delta *= -1; - + entity paddle_thrower = minigame.pong_paddles[team_thrower-1]; if ( paddle_thrower.realowner.minigame_players ) { @@ -105,11 +105,11 @@ void pong_paddle_bounce(entity ball, int pteam) case 3: ball.velocity_y = fabs(ball.velocity_y); break; case 4: ball.velocity_y = -fabs(ball.velocity_y); break; } - + float angle = atan2(ball.velocity_y, ball.velocity_x); angle += ( random() - 0.5 ) * 2 * M_PI/6; float speed = vlen(ball.velocity); - + ball.velocity_y = speed * sin(angle); ball.velocity_x = speed * cos(angle); } @@ -120,7 +120,7 @@ bool pong_paddle_hit(entity ball, int pteam) entity paddle = ball.owner.pong_paddles[pteam-1]; if (!paddle) return false; - vector near_point = box_nearest(paddle.mins+paddle.origin, + vector near_point = box_nearest(paddle.mins+paddle.origin, paddle.maxs+paddle.origin, ball.origin); return vlen(near_point-ball.origin) <= ball.pong_length ; } @@ -131,14 +131,14 @@ bool pong_goal(entity ball, int pteam) entity paddle = ball.owner.pong_paddles[pteam-1]; if (!paddle) return false; - + if ( !pong_paddle_hit(ball, pteam) ) { pong_add_score(ball.owner ,ball.team, pteam, 1); pong_ball_reset(ball); return true; } - + return false; } @@ -147,11 +147,11 @@ void pong_ball_think() {SELFPARAM(); float think_speed = autocvar_sys_ticrate; self.nextthink = time + think_speed; - + self.origin_x += self.velocity_x * think_speed; self.origin_y += self.velocity_y * think_speed; self.SendFlags |= MINIG_SF_UPDATE; - + int i; for ( i = 1; i <= PONG_MAX_PLAYERS; i++ ) if ( pong_paddle_hit(self, i) ) @@ -161,7 +161,7 @@ void pong_ball_think() self.SendFlags |= PONG_SF_BALLTEAM; return; } - + if ( self.origin_y <= self.pong_length ) { if ( !pong_goal(self,3) ) @@ -178,7 +178,7 @@ void pong_ball_think() self.velocity_y *= -1; } } - + if ( self.origin_x <= self.pong_length ) { if ( !pong_goal(self,2) ) @@ -195,7 +195,7 @@ void pong_ball_think() self.velocity_x *= -1; } } - + } // AI action @@ -203,7 +203,7 @@ void pong_ai_think() {SELFPARAM(); float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed; self.nextthink = time + think_speed; - + float distance; float next_distance; float min_distance = 1; @@ -220,11 +220,11 @@ void pong_ai_think() ball = mayball; } } - + float target = 0.5; float self_pos; - - + + if ( self.team <= 2 ) { if ( ball ) @@ -237,7 +237,7 @@ void pong_ai_think() target = ball.origin_x + ball.velocity_x*think_speed; self_pos = self.pong_ai_paddle.origin_x; } - + distance = self.pong_length/2 * autocvar_sv_minigames_pong_ai_tolerance + autocvar_sv_minigames_pong_paddle_speed * think_speed; @@ -257,9 +257,9 @@ entity pong_ai_spawn(entity paddle) ai.think = pong_ai_think; ai.nextthink = time; ai.pong_ai_paddle = paddle; - + paddle.realowner = ai; - + return ai; } @@ -269,20 +269,20 @@ void pong_paddle_think() float think_speed = autocvar_sys_ticrate; self.nextthink = time + think_speed; - if ( self.realowner.minigame_players.pong_keys == PONG_KEY_INCREASE || + if ( self.realowner.minigame_players.pong_keys == PONG_KEY_INCREASE || self.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE ) { float movement = autocvar_sv_minigames_pong_paddle_speed * think_speed; float halflen = self.pong_length/2; - + if ( self.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE ) movement *= -1; - + if ( self.team > 2 ) self.origin_x = bound(halflen, self.origin_x+movement, 1-halflen); else self.origin_y = bound(halflen, self.origin_y+movement, 1-halflen); - + self.SendFlags |= MINIG_SF_UPDATE; } } @@ -318,14 +318,14 @@ entity pong_paddle_spawn(entity minigame, int pl_team, entity real_player) paddle.team = pl_team; paddle.mins = pong_team_to_box_halfsize(pl_team,-paddle.pong_length,-1/16); paddle.maxs = pong_team_to_box_halfsize(pl_team,paddle.pong_length,1/16); - + if ( real_player == world ) pong_ai_spawn(paddle); else paddle.realowner = real_player; - + minigame.pong_paddles[pl_team-1] = paddle; - + return paddle; } @@ -345,7 +345,7 @@ int pong_server_event(entity minigame, string event, ...) // Don't allow joining a match that is already running if ( minigame.minigame_flags & PONG_STATUS_PLAY ) return false; - + entity player = ...(0,entity); int i; for ( i = 0; i < PONG_MAX_PLAYERS; i++ ) @@ -356,7 +356,7 @@ int pong_server_event(entity minigame, string event, ...) return i+1; } } - + return false; } case "part": @@ -374,7 +374,7 @@ int pong_server_event(entity minigame, string event, ...) ai.pong_score = player.minigame_players.pong_score; break; } - + } return false; } @@ -389,7 +389,7 @@ int pong_server_event(entity minigame, string event, ...) minigame.minigame_flags = PONG_STATUS_PLAY | (minigame.minigame_flags & ~PONG_STATUS_WAIT); minigame.SendFlags |= MINIG_SF_UPDATE; - + int i; entity ball; for ( i = 0; i < autocvar_sv_minigames_pong_ball_number; i++ ) @@ -436,7 +436,7 @@ int pong_server_event(entity minigame, string event, ...) for ( i = PONG_MAX_PLAYERS-1; i >= 0; i-- ) { paddle = minigame.pong_paddles[i]; - if ( paddle != world && + if ( paddle != world && paddle.realowner.classname == "pong_ai" ) { minigame.pong_paddles[i] = world; @@ -449,7 +449,7 @@ int pong_server_event(entity minigame, string event, ...) sprint(player.minigame_players,"Cannot remove AI\n"); return true; } - + } return false; } @@ -501,7 +501,7 @@ void pong_hud_board(vector pos, vector mySize) { minigame_hud_fitsqare(pos, mySize); minigame_hud_simpleboard(pos,mySize,minigame_texture("pong/board")); - + entity e; vector obj_pos; vector obj_size; @@ -512,27 +512,27 @@ void pong_hud_board(vector pos, vector mySize) // Note: 4*radius = 2*diameter because the image is large enough to fit the glow around the ball obj_size = minigame_hud_denormalize_size('4 4 0'*e.pong_length,pos,mySize); obj_pos = minigame_hud_denormalize(e.origin,pos,mySize); - + minigame_drawpic_centered( obj_pos, minigame_texture("pong/ball"), obj_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); - + minigame_drawpic_centered( obj_pos, minigame_texture("pong/ball-glow"), - obj_size, pong_team_to_color(e.team), + obj_size, pong_team_to_color(e.team), panel_fg_alpha, DRAWFLAG_ADDITIVE ); } else if ( e.classname == "pong_paddle" ) { obj_pos = minigame_hud_denormalize(e.origin,pos,mySize); obj_size = minigame_hud_denormalize_size(eX / 16 + eY*e.pong_length,pos,mySize); - - drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle-glow"), - obj_size, obj_size/2, pong_team_to_color(e.team), + + drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle-glow"), + obj_size, obj_size/2, pong_team_to_color(e.team), panel_fg_alpha, DRAWFLAG_ADDITIVE ); - - drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle"), - obj_size, obj_size/2, '1 1 1', + + drawrotpic(obj_pos, pong_team_to_angle(e.team), minigame_texture("pong/paddle"), + obj_size, obj_size/2, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); - + } } } @@ -547,7 +547,7 @@ void pong_hud_status(vector pos, vector mySize) ts_y += hud_fontsize_y; pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - PONG_MAX_PLAYERS*player_fontsize_y ) / PONG_MAX_PLAYERS; ts_x = mySize_x; @@ -560,16 +560,16 @@ void pong_hud_status(vector pos, vector mySize) { mypos = pos; mypos_y += (e.team-1) * (player_fontsize_y + ts_y); - + drawfill(mypos, ts, pong_team_to_color(e.team), 0.25, DRAWFLAG_ADDITIVE); - + minigame_drawcolorcodedstring_trunc(mySize_x,mypos, (e.minigame_playerslot ? GetPlayerName(e.minigame_playerslot-1) : _("AI")), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + drawstring(mypos+eY*player_fontsize_y,ftos(e.pong_score),'48 48 0', '0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL); - + if ( e == minigame_self ) drawborderlines(1, mypos, ts, pong_team_to_color(e.team), 1, DRAWFLAG_NORMAL); } diff --git a/qcsrc/common/minigames/minigame/pp.qc b/qcsrc/common/minigames/minigame/pp.qc index eacb985be..01b257a82 100644 --- a/qcsrc/common/minigames/minigame/pp.qc +++ b/qcsrc/common/minigames/minigame/pp.qc @@ -58,7 +58,7 @@ bool pp_winning_piece(entity piece) if(!pp_valid_tile(minigame_tile_buildname(letter+1,number-1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter+1,number-1)).team == 5) if(!pp_valid_tile(minigame_tile_buildname(letter-1,number+1)) || pp_find_piece(piece.owner,minigame_tile_buildname(letter-1,number+1)).team == 5) return true; - + return false; } @@ -233,8 +233,8 @@ int pp_server_event(entity minigame, string event, ...) { switch(argv(0)) { - case "move": - pp_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); + case "move": + pp_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); return true; case "next": pp_next_match(minigame,...(0,entity)); @@ -257,7 +257,7 @@ int pp_server_event(entity minigame, string event, ...) return false; } } - + return false; } @@ -275,7 +275,7 @@ void pp_hud_board(vector pos, vector mySize) minigame_hud_fitsqare(pos, mySize); pp_boardpos = pos; pp_boardsize = mySize; - + minigame_hud_simpleboard(pos,mySize,minigame_texture("pp/board")); vector tile_size = minigame_hud_denormalize_size('1 1 0'/PP_TILE_SIZE,pos,mySize); @@ -305,7 +305,7 @@ void pp_hud_board(vector pos, vector mySize) case 2: tile_color = '0.3 0.3 1'; break; // 3, 4 coming later? } - + string tile_name = strcat("pp/piece",ftos(e.team)); if(e.team == 5) { tile_name = "pp/piece_taken"; } @@ -314,12 +314,12 @@ void pp_hud_board(vector pos, vector mySize) tile_name = "pp/piece_current"; // draw the splat too - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("pp/piece_taken"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); } - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture(tile_name), tile_size, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -330,7 +330,7 @@ void pp_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(pp_curr_pos,PP_LET_CNT,PP_NUM_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("pp/piece_current"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -338,7 +338,7 @@ void pp_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(pp_curr_pos,PP_LET_CNT,PP_NUM_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("pp/piece_selected"), tile_size, '1 1 1', panel_fg_alpha / 2, DRAWFLAG_NORMAL ); } @@ -348,20 +348,20 @@ void pp_hud_board(vector pos, vector mySize) vector winfs = hud_fontsize*2; string playername = ""; FOREACH_MINIGAME_ENTITY(e) - if ( e.classname == "minigame_player" && + if ( e.classname == "minigame_player" && e.team == (active_minigame.minigame_flags & PP_TURN_TEAM) ) playername = GetPlayerName(e.minigame_playerslot-1); - + vector win_pos = pos+eY*(mySize_y-winfs_y)/2; vector win_sz; win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, 0, DRAWFLAG_NORMAL, 0.5); - + drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); - + minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("%s^7 won the game!",playername), + sprintf("%s^7 won the game!",playername), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } } @@ -374,10 +374,10 @@ void pp_hud_status(vector pos, vector mySize) vector ts; ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); - + pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; @@ -410,17 +410,17 @@ void pp_hud_status(vector pos, vector mySize) minigame_drawcolorcodedstring_trunc(mySize_x,mypos, GetPlayerName(e.minigame_playerslot-1), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + mypos_y += player_fontsize_y; - drawpic( mypos, + drawpic( mypos, minigame_texture(strcat("pp/piece",ftos(e.team))), tile_size, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL ); - + mypos_x += tile_size_x; int myscore = 0; if(e.team == 1) { myscore = active_minigame.pp_team1_score; } if(e.team == 2) { myscore = active_minigame.pp_team2_score; } - + drawstring(mypos,ftos(myscore),tile_size, '0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL); } @@ -432,27 +432,27 @@ string pp_turn_to_string(int turnflags) { if ( turnflags & PP_TURN_DRAW ) return _("Draw"); - + if ( turnflags & PP_TURN_WIN ) { if ( (turnflags&PP_TURN_TEAM) != minigame_self.team ) return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!"); return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!"); } - + if ( turnflags & PP_TURN_NEXT ) { if ( (turnflags&PP_TURN_TEAM) != minigame_self.team ) return _("Select \"^1Next Match^7\" on the menu to start a new match!"); return _("Wait for your opponent to confirm the rematch"); } - + if ( (turnflags & PP_TURN_TEAM) != minigame_self.team ) return _("Wait for your opponent to make their move"); - + if ( turnflags & PP_TURN_PLACE ) return _("Click on the game board to place your piece"); - + return ""; } @@ -589,4 +589,4 @@ int pp_client_event(entity minigame, string event, ...) return false; } -#endif \ No newline at end of file +#endif diff --git a/qcsrc/common/minigames/minigame/ps.qc b/qcsrc/common/minigames/minigame/ps.qc index 3acef2fd5..2b8de2992 100644 --- a/qcsrc/common/minigames/minigame/ps.qc +++ b/qcsrc/common/minigames/minigame/ps.qc @@ -102,7 +102,7 @@ bool ps_winning_piece(entity minigame) return false; // a move is valid, abort! } } - + return true; } @@ -248,7 +248,7 @@ int ps_server_event(entity minigame, string event, ...) { switch(argv(0)) { - case "move": + case "move": ps_move(minigame, ...(0,entity), (...(1,int) == 3 ? argv(1) : string_null), (...(1,int) == 3 ? argv(2) : string_null)); return true; @@ -257,7 +257,7 @@ int ps_server_event(entity minigame, string event, ...) return false; } } - + return false; } @@ -275,7 +275,7 @@ void ps_hud_board(vector pos, vector mySize) minigame_hud_fitsqare(pos, mySize); ps_boardpos = pos; ps_boardsize = mySize; - + minigame_hud_simpleboard(pos,mySize,minigame_texture("ps/board")); vector tile_size = minigame_hud_denormalize_size('1 1 0' / PS_TILE_SIZE,pos,mySize); @@ -353,7 +353,7 @@ void ps_hud_board(vector pos, vector mySize) draw_pos = true; } } - + entity e; FOREACH_MINIGAME_ENTITY(e) { @@ -368,18 +368,18 @@ void ps_hud_board(vector pos, vector mySize) if(e.netname == ps_curr_pos) if(ps_curr_piece.netname != ps_curr_pos) { - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("ps/tile_available"), tile_size, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } if(e == ps_curr_piece) { - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("ps/tile_selected"), tile_size, tile_color, panel_fg_alpha, DRAWFLAG_ADDITIVE ); } - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture("ps/piece"), tile_size * 0.8, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -408,17 +408,17 @@ void ps_hud_board(vector pos, vector mySize) remaining_text = "All pieces cleared!"; else remaining_text = strcat("Remaining pieces: ", ftos(remaining)); - + vector win_pos = pos+eY*(mySize_y-winfs_y)/2; vector win_sz; win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("Game over! %s", remaining_text), + sprintf("Game over! %s", remaining_text), winfs, 0, DRAWFLAG_NORMAL, 0.5); - + drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE); - + minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos, - sprintf("Game over! %s", remaining_text), + sprintf("Game over! %s", remaining_text), winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5); } } @@ -431,10 +431,10 @@ void ps_hud_status(vector pos, vector mySize) vector ts; ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); - + pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; @@ -464,12 +464,12 @@ void ps_hud_status(vector pos, vector mySize) minigame_drawcolorcodedstring_trunc(mySize_x,mypos, GetPlayerName(e.minigame_playerslot-1), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + mypos_y += player_fontsize_y; - //drawpic( mypos, + //drawpic( mypos, // minigame_texture("ps/piece"), // tile_size, '1 0 0', panel_fg_alpha, DRAWFLAG_NORMAL ); - + //mypos_x += tile_size_x; drawstring(mypos,sprintf(_("Pieces left: %s"), ftos(remaining)),'28 28 0', @@ -486,10 +486,10 @@ string ps_turn_to_string(int turnflags) if ( turnflags & PS_TURN_WIN ) return _("Well done, you win!"); - + if ( turnflags & PS_TURN_MOVE ) return _("Jump a piece over another to capture it"); - + return ""; } @@ -617,4 +617,4 @@ int ps_client_event(entity minigame, string event, ...) return false; } -#endif \ No newline at end of file +#endif diff --git a/qcsrc/common/minigames/minigame/qto.qc b/qcsrc/common/minigames/minigame/qto.qc index cef71dfcd..76fa3ce43 100644 --- a/qcsrc/common/minigames/minigame/qto.qc +++ b/qcsrc/common/minigames/minigame/qto.qc @@ -34,7 +34,7 @@ bool qto_winning_piece(entity minigame) if(!e.cnt) return false; } - + return true; } @@ -180,8 +180,8 @@ int qto_server_event(entity minigame, string event, ...) { switch(argv(0)) { - case "move": - qto_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); + case "move": + qto_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); return true; case "restart": qto_restart_match(minigame,...(0,entity)); @@ -205,7 +205,7 @@ int qto_server_event(entity minigame, string event, ...) return false; } } - + return false; } @@ -222,7 +222,7 @@ void qto_hud_board(vector pos, vector mySize) minigame_hud_fitsqare(pos, mySize); qto_boardpos = pos; qto_boardsize = mySize; - + minigame_hud_simpleboard(pos,mySize,minigame_texture("qto/board")); vector tile_size = minigame_hud_denormalize_size('1 1 0' / QTO_TILE_SIZE,pos,mySize); @@ -235,7 +235,7 @@ void qto_hud_board(vector pos, vector mySize) string pos2 = minigame_tile_buildname(letter+1,number); string pos3 = minigame_tile_buildname(letter,number-1); string pos4 = minigame_tile_buildname(letter,number+1); - + entity e; FOREACH_MINIGAME_ENTITY(e) { @@ -254,8 +254,8 @@ void qto_hud_board(vector pos, vector mySize) tile_color = '0.8 0.8 0.8'; break; } - - minigame_drawpic_centered( tile_pos, + + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("qto/piece", ftos(e.cnt))), tile_size, tile_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -270,10 +270,10 @@ void qto_hud_status(vector pos, vector mySize) vector ts; ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); - + pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; @@ -294,12 +294,12 @@ void qto_hud_status(vector pos, vector mySize) minigame_drawcolorcodedstring_trunc(mySize_x,mypos, GetPlayerName(e.minigame_playerslot-1), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + mypos_y += player_fontsize_y; - //drawpic( mypos, + //drawpic( mypos, // minigame_texture("qto/piece"), // tile_size, '1 0 0', panel_fg_alpha, DRAWFLAG_NORMAL ); - + //mypos_x += tile_size_x; drawstring(mypos,sprintf(_("Moves: %s"), ftos(e.qto_moves)),'32 32 0', @@ -313,10 +313,10 @@ string qto_turn_to_string(int turnflags) { if ( turnflags & QTO_TURN_WIN ) return _("Well done, you win!"); - + if ( turnflags & QTO_TURN_MOVE ) return _("Turn all the angry faces into happy faces"); - + return ""; } @@ -458,4 +458,4 @@ int qto_client_event(entity minigame, string event, ...) return false; } -#endif \ No newline at end of file +#endif diff --git a/qcsrc/common/minigames/minigame/ttt.qc b/qcsrc/common/minigames/minigame/ttt.qc index 18a64e426..f2253c2a4 100644 --- a/qcsrc/common/minigames/minigame/ttt.qc +++ b/qcsrc/common/minigames/minigame/ttt.qc @@ -35,29 +35,29 @@ bool ttt_winning_piece(entity piece) { int number = minigame_tile_number(piece.netname); int letter = minigame_tile_letter(piece.netname); - + if ( ttt_find_piece(piece.owner,minigame_tile_buildname(0,number)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(1,number)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(2,number)).team == piece.team ) return true; - + if ( ttt_find_piece(piece.owner,minigame_tile_buildname(letter,0)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(letter,1)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(letter,2)).team == piece.team ) return true; - + if ( number == letter ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(0,0)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(1,1)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(2,2)).team == piece.team ) return true; - + if ( number == 2-letter ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(0,2)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(1,1)).team == piece.team ) if ( ttt_find_piece(piece.owner,minigame_tile_buildname(2,0)).team == piece.team ) return true; - + return false; } @@ -152,7 +152,7 @@ int ttt_server_event(entity minigame, string event, ...) case "join": { int pl_num = minigame_count_players(minigame); - + // Don't allow joining a single player match if ( (minigame.ttt_ai) && pl_num > 0 ) return false; @@ -171,8 +171,8 @@ int ttt_server_event(entity minigame, string event, ...) { switch(argv(0)) { - case "move": - ttt_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); + case "move": + ttt_move(minigame, ...(0,entity), ...(1,int) == 2 ? argv(1) : string_null ); return true; case "next": ttt_next_match(minigame,...(0,entity)); @@ -203,7 +203,7 @@ int ttt_server_event(entity minigame, string event, ...) return false; } } - + return false; } @@ -221,7 +221,7 @@ void ttt_hud_board(vector pos, vector mySize) minigame_hud_fitsqare(pos, mySize); ttt_boardpos = pos; ttt_boardsize = mySize; - + minigame_hud_simpleboard(pos,mySize,minigame_texture("ttt/board")); vector tile_size = minigame_hud_denormalize_size('1 1 0'/TTT_TILE_SIZE,pos,mySize); @@ -232,11 +232,11 @@ void ttt_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(ttt_curr_pos,TTT_LET_CNT,TTT_NUM_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - minigame_drawpic_centered( tile_pos, + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("ttt/piece",ftos(minigame_self.team))), tile_size, '1 1 1', panel_fg_alpha/2, DRAWFLAG_NORMAL ); } - + entity e; FOREACH_MINIGAME_ENTITY(e) { @@ -244,11 +244,11 @@ void ttt_hud_board(vector pos, vector mySize) { tile_pos = minigame_tile_pos(e.netname,TTT_LET_CNT,TTT_NUM_CNT); tile_pos = minigame_hud_denormalize(tile_pos,pos,mySize); - + if ( active_minigame.minigame_flags & TTT_TURN_WIN ) if ( !e.ttt_checkwin ) e.ttt_checkwin = ttt_winning_piece(e) ? 1 : -1; - + float icon_color = 1; if ( e.ttt_checkwin == -1 ) icon_color = 0.4; @@ -258,8 +258,8 @@ void ttt_hud_board(vector pos, vector mySize) minigame_drawpic_centered( tile_pos, minigame_texture("ttt/winglow"), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE ); } - - minigame_drawpic_centered( tile_pos, + + minigame_drawpic_centered( tile_pos, minigame_texture(strcat("ttt/piece",ftos(e.team))), tile_size, '1 1 1'*icon_color, panel_fg_alpha, DRAWFLAG_NORMAL ); } @@ -274,10 +274,10 @@ void ttt_hud_status(vector pos, vector mySize) vector ts; ts = minigame_drawstring_wrapped(mySize_x,pos,active_minigame.descriptor.message, hud_fontsize * 2, '0.25 0.47 0.72', panel_fg_alpha, DRAWFLAG_NORMAL,0.5); - + pos_y += ts_y; mySize_y -= ts_y; - + vector player_fontsize = hud_fontsize * 1.75; ts_y = ( mySize_y - 2*player_fontsize_y ) / 2; ts_x = mySize_x; @@ -295,14 +295,14 @@ void ttt_hud_status(vector pos, vector mySize) minigame_drawcolorcodedstring_trunc(mySize_x,mypos, (e.minigame_playerslot ? GetPlayerName(e.minigame_playerslot-1) : _("AI")), player_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL); - + mypos_y += player_fontsize_y; - drawpic( mypos, + drawpic( mypos, minigame_texture(strcat("ttt/piece",ftos(e.team))), tile_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL ); - + mypos_x += tile_size_x; - + drawstring(mypos,ftos(e.minigame_flags),tile_size, '0.7 0.84 1', panel_fg_alpha, DRAWFLAG_NORMAL); } @@ -314,27 +314,27 @@ string ttt_turn_to_string(int turnflags) { if ( turnflags & TTT_TURN_DRAW ) return _("Draw"); - + if ( turnflags & TTT_TURN_WIN ) { if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team ) return _("You lost the game!\nSelect \"^1Next Match^7\" on the menu for a rematch!"); return _("You win!\nSelect \"^1Next Match^7\" on the menu to start a new match!"); } - + if ( turnflags & TTT_TURN_NEXT ) { if ( (turnflags&TTT_TURN_TEAM) != minigame_self.team ) return _("Select \"^1Next Match^7\" on the menu to start a new match!"); return _("Wait for your opponent to confirm the rematch"); } - + if ( (turnflags & TTT_TURN_TEAM) != minigame_self.team ) return _("Wait for your opponent to make their move"); - + if ( turnflags & TTT_TURN_PLACE ) return _("Click on the game board to place your piece"); - + return ""; } @@ -359,21 +359,21 @@ string ttt_ai_piece_flag2pos(int pieceflag) return "a2"; case TTT_AI_POSFLAG_A3: return "a3"; - + case TTT_AI_POSFLAG_B1: return "b1"; case TTT_AI_POSFLAG_B2: return "b2"; case TTT_AI_POSFLAG_B3: return "b3"; - + case TTT_AI_POSFLAG_C1: return "c1"; case TTT_AI_POSFLAG_C2: return "c2"; case TTT_AI_POSFLAG_C3: return "c3"; - + default: return string_null; } @@ -389,13 +389,13 @@ int ttt_ai_1of3(int piecemask, int flag1, int flag2, int flag3) { if ( ttt_ai_checkmask(piecemask,flag1|flag2|flag3) ) return 0; - + if ( ttt_ai_checkmask(piecemask,flag1|flag2) ) return flag3; - + if ( ttt_ai_checkmask(piecemask,flag3|flag2) ) return flag1; - + if ( ttt_ai_checkmask(piecemask,flag3|flag1) ) return flag2; @@ -407,18 +407,18 @@ int ttt_ai_random(int piecemask) { if ( !piecemask ) return 0; - + int f = 1; - + RandomSelection_Init(); - + for ( int i = 0; i < 9; i++ ) { if ( piecemask & f ) RandomSelection_Add(world, f, string_null, 1, 1); f <<= 1; } - + LOG_TRACE(sprintf("TTT AI: selected %x from %x\n", RandomSelection_chosen_float, piecemask) ); return RandomSelection_chosen_float; @@ -428,7 +428,7 @@ int ttt_ai_random(int piecemask) int ttt_ai_block3 ( int piecemask, int piecemask_free ) { int r = 0; - + r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_A1,TTT_AI_POSFLAG_A2,TTT_AI_POSFLAG_A3); r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_B1,TTT_AI_POSFLAG_B2,TTT_AI_POSFLAG_B3); r |= ttt_ai_1of3(piecemask,TTT_AI_POSFLAG_C1,TTT_AI_POSFLAG_C2,TTT_AI_POSFLAG_C3); @@ -449,15 +449,15 @@ int ttt_ai_block3 ( int piecemask, int piecemask_free ) string ttt_ai_choose_simple(int piecemask_self, int piecemask_opponent, int piecemask_free ) { int move = 0; - + LOG_TRACE("TTT AI: checking winning move\n"); if (( move = ttt_ai_block3(piecemask_self,piecemask_free) )) return ttt_ai_piece_flag2pos(move); // place winning move - + LOG_TRACE("TTT AI: checking opponent's winning move\n"); if (( move = ttt_ai_block3(piecemask_opponent,piecemask_free) )) return ttt_ai_piece_flag2pos(move); // block opponent - + LOG_TRACE("TTT AI: random move\n"); return ttt_ai_piece_flag2pos(ttt_ai_random(piecemask_free)); } @@ -471,14 +471,14 @@ void ttt_aimove(entity minigame) while ( ( aiplayer = findentity(aiplayer,owner,minigame) ) ) if ( aiplayer.classname == "minigame_player" && !aiplayer.minigame_playerslot ) break; - + /* * Build bit masks for the board pieces * .---.---.---. * | 4 | 32|256| 3 - * |---+---+---| + * |---+---+---| * | 2 | 16|128| 2 - * |---+---+---| + * |---+---+---| * | 1 | 8 | 64| 1 * '---'---'---' * A B C @@ -506,7 +506,7 @@ void ttt_aimove(entity minigame) pieceflag <<= 1; } } - + // TODO multiple AI difficulties LOG_TRACE(sprintf("TTT AI: self: %x opponent: %x free: %x\n", piecemask_self, piecemask_opponent, piecemask_free)); @@ -631,13 +631,13 @@ int ttt_client_event(entity minigame, string event, ...) if ( sent.minigame_flags & minigame_self.team ) minigame_prompt(); } - + if ( (sf & TTT_SF_SINGLEPLAYER) ) { int ai = ReadByte(); bool spawnai = ai && !sent.ttt_ai; sent.ttt_ai = ai; - + if ( spawnai ) { entity aiplayer = spawn(); @@ -648,7 +648,7 @@ int ttt_client_event(entity minigame, string event, ...) aiplayer.minigame_autoclean = 1; ttt_aimove(minigame); } - + } } else if ( sent.classname == "minigame_player" && (sf & TTT_SF_PLAYERSCORE ) ) diff --git a/qcsrc/common/minigames/minigames.qc b/qcsrc/common/minigames/minigames.qc index 61ab9a6ba..c2392ae0e 100644 --- a/qcsrc/common/minigames/minigames.qc +++ b/qcsrc/common/minigames/minigames.qc @@ -17,7 +17,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 +27,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 +56,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); diff --git a/qcsrc/common/minigames/minigames.qh b/qcsrc/common/minigames/minigames.qh index 86fb778dc..536ac5018 100644 --- a/qcsrc/common/minigames/minigames.qh +++ b/qcsrc/common/minigames/minigames.qh @@ -15,7 +15,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); @@ -88,7 +88,7 @@ int minigame_count_players(entity minigame); /// IMPORTANT: always read in client everything you send from the server! /// cmd(entity minigame_player, int argc, string command) /// self = client entity triggering this -/// argv(n) = console token +/// argv(n) = console token /// argc: number of console tokens /// command: full command string /// triggered when a player does "cmd minigame ..." with some unrecognized command diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 44653ae94..1bd9609de 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -15,7 +15,7 @@ void minigame_rmplayer(entity minigame_session, entity player) { entity e; entity p = minigame_session.minigame_players; - + if ( p.minigame_players == player ) { if ( p.list_next == world ) @@ -64,22 +64,22 @@ bool minigame_SendEntity(entity to, int sf) {SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_MINIGAME); WriteByte(MSG_ENTITY, sf); - + if ( sf & MINIG_SF_CREATE ) { WriteShort(MSG_ENTITY,msle_id(self.classname)); WriteString(MSG_ENTITY,self.netname); } - + entity minigame_ent = self.owner; - + if ( self.classname == "minigame" ) { minigame_ent = self; - + if ( sf & MINIG_SF_CREATE ) WriteString(MSG_ENTITY,self.descriptor.netname); - + if ( sf & MINIG_SF_UPDATE ) WriteLong(MSG_ENTITY,self.minigame_flags); } @@ -94,11 +94,11 @@ bool minigame_SendEntity(entity to, int sf) WriteByte(MSG_ENTITY,self.team); } MINIGAME_SIMPLELINKED_ENTITIES - + minigame_ent.minigame_event(minigame_ent,"network_send",self,sf); - + return true; - + } #undef FIELD #undef MSLE @@ -131,9 +131,9 @@ int minigame_addplayer(entity minigame_session, entity player) return 0; minigame_rmplayer(player.active_minigame,player); } - + int mgteam = minigame_session.minigame_event(minigame_session,"join",player); - + if ( mgteam ) { entity player_pointer = spawn(); @@ -154,12 +154,12 @@ int minigame_addplayer(entity minigame_session, entity player) } if ( autocvar_sv_minigames_observer == 2 ) player.team_forced = -1; - + minigame_resend(minigame_session); } GameLogEcho(strcat(":minigame:join",(mgteam?"":"fail"),":",minigame_session.netname,":", ftos(num_for_edict(player)),":",player.netname)); - + return mgteam; } @@ -167,9 +167,9 @@ entity start_minigame(entity player, string minigame ) { if ( !autocvar_sv_minigames || !IS_REAL_CLIENT(player) ) return world; - + entity e = minigame_get_descriptor(minigame); - if ( e ) + if ( e ) { entity minig = spawn(); minig.classname = "minigame"; @@ -185,7 +185,7 @@ entity start_minigame(entity player, string minigame ) return world; } Net_LinkEntity(minig, false, 0, minigame_SendEntity); - + if ( !minigame_sessions ) minigame_sessions = minig; else @@ -196,7 +196,7 @@ entity start_minigame(entity player, string minigame ) } return minig; } - + return world; } @@ -204,7 +204,7 @@ entity join_minigame(entity player, string game_id ) { if ( !autocvar_sv_minigames || !IS_REAL_CLIENT(player) ) return world; - + entity minig; for ( minig = minigame_sessions; minig != world; minig = minig.list_next ) { @@ -212,14 +212,14 @@ entity join_minigame(entity player, string game_id ) if ( minigame_addplayer(minig,player) ) return minig; } - + return world; } void part_minigame(entity player ) { entity minig = player.active_minigame; - + if ( minig && minig.classname == "minigame" ) minigame_rmplayer(minig,player); } @@ -230,11 +230,11 @@ void end_minigame(entity minigame_session) minigame_session.owner.list_next = minigame_session.list_next; else minigame_sessions = minigame_session.list_next; - + minigame_session.minigame_event(minigame_session,"end"); GameLogEcho(strcat(":minigame:end:",minigame_session.netname)); - - + + entity e = world; while( (e = findentity(e, owner, minigame_session)) ) if ( e.minigame_autoclean ) @@ -242,7 +242,7 @@ void end_minigame(entity minigame_session) LOG_TRACE("SV Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n"); remove(e); } - + entity p; for ( e = minigame_session.minigame_players; e != world; e = p ) { @@ -250,7 +250,7 @@ void end_minigame(entity minigame_session) player_clear_minigame(e.minigame_players); remove(e); } - + strunzone(minigame_session.netname); remove(minigame_session); } @@ -276,9 +276,9 @@ void initialize_minigames() if ( !last_minig ) minigame_descriptors = minig; \ else last_minig.list_next = minig; \ last_minig = minig; - + REGISTERED_MINIGAMES - + #undef MINIGAME } @@ -292,13 +292,13 @@ string invite_minigame(entity inviter, entity player) return "You can't invite yourself"; if ( player.active_minigame == inviter.active_minigame ) return strcat(player.netname," is already playing"); - - Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_MINIGAME_INVITE, + + Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_MINIGAME_INVITE, inviter.active_minigame.netname, inviter.netname ); - + GameLogEcho(strcat(":minigame:invite:",inviter.active_minigame.netname,":", ftos(num_for_edict(player)),":",player.netname)); - + return ""; } @@ -332,7 +332,7 @@ void ClientCommand_minigame(int request, int argc, string command) sprint(self,"Minigames are not enabled!\n"); return; } - + if (request == CMD_REQUEST_COMMAND ) { string minig_cmd = argv(1); @@ -407,11 +407,11 @@ void ClientCommand_minigame(int request, int argc, string command) int arg_c = tokenize_console(subcommand); if ( self.active_minigame.minigame_event(self.active_minigame,"cmd",e,arg_c,subcommand) ) return; - + } else sprint(self,strcat("Wrong command:^1 ",command,"\n")); } - + sprint(self, "\nUsage:^3 cmd minigame create \n"); sprint(self, " Start a new minigame session\n"); sprint(self, "Usage:^3 cmd minigame join \n"); diff --git a/qcsrc/common/monsters/spawn.qc b/qcsrc/common/monsters/spawn.qc index dfa318fe3..cf23639e0 100644 --- a/qcsrc/common/monsters/spawn.qc +++ b/qcsrc/common/monsters/spawn.qc @@ -62,7 +62,7 @@ entity spawnmonster (string monster, float monster_id, entity spawnedby, entity e.angles_y = spawnedby.angles_y; } - + // Monster_Spawn checks if monster is valid WITH(entity, self, e, Monster_Spawn(monster_id)); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index d4e1691f0..fb7ab2fca 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -181,11 +181,11 @@ void monster_setupcolors(entity mon) void monster_changeteam(entity ent, float newteam) { if(!teamplay) { return; } - + ent.team = newteam; ent.monster_attack = true; // new team, activate attacking monster_setupcolors(ent); - + if(ent.sprite) { WaypointSprite_UpdateTeamRadar(ent.sprite, RADARICON_DANGER, ((newteam) ? Team_ColorRGB(newteam) : '1 0 0')); @@ -831,7 +831,7 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed) self.moveto = WarpZone_RefSys_TransformOrigin(self.enemy, self, (0.5 * (self.enemy.absmin + self.enemy.absmax))); self.monster_moveto = '0 0 0'; self.monster_face = '0 0 0'; - + self.pass_distance = vlen((('1 0 0' * self.enemy.origin_x) + ('0 1 0' * self.enemy.origin_y)) - (('1 0 0' * self.origin_x) + ('0 1 0' * self.origin_y))); Monster_Sound(monstersound_sight, 0, false, CH_VOICE); } @@ -1140,22 +1140,22 @@ void Monster_Move_2D(float mspeed, float allow_jumpoff) float reverse = FALSE; vector a, b; - + makevectors(self.angles); a = self.origin + '0 0 16'; b = self.origin + '0 0 16' + v_forward * 32; - + traceline(a, b, MOVE_NORMAL, self); - + if(trace_fraction != 1.0) { reverse = TRUE; - + if(trace_ent) if(IS_PLAYER(trace_ent) && !(trace_ent.items & IT_STRENGTH)) reverse = FALSE; } - + // TODO: fix this... tracing is broken if the floor is thin /* if(!allow_jumpoff) @@ -1165,13 +1165,13 @@ void Monster_Move_2D(float mspeed, float allow_jumpoff) if(trace_fraction == 1.0) reverse = TRUE; } */ - + if(reverse) { self.angles_y = anglemods(self.angles_y - 180); makevectors(self.angles); } - + movelib_move_simple_gravity(v_forward, mspeed, 1); if(time > self.pain_finished) @@ -1361,7 +1361,7 @@ bool Monster_Spawn(int mon_id) self.monster_moveto = '0 0 0'; self.monster_face = '0 0 0'; self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP; - + if(!self.scale) { self.scale = 1; } if(autocvar_g_monsters_edit) { self.grab = 1; } if(autocvar_g_fullbrightplayers) { self.effects |= EF_FULLBRIGHT; } diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 399ce4e58..b057f2edb 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -165,7 +165,7 @@ void W_RocketMinsta_Laser_Touch (void) void W_RocketMinsta_Attack2(void) {SELFPARAM(); makevectors(self.v_angle); - + entity proj; float counter = 0; float total = autocvar_g_rm_laser_count; @@ -192,11 +192,11 @@ void W_RocketMinsta_Attack2(void) PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; setorigin(proj, w_shotorg); - + proj.rm_force = autocvar_g_rm_laser_force / total; proj.rm_damage = autocvar_g_rm_laser_damage / total; proj.rm_edmg = proj.rm_damage; - + //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed); proj.movetype = MOVETYPE_BOUNCEMISSILE; @@ -220,7 +220,7 @@ void W_RocketMinsta_Attack2(void) void W_RocketMinsta_Attack3 (void) {SELFPARAM(); makevectors(self.v_angle); - + entity proj; float counter = 0; float total = 1; @@ -245,11 +245,11 @@ void W_RocketMinsta_Attack3 (void) PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_ELECTRO.m_id; setorigin(proj, w_shotorg); - + proj.rm_force = autocvar_g_rm_laser_force / total; proj.rm_damage = autocvar_g_rm_laser_damage / total; proj.rm_edmg = proj.rm_damage; - + //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed); proj.movetype = MOVETYPE_BOUNCEMISSILE; @@ -357,7 +357,7 @@ float W_Vaporizer(float req) } else self.held_down = false; - + return true; } case WR_INIT: diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 036d417d5..7aefe7bd3 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1366,9 +1366,9 @@ void ChatBubbleThink() remove(self); return; } - + self.mdl = ""; - + if ( !self.owner.deadflag && IS_PLAYER(self.owner) ) { if ( self.owner.active_minigame ) @@ -1376,7 +1376,7 @@ void ChatBubbleThink() else if ( self.owner.BUTTON_CHAT ) self.mdl = "models/misc/chatbubble.spr"; } - + if ( self.model != self.mdl ) setmodel(self, self.mdl); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 8e84f4863..963f11314 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -891,7 +891,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOR_EACH_REALCLIENT(head) + FOR_EACH_REALCLIENT(head) if(head != source) if(head.active_minigame == source.active_minigame) sprint(head, msgstr); diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 1e2afb352..7488fd295 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -387,7 +387,7 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) } MUTATOR_HOOKFUNCTION(instagib_PlayerDies) -{ +{ if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER.m_id)) frag_damage = 1000; // always gib if it was a vaporizer death -- 2.39.2