1263 end; |
1263 end; |
1264 |
1264 |
1265 |
1265 |
1266 var preShiftWorldDx: LongInt; |
1266 var preShiftWorldDx: LongInt; |
1267 |
1267 |
1268 procedure ShiftWorld(Dir: LongInt; Flip: Boolean); |
1268 procedure ShiftWorld(Dir: LongInt); inline; |
1269 begin |
1269 begin |
1270 preShiftWorldDx:= WorldDx; |
1270 preShiftWorldDx:= WorldDx; |
1271 |
1271 WorldDx:= WorldDx + Dir * LongInt(playWidth); |
1272 if Flip then |
1272 |
1273 begin |
1273 end; |
1274 WorldDx:= -WorldDx - LongInt(playWidth) - Dir * LongInt(playWidth); |
1274 |
1275 openglPushMatrix(); |
1275 procedure UnshiftWorld(); inline; |
1276 openglScalef(-1, 1, 1); |
|
1277 end |
|
1278 else |
|
1279 WorldDx:= WorldDx + Dir * LongInt(playWidth); |
|
1280 |
|
1281 end; |
|
1282 |
|
1283 procedure UnshiftWorld(Dir: LongInt; Flip: Boolean); |
|
1284 begin |
1276 begin |
1285 WorldDx:= preShiftWorldDx; |
1277 WorldDx:= preShiftWorldDx; |
1286 |
|
1287 if Flip then |
|
1288 openglPopMatrix(); |
|
1289 |
|
1290 end; |
1278 end; |
1291 |
1279 |
1292 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
1280 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
1293 var i, t: LongInt; |
1281 var i, t: LongInt; |
1294 r: TSDL_Rect; |
1282 r: TSDL_Rect; |
1295 tdx, tdy: Double; |
1283 tdx, tdy: Double; |
1296 s: shortstring; |
1284 s: shortstring; |
1297 offsetX, offsetY, screenBottom: LongInt; |
1285 offsetX, offsetY, screenBottom: LongInt; |
1298 VertexBuffer: array [0..3] of TVertex2f; |
1286 VertexBuffer: array [0..3] of TVertex2f; |
1299 replicateToLeft, replicateToRight, tmp, flip: boolean; |
1287 replicateToLeft, replicateToRight, tmp: boolean; |
1300 begin |
1288 begin |
1301 if (WorldEdge <> weWrap) {and (WorldEdge <> weBounce)} then |
1289 if WorldEdge <> weWrap then |
1302 begin |
1290 begin |
1303 replicateToLeft := false; |
1291 replicateToLeft := false; |
1304 replicateToRight:= false; |
1292 replicateToRight:= false; |
1305 flip:= false; |
|
1306 end |
1293 end |
1307 else |
1294 else |
1308 begin |
1295 begin |
1309 replicateToLeft := (LongInt(leftX) + WorldDx > ViewLeftX); |
1296 replicateToLeft := (LongInt(leftX) + WorldDx > ViewLeftX); |
1310 replicateToRight:= (LongInt(rightX) + WorldDx < ViewRightX); |
1297 replicateToRight:= (LongInt(rightX) + WorldDx < ViewRightX); |
1311 flip:= (WorldEdge = weBounce); |
|
1312 end; |
1298 end; |
1313 |
1299 |
1314 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1300 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1315 |
1301 |
1316 // note: offsetY is negative! |
1302 // note: offsetY is negative! |
1359 DrawVisualGears(5); |
1345 DrawVisualGears(5); |
1360 DrawLand(WorldDx, WorldDy); |
1346 DrawLand(WorldDx, WorldDy); |
1361 |
1347 |
1362 if replicateToLeft then |
1348 if replicateToLeft then |
1363 begin |
1349 begin |
1364 ShiftWorld(-1, flip); |
1350 ShiftWorld(-1); |
1365 DrawLand(WorldDx, WorldDy); |
1351 DrawLand(WorldDx, WorldDy); |
1366 UnshiftWorld(-1, flip); |
1352 UnshiftWorld(); |
1367 end; |
1353 end; |
1368 |
1354 |
1369 if replicateToRight then |
1355 if replicateToRight then |
1370 begin |
1356 begin |
1371 ShiftWorld(1, flip); |
1357 ShiftWorld(1); |
1372 DrawLand(WorldDx, WorldDy); |
1358 DrawLand(WorldDx, WorldDy); |
1373 UnshiftWorld(1, flip); |
1359 UnshiftWorld(); |
1374 end; |
1360 end; |
1375 |
1361 |
1376 DrawWater(255, 0, 0); |
1362 DrawWater(255, 0, 0); |
1377 |
1363 |
1378 (* |
1364 (* |
1402 tmp:= bShowFinger; |
1388 tmp:= bShowFinger; |
1403 bShowFinger:= false; |
1389 bShowFinger:= false; |
1404 |
1390 |
1405 if replicateToLeft then |
1391 if replicateToLeft then |
1406 begin |
1392 begin |
1407 ShiftWorld(-1, flip); |
1393 ShiftWorld(-1); |
1408 DrawVisualGears(1); |
1394 DrawVisualGears(1); |
1409 DrawGears(); |
1395 DrawGears(); |
1410 DrawVisualGears(6); |
1396 DrawVisualGears(6); |
1411 UnshiftWorld(-1, flip); |
1397 UnshiftWorld(); |
1412 end; |
1398 end; |
1413 |
1399 |
1414 if replicateToRight then |
1400 if replicateToRight then |
1415 begin |
1401 begin |
1416 ShiftWorld(1, flip); |
1402 ShiftWorld(1); |
1417 DrawVisualGears(1); |
1403 DrawVisualGears(1); |
1418 DrawGears(); |
1404 DrawGears(); |
1419 DrawVisualGears(6); |
1405 DrawVisualGears(6); |
1420 UnshiftWorld(1, flip); |
1406 UnshiftWorld(); |
1421 end; |
1407 end; |
1422 |
1408 |
1423 bShowFinger:= tmp; |
1409 bShowFinger:= tmp; |
1424 |
1410 |
1425 DrawVisualGears(1); |
1411 DrawVisualGears(1); |
1461 // note: negative parallax gears should last very little for a smooth stereo effect |
1447 // note: negative parallax gears should last very little for a smooth stereo effect |
1462 ChangeDepth(RM, cStereo_Outside); |
1448 ChangeDepth(RM, cStereo_Outside); |
1463 |
1449 |
1464 if replicateToLeft then |
1450 if replicateToLeft then |
1465 begin |
1451 begin |
1466 ShiftWorld(-1, flip); |
1452 ShiftWorld(-1); |
1467 DrawVisualGears(2); |
1453 DrawVisualGears(2); |
1468 UnshiftWorld(-1, flip); |
1454 UnshiftWorld(); |
1469 end; |
1455 end; |
1470 |
1456 |
1471 if replicateToRight then |
1457 if replicateToRight then |
1472 begin |
1458 begin |
1473 ShiftWorld(1, flip); |
1459 ShiftWorld(1); |
1474 DrawVisualGears(2); |
1460 DrawVisualGears(2); |
1475 UnshiftWorld(1, flip); |
1461 UnshiftWorld(); |
1476 end; |
1462 end; |
1477 |
1463 |
1478 DrawVisualGears(2); |
1464 DrawVisualGears(2); |
1479 |
1465 |
1480 // everything after this ResetDepth will be drawn at screen level (depth = 0) |
1466 // everything after this ResetDepth will be drawn at screen level (depth = 0) |
1481 // note: everything that needs to be readable should be on this level |
1467 // note: everything that needs to be readable should be on this level |
1482 ResetDepth(RM); |
1468 ResetDepth(RM); |
1483 |
1469 |
1484 if replicateToLeft then |
1470 if replicateToLeft then |
1485 begin |
1471 begin |
1486 ShiftWorld(-1, flip); |
1472 ShiftWorld(-1); |
1487 DrawVisualGears(3); |
1473 DrawVisualGears(3); |
1488 UnshiftWorld(-1, flip); |
1474 UnshiftWorld(); |
1489 end; |
1475 end; |
1490 |
1476 |
1491 if replicateToRight then |
1477 if replicateToRight then |
1492 begin |
1478 begin |
1493 ShiftWorld(1, flip); |
1479 ShiftWorld(1); |
1494 DrawVisualGears(3); |
1480 DrawVisualGears(3); |
1495 UnshiftWorld(1, flip); |
1481 UnshiftWorld(); |
1496 end; |
1482 end; |
1497 |
1483 |
1498 DrawVisualGears(3); |
1484 DrawVisualGears(3); |
1499 |
1485 |
1500 {$WARNINGS OFF} |
1486 {$WARNINGS OFF} |