195 const BORDERSIZE = 2; |
195 const BORDERSIZE = 2; |
196 var x, y, i, t, g: LongInt; |
196 var x, y, i, t, g: LongInt; |
197 Slot, Pos, STurns: LongInt; |
197 Slot, Pos, STurns: LongInt; |
198 Ammo: PHHAmmo; |
198 Ammo: PHHAmmo; |
199 begin |
199 begin |
200 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then bShowAmmoMenu:= false; |
200 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then |
|
201 bShowAmmoMenu:= false; |
201 if bShowAmmoMenu then |
202 if bShowAmmoMenu then |
202 begin |
203 begin |
203 FollowGear:= nil; |
204 FollowGear:= nil; |
204 if AMxShift = AMWidth then prevPoint.X:= 0; |
205 if AMxShift = AMWidth then prevPoint.X:= 0; |
205 if (cReducedQuality and rqSlowMenu) <> 0 then |
206 if (cReducedQuality and rqSlowMenu) <> 0 then |
252 inc(y, BORDERSIZE); |
253 inc(y, BORDERSIZE); |
253 |
254 |
254 for i:= 0 to cMaxSlotIndex do |
255 for i:= 0 to cMaxSlotIndex do |
255 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
256 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
256 begin |
257 begin |
257 if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y < y + AMSlotSize) then Slot:= i; |
258 if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i; |
258 inc(SlotsNum); |
259 inc(SlotsNum); |
259 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
260 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
260 t:= 0; |
261 t:= 0; |
261 g:= 0; |
262 g:= 0; |
262 while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
263 while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do |
272 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
273 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
273 end else |
274 end else |
274 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
275 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
275 if (Slot = i) |
276 if (Slot = i) |
276 and (CursorPoint.X >= x + g * AMSlotSize) |
277 and (CursorPoint.X >= x + g * AMSlotSize) |
277 and (CursorPoint.X < x + (g + 1) * AMSlotSize) then |
278 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
278 begin |
279 begin |
279 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
280 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
280 Pos:= t; |
281 Pos:= t; |
281 end; |
282 end; |
282 inc(g) |
283 inc(g) |
286 for g:= g to cMaxSlotAmmoIndex do |
287 for g:= g to cMaxSlotAmmoIndex do |
287 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
288 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
288 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
289 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
289 inc(y, AMSlotSize); |
290 inc(y, AMSlotSize); |
290 end; |
291 end; |
291 |
292 |
292 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
293 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2); |
293 for i:= 0 to cMaxSlotAmmoIndex do |
294 for i:= 0 to cMaxSlotAmmoIndex do |
294 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
295 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1); |
295 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
296 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3); |
296 {$ELSE} |
297 {$ELSE} |
308 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
309 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
309 |
310 |
310 for i:= cMaxSlotIndex downto 0 do |
311 for i:= cMaxSlotIndex downto 0 do |
311 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
312 if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then |
312 begin |
313 begin |
313 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y < y) then Slot:= i; |
314 if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i; |
314 dec(y, AMSlotSize); |
315 dec(y, AMSlotSize); |
315 inc(SlotsNum); |
316 inc(SlotsNum); |
316 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
317 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0); |
317 DrawSprite(sprAMSlot, x, y, 1); |
318 DrawSprite(sprAMSlot, x, y, 1); |
318 DrawSprite(sprAMSlotKeys, x, y + 1, i); |
319 DrawSprite(sprAMSlotKeys, x, y + 1, i); |
331 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
332 if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns); |
332 end else |
333 end else |
333 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
334 DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1); |
334 if (Slot = i) |
335 if (Slot = i) |
335 and (CursorPoint.X >= x + g * AMSlotSize) |
336 and (CursorPoint.X >= x + g * AMSlotSize) |
336 and (CursorPoint.X < x + (g + 1) * AMSlotSize) then |
337 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then |
337 begin |
338 begin |
338 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
339 if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0); |
339 Pos:= t; |
340 Pos:= t; |
340 end; |
341 end; |
341 inc(g) |
342 inc(g) |
344 end; |
345 end; |
345 for g:= g to cMaxSlotAmmoIndex + 1 do |
346 for g:= g to cMaxSlotAmmoIndex + 1 do |
346 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
347 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1); |
347 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
348 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1); |
348 end; |
349 end; |
349 |
350 |
350 dec(y, BORDERSIZE); |
351 dec(y, BORDERSIZE); |
351 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
352 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
352 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
353 for i:= 0 to cMaxSlotAmmoIndex + 1 do |
353 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
354 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
354 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
355 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
355 {$ENDIF} |
356 {$ENDIF} |
356 |
357 |
357 if (Pos >= 0) then |
358 if (Pos >= 0) then |
358 begin |
359 begin |
359 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
360 if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then |
|
361 begin |
360 if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then |
362 if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then |
361 begin |
363 begin |
362 amSel:= Ammo^[Slot, Pos].AmmoType; |
364 amSel:= Ammo^[Slot, Pos].AmmoType; |
363 RenderWeaponTooltip(amSel) |
365 RenderWeaponTooltip(amSel) |
364 end; |
366 end; |
365 |
367 |
366 {$IFDEF IPHONEOS} |
368 {$IFDEF IPHONEOS} |
367 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
369 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
368 |
370 |
369 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
371 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
370 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
372 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
371 {$ELSE} |
373 {$ELSE} |
372 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
374 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex); |
373 |
|
374 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
375 if Ammo^[Slot, Pos].Count < AMMO_INFINITE then |
375 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
376 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]); |
376 {$ENDIF} |
377 {$ENDIF} |
377 |
378 |
378 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
379 if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then |
514 lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; |
516 lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale; |
515 rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; |
517 rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale; |
516 rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale; |
518 rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale; |
517 dec(Shift, w div 2); |
519 dec(Shift, w div 2); |
518 DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
520 DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale); |
519 |
521 |
520 i:= Shift - lw; |
522 i:= Shift - lw; |
521 while i >= -sw - lw do |
523 while i >= -sw - lw do |
522 begin |
524 begin |
523 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
525 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale); |
524 dec(i, lw); |
526 dec(i, lw); |
525 end; |
527 end; |
526 |
528 |
527 i:= Shift + w; |
529 i:= Shift + w; |
528 while i <= sw do |
530 while i <= sw do |
529 begin |
531 begin |
530 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); |
532 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale); |
531 inc(i, rw) |
533 inc(i, rw) |
725 ChangeDepth(RM, -cStereo_Horizon); |
725 ChangeDepth(RM, -cStereo_Horizon); |
726 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
726 DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset); |
727 end; |
727 end; |
728 |
728 |
729 DrawVisualGears(0); |
729 DrawVisualGears(0); |
730 |
730 |
731 if (cReducedQuality and rq2DWater) = 0 then |
731 if (cReducedQuality and rq2DWater) = 0 then |
732 begin |
732 begin |
733 // Waves |
733 // Waves |
734 DrawWater(255, SkyOffset); |
734 DrawWater(255, SkyOffset); |
735 ChangeDepth(RM, -cStereo_Water); |
735 ChangeDepth(RM, -cStereo_Water); |
763 begin |
763 begin |
764 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
764 tdx:= hwSign(Gear^.dX) * Sin(Gear^.Angle * Pi / cMaxAngle); |
765 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
765 tdy:= - Cos(Gear^.Angle * Pi / cMaxAngle); |
766 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
766 for i:= (Gear^.Power * 24) div cPowerDivisor downto 0 do |
767 DrawSprite(sprPower, |
767 DrawSprite(sprPower, |
768 hwRound(Gear^.X) + GetLaunchX(Ammo^[CurSlot, CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle) + round(WorldDx + tdx * (24 + i * 2)) - 16, |
768 int64(hwRound(Gear^.X)) + GetLaunchX(CurAmmoType, hwSign(Gear^.dX), Gear^.Angle) + round(WorldDx + tdx * (24 + i * 2)) - 16, |
769 hwRound(Gear^.Y) + GetLaunchY(Ammo^[CurSlot, CurAmmo].AmmoType, Gear^.Angle) + round(WorldDy + tdy * (24 + i * 2)) - 16, |
769 int64(hwRound(Gear^.Y)) + GetLaunchY(CurAmmoType, Gear^.Angle) + round(WorldDy + tdy * (24 + i * 2)) - 16, |
770 i) |
770 i) |
771 end |
771 end |
772 end; |
772 end; |
773 |
773 |
774 DrawVisualGears(1); |
774 DrawVisualGears(1); |
804 // Target |
804 // Target |
805 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then |
805 if (TargetPoint.X <> NoPointX) and (CurrentTeam <> nil) and (CurrentHedgehog <> nil) then |
806 begin |
806 begin |
807 with PHedgehog(CurrentHedgehog)^ do |
807 with PHedgehog(CurrentHedgehog)^ do |
808 begin |
808 begin |
809 if (Ammo^[CurSlot, CurAmmo].AmmoType = amBee) then |
809 if (CurAmmoType = amBee) then |
810 DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
810 DrawRotatedF(sprTargetBee, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360) |
811 else |
811 else |
812 DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
812 DrawRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360); |
813 end; |
813 end; |
814 end; |
814 end; |
823 offsetX:= cScreenHeight - 13; |
823 offsetX:= cScreenHeight - 13; |
824 {$ELSE} |
824 {$ELSE} |
825 offsetX:= 48; |
825 offsetX:= 48; |
826 {$ENDIF} |
826 {$ENDIF} |
827 offsetY:= cOffsetY; |
827 offsetY:= cOffsetY; |
828 if TurnTimeLeft <> 0 then |
828 if ((TurnTimeLeft <> 0) and (TurnTimeLeft < 1000000)) or (ReadyTimeLeft <> 0) then |
829 begin |
829 begin |
830 i:= Succ(Pred(TurnTimeLeft) div 1000); |
830 if ReadyTimeLeft <> 0 then |
|
831 i:= Succ(Pred(ReadyTimeLeft) div 1000) |
|
832 else |
|
833 i:= Succ(Pred(TurnTimeLeft) div 1000); |
|
834 |
831 if i>99 then t:= 112 |
835 if i>99 then t:= 112 |
832 else if i>9 then t:= 96 |
836 else if i>9 then t:= 96 |
833 else t:= 80; |
837 else t:= 80; |
834 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
838 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
835 while i > 0 do |
839 while i > 0 do |
912 // Teams Healths |
916 // Teams Healths |
913 for t:= 0 to Pred(TeamsCount) do |
917 for t:= 0 to Pred(TeamsCount) do |
914 with TeamsArray[t]^ do |
918 with TeamsArray[t]^ do |
915 begin |
919 begin |
916 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
920 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
917 |
921 |
918 if highlight then |
922 if highlight then |
919 Tint(Clan^.Color); |
923 Tint(Clan^.Color); |
920 |
924 |
921 // draw name |
925 // draw name |
922 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
926 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
923 |
927 |
924 // draw flag |
928 // draw flag |
925 DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex); |
929 DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex); |
926 |
930 |
927 // draw health bar |
931 // draw health bar |
928 r.x:= 0; |
932 r.x:= 0; |
929 r.y:= 0; |
933 r.y:= 0; |
930 r.w:= 2 + TeamHealthBarWidth; |
934 r.w:= 2 + TeamHealthBarWidth; |
931 r.h:= HealthTex^.h; |
935 r.h:= HealthTex^.h; |
933 |
937 |
934 // draw health bar's right border |
938 // draw health bar's right border |
935 inc(r.x, cTeamHealthWidth + 2); |
939 inc(r.x, cTeamHealthWidth + 2); |
936 r.w:= 3; |
940 r.w:= 3; |
937 DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex); |
941 DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex); |
|
942 |
|
943 // draw ai kill counter for gfAISurvival |
|
944 if (GameFlags and gfAISurvival) <> 0 then begin |
|
945 DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY, |
|
946 AIKillsTex); |
|
947 end; |
|
948 |
938 // if highlighted, draw flag and other contents again to keep their colors |
949 // if highlighted, draw flag and other contents again to keep their colors |
939 // this approach should be faster than drawing all borders one by one tinted or not |
950 // this approach should be faster than drawing all borders one by one tinted or not |
940 if highlight then |
951 if highlight then |
941 begin |
952 begin |
942 Tint($FF, $FF, $FF, $FF); |
953 Tint($FF, $FF, $FF, $FF); |
1001 |
1012 |
1002 DrawChat; |
1013 DrawChat; |
1003 |
1014 |
1004 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
1015 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture); |
1005 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
1016 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture); |
1006 |
1017 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
1007 if not isFirstFrame and ((missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm)) then |
1018 begin |
1008 begin |
1019 if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); |
1009 if missionTimer > 0 then dec(missionTimer, Lag); |
|
1010 if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
1020 if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
1011 if missionTex <> nil then |
1021 if missionTex <> nil then |
1012 DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1022 DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1013 end; |
1023 end; |
1014 |
1024 |
1108 begin |
1116 begin |
1109 case ScreenFade of |
1117 case ScreenFade of |
1110 sfToBlack, sfFromBlack: Tint(0, 0, 0, ScreenFadeValue * 255 div 1000); |
1118 sfToBlack, sfFromBlack: Tint(0, 0, 0, ScreenFadeValue * 255 div 1000); |
1111 sfToWhite, sfFromWhite: Tint($FF, $FF, $FF, ScreenFadeValue * 255 div 1000); |
1119 sfToWhite, sfFromWhite: Tint($FF, $FF, $FF, ScreenFadeValue * 255 div 1000); |
1112 end; |
1120 end; |
1113 |
1121 |
1114 VertexBuffer[0].X:= -cScreenWidth; |
1122 VertexBuffer[0].X:= -cScreenWidth; |
1115 VertexBuffer[0].Y:= cScreenHeight; |
1123 VertexBuffer[0].Y:= cScreenHeight; |
1116 VertexBuffer[1].X:= -cScreenWidth; |
1124 VertexBuffer[1].X:= -cScreenWidth; |
1117 VertexBuffer[1].Y:= 0; |
1125 VertexBuffer[1].Y:= 0; |
1118 VertexBuffer[2].X:= cScreenWidth; |
1126 VertexBuffer[2].X:= cScreenWidth; |
1119 VertexBuffer[2].Y:= 0; |
1127 VertexBuffer[2].Y:= 0; |
1120 VertexBuffer[3].X:= cScreenWidth; |
1128 VertexBuffer[3].X:= cScreenWidth; |
1121 VertexBuffer[3].Y:= cScreenHeight; |
1129 VertexBuffer[3].Y:= cScreenHeight; |
1122 |
1130 |
1123 glDisable(GL_TEXTURE_2D); |
1131 glDisable(GL_TEXTURE_2D); |
1124 |
1132 |
1125 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1133 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
1126 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1134 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
1127 |
1135 |
1139 if not bShowAmmoMenu then |
1147 if not bShowAmmoMenu then |
1140 begin |
1148 begin |
1141 with CurrentHedgehog^ do |
1149 with CurrentHedgehog^ do |
1142 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1150 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1143 begin |
1151 begin |
1144 i:= Ammo^[CurSlot, CurAmmo].Pos; |
1152 i:= GetAmmoEntry(CurrentHedgehog^)^.Pos; |
1145 with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do |
1153 with Ammoz[CurAmmoType] do |
1146 if PosCount > 1 then |
1154 if PosCount > 1 then |
1147 DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1155 DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1148 end; |
1156 end; |
1149 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1157 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1150 end |
1158 end |
1181 end; |
1189 end; |
1182 {$ENDIF} |
1190 {$ENDIF} |
1183 |
1191 |
1184 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then |
1192 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then |
1185 if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
1193 if abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4 then |
1186 begin |
1194 begin |
1187 FollowGear:= nil; |
1195 FollowGear:= nil; |
1188 prevPoint:= CursorPoint; |
1196 prevPoint:= CursorPoint; |
1189 exit |
1197 exit |
1190 end |
1198 end |
1191 else begin |
1199 else |
|
1200 begin |
1192 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8; |
1201 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8; |
1193 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; |
1202 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; |
1194 end; |
1203 end; |
1195 |
1204 |
1196 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1205 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1197 if WorldDy < wdy then WorldDy:= wdy; |
1206 if WorldDy < wdy then WorldDy:= wdy; |
1198 |
1207 |
1199 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
1208 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
1200 |
1209 |
1201 if AMxShift < AMWidth then |
1210 if AMxShift < AMWidth then |
1202 begin |
1211 begin |
1203 {$IFDEF IPHONEOS} |
1212 {$IFDEF IPHONEOS} |
1204 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1213 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1205 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1214 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1206 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1215 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1207 if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
1216 if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
1212 if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
1221 if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
1213 {$ENDIF} |
1222 {$ENDIF} |
1214 prevPoint:= CursorPoint; |
1223 prevPoint:= CursorPoint; |
1215 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1224 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1216 exit |
1225 exit |
1217 end; |
1226 end; |
1218 |
1227 |
1219 if isCursorVisible then |
1228 if isCursorVisible then |
1220 begin |
1229 begin |
1221 if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
1230 if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then |
1222 begin |
1231 begin |
1223 SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
1232 SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy); |
1224 PrevSentPointTime:= GameTicks |
1233 PrevSentPointTime:= GameTicks |
|
1234 end; |
|
1235 EdgesDist:= cCursorEdgesDist |
|
1236 end |
|
1237 else |
|
1238 EdgesDist:= cGearScrEdgesDist; |
|
1239 |
|
1240 // this generates the border around the screen that moves the camera when cursor is near it |
|
1241 if isCursorVisible or (FollowGear <> nil) then |
|
1242 begin |
|
1243 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
|
1244 begin |
|
1245 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
|
1246 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
|
1247 end |
|
1248 else |
|
1249 if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
|
1250 begin |
|
1251 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
|
1252 CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
1225 end; |
1253 end; |
1226 end; |
1254 if CursorPoint.Y < EdgesDist then |
1227 |
1255 begin |
1228 if isCursorVisible or (FollowGear <> nil) then |
1256 WorldDy:= WorldDy + CursorPoint.Y - EdgesDist; |
1229 begin |
1257 CursorPoint.Y:= EdgesDist |
1230 if isCursorVisible then EdgesDist:= cCursorEdgesDist |
1258 end |
1231 else EdgesDist:= cGearScrEdgesDist; |
1259 else |
1232 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
1260 if CursorPoint.Y > cScreenHeight - EdgesDist then |
1233 begin |
1261 begin |
1234 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1262 WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
1235 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
1263 CursorPoint.Y:= cScreenHeight - EdgesDist |
1236 end else |
1264 end; |
1237 if CursorPoint.X > cScreenWidth div 2 - EdgesDist then |
1265 end |
1238 begin |
1266 else |
1239 WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist; |
1267 if cHasFocus then |
1240 CursorPoint.X:= cScreenWidth div 2 - EdgesDist |
1268 begin |
1241 end; |
1269 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
1242 if CursorPoint.Y < EdgesDist then |
1270 WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
1243 begin |
1271 CursorPoint.X:= 0; |
1244 WorldDy:= WorldDy + CursorPoint.Y - EdgesDist; |
1272 CursorPoint.Y:= cScreenHeight div 2; |
1245 CursorPoint.Y:= EdgesDist |
1273 end; |
1246 end else |
1274 |
1247 if CursorPoint.Y > cScreenHeight - EdgesDist then |
1275 // this moves the camera according to CursorPoint X and Y |
1248 begin |
|
1249 WorldDy:= WorldDy + CursorPoint.Y - cScreenHeight + EdgesDist; |
|
1250 CursorPoint.Y:= cScreenHeight - EdgesDist |
|
1251 end; |
|
1252 end else |
|
1253 if cHasFocus then |
|
1254 begin |
|
1255 WorldDx:= WorldDx - CursorPoint.X + prevPoint.X; |
|
1256 WorldDy:= WorldDy + CursorPoint.Y - prevPoint.Y; |
|
1257 CursorPoint.X:= 0; |
|
1258 CursorPoint.Y:= cScreenHeight div 2; |
|
1259 end; |
|
1260 |
|
1261 prevPoint:= CursorPoint; |
1276 prevPoint:= CursorPoint; |
1262 if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1277 if cHasFocus then SDL_WarpMouse(CursorPoint.X + (cScreenWidth shr 1), cScreenHeight - CursorPoint.Y); |
1263 if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; |
1278 if WorldDy > LAND_HEIGHT + 1024 then WorldDy:= LAND_HEIGHT + 1024; |
1264 if WorldDy < wdy then WorldDy:= wdy; |
1279 if WorldDy < wdy then WorldDy:= wdy; |
1265 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; |
1280 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024; |