updated lua loading in the ifrontend and also fixed masked maps
authorkoda
Thu, 30 Sep 2010 22:31:38 +0200
changeset 3920 a54ca6185307
parent 3919 76d5b32758d9
child 3921 022dfe1431b7
updated lua loading in the ifrontend and also fixed masked maps
hedgewars/uLand.pas
project_files/HedgewarsMobile/Classes/MapConfigViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/hedgewars/uLand.pas	Thu Sep 30 18:38:45 2010 +0200
+++ b/hedgewars/uLand.pas	Thu Sep 30 22:31:38 2010 +0200
@@ -1125,12 +1125,15 @@
 // 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.
 // I would just like to play with it with my friends if you do not mind.
 // Can allow for amusing maps.
-procedure LoadMask;
+procedure LoadMask(mapName: shortstring);
 var tmpsurf: PSDL_Surface;
     p: PLongwordArray;
     x, y, cpX, cpY: Longword;
 begin
     tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps);
+    if (tmpsurf = nil) and (mapName <> '') then
+        tmpsurf:= LoadImage(Pathz[ptMissionMaps] + '/' + mapName +'/mask', ifAlpha or ifTransparent or ifIgnoreCaps);
+
     if (tmpsurf <> nil) and (tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT) and (tmpsurf^.format^.BytesPerPixel = 4) then
     begin
         cpX:= (LAND_WIDTH - tmpsurf^.w) div 2;
@@ -1165,7 +1168,7 @@
 var tmpsurf: PSDL_Surface;
     s: shortstring;
     f: textfile;
-    mapName: shortstring;
+    mapName: shortstring = '';
 begin
 isMap:= true;
 WriteLnToConsole('Loading land from file...');
@@ -1211,7 +1214,7 @@
     tmpsurf);
 SDL_FreeSurface(tmpsurf);
 
-LoadMask;
+LoadMask(mapname);
 end;
 
 procedure GenMap;
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Thu Sep 30 18:38:45 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Thu Sep 30 22:31:38 2010 +0200
@@ -175,7 +175,7 @@
     if (scIndex != 3)
         self.missionCommand = @"";
     else
-        self.missionCommand = [NSString stringWithFormat:@"escript %@/%@/map.lua",MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
+        self.missionCommand = [NSString stringWithFormat:@"escript Missions/Maps/%@/map.lua",[source objectAtIndex:index]];
 }
 
 #pragma mark -
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Thu Sep 30 18:38:45 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Thu Sep 30 22:31:38 2010 +0200
@@ -1444,7 +1444,7 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		1D6058900D05DD3D006BFB54 /* Hedgewars */ = {
+		1D6058900D05DD3D006BFB54 /* Test Lua */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Hedgewars" */;
 			buildPhases = (
@@ -1528,7 +1528,7 @@
 			);
 			projectRoot = "";
 			targets = (
-				1D6058900D05DD3D006BFB54 /* Hedgewars */,
+				1D6058900D05DD3D006BFB54 /* Test Lua */,
 				928301160F10CAFC00CC5A3C /* fpc */,
 				6179928B114AE0C800BA94A9 /* UpdateDataFolder */,
 			);