hedgewars/uWorld.pas
changeset 10358 d22515d9624d
parent 10332 194f003b41a4
child 10359 744f1151c707
equal deleted inserted replaced
10357:86a823dd1d23 10358:d22515d9624d
  1238     r: TSDL_Rect;
  1238     r: TSDL_Rect;
  1239     tdx, tdy: Double;
  1239     tdx, tdy: Double;
  1240     s: shortstring;
  1240     s: shortstring;
  1241     offsetX, offsetY, screenBottom: LongInt;
  1241     offsetX, offsetY, screenBottom: LongInt;
  1242     VertexBuffer: array [0..3] of TVertex2f;
  1242     VertexBuffer: array [0..3] of TVertex2f;
  1243 begin
  1243     replicateToLeft, replicateToRight: boolean;
       
  1244 begin
       
  1245 if WorldEdge <> weWrap then
       
  1246 begin
       
  1247 replicateToLeft := false;
       
  1248 replicateToRight:= false;
       
  1249 end
       
  1250 else
       
  1251 begin
       
  1252 replicateToLeft := (leftX  + WorldDx > ViewLeftX);
       
  1253 replicateToRight:= (rightX + WorldDx < ViewRightX);
       
  1254 end;
       
  1255 
  1244 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1256 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1245 
  1257 
  1246 // note: offsetY is negative!
  1258 // note: offsetY is negative!
  1247 offsetY:= 10 *  Min(0, -145 - ScreenBottom); // TODO limit this in the other direction too
  1259 offsetY:= 10 *  Min(0, -145 - ScreenBottom); // TODO limit this in the other direction too
  1248 
  1260 
  1286     DrawWaves(-1, 100, - cWaveHeight div 2, - cWaveHeight div 2, 0);
  1298     DrawWaves(-1, 100, - cWaveHeight div 2, - cWaveHeight div 2, 0);
  1287 
  1299 
  1288     changeDepth(RM, cStereo_Land);
  1300     changeDepth(RM, cStereo_Land);
  1289     DrawVisualGears(5);
  1301     DrawVisualGears(5);
  1290     DrawLand(WorldDx, WorldDy);
  1302     DrawLand(WorldDx, WorldDy);
  1291     if WorldEdge = weWrap then
  1303 
  1292         begin
  1304     if replicateToLeft then
  1293         DrawLand(WorldDx - playWidth, WorldDy);
  1305         DrawLand(WorldDx - playWidth, WorldDy);
       
  1306 
       
  1307     if replicateToRight then
  1294         DrawLand(WorldDx + playWidth, WorldDy);
  1308         DrawLand(WorldDx + playWidth, WorldDy);
  1295         end;
       
  1296 
  1309 
  1297     DrawWater(255, 0, 0);
  1310     DrawWater(255, 0, 0);
  1298 
  1311 
  1299 (*
  1312 (*
  1300 // Attack bar
  1313 // Attack bar
  1318                             i)
  1331                             i)
  1319                 end
  1332                 end
  1320         end;
  1333         end;
  1321 *)
  1334 *)
  1322 
  1335 
  1323 
  1336 if replicateToLeft then
  1324 if WorldEdge = weWrap then
       
  1325     begin
  1337     begin
  1326     // remember original value
  1338     // remember original value
  1327     i:= WorldDx;
  1339     i:= WorldDx;
  1328     WorldDx:= i - playWidth;
  1340     WorldDx:= i - playWidth;
  1329     DrawVisualGears(1);
  1341     DrawVisualGears(1);
  1330     DrawGears();
  1342     DrawGears();
  1331     DrawVisualGears(6);
  1343     DrawVisualGears(6);
       
  1344     // reset to original value
       
  1345     WorldDx:= i;
       
  1346     end;
       
  1347 
       
  1348 if replicateToRight then
       
  1349     begin
       
  1350     // remember original value
       
  1351     i:= WorldDx;
  1332     WorldDx:= i + playWidth;
  1352     WorldDx:= i + playWidth;
  1333     DrawVisualGears(1);
  1353     DrawVisualGears(1);
  1334     DrawGears();
  1354     DrawGears();
  1335     DrawVisualGears(6);
  1355     DrawVisualGears(6);
  1336     // reset to original value
  1356     // reset to original value
  1373         DrawWaves(-1, 50, cWaveHeight div 2, cWaveHeight div 2, 0);
  1393         DrawWaves(-1, 50, cWaveHeight div 2, cWaveHeight div 2, 0);
  1374 
  1394 
  1375 // everything after this ChangeDepth will be drawn outside the screen
  1395 // everything after this ChangeDepth will be drawn outside the screen
  1376 // note: negative parallax gears should last very little for a smooth stereo effect
  1396 // note: negative parallax gears should last very little for a smooth stereo effect
  1377     ChangeDepth(RM, cStereo_Outside);
  1397     ChangeDepth(RM, cStereo_Outside);
  1378     if WorldEdge = weWrap then
  1398 
       
  1399     if replicateToLeft then
  1379         begin
  1400         begin
  1380         // remember original value
  1401         // remember original value
  1381         i:= WorldDx;
  1402         i:= WorldDx;
  1382         WorldDx:= i - playWidth;
  1403         WorldDx:= i - playWidth;
  1383         DrawVisualGears(2);
  1404         DrawVisualGears(2);
       
  1405         // reset to original value
       
  1406         WorldDx:= i;
       
  1407         end;
       
  1408 
       
  1409     if replicateToRight then
       
  1410         begin
       
  1411         // remember original value
       
  1412         i:= WorldDx;
  1384         WorldDx:= i + playWidth;
  1413         WorldDx:= i + playWidth;
  1385         DrawVisualGears(2);
  1414         DrawVisualGears(2);
  1386         // reset to original value
  1415         // reset to original value
  1387         WorldDx:= i;
  1416         WorldDx:= i;
  1388         end;
  1417         end;
       
  1418 
  1389     DrawVisualGears(2);
  1419     DrawVisualGears(2);
  1390 
  1420 
  1391 // everything after this ResetDepth will be drawn at screen level (depth = 0)
  1421 // everything after this ResetDepth will be drawn at screen level (depth = 0)
  1392 // note: everything that needs to be readable should be on this level
  1422 // note: everything that needs to be readable should be on this level
  1393     ResetDepth(RM);
  1423     ResetDepth(RM);
  1394     if WorldEdge = weWrap then
  1424 
       
  1425     if replicateToLeft then
  1395         begin
  1426         begin
  1396         // remember original value
  1427         // remember original value
  1397         i:= WorldDx;
  1428         i:= WorldDx;
  1398         WorldDx:= i - playWidth;
  1429         WorldDx:= i - playWidth;
  1399         DrawVisualGears(3);
  1430         DrawVisualGears(3);
       
  1431         // reset to original value
       
  1432         WorldDx:= i;
       
  1433         end;
       
  1434 
       
  1435     if replicateToRight then
       
  1436         begin
       
  1437         // remember original value
       
  1438         i:= WorldDx;
  1400         WorldDx:= i + playWidth;
  1439         WorldDx:= i + playWidth;
  1401         DrawVisualGears(3);
  1440         DrawVisualGears(3);
  1402         // reset to original value
  1441         // reset to original value
  1403         WorldDx:= i;
  1442         WorldDx:= i;
  1404         end;
  1443         end;
       
  1444 
  1405     DrawVisualGears(3);
  1445     DrawVisualGears(3);
  1406 
  1446 
  1407 {$WARNINGS OFF}
  1447 {$WARNINGS OFF}
  1408 // Target
  1448 // Target
  1409 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then
  1449 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then