Move amNothing from F1 slot to new special hidden weapon slot. Move amDuck to F1
authorWuzzy <almikes@aol.com>
Wed, 18 Oct 2017 03:19:43 +0200
changeset 12708 5ef6780b1c05
parent 12707 18941b52c8d7
child 12709 8673892ebf24
Move amNothing from F1 slot to new special hidden weapon slot. Move amDuck to F1
hedgewars/uConsts.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/uConsts.pas	Wed Oct 18 02:17:03 2017 +0200
+++ b/hedgewars/uConsts.pas	Wed Oct 18 03:19:43 2017 +0200
@@ -275,7 +275,8 @@
     gmDelete         = $00010000;
     gmAllStoppable = gmLeft or gmRight or gmUp or gmDown or gmAttack or gmPrecise;
 
-    cMaxSlotIndex       = 9;
+    cMaxSlotIndex       = 10;
+    cHiddenSlotIndex    = cMaxSlotIndex; // slot for hidden ammo types, not visible and has no key
     cMaxSlotAmmoIndex   = 5;
 
     // ai hints
--- a/hedgewars/uVariables.pas	Wed Oct 18 02:17:03 2017 +0200
+++ b/hedgewars/uVariables.pas	Wed Oct 18 03:19:43 2017 +0200
@@ -822,7 +822,7 @@
                 AmmoType: amNothing;
                 AttackVoice: sndNone;
                 Bounciness: 1000);
-            Slot: 0;
+            Slot: cHiddenSlotIndex;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -2425,9 +2425,7 @@
                 AmmoType: amDuck;
                 AttackVoice: sndNone;
                 Bounciness: 1000);
-            Slot: 8; // FIXME: Use slot 0. for some reason, hwengine does not like it
-                     // when we put it into slot 0.
-                     // Probably related to amNothing being in slot 0, too?
+            Slot: 0;
             TimeAfterTurn: 3000;
             minAngle: 0;
             maxAngle: 0;
--- a/hedgewars/uWorld.pas	Wed Oct 18 02:17:03 2017 +0200
+++ b/hedgewars/uWorld.pas	Wed Oct 18 03:19:43 2017 +0200
@@ -424,7 +424,7 @@
 
     SlotsNum:= 0;
     for i:= 0 to cMaxSlotIndex do
-        if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (Ammo^[i,0].Count > 0)) then
+        if((i = 0) and (Ammo^[i,1].Count > 0)) or ((i <> 0) and (i <> cHiddenSlotIndex) and (Ammo^[i,0].Count > 0)) then
             inc(SlotsNum);
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
     SlotsNumX:= SlotsNum;
@@ -455,7 +455,7 @@
     x:= AMRect.x;
     y:= AMRect.y;
     for i:= 0 to cMaxSlotIndex do
-        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
+        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (i <> cHiddenSlotIndex) and (Ammo^[i, 0].Count > 0)) then
             begin
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
             y:= AMRect.y;
@@ -662,7 +662,7 @@
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
 c:= -1;
     for i:= 0 to cMaxSlotIndex do
-        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
+        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (i <> cHiddenSlotIndex) and (Ammo^[i, 0].Count > 0)) then
             begin
             inc(c);
     {$IFDEF USE_AM_NUMCOLUMN}
@@ -692,7 +692,7 @@
 {$ELSE}
 c:= -1;
     for i:= 0 to cMaxSlotIndex do
-        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
+        if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (i <> cHiddenSlotIndex) and (Ammo^[i, 0].Count > 0)) then
             begin
             inc(c);
     {$IFDEF USE_AM_NUMCOLUMN}
@@ -720,7 +720,7 @@
                    end;
             end;
 {$ENDIF}
-    if (Pos >= 0) and (Pos <= cMaxSlotAmmoIndex) and (Slot >= 0) and (Slot <= cMaxSlotIndex)then
+    if (Pos >= 0) and (Pos <= cMaxSlotAmmoIndex) and (Slot >= 0) and (Slot <= cMaxSlotIndex) and (Slot <> cHiddenSlotIndex) then
         begin
         if (AMShiftX = 0) and (AMShiftY = 0) then
         if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then