hedgewars/uLand.pas
changeset 3920 a54ca6185307
parent 3912 e11df2de6af2
child 3936 0b982d340633
equal deleted inserted replaced
3919:76d5b32758d9 3920:a54ca6185307
  1123 // This is a function that Tiy assures me would not be good for gameplay.
  1123 // This is a function that Tiy assures me would not be good for gameplay.
  1124 // It allows the setting of arbitrary portions of landscape as indestructible, or regular, or even blank.
  1124 // It allows the setting of arbitrary portions of landscape as indestructible, or regular, or even blank.
  1125 // He said I could add it here only when I swore it would not impact gameplay.  Which, as far as I can tell, is true.
  1125 // He said I could add it here only when I swore it would not impact gameplay.  Which, as far as I can tell, is true.
  1126 // I would just like to play with it with my friends if you do not mind.
  1126 // I would just like to play with it with my friends if you do not mind.
  1127 // Can allow for amusing maps.
  1127 // Can allow for amusing maps.
  1128 procedure LoadMask;
  1128 procedure LoadMask(mapName: shortstring);
  1129 var tmpsurf: PSDL_Surface;
  1129 var tmpsurf: PSDL_Surface;
  1130     p: PLongwordArray;
  1130     p: PLongwordArray;
  1131     x, y, cpX, cpY: Longword;
  1131     x, y, cpX, cpY: Longword;
  1132 begin
  1132 begin
  1133     tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps);
  1133     tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps);
       
  1134     if (tmpsurf = nil) and (mapName <> '') then
       
  1135         tmpsurf:= LoadImage(Pathz[ptMissionMaps] + '/' + mapName +'/mask', ifAlpha or ifTransparent or ifIgnoreCaps);
       
  1136 
  1134     if (tmpsurf <> nil) and (tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT) and (tmpsurf^.format^.BytesPerPixel = 4) then
  1137     if (tmpsurf <> nil) and (tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT) and (tmpsurf^.format^.BytesPerPixel = 4) then
  1135     begin
  1138     begin
  1136         cpX:= (LAND_WIDTH - tmpsurf^.w) div 2;
  1139         cpX:= (LAND_WIDTH - tmpsurf^.w) div 2;
  1137         cpY:= LAND_HEIGHT - tmpsurf^.h;
  1140         cpY:= LAND_HEIGHT - tmpsurf^.h;
  1138         if SDL_MustLock(tmpsurf) then
  1141         if SDL_MustLock(tmpsurf) then
  1163 
  1166 
  1164 procedure LoadMap;
  1167 procedure LoadMap;
  1165 var tmpsurf: PSDL_Surface;
  1168 var tmpsurf: PSDL_Surface;
  1166     s: shortstring;
  1169     s: shortstring;
  1167     f: textfile;
  1170     f: textfile;
  1168     mapName: shortstring;
  1171     mapName: shortstring = '';
  1169 begin
  1172 begin
  1170 isMap:= true;
  1173 isMap:= true;
  1171 WriteLnToConsole('Loading land from file...');
  1174 WriteLnToConsole('Loading land from file...');
  1172 AddProgress;
  1175 AddProgress;
  1173 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', ifAlpha or ifTransparent or ifIgnoreCaps);
  1176 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', ifAlpha or ifTransparent or ifIgnoreCaps);
  1209     LAND_HEIGHT - tmpsurf^.h,
  1212     LAND_HEIGHT - tmpsurf^.h,
  1210     tmpsurf^.w,
  1213     tmpsurf^.w,
  1211     tmpsurf);
  1214     tmpsurf);
  1212 SDL_FreeSurface(tmpsurf);
  1215 SDL_FreeSurface(tmpsurf);
  1213 
  1216 
  1214 LoadMask;
  1217 LoadMask(mapname);
  1215 end;
  1218 end;
  1216 
  1219 
  1217 procedure GenMap;
  1220 procedure GenMap;
  1218 var x, y, w, c: Longword;
  1221 var x, y, w, c: Longword;
  1219 begin
  1222 begin