hedgewars/uWorld.pas
changeset 9481 fbf61ef67c7b
parent 9479 167dea42d7d7
child 9485 3dee8a3b0406
equal deleted inserted replaced
9479:167dea42d7d7 9481:fbf61ef67c7b
  1127     tdx, tdy: Double;
  1127     tdx, tdy: Double;
  1128     s: shortstring;
  1128     s: shortstring;
  1129     highlight: Boolean;
  1129     highlight: Boolean;
  1130     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
  1130     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
  1131     VertexBuffer: array [0..3] of TVertex2f;
  1131     VertexBuffer: array [0..3] of TVertex2f;
       
  1132     lw, lh: GLfloat;
       
  1133     WorldEnd, WorldFade : array[0..3] of HwColor4f;
  1132 begin
  1134 begin
  1133 if (cReducedQuality and rqNoBackground) = 0 then
  1135 if (cReducedQuality and rqNoBackground) = 0 then
  1134     begin
  1136     begin
  1135         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
  1137         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
  1136         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1138         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1236 {$WARNINGS ON}
  1238 {$WARNINGS ON}
  1237 
  1239 
  1238 if WorldEdge <> weNone then
  1240 if WorldEdge <> weNone then
  1239     begin
  1241     begin
  1240 (* 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. *)
  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 
       
  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);
       
  1254     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
       
  1255     glEnableClientState(GL_COLOR_ARRAY);
       
  1256 
       
  1257     glPushMatrix;
       
  1258     glTranslatef(WorldDx, WorldDy, 0);
       
  1259     glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldFade[0]);
       
  1260 
       
  1261     VertexBuffer[0].X:= leftX-120;
       
  1262     VertexBuffer[0].Y:= -3000;
       
  1263     VertexBuffer[1].X:= leftX-120;
       
  1264     VertexBuffer[1].Y:= cWaterLine+cVisibleWater;
       
  1265     VertexBuffer[2].X:= leftX-70;
       
  1266     VertexBuffer[2].Y:= cWaterLine+cVisibleWater;
       
  1267     VertexBuffer[3].X:= leftX-70;
       
  1268     VertexBuffer[3].Y:= -3000;
       
  1269 
       
  1270     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1271     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1272 
       
  1273     VertexBuffer[0].X:= rightX+120;
       
  1274     VertexBuffer[1].X:= rightX+120;
       
  1275     VertexBuffer[2].X:= rightX+70;
       
  1276     VertexBuffer[3].X:= rightX+70;
       
  1277 
       
  1278     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1279     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1280 
       
  1281     glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldEnd[0]);
       
  1282 
       
  1283     VertexBuffer[0].X:= -5000;
       
  1284     VertexBuffer[1].X:= -5000;
       
  1285     VertexBuffer[2].X:= leftX-120;
       
  1286     VertexBuffer[3].X:= leftX-120;
       
  1287 
       
  1288     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1289     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1290 
       
  1291     VertexBuffer[0].X:= rightX+5000;
       
  1292     VertexBuffer[1].X:= rightX+5000;
       
  1293     VertexBuffer[2].X:= rightX+120;
       
  1294     VertexBuffer[3].X:= rightX+120;
       
  1295 
       
  1296     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1297     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1298 
       
  1299     glPopMatrix;
       
  1300     glDisableClientState(GL_COLOR_ARRAY);
       
  1301     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
       
  1302 
       
  1303     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);
       
  1305 
  1241     DrawLine(leftX-100, -3000, leftX-100, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
  1306     DrawLine(leftX-100, -3000, leftX-100, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
  1242     DrawLine(rightX+100, -3000, rightX+100, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF)
  1307     DrawLine(rightX+100, -3000, rightX+100, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
  1243     end;
  1308     end;
  1244 
  1309 
  1245 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1310 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1246 SetScale(cDefaultZoomLevel);
  1311 SetScale(cDefaultZoomLevel);
  1247 
  1312