55 AMxLeft, AMxCurr, SlotsNum: integer; |
55 AMxLeft, AMxCurr, SlotsNum: integer; |
56 |
56 |
57 procedure InitWorld; |
57 procedure InitWorld; |
58 begin |
58 begin |
59 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width); |
59 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width); |
60 cScreenEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); |
60 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50); |
61 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
61 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2); |
62 prevPoint.X:= cScreenWidth div 2; |
62 prevPoint.X:= cScreenWidth div 2; |
63 prevPoint.Y:= cScreenHeight div 2; |
63 prevPoint.Y:= cScreenHeight div 2; |
64 WorldDx:= - 1024 + cScreenWidth div 2; |
64 WorldDx:= - 1024 + cScreenWidth div 2; |
65 WorldDy:= - 512 + cScreenHeight div 2; |
65 WorldDy:= - 512 + cScreenHeight div 2; |
404 Captions[Group].EndTime:= RealTicks + 1200 |
404 Captions[Group].EndTime:= RealTicks + 1200 |
405 end; |
405 end; |
406 |
406 |
407 procedure MoveCamera; |
407 procedure MoveCamera; |
408 const PrevSentPointTime: LongWord = 0; |
408 const PrevSentPointTime: LongWord = 0; |
|
409 var EdgesDist: integer; |
409 begin |
410 begin |
410 if not (CurrentTeam.ExtDriven and isCursorVisible) then SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); |
411 if not (CurrentTeam.ExtDriven and isCursorVisible) then SDL_GetMouseState(@CursorPoint.X, @CursorPoint.Y); |
411 if (FollowGear <> nil) then |
412 if (FollowGear <> nil) then |
412 if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
413 if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
413 begin |
414 begin |
438 begin |
439 begin |
439 SendIPCXY('P', CursorPoint.X - WorldDx, CursorPoint.Y - WorldDy); |
440 SendIPCXY('P', CursorPoint.X - WorldDx, CursorPoint.Y - WorldDy); |
440 PrevSentPointTime:= GameTicks |
441 PrevSentPointTime:= GameTicks |
441 end; |
442 end; |
442 end; |
443 end; |
|
444 |
443 if isCursorVisible or (FollowGear <> nil) then |
445 if isCursorVisible or (FollowGear <> nil) then |
444 begin |
446 begin |
445 if CursorPoint.X < cScreenEdgesDist then |
447 if isCursorVisible then EdgesDist:= cCursorEdgesDist |
|
448 else EdgesDist:= cGearScrEdgesDist; |
|
449 if CursorPoint.X < EdgesDist then |
446 begin |
450 begin |
447 WorldDx:= WorldDx - CursorPoint.X + cScreenEdgesDist; |
451 WorldDx:= WorldDx - CursorPoint.X + EdgesDist; |
448 CursorPoint.X:= cScreenEdgesDist |
452 CursorPoint.X:= EdgesDist |
449 end else |
453 end else |
450 if CursorPoint.X > cScreenWidth - cScreenEdgesDist then |
454 if CursorPoint.X > cScreenWidth - EdgesDist then |
451 begin |
455 begin |
452 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth - cScreenEdgesDist; |
456 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth - EdgesDist; |
453 CursorPoint.X:= cScreenWidth - cScreenEdgesDist |
457 CursorPoint.X:= cScreenWidth - EdgesDist |
454 end; |
458 end; |
455 if CursorPoint.Y < cScreenEdgesDist then |
459 if CursorPoint.Y < EdgesDist then |
456 begin |
460 begin |
457 WorldDy:= WorldDy - CursorPoint.Y + cScreenEdgesDist; |
461 WorldDy:= WorldDy - CursorPoint.Y + EdgesDist; |
458 CursorPoint.Y:= cScreenEdgesDist |
462 CursorPoint.Y:= EdgesDist |
459 end else |
463 end else |
460 if CursorPoint.Y > cScreenHeight - cScreenEdgesDist then |
464 if CursorPoint.Y > cScreenHeight - EdgesDist then |
461 begin |
465 begin |
462 WorldDy:= WorldDy - CursorPoint.Y + cScreenHeight - cScreenEdgesDist; |
466 WorldDy:= WorldDy - CursorPoint.Y + cScreenHeight - EdgesDist; |
463 CursorPoint.Y:= cScreenHeight - cScreenEdgesDist |
467 CursorPoint.Y:= cScreenHeight - EdgesDist |
464 end; |
468 end; |
465 end else |
469 end else |
466 begin |
470 begin |
467 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
471 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
468 WorldDy:= WorldDy - CursorPoint.Y + prevPoint.Y; |
472 WorldDy:= WorldDy - CursorPoint.Y + prevPoint.Y; |