95 s:= s + trgoal[si] + '|'; |
94 s:= s + trgoal[si] + '|'; |
96 AddGoal:= s; |
95 AddGoal:= s; |
97 end; |
96 end; |
98 begin |
97 begin |
99 missionTimer:= 0; |
98 missionTimer:= 0; |
100 // initialized here because when initModule is called cScreenWidth/Height are not yet set |
|
101 if (uWorld.wScreen = 0) and (uWorld.hScreen = 0) then |
|
102 begin |
|
103 uWorld.wScreen:= cScreenWidth; |
|
104 uWorld.hScreen:= cScreenHeight; |
|
105 end; |
|
106 |
99 |
107 if (GameFlags and gfRandomOrder) <> 0 then // shuffle them up a bit |
100 if (GameFlags and gfRandomOrder) <> 0 then // shuffle them up a bit |
108 begin |
101 begin |
109 for i:= 0 to ClansCount * 4 do |
102 for i:= 0 to ClansCount * 4 do |
110 begin |
103 begin |
239 SlotsNum:= 0; |
232 SlotsNum:= 0; |
240 x:= (cScreenWidth shr 1) - AMWidth + AMxShift; |
233 x:= (cScreenWidth shr 1) - AMWidth + AMxShift; |
241 |
234 |
242 {$IFDEF IPHONEOS} |
235 {$IFDEF IPHONEOS} |
243 Slot:= cMaxSlotIndex; |
236 Slot:= cMaxSlotIndex; |
244 y:= AMyOffset; |
237 x:= x - cOffsetY; |
|
238 y:= AMyOffset + 123; |
245 dec(y, BORDERSIZE); |
239 dec(y, BORDERSIZE); |
246 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
240 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0); |
247 for i:= 0 to cMaxSlotAmmoIndex do |
241 for i:= 0 to cMaxSlotAmmoIndex do |
248 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
242 DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0); |
249 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
243 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1); |
401 WaterColorArray[0].a := Alpha; |
395 WaterColorArray[0].a := Alpha; |
402 WaterColorArray[1].a := Alpha; |
396 WaterColorArray[1].a := Alpha; |
403 WaterColorArray[2].a := Alpha; |
397 WaterColorArray[2].a := Alpha; |
404 WaterColorArray[3].a := Alpha; |
398 WaterColorArray[3].a := Alpha; |
405 |
399 |
406 lw:= wScreen / cScaleFactor; |
400 lw:= cScreenWidth / cScaleFactor; |
407 lh:= trunc(hScreen / cScaleFactor) + hScreen div 2 + 16; |
401 lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
408 |
402 |
409 // Water |
403 // Water |
410 r.y:= OffsetY + WorldDy + cWaterLine; |
404 r.y:= OffsetY + WorldDy + cWaterLine; |
411 if WorldDy < trunc(hScreen / cScaleFactor) + hScreen div 2 - cWaterLine then |
405 if WorldDy < trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine then |
412 begin |
406 begin |
413 if r.y < 0 then |
407 if r.y < 0 then |
414 r.y:= 0; |
408 r.y:= 0; |
415 |
409 |
416 glDisable(GL_TEXTURE_2D); |
410 glDisable(GL_TEXTURE_2D); |
441 |
435 |
442 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
436 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
443 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
437 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
444 lw, waves, shift: GLfloat; |
438 lw, waves, shift: GLfloat; |
445 begin |
439 begin |
446 lw:= wScreen / cScaleFactor; |
440 lw:= cScreenWidth / cScaleFactor; |
447 waves:= lw * 2 / cWaveWidth; |
441 waves:= lw * 2 / cWaveWidth; |
448 |
442 |
449 Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
443 Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
450 LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
444 LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
451 LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
445 LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
665 {$IFDEF IPHONEOS} |
659 {$IFDEF IPHONEOS} |
666 offsetX:= cScreenHeight - 13; |
660 offsetX:= cScreenHeight - 13; |
667 {$ELSE} |
661 {$ELSE} |
668 offsetX:= 48; |
662 offsetX:= 48; |
669 {$ENDIF} |
663 {$ENDIF} |
|
664 offsetY:= cOffsetY; |
670 if TurnTimeLeft <> 0 then |
665 if TurnTimeLeft <> 0 then |
671 begin |
666 begin |
672 i:= Succ(Pred(TurnTimeLeft) div 1000); |
667 i:= Succ(Pred(TurnTimeLeft) div 1000); |
673 if i>99 then t:= 112 |
668 if i>99 then t:= 112 |
674 else if i>9 then t:= 96 |
669 else if i>9 then t:= 96 |
675 else t:= 80; |
670 else t:= 80; |
676 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t, cScreenHeight - offsetX, 1); |
671 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, 1); |
677 while i > 0 do |
672 while i > 0 do |
678 begin |
673 begin |
679 dec(t, 32); |
674 dec(t, 32); |
680 DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t, cScreenHeight - offsetX, i mod 10); |
675 DrawSprite(sprBigDigit, -(cScreenWidth shr 1) + t + offsetY, cScreenHeight - offsetX, i mod 10); |
681 i:= i div 10 |
676 i:= i div 10 |
682 end; |
677 end; |
683 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4, cScreenHeight - offsetX, 0); |
678 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
684 end; |
679 end; |
685 |
680 |
686 {$IFNDEF IPHONEOS} |
681 {$IFNDEF IPHONEOS} |
687 // Timetrial |
682 // Timetrial |
688 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then |
683 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then |
854 DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
849 DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
855 end; |
850 end; |
856 |
851 |
857 // fps |
852 // fps |
858 {$IFDEF IPHONEOS} |
853 {$IFDEF IPHONEOS} |
859 offset:= 8; |
854 offsetX:= 8; |
860 {$ELSE} |
855 {$ELSE} |
861 offset:= 10; |
856 offsetX:= 10; |
862 {$ENDIF} |
857 {$ENDIF} |
|
858 offsetY:= cOffsetY; |
863 inc(Frames); |
859 inc(Frames); |
864 |
860 |
865 if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag); |
861 if cShowFPS or (GameType = gmtDemo) then inc(CountTicks, Lag); |
866 if (GameType = gmtDemo) and (CountTicks >= 1000) then |
862 if (GameType = gmtDemo) and (CountTicks >= 1000) then |
867 begin |
863 begin |
881 timeTexture:= Surface2Tex(tmpSurface, false); |
877 timeTexture:= Surface2Tex(tmpSurface, false); |
882 SDL_FreeSurface(tmpSurface) |
878 SDL_FreeSurface(tmpSurface) |
883 end; |
879 end; |
884 |
880 |
885 if timeTexture <> nil then |
881 if timeTexture <> nil then |
886 DrawTexture((cScreenWidth shr 1) - 10 - timeTexture^.w, offset + timeTexture^.h+5, timeTexture); |
882 DrawTexture((cScreenWidth shr 1) - 20 - timeTexture^.w - offsetY, offsetX + timeTexture^.h+5, timeTexture); |
887 |
883 |
888 if cShowFPS then |
884 if cShowFPS then |
889 begin |
885 begin |
890 if CountTicks >= 1000 then |
886 if CountTicks >= 1000 then |
891 begin |
887 begin |
898 tmpSurface:= doSurfaceConversion(tmpSurface); |
894 tmpSurface:= doSurfaceConversion(tmpSurface); |
899 fpsTexture:= Surface2Tex(tmpSurface, false); |
895 fpsTexture:= Surface2Tex(tmpSurface, false); |
900 SDL_FreeSurface(tmpSurface) |
896 SDL_FreeSurface(tmpSurface) |
901 end; |
897 end; |
902 if fpsTexture <> nil then |
898 if fpsTexture <> nil then |
903 DrawTexture((cScreenWidth shr 1) - 50, offset, fpsTexture); |
899 DrawTexture((cScreenWidth shr 1) - 60 - offsetY, offsetX, fpsTexture); |
904 end; |
900 end; |
905 |
901 |
906 if CountTicks >= 1000 then CountTicks:= 0; |
902 if CountTicks >= 1000 then CountTicks:= 0; |
907 |
903 |
908 // lag warning (?) |
904 // lag warning (?) |
1023 |
1019 |
1024 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
1020 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit; |
1025 |
1021 |
1026 if AMxShift < AMWidth then |
1022 if AMxShift < AMWidth then |
1027 begin |
1023 begin |
1028 {$IFDEF IPHONEOS} |
1024 {$IFDEF IPHONEOS} |
1029 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1025 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth; |
1030 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1026 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1031 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1027 if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize; |
1032 if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
1028 if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset; |
1033 {$ELSE} |
1029 {$ELSE} |
1034 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1030 if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize; |
1035 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1031 if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset; |
1036 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
1032 if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize; |
1037 if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
1033 if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize; |
1038 {$ENDIF} |
1034 {$ENDIF} |
1039 prevPoint:= CursorPoint; |
1035 prevPoint:= CursorPoint; |
1040 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1036 if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y); |
1041 exit |
1037 exit |
1042 end; |
1038 end; |
1043 |
1039 |