Add proto_subdata_setup_int_button

This commit is contained in:
Alexander Batalov 2023-09-02 18:33:32 +03:00
parent e0b18a8785
commit 1c2fd05bcd
1 changed files with 55 additions and 0 deletions

View File

@ -22,6 +22,7 @@ namespace fallout {
#define NO 1 #define NO 1
static int proto_choose_container_flags(Proto* proto); static int proto_choose_container_flags(Proto* proto);
static int proto_subdata_setup_int_button(const char* title, int key, int value, int min_value, int max_value, int* y, int a7);
static void proto_critter_flags_redraw(int win, int pid); static void proto_critter_flags_redraw(int win, int pid);
static int proto_critter_flags_modify(int pid); static int proto_critter_flags_modify(int pid);
static int mp_pick_kill_type(); static int mp_pick_kill_type();
@ -57,6 +58,9 @@ int edit_window_color = 1;
// 0x559C60 // 0x559C60
bool can_modify_protos = false; bool can_modify_protos = false;
// 0x559C68
static int subwin = -1;
// 0x559C6C // 0x559C6C
static int critFlagList[CRITTER_FLAG_COUNT] = { static int critFlagList[CRITTER_FLAG_COUNT] = {
CRITTER_NO_STEAL, CRITTER_NO_STEAL,
@ -221,6 +225,57 @@ int proto_choose_container_flags(Proto* proto)
return 0; return 0;
} }
// 0x492A3C
int proto_subdata_setup_int_button(const char* title, int key, int value, int min_value, int max_value, int* y, int a7)
{
char text[36];
int button_x;
int value_offset_x;
button_x = 10;
value_offset_x = 90;
if (a7 == 9) {
*y -= 189;
}
if (a7 > 8) {
button_x = 165;
value_offset_x -= 16;
}
_win_register_text_button(subwin,
button_x,
*y,
-1,
-1,
-1,
key,
title,
0);
if (value >= min_value && value < max_value) {
sprintf(text, "%d", value);
windowDrawText(subwin,
text,
38,
button_x + value_offset_x,
*y + 4,
_colorTable[32747] | 0x10000);
} else {
windowDrawText(subwin,
"<ERROR>",
38,
button_x + value_offset_x,
*y + 4,
_colorTable[31744] | 0x10000);
}
*y += 21;
return 0;
}
// 0x495438 // 0x495438
const char* proto_wall_light_str(int flags) const char* proto_wall_light_str(int flags)
{ {