MCPcopy Create free account
hub / github.com/EasyRPG/Player / DrawParameter

Method DrawParameter

src/window_equipstatus.cpp:86–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void Window_EquipStatus::DrawParameter(int cx, int cy, int type) {
87 std::string_view name;
88 int value;
89 int new_value;
90
91 switch (type) {
92 case 0:
93 name = lcf::Data::terms.attack;
94 value = actor.GetAtk();
95 new_value = atk;
96 break;
97 case 1:
98 name = lcf::Data::terms.defense;
99 value = actor.GetDef();
100 new_value = def;
101 break;
102 case 2:
103 name = lcf::Data::terms.spirit;
104 value = actor.GetSpi();
105 new_value = spi;
106 break;
107 case 3:
108 name = lcf::Data::terms.agility;
109 value = actor.GetAgi();
110 new_value = agi;
111 break;
112 default:
113 return;
114 }
115
116 // Check if 4 digits are needed instead of 3
117 int limit = actor.MaxStatBaseValue();
118 bool more_space_needed = (Player::IsRPG2k3() && limit >= 500) || limit >= 1000;
119
120 // Draw Term
121 contents->TextDraw(cx, cy, 1, name);
122
123 // Draw Value
124 cx += (more_space_needed ? (8 * 6 + 6 * 4) : (10 * 6 + 6 * 3));
125 contents->TextDraw(cx, cy, Font::ColorDefault, std::to_string(value), Text::AlignRight);
126
127 if (draw_params) {
128 if (lcf::Data::terms.easyrpg_equipment_arrow == lcf::Data::terms.kDefaultTerm) {
129 if (Player::IsCP932()) {
130 // Draw fullwidth arrow
131 contents->TextDraw(cx, cy, 1, "→");
132 } else {
133 // Draw arrow (+3 for center between the two numbers)
134 contents->TextDraw(cx + 3, cy, 1, ">");
135 }
136 } else {
137 // Draw arrow
138 int offset = (12 - Text::GetSize(*Font::Default(), lcf::Data::terms.easyrpg_equipment_arrow).width) / 2;
139 contents->TextDraw(cx + offset, cy, 1, lcf::Data::terms.easyrpg_equipment_arrow);
140 }
141
142 // Draw New Value
143 cx += 6 * 2 + (more_space_needed ? (6 * 4) : (6 * 3));

Callers

nothing calls this directly

Calls 6

GetAtkMethod · 0.80
GetDefMethod · 0.80
GetSpiMethod · 0.80
GetAgiMethod · 0.80
TextDrawMethod · 0.80
MaxStatBaseValueMethod · 0.45

Tested by

no test coverage detected