- Some changes in clusters initialization
authorunc0rr
Thu, 08 May 2008 18:02:52 +0000
changeset 915 33040b7695c0
parent 914 c2fcafbfc4aa
child 916 1d0022336fbb
- Some changes in clusters initialization - Dump random numbers buffer on exit
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uMisc.pas
hedgewars/uRandom.pas
--- a/hedgewars/GSHandlers.inc	Thu May 08 14:54:48 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Thu May 08 18:02:52 2008 +0000
@@ -120,9 +120,9 @@
    case Gear^.Kind of
         gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
       gtClusterBomb: begin
-                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
+                     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
                      for i:= 0 to 4 do
-                         AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, (getrandom - _0_5) * _0_2, (getrandom - _3) * _0_08, 0);
+                         AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, rndSign(GetRandom * _0_1), (GetRandom - _3) * _0_08, 0);
                      end
         end;
    DeleteGear(Gear);
@@ -138,7 +138,7 @@
 doStepFallingGear(Gear);
 if (Gear^.State and gstCollision) <> 0 then
    begin
-   doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
+   doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
    DeleteGear(Gear);
    exit
    end;
--- a/hedgewars/uGears.pas	Thu May 08 14:54:48 2008 +0000
+++ b/hedgewars/uGears.pas	Thu May 08 18:02:52 2008 +0000
@@ -195,7 +195,8 @@
    end;
 
 case Kind of
-   gtAmmo_Bomb: begin
+   gtAmmo_Bomb,
+ gtClusterBomb: begin
                 Result^.Radius:= 4;
                 Result^.Elasticity:= _0_6;
                 Result^.Friction:= _0_995;
@@ -247,7 +248,7 @@
                 end;
         gtMine: begin
                 Result^.State:= Result^.State or gstMoving;
-                Result^.Radius:= 3;
+                Result^.Radius:= 2;
                 Result^.Elasticity:= _0_55;
                 Result^.Friction:= _0_995;
                 Result^.Timer:= 3000;
@@ -266,11 +267,6 @@
                 Result^.Friction:= _0_03;
                 Result^.Timer:= 5000;
                 end;
- gtClusterBomb: begin
-                Result^.Radius:= 4;
-                Result^.Elasticity:= _0_6;
-                Result^.Friction:= _0_995;
-                end;
      gtCluster: Result^.Radius:= 2;
       gtShover: Result^.Radius:= 20;
        gtFlame: begin
--- a/hedgewars/uMisc.pas	Thu May 08 14:54:48 2008 +0000
+++ b/hedgewars/uMisc.pas	Thu May 08 18:02:52 2008 +0000
@@ -97,7 +97,6 @@
 function hwSign(r: hwFloat): LongInt;
 function Min(a, b: LongInt): LongInt;
 function Max(a, b: LongInt): LongInt;
-function rndSign(num: hwFloat): hwFloat;
 procedure OutError(Msg: String; isFatalError: boolean);
 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
 procedure SDLTry(Assert: boolean; isFatal: boolean);
@@ -239,12 +238,6 @@
 SendIPC('i' + stc[sit] + s)
 end;
 
-function rndSign(num: hwFloat): hwFloat;
-begin
-num.isNegative:= getrandom(2) = 0;
-rndSign:= num
-end;
-
 function Str2PChar(const s: shortstring): PChar;
 const CharArray: array[byte] of Char = '';
 begin
@@ -353,6 +346,7 @@
 {$I+}
 
 finalization
+uRandom.DumpBuffer;
 writeln(f, '-= halt at ',GameTicks,' ticks =-');
 Flush(f);
 close(f)
--- a/hedgewars/uRandom.pas	Thu May 08 14:54:48 2008 +0000
+++ b/hedgewars/uRandom.pas	Thu May 08 18:02:52 2008 +0000
@@ -25,8 +25,15 @@
 procedure SetRandomSeed(Seed: shortstring);
 function  GetRandom: hwFloat; overload;
 function  GetRandom(m: LongWord): LongWord; overload;
+function  rndSign(num: hwFloat): hwFloat;
+{$IFDEF DEBUGFILE}
+procedure DumpBuffer;
+{$ENDIF}
 
 implementation
+{$IFDEF DEBUGFILE}
+uses uMisc;
+{$ENDIF}
 var cirbuf: array[0..63] of Longword;
     n: byte = 54;
 
@@ -72,4 +79,19 @@
 GetRandom:= GetNext mod m
 end;
 
+function rndSign(num: hwFloat): hwFloat;
+begin
+num.isNegative:= odd(GetNext);
+rndSign:= num
+end;
+
+{$IFDEF DEBUGFILE}
+procedure DumpBuffer;
+var i: LongInt;
+begin
+for i:= 0 to 63 do
+	AddFileLog('[' + inttostr(i) + '] = ' + inttostr(cirbuf[i]))
+end;
+{$ENDIF}
+
 end.