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; |
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); |
1257 htex:= GenericHealthTexture |
1257 htex:= GenericHealthTexture |
1258 end |
1258 end |
1259 else |
1259 else |
1260 htex:= Clan^.HealthTex; |
1260 htex:= Clan^.HealthTex; |
1261 |
1261 |
1262 // draw name |
1262 // draw owner |
|
1263 if OwnerTex <> nil then |
|
1264 DrawTexture(-OwnerTex^.w - NameTagTex^.w - 18, cScreenHeight + DrawHealthY + smallScreenOffset, OwnerTex); |
|
1265 |
|
1266 // draw name |
1263 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex); |
1267 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex); |
1264 |
1268 |
1265 // draw flag |
1269 // draw flag |
1266 DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex); |
1270 DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex); |
|
1271 |
|
1272 TeamHealthBarWidth:= cTeamHealthWidth * TeamHealthBarHealth div MaxTeamHealth; |
1267 |
1273 |
1268 // draw health bar |
1274 // draw health bar |
1269 r.x:= 0; |
1275 r.x:= 0; |
1270 r.y:= 0; |
1276 r.y:= 0; |
1271 r.w:= 2 + TeamHealthBarWidth; |
1277 r.w:= 2 + TeamHealthBarWidth; |
1275 // draw health bars right border |
1281 // draw health bars right border |
1276 inc(r.x, cTeamHealthWidth + 2); |
1282 inc(r.x, cTeamHealthWidth + 2); |
1277 r.w:= 3; |
1283 r.w:= 3; |
1278 DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, htex); |
1284 DrawTextureFromRect(TeamHealthBarWidth + 15, cScreenHeight + DrawHealthY + smallScreenOffset, @r, htex); |
1279 |
1285 |
|
1286 h:= 0; |
1280 if not hasGone then |
1287 if not hasGone then |
1281 for i:= 0 to cMaxHHIndex do |
1288 for i:= 0 to cMaxHHIndex do |
1282 if Hedgehogs[i].Gear <> nil then |
1289 begin |
1283 begin |
1290 inc(h, Hedgehogs[i].HealthBarHealth); |
1284 inc(h,Hedgehogs[i].Gear^.Health); |
1291 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); |
1292 DrawTexture(15 + h * TeamHealthBarWidth div TeamHealthBarHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture); |
1286 end; |
1293 end; |
1287 |
1294 |
1288 // draw ai kill counter for gfAISurvival |
1295 // draw ai kill counter for gfAISurvival |
1289 if (GameFlags and gfAISurvival) <> 0 then |
1296 if (GameFlags and gfAISurvival) <> 0 then |
1290 begin |
1297 begin |
1291 DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex); |
1298 DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset, AIKillsTex); |
1437 |
1444 |
1438 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1445 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1439 SetScale(cDefaultZoomLevel); |
1446 SetScale(cDefaultZoomLevel); |
1440 |
1447 |
1441 // Turn time |
1448 // Turn time |
|
1449 if UIDisplay <> uiNone then |
|
1450 begin |
1442 {$IFDEF USE_TOUCH_INTERFACE} |
1451 {$IFDEF USE_TOUCH_INTERFACE} |
1443 offsetX:= cScreenHeight - 13; |
1452 offsetX:= cScreenHeight - 13; |
1444 {$ELSE} |
1453 {$ELSE} |
1445 offsetX:= 48; |
1454 offsetX:= 48; |
1446 {$ENDIF} |
1455 {$ENDIF} |
1447 offsetY:= cOffsetY; |
1456 offsetY:= cOffsetY; |
1448 if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then |
1457 if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then |
1449 begin |
1458 begin |
1450 if ReadyTimeLeft <> 0 then |
1459 if ReadyTimeLeft <> 0 then |
1451 i:= Succ(Pred(ReadyTimeLeft) div 1000) |
1460 i:= Succ(Pred(ReadyTimeLeft) div 1000) |
1452 else |
1461 else |
1453 i:= Succ(Pred(TurnTimeLeft) div 1000); |
1462 i:= Succ(Pred(TurnTimeLeft) div 1000); |
1454 |
1463 |
1455 if i>99 then |
1464 if i>99 then |
1456 t:= 112 |
1465 t:= 112 |
1457 else if i>9 then |
1466 else if i>9 then |
1458 t:= 96 |
1467 t:= 96 |
1459 else |
1468 else |
1460 t:= 80; |
1469 t:= 80; |
1461 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
1470 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
1462 while i > 0 do |
1471 while i > 0 do |
1463 begin |
1472 begin |
1464 dec(t, 32); |
1473 dec(t, 32); |
1465 DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
1474 DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
1466 i:= i div 10 |
1475 i:= i div 10 |
|
1476 end; |
|
1477 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
1467 end; |
1478 end; |
1468 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
|
1469 end; |
|
1470 |
1479 |
1471 // Captions |
1480 // Captions |
1472 DrawCaptions; |
1481 DrawCaptions |
|
1482 end; |
1473 |
1483 |
1474 {$IFDEF USE_TOUCH_INTERFACE} |
1484 {$IFDEF USE_TOUCH_INTERFACE} |
1475 // Draw buttons Related to the Touch interface |
1485 // Draw buttons Related to the Touch interface |
1476 DrawScreenWidget(@arrowLeft); |
1486 DrawScreenWidget(@arrowLeft); |
1477 DrawScreenWidget(@arrowRight); |
1487 DrawScreenWidget(@arrowRight); |
1483 DrawScreenWidget(@AMWidget); |
1493 DrawScreenWidget(@AMWidget); |
1484 DrawScreenWidget(@pauseButton); |
1494 DrawScreenWidget(@pauseButton); |
1485 DrawScreenWidget(@utilityWidget); |
1495 DrawScreenWidget(@utilityWidget); |
1486 {$ENDIF} |
1496 {$ENDIF} |
1487 |
1497 |
1488 RenderTeamsHealth; |
1498 if UIDisplay = uiAll then |
|
1499 RenderTeamsHealth; |
1489 |
1500 |
1490 // Lag alert |
1501 // Lag alert |
1491 if isInLag then |
1502 if isInLag then |
1492 DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
1503 DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
1493 |
1504 |
1494 // Wind bar |
1505 // Wind bar |
|
1506 if UIDisplay <> uiNone then |
|
1507 begin |
1495 {$IFDEF USE_TOUCH_INTERFACE} |
1508 {$IFDEF USE_TOUCH_INTERFACE} |
1496 offsetX:= cScreenHeight - 13; |
1509 offsetX:= cScreenHeight - 13; |
1497 offsetY:= (cScreenWidth shr 1) + 74; |
1510 offsetY:= (cScreenWidth shr 1) + 74; |
1498 {$ELSE} |
1511 {$ELSE} |
1499 offsetX:= 30; |
1512 offsetX:= 30; |
1511 DrawSpriteFromRect(sprWindR, r, (cScreenWidth shr 1) - offsetY + 77, cScreenHeight - offsetX + 2, 13, 0); |
1524 DrawSpriteFromRect(sprWindR, r, (cScreenWidth shr 1) - offsetY + 77, cScreenHeight - offsetX + 2, 13, 0); |
1512 end |
1525 end |
1513 else |
1526 else |
1514 if WindBarWidth < 0 then |
1527 if WindBarWidth < 0 then |
1515 begin |
1528 begin |
1516 {$WARNINGS OFF} |
1529 {$WARNINGS OFF} |
1517 r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8; |
1530 r.x:= (Longword(WindBarWidth) + RealTicks shr 6) mod 8; |
1518 {$WARNINGS ON} |
1531 {$WARNINGS ON} |
1519 r.y:= 0; |
1532 r.y:= 0; |
1520 r.w:= - WindBarWidth; |
1533 r.w:= - WindBarWidth; |
1521 r.h:= 13; |
1534 r.h:= 13; |
1522 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1535 DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0); |
1523 end; |
1536 end |
|
1537 end; |
1524 |
1538 |
1525 // AmmoMenu |
1539 // AmmoMenu |
1526 if bShowAmmoMenu and ((AMState = AMHidden) or (AMState = AMHiding)) then |
1540 if bShowAmmoMenu and ((AMState = AMHidden) or (AMState = AMHiding)) then |
1527 begin |
1541 begin |
1528 if (AMState = AMHidden) then |
1542 if (AMState = AMHidden) then |
1745 |
1759 |
1746 var PrevSentPointTime: LongWord = 0; |
1760 var PrevSentPointTime: LongWord = 0; |
1747 |
1761 |
1748 procedure MoveCamera; |
1762 procedure MoveCamera; |
1749 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt; |
1763 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt; |
|
1764 inbtwnTrgtAttks: Boolean; |
1750 begin |
1765 begin |
1751 {$IFNDEF MOBILE} |
1766 {$IFNDEF MOBILE} |
1752 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then |
1767 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then |
1753 uCursor.updatePosition(); |
1768 uCursor.updatePosition(); |
1754 {$ENDIF} |
1769 {$ENDIF} |
1755 z:= round(200/zoom); |
1770 z:= round(200/zoom); |
1756 if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then |
1771 inbtwnTrgtAttks := (CurrentHedgehog <> nil) and ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) <> 0) and ((GameFlags and gfInfAttack) <> 0); |
|
1772 if autoCameraOn and not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and not inbtwnTrgtAttks then |
1757 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1773 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1758 begin |
1774 begin |
1759 FollowGear:= nil; |
1775 FollowGear:= nil; |
1760 prevPoint:= CursorPoint; |
1776 prevPoint:= CursorPoint; |
1761 exit |
1777 exit |