hedgewars/uWorld.pas
changeset 9654 47332746e6d9
parent 9557 a5005b7ca305
child 9656 18422d205080
equal deleted inserted replaced
9653:327d98e165e2 9654:47332746e6d9
  1119     glTranslatef(-stereoDepth, 0, 0);
  1119     glTranslatef(-stereoDepth, 0, 0);
  1120     glMatrixMode(GL_MODELVIEW);
  1120     glMatrixMode(GL_MODELVIEW);
  1121     stereoDepth:= 0;
  1121     stereoDepth:= 0;
  1122 {$ENDIF}
  1122 {$ENDIF}
  1123 end;
  1123 end;
  1124  
  1124 
  1125 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
  1125 
  1126 var i, t, h: LongInt;
  1126 procedure RenderWorldEdge(Lag: Longword);
  1127     r: TSDL_Rect;
  1127 var
  1128     tdx, tdy: Double;
       
  1129     s: shortstring;
       
  1130     highlight: Boolean;
       
  1131     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
       
  1132     VertexBuffer: array [0..3] of TVertex2f;
  1128     VertexBuffer: array [0..3] of TVertex2f;
  1133     lw, lh: GLfloat;
       
  1134     c1, c2: LongWord; // couple of colours for edges
  1129     c1, c2: LongWord; // couple of colours for edges
  1135 begin
  1130 begin
  1136 if (cReducedQuality and rqNoBackground) = 0 then
       
  1137     begin
       
  1138         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
       
  1139         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
       
  1140         offsetY:= 10 * Min(0, -145 - ScreenBottom);
       
  1141         SkyOffset:= offsetY div 35 + cWaveHeight;
       
  1142         HorizontOffset:= SkyOffset;
       
  1143         if ScreenBottom > SkyOffset then
       
  1144             HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20);
       
  1145 
       
  1146         // background
       
  1147         ChangeDepth(RM, cStereo_Sky);
       
  1148         if SuddenDeathDmg then
       
  1149             Tint(SDTint, SDTint, SDTint, $FF);
       
  1150         DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset);
       
  1151         ChangeDepth(RM, -cStereo_Horizon);
       
  1152         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
       
  1153         if SuddenDeathDmg then
       
  1154             Tint($FF, $FF, $FF, $FF);
       
  1155     end;
       
  1156 
       
  1157 DrawVisualGears(0);
       
  1158 ChangeDepth(RM, -cStereo_MidDistance);
       
  1159 DrawVisualGears(4);
       
  1160 
       
  1161 if (cReducedQuality and rq2DWater) = 0 then
       
  1162     begin
       
  1163         // Waves
       
  1164         DrawWater(255, SkyOffset); 
       
  1165         ChangeDepth(RM, -cStereo_Water_distant);
       
  1166         DrawWaves( 1,  0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64);
       
  1167         ChangeDepth(RM, -cStereo_Water_distant);
       
  1168         DrawWaves( -1,  25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48);
       
  1169         ChangeDepth(RM, -cStereo_Water_distant);
       
  1170         DrawWaves( 1,  75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32);
       
  1171         ChangeDepth(RM, -cStereo_Water_distant);
       
  1172         DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24);
       
  1173     end
       
  1174 else
       
  1175         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
       
  1176 
       
  1177     changeDepth(RM, cStereo_Land);
       
  1178     DrawVisualGears(5);
       
  1179     DrawLand(WorldDx, WorldDy);
       
  1180 
       
  1181     DrawWater(255, 0);
       
  1182 
       
  1183 DrawVisualGears(1);
       
  1184 DrawGears;
       
  1185 DrawVisualGears(6);
       
  1186 
       
  1187 if SuddenDeathDmg then
       
  1188     DrawWater(SDWaterOpacity, 0)
       
  1189 else
       
  1190     DrawWater(WaterOpacity, 0);
       
  1191 
       
  1192     // Waves
       
  1193 ChangeDepth(RM, cStereo_Water_near);
       
  1194 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12);
       
  1195 
       
  1196 if (cReducedQuality and rq2DWater) = 0 then
       
  1197     begin
       
  1198     //DrawWater(WaterOpacity, - offsetY div 40);
       
  1199     ChangeDepth(RM, cStereo_Water_near);
       
  1200     DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8);
       
  1201     if SuddenDeathDmg then
       
  1202         DrawWater(SDWaterOpacity, - offsetY div 20)
       
  1203     else
       
  1204         DrawWater(WaterOpacity, - offsetY div 20);
       
  1205     ChangeDepth(RM, cStereo_Water_near);
       
  1206     DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2);
       
  1207         if SuddenDeathDmg then
       
  1208             DrawWater(SDWaterOpacity, - offsetY div 10)
       
  1209         else
       
  1210             DrawWater(WaterOpacity, - offsetY div 10);
       
  1211         ChangeDepth(RM, cStereo_Water_near);
       
  1212         DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
       
  1213         end
       
  1214     else
       
  1215         DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
       
  1216 
       
  1217 // everything after this ChangeDepth will be drawn outside the screen
       
  1218 // note: negative parallax gears should last very little for a smooth stereo effect
       
  1219     ChangeDepth(RM, cStereo_Outside);
       
  1220     DrawVisualGears(2);
       
  1221 
       
  1222 // everything after this ResetDepth will be drawn at screen level (depth = 0)
       
  1223 // note: everything that needs to be readable should be on this level
       
  1224     ResetDepth(RM);
       
  1225     DrawVisualGears(3);
       
  1226 
       
  1227 {$WARNINGS OFF}
       
  1228 // Target
       
  1229 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
       
  1230     begin
       
  1231     with PHedgehog(CurrentHedgehog)^ do
       
  1232         begin
       
  1233         if CurAmmoType = amBee then
       
  1234             DrawSpriteRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
       
  1235         else
       
  1236             DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
       
  1237         end
       
  1238     end;
       
  1239 {$WARNINGS ON}
       
  1240 
       
  1241 if WorldEdge <> weNone then
  1131 if WorldEdge <> weNone then
  1242     begin
  1132     begin
  1243 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type.  Prob also, say, trigger a border animation timer on an impact. *)
  1133 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type.  Prob also, say, trigger a border animation timer on an impact. *)
  1244 
  1134 
  1245     glDisable(GL_TEXTURE_2D);
  1135     glDisable(GL_TEXTURE_2D);
  1335         DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $2E8B5780)
  1225         DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $2E8B5780)
  1336         end;
  1226         end;
  1337     if LeftImpactTimer > Lag then dec(LeftImpactTimer,Lag) else LeftImpactTimer:= 0;
  1227     if LeftImpactTimer > Lag then dec(LeftImpactTimer,Lag) else LeftImpactTimer:= 0;
  1338     if RightImpactTimer > Lag then dec(RightImpactTimer,Lag) else RightImpactTimer:= 0
  1228     if RightImpactTimer > Lag then dec(RightImpactTimer,Lag) else RightImpactTimer:= 0
  1339     end;
  1229     end;
       
  1230 end;
       
  1231 
       
  1232 
       
  1233 procedure RenderTeamsHealth;
       
  1234 var t, i, h, smallScreenOffset : LongInt;
       
  1235     r: TSDL_Rect;
       
  1236     highlight: boolean;
       
  1237 begin
       
  1238 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
       
  1239     begin
       
  1240     SetScale(1.5);
       
  1241     smallScreenOffset:= cScreenHeight div 6;
       
  1242     if TeamsCount * 100 > Longword(cScreenHeight) then
       
  1243         Tint($FF,$FF,$FF,$80);
       
  1244     end
       
  1245 else smallScreenOffset:= 0;
       
  1246 for t:= 0 to Pred(TeamsCount) do
       
  1247     with TeamsArray[t]^ do
       
  1248       if TeamHealth > 0 then
       
  1249         begin
       
  1250         h:= 0;
       
  1251         highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
       
  1252 
       
  1253         if highlight then
       
  1254             Tint(Clan^.Color shl 8 or $FF);
       
  1255 
       
  1256          // draw name
       
  1257         DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
       
  1258 
       
  1259         // draw flag
       
  1260         DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
       
  1261 
       
  1262         // draw health bar
       
  1263         r.x:= 0;
       
  1264         r.y:= 0;
       
  1265         r.w:= 2 + TeamHealthBarWidth;
       
  1266         r.h:= HealthTex^.h;
       
  1267         DrawTextureFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
       
  1268 
       
  1269         // draw health bars right border
       
  1270         inc(r.x, cTeamHealthWidth + 2);
       
  1271         r.w:= 3;
       
  1272         DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
       
  1273 
       
  1274         if not hasGone then
       
  1275             for i:= 0 to cMaxHHIndex do
       
  1276                 if Hedgehogs[i].Gear <> nil then
       
  1277                     begin
       
  1278                     inc(h,Hedgehogs[i].Gear^.Health);
       
  1279                     if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
       
  1280                     end;
       
  1281 
       
  1282         // draw ai kill counter for gfAISurvival
       
  1283         if (GameFlags and gfAISurvival) <> 0 then
       
  1284             begin
       
  1285             DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex);
       
  1286             end;
       
  1287 
       
  1288         // if highlighted, draw flag and other contents again to keep their colors
       
  1289         // this approach should be faster than drawing all borders one by one tinted or not
       
  1290         if highlight then
       
  1291             begin
       
  1292             if TeamsCount * 100 > Longword(cScreenHeight) then
       
  1293                 Tint($FF,$FF,$FF,$80)
       
  1294             else Tint($FF, $FF, $FF, $FF);
       
  1295 
       
  1296             // draw name
       
  1297             r.x:= 2;
       
  1298             r.y:= 2;
       
  1299             r.w:= NameTagTex^.w - 4;
       
  1300             r.h:= NameTagTex^.h - 4;
       
  1301             DrawTextureFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex);
       
  1302             // draw flag
       
  1303             r.w:= 22;
       
  1304             r.h:= 15;
       
  1305             DrawTextureFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
       
  1306             end;
       
  1307         end;
       
  1308 if smallScreenOffset <> 0 then
       
  1309     begin
       
  1310     SetScale(cDefaultZoomLevel);
       
  1311     if TeamsCount * 20 > Longword(cScreenHeight) div 5 then
       
  1312         Tint($FF,$FF,$FF,$FF);
       
  1313     end;
       
  1314 end;
       
  1315 
       
  1316 
       
  1317 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
       
  1318 var i, t: LongInt;
       
  1319     r: TSDL_Rect;
       
  1320     tdx, tdy: Double;
       
  1321     s: shortstring;
       
  1322     offsetX, offsetY, screenBottom: LongInt;
       
  1323     VertexBuffer: array [0..3] of TVertex2f;
       
  1324 begin
       
  1325 if (cReducedQuality and rqNoBackground) = 0 then
       
  1326     begin
       
  1327         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
       
  1328         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
       
  1329         offsetY:= 10 * Min(0, -145 - ScreenBottom);
       
  1330         SkyOffset:= offsetY div 35 + cWaveHeight;
       
  1331         HorizontOffset:= SkyOffset;
       
  1332         if ScreenBottom > SkyOffset then
       
  1333             HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20);
       
  1334 
       
  1335         // background
       
  1336         ChangeDepth(RM, cStereo_Sky);
       
  1337         if SuddenDeathDmg then
       
  1338             Tint(SDTint, SDTint, SDTint, $FF);
       
  1339         DrawRepeated(sprSky, sprSkyL, sprSkyR, (WorldDx + LAND_WIDTH div 2) * 3 div 8, SkyOffset);
       
  1340         ChangeDepth(RM, -cStereo_Horizon);
       
  1341         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
       
  1342         if SuddenDeathDmg then
       
  1343             Tint($FF, $FF, $FF, $FF);
       
  1344     end;
       
  1345 
       
  1346 DrawVisualGears(0);
       
  1347 ChangeDepth(RM, -cStereo_MidDistance);
       
  1348 DrawVisualGears(4);
       
  1349 
       
  1350 if (cReducedQuality and rq2DWater) = 0 then
       
  1351     begin
       
  1352         // Waves
       
  1353         DrawWater(255, SkyOffset); 
       
  1354         ChangeDepth(RM, -cStereo_Water_distant);
       
  1355         DrawWaves( 1,  0 - WorldDx div 32, - cWaveHeight + offsetY div 35, 64);
       
  1356         ChangeDepth(RM, -cStereo_Water_distant);
       
  1357         DrawWaves( -1,  25 + WorldDx div 25, - cWaveHeight + offsetY div 38, 48);
       
  1358         ChangeDepth(RM, -cStereo_Water_distant);
       
  1359         DrawWaves( 1,  75 - WorldDx div 19, - cWaveHeight + offsetY div 45, 32);
       
  1360         ChangeDepth(RM, -cStereo_Water_distant);
       
  1361         DrawWaves(-1, 100 + WorldDx div 14, - cWaveHeight + offsetY div 70, 24);
       
  1362     end
       
  1363 else
       
  1364         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
       
  1365 
       
  1366     changeDepth(RM, cStereo_Land);
       
  1367     DrawVisualGears(5);
       
  1368     DrawLand(WorldDx, WorldDy);
       
  1369 
       
  1370     DrawWater(255, 0);
       
  1371 
       
  1372 DrawVisualGears(1);
       
  1373 DrawGears;
       
  1374 DrawVisualGears(6);
       
  1375 
       
  1376 if SuddenDeathDmg then
       
  1377     DrawWater(SDWaterOpacity, 0)
       
  1378 else
       
  1379     DrawWater(WaterOpacity, 0);
       
  1380 
       
  1381     // Waves
       
  1382 ChangeDepth(RM, cStereo_Water_near);
       
  1383 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12);
       
  1384 
       
  1385 if (cReducedQuality and rq2DWater) = 0 then
       
  1386     begin
       
  1387     //DrawWater(WaterOpacity, - offsetY div 40);
       
  1388     ChangeDepth(RM, cStereo_Water_near);
       
  1389     DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8);
       
  1390     if SuddenDeathDmg then
       
  1391         DrawWater(SDWaterOpacity, - offsetY div 20)
       
  1392     else
       
  1393         DrawWater(WaterOpacity, - offsetY div 20);
       
  1394     ChangeDepth(RM, cStereo_Water_near);
       
  1395     DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2);
       
  1396         if SuddenDeathDmg then
       
  1397             DrawWater(SDWaterOpacity, - offsetY div 10)
       
  1398         else
       
  1399             DrawWater(WaterOpacity, - offsetY div 10);
       
  1400         ChangeDepth(RM, cStereo_Water_near);
       
  1401         DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
       
  1402         end
       
  1403     else
       
  1404         DrawWaves(-1, 50, - (cWaveHeight shr 1), 0);
       
  1405 
       
  1406 // everything after this ChangeDepth will be drawn outside the screen
       
  1407 // note: negative parallax gears should last very little for a smooth stereo effect
       
  1408     ChangeDepth(RM, cStereo_Outside);
       
  1409     DrawVisualGears(2);
       
  1410 
       
  1411 // everything after this ResetDepth will be drawn at screen level (depth = 0)
       
  1412 // note: everything that needs to be readable should be on this level
       
  1413     ResetDepth(RM);
       
  1414     DrawVisualGears(3);
       
  1415 
       
  1416 {$WARNINGS OFF}
       
  1417 // Target
       
  1418 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
       
  1419     begin
       
  1420     with PHedgehog(CurrentHedgehog)^ do
       
  1421         begin
       
  1422         if CurAmmoType = amBee then
       
  1423             DrawSpriteRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
       
  1424         else
       
  1425             DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
       
  1426         end
       
  1427     end;
       
  1428 {$WARNINGS ON}
       
  1429 
       
  1430 RenderWorldEdge(Lag);
  1340 
  1431 
  1341 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1432 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1342 SetScale(cDefaultZoomLevel);
  1433 SetScale(cDefaultZoomLevel);
  1343 
  1434 
  1344 // Turn time
  1435 // Turn time
  1386 DrawScreenWidget(@AMWidget);
  1477 DrawScreenWidget(@AMWidget);
  1387 DrawScreenWidget(@pauseButton);
  1478 DrawScreenWidget(@pauseButton);
  1388 DrawScreenWidget(@utilityWidget);
  1479 DrawScreenWidget(@utilityWidget);
  1389 {$ENDIF}
  1480 {$ENDIF}
  1390 
  1481 
  1391 // Teams Healths
  1482 RenderTeamsHealth;
  1392 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
       
  1393     begin
       
  1394     SetScale(1.5);
       
  1395     smallScreenOffset:= cScreenHeight div 6;
       
  1396     if TeamsCount * 20 > Longword(cScreenHeight) div 5 then
       
  1397         Tint($FF,$FF,$FF,$80);
       
  1398     end
       
  1399 else smallScreenOffset:= 0;
       
  1400 for t:= 0 to Pred(TeamsCount) do
       
  1401     with TeamsArray[t]^ do
       
  1402       if TeamHealth > 0 then
       
  1403         begin
       
  1404         h:= 0;
       
  1405         highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
       
  1406 
       
  1407         if highlight then
       
  1408             Tint(Clan^.Color shl 8 or $FF);
       
  1409 
       
  1410          // draw name
       
  1411         DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
       
  1412 
       
  1413         // draw flag
       
  1414         DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
       
  1415 
       
  1416         // draw health bar
       
  1417         r.x:= 0;
       
  1418         r.y:= 0;
       
  1419         r.w:= 2 + TeamHealthBarWidth;
       
  1420         r.h:= HealthTex^.h;
       
  1421         DrawTextureFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
       
  1422 
       
  1423         // draw health bars right border
       
  1424         inc(r.x, cTeamHealthWidth + 2);
       
  1425         r.w:= 3;
       
  1426         DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
       
  1427 
       
  1428         if not highlight and (not hasGone) then
       
  1429             for i:= 0 to cMaxHHIndex do
       
  1430                 if Hedgehogs[i].Gear <> nil then
       
  1431                     begin
       
  1432                     inc(h,Hedgehogs[i].Gear^.Health);
       
  1433                     if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
       
  1434                     end;
       
  1435 
       
  1436         // draw ai kill counter for gfAISurvival
       
  1437         if (GameFlags and gfAISurvival) <> 0 then
       
  1438             begin
       
  1439             DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex);
       
  1440             end;
       
  1441 
       
  1442         // if highlighted, draw flag and other contents again to keep their colors
       
  1443         // this approach should be faster than drawing all borders one by one tinted or not
       
  1444         if highlight then
       
  1445             begin
       
  1446             if TeamsCount * 20 > Longword(cScreenHeight) div 5 then
       
  1447                 Tint($FF,$FF,$FF,$80)
       
  1448             else Tint($FF, $FF, $FF, $FF);
       
  1449 
       
  1450             // draw name
       
  1451             r.x:= 2;
       
  1452             r.y:= 2;
       
  1453             r.w:= NameTagTex^.w - 4;
       
  1454             r.h:= NameTagTex^.h - 4;
       
  1455             DrawTextureFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex);
       
  1456             // draw flag
       
  1457             r.w:= 22;
       
  1458             r.h:= 15;
       
  1459             DrawTextureFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
       
  1460             // draw health bar
       
  1461             r.w:= TeamHealthBarWidth + 1;
       
  1462             r.h:= HealthTex^.h - 4;
       
  1463             DrawTextureFromRect(15, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
       
  1464             if not hasGone and (TeamHealth > 1) then
       
  1465                 begin
       
  1466                 Tint(Clan^.Color shl 8 or $FF);
       
  1467                 for i:= 0 to cMaxHHIndex do
       
  1468                     if Hedgehogs[i].Gear <> nil then
       
  1469                         begin
       
  1470                         inc(h,Hedgehogs[i].Gear^.Health);
       
  1471                         if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
       
  1472                         end;
       
  1473                 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then
       
  1474                     Tint($FF,$FF,$FF,$80)
       
  1475                 else Tint($FF, $FF, $FF, $FF);
       
  1476                 end;
       
  1477             end;
       
  1478         end;
       
  1479 if smallScreenOffset <> 0 then
       
  1480     begin
       
  1481     SetScale(cDefaultZoomLevel);
       
  1482     if TeamsCount * 20 > Longword(cScreenHeight) div 5 then
       
  1483         Tint($FF,$FF,$FF,$FF);
       
  1484     end;
       
  1485 
  1483 
  1486 // Lag alert
  1484 // Lag alert
  1487 if isInLag then
  1485 if isInLag then
  1488     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
  1486     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
  1489 
  1487