- Unicode support for team and hedgehogs names
authorunc0rr
Sat, 08 Jul 2006 21:40:03 +0000
changeset 74 42257fee61ae
parent 73 fe1c62875a19
child 75 d2b737858ff7
- Unicode support for team and hedgehogs names - Clouds move in vertical direction also - Many fixes to hedgehog physics - Support for different images in 16 and 32 bit screen resolution - Fixed bots behavior after attack - Fixed camera behavior right after the game start
QTfrontend/game.cpp
hedgewars/Data/Fonts/DejaVuSans.ttf
hedgewars/Data/Fonts/UN1251N.TTF
hedgewars/Data/Graphics/Power.png
hedgewars/Data/Themes/steel/01.png
hedgewars/Data/Themes/steel/02.png
hedgewars/Data/Themes/steel/Border.png
hedgewars/Data/Themes/steel/LandTex.png
hedgewars/Data/Themes/steel/Sky.16.png
hedgewars/Data/Themes/steel/Sky.32.png
hedgewars/Data/Themes/steel/horizont.png
hedgewars/Data/Themes/steel/theme.cfg
hedgewars/Data/Themes/themes.cfg
hedgewars/Data/Themes/wood/gr1.png
hedgewars/Data/Themes/wood/theme.cfg
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/SDLh.pas
hedgewars/hwengine.dpr
hedgewars/uAI.pas
hedgewars/uAIActions.pas
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
hedgewars/uCollisions.pas
hedgewars/uConsts.pas
hedgewars/uGame.pas
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uLandObjects.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
--- a/QTfrontend/game.cpp	Mon Jul 03 17:46:58 2006 +0000
+++ b/QTfrontend/game.cpp	Sat Jul 08 21:40:03 2006 +0000
@@ -360,7 +360,7 @@
 		str = stream.readLine();
 		if (str.startsWith(";") || (str.length() > 254)) continue;
 		str.prepend("e");
-		SendIPC(str.toLocal8Bit());
+		SendIPC(str.toUtf8());
 	}
 	teamcfg.close();
 }
Binary file hedgewars/Data/Fonts/DejaVuSans.ttf has changed
Binary file hedgewars/Data/Fonts/UN1251N.TTF has changed
Binary file hedgewars/Data/Graphics/Power.png has changed
Binary file hedgewars/Data/Themes/steel/01.png has changed
Binary file hedgewars/Data/Themes/steel/02.png has changed
Binary file hedgewars/Data/Themes/steel/Border.png has changed
Binary file hedgewars/Data/Themes/steel/LandTex.png has changed
Binary file hedgewars/Data/Themes/steel/Sky.16.png has changed
Binary file hedgewars/Data/Themes/steel/Sky.32.png has changed
Binary file hedgewars/Data/Themes/steel/horizont.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/Data/Themes/steel/theme.cfg	Sat Jul 08 21:40:03 2006 +0000
@@ -0,0 +1,7 @@
+2105376
+2
+01
+122 178 4 175 114 2 1 0 0 122 132
+02
+366 363 363 300 3 44 2 119 110 198 205 0 0 171 175
+0
--- a/hedgewars/Data/Themes/themes.cfg	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/Data/Themes/themes.cfg	Sat Jul 08 21:40:03 2006 +0000
@@ -1,5 +1,6 @@
 avematan
 bubbles
+steel
 tibet
 wood
 xtheme
Binary file hedgewars/Data/Themes/wood/gr1.png has changed
--- a/hedgewars/Data/Themes/wood/theme.cfg	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/Data/Themes/wood/theme.cfg	Sat Jul 08 21:40:03 2006 +0000
@@ -1,7 +1,9 @@
 5129753
-1
+2
 tree
 105 225 41 224 22 1 1 0 0 105 203
+gr1
+121 129 47 123 27 4 1 0 0 121 105
 2
 leaf1
 5
--- a/hedgewars/GSHandlers.inc	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Sat Jul 08 21:40:03 2006 +0000
@@ -117,7 +117,10 @@
 procedure doStepCloud(Gear: PGear);
 begin
 Gear.X:= Gear.X + cWindSpeed * 200 + Gear.dX;
-if Gear.X < -cScreenWidth-256 then Gear.X:= cScreenWidth + 2048 else
+if Gear.Y > -160 then Gear.dY:= Gear.dY - 0.00002
+                 else Gear.dY:= Gear.dY + 0.00002;
+Gear.Y:= Gear.Y + Gear.dY;
+if Gear.X < -cScreenWidth - 256 then Gear.X:= cScreenWidth + 2048 else
 if Gear.X > cScreenWidth + 2048 then Gear.X:= -cScreenWidth - 256
 end;
 
--- a/hedgewars/HHHandlers.inc	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Sat Jul 08 21:40:03 2006 +0000
@@ -125,6 +125,7 @@
 procedure doStepHedgehogDriven(Gear: PGear);
 const StepTicks: LongWord = 0;
 var t: PGear;
+    PrevdX: integer;
 begin
 if isInMultiShoot and (Gear.Damage = 0) then
    begin
@@ -247,10 +248,12 @@
          exit
          end;
       end;
+   PrevdX:= Sign(Gear.dX);
    if (Gear.Message and gm_Left  )<>0 then Gear.dX:= -1.0 else
    if (Gear.Message and gm_Right )<>0 then Gear.dX:=  1.0 else exit;
+   StepTicks:= cHHStepTicks;
+   if PrevdX <> Sign(Gear.dX) then exit;
    PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7;
-   StepTicks:= cHHStepTicks;
    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
       begin
       if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX))
@@ -308,7 +311,6 @@
 begin
 //DeleteCI(Gear);
 if not TestCollisionYwithGear(Gear, 1) then
-   if TestCollisionYwithXYShift(Gear, 0, 1, 1) then Gear.Y:= Gear.Y + 1 else
    begin
    if (Gear.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
    Gear.State:= Gear.State or gstFalling or gstMoving;
@@ -318,7 +320,7 @@
    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);
-   if Gear.dY > 0    then Gear.dY:= 0;
+   if Gear.dY > 0 then Gear.dY:= 0;
    if ((Gear.State and gstMoving) <> 0) then Gear.dX:= Gear.dX * Gear.Friction
    end;
 
@@ -328,12 +330,12 @@
    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
       if ((Gear.State and gstFalling) = 0) then
          if abs(Gear.dX) > 0.01 then
-            if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.99; Gear.Y:= Gear.Y - 1 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.98; Gear.Y:= Gear.Y - 2 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.97; Gear.Y:= Gear.Y - 3 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.96; Gear.Y:= Gear.Y - 4 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.95; Gear.Y:= Gear.Y - 5 end else
-            if abs(Gear.dX) > 0.02 then Gear.dX:= -0.3 * Gear.dX
+            if not TestCollisionXwithXYShift(Gear, Sign(Gear.dX) - Gear.dX, -1, Sign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.96; Gear.Y:= Gear.Y - 1 end else
+            if not TestCollisionXwithXYShift(Gear, Sign(Gear.dX) - Gear.dX, -2, Sign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.93; Gear.Y:= Gear.Y - 2 end else
+            if not TestCollisionXwithXYShift(Gear, Sign(Gear.dX) - Gear.dX, -3, Sign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 3 end else
+            if not TestCollisionXwithXYShift(Gear, Sign(Gear.dX) - Gear.dX, -4, Sign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.87; Gear.Y:= Gear.Y - 4 end else
+            if not TestCollisionXwithXYShift(Gear, Sign(Gear.dX) - Gear.dX, -5, Sign(Gear.dX)) then begin Gear.X:= Gear.X + Gear.dX; Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 5 end else
+            if abs(Gear.dX) > 0.02 then Gear.dX:= -0.5 * Gear.dX
                                    else begin
                                         Gear.State:= Gear.State and not gstMoving;
                                         Gear.dX:= 0.0000001 * Sign(Gear.dX)
@@ -342,7 +344,7 @@
                                         Gear.State:= Gear.State and not gstMoving;
                                         Gear.dX:= 0.0000001 * Sign(Gear.dX)
                                         end
-         else Gear.dX:= -0.8 * Gear.dX;
+         else Gear.dX:= -Gear.dX;
 
 if ((Gear.State and gstFalling) = 0)and
    (sqr(Gear.dX) + sqr(Gear.dY) < 0.0008) then
@@ -355,7 +357,12 @@
 if (Gear.State and gstMoving) <> 0 then
    begin
    Gear.X:= Gear.X + Gear.dX;
-   Gear.Y:= Gear.Y + Gear.dY
+   Gear.Y:= Gear.Y + Gear.dY;
+   if (Gear.dY > 0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then
+      begin
+      Gear.dY:= 0;
+      Gear.Y:= Gear.Y + 1
+      end;
    end else
    if Gear.Health = 0 then
       begin
--- a/hedgewars/SDLh.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/SDLh.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -262,9 +262,9 @@
 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
 
 
-function TTF_SizeText(font : PTTF_Font; const text: PChar; var w, h: integer): Integer; cdecl; external SDL_TTFLibName;
-function TTF_RenderText_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
-function TTF_RenderText_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
+function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: integer): Integer; cdecl; external SDL_TTFLibName;
+function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
+function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
 function TTF_OpenFont(const filename: Pchar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName;
 
 (*  SDL_mixer *)
--- a/hedgewars/hwengine.dpr	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/hwengine.dpr	Sat Jul 08 21:40:03 2006 +0000
@@ -174,7 +174,8 @@
    begin
    val(ParamStr(1), cScreenWidth, c);
    val(ParamStr(2), cScreenHeight, c);
-   val(ParamStr(3), cBits, c);
+   cBitsStr:= ParamStr(3);
+   val(cBitsStr, cBits, c);
    val(ParamStr(4), ipcPort, c);
    cFullScreen:= ParamStr(5) = '1';
    isSoundEnabled:= ParamStr(6) = '1';
@@ -197,7 +198,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 begin
-WriteLnToConsole('HedgeWars 0.2');
+WriteLnToConsole('-= HedgeWars 0.2 =-');
 WriteLnToConsole('  -= by unC0Rr =-  ');
 GetParams;
 Randomize;
--- a/hedgewars/uAI.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uAI.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -115,7 +115,7 @@
 Actions.Pos:= 0;
 BestActions.Count:= 0;
 if (Me.State and gstAttacked) = 0 then maxsteps:= (TurnTimeLeft - 4000) div cHHStepTicks
-                                  else maxsteps:= 3000;
+                                  else maxsteps:= TurnTimeLeft div cHHStepTicks;
 BackMe:= Me^;
 if (Me.State and gstAttacked) = 0 then TestAmmos(Actions, Me);
 BestRate:= RatePlace(Me);
@@ -135,7 +135,7 @@
           begin
           BestActions:= Actions;
           BestRate:= Rate;
-          Me.State:= Me.State or gstAttacked // we have better place, go to it and don't use ammo
+          Me.State:= Me.State or gstAttacked // we have better place, go there and don't use ammo
           end
        else if Rate < BestRate then
                if BestRate > 0 then exit
@@ -149,20 +149,34 @@
 end;
 
 procedure Think(Me: PGear); cdecl;
-var BackMe: TGear;
+var BackMe, WalkMe: TGear;
     StartTicks: Longword;
 begin
 StartTicks:= GameTicks;
+BestActions.Count:= 0;
+BestActions.Pos:= 0;
 BestActions.Score:= Low(integer);
-if Targets.Count > 0 then
-   begin
-   BackMe:= Me^;
-   Walk(@BackMe);
-   end;
-if ((Me.State and gstAttacked) = 0)
-    and (StartTicks > GameTicks - 1000) then SDL_Delay(1000);
-    
-if BestActions.Count > 0 then Me.State:= Me.State and not gstHHThinking;
+BackMe:= Me^;
+WalkMe:= BackMe;
+if (Me.State and gstAttacked) = 0 then
+   if Targets.Count > 0 then
+      begin
+      Walk(@WalkMe);
+      if (StartTicks > GameTicks - 1500) then SDL_Delay(2000);
+      end else OutError('AI: no targets!?')
+else begin
+      Walk(@WalkMe);
+      while (not StopThinking) and (BestActions.Count = 0) do
+            begin
+            SDL_Delay(100);
+            FillBonuses(true);
+            WalkMe:= BackMe;
+            Walk(@WalkMe)
+            end;
+      AwareOfExplosion(0, 0, 0)
+      end;
+
+Me.State:= Me.State and not gstHHThinking;
 ThinkThread:= nil
 end;
 
--- a/hedgewars/uAIActions.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uAIActions.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -34,7 +34,7 @@
 unit uAIActions;
 interface
 uses uGears;
-const MAXACTIONS = 256;
+const MAXACTIONS = 32;
       aia_none       = 0;
       aia_Left       = 1;
       aia_Right      = 2;
--- a/hedgewars/uAIAmmoTests.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -108,7 +108,7 @@
         r:= sqrt(r);
         Angle:= DxDy2AttackAngle(Vx, Vy);
         Power:= round(r * cMaxPower);
-        ExplR:= 50;
+        ExplR:= 100;
         ExplX:= EX;
         ExplY:= EY;
         Result:= Score
@@ -161,7 +161,7 @@
         Angle:= DxDy2AttackAngle(Vx, Vy);
         Power:= round(r * cMaxPower);
         Time:= TestTime;
-        ExplR:= 50;
+        ExplR:= 100;
         ExplX:= EX;
         ExplY:= EY;
         Result:= Score
--- a/hedgewars/uAIMisc.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uAIMisc.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -90,8 +90,8 @@
                   begin
                   Point.X:= Round(Gear.X);
                   Point.Y:= Round(Gear.Y);
-                  if t <> CurrentTeam then Score:=  Gear.Health
-                                      else Score:= -Gear.Health
+                  if t.Color <> CurrentTeam.Color then Score:=  Gear.Health
+                                                  else Score:= -Gear.Health
                   end;
              inc(Targets.Count)
              end;
@@ -121,23 +121,21 @@
       begin
       case Gear.Kind of
            gtCase: AddBonus(round(Gear.X), round(Gear.Y), 33, 25);
-           gtMine: AddBonus(round(Gear.X), round(Gear.Y), 46, -50);
+           gtMine: if (Gear.State and gstAttacking) = 0 then AddBonus(round(Gear.X), round(Gear.Y), 50, -50)
+                                                        else AddBonus(round(Gear.X), round(Gear.Y), 100, -50); // mine is on
            gtDynamite: AddBonus(round(Gear.X), round(Gear.Y), 150, -75);
            gtHedgehog: begin
-                       if Gear.Damage >= Gear.Health then AddBonus(round(Gear.X), round(Gear.Y), 50, -25);
-                       if isAfterAttack
-                          and (ThinkingHH.Hedgehog <> Gear.Hedgehog)
-                          and (MyColor = PHedgehog(Gear.Hedgehog).Team.Color) then AddBonus(round(Gear.X), round(Gear.Y), 100, -1);
+                       if Gear.Damage >= Gear.Health then AddBonus(round(Gear.X), round(Gear.Y), 60, -25) else
+                          if isAfterAttack and (ThinkingHH.Hedgehog <> Gear.Hedgehog) then
+                             if (MyColor = PHedgehog(Gear.Hedgehog).Team.Color) then AddBonus(round(Gear.X), round(Gear.Y), 150, -3) // hedgehog-friend
+                                                                                else AddBonus(round(Gear.X), round(Gear.Y), 100, 3)
                        end;
            end;
       Gear:= Gear.NextGear
       end;
 if isAfterAttack and (KnownExplosion.Radius > 0) then
    with KnownExplosion do
-        begin
-        AddBonus(X, Y, Radius, -Radius);
-        Radius:= 0
-        end
+        AddBonus(X, Y, Radius + 10, -Radius);
 end;
 
 procedure AwareOfExplosion(x, y, r: integer);
--- a/hedgewars/uCollisions.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uCollisions.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -49,7 +49,7 @@
 function TestCollisionXwithGear(Gear: PGear; Dir: integer): boolean;
 function TestCollisionYwithGear(Gear: PGear; Dir: integer): boolean;
 function TestCollisionY(Gear: PGear; Dir: integer): boolean;
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: real; Dir: integer): boolean;
 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
 
 implementation
@@ -131,7 +131,7 @@
    end
 end;
 
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: real; Dir: integer): boolean;
 begin
 Gear.X:= Gear.X + ShiftX;
 Gear.Y:= Gear.Y + ShiftY;
--- a/hedgewars/uConsts.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uConsts.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -44,7 +44,7 @@
      TSprite    = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
                    sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO,
                    sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
-                   sprMineOn, sprCase, sprFAid, sprDynamite);
+                   sprMineOn, sprCase, sprFAid, sprDynamite, sprPower);
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
                    gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
@@ -87,6 +87,8 @@
 
       rndfillstr = 'hw';
 
+      MAXNAMELEN = 32;
+
       COLOR_LAND = $00FFFFFF;
 
       cifRandomize = $00000001;
@@ -168,15 +170,15 @@
 
       NoPointX = Low(Integer); // константа для TargetPoint, показывает, что цель не указана
 
-      cHHFileName   = 'Hedgehog.png';
-      cCHFileName   = 'Crosshair.png';
+      cHHFileName   = 'Hedgehog';
+      cCHFileName   = 'Crosshair';
       cThemeCFGFilename = 'theme.cfg';
 
       Fontz: array[THWFont] of THHFont = (
                                          (Height: 12;
-                                          Name: 'UN1251N.TTF'),
+                                          Name: 'DejaVuSans.ttf'),
                                          (Height: 24;
-                                          Name: 'UN1251N.TTF')
+                                          Name: 'DejaVuSans.ttf')
                                          );
 
       Pathz: array[TPathType] of string[ 64] = (
@@ -198,15 +200,15 @@
                                      FileName: String[31];
                                      Path    : TPathType;
                                      end = (
-                                     (FileName: 'horizont.png'; Path: ptThemeCurrent ),    // sHorizont
-                                     (FileName:      'Sky.png'; Path: ptThemeCurrent ),    // sSky
-                                     (FileName:  'Console.png'; Path: ptGraphics     ),    // sConsoleBG
-                                     (FileName: 'PowerBar.png'; Path: ptGraphics     ),    // sPowerBar
-                                     (FileName: 'thinking.png'; Path: ptGraphics     ),    // sQuestion
-                                     (FileName:  'WindBar.png'; Path: ptGraphics     ),    // sWindBar
-                                     (FileName:    'WindL.png'; Path: ptGraphics     ),    // sWindL
-                                     (FileName:    'WindR.png'; Path: ptGraphics     ),    // sWindR
-                                     (FileName: 'RopeNode.png'; Path: ptGraphics     )     // sRopeNode
+                                     (FileName: 'horizont'; Path: ptThemeCurrent ),    // sHorizont
+                                     (FileName:      'Sky'; Path: ptThemeCurrent ),    // sSky
+                                     (FileName:  'Console'; Path: ptGraphics     ),    // sConsoleBG
+                                     (FileName: 'PowerBar'; Path: ptGraphics     ),    // sPowerBar
+                                     (FileName: 'thinking'; Path: ptGraphics     ),    // sQuestion
+                                     (FileName:  'WindBar'; Path: ptGraphics     ),    // sWindBar
+                                     (FileName:    'WindL'; Path: ptGraphics     ),    // sWindL
+                                     (FileName:    'WindR'; Path: ptGraphics     ),    // sWindR
+                                     (FileName: 'RopeNode'; Path: ptGraphics     )     // sRopeNode
                                      );
       StuffPoz: array[TStuff] of TSDL_Rect = (
                                       (x:   0; y:   0; w: 512; h: 256), // sHorizont
@@ -226,24 +228,25 @@
                      Width, Height: integer;
                      hasAlpha: boolean;
                      end = (
-                     (FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48; hasAlpha: false),// sprWater
-                     (FileName:    'Clouds.png'; Path: ptGraphics; Width: 256; Height:128; hasAlpha: false),// sprCloud
-                     (FileName:      'Bomb.png'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprBomb
-                     (FileName: 'BigDigits.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha:  true),// sprBigDigit
-                     (FileName:     'Frame.png'; Path: ptGraphics; Width:   4; Height: 32; hasAlpha:  true),// sprFrame
-                     (FileName:       'Lag.png'; Path: ptGraphics; Width:  64; Height: 64; hasAlpha: false),// sprLag
-                     (FileName:     'Arrow.png'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprCursor
-                     (FileName:   'Grenade.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprGrenade
-                     (FileName:   'Targetp.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprTargetP
-                     (FileName:       'UFO.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprUFO
-                     (FileName:'SmokeTrace.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha:  true),// sprSmokeTrace
-                     (FileName:  'RopeHook.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprRopeHook
-                     (FileName:    'Expl50.png'; Path: ptGraphics; Width:  64; Height: 64; hasAlpha: false),// sprExplosion50
-                     (FileName:   'MineOff.png'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprMineOff
-                     (FileName:    'MineOn.png'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprMineOn
-                     (FileName:      'Case.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprCase
-                     (FileName:  'FirstAid.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprFAid
-                     (FileName:  'dynamite.png'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false) // sprDynamite
+                     (FileName: 'BlueWater'; Path: ptGraphics; Width: 256; Height: 48; hasAlpha: false),// sprWater
+                     (FileName:    'Clouds'; Path: ptGraphics; Width: 256; Height:128; hasAlpha: false),// sprCloud
+                     (FileName:      'Bomb'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprBomb
+                     (FileName: 'BigDigits'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha:  true),// sprBigDigit
+                     (FileName:     'Frame'; Path: ptGraphics; Width:   4; Height: 32; hasAlpha:  true),// sprFrame
+                     (FileName:       'Lag'; Path: ptGraphics; Width:  64; Height: 64; hasAlpha: false),// sprLag
+                     (FileName:     'Arrow'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprCursor
+                     (FileName:   'Grenade'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprGrenade
+                     (FileName:   'Targetp'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprTargetP
+                     (FileName:       'UFO'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprUFO
+                     (FileName:'SmokeTrace'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha:  true),// sprSmokeTrace
+                     (FileName:  'RopeHook'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprRopeHook
+                     (FileName:    'Expl50'; Path: ptGraphics; Width:  64; Height: 64; hasAlpha: false),// sprExplosion50
+                     (FileName:   'MineOff'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprMineOff
+                     (FileName:    'MineOn'; Path: ptGraphics; Width:  16; Height: 16; hasAlpha: false),// sprMineOn
+                     (FileName:      'Case'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprCase
+                     (FileName:  'FirstAid'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprFAid
+                     (FileName:  'dynamite'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha: false),// sprDynamite
+                     (FileName:     'Power'; Path: ptGraphics; Width:  32; Height: 32; hasAlpha:  true) // sprPower
                      );
       Soundz: array[TSound] of record
                                        FileName: String[31];
--- a/hedgewars/uGame.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uGame.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -64,7 +64,7 @@
    end;
 
 if Lag > 100 then Lag:= 100
-else if GameType = gmtSave then Lag:= 1000;
+else if GameType = gmtSave then Lag:= 2500;
 
 for i:= 1 to Lag do
     if not CurrentTeam.ExtDriven then
@@ -79,7 +79,6 @@
           case GameType of
                gmtNet: break;
                gmtDemo: begin
-                        ParseCommand('/quit');
                         GameState:= gsExit;
                         exit
                         end;
--- a/hedgewars/uGears.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uGears.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -76,7 +76,7 @@
     GearsList: PGear = nil;
 
 implementation
-uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics;
+uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics, uAIMisc;
 var RopePoints: record
                 Count: Longword;
                 HookAngle: integer;
@@ -316,6 +316,7 @@
                  inc(step)
                  end;
         stNTurn: begin
+                 AwareOfExplosion(0, 0, 0);
                  if isInMultiShoot then isInMultiShoot:= false
                                    else ParseCommand('/nextturn');
                  step:= Low(step)
@@ -327,6 +328,7 @@
       if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil then
          if ((CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear.State and gstAttacking) = 0)
             and not isInMultiShoot then dec(TurnTimeLeft);
+            
 inc(GameTicks);
 {$IFDEF COUNTTICKS}
 asm
@@ -518,7 +520,9 @@
 procedure AddMiscGears;
 var i: integer;
 begin
-for i:= 0 to cCloudsNumber do AddGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -128, gtCloud, random(4), (0.5-random)*0.01);
+for i:= 0 to cCloudsNumber do
+    AddGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, gtCloud, random(4),
+             (0.5-random)*0.02, ((i mod 2) * 2 - 1) * (0.005 + 0.015*random));
 AddGear(0, 0, gtActionTimer, gtsStartGame, 0, 0, 2000).Health:= 3;
 if (GameFlags and gfForts) = 0 then
    for i:= 0 to 3 do
--- a/hedgewars/uLand.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uLand.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -262,7 +262,7 @@
 var tmpsurf: PSDL_Surface;
     r: TSDL_Rect;
 begin
-tmpsurf:= LoadImage(Pathz[ptThemeCurrent] + '/LandTex.png', false);
+tmpsurf:= LoadImage(Pathz[ptThemeCurrent] + '/LandTex', false);
 r.y:= 0;
 while r.y < 1024 do
       begin
@@ -288,7 +288,7 @@
     r, rr: TSDL_Rect;
     x, yd, yu: integer;
 begin
-tmpsurf:= LoadImage(Pathz[ptThemeCurrent] + '/Border.png', false);
+tmpsurf:= LoadImage(Pathz[ptThemeCurrent] + '/Border', false);
 for x:= 0 to 2047 do
     begin
     yd:= 1023;
@@ -497,12 +497,12 @@
 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);
+tmpsurf:= LoadImage(Pathz[ptForts] + '/' + p.FortName + 'L', false);
 BlitImageAndGenerateCollisionInfo(0, 0, tmpsurf, LandSurface);
 SDL_FreeSurface(tmpsurf);
 p:= p.Next;
 TryDo(p <> nil, 'Only one team on map!', true);
-tmpsurf:= LoadImage(Pathz[ptForts] + '/' + p.FortName + 'R.png', false);
+tmpsurf:= LoadImage(Pathz[ptForts] + '/' + p.FortName + 'R', false);
 BlitImageAndGenerateCollisionInfo(1024, 0, tmpsurf, LandSurface);
 SDL_FreeSurface(tmpsurf);
 p:= p.Next;
@@ -514,7 +514,7 @@
 begin
 WriteLnToConsole('Loading land from file...');
 AddProgress;
-LandSurface:= LoadImage(Pathz[ptMapCurrent] + '/map.png', false);
+LandSurface:= LoadImage(Pathz[ptMapCurrent] + '/map', false);
 TryDo((LandSurface.w = 2048) and (LandSurface.h = 1024), 'Map dimensions should be 2048x1024!', true);
 
 if SDL_MustLock(LandSurface) then
--- a/hedgewars/uLandObjects.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uLandObjects.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -200,7 +200,7 @@
 if x1 > 0 then
    begin
    Result:= true;
-   tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder.png', false);
+   tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder', false);
    rr.x:= x1;
    rr.y:= y;
    while rr.x + 100 < x2 do
@@ -376,7 +376,7 @@
     Readln(f, s); // filename
     with ThemeObjects.objs[i] do
          begin
-         Surf:= LoadImage(Pathz[ptThemeCurrent] + '/' + s + '.png', false);
+         Surf:= LoadImage(Pathz[ptThemeCurrent] + '/' + s, false);
          Read(f, Width, Height);
          with inland do Read(f, x, y, w, h);
          Read(f, rectcnt);
@@ -393,7 +393,7 @@
     Readln(f, s); // filename
     with SprayObjects.objs[i] do
          begin
-         Surf:= LoadImage(Pathz[ptThemeCurrent] + '/' + s + '.png', false);
+         Surf:= LoadImage(Pathz[ptThemeCurrent] + '/' + s, false);
          Width:= Surf.w;
          Height:= Surf.h;
          ReadLn(f, Maxcnt)
--- a/hedgewars/uMisc.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uMisc.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -48,7 +48,7 @@
     TurnTimeLeft  : Longword = 0;
     cHedgehogTurnTime: Longword = 30000;
 
-    cLandYShift      : integer = 888;
+    cLandYShift      : integer = 1088;
     cCloudsNumber    : integer = 9;
     cConsoleHeight   : integer = 320;
     cConsoleYAdd     : integer = 0; 
@@ -56,6 +56,8 @@
     cScreenWidth     : integer = 1024;
     cScreenHeight    : integer = 768;
     cBits            : integer = 16;
+    cBitsStr         : string[2] = '16';
+
     cWaterLine       : integer = 1024;
     cVisibleWater    : integer = 64;
     cScreenEdgesDist : integer = 240;
--- a/hedgewars/uStore.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uStore.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -65,11 +65,11 @@
 
 procedure StoreInit;
 begin
-StoreSurface  := SDL_CreateRGBSurface(SDL_HWSURFACE, 576, 1024, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
+StoreSurface:= SDL_CreateRGBSurface(SDL_HWSURFACE, 576, 1024, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
 TryDo( StoreSurface <> nil, errmsgCreateSurface + ': store' , true);
 SDL_FillRect(StoreSurface, nil, 0);
 
-TempSurface   := SDL_CreateRGBSurface(SDL_HWSURFACE, 724, 320, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
+TempSurface:= SDL_CreateRGBSurface(SDL_HWSURFACE, 724, 900, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
 TryDo(  TempSurface <> nil, errmsgCreateSurface + ': temp'  , true);
 
 TryDo(SDL_SetColorKey( StoreSurface, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true);
@@ -117,22 +117,22 @@
     tmpsurf: PSDL_Surface;
     clr: TSDL_Color;
 begin
-TTF_SizeText(Fontz[Font].Handle, PChar(s), w, h);
+TTF_SizeUTF8(Fontz[Font].Handle, PChar(s), w, h);
 Result.x:= X;
 Result.y:= Y;
 Result.w:= w + 6;
-Result.h:= h + 6;
+Result.h:= h + 2;
 DrawRoundRect(@Result, cWhiteColor, cColorNearBlack, Surface);
 SDL_GetRGB(Color, Surface.format, @clr.r, @clr.g, @clr.b);
-tmpsurf:= TTF_RenderText_Blended(Fontz[Font].Handle, PChar(s), clr);
+tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, PChar(s), clr);
 Result.x:= X + 3;
-Result.y:= Y + 3;
+Result.y:= Y + 1;
 SDL_UpperBlit(tmpsurf, nil, Surface, @Result);
 SDL_FreeSurface(tmpsurf);
 Result.x:= X;
 Result.y:= Y;
 Result.w:= w + 6;
-Result.h:= h + 6
+Result.h:= h + 2
 end;
 
 procedure StoreLoad;
@@ -190,10 +190,7 @@
     r.w:= 16;
     r.h:= 16;
     s:= Pathz[ptGraphics] + '/' + cCHFileName;
-    WriteToConsole(msgLoading + s + ' ');
-    tmpsurf:= IMG_Load(PChar(s));
-    TryDo(tmpsurf <> nil, msgFailed, true);
-    WriteLnToConsole(msgOK);
+    tmpsurf:= LoadImage(PChar(s), false);
     TransColor:= SDL_MapRGB(tmpsurf.format, $FF, $FF, $FF);
     TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, TransColor) = 0, errmsgTransparentSet, true);
 
@@ -239,7 +236,7 @@
           begin
           dec(l, 32);
           if p.GraveName = '' then p.GraveName:= 'Simple';
-          LoadToSurface(Pathz[ptGraves] + '/' + p.GraveName + '.png', StoreSurface, l, 512);
+          LoadToSurface(Pathz[ptGraves] + '/' + p.GraveName, StoreSurface, l, 512);
           p.GraveRect.x:= l;
           p.GraveRect.y:= 512;
           p.GraveRect.w:= 32;
@@ -398,7 +395,7 @@
 r.x:= X;
 r.y:= Y;
 SDL_GetRGB(cWhiteColor, PixelFormat, @clr.r, @clr.g, @clr.b);
-tmpsurf:= TTF_RenderText_Solid(Fontz[Font].Handle, PChar(s), clr);
+tmpsurf:= TTF_RenderUTF8_Solid(Fontz[Font].Handle, PChar(s), clr);
 SDL_UpperBlit(tmpsurf, nil, Surface, @r);
 SDL_FreeSurface(tmpsurf)
 end;
@@ -491,7 +488,9 @@
 var tmpsurf: PSDL_Surface;
 begin
 WriteToConsole(msgLoading + filename + '... ');
-tmpsurf:= IMG_Load(PChar(filename));
+tmpsurf:= IMG_Load(PChar(filename + '.' + cBitsStr + '.png'));
+if tmpsurf = nil then
+   tmpsurf:= IMG_Load(PChar(filename + '.png'));
 TryDo(tmpsurf <> nil, msgFailed, true);
 TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true);
 if cFullScreen then
--- a/hedgewars/uTeams.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uTeams.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -39,7 +39,7 @@
      PTeam     = ^TTeam;
      PHHAmmo   = ^THHAmmo;
      THedgehog = record
-                 Name: string[15];
+                 Name: string[MAXNAMELEN];
                  Gear: PGear;
                  NameRect, HealthRect, HealthTagRect: TSDL_Rect;
                  Ammo: PHHAmmo;
@@ -54,7 +54,7 @@
      TTeam = record
              Next: PTeam;
              Color: Cardinal;
-             TeamName: string[15];
+             TeamName: string[MAXNAMELEN];
              ExtDriven: boolean;
              Aliases: array[0..cKeyMaxIndex] of shortstring;
              Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
@@ -149,7 +149,7 @@
 New(Result);
 TryDo(Result <> nil, 'AddTean: Result = nil', true);
 FillChar(Result^, sizeof(TTeam), 0);
-Result.AttackBar:= 1;
+Result.AttackBar:= 2;
 if TeamsList = nil then TeamsList:= Result
                    else begin
                         Result.Next:= TeamsList;
--- a/hedgewars/uWorld.pas	Mon Jul 03 17:46:58 2006 +0000
+++ b/hedgewars/uWorld.pas	Sat Jul 08 21:40:03 2006 +0000
@@ -70,13 +70,20 @@
 procedure InitWorld;
 begin
 cLandYShift:= cWaterLine + 64;
-cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width)
+cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
+cScreenEdgesDist:= Min(cScreenWidth div 4, cScreenHeight div 4);
+SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
+prevPoint.X:= cScreenWidth div 2;
+prevPoint.Y:= cScreenHeight div 2;
+WorldDx:=  - 1024 + cScreenWidth div 2;
+WorldDy:=  - 512 + cScreenHeight div 2
 end;
 
 procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);
 var i, t: integer;
     r: TSDL_Rect;
     team: PTeam;
+    tdx, tdy: real;
 begin
 // Sky
 inc(RealTicks, Lag);
@@ -178,6 +185,15 @@
            {$WARNINGS ON}
            DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
            end;
+        2: with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
+                begin
+                tdx:= Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle);
+                tdy:= - Cos(Gear.Angle*pi/cMaxAngle);
+                for i:= (Gear.Power * 24) div cPowerDivisor downto 0 do
+                    DrawSprite(sprPower, round(Gear.X + WorldDx + tdx * (32 + i * 2)) - 16,
+                                         round(Gear.Y + WorldDy + tdy * (32 + i * 2)) - 12,
+                                         i, Surface)
+                end
         end;
 
 // Target