hedgewars/uLand.pas
changeset 3038 4e48c276a468
parent 3017 4a52e0705011
child 3045 41732f986b4f
equal deleted inserted replaced
3037:ab6e949eb5cb 3038:4e48c276a468
    39     hasGirders: boolean;  
    39     hasGirders: boolean;  
    40     isMap: boolean;  
    40     isMap: boolean;  
    41     playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.
    41     playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.
    42     LandBackSurface: PSDL_Surface;
    42     LandBackSurface: PSDL_Surface;
    43 
    43 
    44 procedure init_uLand;
    44 procedure initModule;
    45 procedure free_uLand;
    45 procedure freeModule;
    46 procedure GenMap;
    46 procedure GenMap;
    47 function  GenPreview: TPreview;
    47 function  GenPreview: TPreview;
    48 procedure CheckLandDigest(s: shortstring);
    48 procedure CheckLandDigest(s: shortstring);
    49 function  LandBackPixel(x, y: LongInt): LongWord;
    49 function  LandBackPixel(x, y: LongInt): LongWord;
    50 
    50 
   340         end;
   340         end;
   341         inc(r.y, tmpsurf^.h)
   341         inc(r.y, tmpsurf^.h)
   342     end;
   342     end;
   343     SDL_FreeSurface(tmpsurf);
   343     SDL_FreeSurface(tmpsurf);
   344 
   344 
   345     // freed in free_uLand() below
   345     // freed in freeModule() below
   346     LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
   346     LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
   347 
   347 
   348     tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent);
   348     tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent);
   349     for x:= 0 to LAND_WIDTH - 1 do
   349     for x:= 0 to LAND_WIDTH - 1 do
   350     begin
   350     begin
   852             end
   852             end
   853         end;
   853         end;
   854 GenPreview:= Preview
   854 GenPreview:= Preview
   855 end;
   855 end;
   856 
   856 
   857 procedure init_uLand;
   857 procedure initModule;
   858 begin
   858 begin
   859     LandBackSurface:= nil;
   859     LandBackSurface:= nil;
   860 end;
   860 end;
   861 
   861 
   862 procedure free_uLand;
   862 procedure freeModule;
   863 begin
   863 begin
   864     FillChar(LandPixels, sizeof(TLandArray), 0);
   864     FillChar(LandPixels, sizeof(TLandArray), 0);
   865     if LandBackSurface <> nil then
   865     if LandBackSurface <> nil then
   866         SDL_FreeSurface(LandBackSurface);
   866         SDL_FreeSurface(LandBackSurface);
   867 end;
   867 end;