hedgewars/uWorld.pas
changeset 13637 28e4a9db4690
parent 13636 fc8c8910a281
child 13638 039ec6dd304b
equal deleted inserted replaced
13636:fc8c8910a281 13637:28e4a9db4690
  1161         untint;
  1161         untint;
  1162     end;
  1162     end;
  1163 VisibleTeamsCount:= v;
  1163 VisibleTeamsCount:= v;
  1164 end;
  1164 end;
  1165 
  1165 
       
  1166 procedure RenderAttackBar();
       
  1167 var i: LongInt;
       
  1168     tdx, tdy: Double;
       
  1169 begin
       
  1170     if CurrentTeam <> nil then
       
  1171         case AttackBar of
       
  1172         2: with CurrentHedgehog^ do
       
  1173                 begin
       
  1174                 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
       
  1175                 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
       
  1176                 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
       
  1177                     DrawSprite(sprPower,
       
  1178                             hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
       
  1179                             hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
       
  1180                             i)
       
  1181                 end;
       
  1182         end;
       
  1183 end;
  1166 
  1184 
  1167 var preShiftWorldDx: LongInt;
  1185 var preShiftWorldDx: LongInt;
  1168 
  1186 
  1169 procedure ShiftWorld(Dir: LongInt); inline;
  1187 procedure ShiftWorld(Dir: LongInt); inline;
  1170 begin
  1188 begin
  1180 
  1198 
  1181 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
  1199 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
  1182 var i, t: LongInt;
  1200 var i, t: LongInt;
  1183     spr: TSprite;
  1201     spr: TSprite;
  1184     r: TSDL_Rect;
  1202     r: TSDL_Rect;
  1185     tdx, tdy: Double;
       
  1186     s: shortstring;
  1203     s: shortstring;
  1187     offsetX, offsetY, screenBottom: LongInt;
  1204     offsetX, offsetY, screenBottom: LongInt;
  1188     replicateToLeft, replicateToRight, tmp: boolean;
  1205     replicateToLeft, replicateToRight, tmp: boolean;
  1189 {$IFDEF USE_VIDEO_RECORDING}
  1206 {$IFDEF USE_VIDEO_RECORDING}
  1190     a: Byte;
  1207     a: Byte;
  1262     DrawLand(WorldDx, WorldDy);
  1279     DrawLand(WorldDx, WorldDy);
  1263     UnshiftWorld();
  1280     UnshiftWorld();
  1264     end;
  1281     end;
  1265 
  1282 
  1266 DrawWater(255, 0, 0);
  1283 DrawWater(255, 0, 0);
  1267 
       
  1268 (*
       
  1269 // Attack bar
       
  1270     if CurrentTeam <> nil then
       
  1271         case AttackBar of
       
  1272         //1: begin
       
  1273         //r:= StuffPoz[sPowerBar];
       
  1274         //{$WARNINGS OFF}
       
  1275         //r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor;
       
  1276         //{$WARNINGS ON}
       
  1277         //DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
       
  1278         //end;
       
  1279         2: with CurrentHedgehog^ do
       
  1280                 begin
       
  1281                 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
       
  1282                 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
       
  1283                 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
       
  1284                     DrawSprite(sprPower,
       
  1285                             hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
       
  1286                             hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
       
  1287                             i)
       
  1288                 end
       
  1289         end;
       
  1290 *)
       
  1291 
  1284 
  1292 tmp:= bShowFinger;
  1285 tmp:= bShowFinger;
  1293 bShowFinger:= false;
  1286 bShowFinger:= false;
  1294 
  1287 
  1295 if replicateToLeft then
  1288 if replicateToLeft then
  1428 
  1421 
  1429         DrawSpriteRotatedF(spr, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
  1422         DrawSpriteRotatedF(spr, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
  1430         end;
  1423         end;
  1431     end;
  1424     end;
  1432 
  1425 
       
  1426 // Attack bar
       
  1427 if replicateToLeft then
       
  1428     begin
       
  1429     ShiftWorld(-1);
       
  1430     RenderAttackBar();
       
  1431     UnshiftWorld();
       
  1432     end;
       
  1433 
       
  1434 if replicateToRight then
       
  1435     begin
       
  1436     ShiftWorld(1);
       
  1437     RenderAttackBar();
       
  1438     UnshiftWorld();
       
  1439     end;
       
  1440 
       
  1441 RenderAttackBar();
       
  1442 
  1433 RenderWorldEdge();
  1443 RenderWorldEdge();
  1434 
  1444 
  1435 // 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
  1436 SetScale(cDefaultZoomLevel);
  1446 SetScale(cDefaultZoomLevel);
  1437 
  1447 
  1750     DrawCircleFilled(-(cScreenWidth shr 1) + 30, 35, 10, $FF, $00, $00, a);
  1760     DrawCircleFilled(-(cScreenWidth shr 1) + 30, 35, 10, $FF, $00, $00, a);
  1751     end;
  1761     end;
  1752 {$ENDIF}
  1762 {$ENDIF}
  1753 
  1763 
  1754 SetScale(zoom);
  1764 SetScale(zoom);
  1755 
       
  1756 // Attack bar
       
  1757     if CurrentTeam <> nil then
       
  1758         case AttackBar of
       
  1759 (*        1: begin
       
  1760         r:= StuffPoz[sPowerBar];
       
  1761         {$WARNINGS OFF}
       
  1762         r.w:= (CurrentHedgehog^.Gear^.Power * 256) div cPowerDivisor;
       
  1763         {$WARNINGS ON}
       
  1764         DrawSpriteFromRect(r, cScreenWidth - 272, cScreenHeight - 48, 16, 0, Surface);
       
  1765         end;*)
       
  1766         2: with CurrentHedgehog^ do
       
  1767                 begin
       
  1768                 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle);
       
  1769                 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle);
       
  1770                 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do
       
  1771                     DrawSprite(sprPower,
       
  1772                             hwRound(Gear^.X) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + LongInt(round(WorldDx + tdx * (24 + i * 2))) - 16,
       
  1773                             hwRound(Gear^.Y) + GetLaunchY(CurAmmoType, Gear^.Angle) + LongInt(round(WorldDy + tdy * (24 + i * 2))) - 16,
       
  1774                             i)
       
  1775                 end
       
  1776         end;
       
  1777 
       
  1778 
  1765 
  1779 // Cursor
  1766 // Cursor
  1780 if isCursorVisible and (not bShowAmmoMenu) then
  1767 if isCursorVisible and (not bShowAmmoMenu) then
  1781     begin
  1768     begin
  1782     if not CurrentTeam^.ExtDriven then TargetCursorPoint:= CursorPoint;
  1769     if not CurrentTeam^.ExtDriven then TargetCursorPoint:= CursorPoint;