]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/respawn_improvements
authorSamual Lenks <samual@xonotic.org>
Thu, 9 May 2013 20:57:46 +0000 (16:57 -0400)
committerSamual Lenks <samual@xonotic.org>
Thu, 9 May 2013 20:57:46 +0000 (16:57 -0400)
42 files changed:
defaultXonotic.cfg
gfx/hud/default/weaponlaser.tga
gfx/hud/default/weaponminstanex.tga
gfx/hud/luminos/weaponlaser.tga
gfx/hud/luminos/weaponminstanex.tga
gfx/menu/luminos/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/luminos/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/luminos/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/luminos/skinvalues.txt
gfx/menu/wickedx/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/wickedx/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/wickedx/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/wickedx/skinvalues.txt
gfx/menu/xaw/clearbutton_c.tga [new file with mode: 0644]
gfx/menu/xaw/clearbutton_f.tga [new file with mode: 0644]
gfx/menu/xaw/clearbutton_n.tga [new file with mode: 0644]
gfx/menu/xaw/skinvalues.txt
qcsrc/client/hud.qc
qcsrc/common/deathtypes.qh
qcsrc/menu/item/inputbox.c
qcsrc/menu/item/inputcontainer.c
qcsrc/menu/item/nexposee.c
qcsrc/menu/skin-customizables.inc
qcsrc/menu/xonotic/charmap.c
qcsrc/menu/xonotic/dialog_multiplayer_demo.c
qcsrc/menu/xonotic/dialog_multiplayer_join.c
qcsrc/menu/xonotic/dialog_multiplayer_playersetup.c
qcsrc/menu/xonotic/dialog_settings_misc.c
qcsrc/menu/xonotic/dialog_settings_misc_cvars.c
qcsrc/menu/xonotic/inputbox.c
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_lms.qh
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/w_shotgun.qc

index de83c9ae57901fc412fcbc804a1a5eae42de5be0..b5dc919fa3f0ce783d37cf9471ac8ad37d2bf390 100644 (file)
@@ -959,7 +959,7 @@ seta scoreboard_border_thickness 1 "scoreboard border thickness"
 seta scoreboard_accuracy_border_thickness 1 "accuracy stats border thickness"
 seta scoreboard_accuracy_doublerows 0 "use two rows instead of one"
 seta scoreboard_accuracy_nocolors 0 "don't use colors displaying accuracy stats"
-seta scoreboard_accuracy 1 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
+seta scoreboard_accuracy 0 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
 seta scoreboard_color_bg_r 0 "red color component of the scoreboard background"
 seta scoreboard_color_bg_g 0.4 "green color component of the scoreboard background"
 seta scoreboard_color_bg_b 0.6 "blue color component of the scoreboard background"
index 0afbb37d48124bb6f9b9a4f82998c45a1dcb43d4..f384a2c3000c27fbea425f23165e662c0f301bb5 100644 (file)
Binary files a/gfx/hud/default/weaponlaser.tga and b/gfx/hud/default/weaponlaser.tga differ
index 3618778729fc6918db40260e421f6cbf86ab842e..3bd2ae2d7aabe4270483aa1ac0c5016df50d6ccc 100644 (file)
Binary files a/gfx/hud/default/weaponminstanex.tga and b/gfx/hud/default/weaponminstanex.tga differ
index 0afbb37d48124bb6f9b9a4f82998c45a1dcb43d4..f384a2c3000c27fbea425f23165e662c0f301bb5 100644 (file)
Binary files a/gfx/hud/luminos/weaponlaser.tga and b/gfx/hud/luminos/weaponlaser.tga differ
index 3618778729fc6918db40260e421f6cbf86ab842e..3bd2ae2d7aabe4270483aa1ac0c5016df50d6ccc 100644 (file)
Binary files a/gfx/hud/luminos/weaponminstanex.tga and b/gfx/hud/luminos/weaponminstanex.tga differ
diff --git a/gfx/menu/luminos/clearbutton_c.tga b/gfx/menu/luminos/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..3de1ccb
Binary files /dev/null and b/gfx/menu/luminos/clearbutton_c.tga differ
diff --git a/gfx/menu/luminos/clearbutton_f.tga b/gfx/menu/luminos/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..be0939c
Binary files /dev/null and b/gfx/menu/luminos/clearbutton_f.tga differ
diff --git a/gfx/menu/luminos/clearbutton_n.tga b/gfx/menu/luminos/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..57d76c4
Binary files /dev/null and b/gfx/menu/luminos/clearbutton_n.tga differ
index 316ae273f8a88f29dab82696785e8e33a879eb85..e79dba0e099fd157d28f4c8f7ad7692b3568f7c1 100755 (executable)
@@ -189,6 +189,13 @@ COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
 
+// item: clear button
+//   uses "clearbutton" images
+OFFSET_CLEARBUTTON              -0.3
+COLOR_CLEARBUTTON_N                '1 1 1'
+COLOR_CLEARBUTTON_C                '1 1 1'
+COLOR_CLEARBUTTON_F                '1 1 1'
+
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
 ALPHA_KEYGRABBER_TITLES         1
diff --git a/gfx/menu/wickedx/clearbutton_c.tga b/gfx/menu/wickedx/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..26bc0ef
Binary files /dev/null and b/gfx/menu/wickedx/clearbutton_c.tga differ
diff --git a/gfx/menu/wickedx/clearbutton_f.tga b/gfx/menu/wickedx/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..e857381
Binary files /dev/null and b/gfx/menu/wickedx/clearbutton_f.tga differ
diff --git a/gfx/menu/wickedx/clearbutton_n.tga b/gfx/menu/wickedx/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..26bc0ef
Binary files /dev/null and b/gfx/menu/wickedx/clearbutton_n.tga differ
index 3259d7122afe644cccbbcfd775cef69a60c2bc73..15605128588e79c4e3c73c4f647a3e518837ea50 100755 (executable)
@@ -189,6 +189,13 @@ COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
 
+// item: clear button
+//   uses "clearbutton" images
+OFFSET_CLEARBUTTON              -0.5
+COLOR_CLEARBUTTON_N                '1 1 1'
+COLOR_CLEARBUTTON_C                '1 1 1'
+COLOR_CLEARBUTTON_F                '1 1 1'
+
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
 ALPHA_KEYGRABBER_TITLES         1
diff --git a/gfx/menu/xaw/clearbutton_c.tga b/gfx/menu/xaw/clearbutton_c.tga
new file mode 100644 (file)
index 0000000..d8bfea5
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_c.tga differ
diff --git a/gfx/menu/xaw/clearbutton_f.tga b/gfx/menu/xaw/clearbutton_f.tga
new file mode 100644 (file)
index 0000000..338ac1f
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_f.tga differ
diff --git a/gfx/menu/xaw/clearbutton_n.tga b/gfx/menu/xaw/clearbutton_n.tga
new file mode 100644 (file)
index 0000000..60ee8c8
Binary files /dev/null and b/gfx/menu/xaw/clearbutton_n.tga differ
index 36db25d5cd7cf18f8a538437059360214194d49e..3bd555f031ed32255e35cec19596893bfc5597dc 100644 (file)
@@ -129,6 +129,13 @@ COLOR_INPUTBOX_N                '1 1 1'
 COLOR_INPUTBOX_F                '1 1 1'
 MARGIN_INPUTBOX_CHARS           1
 
+// item: clear button
+//   uses "clearbutton" images
+OFFSET_CLEARBUTTON              0
+COLOR_CLEARBUTTON_N                '1 1 1'
+COLOR_CLEARBUTTON_C                '1 1 1'
+COLOR_CLEARBUTTON_F                '1 1 1'
+
 // item: key grabber
 COLOR_KEYGRABBER_TITLES         '1 1 1'
 ALPHA_KEYGRABBER_TITLES         1
index ee44db91a8f0e6013c027574b975b6fde3f5392b..469fe67fa27d1524e8f541adaf86602b46f3be90 100644 (file)
@@ -3693,7 +3693,7 @@ void HUD_InfoMessages(void)
                        if(spectatee_status == -1)
                                s = sprintf(_("^1Press ^3%s^1 to spectate"), getcommandkey("primary fire", "+fire"));
                        else
-                               s = sprintf(_("^1Press ^3%s^1 for another player"), getcommandkey("primary fire", "+fire"));
+                               s = sprintf(_("^1Press ^3%s^1 or ^3%s^1 for next or previous player"), getcommandkey("next weapon", "weapnext"), getcommandkey("previous weapon", "weapprev"));
                        drawInfoMessage(s)
 
                        if(spectatee_status == -1)
index ca13f15a063e2fc674465312ebe1b600a1e88bd3..f9a9ceba25b1e0df2da7e77db433f5982e644b99 100644 (file)
@@ -69,7 +69,7 @@ entity deathtypes[DT_MAX];
                CHECK_MAX_COUNT(name, DT_MAX, DT_COUNT, "deathtypes") \
                \
                entity deathent = spawn(); \
-               deathtypes[(name - DT_FIRST) - 1] = deathent; \
+               deathtypes[(name - DT_FIRST)] = deathent; \
                deathent.classname = "deathtype"; \
                deathent.nent_name = #name; \
                #if (msg_death != NO_MSG) \
@@ -96,7 +96,7 @@ string Deathtype_Name(float deathtype)
 {
        if(DEATH_ISSPECIAL(deathtype))
        {
-               entity deathent = deathtypes[(deathtype - DT_FIRST) - 1];
+               entity deathent = deathtypes[(deathtype - DT_FIRST)];
                if not(deathent) { backtrace("Deathtype_Name: Could not find deathtype entity!\n"); return ""; }
                return deathent.nent_name;
        }
index 572d3a0710dd866bef056667cb2862165d80cf0b..614f6d557679a465861e400a8e3cb9e1deebee1a 100644 (file)
@@ -5,10 +5,12 @@ CLASS(InputBox) EXTENDS(Label)
        METHOD(InputBox, setText, void(entity, string))
        METHOD(InputBox, enterText, void(entity, string))
        METHOD(InputBox, keyDown, float(entity, float, float, float))
+       METHOD(InputBox, mouseMove, float(entity, vector))
        METHOD(InputBox, mouseRelease, float(entity, vector))
        METHOD(InputBox, mousePress, float(entity, vector))
        METHOD(InputBox, mouseDrag, float(entity, vector))
        METHOD(InputBox, showNotify, void(entity))
+       METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector))
 
        ATTRIB(InputBox, src, string, string_null)
 
@@ -26,6 +28,15 @@ CLASS(InputBox) EXTENDS(Label)
        ATTRIB(InputBox, color, vector, '1 1 1')
        ATTRIB(InputBox, colorF, vector, '1 1 1')
        ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars
+
+       ATTRIB(InputBox, enableClearButton, float, 1)
+       ATTRIB(InputBox, clearButton, entity, NULL)
+       ATTRIB(InputBox, cb_width, float, 0)
+       ATTRIB(InputBox, cb_pressed, float, 0)
+       ATTRIB(InputBox, cb_focused, float, 0)
+       ATTRIB(InputBox, cb_color, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
+       ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
 ENDCLASS(InputBox)
 void InputBox_Clear_Click(entity btn, entity me);
 #endif
@@ -37,6 +48,16 @@ void InputBox_configureInputBox(entity me, string theText, float theCursorPos, f
        me.src = gfx;
        me.cursorPos = theCursorPos;
 }
+void InputBox_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
+{
+       SUPER(InputBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+       if (me.enableClearButton)
+       {
+               me.cb_width = absSize_y / absSize_x;
+               me.cb_offset = bound(-1, me.cb_offset, 0) * me.cb_width; // bound to range -1, 0
+               me.keepspaceRight = me.keepspaceRight - me.cb_offset + me.cb_width;
+       }
+}
 
 void InputBox_setText(entity me, string txt)
 {
@@ -50,18 +71,60 @@ void InputBox_Clear_Click(entity btn, entity me)
        me.setText(me, "");
 }
 
+float over_ClearButton(entity me, vector pos)
+{
+       if (pos_x >= 1 + me.cb_offset - me.cb_width)
+       if (pos_x < 1 + me.cb_offset)
+       if (pos_y >= 0)
+       if (pos_y < 1)
+               return 1;
+       return 0;
+}
+
+float InputBox_mouseMove(entity me, vector pos)
+{
+       if (me.enableClearButton)
+       {
+               if (over_ClearButton(me, pos))
+               {
+                       me.cb_focused = 1;
+                       return 1;
+               }
+               me.cb_focused = 0;
+       }
+       return 1;
+}
+
 float InputBox_mouseDrag(entity me, vector pos)
 {
        float p;
-       me.dragScrollPos = pos;
-       p = me.scrollPos + pos_x - me.keepspaceLeft;
-       me.cursorPos = draw_TextLengthUpToWidth(me.text, p, 0, me.realFontSize);
-       me.lastChangeTime = time;
+       if(me.pressed)
+       {
+               me.dragScrollPos = pos;
+               p = me.scrollPos + pos_x - me.keepspaceLeft;
+               me.cursorPos = draw_TextLengthUpToWidth(me.text, p, 0, me.realFontSize);
+               me.lastChangeTime = time;
+       }
+       else if (me.enableClearButton)
+       {
+               if (over_ClearButton(me, pos))
+               {
+                       me.cb_pressed = 1;
+                       return 1;
+               }
+       }
+       me.cb_pressed = 0;
        return 1;
 }
 
 float InputBox_mousePress(entity me, vector pos)
 {
+       if (me.enableClearButton)
+       if (over_ClearButton(me, pos))
+       {
+               me.cb_pressed = 1;
+               return 1;
+       }
        me.dragScrollTimer = time;
        me.pressed = 1;
        return InputBox_mouseDrag(me, pos);
@@ -69,8 +132,19 @@ float InputBox_mousePress(entity me, vector pos)
 
 float InputBox_mouseRelease(entity me, vector pos)
 {
+       if(me.cb_pressed)
+       if (over_ClearButton(me, pos))
+       {
+               me.cb_pressed = 0;
+               InputBox_Clear_Click(world, me);
+               return 1;
+       }
+       float r = InputBox_mouseDrag(me, pos);
+       //reset cb_pressed after mouseDrag, mouseDrag could set cb_pressed in this case:
+       //mouse press out of the clear button, drag and then mouse release over the clear button
+       me.cb_pressed = 0;
        me.pressed = 0;
-       return InputBox_mouseDrag(me, pos);
+       return r;
 }
 
 void InputBox_enterText(entity me, string ch)
@@ -295,6 +369,17 @@ void InputBox_draw(entity me)
 
        draw_ClearClip();
 
+       if (me.enableClearButton)
+       if (me.text != "")
+       {
+               if(me.focused && me.cb_pressed)
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_c"), eX * me.cb_width + eY, me.cb_colorC, 1);
+               else if(me.focused && me.cb_focused)
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_f"), eX * me.cb_width + eY, me.cb_colorF, 1);
+               else
+                       draw_Picture(eX * (1 + me.cb_offset - me.cb_width), strcat(me.cb_src, "_n"), eX * me.cb_width + eY, me.cb_color, 1);
+       }
+
        // skipping SUPER(InputBox).draw(me);
        Item_draw(me);
 }
index 65129b294dd6c0229436da186734c244d30b6b6f..4531a1f4e11c2f4917baef0e9d03d4f5bb4ef6f1 100644 (file)
@@ -134,6 +134,8 @@ float InputContainer_mouseDrag(entity me, vector pos)
 }
 float InputContainer_mouseMove(entity me, vector pos)
 {
+       if(me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
+               me.mouseFocusedChild = NULL; // force focusing
        if(me._changeFocusXY(me, pos))
                if(SUPER(InputContainer).mouseMove(me, pos))
                        return 1;
index 64da6bcd6de8a93f0919d080bc425f2f358b3762..97eabd7d66beffd07e0263f5474a63c572db5270 100644 (file)
@@ -263,7 +263,7 @@ float Nexposee_mouseMove(entity me, vector pos)
        if(me.animationState == 0)
        {
                if(me.mouseFocusedChild)
-                       if(me.mouseFocusedChild != e)
+                       if(me.mouseFocusedChild != e || me.mouseFocusedChild != me.selectedChild)
                                me.selectedChild = me.mouseFocusedChild;
                return 1;
        }
index d30ac7248d0294ac557d8fe4b38a9a96b1814ad1..6b5cac042ca970af7df0cc83c1c4e9f5e5e14585 100644 (file)
@@ -166,6 +166,13 @@ SKINBEGIN
        SKINVECTOR(COLOR_INPUTBOX_F, '1 1 1');
        SKINFLOAT(MARGIN_INPUTBOX_CHARS, 1);
 
+       // item: clear button
+       SKINSTRING(GFX_CLEARBUTTON, "clearbutton");
+       SKINFLOAT(OFFSET_CLEARBUTTON, 0);
+       SKINVECTOR(COLOR_CLEARBUTTON_N, '1 1 1');
+       SKINVECTOR(COLOR_CLEARBUTTON_F, '1 1 1');
+       SKINVECTOR(COLOR_CLEARBUTTON_C, '1 1 1');
+
        // item: key grabber
        SKINVECTOR(COLOR_KEYGRABBER_TITLES, '1 1 1');
        SKINFLOAT(ALPHA_KEYGRABBER_TITLES, 1);
index 0e375c9cc4654e10f81b938232f25ef36eca3c93..6966aaf481b7460b337387762e542ac171dc7a7f 100644 (file)
@@ -64,7 +64,7 @@ float XonoticCharmap_mouseMove(entity me, vector coords)
                return 0;
        }
        c = y * 16 + x;
-       if(c != me.mouseSelectedCharacterCell)
+       if(c != me.mouseSelectedCharacterCell || me.mouseSelectedCharacterCell != me.selectedCharacterCell)
                me.mouseSelectedCharacterCell = me.selectedCharacterCell = c;
        return 1;
 }
index bb4b969c4c80e5e07f073ab972f57e719d30e3af..84115f1ed651fcaac7852871657b170b478eb9e4 100644 (file)
@@ -20,22 +20,17 @@ entity makeXonoticDemoBrowserTab()
 }
 void XonoticDemoBrowserTab_fill(entity me)
 {
-       entity e;
-       entity btn;
-       entity dlist;
+       entity e, dlist;
 
        me.TR(me);
                me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "cl_autodemo", _("Automatically record demos while playing")));
        me.TR(me);
        me.TR(me);
                me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
-               me.TD(me, 1, 0.5, btn = makeXonoticButton(_("Clear"), '0 0 0'));
-                       btn.onClick = InputBox_Clear_Click;     
-               me.TD(me, 1, 3, e = makeXonoticInputBox(0, string_null));
+               me.TD(me, 1, 3.5, e = makeXonoticInputBox(0, string_null));
                        dlist = makeXonoticDemoList();
                        e.onChange = DemoList_Filter_Change;
                        e.onChangeEntity = dlist;
-                       btn.onClickEntity = e;
                        dlist.controlledTextbox = e;
                        
        me.TR(me);
index ee451744fb8899942380f76248d7ff8bfa638f51..02d3b410209a0af2bdf371309a45ea7325f57906 100644 (file)
@@ -20,18 +20,15 @@ entity makeXonoticServerListTab()
 }
 void XonoticServerListTab_fill(entity me)
 {
-       entity e, slist, btn;
+       entity e, slist;
 
        slist  = makeXonoticServerList();
 
        me.TR(me);
                me.TD(me, 1, 0.4, e = makeXonoticTextLabel(0, _("Filter:")));
-               me.TD(me, 1, 0.6, btn = makeXonoticButton(_("Clear"), '0 0 0'));
-                       btn.onClick = InputBox_Clear_Click;
-               me.TD(me, 1, me.columns - 0.6 * 4 - 0.4, e = makeXonoticInputBox(0, string_null));
+               me.TD(me, 1, me.columns - 0.6 * 3 - 0.4, e = makeXonoticInputBox(0, string_null));
                        e.onChange = ServerList_Filter_Change;
                        e.onChangeEntity = slist;
-                       btn.onClickEntity = e;
                        slist.controlledTextbox = e;
                me.TD(me, 1, 0.6, e = makeXonoticCheckBox(0, "menu_slist_showempty", ZCTX(_("SRVS^Empty"))));
                        slist.filterShowEmpty = e.checked;
index ef930b4e1490fe879c28ca7a83a191f191610777..21beeca6f48ea94472869ba69d7ac98742cad660 100644 (file)
@@ -45,6 +45,7 @@ void XonoticPlayerSettingsTab_fill(entity me)
                        box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
                        box.maxLength = -127; // negative means encoded length in bytes
                        box.saveImmediately = 1;
+                       box.enableClearButton = 0;
                        label.textEntity = box;
        me.TR(me);
                me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
index b9aab55ab74dda5cf007353946118592572a78f1..37effe93256e3415ac97140777ee7bda1062669e 100644 (file)
@@ -49,6 +49,7 @@ void XonoticMiscSettingsTab_fill(entity me)
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, _("Client UDP port:")));
                me.TD(me, 1, 1, e = makeXonoticInputBox(0, "cl_port"));
+                       e.enableClearButton = 0;
        me.TR(me);
        me.TR(me);
                me.TDempty(me, 0.2);
index 7ebca4162ce78174a5c9e6a93ffcbaeb8bb09b94..5db6d35c62c3d6522a9bd1c222947d4dcc16e37b 100644 (file)
@@ -17,26 +17,27 @@ void XonoticCvarsDialog_showNotify(entity me)
 }
 void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIST_CONTROLS to color ALL controls 
 {
-       entity e, cvarlist, btn;
-       
+
+       entity e, cvarlist;
+
        cvarlist = makeXonoticCvarList();
-       
+
        cvarlist.color = 
                cvarlist.colorF = 
                cvarlist.color2 = 
                cvarlist.colorC = 
                SKINCOLOR_CVARLIST_CONTROLS;
-       
+
        me.TR(me);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
-               me.TD(me, 1, 0.5, btn = makeXonoticButton(_("Clear"), SKINCOLOR_CVARLIST_CONTROLS));
-               me.TD(me, 1, me.columns - 1.5, e = makeXonoticInputBox(0, string_null));
+               me.TD(me, 1, me.columns - 1, e = makeXonoticInputBox(0, string_null));
                        e.color = SKINCOLOR_CVARLIST_CONTROLS;
                        e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
                        e.onChange = CvarList_Filter_Change;
                        e.onChangeEntity = cvarlist;
-                       btn.onClick = InputBox_Clear_Click;
-                       btn.onClickEntity = e;
                        cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
        me.TR(me);
                me.TD(me, me.rows - me.currentRow - 7, me.columns, cvarlist);
@@ -54,6 +55,9 @@ void XonoticCvarsDialog_fill(entity me) // in this dialog, use SKINCOLOR_CVARLIS
                        cvarlist.cvarValueBox = e;
                        e.color = SKINCOLOR_CVARLIST_CONTROLS;
                        e.colorF = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_color = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorC = SKINCOLOR_CVARLIST_CONTROLS;
+                       e.cb_colorF = SKINCOLOR_CVARLIST_CONTROLS;
                        e.onChange = CvarList_Value_Change;
                        e.onChangeEntity = cvarlist;
                        e.onEnter = CvarList_End_Editing;
index dbbcc7b0c495af9609cae5dfac612b2ef4da9f74..56aa9702c67170c82e286d62eed7cec004221999 100644 (file)
@@ -16,6 +16,13 @@ CLASS(XonoticInputBox) EXTENDS(InputBox)
 
        ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
 
+       // Clear button attributes
+       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
+       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
+       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
+       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
+       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
+
        ATTRIB(XonoticInputBox, cvarName, string, string_null)
        METHOD(XonoticInputBox, loadCvars, void(entity))
        METHOD(XonoticInputBox, saveCvars, void(entity))
index f99bdec56b550ac99b6e231537de9bcd41388937..b3e651a258fa1d1ebc3fe95bf45bf36e190e7d93 100644 (file)
@@ -154,15 +154,7 @@ void PutObserverInServer (void)
                WriteEntity(MSG_ONE, self);
        }
 
-       if(g_lms)
-       {
-               // Only if the player cannot play at all
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
-                       self.frags = FRAGS_SPECTATOR;
-               else
-                       self.frags = FRAGS_LMS_LOSER;
-       }
-       else if((g_race && g_race_qualifying) || g_cts)
+       if((g_race && g_race_qualifying) || g_cts)
        {
                if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
                        self.frags = FRAGS_LMS_LOSER;
@@ -379,14 +371,6 @@ void PutClientInServer (void)
        // reset player keys
        self.itemkeys = 0;
 
-       // player is dead and becomes observer
-       // FIXME fix LMS scoring for new system
-       if(g_lms)
-       {
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
-                       self.classname = "observer";
-       }
-
        MUTATOR_CALLHOOK(PutClientInServer);
 
        if(gameover)
@@ -569,8 +553,6 @@ void PutClientInServer (void)
                self.colormod = '1 1 1' * autocvar_g_player_brightness;
                self.exteriorweaponentity.alpha = default_weapon_alpha;
 
-               self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
-               self.lms_traveled_distance = 0;
                self.speedrunning = FALSE;
 
                race_PostSpawn(spot);
@@ -1858,6 +1840,46 @@ float SpectateUpdate() {
 }
 
 
+float SpectateSet()
+{
+       if(self.enemy.classname != "player")
+               return FALSE;
+       /*if(self.enemy.vehicle)
+       {
+
+               msg_entity = self;
+               WriteByte(MSG_ONE, SVC_SETVIEW);
+               WriteEntity(MSG_ONE, self.enemy);
+               //stuffcmd(self, "set viewsize $tmpviewsize \n");
+
+               self.movetype = MOVETYPE_NONE;
+               accuracy_resend(self);
+       }
+       else
+       {*/
+               msg_entity = self;
+               WriteByte(MSG_ONE, SVC_SETVIEW);
+               WriteEntity(MSG_ONE, self.enemy);
+               //stuffcmd(self, "set viewsize $tmpviewsize \n");
+               self.movetype = MOVETYPE_NONE;
+               accuracy_resend(self);
+
+               if(!SpectateUpdate())
+                       PutObserverInServer();
+       //}
+       return TRUE;
+}
+
+float Spectate(entity pl)
+{
+       if(g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer)
+       if(pl.team != self.team)
+               return 0;
+
+       self.enemy = pl;
+       return SpectateSet();
+}
+
 // Returns next available player to spectate if g_ca_spectate_enemies == 0
 entity CA_SpectateNext(entity start) {
        if (start.team == self.team) {
@@ -1881,13 +1903,10 @@ entity CA_SpectateNext(entity start) {
        return other;
 }
 
-float SpectateNext(entity _prefer) {
-       
-       if(_prefer)
-               other = _prefer;        
-       else
-               other = find(self.enemy, classname, "player");
-       
+float SpectateNext()
+{
+       other = find(self.enemy, classname, "player");
+
        if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) {
                // CA and ca players when spectating enemies is forbidden
                other = CA_SpectateNext(other);
@@ -1896,38 +1915,49 @@ float SpectateNext(entity _prefer) {
                if (!other)
                        other = find(other, classname, "player");
        }
-       
+
        if (other)
                self.enemy = other;
 
-       if(self.enemy.classname == "player") {
-           /*if(self.enemy.vehicle)
-           {      
-            
-            msg_entity = self;
-            WriteByte(MSG_ONE, SVC_SETVIEW);
-            WriteEntity(MSG_ONE, self.enemy);
-            //stuffcmd(self, "set viewsize $tmpviewsize \n");
-            
-            self.movetype = MOVETYPE_NONE;
-            accuracy_resend(self);
-           }
-           else 
-           {*/         
-            msg_entity = self;
-            WriteByte(MSG_ONE, SVC_SETVIEW);
-            WriteEntity(MSG_ONE, self.enemy);
-            //stuffcmd(self, "set viewsize $tmpviewsize \n");
-            self.movetype = MOVETYPE_NONE;
-            accuracy_resend(self);
-
-            if(!SpectateUpdate())
-                PutObserverInServer();
-        //}
-        return 1;
-       } else {
-               return 0;
+       return SpectateSet();
+}
+
+float SpectatePrev()
+{
+       // NOTE: chain order is from the highest to the lower entnum (unlike find)
+       other = findchain(classname, "player");
+       if not(other) // no player
+               return FALSE;
+
+       entity first = other;
+       // skip players until current spectated player
+       if(self.enemy)
+       while(other && other != self.enemy)
+               other = other.chain;
+
+       if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer)
+       {
+               do { other = other.chain; }
+               while(other && other.team != self.team);
+
+               if not(other)
+               {
+                       other = first;
+                       while(other.team != self.team)
+                               other = other.chain;
+                       if(other == self.enemy)
+                               return TRUE;
+               }
+       }
+       else
+       {
+               if(other.chain)
+                       other = other.chain;
+               else
+                       other = first;
        }
+       self.enemy = other;
+       return SpectateSet();
 }
 
 /*
@@ -2098,7 +2128,7 @@ void ObserverThink()
                        self.flags |= FL_SPAWNING;
                } else if(self.BUTTON_ATCK && !self.version_mismatch) {
                        self.flags &~= FL_JUMPRELEASED;
-                       if(SpectateNext(world) == 1) {
+                       if(SpectateNext()) {
                                self.classname = "spectator";
                        }
                } else {
@@ -2125,14 +2155,24 @@ void SpectatorThink()
                if (self.BUTTON_JUMP && !self.version_mismatch) {
                        self.flags &~= FL_JUMPRELEASED;
                        self.flags |= FL_SPAWNING;
-               } else if(self.BUTTON_ATCK) {
+               } else if(self.BUTTON_ATCK || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || self.impulse >= 200 && self.impulse <= 209) {
+                       self.flags &~= FL_JUMPRELEASED;
+                       if(SpectateNext()) {
+                               self.classname = "spectator";
+                       } else {
+                               self.classname = "observer";
+                               PutClientInServer();
+                       }
+                       self.impulse = 0;
+               } else if(self.impulse == 12 || self.impulse == 16  || self.impulse == 19 || self.impulse >= 220 && self.impulse <= 229) {
                        self.flags &~= FL_JUMPRELEASED;
-                       if(SpectateNext(world) == 1) {
+                       if(SpectatePrev()) {
                                self.classname = "spectator";
                        } else {
                                self.classname = "observer";
                                PutClientInServer();
                        }
+                       self.impulse = 0;
                } else if (self.BUTTON_ATCK2) {
                        self.flags &~= FL_JUMPRELEASED;
                        self.classname = "observer";
index a929e368c184f3f1a0ea6431318ac5a96c772de8..a318b8e3a4ad10c950a1adacc807a5da8b15e241 100644 (file)
@@ -48,13 +48,7 @@ void PlayerJump (void)
        mjumpheight = autocvar_sv_jumpvelocity;
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
-               if (self.watertype == CONTENT_WATER)
-                       self.velocity_z = 200;
-               else if (self.watertype == CONTENT_SLIME)
-                       self.velocity_z = 80;
-               else
-                       self.velocity_z = 50;
-
+               self.velocity_z = self.stat_sv_maxspeed * 0.7;
                return;
        }
 
index 95aeced31b308b5db10fa4ab9da332baab5151aa..60df5dd314a21d7008cd1232731a006dadffada3 100644 (file)
@@ -664,7 +664,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                else
                        self.respawn_countdown = -1; // do not count down
 
-               if(g_lms || g_cts || autocvar_g_forced_respawn)
+               if(g_cts || autocvar_g_forced_respawn)
                        self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
 
                self.death_time = time;
index 3e564e39ae93f055226d64ad8e3caf5b40e13fe0..e34464f16cbc84a102bfc9de9367ec8fb1a5c967 100644 (file)
@@ -332,9 +332,6 @@ void reset_map(float dorespawn)
                race_ReadyRestart();
        else MUTATOR_CALLHOOK(reset_map_global);
 
-       lms_lowest_lives = 999;
-       lms_next_place = player_count;
-
        for(self = world; (self = nextent(self)); )
        if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
        {
@@ -379,8 +376,6 @@ void reset_map(float dorespawn)
                        //NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
                        if (IS_PLAYER(self)) {
                                //PlayerScore_Clear(self);
-                               if(g_lms)
-                                       PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
                                self.killcount = 0;
                                //stop the player from moving so that he stands still once he gets respawned
                                self.velocity = '0 0 0';
index fb93b7c7876b3d133d4f5b30b2daa872b56e4aa8..95dbe48ff3f4e24423ffeabff3d2e27bd9340bb7 100644 (file)
@@ -243,9 +243,6 @@ float nJoinAllowed(entity ignore);
 
 .float spawnshieldtime;
 
-.float lms_nextcheck;
-.float lms_traveled_distance;
-
 .entity flagcarried;
 
 .float playerid;
index 6687f18ebc24064cf023faaa1c9a6b766cdb9396..fcabe6daf40ba28666593d79d55dbda3f19bd759 100644 (file)
@@ -240,7 +240,7 @@ void Obituary_SpecialDeath(
 {
        if(DEATH_ISSPECIAL(deathtype))
        {
-               entity deathent = deathtypes[(deathtype - DT_FIRST) - 1];
+               entity deathent = deathtypes[(deathtype - DT_FIRST)];
                if not(deathent) { backtrace("Obituary_SpecialDeath: Could not find deathtype entity!\n"); return; }
 
                if(murder)
index e79fb5a4e9a0eceb3f9c0cb7a02e46c62a104ba9..6162a34f8542be744187615938cc0ed2d42a60fd 100644 (file)
@@ -771,8 +771,7 @@ void readplayerstartcvars()
                g_pinata = 0; // incompatible
                g_weapon_stay = 0; // incompatible
                WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
-               if(!g_ca)
-                       start_items |= IT_UNLIMITED_AMMO;
+               start_items |= IT_UNLIMITED_AMMO;
        }
        else if (g_minstagib)
        {
@@ -824,28 +823,11 @@ void readplayerstartcvars()
        }
        else
        {
-               if(g_ca)
-               {
-                       start_ammo_shells = cvar("g_lms_start_ammo_shells");
-                       start_ammo_nails = cvar("g_lms_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_lms_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-               }
-               else
-               {
-                       start_ammo_shells = cvar("g_start_ammo_shells");
-                       start_ammo_nails = cvar("g_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_start_ammo_fuel");
-               }
-       }
-
-       if (g_ca)
-       {
-               start_health = cvar("g_lms_start_health");
-               start_armorvalue = cvar("g_lms_start_armor");
+               start_ammo_shells = cvar("g_start_ammo_shells");
+               start_ammo_nails = cvar("g_start_ammo_nails");
+               start_ammo_rockets = cvar("g_start_ammo_rockets");
+               start_ammo_cells = cvar("g_start_ammo_cells");
+               start_ammo_fuel = cvar("g_start_ammo_fuel");
        }
 
        if (inWarmupStage)
index 11330fbd7d6b370f851aa8425bd11d0dfab4322d..22bfc981c34c6cff8013f384f73641c698343f90 100644 (file)
@@ -222,6 +222,22 @@ MUTATOR_HOOKFUNCTION(ca_GiveFragsForKill)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(ca_SetStartItems)
+{
+       start_health = cvar("g_lms_start_health");
+       start_armorvalue = cvar("g_lms_start_armor");
+       
+       start_ammo_shells = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells = cvar("g_lms_start_ammo_cells");
+       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
+       
+       start_items &~= IT_UNLIMITED_AMMO;
+
+       return 0;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
@@ -248,6 +264,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, ca_ForbidPlayerScore_Clear, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, ca_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST);
+       MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 681a1d433a1f62dbc0cfe4b60b7d05b71850b704..82258ac77c115e33d144c7dc280526c0c3aa729c 100644 (file)
@@ -18,15 +18,49 @@ float LMS_NewPlayerLives()
 }
 
 // mutator hooks
-MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+MUTATOR_HOOKFUNCTION(lms_ResetMap)
+{
+       lms_lowest_lives = 999;
+       lms_next_place = player_count;
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
 {
-       if(IS_PLAYER(self))
        if(restart_mapalreadyrestarted || (time < game_starttime))
+       FOR_EACH_CLIENT(self)
+       if(IS_PLAYER(self))
                PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
+{
+       // player is dead and becomes observer
+       // FIXME fix LMS scoring for new system
+       if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
+               self.classname = "observer";
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+{
+       self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
+       self.lms_traveled_distance = 0;
                
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(lms_PlayerDies)
+{
+       self.respawn_flags |= RESPAWN_FORCE;
+       
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
 {
        // Only if the player cannot play at all
@@ -181,18 +215,6 @@ MUTATOR_HOOKFUNCTION(lms_ItemTouch)
        return FALSE;
 }
 
-MUTATOR_HOOKFUNCTION(lms_BotSpawn)
-{
-       // temporary hack to give bots lives
-       if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
-       {
-               PlayerScore_Add(self, SP_LMS_RANK, 666);
-               self.frags = FRAGS_SPECTATOR;
-       }
-       
-       return FALSE;
-}
-
 // scoreboard stuff
 void lms_ScoreRules()
 {
@@ -212,7 +234,11 @@ void lms_Initialize()
 
 MUTATOR_DEFINITION(gamemode_lms)
 {
+       MUTATOR_HOOK(reset_map_global, lms_ResetMap, CBC_ORDER_ANY);
+       MUTATOR_HOOK(reset_map_players, lms_ResetPlayers, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PutClientInServer, lms_PlayerPreSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, lms_PlayerSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDies, lms_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(MakePlayerObserver, lms_RemovePlayer, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientConnect, lms_ClientConnect, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPreThink, lms_PlayerThink, CBC_ORDER_ANY);
@@ -223,7 +249,6 @@ MUTATOR_DEFINITION(gamemode_lms)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, lms_KeepScore, CBC_ORDER_ANY);
        MUTATOR_HOOK(FilterItem, lms_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(ItemTouch, lms_ItemTouch, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, lms_BotSpawn, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 16fda61550823e6a098e27a2f47e1cfe2506550d..508bf8c6cd12b98af08be540322c31a346adea79 100644 (file)
@@ -5,4 +5,8 @@
 // lives related defs
 float lms_lowest_lives;
 float lms_next_place;
-float LMS_NewPlayerLives();
\ No newline at end of file
+float LMS_NewPlayerLives();
+
+// camp check
+.float lms_nextcheck;
+.float lms_traveled_distance;
\ No newline at end of file
index 5a050356de617f251898f27648ca1736a91065f8..8f289e5c3b5e0f5821b0df4bc5b99ecbb3c7da2e 100644 (file)
@@ -21,7 +21,7 @@
 
 float _spectate(entity _player)
 {
-       if(SpectateNext(_player) == 1)
+       if(Spectate(_player) == 1)
        {
                PutObserverInServer();
                self.classname = "spectator";
index 75f6a087d14256ef0b32ee3525809e847b47cf41..1b612057fe431f33dc78f08b3038112d2d205960 100644 (file)
@@ -85,7 +85,7 @@ void shotgun_meleethink (void)
                        + (v_up * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_up)
                        + (v_right * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_side));
 
-               WarpZone_traceline_antilag(self.realowner, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self.realowner, ANTILAG_LATENCY(self.realowner));
+               WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self, ANTILAG_LATENCY(self.realowner));
                
                // draw lightning beams for debugging
                //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5); 
@@ -151,7 +151,7 @@ void W_Shotgun_Attack2 (void)
 
        entity meleetemp;
        meleetemp = spawn();
-       meleetemp.owner = meleetemp.realowner = self;
+       meleetemp.realowner = self;
        meleetemp.think = shotgun_meleethink;
        meleetemp.nextthink = time + autocvar_g_balance_shotgun_secondary_melee_delay * W_WeaponRateFactor();
        W_SetupShot_Range(self, TRUE, 0, "", 0, autocvar_g_balance_shotgun_secondary_damage, autocvar_g_balance_shotgun_secondary_melee_range);