equal
deleted
inserted
replaced
34 procedure GenMap; |
34 procedure GenMap; |
35 function GenPreview: TPreview; |
35 function GenPreview: TPreview; |
36 |
36 |
37 implementation |
37 implementation |
38 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils, |
38 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils, |
39 uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted; |
39 uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted, uTextures; |
40 |
40 |
41 operator=(const a, b: direction) c: Boolean; |
41 operator=(const a, b: direction) c: Boolean; |
42 begin |
42 begin |
43 c := (a.x = b.x) and (a.y = b.y); |
43 c := (a.x = b.x) and (a.y = b.y); |
44 end; |
44 end; |
300 SDL_FreeSurface(tmpsurf); |
300 SDL_FreeSurface(tmpsurf); |
301 |
301 |
302 // freed in freeModule() below |
302 // freed in freeModule() below |
303 LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
303 LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
304 if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
304 if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
|
305 if (LandBackSurface <> nil) and cGrayScale then Surface2GrayScale(LandBackSurface); |
305 |
306 |
306 tmpsurf:= LoadImage(UserPathz[ptCurrTheme] + '/Border', ifIgnoreCaps or ifTransparent); |
307 tmpsurf:= LoadImage(UserPathz[ptCurrTheme] + '/Border', ifIgnoreCaps or ifTransparent); |
307 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
308 if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
308 for x:= 0 to LAND_WIDTH - 1 do |
309 for x:= 0 to LAND_WIDTH - 1 do |
309 begin |
310 begin |
853 end; |
854 end; |
854 |
855 |
855 end; |
856 end; |
856 |
857 |
857 begin |
858 begin |
858 case cMazeSize of |
859 case cTemplateFilter of |
859 0: begin |
860 0: begin |
860 cellsize := small_cell_size; |
861 cellsize := small_cell_size; |
861 maze_inverted := false; |
862 maze_inverted := false; |
862 end; |
863 end; |
863 1: begin |
864 1: begin |
1178 SDL_UnlockSurface(tmpsurf); |
1179 SDL_UnlockSurface(tmpsurf); |
1179 if not disableLandBack then |
1180 if not disableLandBack then |
1180 begin |
1181 begin |
1181 // freed in freeModule() below |
1182 // freed in freeModule() below |
1182 LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
1183 LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
1183 if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent) |
1184 if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
|
1185 if (LandBackSurface <> nil) and cGrayScale then Surface2GrayScale(LandBackSurface) |
1184 end; |
1186 end; |
1185 end; |
1187 end; |
1186 if (tmpsurf <> nil) then |
1188 if (tmpsurf <> nil) then |
1187 SDL_FreeSurface(tmpsurf); |
1189 SDL_FreeSurface(tmpsurf); |
1188 tmpsurf:= nil; |
1190 tmpsurf:= nil; |
1437 var adler, i: LongInt; |
1439 var adler, i: LongInt; |
1438 begin |
1440 begin |
1439 adler:= 1; |
1441 adler:= 1; |
1440 for i:= 0 to LAND_HEIGHT-1 do |
1442 for i:= 0 to LAND_HEIGHT-1 do |
1441 Adler32Update(adler, @Land[i,0], LAND_WIDTH); |
1443 Adler32Update(adler, @Land[i,0], LAND_WIDTH); |
1442 s:= 'M' + IntToStr(adler); |
1444 s:= 'M' + IntToStr(adler) + cScriptName; |
1443 |
1445 |
1444 chLandCheck(s); |
1446 chLandCheck(s); |
1445 SendIPCRaw(@s[0], Length(s) + 1) |
1447 SendIPCRaw(@s[0], Length(s) + 1) |
1446 end; |
1448 end; |
1447 |
1449 |