Add proto_subdata_setup_fid_button

This commit is contained in:
Alexander Batalov 2023-09-02 19:31:16 +03:00
parent 1c2fd05bcd
commit b0b161ceb5
3 changed files with 67 additions and 0 deletions

View File

@ -438,6 +438,14 @@ void artRender(int fid, unsigned char* dest, int width, int height, int pitch)
artUnlock(handle);
}
// mapper2.exe: 0x40A03C
int art_list_str(int fid, char* name)
{
// TODO: Incomplete.
return -1;
}
// 0x419160
Art* artLock(int fid, CacheEntry** handlePtr)
{

View File

@ -123,6 +123,7 @@ char* artGetObjectTypeName(int objectType);
int artIsObjectTypeHidden(int objectType);
int artGetFidgetCount(int headFid);
void artRender(int fid, unsigned char* dest, int width, int height, int pitch);
int art_list_str(int fid, char* name);
Art* artLock(int fid, CacheEntry** cache_entry);
unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry** out_cache_entry);
unsigned char* artLockFrameDataReturningSize(int fid, CacheEntry** out_cache_entry, int* widthPtr, int* heightPtr);

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "art.h"
#include "color.h"
#include "combat_ai.h"
#include "critter.h"
@ -23,6 +24,7 @@ namespace fallout {
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 int proto_subdata_setup_fid_button(const char* title, int key, int fid, int* y, int a5);
static void proto_critter_flags_redraw(int win, int pid);
static int proto_critter_flags_modify(int pid);
static int mp_pick_kill_type();
@ -276,6 +278,62 @@ int proto_subdata_setup_int_button(const char* title, int key, int value, int mi
return 0;
}
// 0x492B28
int proto_subdata_setup_fid_button(const char* title, int key, int fid, int* y, int a5)
{
char text[36];
char* pch;
int button_x;
int value_offset_x;
button_x = 10;
value_offset_x = 90;
if (a5 == 9) {
*y -= 189;
}
if (a5 > 8) {
button_x = 165;
value_offset_x -= 16;
}
_win_register_text_button(subwin,
button_x,
*y,
-1,
-1,
-1,
key,
title,
0);
if (art_list_str(fid, text) != -1) {
pch = strchr(text, '.');
if (pch != NULL) {
*pch = '\0';
}
windowDrawText(subwin,
text,
80,
button_x + value_offset_x,
*y + 4,
_colorTable[32747] | 0x10000);
} else {
windowDrawText(subwin,
"None",
80,
button_x + value_offset_x,
*y + 4,
_colorTable[992] | 0x10000);
}
*y += 21;
return 0;
}
// 0x495438
const char* proto_wall_light_str(int flags)
{