1128 s: shortstring; |
1129 s: shortstring; |
1129 highlight: Boolean; |
1130 highlight: Boolean; |
1130 smallScreenOffset, offsetX, offsetY, screenBottom: LongInt; |
1131 smallScreenOffset, offsetX, offsetY, screenBottom: LongInt; |
1131 VertexBuffer: array [0..3] of TVertex2f; |
1132 VertexBuffer: array [0..3] of TVertex2f; |
1132 lw, lh: GLfloat; |
1133 lw, lh: GLfloat; |
1133 WorldEnd, WorldFade : array[0..3] of HwColor4f; |
1134 c1, c2: LongWord; // couple of colours for edges |
1134 begin |
1135 begin |
1135 if (cReducedQuality and rqNoBackground) = 0 then |
1136 if (cReducedQuality and rqNoBackground) = 0 then |
1136 begin |
1137 begin |
1137 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
1138 // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway |
1138 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1139 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine); |
1239 |
1240 |
1240 if WorldEdge <> weNone then |
1241 if WorldEdge <> weNone then |
1241 begin |
1242 begin |
1242 (* 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. *) |
1243 (* 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. *) |
1243 |
1244 |
1244 FillChar(WorldFade, sizeof(WorldFade), 0); |
|
1245 WorldFade[0].a:= 255; |
|
1246 WorldFade[1].a:= 255; |
|
1247 FillChar(WorldEnd, sizeof(WorldEnd), 0); |
|
1248 WorldEnd[0].a:= 255; |
|
1249 WorldEnd[1].a:= 255; |
|
1250 WorldEnd[2].a:= 255; |
|
1251 WorldEnd[3].a:= 255; |
|
1252 |
|
1253 glDisable(GL_TEXTURE_2D); |
1245 glDisable(GL_TEXTURE_2D); |
1254 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
1246 glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
1255 glEnableClientState(GL_COLOR_ARRAY); |
1247 glEnableClientState(GL_COLOR_ARRAY); |
1256 |
1248 |
1257 glPushMatrix; |
1249 glPushMatrix; |
1301 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
1293 glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
1302 |
1294 |
1303 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
1295 glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required |
1304 glEnable(GL_TEXTURE_2D); |
1296 glEnable(GL_TEXTURE_2D); |
1305 |
1297 |
1306 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF); |
1298 // I'd still like to have things happen to the border when a wrap or bounce just occurred, based on a timer |
1307 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF); |
1299 if WorldEdge = weBounce then |
|
1300 begin |
|
1301 // could maybe alternate order of these on a bounce, or maybe drop the outer ones. |
|
1302 if LeftImpactTimer mod 2 = 0 then |
|
1303 begin |
|
1304 c1:= $5454FFFF; c2:= $FFFFFFFF; |
|
1305 end |
|
1306 else begin |
|
1307 c1:= $FFFFFFFF; c2:= $5454FFFF; |
|
1308 end; |
|
1309 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 7.0, c1); |
|
1310 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, c2); |
|
1311 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 3.0, c1); |
|
1312 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 1.0, c2); |
|
1313 if RightImpactTimer mod 2 = 0 then |
|
1314 begin |
|
1315 c1:= $5454FFFF; c2:= $FFFFFFFF; |
|
1316 end |
|
1317 else begin |
|
1318 c1:= $FFFFFFFF; c2:= $5454FFFF; |
|
1319 end; |
|
1320 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 7.0, c1); |
|
1321 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, c2); |
|
1322 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 3.0, c1); |
|
1323 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 1.0, c2) |
|
1324 end |
|
1325 else if WorldEdge = weWrap then |
|
1326 begin |
|
1327 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, $A0, $30, $60, max(50,255-LeftImpactTimer)); |
|
1328 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 2.0, $FF0000FF); |
|
1329 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $A0, $30, $60, max(50,255-RightImpactTimer)); |
|
1330 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 2.0, $FF0000FF); |
|
1331 end |
|
1332 else |
|
1333 begin |
|
1334 DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 5.0, $2E8B5780); |
|
1335 DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 5.0, $2E8B5780) |
|
1336 end; |
|
1337 if LeftImpactTimer > Lag then dec(LeftImpactTimer,Lag) else LeftImpactTimer:= 0; |
|
1338 if RightImpactTimer > Lag then dec(RightImpactTimer,Lag) else RightImpactTimer:= 0 |
1308 end; |
1339 end; |
1309 |
1340 |
1310 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1341 // this scale is used to keep the various widgets at the same dimension at all zoom levels |
1311 SetScale(cDefaultZoomLevel); |
1342 SetScale(cDefaultZoomLevel); |
1312 |
1343 |