hedgewars/uWorld.pas
changeset 9720 453a1c29b7e4
parent 9693 9e31e3bb4476
child 9755 6306b54dd8fc
equal deleted inserted replaced
9719:cbdef918d087 9720:453a1c29b7e4
    58     , uTextures
    58     , uTextures
    59     , uRender
    59     , uRender
    60     , uCaptions
    60     , uCaptions
    61     , uCursor
    61     , uCursor
    62     , uCommands
    62     , uCommands
    63 {$IFDEF USE_VIDEO_RECORDING}    
    63     , uTeams
       
    64 {$IFDEF USE_VIDEO_RECORDING}
    64     , uVideoRec
    65     , uVideoRec
    65 {$ENDIF}    
    66 {$ENDIF}
    66     ;
    67     ;
    67 
    68 
    68 var cWaveWidth, cWaveHeight: LongInt;
    69 var cWaveWidth, cWaveHeight: LongInt;
    69     AMShiftTargetX, AMShiftTargetY, AMShiftX, AMShiftY, SlotsNum: LongInt;
    70     AMShiftTargetX, AMShiftTargetY, AMShiftX, AMShiftY, SlotsNum: LongInt;
    70     AMAnimStartTime, AMState : LongInt;
    71     AMAnimStartTime, AMState : LongInt;
  1229     end;
  1230     end;
  1230 end;
  1231 end;
  1231 
  1232 
  1232 
  1233 
  1233 procedure RenderTeamsHealth;
  1234 procedure RenderTeamsHealth;
  1234 var t, i, h, smallScreenOffset : LongInt;
  1235 var t, i, h, smallScreenOffset, TeamHealthBarWidth : LongInt;
  1235     r: TSDL_Rect;
  1236     r: TSDL_Rect;
  1236     highlight: boolean;
  1237     highlight: boolean;
  1237     htex: PTexture;
  1238     htex: PTexture;
  1238 begin
  1239 begin
  1239 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1240 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1246 else smallScreenOffset:= 0;
  1247 else smallScreenOffset:= 0;
  1247 for t:= 0 to Pred(TeamsCount) do
  1248 for t:= 0 to Pred(TeamsCount) do
  1248     with TeamsArray[t]^ do
  1249     with TeamsArray[t]^ do
  1249       if TeamHealth > 0 then
  1250       if TeamHealth > 0 then
  1250         begin
  1251         begin
  1251         h:= 0;
       
  1252         highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
  1252         highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
  1253 
  1253 
  1254         if highlight then
  1254         if highlight then
  1255             begin
  1255             begin
  1256             Tint(Clan^.Color shl 8 or $FF);
  1256             Tint(Clan^.Color shl 8 or $FF);
  1263         DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
  1263         DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
  1264 
  1264 
  1265         // draw flag
  1265         // draw flag
  1266         DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
  1266         DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
  1267 
  1267 
       
  1268         TeamHealthBarWidth:= cTeamHealthWidth * TeamHealthBarHealth div MaxTeamHealth;
       
  1269 
  1268         // draw health bar
  1270         // draw health bar
  1269         r.x:= 0;
  1271         r.x:= 0;
  1270         r.y:= 0;
  1272         r.y:= 0;
  1271         r.w:= 2 + TeamHealthBarWidth;
  1273         r.w:= 2 + TeamHealthBarWidth;
  1272         r.h:= htex^.h;
  1274         r.h:= htex^.h;
  1275         // draw health bars right border
  1277         // draw health bars right border
  1276         inc(r.x, cTeamHealthWidth + 2);
  1278         inc(r.x, cTeamHealthWidth + 2);
  1277         r.w:= 3;
  1279         r.w:= 3;
  1278         DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, htex);
  1280         DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, htex);
  1279 
  1281 
       
  1282         h:= 0;
  1280         if not hasGone then
  1283         if not hasGone then
  1281             for i:= 0 to cMaxHHIndex do
  1284             for i:= 0 to cMaxHHIndex do
  1282                 if Hedgehogs[i].Gear <> nil then
  1285                 begin
  1283                     begin
  1286                 inc(h, Hedgehogs[i].HealthBarHealth);
  1284                     inc(h,Hedgehogs[i].Gear^.Health);
  1287                 if (h < TeamHealthBarHealth) and (Hedgehogs[i].HealthBarHealth > 0) then 
  1285                     if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
  1288                     DrawTexture(15 + h * TeamHealthBarWidth div TeamHealthBarHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
  1286                     end;
  1289                 end;
  1287 
  1290 
  1288         // draw ai kill counter for gfAISurvival
  1291         // draw ai kill counter for gfAISurvival
  1289         if (GameFlags and gfAISurvival) <> 0 then
  1292         if (GameFlags and gfAISurvival) <> 0 then
  1290             begin
  1293             begin
  1291             DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex);
  1294             DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex);