present somthing that could be taken as a structure
authorHenek
Wed, 30 Nov 2011 23:16:44 +0100
changeset 6472 bced12412f94
parent 6471 010ec2fa7d7b
child 6473 2bed5ba1a7ea
present somthing that could be taken as a structure enable structures again disable sudden death music as a mood effect
QTfrontend/hwconsts.h
QTfrontend/ui/widget/selectWeapon.cpp
hedgewars/GSHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uGears.pas
hedgewars/uGearsList.pas
hedgewars/uSound.pas
--- a/QTfrontend/hwconsts.h	Wed Nov 30 12:19:10 2011 +0100
+++ b/QTfrontend/hwconsts.h	Wed Nov 30 23:16:44 2011 +0100
@@ -61,19 +61,19 @@
 #define HEDGEHOGS_PER_TEAM           8
 
 #define AMMOLINE_DEFAULT_QT     "939192942219912103223511100120100000021111010101111101"
-#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_DEFAULT_PROB   "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_DEFAULT_DELAY  "000000000000020550000004000700400000000022000000060000"
-#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_DEFAULT_CRATE  "131111031211111112311411111111111111121111110111111111"
 
-#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999209"
-#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111101"
+#define AMMOLINE_CRAZY_QT       "999999999999999999299999999999999929999999990999999229"
+#define AMMOLINE_CRAZY_PROB     "111111011111111111111111111111111111111111110111111111"
 #define AMMOLINE_CRAZY_DELAY    "000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111101"
+#define AMMOLINE_CRAZY_CRATE    "131111031211111112311411111111111111121111010111111111"
 
 #define AMMOLINE_PROMODE_QT     "909000900000000000000900000000000000000000000000000000"
 #define AMMOLINE_PROMODE_PROB   "000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_PROMODE_DELAY  "000000000000020550000004000700400000000020000000000000"
-#define AMMOLINE_PROMODE_CRATE  "111111111111111111111111111111111111111110010111111101"
+#define AMMOLINE_PROMODE_CRATE  "111111111111111111111111111111111111111110010111111111"
 
 #define AMMOLINE_SHOPPA_QT      "000000990000000000000000000000000000000000000000000000"
 #define AMMOLINE_SHOPPA_PROB    "444441004424440221011212122242200000000200040001001100"
@@ -81,19 +81,19 @@
 #define AMMOLINE_SHOPPA_CRATE   "111111111111111111111111111111111111111110110111111100"
 
 #define AMMOLINE_CLEAN_QT       "101000900001000001100000000000000000000000000000100000"
-#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_CLEAN_PROB     "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_CLEAN_DELAY    "000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_CLEAN_CRATE    "131111031211111112311411111111111111121111110111111111"
 
 #define AMMOLINE_MINES_QT       "000000990009000000030000000000000000000000000000000000"
 #define AMMOLINE_MINES_PROB     "000000000000000000000000000000000000000000000000000000"
 #define AMMOLINE_MINES_DELAY    "000000000000020550000004000700400000000020000000060000"
-#define AMMOLINE_MINES_CRATE    "111111111111111111111111111111111111111111110111111101"
+#define AMMOLINE_MINES_CRATE    "111111111111111111111111111111111111111111110111111111"
 
 #define AMMOLINE_PORTALS_QT     "900000900200000000210000000000000011000009000000000000"
-#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541101"
+#define AMMOLINE_PORTALS_PROB   "040504054160065554655446477657666666615551010111541111"
 #define AMMOLINE_PORTALS_DELAY  "000000000000020550000004000700400000000020000000060000"
-#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111101"
+#define AMMOLINE_PORTALS_CRATE  "131111031211111112311411111111111111121111110111111111"
 
 
 #define NETGAME_DEFAULT_PORT 46631
--- a/QTfrontend/ui/widget/selectWeapon.cpp	Wed Nov 30 12:19:10 2011 +0100
+++ b/QTfrontend/ui/widget/selectWeapon.cpp	Wed Nov 30 23:16:44 2011 +0100
@@ -129,7 +129,6 @@
     int i = 0, k = 0;
     for(; i < m_numItems; ++i) {
         if (i == 6) continue;
-        if (i == 52) continue; // Disable structures for now
         if (k % 4 == 0) ++j;
         SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this);
         weaponItems[i].append(swi);
--- a/hedgewars/GSHandlers.inc	Wed Nov 30 12:19:10 2011 +0100
+++ b/hedgewars/GSHandlers.inc	Wed Nov 30 23:16:44 2011 +0100
@@ -398,7 +398,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepMolotov(Gear: PGear);
 var 
-	s: Longword;
+    s: Longword;
     i, gX, gY: LongInt;
     dX, dY: hwFloat;
     smoke, glass: PVisualGear;
@@ -4941,8 +4941,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepStructure(Gear: PGear);
 var 
-    x, y: LongInt;
+    x, y, i: LongInt;
+    HH: PHedgehog;
+    t: PGear;
 begin
+    HH:= Gear^.Hedgehog;
+
     if (Gear^.State and gstMoving) <> 0 then
         begin
         AddGearCI(Gear);
@@ -4951,44 +4955,66 @@
         Gear^.State:= Gear^.State and (not gstMoving);
         end;
 
-    if CurAmmoGear = Gear then
+    dec(Gear^.Health, Gear^.Damage);
+    Gear^.Damage:= 0;
+        
+    if Gear^.Pos = 1 then
         begin
-        if (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
+        AddGearCI(Gear);
+        AfterAttack;
+        if Gear = CurAmmoGear then CurAmmoGear:= nil;
+        if HH^.Gear <> nil then HideHog(HH);
+        Gear^.Pos:= 2
+        end;
+        
+    if Gear^.Pos = 2 then
+        begin
+        if ((GameTicks mod 100) = 0) and (Gear^.Timer < 1000) then
             begin
-            DeleteGear(Gear);
-            exit
+            if (Gear^.Timer mod 10) = 0 then
+                begin
+                DeleteCI(Gear);
+                Gear^.Y:= Gear^.Y - _0_5;
+                AddGearCI(Gear);
+                end;
+            inc(Gear^.Timer);
             end;
-        if Gear = CurAmmoGear then CurAmmoGear := nil;
-        Gear^.Hedgehog:= CurrentHedgehog;
-        RemoveGearFromList(CurrentHedgehog^.Gear);
-        CurrentHedgehog^.Gear^.Z := cHHZ;
-        CurrentHedgehog^.Gear^.Active := false;
-        CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and (not gstHHDriven);
-        CurrentHedgehog^.GearHidden:= CurrentHedgehog^.Gear;
-        CurrentHedgehog^.Gear:= nil;
-        Gear^.Tag:= TotalRounds + Gear^.Tag;
-        AddGearCI(Gear);
+        if Gear^.Tag <= TotalRounds then Gear^.Pos:= 3;
         end;
-
-    dec(Gear^.Health, Gear^.Damage);
-    Gear^.Damage := 0;
         
-    if (Gear^.Tag = TotalRounds) or (Gear^.Health <= 0) then
-        begin
-        if Gear^.Hedgehog <> nil then
+    if Gear^.Pos = 3 then
+        if Gear^.Timer < 1000 then
+            begin
+            if (Gear^.Timer mod 10) = 0 then
+                begin
+                DeleteCI(Gear);
+                Gear^.Y:= Gear^.Y - _0_5;
+                AddGearCI(Gear);
+                end;
+            inc(Gear^.Timer);
+            end
+        else
             begin
-            Gear^.Hedgehog^.Gear:= Gear^.Hedgehog^.GearHidden;
-            Gear^.Hedgehog^.GearHidden:= nil;
-            Gear^.Hedgehog^.Gear^.X:= Gear^.X;
-            Gear^.Hedgehog^.Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Radius + cHHRadius);
-            InsertGearToList(Gear^.Hedgehog^.Gear);
-            Gear^.Hedgehog:= nil;
-            SetAllHHToActive;
+            if HH^.GearHidden <> nil then RestoreHog(HH);
+            Gear^.Pos:= 4;
             end;
-        end;
+        
+    if Gear^.Pos = 4 then
+        if ((GameTicks mod 1000) = 0) and ((GameFlags And gfInvulnerable) = 0) then
+            begin
+            t:= GearsList;
+            while t <> nil do
+                begin
+                if (t^.Kind = gtHedgehog) and (t^.Hedgehog^.Team^.Clan = HH^.Team^.Clan) then
+                    t^.Invulnerable:= true;
+                t:= t^.NextGear;
+                end;
+            end;
         
     if Gear^.Health <= 0 then
         begin
+        if HH^.GearHidden <> nil then RestoreHog(HH);
+        
         x := hwRound(Gear^.X);
         y := hwRound(Gear^.Y);
 
@@ -5052,10 +5078,10 @@
        ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
         with HH^.Gear^ do
             begin
-	        State:= State or gstAnimation;
-	        Tag:= 2;
-	        Timer:= 0;
-	        Pos:= 0
+            State:= State or gstAnimation;
+            Tag:= 2;
+            Timer:= 0;
+            Pos:= 0
             end
     end;
 if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power);
--- a/hedgewars/uAmmos.pas	Wed Nov 30 12:19:10 2011 +0100
+++ b/hedgewars/uAmmos.pas	Wed Nov 30 23:16:44 2011 +0100
@@ -111,8 +111,7 @@
            ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or
            ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or
            ((a = amVampiric) and ((GameFlags and gfVampiric) <> 0)) or
-           ((a = amExtraTime) and (cHedgehogTurnTime >= 1000000)) or
-            (a = amStructure) then
+           ((a = amExtraTime) and (cHedgehogTurnTime >= 1000000)) then
             begin
             cnt:= 0;
             Ammoz[a].Probability:= 0
--- a/hedgewars/uGears.pas	Wed Nov 30 12:19:10 2011 +0100
+++ b/hedgewars/uGears.pas	Wed Nov 30 23:16:44 2011 +0100
@@ -353,8 +353,9 @@
                         end;
                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
                     playSound(sndSuddenDeath);
-                    MusicFN:= SDMusic;
-                    ChangeMusic
+                    StopMusic //No SDMusic for now
+                    //MusicFN:= SDMusic;
+                    //ChangeMusic
                     end
                 else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
                     begin
--- a/hedgewars/uGearsList.pas	Wed Nov 30 12:19:10 2011 +0100
+++ b/hedgewars/uGearsList.pas	Wed Nov 30 23:16:44 2011 +0100
@@ -437,7 +437,9 @@
                 gear^.Density:= _0_9;
                 gear^.Radius:= 13;
                 gear^.Health:= 200;
-                gear^.Tag:= 3;
+                gear^.Timer:= 0;
+                gear^.Tag:= TotalRounds + 3;
+                gear^.Pos:= 1;
                 end;
     end;
 
--- a/hedgewars/uSound.pas	Wed Nov 30 12:19:10 2011 +0100
+++ b/hedgewars/uSound.pas	Wed Nov 30 23:16:44 2011 +0100
@@ -52,6 +52,7 @@
 procedure PauseMusic;
 procedure ResumeMusic;
 procedure ChangeMusic; // Replaces music track with current MusicFN and plays it.
+procedure StopMusic; // Stops and releases the current track
 
 
 // SOUNDS
@@ -458,7 +459,8 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    Mix_PauseMusic(Mus);
+    if Mus <> nil then
+    	Mix_PauseMusic(Mus);
 end;
 
 procedure ResumeMusic;
@@ -466,7 +468,8 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    Mix_ResumeMusic(Mus);
+    if Mus <> nil then
+    	Mix_ResumeMusic(Mus);
 end;
 
 procedure ChangeMusic;
@@ -474,11 +477,17 @@
     if (MusicFN = '') or (not isMusicEnabled) then
         exit;
 
-    // get rid of current music
+    StopMusic;
+    PlayMusic;
+end;
+
+procedure StopMusic;
+begin
+    if (MusicFN = '') or (not isMusicEnabled) then
+        exit;
+
     if Mus <> nil then
         Mix_FreeMusic(Mus);
-
-    PlayMusic;
 end;
 
 procedure chVoicepack(var s: shortstring);