equal
deleted
inserted
replaced
29 procedure InitWorld; |
29 procedure InitWorld; |
30 procedure DrawWorld(Lag: LongInt); |
30 procedure DrawWorld(Lag: LongInt); |
31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
33 procedure HideMission; |
33 procedure HideMission; |
34 procedure ShakeCamera(amount: LongWord); |
34 procedure ShakeCamera(amount: LongInt); |
35 procedure InitCameraBorders; |
35 procedure InitCameraBorders; |
36 procedure MoveCamera; |
36 procedure MoveCamera; |
37 procedure onFocusStateChanged; |
37 procedure onFocusStateChanged; |
38 |
38 |
39 implementation |
39 implementation |
52 uUtils, |
52 uUtils, |
53 uTextures, |
53 uTextures, |
54 uRender, |
54 uRender, |
55 uCaptions, |
55 uCaptions, |
56 uCursor, |
56 uCursor, |
57 uCommands |
57 uCommands, |
|
58 uMobile |
58 ; |
59 ; |
59 |
60 |
60 var cWaveWidth, cWaveHeight: LongInt; |
61 var cWaveWidth, cWaveHeight: LongInt; |
61 AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
62 AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
62 tmpSurface: PSDL_Surface; |
63 tmpSurface: PSDL_Surface; |
912 |
913 |
913 // Captions |
914 // Captions |
914 DrawCaptions; |
915 DrawCaptions; |
915 |
916 |
916 // Teams Healths |
917 // Teams Healths |
917 if TeamsCount * 20 > cScreenHeight div 7 then // take up less screen on small displays |
918 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays |
918 begin |
919 begin |
919 SetScale(1.5); |
920 SetScale(1.5); |
920 smallScreenOffset:= cScreenHeight div 6; |
921 smallScreenOffset:= cScreenHeight div 6; |
921 if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80); |
922 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80); |
922 end |
923 end |
923 else smallScreenOffset:= 0; |
924 else smallScreenOffset:= 0; |
924 for t:= 0 to Pred(TeamsCount) do |
925 for t:= 0 to Pred(TeamsCount) do |
925 with TeamsArray[t]^ do |
926 with TeamsArray[t]^ do |
926 begin |
927 begin |
955 |
956 |
956 // if highlighted, draw flag and other contents again to keep their colors |
957 // if highlighted, draw flag and other contents again to keep their colors |
957 // this approach should be faster than drawing all borders one by one tinted or not |
958 // this approach should be faster than drawing all borders one by one tinted or not |
958 if highlight then |
959 if highlight then |
959 begin |
960 begin |
960 if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80) |
961 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80) |
961 else Tint($FF, $FF, $FF, $FF); |
962 else Tint($FF, $FF, $FF, $FF); |
962 |
963 |
963 // draw name |
964 // draw name |
964 r.x:= 2; |
965 r.x:= 2; |
965 r.y:= 2; |
966 r.y:= 2; |
977 end; |
978 end; |
978 end; |
979 end; |
979 if smallScreenOffset <> 0 then |
980 if smallScreenOffset <> 0 then |
980 begin |
981 begin |
981 SetScale(cDefaultZoomLevel); |
982 SetScale(cDefaultZoomLevel); |
982 if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF); |
983 if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$FF); |
983 end; |
984 end; |
984 |
985 |
985 // Lag alert |
986 // Lag alert |
986 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
987 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12); |
987 |
988 |
1194 exit |
1195 exit |
1195 end |
1196 end |
1196 else |
1197 else |
1197 begin |
1198 begin |
1198 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8; |
1199 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8; |
1199 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y)+ hwSign(FollowGear^.dY) * z + WorldDy)) div 8; |
1200 if isPhone() then |
|
1201 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8 |
|
1202 else |
|
1203 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8; |
1200 end; |
1204 end; |
1201 |
1205 |
1202 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1206 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1203 if WorldDy < wdy then WorldDy:= wdy; |
1207 if WorldDy < wdy then WorldDy:= wdy; |
1204 |
1208 |
1310 begin |
1314 begin |
1311 missionTimer:= 0; |
1315 missionTimer:= 0; |
1312 if missionTex <> nil then FreeTexture(missionTex); |
1316 if missionTex <> nil then FreeTexture(missionTex); |
1313 end; |
1317 end; |
1314 |
1318 |
1315 procedure ShakeCamera(amount: LongWord); |
1319 procedure ShakeCamera(amount: LongInt); |
1316 begin |
1320 begin |
1317 if isCursorVisible then exit; |
1321 if isCursorVisible then exit; |
1318 amount:= Max(1, round(amount*zoom/2)); |
1322 amount:= Max(1, round(amount*zoom/2)); |
1319 WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); |
1323 WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); |
1320 WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); |
1324 WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); |