- Make world wrap edges not depend on gear radius
- Camera jumps on wrap such that gear position on the screen doesn't change
- Small fix to cmake script
--- a/hedgewars/CMakeLists.txt Mon Feb 24 13:41:32 2014 -0500
+++ b/hedgewars/CMakeLists.txt Wed Feb 26 00:28:27 2014 +0400
@@ -198,9 +198,11 @@
#SOURCE AND PROGRAMS SECTION
if(BUILD_ENGINE_LIBRARY)
message("***Engine will be built as library (experimental)***")
- if(APPLE AND ${current_macosx_version} VERSION_GREATER "10.5")
- # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
- add_flag_prepend(CMAKE_Pascal_FLAGS "-k-no_order_inits")
+ if(APPLE)
+ if (${current_macosx_version} VERSION_GREATER "10.5")
+ # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
+ add_flag_prepend(CMAKE_Pascal_FLAGS "-k-no_order_inits")
+ endif()
endif()
#workaround for missing <TARGET> support during object generation
--- a/hedgewars/uGearsUtils.pas Mon Feb 24 13:41:32 2014 -0500
+++ b/hedgewars/uGearsUtils.pas Wed Feb 26 00:28:27 2014 +0400
@@ -1232,14 +1232,14 @@
begin
WorldWrap:= false;
if WorldEdge = weNone then exit(false);
-if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) or
- (hwRound(Gear^.X) + LongInt(Gear^.Radius) > LongInt(rightX)) then
+if (hwRound(Gear^.X) < LongInt(leftX)) or
+ (hwRound(Gear^.X) > LongInt(rightX)) then
begin
if WorldEdge = weWrap then
begin
- if (hwRound(Gear^.X) - Gear^.Radius < LongInt(leftX)) then
- Gear^.X:= int2hwfloat(rightX - Gear^.Radius)
- else Gear^.X:= int2hwfloat(LongInt(leftX) + Gear^.Radius);
+ if (hwRound(Gear^.X) < LongInt(leftX)) then
+ Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX)
+ else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX);
LeftImpactTimer:= 150;
RightImpactTimer:= 150
end
--- a/hedgewars/uWorld.pas Mon Feb 24 13:41:32 2014 -0500
+++ b/hedgewars/uWorld.pas Wed Feb 26 00:28:27 2014 +0400
@@ -1851,7 +1851,7 @@
var PrevSentPointTime: LongWord = 0;
procedure MoveCamera;
-var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt;
+var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY, cameraJump: LongInt;
inbtwnTrgtAttks: Boolean;
begin
{$IFNDEF MOBILE}
@@ -1869,7 +1869,17 @@
end
else
begin
+ if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > rightX - leftX - 100 then
+ begin
+ if (prevPoint.X - WorldDx) * 2 < rightX + leftX then
+ cameraJump:= rightX - leftX
+ else
+ cameraJump:= leftX - rightX;
+ WorldDx:= WorldDx - cameraJump;
+ end;
+
CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
+
if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10) then
CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
else