hedgewars/uWorld.pas
changeset 14418 f9a3cfdec1df
parent 14416 f39d34d78028
child 14430 85008b73e118
equal deleted inserted replaced
14417:694c96fb3a06 14418:f9a3cfdec1df
  1198 var i, t: LongInt;
  1198 var i, t: LongInt;
  1199     spr: TSprite;
  1199     spr: TSprite;
  1200     r: TSDL_Rect;
  1200     r: TSDL_Rect;
  1201     s: shortstring;
  1201     s: shortstring;
  1202     offsetX, offsetY, screenBottom: LongInt;
  1202     offsetX, offsetY, screenBottom: LongInt;
  1203     replicateToLeft, replicateToRight, tmp: boolean;
  1203     replicateToLeft, replicateToRight, tmp, notHiddenByCinematic: boolean;
  1204 {$IFDEF USE_VIDEO_RECORDING}
  1204 {$IFDEF USE_VIDEO_RECORDING}
  1205     a: Byte;
  1205     a: Byte;
  1206 {$ENDIF}
  1206 {$ENDIF}
  1207 begin
  1207 begin
  1208 if WorldEdge <> weWrap then
  1208 if WorldEdge <> weWrap then
  1447 RenderWorldEdge();
  1447 RenderWorldEdge();
  1448 
  1448 
  1449 // This scale is used to keep the various widgets at the same dimension at all zoom levels
  1449 // This scale is used to keep the various widgets at the same dimension at all zoom levels
  1450 SetScale(cDefaultZoomLevel);
  1450 SetScale(cDefaultZoomLevel);
  1451 
  1451 
  1452 // Cinematic Mode: Effects
  1452 notHiddenByCinematic:= true;
       
  1453 // Cinematic Mode: Determine effects and state
  1453 if CinematicScript or (InCinematicMode and autoCameraOn
  1454 if CinematicScript or (InCinematicMode and autoCameraOn
  1454     and ((CurrentHedgehog = nil) or CurrentHedgehog^.Team^.ExtDriven
  1455     and ((CurrentHedgehog = nil) or CurrentHedgehog^.Team^.ExtDriven
  1455     or (CurrentHedgehog^.BotLevel <> 0) or (GameType = gmtDemo))) then
  1456     or (CurrentHedgehog^.BotLevel <> 0) or (GameType = gmtDemo))) then
  1456     begin
  1457     begin
  1457     if CinematicSteps < 300 then
  1458     if CinematicSteps < 300 then
  1458         begin
  1459         begin
  1459         inc(CinematicSteps, Lag);
  1460         inc(CinematicSteps, Lag);
  1460         if CinematicSteps > 300 then
  1461         if CinematicSteps > 300 then
  1461         CinematicSteps:= 300;
  1462             begin
       
  1463             CinematicSteps:= 300;
       
  1464             notHiddenByCinematic:= false;
       
  1465             end;
  1462         end;
  1466         end;
  1463     end
  1467     end
  1464 else if CinematicSteps > 0 then
  1468 else if CinematicSteps > 0 then
  1465     begin
  1469     begin
  1466     dec(CinematicSteps, Lag);
  1470     dec(CinematicSteps, Lag);
  1467     if CinematicSteps < 0 then
  1471     if CinematicSteps < 0 then
  1468         CinematicSteps:= 0;
  1472         CinematicSteps:= 0;
  1469     end;
  1473     end;
  1470 
  1474 
  1471 // Cinematic Mode: Render black bars
       
  1472 if CinematicSteps > 0 then
       
  1473     begin
       
  1474     r.x:= ViewLeftX;
       
  1475     r.w:= ViewWidth;
       
  1476     r.y:= ViewTopY;
       
  1477     CinematicBarH:= (ViewHeight * CinematicSteps) div 2048;
       
  1478     r.h:= CinematicBarH;
       
  1479     DrawRect(r, 0, 0, 0, $FF, true);
       
  1480     r.y:= ViewBottomY - r.h;
       
  1481     DrawRect(r, 0, 0, 0, $FF, true);
       
  1482     end;
       
  1483 
       
  1484 
       
  1485 // Turn time
  1475 // Turn time
  1486 if UIDisplay <> uiNone then
  1476 if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
  1487     begin
  1477     begin
  1488 {$IFDEF USE_TOUCH_INTERFACE}
  1478 {$IFDEF USE_TOUCH_INTERFACE}
  1489     offsetX:= cScreenHeight - 13;
  1479     offsetX:= cScreenHeight - 13;
  1490 {$ELSE}
  1480 {$ELSE}
  1491     offsetX:= 48;
  1481     offsetX:= 48;
  1520             i:= i div 10
  1510             i:= i div 10
  1521             end;
  1511             end;
  1522         DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
  1512         DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
  1523         end;
  1513         end;
  1524 
  1514 
  1525 // Captions
  1515     end;
  1526     DrawCaptions
       
  1527     end;
       
  1528 
       
  1529 {$IFDEF USE_TOUCH_INTERFACE}
       
  1530 // Draw buttons Related to the Touch interface
       
  1531 DrawScreenWidget(@arrowLeft);
       
  1532 DrawScreenWidget(@arrowRight);
       
  1533 DrawScreenWidget(@arrowUp);
       
  1534 DrawScreenWidget(@arrowDown);
       
  1535 
       
  1536 DrawScreenWidget(@fireButton);
       
  1537 DrawScreenWidget(@jumpWidget);
       
  1538 DrawScreenWidget(@AMWidget);
       
  1539 DrawScreenWidget(@pauseButton);
       
  1540 DrawScreenWidget(@utilityWidget);
       
  1541 {$ENDIF}
       
  1542 
  1516 
  1543 // Team bars
  1517 // Team bars
  1544 if UIDisplay = uiAll then
  1518 if (UIDisplay = uiAll) and (notHiddenByCinematic) then
  1545     RenderTeamsHealth;
  1519     RenderTeamsHealth;
  1546 
  1520 
  1547 // Lag alert
       
  1548 if isInLag then
       
  1549     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
       
  1550 
       
  1551 // Wind bar
  1521 // Wind bar
  1552 if UIDisplay <> uiNone then
  1522 if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
  1553     begin
  1523     begin
  1554 {$IFDEF USE_TOUCH_INTERFACE}
  1524 {$IFDEF USE_TOUCH_INTERFACE}
  1555     offsetX:= cScreenHeight - 13;
  1525     offsetX:= cScreenHeight - 13;
  1556     offsetY:= (cScreenWidth shr 1) + 74;
  1526     offsetY:= (cScreenWidth shr 1) + 74;
  1557 {$ELSE}
  1527 {$ELSE}
  1581         DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
  1551         DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
  1582         end
  1552         end
  1583     end;
  1553     end;
  1584 
  1554 
  1585 // Indicators for global effects (extra damage, low gravity)
  1555 // Indicators for global effects (extra damage, low gravity)
  1586 if UIDisplay <> uiNone then
  1556 if (UIDisplay <> uiNone) and (notHiddenByCinematic) then
  1587     begin
  1557     begin
  1588 {$IFDEF USE_TOUCH_INTERFACE}
  1558 {$IFDEF USE_TOUCH_INTERFACE}
  1589     offsetX:= (cScreenWidth shr 1) - 95;
  1559     offsetX:= (cScreenWidth shr 1) - 95;
  1590     offsetY:= cScreenHeight - 21;
  1560     offsetY:= cScreenHeight - 21;
  1591 {$ELSE}
  1561 {$ELSE}
  1607         begin
  1577         begin
  1608             DrawTextureF(ropeIconTex, 1, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, 0, 1, 32, 32);
  1578             DrawTextureF(ropeIconTex, 1, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, 0, 1, 32, 32);
  1609             DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.90, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, ord(amLowGravity) - 1, 1, 32, 32);
  1579             DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.90, (cScreenWidth shr 1) - offsetX, cScreenHeight - offsetY, ord(amLowGravity) - 1, 1, 32, 32);
  1610         end;
  1580         end;
  1611     end;
  1581     end;
       
  1582 
       
  1583 // Cinematic Mode: Render black bars
       
  1584 if CinematicSteps > 0 then
       
  1585     begin
       
  1586     r.x:= ViewLeftX;
       
  1587     r.w:= ViewWidth;
       
  1588     r.y:= ViewTopY;
       
  1589     CinematicBarH:= (ViewHeight * CinematicSteps) div 2048;
       
  1590     r.h:= CinematicBarH;
       
  1591     DrawRect(r, 0, 0, 0, $FF, true);
       
  1592     r.y:= ViewBottomY - r.h;
       
  1593     DrawRect(r, 0, 0, 0, $FF, true);
       
  1594     end;
       
  1595 
       
  1596 // Touchscreen interface widgets
       
  1597 {$IFDEF USE_TOUCH_INTERFACE}
       
  1598 DrawScreenWidget(@arrowLeft);
       
  1599 DrawScreenWidget(@arrowRight);
       
  1600 DrawScreenWidget(@arrowUp);
       
  1601 DrawScreenWidget(@arrowDown);
       
  1602 
       
  1603 DrawScreenWidget(@fireButton);
       
  1604 DrawScreenWidget(@jumpWidget);
       
  1605 DrawScreenWidget(@AMWidget);
       
  1606 DrawScreenWidget(@utilityWidget);
       
  1607 DrawScreenWidget(@pauseButton);
       
  1608 {$ENDIF}
       
  1609 
       
  1610 // Captions
       
  1611 if UIDisplay <> uiNone then
       
  1612     DrawCaptions;
       
  1613 
       
  1614 // Lag alert
       
  1615 if isInLag then
       
  1616     DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
  1612 
  1617 
  1613 // Chat
  1618 // Chat
  1614 DrawChat;
  1619 DrawChat;
  1615 
  1620 
  1616 
  1621