18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
21 unit uWorld; |
21 unit uWorld; |
22 interface |
22 interface |
23 uses SDLh, uGears, uConsts, uFloat, uRandom; |
23 uses SDLh, uGears, uConsts, uFloat, uRandom, uTypes; |
24 |
|
25 var FollowGear: PGear; |
|
26 WindBarWidth: LongInt; |
|
27 bShowAmmoMenu: boolean; |
|
28 bSelected: boolean; |
|
29 bShowFinger: boolean; |
|
30 Frames: Longword; |
|
31 AFRToggle: Boolean; |
|
32 WaterColor, DeepWaterColor: TSDL_Color; |
|
33 WorldDx: LongInt; |
|
34 WorldDy: LongInt; |
|
35 SkyOffset: LongInt; |
|
36 HorizontOffset: LongInt; |
|
37 bAFRRight: Boolean; |
|
38 {$IFDEF COUNTTICKS} |
|
39 cntTicks: LongWord; |
|
40 {$ENDIF} |
|
41 cOffsetY: LongInt; |
|
42 |
24 |
43 procedure initModule; |
25 procedure initModule; |
44 procedure freeModule; |
26 procedure freeModule; |
45 |
27 |
46 procedure InitWorld; |
28 procedure InitWorld; |
47 procedure DrawWorld(Lag: LongInt); |
29 procedure DrawWorld(Lag: LongInt); |
48 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
30 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode); |
49 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
|
50 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
31 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt); |
51 procedure HideMission; |
32 procedure HideMission; |
52 procedure ShakeCamera(amount: LongWord); |
33 procedure ShakeCamera(amount: LongWord); |
53 procedure MoveCamera; |
34 procedure MoveCamera; |
54 |
35 |
55 implementation |
36 implementation |
56 uses uStore, uMisc, uTeams, uIO, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand, GLunit; |
37 uses |
57 |
38 uStore, |
58 type TCaptionStr = record |
39 uMisc, |
59 Tex: PTexture; |
40 uIO, |
60 EndTime: LongWord; |
41 uLocale, |
61 end; |
42 uSound, |
|
43 uAmmos, |
|
44 uVisualGears, |
|
45 uChat, |
|
46 uLandTexture, |
|
47 GLunit, |
|
48 uVariables, |
|
49 uUtils, |
|
50 uTextures, |
|
51 uRender, |
|
52 uCaptions |
|
53 ; |
62 |
54 |
63 var cWaveWidth, cWaveHeight: LongInt; |
55 var cWaveWidth, cWaveHeight: LongInt; |
64 Captions: array[TCapGroup] of TCaptionStr; |
|
65 AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
56 AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt; |
66 tmpSurface: PSDL_Surface; |
57 tmpSurface: PSDL_Surface; |
67 fpsTexture: PTexture; |
58 fpsTexture: PTexture; |
68 timeTexture: PTexture; |
59 timeTexture: PTexture; |
69 FPS: Longword; |
60 FPS: Longword; |
154 ScreenFade:= sfFromBlack; |
145 ScreenFade:= sfFromBlack; |
155 ScreenFadeValue:= sfMax; |
146 ScreenFadeValue:= sfMax; |
156 ScreenFadeSpeed:= 1; |
147 ScreenFadeSpeed:= 1; |
157 |
148 |
158 // modified mine timers? |
149 // modified mine timers? |
159 if cMinesTime <> 3 then |
150 if cMinesTime <> 3000 then |
160 begin |
151 begin |
161 if cMinesTime = 0 then |
152 if cMinesTime = 0 then |
162 g:= AddGoal(g, gfAny, gidNoMineTimer) |
153 g:= AddGoal(g, gfAny, gidNoMineTimer) |
163 else if cMinesTime < 0 then |
154 else if cMinesTime < 0 then |
164 g:= AddGoal(g, gfAny, gidRandomMineTimer) |
155 g:= AddGoal(g, gfAny, gidRandomMineTimer) |
165 else |
156 else |
166 g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime); |
157 g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime div 1000); |
167 end; |
158 end; |
168 |
159 |
169 // if the string has been set, show it for (default timeframe) seconds |
160 // if the string has been set, show it for (default timeframe) seconds |
170 if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
161 if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
171 |
162 |
395 FreeWeaponTooltip; |
386 FreeWeaponTooltip; |
396 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then |
387 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then |
397 {$IFDEF IPHONEOS} |
388 {$IFDEF IPHONEOS} |
398 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1); |
389 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1); |
399 {$ELSE} |
390 {$ELSE} |
400 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
391 ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40)); |
401 {$ENDIF} |
392 {$ENDIF} |
402 |
393 |
403 bSelected:= false; |
394 bSelected:= false; |
404 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
395 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
405 end; |
396 end; |
407 procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
398 procedure DrawWater(Alpha: byte; OffsetY: LongInt); |
408 var VertexBuffer: array [0..3] of TVertex2f; |
399 var VertexBuffer: array [0..3] of TVertex2f; |
409 r: TSDL_Rect; |
400 r: TSDL_Rect; |
410 lw, lh: GLfloat; |
401 lw, lh: GLfloat; |
411 begin |
402 begin |
412 WaterColorArray[0].a := Alpha; |
403 if SuddenDeathDmg then |
413 WaterColorArray[1].a := Alpha; |
404 begin |
414 WaterColorArray[2].a := Alpha; |
405 SDWaterColorArray[0].a := Alpha; |
415 WaterColorArray[3].a := Alpha; |
406 SDWaterColorArray[1].a := Alpha; |
|
407 SDWaterColorArray[2].a := Alpha; |
|
408 SDWaterColorArray[3].a := Alpha |
|
409 end |
|
410 else |
|
411 begin |
|
412 WaterColorArray[0].a := Alpha; |
|
413 WaterColorArray[1].a := Alpha; |
|
414 WaterColorArray[2].a := Alpha; |
|
415 WaterColorArray[3].a := Alpha |
|
416 end; |
416 |
417 |
417 lw:= cScreenWidth / cScaleFactor; |
418 lw:= cScreenWidth / cScaleFactor; |
418 lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
419 lh:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 + 16; |
419 |
420 |
420 // Water |
421 // Water |
434 VertexBuffer[3].X:= -lw; |
435 VertexBuffer[3].X:= -lw; |
435 VertexBuffer[3].Y:= lh; |
436 VertexBuffer[3].Y:= lh; |
436 |
437 |
437 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
438 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
438 glEnableClientState(GL_COLOR_ARRAY); |
439 glEnableClientState(GL_COLOR_ARRAY); |
439 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]); |
440 if SuddenDeathDmg then |
|
441 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @SDWaterColorArray[0]) |
|
442 else |
|
443 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WaterColorArray[0]); |
440 |
444 |
441 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
445 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
442 |
446 |
443 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
447 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
444 |
448 |
450 end; |
454 end; |
451 |
455 |
452 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
456 procedure DrawWaves(Dir, dX, dY: LongInt; tnt: Byte); |
453 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
457 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
454 lw, waves, shift: GLfloat; |
458 lw, waves, shift: GLfloat; |
455 begin |
459 sprite: TSprite; |
|
460 begin |
|
461 if SuddenDeathDmg then |
|
462 sprite:= sprSDWater |
|
463 else |
|
464 sprite:= sprWater; |
|
465 |
|
466 cWaveWidth:= SpritesData[sprite].Width; |
|
467 |
456 lw:= cScreenWidth / cScaleFactor; |
468 lw:= cScreenWidth / cScaleFactor; |
457 waves:= lw * 2 / cWaveWidth; |
469 waves:= lw * 2 / cWaveWidth; |
458 |
470 |
459 Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
471 if SuddenDeathDmg then |
460 LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
472 Tint(LongInt(tnt) * SDWaterColorArray[2].r div 255 + 255 - tnt, |
461 LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
473 LongInt(tnt) * SDWaterColorArray[2].g div 255 + 255 - tnt, |
462 255 |
474 LongInt(tnt) * SDWaterColorArray[2].b div 255 + 255 - tnt, |
463 ); |
475 255 |
464 |
476 ) |
465 glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id); |
477 else |
|
478 Tint(LongInt(tnt) * WaterColorArray[2].r div 255 + 255 - tnt, |
|
479 LongInt(tnt) * WaterColorArray[2].g div 255 + 255 - tnt, |
|
480 LongInt(tnt) * WaterColorArray[2].b div 255 + 255 - tnt, |
|
481 255 |
|
482 ); |
|
483 |
|
484 glBindTexture(GL_TEXTURE_2D, SpritesData[sprite].Texture^.id); |
466 |
485 |
467 VertexBuffer[0].X:= -lw; |
486 VertexBuffer[0].X:= -lw; |
468 VertexBuffer[0].Y:= cWaterLine + WorldDy + dY; |
487 VertexBuffer[0].Y:= cWaterLine + WorldDy + dY; |
469 VertexBuffer[1].X:= lw; |
488 VertexBuffer[1].X:= lw; |
470 VertexBuffer[1].Y:= VertexBuffer[0].Y; |
489 VertexBuffer[1].Y:= VertexBuffer[0].Y; |
471 VertexBuffer[2].X:= lw; |
490 VertexBuffer[2].X:= lw; |
472 VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprWater].Height; |
491 VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprite].Height; |
473 VertexBuffer[3].X:= -lw; |
492 VertexBuffer[3].X:= -lw; |
474 VertexBuffer[3].Y:= VertexBuffer[2].Y; |
493 VertexBuffer[3].Y:= VertexBuffer[2].Y; |
475 |
494 |
476 shift:= - lw / cWaveWidth; |
495 shift:= - lw / cWaveWidth; |
477 TextureBuffer[0].X:= shift + (( - WorldDx + LongInt(RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1); |
496 TextureBuffer[0].X:= shift + (( - WorldDx + LongInt(RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1); |
478 TextureBuffer[0].Y:= 0; |
497 TextureBuffer[0].Y:= 0; |
479 TextureBuffer[1].X:= TextureBuffer[0].X + waves; |
498 TextureBuffer[1].X:= TextureBuffer[0].X + waves; |
480 TextureBuffer[1].Y:= TextureBuffer[0].Y; |
499 TextureBuffer[1].Y:= TextureBuffer[0].Y; |
481 TextureBuffer[2].X:= TextureBuffer[1].X; |
500 TextureBuffer[2].X:= TextureBuffer[1].X; |
482 TextureBuffer[2].Y:= SpritesData[sprWater].Texture^.ry; |
501 TextureBuffer[2].Y:= SpritesData[sprite].Texture^.ry; |
483 TextureBuffer[3].X:= TextureBuffer[0].X; |
502 TextureBuffer[3].X:= TextureBuffer[0].X; |
484 TextureBuffer[3].Y:= TextureBuffer[2].Y; |
503 TextureBuffer[3].Y:= TextureBuffer[2].Y; |
485 |
504 |
486 |
505 |
487 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
506 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
726 begin |
745 begin |
727 if (cReducedQuality and rqNoBackground) = 0 then |
746 if (cReducedQuality and rqNoBackground) = 0 then |
728 begin |
747 begin |
729 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
748 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
730 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
749 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
731 offsetY:= 10 * min(0, -145 - ScreenBottom); |
750 offsetY:= 10 * Min(0, -145 - ScreenBottom); |
732 SkyOffset:= offsetY div 35 + cWaveHeight; |
751 SkyOffset:= offsetY div 35 + cWaveHeight; |
733 HorizontOffset:= SkyOffset; |
752 HorizontOffset:= SkyOffset; |
734 if ScreenBottom > SkyOffset then |
753 if ScreenBottom > SkyOffset then |
735 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
754 HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20); |
736 |
755 |
790 |
809 |
791 DrawGears; |
810 DrawGears; |
792 |
811 |
793 DrawVisualGears(2); |
812 DrawVisualGears(2); |
794 |
813 |
795 DrawWater(cWaterOpacity, 0); |
814 if SuddenDeathDmg then |
|
815 DrawWater(cSDWaterOpacity, 0) |
|
816 else |
|
817 DrawWater(cWaterOpacity, 0); |
796 |
818 |
797 // Waves |
819 // Waves |
798 ChangeDepth(RM, cStereo_Water); |
820 ChangeDepth(RM, cStereo_Water); |
799 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); |
821 DrawWaves( 1, 25 - WorldDx div 9, - cWaveHeight, 12); |
800 |
822 |
801 if (cReducedQuality and rq2DWater) = 0 then |
823 if (cReducedQuality and rq2DWater) = 0 then |
802 begin |
824 begin |
803 //DrawWater(cWaterOpacity, - offsetY div 40); |
825 //DrawWater(cWaterOpacity, - offsetY div 40); |
804 ChangeDepth(RM, cStereo_Water); |
826 ChangeDepth(RM, cStereo_Water); |
805 DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); |
827 DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8); |
806 DrawWater(cWaterOpacity, - offsetY div 20); |
828 if SuddenDeathDmg then |
|
829 DrawWater(cSDWaterOpacity, - offsetY div 20) |
|
830 else |
|
831 DrawWater(cWaterOpacity, - offsetY div 20); |
807 ChangeDepth(RM, cStereo_Water); |
832 ChangeDepth(RM, cStereo_Water); |
808 DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); |
833 DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2); |
809 DrawWater(cWaterOpacity, - offsetY div 10); |
834 if SuddenDeathDmg then |
|
835 DrawWater(cSDWaterOpacity, - offsetY div 10) |
|
836 else |
|
837 DrawWater(cWaterOpacity, - offsetY div 10); |
810 ChangeDepth(RM, cStereo_Water); |
838 ChangeDepth(RM, cStereo_Water); |
811 DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
839 DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0); |
812 ResetDepth(RM); |
840 ResetDepth(RM); |
813 end |
841 end |
814 else |
842 else |
858 i:= i div 10 |
886 i:= i div 10 |
859 end; |
887 end; |
860 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
888 DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0); |
861 end; |
889 end; |
862 |
890 |
863 {$IFNDEF IPHONEOS} |
|
864 // Timetrial |
|
865 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then |
|
866 begin |
|
867 if TimeTrialStopTime = 0 then i:= RealTicks - TimeTrialStartTime else i:= TimeTrialStopTime - TimeTrialStartTime; |
|
868 t:= 272; |
|
869 // right frame |
|
870 DrawSprite(sprFrame, -cScreenWidth div 2 + t, 8, 1); |
|
871 dec(t, 32); |
|
872 // 1 ms |
|
873 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
874 dec(t, 32); |
|
875 i:= i div 10; |
|
876 // 10 ms |
|
877 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
878 dec(t, 32); |
|
879 i:= i div 10; |
|
880 // 100 ms |
|
881 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
882 dec(t, 16); |
|
883 // Point |
|
884 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 11); |
|
885 dec(t, 32); |
|
886 i:= i div 10; |
|
887 // 1 s |
|
888 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
889 dec(t, 32); |
|
890 i:= i div 10; |
|
891 // 10s |
|
892 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 6); |
|
893 dec(t, 16); |
|
894 // Point |
|
895 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 10); |
|
896 dec(t, 32); |
|
897 i:= i div 6; |
|
898 // 1 m |
|
899 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
900 dec(t, 32); |
|
901 i:= i div 10; |
|
902 // 10 m |
|
903 DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); |
|
904 // left frame |
|
905 DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, 8, 0); |
|
906 end; |
|
907 {$ENDIF} |
|
908 |
|
909 // Captions |
891 // Captions |
910 {$IFDEF IPHONEOS} |
892 DrawCaptions; |
911 offset:= 40; |
|
912 {$ELSE} |
|
913 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then offset:= 48 |
|
914 else offset:= 8; |
|
915 {$ENDIF} |
|
916 |
|
917 for grp:= Low(TCapGroup) to High(TCapGroup) do |
|
918 with Captions[grp] do |
|
919 if Tex <> nil then |
|
920 begin |
|
921 DrawCentered(0, offset, Tex); |
|
922 inc(offset, Tex^.h + 2); |
|
923 if EndTime <= RealTicks then |
|
924 begin |
|
925 FreeTexture(Tex); |
|
926 Tex:= nil; |
|
927 EndTime:= 0 |
|
928 end; |
|
929 end; |
|
930 |
893 |
931 // Teams Healths |
894 // Teams Healths |
932 for t:= 0 to Pred(TeamsCount) do |
895 for t:= 0 to Pred(TeamsCount) do |
933 with TeamsArray[t]^ do |
896 with TeamsArray[t]^ do |
934 begin |
897 begin |
935 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
898 highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); |
936 |
899 |
937 if highlight then |
900 if highlight then |
938 Tint(Clan^.Color); |
901 Tint(Clan^.Color shl 8 or $FF); |
939 |
902 |
940 // draw name |
903 // draw name |
941 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
904 DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex); |
942 |
905 |
943 // draw flag |
906 // draw flag |
1032 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
995 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then |
1033 begin |
996 begin |
1034 if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); |
997 if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag); |
1035 if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
998 if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0 |
1036 if missionTex <> nil then |
999 if missionTex <> nil then |
1037 DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1000 DrawCentered(0, Min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex); |
1038 end; |
1001 end; |
1039 |
1002 |
1040 // fps |
1003 // fps |
1041 {$IFDEF IPHONEOS} |
1004 {$IFDEF IPHONEOS} |
1042 offsetX:= 8; |
1005 offsetX:= 8; |
1173 end |
1136 end |
1174 end; |
1137 end; |
1175 isFirstFrame:= false |
1138 isFirstFrame:= false |
1176 end; |
1139 end; |
1177 |
1140 |
1178 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); |
|
1179 begin |
|
1180 //if Group in [capgrpGameState] then WriteLnToConsole(s); |
|
1181 if Captions[Group].Tex <> nil then |
|
1182 FreeTexture(Captions[Group].Tex); |
|
1183 Captions[Group].Tex:= nil; |
|
1184 |
|
1185 Captions[Group].Tex:= RenderStringTex(s, Color, fntBig); |
|
1186 |
|
1187 case Group of |
|
1188 capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200 |
|
1189 else |
|
1190 Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3; |
|
1191 end; |
|
1192 end; |
|
1193 |
|
1194 procedure MoveCamera; |
1141 procedure MoveCamera; |
1195 var EdgesDist, wdy: LongInt; |
1142 var EdgesDist, wdy: LongInt; |
1196 PrevSentPointTime: LongWord = 0; |
1143 PrevSentPointTime: LongWord = 0; |
1197 begin |
1144 begin |
1198 {$IFNDEF IPHONEOS} |
1145 {$IFNDEF IPHONEOS} |
1314 r.y:= icon * 32; |
1261 r.y:= icon * 32; |
1315 missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r) |
1262 missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r) |
1316 end |
1263 end |
1317 else |
1264 else |
1318 begin |
1265 begin |
1319 r.x:= ((-icon - 1) shr 5) * 32; |
1266 r.x:= ((-icon - 1) shr 4) * 32; |
1320 r.y:= ((-icon - 1) mod 32) * 32; |
1267 r.y:= ((-icon - 1) mod 16) * 32; |
1321 missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, SpritesData[sprAMAmmos].Surface, @r) |
1268 missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, SpritesData[sprAMAmmos].Surface, @r) |
1322 end; |
1269 end; |
1323 end; |
1270 end; |
1324 |
1271 |
1325 procedure HideMission; |
1272 procedure HideMission; |