00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022
00023 #include "actors.h"
00024 #include "game.h"
00025 #include "gamewin.h"
00026 #include "misc_buttons.h"
00027 #include "Stats_gump.h"
00028 #include "Gump_manager.h"
00029
00030
00031
00032
00033
00034
00035 const int ASLEEP = 0, POISONED = 1, CHARMED = 2, HUNGRY = 3,
00036 PROTECTED = 4, CURSED = 5, PARALYZED = 6;
00037
00038
00039
00040
00041
00042 short Stats_gump::textx = 123;
00043 short Stats_gump::texty[10] = {17, 26, 35, 46, 55, 67, 76, 86,
00044 95, 104};
00045
00046
00047
00048
00049
00050
00051
00052 static int Show_atts
00053 (
00054 int x, int y,
00055 int framenum
00056 )
00057 {
00058 Shape_manager *sman = Shape_manager::get_instance();
00059 ShapeID sid(game->get_shape("gumps/statatts"), framenum, SF_GUMPS_VGA);
00060 Shape_frame *s = sid.get_shape();
00061 sman->paint_shape(x + s->get_xleft(),
00062 y + s->get_ybelow(), s, 1);
00063 return s->get_width() + 2;
00064 }
00065
00066
00067
00068
00069 Stats_gump::Stats_gump
00070 (
00071 Container_game_object *cont,
00072 int initx, int inity
00073 ) : Gump(cont, initx, inity, game->get_shape("gumps/statsdisplay"))
00074 {
00075 set_object_area(Rectangle(0,0,0,0), 6, 136);
00076 }
00077
00078
00079
00080
00081
00082 void Stats_gump::paint
00083 (
00084 )
00085 {
00086 Gump_manager* gman = gumpman;
00087
00088
00089 const int namex = 30, namey = 6, namew = 95;
00090 Actor *act = get_actor();
00091 if (gwin->get_main_actor()->get_flag(Obj_flags::freeze))
00092 {
00093 int temp = act->get_temperature();
00094 int framenum = temp/10;
00095 if (framenum <= 0)
00096 framenum = 1;
00097 else if (framenum > 5)
00098 framenum = 5;
00099 set_frame(framenum);
00100 }
00101
00102 paint_shape(x, y);
00103
00104 check_button->paint();
00105
00106 std::string nm = act->get_name();
00107 sman->paint_text(2, nm.c_str(), x + namex +
00108 (namew - sman->get_text_width(2, nm.c_str()))/2, y + namey);
00109 gman->paint_num(act->get_effective_prop(Actor::strength),
00110 x + textx, y + texty[0]);
00111 gman->paint_num(act->get_effective_prop(Actor::dexterity),
00112 x + textx, y + texty[1]);
00113 gman->paint_num(act->get_effective_prop(Actor::intelligence),
00114 x + textx, y + texty[2]);
00115 gman->paint_num(act->get_effective_prop(Actor::combat),
00116 x + textx, y + texty[3]);
00117 gman->paint_num(act->get_property(Actor::magic),
00118 x + textx, y + texty[4]);
00119 gman->paint_num(act->get_property(Actor::health),
00120 x + textx, y + texty[5]);
00121 gman->paint_num(act->get_property(Actor::mana),
00122 x + textx, y + texty[6]);
00123 gman->paint_num(act->get_property(Actor::exp),
00124 x + textx, y + texty[7]);
00125 gman->paint_num(act->get_level(), x + textx, y + texty[8]);
00126 gman->paint_num(act->get_property(Actor::training),
00127 x + textx, y + texty[9]);
00128
00129 const int attsy = 130, attsx0 = 29;
00130 int attsx = attsx0;
00131 if (act->get_flag(Obj_flags::asleep))
00132 attsx += Show_atts(x + attsx, y + attsy, ASLEEP);
00133 if (act->get_flag(Obj_flags::poisoned))
00134 attsx += Show_atts(x + attsx, y + attsy, POISONED);
00135 if (act->get_flag(Obj_flags::charmed))
00136 attsx += Show_atts(x + attsx, y + attsy, CHARMED);
00137 if (act->get_property((int) Actor::food_level) <= 4)
00138 attsx += Show_atts(x + attsx, y + attsy, HUNGRY);
00139 if (act->get_flag(Obj_flags::protection))
00140 attsx += Show_atts(x + attsx, y + attsy, PROTECTED);
00141 if (act->get_flag(Obj_flags::cursed))
00142 attsx += Show_atts(x + attsx, y + attsy, CURSED);
00143 if (act->get_flag(Obj_flags::paralyzed))
00144 attsx += Show_atts(x + attsx, y + attsy, PARALYZED);
00145 }