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 "CombatStats_gump.h"
00028 #include "Paperdoll_gump.h"
00029 #include "Gump_manager.h"
00030
00031
00032
00033
00034
00035
00036 static const int colx = 110;
00037 static const int coldx = 29;
00038 static const int rowy[7] = {15, 29, 42, 73, 87, 93, 106};
00039
00040
00041
00042
00043 CombatStats_gump::CombatStats_gump(int initx, int inity) :
00044 Gump(0, initx, inity, game->get_shape("gumps/cstats/1"))
00045 {
00046 set_object_area(Rectangle(0,0,0,0), 7, 95);
00047
00048
00049 party_size = gwin->get_party(party, 1);
00050
00051 Gump::shapenum = game->get_shape("gumps/cstats/1") + party_size - 1;
00052 ShapeID::set_shape(Gump::shapenum, 0);
00053
00054 int i;
00055 for (i = 0; i < party_size; i++) {
00056 halo_btn[i] = new Halo_button(this, colx + i*coldx, rowy[4], party[i]);
00057 cmb_btn[i] = new Combat_mode_button(this, colx + i*coldx + 1, rowy[3],
00058 party[i]);
00059 face_btn[i] = new Face_button(this, colx + i*coldx - 13, rowy[0],
00060 party[i]);
00061 }
00062 for (i = party_size; i < 9; i++) {
00063 halo_btn[i] = 0;
00064 cmb_btn[i] = 0;
00065 face_btn[i] = 0;
00066 }
00067 }
00068
00069 CombatStats_gump::~CombatStats_gump()
00070 {
00071 for (int i = 0; i < 9; i++) {
00072 delete halo_btn[i];
00073 delete cmb_btn[i];
00074 delete face_btn[i];
00075 }
00076 }
00077
00078
00079
00080
00081
00082 void CombatStats_gump::paint()
00083 {
00084 Gump_manager* gman = gumpman;
00085
00086 Gump::paint();
00087
00088
00089 for (int i = 0; i < party_size; i++) {
00090 face_btn[i]->paint();
00091
00092 gman->paint_num(party[i]->get_effective_prop(Actor::combat),
00093 x + colx + i*coldx, y + rowy[1]);
00094 gman->paint_num(party[i]->get_property(Actor::health),
00095 x + colx + i*coldx, y + rowy[2]);
00096
00097 halo_btn[i]->paint();
00098 cmb_btn[i]->paint();
00099 }
00100
00101
00102 gman->paint_num(party[0]->get_property(Actor::magic),
00103 x + colx, y + rowy[5]);
00104 gman->paint_num(party[0]->get_property(Actor::mana),
00105 x + colx, y + rowy[6]);
00106 }
00107
00108 Gump_button* CombatStats_gump::on_button(int mx, int my)
00109 {
00110 Gump_button *btn = Gump::on_button(mx, my);
00111 if (btn)
00112 return btn;
00113 for (int i = 0; i < party_size; i++) {
00114 if (halo_btn[i]->on_button(mx, my))
00115 return halo_btn[i];
00116 if (cmb_btn[i]->on_button(mx, my))
00117 return cmb_btn[i];
00118 if (face_btn[i]->on_button(mx, my))
00119 return face_btn[i];
00120 }
00121 return 0;
00122 }