- Properly get seed in net game
authorunc0rr
Thu, 05 Jan 2006 15:54:22 +0000
changeset 37 2b7f2a43b999
parent 36 a803a00a3272
child 38 c1ec4b15d70e
- Properly get seed in net game - Changed graphics to not get different collisions array in different bit depth - Make log files of different clients look more similar in net game - Start to implement new ammo - Properly handle intersections with current hedgehog
QTfrontend/hwform.cpp
QTfrontend/netclient.cpp
hedgewars/CCHandlers.inc
hedgewars/Data/Themes/avematan/a.png
hedgewars/Data/Themes/avematan/e.png
hedgewars/Data/Themes/themes.cfg
hedgewars/Data/Themes/tibet/chha.png
hedgewars/Data/Themes/tibet/ma.png
hedgewars/Data/Themes/tibet/nga.png
hedgewars/Data/Themes/tibet/sa.png
hedgewars/Data/Themes/tibet/ta1.png
hedgewars/Data/Themes/wood/theme.cfg
hedgewars/Data/Themes/wood/tree.png
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/hw.dpr
hedgewars/uAIAmmoTests.pas
hedgewars/uCollisions.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uIO.pas
hedgewars/uLand.pas
hedgewars/uStore.pas
--- a/QTfrontend/hwform.cpp	Sat Dec 31 13:46:49 2005 +0000
+++ b/QTfrontend/hwform.cpp	Thu Jan 05 15:54:22 2006 +0000
@@ -117,7 +117,7 @@
 	list = cfgdir.entryList(QStringList("*.cfg"));
 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
 	{
-		ui.CBTeamName->addItem((*it).replace(QRegExp("^(.*).cfg"), "\\1"));
+		ui.CBTeamName->addItem((*it).replace(QRegExp("^(.*).cfg$"), "\\1"));
 	}
 
 
--- a/QTfrontend/netclient.cpp	Sat Dec 31 13:46:49 2005 +0000
+++ b/QTfrontend/netclient.cpp	Thu Jan 05 15:54:22 2006 +0000
@@ -394,7 +394,7 @@
 		if (msg.startsWith(MAGIC_CHAR"Start!"MAGIC_CHAR) && (who == opnick))
 		{
 			state = nsStarting;
-			RunGame(msg.mid(7));
+			RunGame(msg.mid(8));
 			return ;
 		}
 		if (msg.startsWith(MAGIC_CHAR"="MAGIC_CHAR) && (who == opnick))
--- a/hedgewars/CCHandlers.inc	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/CCHandlers.inc	Thu Jan 05 15:54:22 2006 +0000
@@ -232,7 +232,6 @@
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^,
      CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
      begin
-     {$IFDEF DEBUGFILE}AddFileLog('/-attack: Gear.State = '+inttostr(State)+' CurAmmoGear = '+inttostr(longword(CurAmmoGear)));{$ENDIF}
       Message:= Message and not gm_Attack;
       if not CurrentTeam.ExtDriven then SendIPC('a')
      end
Binary file hedgewars/Data/Themes/avematan/a.png has changed
Binary file hedgewars/Data/Themes/avematan/e.png has changed
--- a/hedgewars/Data/Themes/themes.cfg	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/Data/Themes/themes.cfg	Thu Jan 05 15:54:22 2006 +0000
@@ -1,4 +1,5 @@
 avematan
 bubbles
 tibet
+wood
 xtheme
Binary file hedgewars/Data/Themes/tibet/chha.png has changed
Binary file hedgewars/Data/Themes/tibet/ma.png has changed
Binary file hedgewars/Data/Themes/tibet/nga.png has changed
Binary file hedgewars/Data/Themes/tibet/sa.png has changed
Binary file hedgewars/Data/Themes/tibet/ta1.png has changed
--- a/hedgewars/Data/Themes/wood/theme.cfg	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/Data/Themes/wood/theme.cfg	Thu Jan 05 15:54:22 2006 +0000
@@ -1,2 +1,4 @@
 5129753
-0
+1
+tree
+105 225 41 224 22 1 1 0 0 105 203
\ No newline at end of file
Binary file hedgewars/Data/Themes/wood/tree.png has changed
--- a/hedgewars/GSHandlers.inc	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Jan 05 15:54:22 2006 +0000
@@ -265,6 +265,27 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+procedure doStepDEagleShot(Gear: PGear);    // сама идея такова, что должна как то образовываться выбоина от выстрела :)
+var i: LongWord;                            // пуля и в африке пуля.. и демаж совсем другой.. и эксплоза никакого, можно даже
+begin                                       // навылет сделать, типа через одного пролетела и в другого попала... опять же
+AllInactive:= false;                        // дальше летишь меньше урон.. ой скока сразу мыслей то :))
+i:= 80;
+repeat
+Gear.X:= Gear.X + Gear.dX;
+Gear.Y:= Gear.Y + Gear.dY;
+CheckCollision(Gear);
+if (Gear.State and gstCollision) <> 0 then
+   begin
+   inc(Gear.Damage);
+   doMakeExplosion(round(Gear.X), round(Gear.Y), 2, EXPLAllDamageInRadius);
+   end;
+dec(i)
+until i = 0;
+if (Gear.Damage > 20) or (Gear.X < 0) or (Gear.Y < 0) or (Gear.X > 2048) or (Gear.Y > 1024) then
+   DeleteGear(Gear)
+end;
+
+////////////////////////////////////////////////////////////////////////////////
 procedure doStepActionTimer(Gear: PGear);
 begin
 case Gear.State of
@@ -593,7 +614,7 @@
       end else // gstAttacking <> 0
       begin
       AllInactive:= false;
-      if (Gear.Timer and $1FF) = 0 then PlaySound(sndMineTick);
+      if (Gear.Timer and $FF) = 0 then PlaySound(sndMineTick);
       if Gear.Timer = 0 then
          begin
          doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound);
--- a/hedgewars/HHHandlers.inc	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/HHHandlers.inc	Thu Jan 05 15:54:22 2006 +0000
@@ -31,6 +31,70 @@
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *)
 
+procedure AddIntersectorsCR(Gear: PGear);
+var t: PGear;
+    x, xw, y, yh: real;
+    ar: array[0..Pred(cMaxHHs)] of PGear;
+    cnt: Longword;
+    b: boolean;
+begin
+x:= Gear.X - Gear.HalfWidth;
+xw:= Gear.X + Gear.HalfWidth;
+y:= Gear.Y - Gear.HalfHeight;
+yh:= Gear.Y + Gear.HalfHeight;
+t:= GearsList;
+b:= false;
+cnt:= 0;
+while (t <> nil) do
+      begin
+      if (t <> Gear) then
+         if (x < t.X + t.HalfWidth ) and (t.X - t.HalfWidth  < xw) and
+            (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then
+            if t.Kind = gtHedgehog then
+               begin
+               ar[cnt]:= t;
+               inc(cnt)
+               end else b:= true;
+      t:= t.NextGear
+      end;
+ar[cnt]:= Gear;
+inc(cnt);
+if b then
+   begin
+   repeat
+     dec(cnt);
+     if ar[cnt].CollIndex < High(Longword) then DeleteCR(ar[cnt])
+   until cnt = 0;
+   end else
+   begin
+   repeat
+     dec(cnt);
+     if ar[cnt].CollIndex = High(Longword) then AddGearCR(ar[cnt])
+   until cnt = 0
+   end
+end;
+
+procedure RemoveIntersectorsCR(Gear: PGear);
+var t: PGear;
+    x, xw, y, yh: real;
+begin
+x:= Gear.X - Gear.HalfWidth;
+xw:= Gear.X + Gear.HalfWidth;
+y:= Gear.Y - Gear.HalfHeight;
+yh:= Gear.Y + Gear.HalfHeight;
+t:= GearsList;
+while (t <> nil) do
+      begin
+      if (t <> Gear) then
+         if (x < t.X + t.HalfWidth ) and (t.X - t.HalfWidth  < xw) and
+            (y < t.Y + t.HalfHeight) and (t.Y - t.HalfHeight < yh) then
+               if t.CollIndex < High(Longword) then DeleteCR(t);
+      t:= t.NextGear
+      end;
+if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
+end;
+
+////////////////////////////////////////////////////////////////////////////////
 procedure Attack(Gear: PGear);
 var xx, yy: real;
 begin
@@ -64,6 +128,9 @@
                                  PlaySound(sndShotgunReload);
                                  FollowGear:= AddGear(round(X + xx*20), round(Y + yy*20), gtShotgunShot,  0, xx * 0.5, 0.5 * yy);
                                  end;
+                       amDEagle: begin
+                                 FollowGear:= AddGear(round(X + xx*20), round(Y + yy*20), gtDEagleShot,  0, xx * 0.5, 0.5 * yy);
+                                 end;
                          amSkip: TurnTimeLeft:= 0;
                    amPickHammer: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y) + cHHHalfHeight, gtPickHammer, 0);
                          amRope: CurAmmoGear:= AddGear(round(Gear.X), round(Gear.Y), gtRope, 0, xx, yy);
@@ -120,7 +187,7 @@
       Gear.State:= Gear.State and not gstHHJumping;
    exit
    end;
-   
+
 // check for case with ammo
 t:= CheckGearNear(Gear, gtCase, 30, 30);
 if t <> nil then
@@ -141,7 +208,7 @@
             begin
             Gear.State:= Gear.State or gstAttacking;
             if Gear.Power = cMaxPower then Gear.Message:= Gear.Message and not gm_Attack
-               else begin
+               else
                if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Attack(Gear)
                   else begin
                   if Gear.Power = 0 then
@@ -151,10 +218,14 @@
                      end;
                   inc(Gear.Power)
                   end
-               end;
-            end else Gear.Message:= Gear.Message and not gm_Attack;
+            end
+      else Gear.Message:= Gear.Message and not gm_Attack;
 
-if ((Gear.State and gstAttacking) <> 0) and ((Gear.Message and gm_Attack) = 0) then Attack(Gear);
+if ((Gear.State and gstAttacking) <> 0) and ((Gear.Message and gm_Attack) = 0) then
+   begin
+   RemoveIntersectorsCR(Gear);
+   Attack(Gear);
+   end;
 
 if (Gear.State and gstFalling) <> 0 then
    begin
@@ -178,12 +249,12 @@
       if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
          and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * Sign(Gear.dX);
       Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
-      StepTicks:= 200;
+      StepTicks:= 300;   writelntoconsole(inttostr(gameticks)+'ooo');
       Gear.dY:= 0
       end;
    CheckGearDrowning(Gear);
    exit
-   end;
+   end else if Gear.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
 
 if StepTicks > 0 then dec(StepTicks);
 
@@ -197,6 +268,7 @@
    if ((Gear.Message and gm_LJump )<>0) then
       begin
       Gear.Message:= 0;
+      RemoveIntersectorsCR(Gear);
       if not HHTestCollisionYwithGear(Gear, -1) then
          if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 2 else
          if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 1;
@@ -212,6 +284,7 @@
    if ((Gear.Message and gm_HJump )<>0) then
       begin
       Gear.Message:= 0;
+      RemoveIntersectorsCR(Gear);
       if not HHTestCollisionYwithGear(Gear, -1) then
          begin
          Gear.dY:= -0.20;
@@ -225,6 +298,7 @@
    if (Gear.Message and gm_Right )<>0 then Gear.dX:=  1.0 else exit;
    PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7;
    StepTicks:= 40;
+   RemoveIntersectorsCR(Gear);
    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
       begin
       if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX))
@@ -241,7 +315,7 @@
          or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
       end;
    if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX;
-   
+
    if not HHTestCollisionYwithGear(Gear, 1) then
    begin
    Gear.Y:= Gear.Y + 1;
@@ -267,19 +341,21 @@
       Gear.dX:= 0.0000001 * Sign(Gear.dX);
       Gear.State:= Gear.State or gstFalling
       end;
-   SetAllHHToActive
    end
    end
    end
    end
    end
-   end
+   end;
+   AddIntersectorsCR(Gear);
+   SetAllHHToActive
    end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogFree(Gear: PGear);
 begin
+if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
 if not HHTestCollisionYwithGear(Gear, 1) then
    begin
    if (Gear.dY < 0) and HHTestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
@@ -348,7 +424,7 @@
       begin
       Gear.State:= 0;
       Gear.Active:= false;
-      AddGearCR(Gear);
+      AddIntersectorsCR(Gear);
       exit
       end
 end;
@@ -361,7 +437,6 @@
    DeleteGear(Gear);
    exit
    end;
-if Gear.CollIndex < High(Longword) then DeleteCR(Gear);
 if (Gear.State and gstHHDriven) = 0 then doStepHedgehogFree(Gear)
                                     else doStepHedgehogDriven(Gear)
 end;
--- a/hedgewars/hw.dpr	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/hw.dpr	Thu Jan 05 15:54:22 2006 +0000
@@ -72,8 +72,7 @@
 begin
 case GameState of
    gsLandGen: begin
-              if (GameFlags and gfForts) = 0 then GenLandSurface
-                                             else MakeFortsMap;
+              GenMap;
               GameState:= gsStart;
               end;
      gsStart: begin
--- a/hedgewars/uAIAmmoTests.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -71,6 +71,9 @@
                     ),
                     ( Test: nil;
                       Flags: 0;
+                    ),
+                    ( Test: nil;
+                      Flags: 0;
                     )
                     );
 
--- a/hedgewars/uCollisions.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uCollisions.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -61,7 +61,6 @@
 
 procedure AddGearCR(Gear: PGear);
 begin
-{$IFDEF DEBUGFILE}AddFileLog('AddCR crects count = ' + inttostr(Count));{$ENDIF}
 TryDo(Count <= MAXRECTSINDEX, 'Collision rects array overflow', true);
 with crects[Count] do
      begin
@@ -86,7 +85,6 @@
 
 procedure DeleteCR(Gear: PGear);
 begin
-{$IFDEF DEBUGFILE}AddFileLog('DelCR crects count = ' + inttostr(Count) + ' deleting ' + inttostr(Gear.CollIndex));{$ENDIF}
 if Gear.CollIndex < Pred(Count) then
    begin
    crects[Gear.CollIndex]:= crects[Pred(Count)];
@@ -104,15 +102,7 @@
 if Count = 0 then exit;
 x1:= round(Gear.X);
 y1:= round(Gear.Y);
-{if (Gear.State and gstOutOfHH) = 0 then
-   begin
-   p:= PHedgehog(Gear.Hedgehog)^.Gear;
-   if (p <> nil) and
-        ((x1 + Gear.HalfWidth < round(p.X) - p.HalfWidth)
-      or (x1 - Gear.HalfWidth > round(p.X) + p.HalfWidth)
-      or (y1 - Gear.HalfHeight > round(p.Y) + p.HalfHeight)
-      or (y1 + Gear.HalfHeight < round(p.Y) - p.HalfHeight)) then Gear.State:= Gear.State or gstOutOfHH;
-   end; }
+
 if forX then
    begin
    x1:= x1 + Dir*Gear.HalfWidth;
@@ -130,7 +120,6 @@
 for i:= 0 to Pred(Count) do
    with crects[i] do
       if  (Gear.CollIndex <> i)
-//      if ((p.Kind = gtHedgehog) and ((p.Hedgehog <> Gear.Hedgehog) or ((Gear.State and gstOutOfHH) <> 0)))
          and (x1 <= X + HWidth)
          and (x2 >= X - HWidth)
          and (y1 <= Y + HHeight)
--- a/hedgewars/uConsts.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uConsts.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -47,12 +47,12 @@
                    sprMineOn, sprCase);
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
-                   gtSmokeTrace, gtExplosion, gtMine, gtCase);
+                   gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot);
      TGearsType = set of TGearType;
      TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
                    sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
      TAmmoType  = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope,
-                   amMine);
+                   amMine, amDEagle);
      THWFont    = (fnt16, fntBig);
      THHFont    = record
                   Handle: PTTF_Font;
@@ -119,7 +119,6 @@
       gstFalling        = $00000080;
       gstHHJumping      = $00000100;
       gsttmpFlag        = $00000200;
-      gstOutOfHH        = $00000400;
       gstHHThinking     = $00000800;
 
       gtsStartGame      = 1;
@@ -320,9 +319,19 @@
                                           Timer: 0;
                                           AmmoType: amMine);
                                    Slot: 3;
-                                   TimeAfterTurn: 3000)
-                                  );
-                                  
+                                   TimeAfterTurn: 3000),
+                                  (Name: 'Desert Eagle';
+                                   Ammo: (Propz: 0;
+                                          Count: AMMO_INFINITE;
+                                          NumPerTurn: 3;
+                                          Timer: 0;
+                                          AmmoType: amDEagle);
+                                   Slot: 2;
+                                   TimeAfterTurn: 3000));
+
+
+
+
       Resolutions: array[0..3] of String = (
                                            '640 480',
                                            '800 600',
--- a/hedgewars/uGears.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uGears.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -110,7 +110,8 @@
                                                                doStepSmokeTrace,
                                                                doStepExplosion,
                                                                doStepMine,
-                                                               doStepCase
+                                                               doStepCase,
+                                                               doStepDEagleShot
                                                                );
 
 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -202,6 +203,10 @@
                 Result.HalfHeight:= 14;
                 Result.Elasticity:= 0.6
                 end;
+  gtDEagleShot: begin
+                Result.HalfWidth:= 1;
+                Result.HalfHeight:= 1
+                end;
      end;
 if GearsList = nil then GearsList:= Result
                    else begin
@@ -369,6 +374,11 @@
     var i, x, y: integer;
         t, k, ladd: real;
     begin
+    if (X1 = X2) and (Y1 = Y2) then
+       begin
+       {$IFDEF DEBUGFILE}AddFileLog('zero length rope line!!!!!');{$ENDIF}
+       exit
+       end;
     if abs(X1 - X2) > abs(Y1 - Y2) then
        begin
        if X1 > X2 then
@@ -550,6 +560,7 @@
       if Gear.Kind = gtHedgehog then
          begin
          GetHHPoint(pX, pY);
+         {$IFDEF DEBUGFILE}AddFileLog('HH at ('+inttostr(pX)+','+inttostr(pY)+')');{$ENDIF}
          Gear.X:= pX;
          Gear.Y:= pY
          end;
--- a/hedgewars/uIO.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uIO.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -171,19 +171,19 @@
 while (cmdcurpos <= cmdendpos)and(GameTicks = extcmd[cmdcurpos].Time) do
    begin
    case extcmd[cmdcurpos].cmd of
-        'L': ParseCommand('/+left');
-        'l': ParseCommand('/-left');
-        'R': ParseCommand('/+right');
-        'r': ParseCommand('/-right');
-        'U': ParseCommand('/+up');
-        'u': ParseCommand('/-up');
-        'D': ParseCommand('/+down');
-        'd': ParseCommand('/-down');
-        'A': ParseCommand('/+attack');
-        'a': ParseCommand('/-attack');
-        'S': ParseCommand('/switch');
-        'j': ParseCommand('/ljump');
-        'J': ParseCommand('/hjump');
+        'L': ParseCommand('+left');
+        'l': ParseCommand('-left');
+        'R': ParseCommand('+right');
+        'r': ParseCommand('-right');
+        'U': ParseCommand('+up');
+        'u': ParseCommand('-up');
+        'D': ParseCommand('+down');
+        'd': ParseCommand('-down');
+        'A': ParseCommand('+attack');
+        'a': ParseCommand('-attack');
+        'S': ParseCommand('switch');
+        'j': ParseCommand('ljump');
+        'J': ParseCommand('hjump');
         'N': begin
              tmpflag:= false;
              {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(extcmd[cmdcurpos].Time)){$ENDIF}
@@ -191,14 +191,14 @@
         'p': begin
              TargetPoint.X:= extcmd[cmdcurpos].X;
              TargetPoint.Y:= extcmd[cmdcurpos].Y;
-             ParseCommand('/put')
+             ParseCommand('put')
              end;
         'P': begin
              CursorPoint.X:= extcmd[cmdcurpos].X + WorldDx;
              CursorPoint.Y:= extcmd[cmdcurpos].Y + WorldDy;
              end;
-        '1'..'5': ParseCommand('/timer ' + extcmd[cmdcurpos].cmd);
-        #128..#134: ParseCommand('/slot ' + char(byte(extcmd[cmdcurpos].cmd) - 79))
+        '1'..'5': ParseCommand('timer ' + extcmd[cmdcurpos].cmd);
+        #128..#134: ParseCommand('slot ' + char(byte(extcmd[cmdcurpos].cmd) - 79))
         end;
    inc(cmdcurpos)
    end;
--- a/hedgewars/uLand.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uLand.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -40,14 +40,13 @@
 var  Land: TLandArray;
      LandSurface: PSDL_Surface;
 
-procedure GenLandSurface;
-procedure MakeFortsMap;
 procedure AddHHPoint(_x, _y: integer);
 procedure GetHHPoint(out _x, _y: integer);
 procedure RandomizeHHPoints;
+procedure GenMap;
 
 implementation
-uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uIO, uLandTemplates, uLandObjects;
+uses uConsole, uStore, uMisc, uConsts, uRandom, uTeams, uIO, uLandTemplates, uLandObjects, uSHA;
 
 type TPixAr = record
               Count: Longword;
@@ -59,6 +58,18 @@
               ar: array[1..Pred(cMaxSpawnPoints)] of TPoint
               end = (First: 1);
 
+procedure LogLandDigest;
+var ctx: TSHA1Context;
+    dig: TSHA1Digest;
+begin
+SHA1Init(ctx);
+SHA1Update(ctx, @Land, sizeof(Land));
+dig:= SHA1Final(ctx);
+AddFileLog('SHA1 Land digest: {'+inttostr(dig.LongWords[0])+':'
+           +inttostr(dig.LongWords[1])+':'+inttostr(dig.LongWords[2])+':'
+           +inttostr(dig.LongWords[3])+':'+inttostr(dig.LongWords[4])+'}');
+end;
+
 procedure DrawBezierEdge(var pa: TPixAr);
 var x, y, i: integer;
     tx, ty, vx, vy, vlen, t: real;
@@ -483,6 +494,7 @@
 TryDo(p <> nil, 'No teams on map!', true);
 with PixelFormat^ do
      LandSurface:= SDL_CreateRGBSurface(SDL_HWSURFACE, 2048, 1024, BitsPerPixel, RMask, GMask, BMask, 0);
+SDL_FillRect(LandSurface, nil, 0);
 tmpsurf:= LoadImage(Pathz[ptForts] + p.FortName + 'L.png', false);
 BlitImageAndGenerateCollisionInfo(0, 0, tmpsurf, LandSurface);
 SDL_FreeSurface(tmpsurf);
@@ -497,6 +509,14 @@
 TryDo(p = nil, 'More than 2 teams on map in forts mode!', true);
 end;
 
+procedure GenMap;
+begin
+if (GameFlags and gfForts) = 0 then GenLandSurface
+                               else MakeFortsMap;
+AddProgress;
+{$IFDEF DEBUGFILE}LogLandDigest{$ENDIF}
+end;
+
 procedure AddHHPoint(_x, _y: integer);
 begin
 with HHPoints do
--- a/hedgewars/uStore.pas	Sat Dec 31 13:46:49 2005 +0000
+++ b/hedgewars/uStore.pas	Thu Jan 05 15:54:22 2006 +0000
@@ -189,15 +189,10 @@
 end;
 
 procedure StoreInit;
-var r: TSDL_Rect;
 begin
 StoreSurface  := SDL_CreateRGBSurface(SDL_HWSURFACE, 576, 1024, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
 TryDo( StoreSurface <> nil, errmsgCreateSurface + ': store' , true);
-r.x:= 0;
-r.y:= 0;
-r.w:= 576;
-r.h:= 1024;
-SDL_FillRect(StoreSurface, @r, 0);
+SDL_FillRect(StoreSurface, nil, 0);
 
 TempSurface   := SDL_CreateRGBSurface(SDL_HWSURFACE, 724, 320, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
 TryDo(  TempSurface <> nil, errmsgCreateSurface + ': temp'  , true);