changeset 15149 | a8b1e25040f3 |
parent 15070 | 57f7d89067ef |
child 15205 | 8705ee93f8b3 |
15148:95b72e81a866 | 15149:a8b1e25040f3 |
---|---|
76 tmpSurface: PSDL_Surface; |
76 tmpSurface: PSDL_Surface; |
77 fpsTexture: PTexture; |
77 fpsTexture: PTexture; |
78 timeTexture: PTexture; |
78 timeTexture: PTexture; |
79 FPS: Longword; |
79 FPS: Longword; |
80 CountTicks: Longword; |
80 CountTicks: Longword; |
81 prevPoint{, prevTargetPoint}: TPoint; |
81 prevPoint: TPoint; |
82 amSel: TAmmoType = amNothing; |
82 amSel: TAmmoType = amNothing; |
83 missionTex: PTexture; |
83 missionTex: PTexture; |
84 missionTimer: LongInt; |
84 missionTimer: LongInt; |
85 isFirstFrame: boolean; |
85 isFirstFrame: boolean; |
86 AMAnimType: LongInt; |
86 AMAnimType: LongInt; |
105 AMHiding = 3; |
105 AMHiding = 3; |
106 |
106 |
107 AMTypeMaskX = $00000001; |
107 AMTypeMaskX = $00000001; |
108 AMTypeMaskY = $00000002; |
108 AMTypeMaskY = $00000002; |
109 AMTypeMaskAlpha = $00000004; |
109 AMTypeMaskAlpha = $00000004; |
110 //AMTypeMaskSlide = $00000008; |
|
111 |
110 |
112 {$IFDEF MOBILE} |
111 {$IFDEF MOBILE} |
113 AMSlotSize = 48; |
112 AMSlotSize = 48; |
114 {$ELSE} |
113 {$ELSE} |
115 AMSlotSize = 32; |
114 AMSlotSize = 32; |
236 ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 0, 0) |
235 ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 0, 0) |
237 else |
236 else |
238 // target icon for anything else |
237 // target icon for anything else |
239 ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
238 ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0); |
240 |
239 |
241 //cWaveWidth:= SpritesData[sprWater].Width; |
|
242 //cWaveHeight:= SpritesData[sprWater].Height; |
|
243 cWaveHeight:= 32; |
240 cWaveHeight:= 32; |
244 |
241 |
245 InitCameraBorders(); |
242 InitCameraBorders(); |
246 uCursor.init(); |
243 uCursor.init(); |
247 prevPoint.X:= 0; |
244 prevPoint.X:= 0; |
248 prevPoint.Y:= cScreenHeight div 2; |
245 prevPoint.Y:= cScreenHeight div 2; |
249 //prevTargetPoint.X:= 0; |
246 WorldDx:= -(LongInt(leftX + (playWidth div 2))); |
250 //prevTargetPoint.Y:= 0; |
|
251 WorldDx:= -(LongInt(leftX + (playWidth div 2))); // -(LAND_WIDTH div 2);// + cScreenWidth div 2; |
|
252 WorldDy:= -(LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
247 WorldDy:= -(LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
253 |
248 |
254 //aligns it to the bottom of the screen, minus the border |
249 //aligns it to the bottom of the screen, minus the border |
255 SkyOffset:= 0; |
250 SkyOffset:= 0; |
256 HorizontOffset:= 0; |
251 HorizontOffset:= 0; |
925 FinishRender(); |
920 FinishRender(); |
926 end; |
921 end; |
927 |
922 |
928 procedure RenderWorldEdge; |
923 procedure RenderWorldEdge; |
929 var |
924 var |
930 //VertexBuffer: array [0..3] of TVertex2f; |
|
931 tmp, w: LongInt; |
925 tmp, w: LongInt; |
932 rect: TSDL_Rect; |
926 rect: TSDL_Rect; |
933 //c1, c2: LongWord; // couple of colours for edges |
|
934 begin |
927 begin |
935 if (WorldEdge <> weNone) and (WorldEdge <> weSea) then |
928 if (WorldEdge <> weNone) and (WorldEdge <> weSea) then |
936 begin |
929 begin |
937 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type. Prob also, say, trigger a border animation timer on an impact. *) |
930 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type. Prob also, say, trigger a border animation timer on an impact. *) |
938 |
931 |
960 DrawRect(rect, $10, $10, $10, $80, true); |
953 DrawRect(rect, $10, $10, $10, $80, true); |
961 if WorldEdge = weBounce then |
954 if WorldEdge = weBounce then |
962 DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); |
955 DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF); |
963 end; |
956 end; |
964 |
957 |
965 (* |
|
966 WARNING: the following render code is outdated and does not work with |
|
967 current Render.pas ! - don't just uncomment without fixing it first |
|
968 |
|
969 glDisable(GL_TEXTURE_2D); |
|
970 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
|
971 if (WorldEdge = weWrap) or (worldEdge = weBounce) then |
|
972 glColor4ub($00, $00, $00, $40) |
|
973 else |
|
974 begin |
|
975 glEnableClientState(GL_COLOR_ARRAY); |
|
976 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldFade[0]); |
|
977 end; |
|
978 |
|
979 glPushMatrix; |
|
980 glTranslatef(WorldDx, WorldDy, 0); |
|
981 |
|
982 VertexBuffer[0].X:= leftX-20; |
|
983 VertexBuffer[0].Y:= -3500; |
|
984 VertexBuffer[1].X:= leftX-20; |
|
985 VertexBuffer[1].Y:= cWaterLine+cVisibleWater; |
|
986 VertexBuffer[2].X:= leftX+30; |
|
987 VertexBuffer[2].Y:= cWaterLine+cVisibleWater; |
|
988 VertexBuffer[3].X:= leftX+30; |
|
989 VertexBuffer[3].Y:= -3500; |
|
990 |
|
991 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
992 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
993 |
|
994 VertexBuffer[0].X:= rightX+20; |
|
995 VertexBuffer[1].X:= rightX+20; |
|
996 VertexBuffer[2].X:= rightX-30; |
|
997 VertexBuffer[3].X:= rightX-30; |
|
998 |
|
999 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
1000 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
1001 |
|
1002 glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldEnd[0]); |
|
1003 |
|
1004 VertexBuffer[0].X:= -5000; |
|
1005 VertexBuffer[1].X:= -5000; |
|
1006 VertexBuffer[2].X:= leftX-20; |
|
1007 VertexBuffer[3].X:= leftX-20; |
|
1008 |
|
1009 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
1010 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
1011 |
|
1012 VertexBuffer[0].X:= rightX+5000; |
|
1013 VertexBuffer[1].X:= rightX+5000; |
|
1014 VertexBuffer[2].X:= rightX+20; |
|
1015 VertexBuffer[3].X:= rightX+20; |
|
1016 |
|
1017 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
1018 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
1019 |
|
1020 glPopMatrix; |
|
1021 glDisableClientState(GL_COLOR_ARRAY); |
|
1022 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
1023 |
|
1024 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
|
1025 glEnable(GL_TEXTURE_2D); |
|
1026 |
|
1027 // I'd still like to have things happen to the border when a wrap or bounce just occurred, based on a timer |
|
1028 if WorldEdge = weBounce then |
|
1029 begin |
|
1030 // could maybe alternate order of these on a bounce, or maybe drop the outer ones. |
|
1031 if LeftImpactTimer mod 2 = 0 then |
|
1032 begin |
|
1033 c1:= $5454FFFF; c2:= $FFFFFFFF; |
|
1034 end |
|
1035 else begin |
|
1036 c1:= $FFFFFFFF; c2:= $5454FFFF; |
|
1037 end; |
|
1038 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 7.0, c1); |
|
1039 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, c2); |
|
1040 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 3.0, c1); |
|
1041 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 1.0, c2); |
|
1042 if RightImpactTimer mod 2 = 0 then |
|
1043 begin |
|
1044 c1:= $5454FFFF; c2:= $FFFFFFFF; |
|
1045 end |
|
1046 else begin |
|
1047 c1:= $FFFFFFFF; c2:= $5454FFFF; |
|
1048 end; |
|
1049 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 7.0, c1); |
|
1050 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, c2); |
|
1051 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 3.0, c1); |
|
1052 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 1.0, c2) |
|
1053 end |
|
1054 else if WorldEdge = weWrap then |
|
1055 begin |
|
1056 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, $A0, $30, $60, max(50,255-LeftImpactTimer)); |
|
1057 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 2.0, $FF0000FF); |
|
1058 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $A0, $30, $60, max(50,255-RightImpactTimer)); |
|
1059 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 2.0, $FF0000FF); |
|
1060 end |
|
1061 else |
|
1062 begin |
|
1063 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, $2E8B5780); |
|
1064 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $2E8B5780) |
|
1065 end; |
|
1066 if LeftImpactTimer > Lag then dec(LeftImpactTimer,Lag) else LeftImpactTimer:= 0; |
|
1067 if RightImpactTimer > Lag then dec(RightImpactTimer,Lag) else RightImpactTimer:= 0 |
|
1068 *) |
|
1069 end; |
958 end; |
1070 end; |
959 end; |
1071 |
960 |
1072 |
961 |
1073 procedure RenderTeamsHealth; |
962 procedure RenderTeamsHealth; |
2202 if isCursorVisible then |
2091 if isCursorVisible then |
2203 exit; |
2092 exit; |
2204 amount:= Max(1, round(amount*zoom/2)); |
2093 amount:= Max(1, round(amount*zoom/2)); |
2205 WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); |
2094 WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); |
2206 WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); |
2095 WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); |
2207 //CursorPoint.X:= CursorPoint.X - amount + LongInt(random(1 + amount * 2)); |
|
2208 //CursorPoint.Y:= CursorPoint.Y - amount + LongInt(random(1 + amount * 2)) |
|
2209 end; |
2096 end; |
2210 |
2097 |
2211 |
2098 |
2212 procedure onFocusStateChanged; |
2099 procedure onFocusStateChanged; |
2213 begin |
2100 begin |