浏览代码

- fixed #1220 and #1218
- vcmibuilder will correctly install campaign video

Ivan Savenko 12 年之前
父节点
当前提交
9c1c337a3d
共有 5 个文件被更改,包括 20 次插入12 次删除
  1. 3 0
      client/CVideoHandler.cpp
  2. 1 1
      client/GUIClasses.cpp
  3. 13 9
      client/UIFramework/CIntObjectClasses.cpp
  4. 1 0
      config/filesystem.json
  5. 2 2
      vcmibuilder

+ 3 - 0
client/CVideoHandler.cpp

@@ -627,7 +627,10 @@ bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
 	ResourceID resource(std::string("Video/") + fname, EResType::VIDEO);
 
 	if (!CResourceHandler::get()->existsResource(resource))
+	{
+		tlog0 << "Error: video " << resource.getName() << " was not found\n";
 		return false;
+	}
 
 	data = CResourceHandler::get()->load(resource);
 

+ 1 - 1
client/GUIClasses.cpp

@@ -3734,7 +3734,7 @@ void CTavernWindow::show(SDL_Surface * to)
 			boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",sel->h->type->heroClass->name);
 		}
 
-		printAtMiddleWBLoc(sel->descr, 146, 389, FONT_SMALL, 200, Colors::WHITE, to);
+		printAtMiddleWBLoc(sel->descr, 146, 395, FONT_SMALL, 200, Colors::WHITE, to);
 		CSDL_Ext::drawBorder(to,sel->pos.x-2,sel->pos.y-2,sel->pos.w+4,sel->pos.h+4,int3(247,223,123));
 	}
 }

+ 13 - 9
client/UIFramework/CIntObjectClasses.cpp

@@ -1217,14 +1217,16 @@ void CTextContainer::blitLine(SDL_Surface *to, Point where, std::string what)
 {
 	const IFont * f = graphics->fonts[font];
 
-	auto renderer = &IFont::renderTextLeft;
+	if (alignment == CENTER)
+	{
+		where.x -= f->getStringWidth(what) / 2;
+		where.y -= f->getLineHeight() / 2;
+	}
 
-	switch (alignment)
+	if (alignment == BOTTOMRIGHT)
 	{
-	break; case TOPLEFT:     renderer = &IFont::renderTextLeft;
-	break; case CENTER:      renderer = &IFont::renderTextCenter;
-	break; case BOTTOMRIGHT: renderer = &IFont::renderTextRight;
-	break; default: assert(0);
+		where.x -= f->getStringWidth(what);
+		where.y -= f->getLineHeight();
 	}
 
 	size_t begin = 0;
@@ -1238,12 +1240,14 @@ void CTextContainer::blitLine(SDL_Surface *to, Point where, std::string what)
 		if (begin != end)
 		{
 			std::string toPrint = what.substr(begin, end-1);
+
 			if (currDelimeter % 2) // Enclosed in {} text - set to yellow
-				(graphics->fonts[font]->*renderer)(to, toPrint, Colors::YELLOW, where);
+				f->renderTextLeft(to, toPrint, Colors::YELLOW, where);
 			else // Non-enclosed text
-				(graphics->fonts[font]->*renderer)(to, toPrint, color, where);
+				f->renderTextLeft(to, toPrint, color, where);
 			begin = end;
-			where.x += f->getStringWidth(toPrint.c_str());
+
+			where.x += f->getStringWidth(toPrint);
 		}
 		currDelimeter++;
 	}

+ 1 - 0
config/filesystem.json

@@ -36,6 +36,7 @@
 		"VIDEO/":
 		[
 			{"type" : "vid", "path" : "ALL/Data/H3ab_ahd.vid"},
+			{"type" : "vid", "path" : "ALL/Data/Heroes3.vid"},
 			{"type" : "vid", "path" : "ALL/Data/video.vid"},
 			// Location of video files in linux release
 			{"type" : "dir",  "path" : "ALL/Data/Video"}

+ 2 - 2
vcmibuilder

@@ -201,10 +201,10 @@ then
 
 	if [ -d "$cd2_dir"/heroes3 ]
 	then
-		cp "$cd2_dir"/heroes3/Data/Heroes3.vid "$dest_dir"/Data/VIDEO.VID
+		cp "$cd2_dir"/heroes3/Data/Heroes3.vid "$dest_dir"/Data/Heroes3.vid
 		cp "$cd2_dir"/heroes3/Data/Heroes3.snd "$dest_dir"/Data/Heroes3-cd2.snd
 	else
-		cp "$cd2_dir"/Heroes3/Data/Heroes3.vid "$dest_dir"/Data/VIDEO.VID
+		cp "$cd2_dir"/Heroes3/Data/Heroes3.vid "$dest_dir"/Data/Heroes3.vid
 		cp "$cd2_dir"/Heroes3/Data/Heroes3.snd "$dest_dir"/Data/Heroes3-cd2.snd
 	fi
 fi