2009-05-20 13:08:56 +03:00
# include "../stdafx.h"
2008-08-26 00:14:00 +03:00
# include "AdventureMapButton.h"
2008-01-11 20:56:39 +02:00
# include "CAdvmapInterface.h"
2009-05-20 13:08:56 +03:00
# include "../CCallback.h"
2008-08-26 00:14:00 +03:00
# include "CGameInfo.h"
# include "CHeroWindow.h"
2008-01-15 20:50:52 +02:00
# include "CMessage.h"
2010-02-04 17:50:59 +02:00
# include "CKingdomInterface.h"
2008-08-26 00:14:00 +03:00
# include "SDL.h"
# include "SDL_Extensions.h"
2009-05-20 13:08:56 +03:00
# include "CBitmapHandler.h"
# include "Graphics.h"
# include "CSpellWindow.h"
# include "CConfigHandler.h"
# include "../global.h"
2010-12-20 23:22:53 +02:00
# include "../lib/CArtHandler.h"
# include "CDefHandler.h"
# include "../lib/CGeneralTextHandler.h"
# include "../lib/CHeroHandler.h"
# include "../lib/CLodHandler.h"
# include "../lib/CObjectHandler.h"
2008-08-28 20:36:34 +03:00
# include <boost/algorithm/string/replace.hpp>
# include <boost/assign/list_of.hpp>
2008-08-26 00:14:00 +03:00
# include <boost/assign/std/vector.hpp>
# include <cstdlib>
2008-01-13 18:24:24 +02:00
# include <sstream>
2009-11-13 18:02:25 +02:00
# include <boost/lexical_cast.hpp>
2010-12-17 00:32:53 +02:00
# include <boost/format.hpp>
# include <boost/foreach.hpp>
2009-01-07 21:40:19 +02:00
2009-11-29 04:46:30 +02:00
# undef min
2009-11-21 00:35:18 +02:00
2009-04-15 17:03:31 +03:00
/*
* CHeroWindow . cpp , part of VCMI engine
*
* Authors : listed in file AUTHORS in main folder
*
* License : GNU General Public License v2 .0 or later
* Full text of license available in license . txt file , in main folder
*
*/
2008-01-19 15:19:58 +02:00
extern SDL_Surface * screen ;
2008-08-26 00:14:00 +03:00
using namespace boost : : assign ;
2010-07-13 08:25:40 +03:00
void CHeroSwitcher : : clickLeft ( tribool down , bool previousState )
{
if ( ! down )
{
2010-12-17 00:32:53 +02:00
getOwner ( ) - > deactivate ( ) ;
2010-07-13 08:25:40 +03:00
const CGHeroInstance * buf = LOCPLINT - > getWHero ( id ) ;
2010-12-17 00:32:53 +02:00
getOwner ( ) - > setHero ( buf ) ;
getOwner ( ) - > activate ( ) ;
2010-07-13 08:25:40 +03:00
}
}
2010-12-17 00:32:53 +02:00
CHeroWindow * CHeroSwitcher : : getOwner ( )
2010-07-13 08:25:40 +03:00
{
2010-12-17 00:32:53 +02:00
return dynamic_cast < CHeroWindow * > ( parent ) ;
}
CHeroSwitcher : : CHeroSwitcher ( int serial )
{
pos = Rect ( 677 , 95 + serial * 54 , 48 , 32 ) + pos ;
id = serial ;
2010-07-13 08:25:40 +03:00
used = LCLICK ;
}
2010-12-17 00:32:53 +02:00
CHeroWindow : : CHeroWindow ( const CGHeroInstance * hero )
2008-01-10 21:01:25 +02:00
{
2010-12-17 00:32:53 +02:00
OBJ_CONSTRUCTION_CAPTURING_ALL ;
garr = NULL ;
2008-01-15 20:50:52 +02:00
curHero = NULL ;
2010-12-17 00:32:53 +02:00
player = hero - > tempOwner ;
2009-06-18 18:05:00 +03:00
2010-12-17 00:32:53 +02:00
background = new CPicture ( " HeroScr4.BMP " ) ;
background - > colorizeAndConvert ( player ) ;
pos = background - > center ( ) ;
2008-01-11 20:56:39 +02:00
2008-01-30 15:18:08 +02:00
2010-12-17 00:32:53 +02:00
//artifs = new CArtifactsOfHero(pos.topLeft(), true);
ourBar = new CGStatusBar ( 7 , 559 , " ADROLLVR.bmp " , 660 ) ; // new CStatusBar(pos.x+72, pos.y+567, "ADROLLVR.bmp", 660);
2008-01-12 14:55:45 +02:00
2010-12-17 00:32:53 +02:00
quitButton = new AdventureMapButton ( CGI - > generaltexth - > heroscrn [ 17 ] , std : : string ( ) , boost : : bind ( & CHeroWindow : : quit , this ) , 609 , 516 , " hsbtns.def " , SDLK_RETURN ) ;
dismissButton = new AdventureMapButton ( std : : string ( ) , CGI - > generaltexth - > heroscrn [ 28 ] , boost : : bind ( & CHeroWindow : : dismissCurrent , this ) , 454 , 429 , " hsbtns2.def " , SDLK_d ) ;
questlogButton = new AdventureMapButton ( CGI - > generaltexth - > heroscrn [ 0 ] , std : : string ( ) , boost : : bind ( & CHeroWindow : : questlog , this ) , 314 , 429 , " hsbtns4.def " , SDLK_q ) ;
2008-09-24 11:15:49 +03:00
2010-12-17 00:32:53 +02:00
formations = new CHighlightableButtonsGroup ( 0 ) ;
{
BLOCK_CAPTURING ;
formations - > addButton ( map_list_of ( 0 , CGI - > generaltexth - > heroscrn [ 23 ] ) , CGI - > generaltexth - > heroscrn [ 29 ] , " hsbtns6.def " , pos . x + 481 , pos . y + 483 , 0 , 0 , SDLK_t ) ;
formations - > addButton ( map_list_of ( 0 , CGI - > generaltexth - > heroscrn [ 24 ] ) , CGI - > generaltexth - > heroscrn [ 30 ] , " hsbtns7.def " , pos . x + 481 , pos . y + 519 , 1 , 0 , SDLK_l ) ;
}
2008-09-19 11:16:19 +03:00
2010-12-17 00:32:53 +02:00
tacticsButton = new CHighlightableButton ( 0 , 0 , map_list_of ( 0 , CGI - > generaltexth - > heroscrn [ 26 ] ) ( 3 , CGI - > generaltexth - > heroscrn [ 25 ] ) , CGI - > generaltexth - > heroscrn [ 31 ] , false , " hsbtns8.def " , NULL , 539 , 483 , SDLK_b ) ;
2008-11-28 03:36:34 +02:00
2008-01-13 21:42:21 +02:00
2009-06-19 15:10:36 +03:00
//right list of heroes
2008-01-13 21:42:21 +02:00
for ( int g = 0 ; g < 8 ; + + g )
2010-12-17 00:32:53 +02:00
heroListMi . push_back ( new CHeroSwitcher ( g ) ) ;
2008-01-13 21:42:21 +02:00
2008-11-28 03:36:34 +02:00
2009-06-17 19:46:16 +03:00
flags = CDefHandler : : giveDefEss ( " CREST58.DEF " ) ;
2010-12-17 00:32:53 +02:00
2008-01-19 20:58:24 +02:00
//areas
2010-12-17 00:32:53 +02:00
portraitArea = new LRClickableAreaWText ( Rect ( 18 , 18 , 58 , 64 ) ) ;
2009-06-19 15:10:36 +03:00
2010-02-01 01:22:25 +02:00
for ( int v = 0 ; v < PRIMARY_SKILLS ; + + v )
2008-01-27 18:07:27 +02:00
{
2010-12-17 00:32:53 +02:00
LRClickableAreaWTextComp * area = new LRClickableAreaWTextComp ( Rect ( 30 + 70 * v , 109 , 42 , 64 ) , SComponent : : primskill ) ;
area - > text = CGI - > generaltexth - > arraytxt [ 2 + v ] ;
area - > type = v ;
area - > hoverText = boost : : str ( boost : : format ( CGI - > generaltexth - > heroscrn [ 1 ] ) % CGI - > generaltexth - > primarySkillNames [ v ] ) ;
primSkillAreas . push_back ( area ) ;
2010-02-01 01:30:47 +02:00
}
2010-12-17 00:32:53 +02:00
specArea = new LRClickableAreaWText ( Rect ( 18 , 180 , 136 , 42 ) , CGI - > generaltexth - > heroscrn [ 27 ] ) ;
expArea = new LRClickableAreaWText ( Rect ( 18 , 228 , 136 , 42 ) , CGI - > generaltexth - > heroscrn [ 9 ] ) ;
morale = new MoraleLuckBox ( true , Rect ( 175 , 179 , 53 , 45 ) ) ;
luck = new MoraleLuckBox ( false , Rect ( 233 , 179 , 53 , 45 ) ) ;
spellPointsArea = new LRClickableAreaWText ( Rect ( 162 , 228 , 136 , 42 ) , CGI - > generaltexth - > heroscrn [ 22 ] ) ;
2008-01-29 15:55:14 +02:00
2010-02-01 01:22:25 +02:00
for ( int i = 0 ; i < SKILL_PER_HERO ; + + i )
2008-01-28 14:28:18 +02:00
{
2010-12-17 00:32:53 +02:00
Rect r = Rect ( i % 2 = = 0 ? 18 : 162 , 276 + 48 * ( i / 2 ) , 136 , 42 ) ;
secSkillAreas . push_back ( new LRClickableAreaWTextComp ( r , SComponent : : secskill ) ) ;
2008-01-28 14:28:18 +02:00
}
2010-12-17 00:32:53 +02:00
//////////////////////////////////////////////////////////////////////////???????????????
// pos.x += 65;
// pos.y += 8;
//
//primary skills & exp and mana
new CPicture ( graphics - > pskillsm - > ourImages [ 0 ] . bitmap , 32 , 111 , false ) ;
new CPicture ( graphics - > pskillsm - > ourImages [ 1 ] . bitmap , 102 , 111 , false ) ;
new CPicture ( graphics - > pskillsm - > ourImages [ 2 ] . bitmap , 172 , 111 , false ) ;
new CPicture ( graphics - > pskillsm - > ourImages [ 5 ] . bitmap , 242 , 111 , false ) ;
new CPicture ( graphics - > pskillsm - > ourImages [ 4 ] . bitmap , 20 , 230 , false ) ;
new CPicture ( graphics - > pskillsm - > ourImages [ 3 ] . bitmap , 162 , 230 , false ) ;
setHero ( hero ) ;
2008-01-10 21:01:25 +02:00
}
CHeroWindow : : ~ CHeroWindow ( )
{
2010-12-17 00:32:53 +02:00
delete flags ;
//SDL_FreeSurface(curBack);
//curBack = NULL;
curHero = NULL ;
2008-01-10 21:01:25 +02:00
2010-12-17 00:32:53 +02:00
//artifs->dispose();
2008-01-10 21:01:25 +02:00
}
2009-06-19 15:10:36 +03:00
void CHeroWindow : : setHero ( const CGHeroInstance * hero )
2010-12-17 00:32:53 +02:00
{
2008-01-28 14:28:18 +02:00
if ( ! hero ) //something strange... no hero? it shouldn't happen
2010-12-17 00:32:53 +02:00
{
tlog1 < < " Set NULL hero? no way... \n " ;
return ;
}
if ( hero = = curHero )
2008-01-25 21:09:41 +02:00
{
2008-08-02 18:08:03 +03:00
return ;
2008-01-25 21:09:41 +02:00
}
2010-07-21 22:50:15 +03:00
2010-12-17 00:32:53 +02:00
assert ( hero - > tempOwner = = LOCPLINT - > playerID ) ; //for now we won't show hero windows for non-our heroes
curHero = hero ;
2010-02-01 01:30:47 +02:00
specArea - > text = CGI - > generaltexth - > hTxts [ hero - > subID ] . longBonus ;
2008-11-28 03:36:34 +02:00
2010-12-17 00:32:53 +02:00
tacticsButton - > callback . clear ( ) ;
tacticsButton - > callback2 . clear ( ) ;
2008-01-31 14:10:59 +02:00
2010-12-17 00:32:53 +02:00
dismissButton - > hoverTexts [ 0 ] = boost : : str ( boost : : format ( CGI - > generaltexth - > heroscrn [ 16 ] ) % curHero - > name % curHero - > type - > heroClass - > name ) ;
portraitArea - > hoverText = boost : : str ( boost : : format ( CGI - > generaltexth - > allTexts [ 15 ] ) % curHero - > name % curHero - > type - > heroClass - > name ) ;
2008-11-28 03:36:34 +02:00
portraitArea - > text = hero - > getBiography ( ) ;
2008-01-19 15:19:58 +02:00
2010-12-17 00:32:53 +02:00
{
delete garr ;
OBJ_CONSTRUCTION_CAPTURING_ALL ;
2010-12-17 20:47:07 +02:00
garr = new CGarrisonInt ( 80 , 493 , 8 , Point ( ) , background - > bg , Point ( 16 , 486 ) , curHero ) ;
2010-12-17 00:32:53 +02:00
}
2009-09-09 09:04:42 +03:00
2010-12-17 00:32:53 +02:00
AdventureMapButton * split = NULL ;
{
BLOCK_CAPTURING ;
split = new AdventureMapButton ( CGI - > generaltexth - > allTexts [ 256 ] , CGI - > generaltexth - > heroscrn [ 32 ] , boost : : bind ( & CGarrisonInt : : splitClick , garr ) , pos . x + 604 , pos . y + 527 , " hsbtns9.def " , false , NULL , false ) ; //deleted by garrison destructor
}
2009-09-09 09:04:42 +03:00
boost : : algorithm : : replace_first ( split - > hoverTexts [ 0 ] , " %s " , CGI - > generaltexth - > allTexts [ 43 ] ) ;
2010-08-27 19:20:35 +03:00
garr - > addSplitBtn ( split ) ;
2008-06-21 16:27:52 +03:00
2009-06-19 15:10:36 +03:00
//primary skills support
2008-12-21 21:17:35 +02:00
for ( size_t g = 0 ; g < primSkillAreas . size ( ) ; + + g )
2008-01-27 18:07:27 +02:00
{
2010-07-13 08:25:40 +03:00
primSkillAreas [ g ] - > bonusValue = hero - > getPrimSkillLevel ( g ) ;
2008-01-27 18:07:27 +02:00
}
2009-07-03 22:57:14 +03:00
2009-06-19 15:10:36 +03:00
//secondary skills support
2009-11-21 00:35:18 +02:00
for ( size_t g = 0 ; g < std : : min ( secSkillAreas . size ( ) , hero - > secSkills . size ( ) ) ; + + g )
2008-01-28 14:28:18 +02:00
{
2010-12-17 00:32:53 +02:00
int skill = hero - > secSkills [ g ] . first ,
2010-12-23 22:18:10 +02:00
level = hero - > getSecSkillLevel ( static_cast < CGHeroInstance : : SecondarySkill > ( hero - > secSkills [ g ] . first ) ) ;
2009-07-03 22:57:14 +03:00
secSkillAreas [ g ] - > type = skill ;
2010-07-13 08:25:40 +03:00
secSkillAreas [ g ] - > bonusValue = level ;
2009-07-03 22:57:14 +03:00
secSkillAreas [ g ] - > text = CGI - > generaltexth - > skillInfoTexts [ skill ] [ level - 1 ] ;
2010-12-17 00:32:53 +02:00
secSkillAreas [ g ] - > hoverText = boost : : str ( boost : : format ( CGI - > generaltexth - > heroscrn [ 21 ] ) % CGI - > generaltexth - > levels [ level - 1 ] % CGI - > generaltexth - > skillName [ skill ] ) ;
2008-01-28 14:28:18 +02:00
}
2008-01-27 18:07:27 +02:00
2010-12-17 00:32:53 +02:00
2009-10-28 12:45:45 +02:00
//printing experience - original format does not support ui64
2010-12-17 00:32:53 +02:00
expArea - > text = CGI - > generaltexth - > allTexts [ 2 ] ;
2009-10-27 22:40:11 +02:00
boost : : replace_first ( expArea - > text , " %d " , boost : : lexical_cast < std : : string > ( hero - > level ) ) ;
boost : : replace_first ( expArea - > text , " %d " , boost : : lexical_cast < std : : string > ( CGI - > heroh - > reqExp ( hero - > level + 1 ) ) ) ;
boost : : replace_first ( expArea - > text , " %d " , boost : : lexical_cast < std : : string > ( hero - > exp ) ) ;
2008-09-29 00:01:49 +03:00
2009-06-19 15:10:36 +03:00
//printing spell points
2010-12-17 00:32:53 +02:00
spellPointsArea - > text = boost : : str ( boost : : format ( CGI - > generaltexth - > allTexts [ 205 ] ) % hero - > name % hero - > mana % hero - > manaLimit ( ) ) ;
2008-01-30 12:55:43 +02:00
2010-02-04 17:50:59 +02:00
//if we have exchange window with this hero open
bool noDismiss = false ;
2010-12-17 00:32:53 +02:00
BOOST_FOREACH ( IShowActivable * isa , GH . listInt )
2010-02-04 17:50:59 +02:00
{
2010-12-17 00:32:53 +02:00
if ( CExchangeWindow * cew = dynamic_cast < CExchangeWindow * > ( isa ) )
for ( int g = 0 ; g < ARRAY_COUNT ( cew - > heroInst ) ; + + g )
if ( cew - > heroInst [ g ] = = hero )
noDismiss = true ;
if ( CKingdomInterface * cki = dynamic_cast < CKingdomInterface * > ( isa ) )
noDismiss = true ;
2010-02-04 17:50:59 +02:00
}
dismissButton - > block ( ! ! hero - > visitedTown | | noDismiss ) ;
2010-12-17 00:32:53 +02:00
2010-12-23 22:18:10 +02:00
if ( hero - > getSecSkillLevel ( CGHeroInstance : : TACTICS ) = = 0 )
2010-12-17 00:32:53 +02:00
tacticsButton - > block ( true ) ;
2008-08-28 20:36:34 +03:00
else
{
2010-12-17 00:32:53 +02:00
tacticsButton - > block ( false ) ;
tacticsButton - > callback = vstd : : assigno ( hero - > tacticFormationEnabled , true ) ;
tacticsButton - > callback2 = vstd : : assigno ( hero - > tacticFormationEnabled , false ) ;
2008-08-28 20:36:34 +03:00
}
2008-09-24 11:15:49 +03:00
2009-06-19 15:10:36 +03:00
//setting formations
2008-10-26 22:58:34 +02:00
formations - > onChange = 0 ;
2010-05-02 21:20:26 +03:00
formations - > select ( hero - > formation , true ) ;
2009-06-19 15:10:36 +03:00
formations - > onChange = boost : : bind ( & CCallback : : setFormation , LOCPLINT - > cb , hero , _1 ) ;
2008-09-24 11:15:49 +03:00
2010-07-13 08:25:40 +03:00
morale - > set ( hero ) ;
luck - > set ( hero ) ;
2008-01-11 20:56:39 +02:00
}
void CHeroWindow : : quit ( )
{
2010-12-17 00:32:53 +02:00
adventureInt - > heroWindow = NULL ;
GH . popIntTotally ( this ) ;
2008-01-20 14:34:39 +02:00
}
2008-01-15 20:50:52 +02:00
void CHeroWindow : : dismissCurrent ( )
{
2008-08-27 13:19:18 +03:00
CFunctionList < void ( ) > ony = boost : : bind ( & CHeroWindow : : quit , this ) ;
ony + = boost : : bind ( & CCallback : : dismissHero , LOCPLINT - > cb , curHero ) ;
2009-04-14 15:47:09 +03:00
LOCPLINT - > showYesNoDialog ( CGI - > generaltexth - > allTexts [ 22 ] , std : : vector < SComponent * > ( ) , ony , 0 , false ) ;
2008-01-15 20:50:52 +02:00
}
void CHeroWindow : : questlog ( )
{
}
2010-12-17 00:32:53 +02:00
void CHeroWindow : : showAll ( SDL_Surface * to )
2008-01-15 20:50:52 +02:00
{
2010-12-17 00:32:53 +02:00
CIntObject : : showAll ( to ) ;
2009-06-17 12:38:03 +03:00
//blitting portrait
2010-12-17 00:32:53 +02:00
blitAtLoc ( graphics - > portraitLarge [ curHero - > portrait ] , 19 , 19 , to ) ;
2009-06-17 12:38:03 +03:00
//printing hero's name
2010-12-17 00:32:53 +02:00
printAtMiddleLoc ( curHero - > name , 190 , 38 , FONT_BIG , tytulowy , to ) ;
2009-06-17 12:38:03 +03:00
//printing hero's level
2010-08-25 17:57:58 +03:00
std : : string secondLine = CGI - > generaltexth - > allTexts [ 342 ] ;
boost : : algorithm : : replace_first ( secondLine , " %d " , boost : : lexical_cast < std : : string > ( curHero - > level ) ) ;
boost : : algorithm : : replace_first ( secondLine , " %s " , curHero - > type - > heroClass - > name ) ;
2010-12-17 00:32:53 +02:00
printAtMiddleLoc ( secondLine , 190 , 65 , FONT_MEDIUM , zwykly , to ) ;
2009-06-01 06:04:50 +03:00
//primary skills names
2010-12-17 00:32:53 +02:00
printAtMiddleLoc ( CGI - > generaltexth - > jktexts [ 1 ] , 52 , 99 , FONT_SMALL , tytulowy , to ) ;
printAtMiddleLoc ( CGI - > generaltexth - > jktexts [ 2 ] , 123 , 99 , FONT_SMALL , tytulowy , to ) ;
printAtMiddleLoc ( CGI - > generaltexth - > jktexts [ 3 ] , 193 , 99 , FONT_SMALL , tytulowy , to ) ;
printAtMiddleLoc ( CGI - > generaltexth - > jktexts [ 4 ] , 262 , 99 , FONT_SMALL , tytulowy , to ) ;
2008-01-15 20:50:52 +02:00
//dismiss / quest log
2010-07-06 05:10:26 +03:00
std : : vector < std : : string > toPrin = CMessage : : breakText ( CGI - > generaltexth - > jktexts [ 8 ] . substr ( 1 , CGI - > generaltexth - > jktexts [ 8 ] . size ( ) - 2 ) ) ;
if ( toPrin . size ( ) = = 1 )
2008-01-15 20:50:52 +02:00
{
2010-12-17 00:32:53 +02:00
printAtLoc ( toPrin [ 0 ] , 372 , 439 , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
}
else
{
2010-12-17 00:32:53 +02:00
printAtLoc ( toPrin [ 0 ] , 372 , 430 , FONT_SMALL , zwykly , to ) ;
printAtLoc ( toPrin [ 1 ] , 372 , 446 , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
}
2010-12-17 00:32:53 +02:00
2008-01-15 20:50:52 +02:00
toPrin = CMessage : : breakText ( CGI - > generaltexth - > jktexts [ 9 ] . substr ( 1 , CGI - > generaltexth - > jktexts [ 9 ] . size ( ) - 2 ) ) ;
2010-07-06 05:10:26 +03:00
if ( toPrin . size ( ) = = 1 )
2008-01-15 20:50:52 +02:00
{
2010-12-17 00:32:53 +02:00
printAtLoc ( toPrin [ 0 ] , 512 , 439 , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
}
else
{
2010-12-17 00:32:53 +02:00
printAtLoc ( toPrin [ 0 ] , 512 , 430 , FONT_SMALL , zwykly , to ) ;
printAtLoc ( toPrin [ 1 ] , 512 , 446 , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
}
2010-12-17 00:32:53 +02:00
2008-01-15 20:50:52 +02:00
//printing primary skills' amounts
2009-06-17 19:46:16 +03:00
for ( int m = 0 ; m < 4 ; + + m )
{
2010-12-17 00:32:53 +02:00
std : : ostringstream primarySkill ;
primarySkill < < curHero - > getPrimSkillLevel ( m ) ;
printAtMiddleLoc ( primarySkill . str ( ) , 53 + 70 * m , 166 , FONT_SMALL , zwykly , to ) ;
2009-06-17 19:46:16 +03:00
}
2010-12-17 00:32:53 +02:00
2009-06-26 18:41:19 +03:00
//morale and luck printing
2010-12-17 20:47:07 +02:00
blitAtLoc ( graphics - > luck42 - > ourImages [ curHero - > LuckVal ( ) + 3 ] . bitmap , 239 , 182 , to ) ;
blitAtLoc ( graphics - > morale42 - > ourImages [ curHero - > MoraleVal ( ) + 3 ] . bitmap , 181 , 182 , to ) ;
2010-12-17 00:32:53 +02:00
2010-12-17 20:47:07 +02:00
blitAtLoc ( flags - > ourImages [ player ] . bitmap , 606 , 8 , to ) ;
2010-12-17 00:32:53 +02:00
2008-01-13 21:42:21 +02:00
//hero list blitting
2010-12-17 00:32:53 +02:00
2009-06-11 20:21:06 +03:00
for ( int pos = 0 , g = 0 ; g < LOCPLINT - > wanderingHeroes . size ( ) ; + + g )
2008-01-13 21:42:21 +02:00
{
2010-12-17 00:32:53 +02:00
const CGHeroInstance * cur = LOCPLINT - > wanderingHeroes [ g ] ;
if ( cur - > inTownGarrison )
// Only display heroes that are not in garrison
continue ;
2010-12-17 20:47:07 +02:00
blitAtLoc ( graphics - > portraitSmall [ cur - > portrait ] , 611 , 87 + pos * 54 , to ) ;
2010-12-17 00:32:53 +02:00
//printing yellow border
if ( cur - > name = = curHero - > name )
{
for ( int f = 0 ; f < graphics - > portraitSmall [ cur - > portrait ] - > w ; + + f )
{
for ( int h = 0 ; h < graphics - > portraitSmall [ cur - > portrait ] - > h ; + + h )
if ( f = = 0 | | h = = 0 | | f = = graphics - > portraitSmall [ cur - > portrait ] - > w - 1 | | h = = graphics - > portraitSmall [ cur - > portrait ] - > h - 1 )
{
CSDL_Ext : : SDL_PutPixelWithoutRefresh ( to , 611 + f , 87 + pos * 54 + h , 240 , 220 , 120 ) ;
}
}
}
pos + + ;
2008-01-13 21:42:21 +02:00
}
2010-12-17 00:32:53 +02:00
2008-01-15 20:50:52 +02:00
//secondary skills
2010-07-31 16:18:40 +03:00
for ( size_t v = 0 ; v < std : : min ( secSkillAreas . size ( ) , curHero - > secSkills . size ( ) ) ; + + v )
2008-01-15 20:50:52 +02:00
{
2010-12-17 20:47:07 +02:00
blitAtLoc ( graphics - > abils44 - > ourImages [ curHero - > secSkills [ v ] . first * 3 + 3 + curHero - > secSkills [ v ] . second - 1 ] . bitmap , v % 2 ? 161 : 18 , 276 + 48 * ( v / 2 ) , to ) ;
2010-12-17 00:32:53 +02:00
printAtLoc ( CGI - > generaltexth - > levels [ curHero - > secSkills [ v ] . second - 1 ] , v % 2 ? 212 : 68 , 280 + 48 * ( v / 2 ) , FONT_SMALL , zwykly , to ) ;
printAtLoc ( CGI - > generaltexth - > skillName [ curHero - > secSkills [ v ] . first ] , v % 2 ? 212 : 68 , 300 + 48 * ( v / 2 ) , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
}
2010-12-17 00:32:53 +02:00
2008-01-15 20:50:52 +02:00
//printing special ability
2010-12-17 20:47:07 +02:00
blitAtLoc ( graphics - > un44 - > ourImages [ curHero - > subID ] . bitmap , 18 , 180 , to ) ;
2010-12-17 00:32:53 +02:00
printAtLoc ( CGI - > generaltexth - > jktexts [ 5 ] . substr ( 1 , CGI - > generaltexth - > jktexts [ 5 ] . size ( ) - 2 ) , 69 , 183 , FONT_SMALL , tytulowy , to ) ;
printAtLoc ( CGI - > generaltexth - > hTxts [ curHero - > subID ] . bonusName , 69 , 205 , FONT_SMALL , zwykly , to ) ;
2008-01-15 20:50:52 +02:00
//printing necessery texts
2010-12-17 00:32:53 +02:00
printAtLoc ( CGI - > generaltexth - > jktexts [ 6 ] . substr ( 1 , CGI - > generaltexth - > jktexts [ 6 ] . size ( ) - 2 ) , 69 , 232 , FONT_SMALL , tytulowy , to ) ;
2009-06-17 19:46:16 +03:00
std : : ostringstream expstr ;
2008-01-15 20:50:52 +02:00
expstr < < curHero - > exp ;
2010-12-17 00:32:53 +02:00
printAtLoc ( expstr . str ( ) , 68 , 252 , FONT_SMALL , zwykly , to ) ;
printAtLoc ( CGI - > generaltexth - > jktexts [ 7 ] . substr ( 1 , CGI - > generaltexth - > jktexts [ 7 ] . size ( ) - 2 ) , 213 , 232 , FONT_SMALL , tytulowy , to ) ;
2009-06-17 19:46:16 +03:00
std : : ostringstream manastr ;
2009-05-22 22:20:30 +03:00
manastr < < curHero - > mana < < ' / ' < < curHero - > manaLimit ( ) ;
2010-12-17 00:32:53 +02:00
printAtLoc ( manastr . str ( ) , 211 , 252 , FONT_SMALL , zwykly , to ) ;
}