Parcourir la source

In config file, for adventure map, replaced tilesWidth, tilesHeight, trimX and trimY with width and height. Let VCMI do the right calculations.

Frank Zago il y a 16 ans
Parent
commit
e5203db83c
4 fichiers modifiés avec 15 ajouts et 14 suppressions
  1. 9 6
      client/CAdvmapInterface.cpp
  2. 2 4
      client/CConfigHandler.cpp
  3. 1 1
      client/CConfigHandler.h
  4. 3 3
      config/settings.txt

+ 9 - 6
client/CAdvmapInterface.cpp

@@ -55,8 +55,11 @@ CMinimap::CMinimap(bool draw)
 	pos.h=ADVOPT.minimapW;//144
 	pos.w=ADVOPT.minimapH;//144
 
-	int rx = (((float)ADVOPT.tilesW)/(mapSizes.x))*((float)pos.w),
-		ry = (((float)ADVOPT.tilesH)/(mapSizes.y))*((float)pos.h);
+	const int tilesw=(ADVOPT.advmapW+31)/32;
+	const int tilesh=(ADVOPT.advmapH+31)/32;
+
+	int rx = (((float)tilesw)/(mapSizes.x))*((float)pos.w),
+		ry = (((float)tilesh)/(mapSizes.y))*((float)pos.h);
 
 	radar = newSurface(rx,ry);
 	temps = newSurface(pos.w,pos.h);
@@ -374,12 +377,12 @@ void CMinimap::hideTile(const int3 &pos)
 CTerrainRect::CTerrainRect()
 	:currentPath(NULL)
 {
-	tilesw=ADVOPT.tilesW;
-	tilesh=ADVOPT.tilesH;
+	tilesw=(ADVOPT.advmapW+31)/32;
+	tilesh=(ADVOPT.advmapH+31)/32;
 	pos.x=ADVOPT.advmapX;
 	pos.y=ADVOPT.advmapY;
-	pos.w=tilesw*32 - ADVOPT.advmapTrimX;
-	pos.h=tilesh*32 - ADVOPT.advmapTrimY;
+	pos.w=ADVOPT.advmapW;
+	pos.h=ADVOPT.advmapH;
 	moveX = moveY = 0;
 	arrows = CDefHandler::giveDef("ADAG.DEF");
 	for(size_t y=0; y < arrows->ourImages.size(); ++y)

+ 2 - 4
client/CConfigHandler.cpp

@@ -235,10 +235,8 @@ struct SettingsGrammar : public grammar<SettingsGrammar>
 						*(	
 							(   "x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapX)]
 							  | "y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapY)]
-							  | "trimX=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapTrimX)]
-							  | "trimY=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapTrimY)]
-							  | "tilesWidth=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tilesW)]
-							  | "tilesHeight=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tilesH)]
+							  | "width=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapW)]
+							  | "height=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapH)]
 							  | "smoothMove=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::smoothMove)]
 							) 
 						 )

+ 1 - 1
client/CConfigHandler.h

@@ -42,7 +42,7 @@ namespace config
 		//infobox
 		int infoboxX, infoboxY;
 		//advmap
-		int tilesW, tilesH, advmapX, advmapY, advmapTrimX, advmapTrimY;
+		int advmapX, advmapY, advmapW, advmapH;
 		bool smoothMove;
 		//general properties
 		std::string mainGraphic;

+ 3 - 3
config/settings.txt

@@ -16,7 +16,7 @@ GUISettings
 	{
 		AdventureMap
 		{
-			AdvMap: x=7 y=6 tilesWidth=19 tilesHeight=18 trimX=15 trimY=29 smoothMove=1;
+			AdvMap: x=7 y=6 width=593 height=547 smoothMove=1;
 			InfoBox: x=605 y=389;
 			gem0: x=6 y=508 graphic=agemLL.def;
 			gem1: x=556 y=508 graphic=agemLR.def;
@@ -44,7 +44,7 @@ GUISettings
 	{
 		AdventureMap
 		{
-			AdvMap: x=7 y=6 tilesWidth=26 tilesHeight=18 trimX=15 trimY=29 smoothMove=1;
+			AdvMap: x=7 y=6 width=817 height=547 smoothMove=1;
 			InfoBox: x=829 y=389;
 		 	gem0: x=6 y=508 graphic=agemLL.def;
 			gem1: x=780 y=508 graphic=agemLR.def;
@@ -73,7 +73,7 @@ GUISettings
 	{
 		AdventureMap
 		{
-			AdvMap: x=7 y=6 tilesWidth=26 tilesHeight=23 trimX=15 trimY=20 smoothMove=1;
+			AdvMap: x=7 y=6 width=817 height=715 smoothMove=1;
 			InfoBox: x=829 y=557;
 			gem0: x=6 y=676 graphic=agemLL.def;
 			gem1: x=780 y=676 graphic=agemLR.def;