1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

* added #33 & #19 (as far as possible by now)

* more text in CPreGameTextHandler
This commit is contained in:
Michał W. Urbańczyk 2007-10-13 21:27:03 +00:00
parent 9e84383a61
commit 70ce922fe6
3 changed files with 100 additions and 8 deletions

View File

@ -239,8 +239,8 @@ void CHeroList::clickLeft(tribool down)
if (!down)
{
from++;
if (from<items.size()-5)
from=items.size()-5;
//if (from<items.size()-5)
// from=items.size()-5;
draw();
}
}
@ -284,6 +284,23 @@ void CHeroList::mouseMoved (SDL_MouseMotionEvent & sEvent)
}
void CHeroList::clickRight(tribool down)
{
if (down)
{
/***************************ARROWS*****************************************/
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListUp.second,down,this);
}
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListDown.second,down,this);
}
}
else
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListDown.second,down,this);
}
}
void CHeroList::hover (bool on)
{
@ -373,6 +390,33 @@ void CTownList::select(int which)
}
void CTownList::mouseMoved (SDL_MouseMotionEvent & sEvent)
{
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if (from>0)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advTListUp.first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
}
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if ((items.size()-from) > 5)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advTListDown.first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
}
//if not buttons then heroes
int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
hx-=pos.x;
hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h;
float ny = (float)hy/(float)32;
if ((ny>5 || ny<0) || (from+ny>=items.size()))
{
LOCPLINT->adventureInt->statusbar.clear();
return;
};
//LOCPLINT->adventureInt->statusbar.print( items[from+ny]->name + ", " + items[from+ny]->town->name ); //TODO - uncomment when pointer to the town type is initialized
}
void CTownList::clickLeft(tribool down)
{
@ -391,7 +435,7 @@ void CTownList::clickLeft(tribool down)
pressed = false;
return;
}
/***************************HEROES*****************************************/
/***************************TOWNS*****************************************/
int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
hx-=pos.x;
hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h;
@ -423,8 +467,8 @@ void CTownList::clickLeft(tribool down)
if (!down)
{
from++;
if (from<items.size()-5)
from=items.size()-5;
//if (from<items.size()-5)
// from=items.size()-5;
draw();
}
}
@ -434,7 +478,24 @@ void CTownList::clickLeft(tribool down)
}
}
void CTownList::clickRight(tribool down)
{
{
if (down)
{
/***************************ARROWS*****************************************/
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListUp.second,down,this);
}
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListDown.second,down,this);
}
}
else
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListDown.second,down,this);
}
}
void CTownList::hover (bool on)
{
@ -1089,6 +1150,12 @@ void CAdvMapInt::fsleepWake()
}
void CAdvMapInt::fmoveHero()
{
if (selection.type!=HEROI_TYPE)
return;
if (!terrain.currentPath)
return;
CPath sended(*(terrain.currentPath)); //temporary path - engine will operate on it
LOCPLINT->cb->moveHero( ((const CHeroInstance*)LOCPLINT->adventureInt->selection.selected)->type->ID,&sended,1,0);
}
void CAdvMapInt::fshowSpellbok()
{

View File

@ -450,6 +450,30 @@ void CPreGameTextHandler::loadTexts()
loadToIt(advHListUp.second, buf, i, 2);
loadToIt(advHListDown.first, buf, i, 4);
loadToIt(advHListDown.second, buf, i, 2);
loadToIt(advHPortrait.first, buf, i, 4);
loadToIt(advHPortrait.second, buf, i, 2);
loadToIt(advTListUp.first, buf, i, 4);
loadToIt(advTListUp.second, buf, i, 2);
loadToIt(advTListDown.first, buf, i, 4);
loadToIt(advTListDown.second, buf, i, 2);
loadToIt(advTPortrait.first, buf, i, 4);
loadToIt(advTPortrait.second, buf, i, 2);
loadToIt(advRGold.first, buf, i, 4);
loadToIt(advRGold.second, buf, i, 2);
loadToIt(advRWood.first, buf, i, 4);
loadToIt(advRWood.second, buf, i, 2);
loadToIt(advRMercury.first, buf, i, 4);
loadToIt(advRMercury.second, buf, i, 2);
loadToIt(advROre.first, buf, i, 4);
loadToIt(advROre.second, buf, i, 2);
loadToIt(advRSulfur.first, buf, i, 4);
loadToIt(advRSulfur.second, buf, i, 2);
loadToIt(advRCrystal.first, buf, i, 4);
loadToIt(advRCrystal.second, buf, i, 2);
loadToIt(advRGems.first, buf, i, 4);
loadToIt(advRGems.second, buf, i, 2);
loadToIt(advDate.first, buf, i, 4);
loadToIt(advDate.second, buf, i, 2);
loadLossConditions();
loadVictoryConditions();

View File

@ -39,8 +39,9 @@ public:
std::string getDescr(std::string text);
std::pair<std::string, std::string> //first is statusbar text, second right-click help; they're all for adventure map interface
advKingdomOverview, advSurfaceSwitch, advQuestlog, advSleepWake, advMoveHero, advCastSpell, advAdvOptions, advSystemOptions, advNextHero, advEndTurn, advHListUp, advHListDown, //buttons
advWorldMap, advStatusWindow1;
advKingdomOverview, advSurfaceSwitch, advQuestlog, advSleepWake, advMoveHero, advCastSpell, advAdvOptions, advSystemOptions, advNextHero, advEndTurn, advHListUp, advHListDown, advHPortrait, advTListUp, advTListDown, advTPortrait, //buttons
advRGold, advRWood, advRMercury, advROre, advRSulfur, advRCrystal, advRGems, //resources
advDate, advWorldMap, advStatusWindow1;
void loadTexts();
void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol //mode 2 - copy to tab, dump to eol //mode 3 - copy to eol //mode 4 - copy to tab