changeset 10494 | 0eb97cf4c78e |
parent 10425 | 9bf21d178d13 |
child 10507 | ed5df9cd251f |
10493:bcbf029e6b08 | 10494:0eb97cf4c78e |
---|---|
1000 openglTranslProjMatrix(-cStereoDepth, 0, 0); |
1000 openglTranslProjMatrix(-cStereoDepth, 0, 0); |
1001 cStereoDepth:= 0; |
1001 cStereoDepth:= 0; |
1002 {$ENDIF} |
1002 {$ENDIF} |
1003 end; |
1003 end; |
1004 |
1004 |
1005 procedure RenderWorldEdge(Lag: Longword); |
1005 procedure RenderWorldEdge; |
1006 var |
1006 var |
1007 //VertexBuffer: array [0..3] of TVertex2f; |
1007 //VertexBuffer: array [0..3] of TVertex2f; |
1008 tmp, w: LongInt; |
1008 tmp, w: LongInt; |
1009 rect: TSDL_Rect; |
1009 rect: TSDL_Rect; |
1010 //c1, c2: LongWord; // couple of colours for edges |
1010 //c1, c2: LongWord; // couple of colours for edges |
1013 begin |
1013 begin |
1014 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type. Prob also, say, trigger a border animation timer on an impact. *) |
1014 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type. Prob also, say, trigger a border animation timer on an impact. *) |
1015 |
1015 |
1016 rect.y:= ViewTopY; |
1016 rect.y:= ViewTopY; |
1017 rect.h:= ViewHeight; |
1017 rect.h:= ViewHeight; |
1018 tmp:= leftX + WorldDx; |
1018 tmp:= LongInt(leftX) + WorldDx; |
1019 w:= tmp - ViewLeftX; |
1019 w:= tmp - ViewLeftX; |
1020 |
1020 |
1021 if w > 0 then |
1021 if w > 0 then |
1022 begin |
1022 begin |
1023 rect.w:= w; |
1023 rect.w:= w; |
1025 DrawRect(rect, $30, $30, $30, $40, true); |
1025 DrawRect(rect, $30, $30, $30, $40, true); |
1026 if WorldEdge = weBounce then |
1026 if WorldEdge = weBounce then |
1027 DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); |
1027 DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); |
1028 end; |
1028 end; |
1029 |
1029 |
1030 tmp:= rightX + WorldDx; |
1030 tmp:= LongInt(rightX) + WorldDx; |
1031 w:= ViewRightX - tmp; |
1031 w:= ViewRightX - tmp; |
1032 |
1032 |
1033 if w > 0 then |
1033 if w > 0 then |
1034 begin |
1034 begin |
1035 rect.w:= w; |
1035 rect.w:= w; |
1269 begin |
1269 begin |
1270 preShiftWorldDx:= WorldDx; |
1270 preShiftWorldDx:= WorldDx; |
1271 |
1271 |
1272 if Flip then |
1272 if Flip then |
1273 begin |
1273 begin |
1274 WorldDx:= -WorldDx - playWidth - Dir * playWidth; |
1274 WorldDx:= -WorldDx - LongInt(playWidth) - Dir * LongInt(playWidth); |
1275 openglPushMatrix(); |
1275 openglPushMatrix(); |
1276 openglScalef(-1, 1, 1); |
1276 openglScalef(-1, 1, 1); |
1277 end |
1277 end |
1278 else |
1278 else |
1279 WorldDx:= WorldDx + Dir * playWidth; |
1279 WorldDx:= WorldDx + Dir * LongInt(playWidth); |
1280 |
1280 |
1281 end; |
1281 end; |
1282 |
1282 |
1283 procedure UnshiftWorld(Dir: LongInt; Flip: Boolean); |
1283 procedure UnshiftWorld(Dir: LongInt; Flip: Boolean); |
1284 begin |
1284 begin |
1304 replicateToRight:= false; |
1304 replicateToRight:= false; |
1305 flip:= false; |
1305 flip:= false; |
1306 end |
1306 end |
1307 else |
1307 else |
1308 begin |
1308 begin |
1309 replicateToLeft := (leftX + WorldDx > ViewLeftX); |
1309 replicateToLeft := (LongInt(leftX) + WorldDx > ViewLeftX); |
1310 replicateToRight:= (rightX + WorldDx < ViewRightX); |
1310 replicateToRight:= (LongInt(rightX) + WorldDx < ViewRightX); |
1311 flip:= (WorldEdge = weBounce); |
1311 flip:= (WorldEdge = weBounce); |
1312 end; |
1312 end; |
1313 |
1313 |
1314 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1314 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1315 |
1315 |
1509 DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
1509 DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
1510 end |
1510 end |
1511 end; |
1511 end; |
1512 {$WARNINGS ON} |
1512 {$WARNINGS ON} |
1513 |
1513 |
1514 RenderWorldEdge(Lag); |
1514 RenderWorldEdge(); |
1515 |
1515 |
1516 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1516 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1517 SetScale(cDefaultZoomLevel); |
1517 SetScale(cDefaultZoomLevel); |
1518 |
1518 |
1519 // Turn time |
1519 // Turn time |
1833 DrawSprite(PosSprite, TargetCursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - TargetCursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1833 DrawSprite(PosSprite, TargetCursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - TargetCursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1834 Untint(); |
1834 Untint(); |
1835 end; |
1835 end; |
1836 end; |
1836 end; |
1837 //DrawSprite(sprArrow, TargetCursorPoint.X, cScreenHeight - TargetCursorPoint.Y, (RealTicks shr 6) mod 8) |
1837 //DrawSprite(sprArrow, TargetCursorPoint.X, cScreenHeight - TargetCursorPoint.Y, (RealTicks shr 6) mod 8) |
1838 DrawTextureF(SpritesData[sprArrow].Texture, cDefaultZoomLevel / cScaleFactor, TargetCursorPoint.X + round(SpritesData[sprArrow].Width / cScaleFactor), cScreenHeight - TargetCursorPoint.Y + round(SpritesData[sprArrow].Height / cScaleFactor), (RealTicks shr 6) mod 8, 1, SpritesData[sprArrow].Width, SpritesData[sprArrow].Height); |
1838 DrawTextureF(SpritesData[sprArrow].Texture, cDefaultZoomLevel / cScaleFactor, TargetCursorPoint.X + round(SpritesData[sprArrow].Width / cScaleFactor), cScreenHeight + round(SpritesData[sprArrow].Height / cScaleFactor) - TargetCursorPoint.Y, (RealTicks shr 6) mod 8, 1, SpritesData[sprArrow].Width, SpritesData[sprArrow].Height); |
1839 end |
1839 end |
1840 end; |
1840 end; |
1841 |
1841 |
1842 // debug stuff |
1842 // debug stuff |
1843 if cViewLimitsDebug then |
1843 if cViewLimitsDebug then |
1873 end |
1873 end |
1874 else |
1874 else |
1875 begin |
1875 begin |
1876 if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > rightX - leftX - 100 then |
1876 if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > rightX - leftX - 100 then |
1877 begin |
1877 begin |
1878 if (prevPoint.X - WorldDx) * 2 < rightX + leftX then |
1878 if (prevPoint.X - WorldDx) * 2 < LongInt(rightX + leftX) then |
1879 cameraJump:= rightX - leftX |
1879 cameraJump:= rightX - leftX |
1880 else |
1880 else |
1881 cameraJump:= leftX - rightX; |
1881 cameraJump:= leftX - rightX; |
1882 WorldDx:= WorldDx - cameraJump; |
1882 WorldDx:= WorldDx - cameraJump; |
1883 end; |
1883 end; |