- First hedgehog in team has first turn in team
authorunc0rr
Mon, 24 Jul 2006 14:03:51 +0000
changeset 83 207c85fbef51
parent 82 2f4f3236cccc
child 84 0f6669da2fcb
- First hedgehog in team has first turn in team - AI fix: let bots go to the right and... Show whether round finished with draw or team won... get rid of error message
hedgewars/CCHandlers.inc
hedgewars/Data/Locale/en.txt
hedgewars/Data/Locale/ru.txt
hedgewars/GSHandlers.inc
hedgewars/uAI.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
--- a/hedgewars/CCHandlers.inc	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/CCHandlers.inc	Mon Jul 24 14:03:51 2006 +0000
@@ -67,7 +67,8 @@
 if s[1]='"' then Delete(s, 1, 1);
 if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
 if id = 'team' then CurrentTeam.TeamName:= s
-else if (id[1]='h')and(id[2]='h')and(id[3]>='0')and(id[3]<='7') then
+else if (id[1] = 'h') and (id[2] = 'h')
+     and (id[3] >= '0') and (id[3] <= chr(ord('0')+cMaxHHIndex)) then
    CurrentTeam.Hedgehogs[byte(id[3])-48].Name:= s
 else OutError(errmsgUnknownVariable + ' "' + id + '"')
 end;
--- a/hedgewars/Data/Locale/en.txt	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/Data/Locale/en.txt	Mon Jul 24 14:03:51 2006 +0000
@@ -13,6 +13,8 @@
 00:10=Dynamite
 00:11=BaseballBat
 00:12=Fire Punch
+00:13=sec
 
 01:00=Let's fight!
-01:01=sec
\ No newline at end of file
+01:01=Round draw
+01:02=%1 wins!
\ No newline at end of file
--- a/hedgewars/Data/Locale/ru.txt	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/Data/Locale/ru.txt	Mon Jul 24 14:03:51 2006 +0000
@@ -13,6 +13,8 @@
 00:10=Динамит
 00:11=Бейсбольная бита
 00:12=Огненный удар
+00:13=сек
 
 01:00=Вперёд к победе!
-01:01=сек
\ No newline at end of file
+01:01=Ничья
+01:02=Победила команда %1!
\ No newline at end of file
--- a/hedgewars/GSHandlers.inc	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Jul 24 14:03:51 2006 +0000
@@ -318,24 +318,28 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepActionTimer(Gear: PGear);
 begin
-case Gear.State of
-     gtsStartGame: begin
-                   dec(Gear.Timer);
+dec(Gear.Timer);
+case Gear.Kind of
+    gtATStartGame: begin
                    AllInactive:= false;
-                   if Gear.Timer > 0 then exit;
-                   AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpStartGame);
-                   DeleteGear(Gear)
+                   if Gear.Timer = 0 then
+                      AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpGameState);
                    end;
-  gtsSmoothWindCh: begin
+ gtATSmoothWindCh: begin
                    if Gear.Timer = 0 then
                       begin
-                      Gear.Timer:= 10;
                       if WindBarWidth < Gear.Tag then inc(WindBarWidth)
-                         else if WindBarWidth > Gear.Tag then dec(WindBarWidth)
-                         else DeleteGear(Gear)
-                      end else dec(Gear.Timer)
+                         else if WindBarWidth > Gear.Tag then dec(WindBarWidth);
+                      if WindBarWidth <> Gear.Tag then Gear.Timer:= 10;
+                      end
+                   end;
+   gtATFinishGame: begin
+                   AllInactive:= false;
+                   if Gear.Timer = 0 then
+                      GameState:= gsExit
                    end;
      end;
+if Gear.Timer = 0 then DeleteGear(Gear)
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uAI.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uAI.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -81,15 +81,18 @@
               if Time <> 0 then AddAction(BestActions, aia_Timer, Time div 1000, 400);
               if (Angle > 0) then AddAction(BestActions, aia_LookRight, 0, 200)
               else if (Angle < 0) then AddAction(BestActions, aia_LookLeft, 0, 200);
-              Angle:= integer(Me.Angle) - Abs(Angle);
-              if Angle > 0 then
+              if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
                  begin
-                 AddAction(BestActions, aia_Up, aim_push, 500);
-                 AddAction(BestActions, aia_Up, aim_release, Angle)
-                 end else if Angle < 0 then
-                 begin
-                 AddAction(BestActions, aia_Down, aim_push, 500);
-                 AddAction(BestActions, aia_Down, aim_release, -Angle)
+                 Angle:= integer(Me.Angle) - Abs(Angle);
+                 if Angle > 0 then
+                    begin
+                    AddAction(BestActions, aia_Up, aim_push, 500);
+                    AddAction(BestActions, aia_Up, aim_release, Angle)
+                    end else if Angle < 0 then
+                    begin
+                    AddAction(BestActions, aia_Down, aim_push, 500);
+                    AddAction(BestActions, aia_Down, aim_release, -Angle)
+                    end
                  end;
               AddAction(BestActions, aia_attack, aim_push, 800);
               AddAction(BestActions, aia_attack, aim_release, Power);
@@ -150,8 +153,9 @@
     Result:= false;
     while (i < Stack.Count) and not Result do
           begin
-          Result:= abs(Stack.States[i].Hedgehog.X - Me.X) +
-                   abs(Stack.States[i].Hedgehog.Y - Me.Y) <= 2;
+          Result:= (abs(Stack.States[i].Hedgehog.X - Me.X) +
+                    abs(Stack.States[i].Hedgehog.Y - Me.Y) <= 2)
+                    and (Stack.States[i].Hedgehog.Message = Me.Message);
           inc(i)
           end
     end;
--- a/hedgewars/uConsts.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uConsts.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -49,10 +49,10 @@
                    sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
                    sprSky);
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
-                   gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
+                   gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
                    gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
                    gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
-                   gtFirePunch);
+                   gtFirePunch, gtATStartGame, gtATSmoothWindCh, gtATFinishGame);
      TGearsType = set of TGearType;
      TSound     = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
                    sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
@@ -60,6 +60,7 @@
                    amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
                    amBaseballBat);
      THWFont    = (fnt16, fntBig);
+     TCapGroup  = (capgrpGameState, capgrpAmmoinfo, capgrpNetSay);
      THHFont    = record
                   Handle: PTTF_Font;
                   Height: integer;
@@ -137,9 +138,6 @@
       gstHHThinking     = $00000800;
       gstNoDamage       = $00001000;
 
-      gtsStartGame      = 1;
-      gtsSmoothWindCh   = 2;
-
       gm_Left   = $00000001;
       gm_Right  = $00000002;
       gm_Up     = $00000004;
@@ -162,10 +160,6 @@
       ammoprop_NoCrosshair  = $00000040;
       AMMO_INFINITE = High(LongWord);
 
-      capgrpStartGame     = 0;
-      capgrpAmmoinfo      = 1;
-      capgrpNetSay        = 2;
-
       EXPLAllDamageInRadius = $00000001;
       EXPLAutoSound         = $00000002;
       EXPLNoDamage          = $00000004;
--- a/hedgewars/uGears.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uGears.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -109,7 +109,6 @@
                                                                doStepGrave,
                                                                doStepUFO,
                                                                doStepShotgunShot,
-                                                               doStepActionTimer,
                                                                doStepPickHammer,
                                                                doStepRope,
                                                                doStepSmokeTrace,
@@ -123,7 +122,10 @@
                                                                doStepCluster,
                                                                doStepShover,
                                                                doStepFlame,
-                                                               doStepFirePunch
+                                                               doStepFirePunch,
+                                                               doStepActionTimer,
+                                                               doStepActionTimer,
+                                                               doStepActionTimer
                                                                );
 
 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
@@ -143,6 +145,7 @@
 Result.dY:= dY;
 Result.doStep:= doStepHandlers[Kind];
 Result.CollIndex:= High(Longword);
+Result.Timer:= Timer;
 if CurrentTeam <> nil then
    Result.Hedgehog:= @CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog];
 case Kind of
@@ -150,7 +153,6 @@
                 Result.Radius:= 4;
                 Result.Elasticity:= 0.6;
                 Result.Friction:= 0.995;
-                Result.Timer:= Timer
                 end;
     gtHedgehog: begin
                 Result.Radius:= cHHRadius;
@@ -177,9 +179,6 @@
                 Result.Timer:= 900;
                 Result.Radius:= 2
                 end;
- gtActionTimer: begin
-                Result.Timer:= Timer
-                end;
   gtPickHammer: begin
                 Result.Radius:= 10;
                 Result.Timer:= 4000
@@ -223,7 +222,6 @@
                 Result.Radius:= 4;
                 Result.Elasticity:= 0.6;
                 Result.Friction:= 0.995;
-                Result.Timer:= Timer
                 end;
        gtFlame: begin
                 Result.Angle:= Counter mod 64;
@@ -294,7 +292,8 @@
             Gear.Damage:= 0
             end;
       Gear:= Gear.NextGear
-      end
+      end;
+CheckForWin
 end;
 
 procedure ProcessGears;
@@ -413,7 +412,7 @@
     begin
     if (X1 = X2) and (Y1 = Y2) then
        begin
-       {$IFDEF DEBUGFILE}AddFileLog('zero length rope line!!!!!');{$ENDIF}
+       OutError('WARNING: zero length rope line!');
        exit
        end;
     if abs(X1 - X2) > abs(Y1 - Y2) then
@@ -551,7 +550,7 @@
 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;
+AddGear(0, 0, gtATStartGame, 0, 0, 0, 2000);
 if (GameFlags and gfForts) = 0 then
    for i:= 0 to 3 do
        FindPlace(AddGear(0, 0, gtMine, 0), false, 0, 2048);
--- a/hedgewars/uLocale.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uLocale.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -35,12 +35,13 @@
 interface
 type TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidUFO, sidShotgun,
                    sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
-                   sidDynamite, sidBaseballBat, sidFirePunch);
-     TMsgStrId = (sidStartFight, sidSeconds);
+                   sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds);
+     TMsgStrId = (sidStartFight, sidDraw, sidWinner);
 var trammo: array[TAmmoStrId] of shortstring;
     trmsg: array[TMsgStrId] of shortstring;
 
 procedure LoadLocale(FileName: string);
+function Format(fmt: shortstring; var arg: shortstring): shortstring;
 
 implementation
 uses uMisc;
@@ -76,4 +77,12 @@
 {$I+}
 end;
 
+function Format(fmt: shortstring; var arg: shortstring): shortstring;
+var i: integer;
+begin
+i:= Pos('%1', fmt);
+if i = 0 then Result:= fmt
+         else Result:= copy(fmt, 1, i - 1) + arg + Format(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
+end;
+
 end.
--- a/hedgewars/uStore.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uStore.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -49,7 +49,7 @@
 procedure DrawFromStoreRect(X, Y: integer; Rect: PSDL_Rect; Surface: PSDL_Surface);
 procedure DrawHedgehog(X, Y: integer; Dir: integer; Pos, Step: LongWord; Surface: PSDL_Surface);
 procedure RenderHealth(var Hedgehog: THedgehog);
-function  RenderString(var s: shortstring; Color, Pos: integer): TSDL_Rect;
+function  RenderString(var s: shortstring; Color, Pos: integer): PSDL_Surface;
 procedure AddProgress;
 function  LoadImage(filename: string; hasAlpha: boolean; const critical: boolean = true): PSDL_Surface;
 
@@ -87,11 +87,11 @@
   SDL_FreeSurface(tmpsurf);
 end;
 
-procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface);
+procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; const Clear: boolean = true);
 var r: TSDL_Rect;
 begin
 r:= rect^;
-SDL_FillRect(Surface, @r, 0);
+if Clear then SDL_FillRect(Surface, @r, 0);
 r.y:= rect.y + 1;
 r.h:= rect.h - 2;
 SDL_FillRect(Surface, @r, BorderColor);
@@ -163,7 +163,7 @@
       Team.HealthRect:= r;
       rr:= r;
       inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
-      DrawRoundRect(@rr, Team.Color, Team.Color, StoreSurface);
+      DrawRoundRect(@rr, Team.Color, Team.Color, StoreSurface, false);
       inc(r.y, r.h);
       dec(drY, r.h + 2);
       Team.DrawHealthY:= drY;
@@ -461,9 +461,13 @@
    end;
 end;
 
-function RenderString(var s: shortstring; Color, Pos: integer): TSDL_Rect;
+function RenderString(var s: shortstring; Color, Pos: integer): PSDL_Surface;
+var w, h: integer;
 begin
-Result:= WriteInRoundRect(TempSurface, 64, Pos * Fontz[fntBig].Height, Color, fntBig, s);
+TTF_SizeUTF8(Fontz[fntBig].Handle, PChar(String(s)), w, h);
+Result:= SDL_CreateRGBSurface(SDL_HWSURFACE, w + 6, h + 2, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
+WriteInRoundRect(Result, 0, 0, Color, fntBig, s);
+TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true)
 end;
 
 procedure AddProgress;
--- a/hedgewars/uTeams.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uTeams.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -81,6 +81,7 @@
 function  TeamSize(p: PTeam): Longword;
 procedure RecountTeamHealth(team: PTeam);
 procedure RestoreTeamsFromSave;
+procedure CheckForWin;
 
 implementation
 uses uMisc, uStore, uWorld, uIO, uAI, uLocale;
@@ -88,6 +89,37 @@
 
 procedure FreeTeamsList; forward;
 
+procedure CheckForWin;
+var team, AliveTeam: PTeam;
+    AliveCount: Longword;
+begin
+AliveCount:= 0;
+AliveTeam:= nil;
+team:= TeamsList;
+while team <> nil do
+      begin
+      if team.TeamHealth > 0 then
+         begin
+         inc(AliveCount);
+         AliveTeam:= team
+         end;
+      team:= team.Next
+      end;
+
+if AliveCount >= 2 then exit;
+
+TurnTimeLeft:= 0;
+if AliveCount = 0 then
+   begin // draw
+   AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState);
+   AddGear(0, 0, gtATFinishGame, 0, 0, 0, 2000)
+   end else // win
+   begin
+   AddCaption(Format(trmsg[sidWinner], AliveTeam.TeamName), $FFFFFF, capgrpGameState);
+   AddGear(0, 0, gtATFinishGame, 0, 0, 0, 2000)
+   end;
+end;
+
 procedure SwitchHedgehog;
 var tteam: PTeam;
     th: integer;
@@ -104,19 +136,12 @@
   if CurrentTeam = nil then CurrentTeam:= TeamsList;
   th:= CurrentTeam.CurrHedgehog;
   repeat
-    CurrentTeam.CurrHedgehog:= Succ(CurrentTeam.CurrHedgehog) mod cMaxHHIndex;
+    CurrentTeam.CurrHedgehog:= Succ(CurrentTeam.CurrHedgehog) mod (cMaxHHIndex + 1);
   until (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil) or (CurrentTeam.CurrHedgehog = th)
 until (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear <> nil) or (CurrentTeam = tteam);
 
-if (CurrentTeam = tteam) then
-   begin
-   if GameType = gmtDemo then
-      begin
-      SendIPC('q');
-      GameState:= gsExit;
-      exit
-      end else OutError('There''s only one team on map!', true);
-   end;
+TryDo(CurrentTeam <> tteam, 'Switch hedgehog: only one team?!', true);
+
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
      begin
      AttacksNum:= 0;
@@ -129,28 +154,19 @@
      end;
 ResetKbd;
 cWindSpeed:= (GetRandom * 2 - 1) * cMaxWindSpeed;
-AddGear(0, 0, gtActionTimer, gtsSmoothWindCh).Tag:= round(72 * cWindSpeed / cMaxWindSpeed);
+AddGear(0, 0, gtATSmoothWindCh, 0, 0, 0, 1).Tag:= round(72 * cWindSpeed / cMaxWindSpeed);
 {$IFDEF DEBUGFILE}AddFileLog('Wind = '+FloatToStr(cWindSpeed));{$ENDIF}
 ApplyAmmoChanges(CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]);
 TurnTimeLeft:= cHedgehogTurnTime
 end;
 
-procedure SetFirstTurnHedgehog;
-var i: integer;
-begin
-if CurrentTeam=nil then OutError('nil Team (SetFirstTurnHedgehog)', true);
-i:= 0;
-while (i<cMaxHHIndex)and(CurrentTeam.Hedgehogs[i].Gear=nil) do inc(i);
-if CurrentTeam.Hedgehogs[i].Gear = nil then OutError(errmsgIncorrectUse + ' (sfth)', true);
-CurrentTeam.CurrHedgehog:= i;
-end;
-
 function AddTeam: PTeam;
 begin
 New(Result);
 TryDo(Result <> nil, 'AddTeam: Result = nil', true);
 FillChar(Result^, sizeof(TTeam), 0);
 Result.AttackBar:= 2;
+Result.CurrHedgehog:= cMaxHHIndex;
 if TeamsList = nil then TeamsList:= Result
                    else begin
                         Result.Next:= TeamsList;
@@ -217,7 +233,6 @@
       if th > MaxTeamHealth then MaxTeamHealth:= th;
       p:= p.Next
       end;
-SetFirstTurnHedgehog;
 RecountAllTeamsHealth
 end;
 
@@ -238,7 +253,7 @@
      if Count <> AMMO_INFINITE then
         s:= s + ' (' + IntToStr(Count) + ')';
      if (Propz and ammoprop_Timerable) <> 0 then
-        s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trmsg[sidSeconds];
+        s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trammo[sidSeconds];
      AddCaption(s, Team.Color, capgrpAmmoinfo);
      if (Propz and ammoprop_NeedTarget) <> 0
         then begin
--- a/hedgewars/uWorld.pas	Sun Jul 23 21:22:44 2006 +0000
+++ b/hedgewars/uWorld.pas	Mon Jul 24 14:03:51 2006 +0000
@@ -33,14 +33,14 @@
 
 unit uWorld;
 interface
-uses SDLh, uGears;
+uses SDLh, uGears, uConsts;
 {$INCLUDE options.inc}
 const WorldDx: integer = -512;
       WorldDy: integer = -256;
 
 procedure InitWorld;
 procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);
-procedure AddCaption(s: shortstring; Color, Group: LongWord);
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
 procedure MoveCamera;
 
 {$IFDEF COUNTTICKS}
@@ -50,7 +50,7 @@
     WindBarWidth: integer = 0;
 
 implementation
-uses uStore, uMisc, uConsts, uTeams, uIO;
+uses uStore, uMisc, uTeams, uIO, uConsole;
 const RealTicks: Longword = 0;
       Frames: Longword = 0;
       FPS: Longword = 0;
@@ -58,9 +58,9 @@
       prevPoint: TPoint = (X: 0; Y: 0);
       
 type TCaptionStr = record
-                   r: TSDL_Rect;
-                   StorePos,
-                   Group,
+                   Surf: PSDL_Surface;
+                   StorePos: Longword;
+                   Group: TCapGroup;
                    EndTime: LongWord;
                    end;
 
@@ -216,11 +216,19 @@
 while (i < cMaxCaptions) do
     begin
     with Captions[i] do
-         if EndTime > 0 then DrawCaption(cScreenWidth div 2, 8 + i * 32 + cConsoleYAdd, r, Surface, true);
+         if EndTime > 0 then
+            begin
+            r.x:= (cScreenWidth - Surf.w) div 2;
+            r.y:= 8 + i * (Surf.h + 2) + cConsoleYAdd;
+            r.w:= Surf.w;
+            r.h:= Surf.h;
+            SDL_UpperBlit(Surf, nil, Surface, @r)
+            end;
     inc(i)
     end;
 while (Captions[0].EndTime > 0) and (Captions[0].EndTime <= RealTicks) do
     begin
+    SDL_FreeSurface(Captions[0].Surf);
     for i:= 1 to Pred(cMaxCaptions) do
         Captions[Pred(i)]:= Captions[i];
     Captions[Pred(cMaxCaptions)].EndTime:= 0
@@ -234,13 +242,13 @@
                         Team.DrawHealthY,
                         @team.NameRect, Surface);
       r:= team.HealthRect;
-      r.w:= 3 + team.TeamHealth;
+      r.w:= 2 + team.TeamHealth;
       DrawFromStoreRect(cScreenWidth div 2,
                         Team.DrawHealthY,
                         @r, Surface);
-      inc(r.x, cTeamHealthWidth + 3);
-      r.w:= 2;
-      DrawFromStoreRect(cScreenWidth div 2 + team.TeamHealth + 3,
+      inc(r.x, cTeamHealthWidth + 2);
+      r.w:= 3;
+      DrawFromStoreRect(cScreenWidth div 2 + team.TeamHealth + 2,
                         Team.DrawHealthY,
                         @r, Surface);
       team:= team.Next
@@ -296,11 +304,12 @@
 if cShowFPS then DXOutText(cScreenWidth - 50, 10, fnt16, inttostr(FPS) + ' fps', Surface)
 end;
 
-procedure AddCaption(s: shortstring; Color, Group: LongWord);
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
 var i, t, m, k: LongWord;
 begin
+if Group in [capgrpGameState, capgrpNetSay] then WriteLnToConsole(s);
 i:= 0;
-while (i < cMaxCaptions) and (Captions[i].Group <> Group)do inc(i);
+while (i < cMaxCaptions) and (Captions[i].Group <> Group) do inc(i);
 if i < cMaxCaptions then
    begin
    while (i < Pred(cMaxCaptions)) do
@@ -326,9 +335,9 @@
 k:= 0;
 for i:= 0 to Pred(cMaxCaptions) do
     for t:= 0 to Pred(cMaxCaptions) do
-        if (Captions[t].EndTime > 0)and(Captions[t].StorePos = k) then inc(k);
+        if (Captions[t].EndTime > 0) and (Captions[t].StorePos = k) then inc(k);
 
-Captions[m].r:= RenderString(s, Color, k);
+Captions[m].Surf:= RenderString(s, Color, k);
 Captions[m].StorePos:= k;
 Captions[m].Group:= Group;
 Captions[m].EndTime:= RealTicks + 1200