Browse Source

- fixed #762
- (linux) fixed video in campaigns menu

Ivan Savenko 14 years ago
parent
commit
5d2f5c2e33
4 changed files with 13 additions and 23 deletions
  1. 4 8
      client/AdventureMapButton.cpp
  2. 0 1
      client/AdventureMapButton.h
  3. 6 8
      client/CPreGame.cpp
  4. 3 6
      lib/CGameInterface.cpp

+ 4 - 8
client/AdventureMapButton.cpp

@@ -65,8 +65,10 @@ void CButtonBase::update()
 	
 	if (active)
 	{
-		showAll(screen);
-		showAll(screen2);//Any way to remove one of showAll()?
+		if (parent)
+			parent->redraw();
+		else
+			redraw();
 	}
 }
 
@@ -259,7 +261,6 @@ void AdventureMapButton::setImage(CAnimation* anim, bool playerColoredButton)
 
 	pos.w = image->pos.w;
 	pos.h = image->pos.h;
-	
 }
 
 void AdventureMapButton::setPlayerColor(int player)
@@ -268,11 +269,6 @@ void AdventureMapButton::setPlayerColor(int player)
 	image->playerColored(player);
 }
 
-void AdventureMapButton::show(SDL_Surface *to)
-{
-	showAll(to);
-}
-
 void AdventureMapButton::showAll(SDL_Surface *to)
 {
 	CIntObject::showAll(to);

+ 0 - 1
client/AdventureMapButton.h

@@ -91,7 +91,6 @@ public:
 	void setIndex(size_t index, bool playerColoredButton=false);
 	void setImage(CAnimation* anim, bool playerColoredButton=false);
 	void setPlayerColor(int player);
-	void show(SDL_Surface *to);
 	void showAll(SDL_Surface *to);
 };
 

+ 6 - 8
client/CPreGame.cpp

@@ -272,13 +272,13 @@ CMenuScreen::~CMenuScreen()
 void CMenuScreen::showAll( SDL_Surface * to )
 {
 	blitAt(CGP->mainbg, 0, 0, to);
-	CCS->videoh->update(pos.x + 8, pos.y + 105, to, true, false);
 	CIntObject::showAll(to);
 }
 
 void CMenuScreen::show( SDL_Surface * to )
 {
-	showAll(to);
+	CCS->videoh->update(pos.x + 8, pos.y + 105, to, true, false);
+	CIntObject::show(to);
 }
 
 void CMenuScreen::moveTo( CMenuScreen *next )
@@ -3375,10 +3375,12 @@ CCampaignScreen::CCampaignScreen(CampaignSet campaigns, std::map<std::string, Ca
 	static const std::string campImages[3][7] = { { "CAMPGD1S.BMP", "CAMPEV1S.BMP", "CAMPGD2S.BMP", "CAMPNEUS.BMP", "CAMPEV2S.BMP", "CAMPGD3S.BMP", "CAMPSCTS.BMP" }, 
 												  { "CAMP1AB7.BMP", "CAMP1DB2.BMP", "CAMP1DS1.BMP", "CAMP1FL3.BMP", "CAMP1PF2.BMP", "CAMP1FW1.BMP" },
 												  { "CAMPZ01.BMP", "CAMPZ02.BMP", "CAMPZ03.BMP", "CAMPZ04.BMP" } };
-
+#ifdef _WIN32
 	static const std::string campVideos[3][7] = { { "CGOOD1.BIK", "CEVIL1.BIK", "CGOOD2.BIK", "CNEUTRAL.BIK", "CEVIL2.BIK", "CGOOD3.BIK", "CSECRET.BIK" },
 												  { "C1ab7.BIK", "C1db2.BIK", "C1ds1.BIK", "C1fl3.BIK", "C1pf2.BIK", "C1fw1.BIK" } };
-
+#else
+	static const std::string campVideos[3][7] = { { "cgood1.mjpg", "cevil1.mjpg", "cgood2.mjpg", "cneutral.mjpg", "cevil2.mjpg", "cgood3.mjpg", "csecret.mjpg" } };
+#endif
 	static const std::string campTexts[3][7] = { { getMapText(0), getMapText(3), getMapText(1), getMapText(5), getMapText(4), getMapText(2), getMapText(6) },
 												 { "Armageddon's Blade", "Dragon's Blood", "Dragon Slayer", "Festival of Life", "Playing With Fire", "Foolhardy Waywardness" },
 												 { "In the Wake of Gods", "The Samaritan", "A Life of A-d-v-e-n-t-u-r-e", "Evil Way Home" } };
@@ -3530,10 +3532,6 @@ void CCampaignScreen::CCampaignButton::show(SDL_Surface *to)
 	if (status == CCampaignScreen::DISABLED || video == "" || button == 0)
 		return;
 
-
-	// TODO: windows video code seem to have diverged a little bit
-	// from non-windows code. Needs to be fixed and this ifdef removed.
-
 	// Play the campaign button video when the mouse cursor is placed over the button
 	if (CCS->curh->xpos >= pos.x && CCS->curh->ypos >= pos.y && CCS->curh->xpos < pos.x + pos.w && CCS->curh->ypos < pos.y + pos.h)
 	{

+ 3 - 6
lib/CGameInterface.cpp

@@ -63,11 +63,7 @@ rett * createAny(std::string dllname, std::string methodName)
 #ifdef _WIN32
 std::string getAIFileName(std::string input)
 {
-	size_t found=input.find(LIB_EXT);
-	if (found != std::string::npos) //quick, dirty fix
-		return input;
-	else
-		return input + '.' + LIB_EXT;
+	return input + '.' + LIB_EXT;
 }
 #else
 std::string getAIFileName(std::string input)
@@ -79,9 +75,10 @@ std::string getAIFileName(std::string input)
 template<typename rett>
 rett * createAnyAI(std::string dllname, std::string methodName)
 {
+	tlog1<<"Opening "<<dllname<<"\n";
 	std::string filename = getAIFileName(dllname);
 	rett* ret = createAny<rett>(LIB_DIR "/AI/" + filename, methodName);
-	ret->dllName = filename;
+	ret->dllName = dllname;
 	return ret;
 }