hedgewars/uLand.pas
changeset 3519 56cbc035b74b
parent 3513 f589230fa21b
child 3526 a1d2180fef42
equal deleted inserted replaced
3518:772b37c9c3ba 3519:56cbc035b74b
   559     i: Longword;
   559     i: Longword;
   560     y, x: Longword;
   560     y, x: Longword;
   561 begin
   561 begin
   562 for y:= 0 to LAND_HEIGHT - 1 do
   562 for y:= 0 to LAND_HEIGHT - 1 do
   563     for x:= 0 to LAND_WIDTH - 1 do
   563     for x:= 0 to LAND_WIDTH - 1 do
   564         Land[y, x]:= LAND_BASIC;
   564         Land[y, x]:= lfBasic;
   565 
   565 
   566 {$HINTS OFF}
   566 {$HINTS OFF}
   567 SetPoints(Template, pa);
   567 SetPoints(Template, pa);
   568 {$HINTS ON}
   568 {$HINTS ON}
   569 for i:= 1 to Template.BezierizeCount do
   569 for i:= 1 to Template.BezierizeCount do
   580 with Template do
   580 with Template do
   581      for i:= 0 to pred(FillPointsCount) do
   581      for i:= 0 to pred(FillPointsCount) do
   582          with FillPoints^[i] do
   582          with FillPoints^[i] do
   583               FillLand(x, y);
   583               FillLand(x, y);
   584 
   584 
   585 DrawEdge(pa, LAND_BASIC);
   585 DrawEdge(pa, lfBasic);
   586 
   586 
   587 MaxHedgehogs:= Template.MaxHedgehogs;
   587 MaxHedgehogs:= Template.MaxHedgehogs;
   588 hasGirders:= Template.hasGirders;
   588 hasGirders:= Template.hasGirders;
   589 playHeight:= Template.TemplateHeight;
   589 playHeight:= Template.TemplateHeight;
   590 playWidth:= Template.TemplateWidth;
   590 playWidth:= Template.TemplateWidth;
   603             if (y < topY) or (x < leftX) or (x > rightX) then
   603             if (y < topY) or (x < leftX) or (x > rightX) then
   604                 Land[y, x]:= 0
   604                 Land[y, x]:= 0
   605             else
   605             else
   606             begin
   606             begin
   607                if Land[y, x] = 0 then
   607                if Land[y, x] = 0 then
   608                    Land[y, x]:= LAND_BASIC
   608                    Land[y, x]:= lfBasic
   609                else if Land[y, x] = LAND_BASIC then
   609                else if Land[y, x] = lfBasic then
   610                    Land[y, x]:= 0;
   610                    Land[y, x]:= 0;
   611             end;
   611             end;
   612     end;
   612     end;
   613 end;
   613 end;
   614 
   614 
   976     for y := 0 to off_y - 1 do
   976     for y := 0 to off_y - 1 do
   977         Land[y, x] := 0;
   977         Land[y, x] := 0;
   978 
   978 
   979 for x := 0 to playWidth do
   979 for x := 0 to playWidth do
   980     for y := off_y to LAND_HEIGHT - 1 do
   980     for y := off_y to LAND_HEIGHT - 1 do
   981         Land[y, x] := LAND_BASIC;
   981         Land[y, x] := lfBasic;
   982 
   982 
   983 for y := 0 to num_cells_y - 1 do
   983 for y := 0 to num_cells_y - 1 do
   984     for x := 0 to num_cells_x - 1 do
   984     for x := 0 to num_cells_x - 1 do
   985         maze[x, y] := false;
   985         maze[x, y] := false;
   986 
   986 
  1077 if maze_inverted then
  1077 if maze_inverted then
  1078     FillLand(1, 1+off_y)
  1078     FillLand(1, 1+off_y)
  1079 else
  1079 else
  1080 begin
  1080 begin
  1081     x := 0;
  1081     x := 0;
  1082     while Land[cellsize div 2 + cellsize + off_y, x] = LAND_BASIC do
  1082     while Land[cellsize div 2 + cellsize + off_y, x] = lfBasic do
  1083         x := x + 1;
  1083         x := x + 1;
  1084     while Land[cellsize div 2 + cellsize + off_y, x] = 0 do
  1084     while Land[cellsize div 2 + cellsize + off_y, x] = 0 do
  1085         x := x + 1;
  1085         x := x + 1;
  1086     FillLand(x+1, cellsize div 2 + cellsize + off_y);
  1086     FillLand(x+1, cellsize div 2 + cellsize + off_y);
  1087 end;
  1087 end;
  1163                 for x:= 0 to Pred(tmpsurf^.w) do
  1163                 for x:= 0 to Pred(tmpsurf^.w) do
  1164                 begin
  1164                 begin
  1165                     if ((AMask and p^[x]) = 0) then  // Tiy was having trouble generating transparent black
  1165                     if ((AMask and p^[x]) = 0) then  // Tiy was having trouble generating transparent black
  1166                         Land[cpY + y, cpX + x]:= 0
  1166                         Land[cpY + y, cpX + x]:= 0
  1167                     else if p^[x] = (AMask or RMask) then
  1167                     else if p^[x] = (AMask or RMask) then
  1168                         Land[cpY + y, cpX + x]:= LAND_INDESTRUCTIBLE
  1168                         Land[cpY + y, cpX + x]:= lfIndestructible
  1169                     else if p^[x] = $FFFFFFFF then
  1169                     else if p^[x] = $FFFFFFFF then
  1170                         Land[cpY + y, cpX + x]:= LAND_BASIC;
  1170                         Land[cpY + y, cpX + x]:= lfBasic;
  1171                 end;
  1171                 end;
  1172                 p:= @(p^[tmpsurf^.pitch div 4]);
  1172                 p:= @(p^[tmpsurf^.pitch div 4]);
  1173             end;
  1173             end;
  1174 
  1174 
  1175         if SDL_MustLock(tmpsurf) then
  1175         if SDL_MustLock(tmpsurf) then
  1259 if hasBorder then
  1259 if hasBorder then
  1260     begin
  1260     begin
  1261     for y:= 0 to LAND_HEIGHT - 1 do
  1261     for y:= 0 to LAND_HEIGHT - 1 do
  1262         for x:= 0 to LAND_WIDTH - 1 do
  1262         for x:= 0 to LAND_WIDTH - 1 do
  1263             if (y < topY) or (x < leftX) or (x > rightX) then
  1263             if (y < topY) or (x < leftX) or (x > rightX) then
  1264                 Land[y, x]:= LAND_INDESTRUCTIBLE;
  1264                 Land[y, x]:= lfIndestructible;
  1265     // experiment hardcoding cave
  1265     // experiment hardcoding cave
  1266     // also try basing cave dimensions on map/template dimensions, if they exist
  1266     // also try basing cave dimensions on map/template dimensions, if they exist
  1267     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
  1267     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
  1268         begin
  1268         begin
  1269         for y:= topY to LAND_HEIGHT - 1 do
  1269         for y:= topY to LAND_HEIGHT - 1 do
  1270             begin
  1270             begin
  1271             Land[y, leftX + w]:= LAND_INDESTRUCTIBLE;
  1271             Land[y, leftX + w]:= lfIndestructible;
  1272             Land[y, rightX - w]:= LAND_INDESTRUCTIBLE;
  1272             Land[y, rightX - w]:= lfIndestructible;
  1273             if (y + w) mod 32 < 16 then
  1273             if (y + w) mod 32 < 16 then
  1274                 c:= AMask
  1274                 c:= AMask
  1275             else
  1275             else
  1276                 c:= AMask or RMask or GMask; // FF00FFFF
  1276                 c:= AMask or RMask or GMask; // FF00FFFF
  1277 {$IFDEF DOWNSCALE}
  1277 {$IFDEF DOWNSCALE}
  1283 {$ENDIF}
  1283 {$ENDIF}
  1284             end;
  1284             end;
  1285 
  1285 
  1286         for x:= leftX to rightX do
  1286         for x:= leftX to rightX do
  1287             begin
  1287             begin
  1288             Land[topY + w, x]:= LAND_INDESTRUCTIBLE;
  1288             Land[topY + w, x]:= lfIndestructible;
  1289             if (x + w) mod 32 < 16 then
  1289             if (x + w) mod 32 < 16 then
  1290                 c:= AMask
  1290                 c:= AMask
  1291             else
  1291             else
  1292                 c:= AMask or RMask or GMask; // FF00FFFF
  1292                 c:= AMask or RMask or GMask; // FF00FFFF
  1293 {$IFDEF DOWNSCALE}
  1293 {$IFDEF DOWNSCALE}