mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Various fixes. Subtitles for choosen hero/town/bonus in pregame. Fixed arrows behavior. Really fixed shortcuts. Fixed map scrolling. Fixed disappearing battle interface.
This commit is contained in:
parent
a3b6bb4892
commit
3915b71869
@ -1336,6 +1336,9 @@ endTurn(CGI->generaltexth->zelp[302].first,CGI->generaltexth->zelp[302].second,
|
||||
heroList(ADVOPT.hlistSize),
|
||||
townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
|
||||
{
|
||||
pos.x = pos.y = 0;
|
||||
pos.w = screen->w;
|
||||
pos.h = screen->h;
|
||||
active = 0;
|
||||
selection = NULL;
|
||||
townList.fun = boost::bind(&CAdvMapInt::selectionChanged,this);
|
||||
|
@ -80,6 +80,7 @@ struct OCM_HLP_CGIN
|
||||
|
||||
CPlayerInterface::CPlayerInterface(int Player, int serial)
|
||||
{
|
||||
GH.defActionsDef = 0;
|
||||
LOCPLINT = this;
|
||||
curAction = NULL;
|
||||
playerID=Player;
|
||||
|
@ -858,8 +858,9 @@ void OptionsTab::showAll( SDL_Surface * to )
|
||||
|
||||
void OptionsTab::nextCastle( int player, int dir )
|
||||
{
|
||||
si32 &cur = curOpts->playerInfos[player].castle;
|
||||
ui32 allowed = curMap->players[curOpts->playerInfos[player].color].allowedFactions;
|
||||
PlayerSettings &s = curOpts->playerInfos[player];
|
||||
si32 &cur = s.castle;
|
||||
ui32 allowed = curMap->players[s.color].allowedFactions;
|
||||
|
||||
if (cur == -2) //no castle - no change
|
||||
return;
|
||||
@ -897,6 +898,12 @@ void OptionsTab::nextCastle( int player, int dir )
|
||||
}
|
||||
}
|
||||
|
||||
if(s.hero >= 0)
|
||||
s.hero = -1;
|
||||
if(s.bonus == bresource)
|
||||
s.bonus = brandom;
|
||||
|
||||
entries[player]->selectButtons();
|
||||
redraw();
|
||||
}
|
||||
|
||||
@ -1013,10 +1020,19 @@ void OptionsTab::setTurnLength( int npos )
|
||||
|
||||
void OptionsTab::flagPressed( int player )
|
||||
{
|
||||
PlayerSettings &s = curOpts->playerInfos[player];
|
||||
std::swap(curOpts->playerInfos[playerColor].human, s.human);
|
||||
std::swap(curOpts->playerInfos[playerColor].name, s.name);
|
||||
int playerSerial = playerColor; //curMap->players[playerColor].serial;
|
||||
PlayerSettings &s = curOpts->playerInfos[player],
|
||||
&old = curOpts->playerInfos[playerSerial];
|
||||
|
||||
std::swap(old.human, s.human);
|
||||
std::swap(old.name, s.name);
|
||||
playerColor = s.color;
|
||||
|
||||
if(!entries[playerSerial]->fixedHero)
|
||||
old.hero = -1;
|
||||
|
||||
entries[s.serial]->selectButtons();
|
||||
entries[old.serial]->selectButtons();
|
||||
GH.totalRedraw();
|
||||
}
|
||||
|
||||
@ -1040,6 +1056,10 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSet
|
||||
btns[4] = new AdventureMapButton(CGI->generaltexth->zelp[164], bind(&OptionsTab::nextBonus, owner, s.serial, -1), 259, 5, "ADOPLFA.DEF");
|
||||
btns[5] = new AdventureMapButton(CGI->generaltexth->zelp[165], bind(&OptionsTab::nextBonus, owner, s.serial, +1), 320, 5, "ADOPRTA.DEF");
|
||||
|
||||
fixedHero = s.hero != -1; //if we doesn't start with "random hero" it must be fixed or none
|
||||
selectButtons(false);
|
||||
|
||||
|
||||
if(curMap->players[s.color].canHumanPlay)
|
||||
{
|
||||
flag = new AdventureMapButton(CGI->generaltexth->zelp[180], bind(&OptionsTab::flagPressed, owner, s.serial), -43, 2, flags[s.color]);
|
||||
@ -1062,52 +1082,92 @@ void OptionsTab::PlayerOptionsEntry::showAll( SDL_Surface * to )
|
||||
printAtMiddleLoc(s.name, 55, 10, FONT_SMALL, zwykly, to);
|
||||
}
|
||||
|
||||
void OptionsTab::PlayerOptionsEntry::selectButtons(bool onlyHero)
|
||||
{
|
||||
if(!onlyHero && s.castle != -1)
|
||||
{
|
||||
btns[0]->disable();
|
||||
btns[1]->disable();
|
||||
}
|
||||
if(fixedHero || !s.human || s.castle < 0)
|
||||
{
|
||||
btns[2]->disable();
|
||||
btns[3]->disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
btns[2]->enable(active);
|
||||
btns[3]->enable(active);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsTab::SelectedBox::showAll( SDL_Surface * to )
|
||||
{
|
||||
PlayerSettings &s = curOpts->playerInfos[player];
|
||||
SDL_Surface *toBlit = NULL;
|
||||
const std::string *toPrint = NULL;
|
||||
|
||||
switch(which)
|
||||
{
|
||||
case TOWN:
|
||||
{
|
||||
if (s.castle < F_NUMBER && s.castle >= 0)
|
||||
blitAt(graphics->getPic(s.castle, true, false), pos, to);
|
||||
{
|
||||
toBlit = graphics->getPic(s.castle, true, false);
|
||||
toPrint = &CGI->townh->towns[s.castle].Name();
|
||||
}
|
||||
else if (s.castle == -1)
|
||||
blitAt(CGP->rTown, pos, to);
|
||||
{
|
||||
toBlit = CGP->rTown;
|
||||
toPrint = &CGI->generaltexth->allTexts[522];
|
||||
}
|
||||
else if (s.castle == -2)
|
||||
blitAt(CGP->nTown, pos, to);
|
||||
{
|
||||
toBlit = CGP->nTown;
|
||||
toPrint = &CGI->generaltexth->allTexts[523];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HERO:
|
||||
{
|
||||
if (s.hero == -1)
|
||||
{
|
||||
blitAt(CGP->rHero, pos, to);
|
||||
toBlit = CGP->rHero;
|
||||
toPrint = &CGI->generaltexth->allTexts[522];
|
||||
}
|
||||
else if (s.hero == -2)
|
||||
{
|
||||
if(s.heroPortrait >= 0)
|
||||
{
|
||||
blitAt(graphics->portraitSmall[s.heroPortrait], pos, to);
|
||||
toBlit = graphics->portraitSmall[s.heroPortrait];
|
||||
if(s.heroName.length())
|
||||
toPrint = &s.heroName;
|
||||
else
|
||||
toPrint = &CGI->heroh->heroes[s.heroPortrait]->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
blitAt(CGP->nHero, pos, to);
|
||||
toBlit = CGP->nHero;
|
||||
toPrint = &CGI->generaltexth->allTexts[523];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blitAt(graphics->portraitSmall[s.hero], pos, to);
|
||||
toBlit = graphics->portraitSmall[s.hero];
|
||||
toPrint = &s.heroName;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BONUS:
|
||||
{
|
||||
int pom;
|
||||
toPrint = &CGI->generaltexth->arraytxt[214 + s.bonus];
|
||||
|
||||
switch (s.bonus)
|
||||
{
|
||||
case -1:
|
||||
pom=10;
|
||||
toPrint = &CGI->generaltexth->allTexts[522];
|
||||
break;
|
||||
case 0:
|
||||
pom=9;
|
||||
@ -1119,10 +1179,13 @@ void OptionsTab::SelectedBox::showAll( SDL_Surface * to )
|
||||
pom=CGI->townh->towns[s.castle].bonus;
|
||||
break;
|
||||
}
|
||||
blitAt(CGP->bonuses->ourImages[pom].bitmap, pos, to);
|
||||
toBlit = CGP->bonuses->ourImages[pom].bitmap;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
blitAt(toBlit, pos, to);
|
||||
printAtMiddleLoc(*toPrint, 23, 39, FONT_TINY, zwykly, to);
|
||||
}
|
||||
|
||||
OptionsTab::SelectedBox::SelectedBox( SelType Which, ui8 Player )
|
||||
|
@ -119,8 +119,10 @@ public:
|
||||
SelectedBox *town;
|
||||
SelectedBox *hero;
|
||||
SelectedBox *bonus;
|
||||
bool fixedHero;
|
||||
|
||||
PlayerOptionsEntry(OptionsTab *owner, PlayerSettings &S);
|
||||
void selectButtons(bool onlyHero = true); //hides unavailable buttons
|
||||
void showAll(SDL_Surface * to);
|
||||
};
|
||||
CPicture *bg;
|
||||
|
@ -23,12 +23,15 @@ void KeyShortcut::keyPressed(const SDL_KeyboardEvent & key)
|
||||
{
|
||||
if(vstd::contains(assignedKeys,key.keysym.sym))
|
||||
{
|
||||
if(key.state == SDL_PRESSED) {
|
||||
clickLeft(true, pressedL);
|
||||
bool prev = pressedL;
|
||||
if(key.state == SDL_PRESSED)
|
||||
{
|
||||
pressedL = true;
|
||||
} else {
|
||||
clickLeft(false, pressedL);
|
||||
clickLeft(true, prev);
|
||||
} else
|
||||
{
|
||||
pressedL = false;
|
||||
clickLeft(false, prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -517,6 +520,22 @@ void CIntObject::printToLoc( const std::string & text, int x, int y, EFonts font
|
||||
CSDL_Ext::printTo(text, pos.x + x, pos.y + y, font, kolor, dst, refresh);
|
||||
}
|
||||
|
||||
void CIntObject::disable()
|
||||
{
|
||||
if(active)
|
||||
deactivate();
|
||||
|
||||
recActions = DISPOSE;
|
||||
}
|
||||
|
||||
void CIntObject::enable(bool activation)
|
||||
{
|
||||
if(!active && activation)
|
||||
activate();
|
||||
|
||||
recActions = 255;
|
||||
}
|
||||
|
||||
CPicture::CPicture( SDL_Surface *BG, int x, int y, bool Free )
|
||||
{
|
||||
bg = BG;
|
||||
|
@ -317,6 +317,8 @@ public:
|
||||
ui8 defActions; //which calls will be tried to be redirected to children
|
||||
ui8 recActions; //which calls we allow te receive from parent
|
||||
|
||||
void disable(); //deactivates if needed, blocks all automatic activity, allows only disposal
|
||||
void enable(bool activation = true); //activates if needed, all activity enabled (Warning: may not be symetric with disable if recActions was limited!)
|
||||
void defActivate();
|
||||
void defDeactivate();
|
||||
void activate();
|
||||
|
@ -93,7 +93,9 @@ void CObjectHandler::loadObjects()
|
||||
tlog5 << "\t\tDone loading objects!\n";
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
std::string banksConfig = bitmaph->getTextFile("ZCRBANK.TXT");
|
||||
|
||||
//TODO: parse to banksInfo
|
||||
}
|
||||
int CGObjectInstance::getOwner() const
|
||||
|
@ -1299,19 +1299,51 @@ unsigned char CMapHandler::getHeroFrameNum(unsigned char dir, bool isMoving) con
|
||||
{
|
||||
if(isMoving)
|
||||
{
|
||||
std::map<int, unsigned char> dirToFrame = boost::assign::map_list_of(1, 10)(2, 5)(3, 6)(4, 7)(5, 8)(6, 9)(7, 12)(8, 11);
|
||||
if(dir >= 1 && dir <= 10)
|
||||
return dirToFrame[dir];
|
||||
|
||||
throw std::string("Something very wrong1.");
|
||||
switch(dir)
|
||||
{
|
||||
case 1:
|
||||
return 10;
|
||||
case 2:
|
||||
return 5;
|
||||
case 3:
|
||||
return 6;
|
||||
case 4:
|
||||
return 7;
|
||||
case 5:
|
||||
return 8;
|
||||
case 6:
|
||||
return 9;
|
||||
case 7:
|
||||
return 12;
|
||||
case 8:
|
||||
return 11;
|
||||
default:
|
||||
throw std::string("Something very wrong1.");
|
||||
}
|
||||
}
|
||||
else //if(isMoving)
|
||||
{
|
||||
std::map<int, unsigned char> dirToFrame = boost::assign::map_list_of(1, 13)(2, 0)(3, 1)(4, 2)(5, 3)(6, 4)(7, 15)(8, 14);
|
||||
if(dir >= 1 && dir <= 10)
|
||||
return dirToFrame[dir];
|
||||
|
||||
throw std::string("Something very wrong1.");
|
||||
switch(dir)
|
||||
{
|
||||
case 1:
|
||||
return 13;
|
||||
case 2:
|
||||
return 0;
|
||||
case 3:
|
||||
return 1;
|
||||
case 4:
|
||||
return 2;
|
||||
case 5:
|
||||
return 3;
|
||||
case 6:
|
||||
return 4;
|
||||
case 7:
|
||||
return 15;
|
||||
case 8:
|
||||
return 14;
|
||||
default:
|
||||
throw std::string("Something very wrong2.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user