1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

* Reverted previously changed PreGame code

* Added the missing AB video resource file in linux code, AB campaign selection videos should now play BUT they don't => it seems that ffmpeg can't handle older BINK videos
* Fixed a visual glitch which could be seen at the WOG animation in the main menu on a linux machine
* Fixed the random crashes bug on mouse centering at startup on linux
* Fixed a visual bug at the bonus selection screen when starting a campaign-map
* Changed some positions in the bonus selection screen, no bonus pre selection, you cannot start the campaign when no bonus is selected (like in h3)
* Added a border functionality to the AdventureMapButton
* InfoWindow buttons and some other buttons have now the border which heroes 3 buttons have
* Fixed a app crash when you start a campaign two times in one session
This commit is contained in:
beegee1
2011-04-26 13:30:29 +00:00
parent a73a1c2724
commit 45fba15511
14 changed files with 116 additions and 77 deletions

View File

@ -277,8 +277,7 @@ void CMenuScreen::showAll( SDL_Surface * to )
void CMenuScreen::show( SDL_Surface * to )
{
CIntObject::show(to);
//CCS->videoh->update(pos.x + 8, pos.y + 105, screen, true, false);
showAll(to);
}
void CMenuScreen::moveTo( CMenuScreen *next )
@ -339,8 +338,6 @@ void CGPreGame::disposeGraphics()
void CGPreGame::update()
{
SDL_FillRect(screen, 0, 0);
if (GH.listInt.size() == 0)
{
CCS->musich->playMusic(musicBase::mainMenu, -1);
@ -358,14 +355,15 @@ void CGPreGame::update()
if (GH.curInt == 0) // no redraw, when a new game was created
return;
GH.totalRedraw();
GH.topInt()->show(screen);
if (conf.cc.showFPS)
GH.drawFPSCounter();
// draw the mouse cursor and update the screen
CCS->curh->draw(screen);
CCS->curh->draw1();
CSDL_Ext::update(screen);
CCS->curh->draw2();
}
CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMultiMode MultiPlayer /*= CMenuScreen::SINGLE_PLAYER*/, const std::map<ui32, std::string> *Names /*= NULL*/)
@ -2616,6 +2614,7 @@ CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
startB = new AdventureMapButton("", "", bind(&CBonusSelection::startMap, this), 475, 536, "CBBEGIB.DEF", SDLK_RETURN);
backB = new AdventureMapButton("", "", bind(&CBonusSelection::goBack, this), 624, 536, "CBCANCB.DEF", SDLK_ESCAPE);
startB->setState(CButtonBase::BLOCKED);
//campaign name
if (ourCampaign->camp->header.name.length())
@ -2637,7 +2636,7 @@ CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
mapDesc = new CTextBox("", Rect(480, 280, 286, 117), 1);
//bonus choosing
printAtMiddleLoc(CGI->generaltexth->allTexts[71], 562, 438, FONT_MEDIUM, zwykly, background); //Choose a bonus:
printAtLoc(CGI->generaltexth->allTexts[71], 511, 432, FONT_MEDIUM, zwykly, background); //Choose a bonus:
bonuses = new CHighlightableButtonsGroup(bind(&CBonusSelection::selectBonus, this, _1));
//set left part of window
@ -2673,18 +2672,21 @@ CBonusSelection::CBonusSelection( CCampaignState * _ourCampaign )
SDL_FreeSurface(panel);
//difficulty
printAtMiddleLoc(CGI->generaltexth->allTexts[492], 715, 438, FONT_MEDIUM, zwykly, background); //Difficulty
{//difficulty pics
for (int b=0; b<ARRAY_COUNT(diffPics); ++b)
{
CDefEssential * cde = CDefHandler::giveDefEss("GSPBUT" + boost::lexical_cast<std::string>(b+3) + ".DEF");
SDL_Surface * surfToDuplicate = cde->ourImages[0].bitmap;
diffPics[b] = SDL_ConvertSurface(surfToDuplicate, surfToDuplicate->format,
surfToDuplicate->flags);
std::vector<std::string> difficulty;
boost::split(difficulty, CGI->generaltexth->allTexts[492], boost::is_any_of(" "));
printAtLoc(difficulty.back(), 689, 432, FONT_MEDIUM, zwykly, background); //Difficulty
//difficulty pics
for (int b=0; b<ARRAY_COUNT(diffPics); ++b)
{
CDefEssential * cde = CDefHandler::giveDefEss("GSPBUT" + boost::lexical_cast<std::string>(b+3) + ".DEF");
SDL_Surface * surfToDuplicate = cde->ourImages[0].bitmap;
diffPics[b] = SDL_ConvertSurface(surfToDuplicate, surfToDuplicate->format,
surfToDuplicate->flags);
delete cde;
}
delete cde;
}
//difficulty selection buttons
if (ourCampaign->camp->header.difficultyChoosenByPlayer)
{
@ -3010,26 +3012,20 @@ void CBonusSelection::updateBonusSelection()
break;
}
bonuses->addButton(new CHighlightableButton(desc, desc, 0, 475 + i*68, 455, "", i));
CHighlightableButton *bonusButton = new CHighlightableButton(desc, desc, 0, 475 + i*68, 455, "", i);
if (picNumber != -1)
picName += ":" + boost::lexical_cast<std::string>(picNumber);
CAnimation * anim = new CAnimation();
anim->setCustom(picName, 0);
anim->setCustom("TWCRPORT:1", 1);//create separate surface with yellow border
bonuses->buttons.back()->setImage(anim);
//FIXME: use show base
bonusButton->setImage(anim);
bonusButton->borderColor = int3(242, 226, 110); // yellow border
bonuses->addButton(bonusButton);
}
if (active)
for (size_t i=0; i<bonuses->buttons.size(); i++)
bonuses->buttons[i]->activate();
if (bonuses->buttons.size() > 0)
{
bonuses->select(0, 0);
}
}
void CBonusSelection::startMap()
@ -3041,14 +3037,28 @@ void CBonusSelection::startMap()
}
else
{
GH.popInts(3);
// Deletes either the Custom campaign selection screen + Bonus selection screen or
// one of the main campaign selection screens + Bonus selection screen and
// deactivates the main menu
GH.popInts(2);
GH.popInt(GH.topInt());
}
::startGame(si);
}
void CBonusSelection::selectBonus( int id )
{
sInfo.choosenCampaignBonus = id;
// Total redraw is needed because the border around the bonus images
// have to be undrawn/drawn.
if (id != sInfo.choosenCampaignBonus)
{
sInfo.choosenCampaignBonus = id;
GH.totalRedraw();
if (startB->getState() == CButtonBase::BLOCKED)
startB->setState(CButtonBase::NORMAL);
}
const CCampaignScenario &scenario = ourCampaign->camp->scenarios[sInfo.whichMapInCampaign];
const std::vector<CScenarioTravel::STravelBonus> & bonDescs = scenario.travelOptions.bonusesToChoose;
@ -3436,6 +3446,7 @@ CCampaignScreen::~CCampaignScreen()
if (noCamp != 0)
SDL_FreeSurface(noCamp);
//campButtons.clear();
CCS->videoh->open("ACREDIT.SMK");
}
@ -3470,11 +3481,17 @@ void CCampaignScreen::drawCampaignPlaceholder()
blitAt(noCamp, noCampRect, bg);
}
void CCampaignScreen::showAll(SDL_Surface *to)
void CCampaignScreen::show(SDL_Surface *to)
{
// Draw background image and all interactive objects like buttons
blitAt(bg, pos.x, pos.y, to);
CIntObject::showAll(to);
for (int i = 0; i < this->campButtons.size(); i++)
{
campButtons[i]->show(to);
}
back->showAll(to);
}
CCampaignScreen::CCampaignButton::CCampaignButton(SDL_Surface *bg, const std::string image, const int x, const int y, CampaignStatus status)
@ -3507,7 +3524,6 @@ CCampaignScreen::CCampaignButton::CCampaignButton(SDL_Surface *bg, const std::st
// Create the button hover effect
hoverLabel = new CLabel(pos.w / 2., pos.h + 20, FONT_MEDIUM, CENTER, tytulowy, "");
hoverLabel->ignoreLeadingWhitespace = false;
hoverLabel->autoRedraw = false;
}
CCampaignScreen::CCampaignButton::~CCampaignButton()
@ -3532,9 +3548,9 @@ void CCampaignScreen::CCampaignButton::hover(bool on)
}
void CCampaignScreen::CCampaignButton::showAll(SDL_Surface *to)
void CCampaignScreen::CCampaignButton::show(SDL_Surface *to)
{
CIntObject::showAll(to);
hoverLabel->showAll(to);
if (status == CCampaignScreen::DISABLED || video == "" || button == 0)
return;