Show wind speed on bar
authorunc0rr
Thu, 25 Aug 2005 16:45:58 +0000
changeset 5 0dafbd19a04c
parent 4 bcbd7adb4e4b
child 6 9c1f00e7b43e
Show wind speed on bar
hedgewars/Data/Graphics/WindBar.png
hedgewars/Data/Graphics/WindL.png
hedgewars/Data/Graphics/WindR.png
hedgewars/uConsts.pas
hedgewars/uRandom.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
Binary file hedgewars/Data/Graphics/WindBar.png has changed
Binary file hedgewars/Data/Graphics/WindL.png has changed
Binary file hedgewars/Data/Graphics/WindR.png has changed
--- a/hedgewars/uConsts.pas	Tue Aug 23 16:17:53 2005 +0000
+++ b/hedgewars/uConsts.pas	Thu Aug 25 16:45:58 2005 +0000
@@ -35,7 +35,8 @@
 interface
 uses SDLh;
 {$INCLUDE options.inc}
-type TStuff     = (sHorizont, sSky, sConsoleBG, sPowerBar, sQuestion);
+type TStuff     = (sHorizont, sSky, sConsoleBG, sPowerBar, sQuestion, sWindBar,
+                   sWindL, sWindR);
      TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit);
      TGameType  = (gmtLocal, gmtDemo, gmtNet);
      TPathType  = (ptData, ptGraphics, ptThemes, ptThemeCurrent, ptTeams, ptMaps,
@@ -186,14 +187,20 @@
                                      (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: 'thinking.png'; Path: ptGraphics     ),    // sQuestion
+                                     (FileName:  'WindBar.png'; Path: ptGraphics     ),    // sWindBar
+                                     (FileName:    'WindL.png'; Path: ptGraphics     ),    // sWindL
+                                     (FileName:    'WindR.png'; Path: ptGraphics     )     // sWindR
                                      );
       StuffPoz: array[TStuff] of TSDL_Rect = (
                                       (x:   0; y:   0; w: 512; h: 256), // sHorizont
                                       (x: 512; y:   0; w:  64; h:1024), // sSky
                                       (x: 256; y: 256; w: 256; h: 256), // sConsoleBG
                                       (x: 256; y: 768; w: 256; h:  32), // sPowerBar
-                                      (x: 256; y: 512; w:  32; h:  32)  // sQuestion
+                                      (x: 256; y: 512; w:  32; h:  32), // sQuestion
+                                      (x: 256; y: 800; w: 151; h:  17), // sWindBar
+                                      (x: 256; y: 817; w:  80; h:  13), // sWindL
+                                      (x: 336; y: 817; w:  80; h:  13)  // sWindR
                                       );
       SpritesData: array[TSprite] of record
                                          FileName: String[31];
--- a/hedgewars/uRandom.pas	Tue Aug 23 16:17:53 2005 +0000
+++ b/hedgewars/uRandom.pas	Thu Aug 25 16:45:58 2005 +0000
@@ -68,7 +68,7 @@
 SHA1Update(sc1, @Fill[1], Length(Fill));
 sc2:= sc1;
 dig:= SHA1Final(sc1);
-Result:= (((dig.LongWords[0] mod m) + (dig.LongWords[2] mod m)) mod m + (dig.LongWords[3] mod m)) mod m;
+Result:= (dig.LongWords[0] + dig.LongWords[2] + dig.LongWords[3]) mod m;
 sc1:= sc2
 end;
 
--- a/hedgewars/uTeams.pas	Tue Aug 23 16:17:53 2005 +0000
+++ b/hedgewars/uTeams.pas	Thu Aug 25 16:45:58 2005 +0000
@@ -48,7 +48,7 @@
                  Team: PTeam;
                  AttacksNum: Longword;
                  visStepPos: LongWord;
-                 BotLevel  : LongWord; // 0 - человек
+                 BotLevel  : LongWord; // 0 - Human player
                  end;
      THHAmmo   = array[0..cMaxSlot, 0..cMaxSlotAmmo] of TAmmo;
      TTeam = record
--- a/hedgewars/uWorld.pas	Tue Aug 23 16:17:53 2005 +0000
+++ b/hedgewars/uWorld.pas	Thu Aug 25 16:45:58 2005 +0000
@@ -78,7 +78,7 @@
     r: TSDL_Rect;
     team: PTeam;
 begin
-// синее небо
+// Sky
 inc(RealTicks, Lag);
 r.h:= WorldDy;
 if r.h > 0 then
@@ -89,22 +89,21 @@
    r.w:= cScreenWidth;
    SDL_FillRect(Surface, @r, cSkyColor)
    end;
-// задний фон
+// background
 for i:= 0 to (cScreenWidth shr 6) do
     DrawGear(sSky, i*64, WorldDy, Surface);
 
-for i:= -1 to 3 do // горизонт
+for i:= -1 to 3 do
     DrawGear(sHorizont, i * 512 + (((WorldDx * 3) div 5) and $1FF), cWaterLine - 256 + WorldDy, Surface);
 
-// волны
+// Waves
 {$WARNINGS OFF}
 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 256  + ((WorldDx + (RealTicks shr 6)      ) and $FF), cWaterLine + WorldDy - 40, (((GameTicks shr 7) + 2) mod 12), Surface);
 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 256  + ((WorldDx - (RealTicks shr 6) + 192) and $FF), cWaterLine + WorldDy - 30, (((GameTicks shr 7) + 8) mod 12), Surface);
 {$WARNINGS ON}
 
-// поле
 DrawLand(WorldDx, WorldDy, Surface);
-// вода
+// Water
 r.y:= WorldDy + cWaterLine + 32;
 if r.y < cScreenHeight then
    begin
@@ -123,7 +122,7 @@
           with team.Hedgehogs[i] do
                if Gear<>nil then
                   if Gear.State = 0 then
-                     begin // ёжик не находится под управлением
+                     begin
                      DrawCaption( round(Gear.X) + WorldDx,
                                   round(Gear.Y) - cHHHalfHeight - 30 + WorldDy,
                                   HealthRect, Surface, true);
@@ -133,9 +132,9 @@
 //                     DrawCaption( round(Gear.X) + WorldDx,
 //                                  round(Gear.Y) - Gear.HalfHeight - 60 + WorldDy,
 //                                  Team.NameRect, Surface);
-                     end else // ёжик, которым счас управляем
+                     end else // Current hedgehog
                      begin
-                     if (Gear.State and (gstMoving or gstAttacked or gstDrowning or gstFalling))=0 then // рисуем прицел и, если бот думает, знак вопроса
+                     if (Gear.State and (gstMoving or gstAttacked or gstDrowning or gstFalling))=0 then
                         if (Gear.State and gstHHThinking) <> 0 then
                            DrawGear(sQuestion, Round(Gear.X)  - 10 + WorldDx, Round(Gear.Y) - cHHHalfHeight - 34 + WorldDy, Surface)
                         else
@@ -146,7 +145,7 @@
       team:= team.Next
       end;
 
-// волны
+// Waves
 {$WARNINGS OFF}
 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 256  + ((WorldDx + (RealTicks shr 6) +  64) and $FF), cWaterLine + WorldDy - 20, (((GameTicks shr 7) + 4 ) mod 12), Surface);
 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 256  + ((WorldDx - (RealTicks shr 6) + 128) and $FF), cWaterLine + WorldDy - 10, (((GameTicks shr 7) + 10) mod 12), Surface);
@@ -179,7 +178,7 @@
            end;
         end;
 
-// Указатель на цель
+// Target
 if TargetPoint.X <> NoPointX then DrawSprite(sprTargetP, TargetPoint.X + WorldDx - 16, TargetPoint.Y + WorldDy - 16, 0, Surface);
 
 // Captions
@@ -197,10 +196,36 @@
     Captions[Pred(cMaxCaptions)].EndTime:= 0
     end;
 
-// Указание на лаг
+// Lag alert
 if isInLag then DrawSprite(sprLag, 32, 32  + cConsoleYAdd, (RealTicks shr 7) mod 7, Surface);
 
-// Курсор
+// Wind bar
+DrawGear(sWindBar, cScreenWidth - 180, cScreenHeight - 30, Surface);
+if cWindSpeed > 0 then
+   begin
+   t:= round(72 * cWindSpeed / cMaxWindSpeed);
+   with StuffPoz[sWindR] do
+        begin
+        r.x:= x + 8 - (RealTicks shr 6) mod 8;
+        r.y:= y;
+        r.w:= t;
+        r.h:= 13;
+        end;
+   DrawSpriteFromRect(r, cScreenWidth - 103, cScreenHeight - 28, 13, 0, Surface);
+   end else
+   begin
+   t:= - round(72 * cWindSpeed / cMaxWindSpeed);
+   with StuffPoz[sWindL] do
+        begin
+        r.x:= x + (RealTicks shr 6) mod 8;
+        r.y:= y;
+        r.w:= t;
+        r.h:= 13;
+        end;
+   DrawSpriteFromRect(r, cScreenWidth - 106 - t, cScreenHeight - 28, 13, 0, Surface);
+   end;
+
+// Cursor
 if isCursorVisible then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface);
 
 {$IFDEF COUNTTICKS}