1 /***************************************************************************
2                 characterinfo.cpp  -  Basic character info widget
3                              -------------------
4     begin                : Sat May 3 2003
5     copyright            : (C) 2003 by Gabor Torok
6     email                : cctorok@yahoo.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 #include "common/constants.h"
18 #include "characterinfo.h"
19 #include "item.h"
20 #include "creature.h"
21 #include "rpg/rpglib.h"
22 #include "gui/window.h"
23 #include "gui/guitheme.h"
24 #include "util.h"
25 
26 using namespace std;
27 
CharacterInfoUI(Scourge * scourge)28 CharacterInfoUI::CharacterInfoUI( Scourge *scourge ) {
29 	this->scourge = scourge;
30 	creature = NULL;
31 	win = NULL;
32 }
33 
~CharacterInfoUI()34 CharacterInfoUI::~CharacterInfoUI() {
35 }
36 
drawWidgetContents(Widget * w)37 void CharacterInfoUI::drawWidgetContents( Widget *w ) {
38 	if ( !( win && creature ) ) return;
39 
40 	//GuiTheme *theme = win->getTheme();
41 	Creature *p = creature;
42 	glDisable( GL_TEXTURE_2D );
43 	glColor4f( 1, 1, 1, 1 );
44 
45 	int y = 0;
46 	glColor4f( 1, 0.35f, 0, 1 );
47 	scourge->getSDLHandler()->texPrint( 10, y + 15, _( "Basic Statistics:" ) );
48 
49 	glColor4f( 1, 1, 1, 1 );
50 	scourge->getSDLHandler()->texPrint( 10, y + 30, "%s: %d", _( "HP" ), p->getMaxHp() );
51 	scourge->getSDLHandler()->texPrint( 10, y + 45, "%s: %d", _( "MP" ), p->getMaxMp() );
52 	scourge->getSDLHandler()->texPrint( 10, y + 60, "%s: %d", _( "AP" ), toint( p->getMaxAP() ) );
53 
54 	glColor4f( 1, 0.35f, 0, 1 );
55 	scourge->getSDLHandler()->texPrint( 10, y + 75, _( "Attack:" ) );
56 	scourge->describeAttacks( p, 10, y + 90, true );
57 
58 	glColor4f( 1, 0.35f, 0, 1 );
59 	scourge->getSDLHandler()->texPrint( 160, y + 75, _( "Unarmed Defense:" ) );
60 	scourge->describeDefense( p, 160, y + 90 );
61 }
62 
setCreature(Window * win,Creature * creature)63 void CharacterInfoUI::setCreature( Window *win,
64     Creature *creature ) {
65 	this->win = win;
66 	this->creature = creature;
67 }
68 
69