From 4cd40b33afc0fd0e7e4af85a8dd5729d5ea67a19 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 24 Jul 2023 06:50:07 +0300 Subject: [PATCH] Add mapper_edit_init --- src/graph_lib.cc | 8 + src/graph_lib.h | 1 + src/mapper/map_func.cc | 11 + src/mapper/map_func.h | 10 + src/mapper/mapper.cc | 1088 +++++++++++++++++++++++++++++++++++++++- src/mapper/mp_proto.cc | 6 + src/mapper/mp_proto.h | 2 + src/mapper/mp_targt.cc | 19 + src/mapper/mp_targt.h | 11 + src/mapper/mp_text.cc | 13 + src/mapper/mp_text.h | 10 + 11 files changed, 1178 insertions(+), 1 deletion(-) create mode 100644 src/mapper/map_func.cc create mode 100644 src/mapper/map_func.h create mode 100644 src/mapper/mp_targt.cc create mode 100644 src/mapper/mp_targt.h create mode 100644 src/mapper/mp_text.cc create mode 100644 src/mapper/mp_text.h diff --git a/src/graph_lib.cc b/src/graph_lib.cc index 08a65dd..6a432bd 100644 --- a/src/graph_lib.cc +++ b/src/graph_lib.cc @@ -52,6 +52,14 @@ unsigned char HighRGB(unsigned char color) return std::max(std::max(r, g), b); } +// 0x44ED98 +int load_lbm_to_buf(const char* path, unsigned char* buffer, int a3, int a4, int a5, int a6, int a7) +{ + // TODO: Incomplete. + + return -1; +} + // 0x44F250 int graphCompress(unsigned char* a1, unsigned char* a2, int a3) { diff --git a/src/graph_lib.h b/src/graph_lib.h index 4364973..8278c6a 100644 --- a/src/graph_lib.h +++ b/src/graph_lib.h @@ -4,6 +4,7 @@ namespace fallout { unsigned char HighRGB(unsigned char color); +int load_lbm_to_buf(const char* path, unsigned char* buffer, int a3, int a4, int a5, int a6, int a7); int graphCompress(unsigned char* a1, unsigned char* a2, int a3); int graphDecompress(unsigned char* a1, unsigned char* a2, int a3); void grayscalePaletteUpdate(int a1, int a2); diff --git a/src/mapper/map_func.cc b/src/mapper/map_func.cc new file mode 100644 index 0000000..9d96f2e --- /dev/null +++ b/src/mapper/map_func.cc @@ -0,0 +1,11 @@ +#include "mapper/map_func.h" + +namespace fallout { + +// 0x4825B0 +void setup_map_dirs() +{ + // TODO: Incomplete. +} + +} // namespace fallout diff --git a/src/mapper/map_func.h b/src/mapper/map_func.h new file mode 100644 index 0000000..fb71b2b --- /dev/null +++ b/src/mapper/map_func.h @@ -0,0 +1,10 @@ +#ifndef FALLOUT_MAPPER_MAP_FUNC_H_ +#define FALLOUT_MAPPER_MAP_FUNC_H_ + +namespace fallout { + +void setup_map_dirs(); + +} // namespace fallout + +#endif /* FALLOUT_MAPPER_MAP_FUNC_H_ */ diff --git a/src/mapper/mapper.cc b/src/mapper/mapper.cc index c1cc87b..786b5a5 100644 --- a/src/mapper/mapper.cc +++ b/src/mapper/mapper.cc @@ -5,17 +5,26 @@ #include "animation.h" #include "art.h" #include "color.h" +#include "debug.h" #include "draw.h" +#include "game.h" #include "game_mouse.h" +#include "graph_lib.h" #include "inventory.h" #include "kb.h" +#include "mapper/map_func.h" #include "mapper/mp_proto.h" +#include "mapper/mp_targt.h" +#include "mapper/mp_text.h" #include "memory.h" +#include "mouse.h" #include "object.h" #include "proto.h" #include "settings.h" #include "svga.h" +#include "tile.h" #include "window_manager.h" +#include "window_manager_private.h" namespace fallout { @@ -33,15 +42,141 @@ static int categoryToggleState(); static int categoryUnhide(); static bool proto_user_is_librarian(); static void edit_mapper(); +static void mapper_load_toolbar(int a1, int a2); static void redraw_toolname(); static void clear_toolname(); static void update_high_obj_name(Object* obj); static int mapper_mark_exit_grid(); static void mapper_mark_all_exit_grids(); +// TODO: Underlying menu/pulldown interface wants menu items to be non-const, +// needs some refactoring. + +static char kSeparator[] = ""; + +static char kNew[] = " New "; +static char kOpen[] = " Open "; +static char kSave[] = " Save "; +static char kSaveAs[] = " Save As... "; +static char kInfo[] = " Info "; +static char kOpenFromText[] = " Open From Text "; +static char kQuit[] = " Quit "; + +static char kCreatePattern[] = " Create Pattern "; +static char kUsePattern[] = " Use Pattern "; +static char kMoveMap[] = " Move Map "; +static char kMoveMapElev[] = " Move Map Elev "; +static char kCopyMapElev[] = " Copy Map Elev "; +static char kEditObjDude[] = " Edit Obj_dude "; +static char kFlushCache[] = " Flush Cache "; +static char kToggleAnimStepping[] = " Toggle Anim Stepping "; +static char kFixMapObjectsToPids[] = " Fix map-objects to pids "; +static char kSetBookmark[] = " Set Bookmark "; +static char kToggleBlockObjView[] = " Toggle Block Obj View "; +static char kToggleClickToScroll[] = " Toggle Click-To-Scroll "; +static char kSetExitGridData[] = " Set Exit-Grid Data "; +static char kMarkExitGrids[] = " Mark Exit-Grids "; +static char kMarkAllExitGrids[] = " Mark *ALL* Exit Grids "; +static char kClearMapLevel[] = " *Clear Map Level* "; +static char kCreateAllMapTexts[] = " Create ALL MAP TEXTS "; +static char kRebuildAllMaps[] = " Rebuild ALL MAPS "; + +static char kListAllScripts[] = " List all Scripts "; +static char kSetStartHex[] = " Set Start Hex "; +static char kPlaceSpatialScript[] = " Place Spatial Script "; +static char kDeleteSpatialScript[] = " Delete Spatial Script "; +static char kDeleteAllSpatialScripts[] = " Delete *ALL* Spatial SCRIPTS! "; +static char kCreateScript[] = " Create Script "; +static char kSetMapScript[] = " Set Map Script "; +static char kShowMapScript[] = " Show Map Script "; + +static char kRebuildWeapons[] = " Rebuild Weapons "; +static char kRebuildProtoList[] = " Rebuild Proto List "; +static char kRebuildAll[] = " Rebuild ALL "; +static char kRebuildBinary[] = " Rebuild Binary "; +static char kArtToProtos[] = " Art => New Protos "; +static char kSwapPrototypse[] = " Swap Prototypes "; + +// 0x559648 +char* menu_0[] = { + kNew, + kOpen, + kSave, + kSaveAs, + kSeparator, + kInfo, + kOpenFromText, + kQuit, +}; + +// 0x559668 +char* menu_1[] = { + kCreatePattern, + kUsePattern, + kSeparator, + kMoveMap, + kMoveMapElev, + kCopyMapElev, + kSeparator, + kEditObjDude, + kFlushCache, + kToggleAnimStepping, + kFixMapObjectsToPids, + kSetBookmark, + kToggleBlockObjView, + kToggleClickToScroll, + kSetExitGridData, + kMarkExitGrids, + kMarkAllExitGrids, + kClearMapLevel, + kSeparator, + kCreateAllMapTexts, + kRebuildAllMaps, +}; + +// 0x5596BC +char* menu_2[] = { + kListAllScripts, + kSetStartHex, + kPlaceSpatialScript, + kDeleteSpatialScript, + kDeleteAllSpatialScripts, + kCreateScript, + kSetMapScript, + kShowMapScript, +}; + +// 0x5596DC +char* menu_3[] = { + kRebuildWeapons, + kRebuildProtoList, + kRebuildAll, + kRebuildBinary, + kSeparator, + kArtToProtos, + kSwapPrototypse, +}; + +// 0x5596F8 +char** menu_names[] = { + menu_0, + menu_1, + menu_2, + menu_3, +}; + // 0x559748 MapTransition mapInfo = { -1, -1, 0, 0 }; +// 0x559880 +int max_art_buttons = 7; + +// 0x559884 +int art_scale_width = 49; + +// 0x559888 +int art_scale_height = 48; + // 0x5598A8 static int bookmarkWin = -1; @@ -57,15 +192,234 @@ int menu_val_0[8]; // 0x6EAA60 int menu_val_2[8]; +// 0x6EAA80 +unsigned char e_num[4][19 * 26]; + // 0x6EC408 int menu_val_1[21]; +// 0x6EC468 +unsigned char* art_shape; + +// 0x6EC46C +int to_paint_bid; + +// 0x6EC470 +int edit_bid; + +// 0x6EC474 +int paste_bid; + +// 0x6EC478 +int misc_bid; + +// 0x6EC47C +int tile_bid; + +// 0x6EC480 +int copy_bid; + +// 0x6EC484 +int delete_bid; + +// 0x6EC488 +int wall_bid; + +// 0x6EC48C +int obj_bid; + +// 0x6EC490 +int to_topdown_bid; + +// 0x6EC494 +int roof_bid; + +// 0x6EC498 +int hex_bid; + +// 0x6EC49C +int to_iso_bid; + +// 0x6EC4A0 +int scen_bid; + +// 0x6EC4A4 +int crit_bid; + // 0x6EC4A8 unsigned char* tool; // 0x6EC4AC int tool_win; +// 0x6EC4B0 +int menu_bar; + +// 0x6EC4B4 +unsigned char* lbm_buf; + +// 0x6EC4B8 +unsigned char height_inc_up[18 * 23]; + +// 0x6EC656 +unsigned char height_dec_up[18 * 23]; + +// 0x6EC7F4 +unsigned char height_dec_down[18 * 23]; + +// 0x6EC992 +unsigned char height_inc_down[18 * 23]; + +// 0x6ECB30 +unsigned char obj_down[66 * 13]; + +// 0x6ECE8A +unsigned char to_iso_down[58 * 13]; + +// 0x6ED17C +unsigned char scen_up[66 * 13]; + +// 0x6ED4D6 +unsigned char roof_up[58 * 13]; + +// 0x6ED7C8 +unsigned char crit_down[66 * 13]; + +// 0x6EDB22 +unsigned char obj_up[66 * 13]; + +// 0x6EDE7C +unsigned char crit_up[66 * 13]; + +// 0x6EE1D6 +unsigned char to_topdown_down[58 * 13]; + +// 0x6EE4C8 +unsigned char hex_up[58 * 13]; + +// 0x6EE7BA +unsigned char hex_down[58 * 13]; + +// 0x6EEAAC +unsigned char to_topdown_up[58 * 13]; + +// 0x6EED9E +unsigned char scen_down[66 * 13]; + +// 0x6EF0F8 +unsigned char edec_down[18 * 23]; + +// 0x6EF296 +unsigned char to_iso_up[58 * 13]; + +// 0x6EF588 +unsigned char roof_down[58 * 13]; + +// 0x6EF87A +unsigned char r_up[18 * 23]; + +// 0x6EFA18 +unsigned char einc_down[18 * 23]; + +// 0x6EFBB6 +unsigned char shift_l_up[18 * 23]; + +// 0x6EFD54 +unsigned char edec_up[18 * 23]; + +// 0x6EFEF2 +unsigned char shift_r_up[18 * 23]; + +// 0x6F0090 +unsigned char shift_r_down[18 * 23]; + +// 0x6F022E +unsigned char r_down[18 * 23]; + +// 0x6F03CC +unsigned char einc_up[18 * 23]; + +// 0x6F056A +unsigned char l_down[18 * 23]; + +// 0x6F0708 +unsigned char shift_l_down[18 * 23]; + +// 0x6F08A6 +unsigned char l_up[18 * 23]; + +// 0x6F0A44 +unsigned char to_edit_up[45 * 43]; + +// 0x6F11D3 +unsigned char erase_up[45 * 43]; + +// 0x6F1962 +unsigned char copy_group_up[45 * 43]; + +// 0x6F20F1 +unsigned char to_paint_down[45 * 43]; + +// 0x6F2880 +unsigned char erase_down[45 * 43]; + +// 0x6F300F +unsigned char copy_group_down[45 * 43]; + +// 0x6F379E +unsigned char to_edit_down[45 * 43]; + +// 0x6F3F2D +unsigned char copy_up[49 * 19]; + +// 0x6F42D0 +unsigned char misc_down[53 * 18]; + +// 0x6F4581 +unsigned char wall_down[53 * 18]; + +// 0x6F4832 +unsigned char delete_up[49 * 19]; + +// 0x6F4BD5 +unsigned char edit_up[49 * 19]; + +// 0x6F4F78 +unsigned char tile_up[53 * 18]; + +// 0x6F5229 +unsigned char edit_down[49 * 19]; + +// 0x6F55CC +unsigned char paste_down[49 * 19]; + +// 0x6F596F +unsigned char delete_down[49 * 19]; + +// 0x6F5D12 +unsigned char tile_down[53 * 18]; + +// 0x6F5FC3 +unsigned char copy_down[49 * 19]; + +// 0x6F6366 +unsigned char misc_up[53 * 18]; + +// 0x6F6617 +unsigned char paste_up[49 * 19]; + +// 0x6F69BA +unsigned char to_paint_up[1935]; + +// 0x6F7149 +unsigned char wall_up[53 * 18]; + +// 0x6F73FA +bool draw_mode; + +// 0x6F73FB +bool view_mode; + // gnw_main // 0x485DD0 int mapper_main(int argc, char** argv) @@ -131,7 +485,733 @@ void MapperInit() // 0x485F94 int mapper_edit_init(int argc, char** argv) { - // TODO: Incomplete. + int index; + + if (gameInitWithOptions("FALLOUT Mapper", true, 2, 0, argc, argv) == -1) { + return -1; + } + + tileEnable(); + gmouse_set_mapper_mode(true); + settings.system.executable = "mapper"; + + if (settings.mapper.override_librarian) { + can_modify_protos = true; + target_override_protection(); + } + + setup_map_dirs(); + mapper_load_toolbar(4, 0); + + max_art_buttons = (_scr_size.right - _scr_size.left - 136) / 50; + art_shape = (unsigned char*)internal_malloc(art_scale_height * art_scale_width); + if (art_shape == NULL) { + printf("Can't malloc memory!!\n"); + exit(1); + } + + menu_bar = windowCreate(0, + 0, + rectGetWidth(&_scr_size), + 16, + _colorTable[0], + WINDOW_HIDDEN); + _win_register_menu_bar(menu_bar, + 0, + 0, + rectGetWidth(&_scr_size), + 16, + 260, + _colorTable[8456]); + _win_register_menu_pulldown(menu_bar, + 8, + "FILE", + 289, + 8, + menu_names[0], + 260, + _colorTable[8456]); + _win_register_menu_pulldown(menu_bar, + 40, + "TOOLS", + 303, + 21, + menu_names[1], + 260, + _colorTable[8456]); + _win_register_menu_pulldown(menu_bar, + 80, + "SCRIPTS", + 276, + 8, + menu_names[2], + 260, + _colorTable[8456]); + + if (can_modify_protos) { + _win_register_menu_pulldown(menu_bar, + 130, + "LIBRARIAN", + 292, + 6, + &(menu_1[14]), + 260, + _colorTable[8456]); + } + + tool_win = windowCreate(0, + _scr_size.bottom - 99, + rectGetWidth(&_scr_size), + 100, + 256, + 0); + tool = windowGetBuffer(tool_win); + + lbm_buf = (unsigned char*)internal_malloc(640 * 480); + load_lbm_to_buf("data\\mapper2.lbm", + lbm_buf, + rectGetWidth(&_scr_size), + 0, + 0, + _scr_size.right - _scr_size.left, + 479); + + // + blitBufferToBuffer(lbm_buf + 380 * rectGetWidth(&_scr_size), + rectGetWidth(&_scr_size), + 100, + rectGetWidth(&_scr_size), + tool, + rectGetWidth(&_scr_size)); + + // + blitBufferToBuffer(lbm_buf + 406 * (rectGetWidth(&_scr_size)) + 101, + 18, + 23, + rectGetWidth(&_scr_size), + l_up, + 18); + blitBufferToBuffer(lbm_buf + 253 * (rectGetWidth(&_scr_size)) + 101, + 18, + 23, + rectGetWidth(&_scr_size), + l_down, + 18); + buttonCreate(tool_win, + 101, + 26, + 18, + 23, + -1, + -1, + 45, + -1, + l_up, + l_down, + NULL, + 0); + + // + blitBufferToBuffer(lbm_buf + 406 * (rectGetWidth(&_scr_size)) + 622, + 18, + 23, + rectGetWidth(&_scr_size), + r_up, + 18); + blitBufferToBuffer(lbm_buf + 253 * (rectGetWidth(&_scr_size)) + 622, + 18, + 23, + rectGetWidth(&_scr_size), + r_down, + 18); + buttonCreate(tool_win, + _scr_size.right - 18, + 1, + 18, + 23, + -1, + -1, + 61, + -1, + r_up, + r_down, + NULL, + 0); + + // + blitBufferToBuffer(lbm_buf + 381 * (rectGetWidth(&_scr_size)) + 101, + 18, + 23, + rectGetWidth(&_scr_size), + shift_l_up, + 18); + blitBufferToBuffer(lbm_buf + 228 * (rectGetWidth(&_scr_size)) + 101, + 18, + 23, + rectGetWidth(&_scr_size), + shift_l_down, + 18); + buttonCreate(tool_win, + 101, + 1, + 18, + 23, + -1, + -1, + 95, + -1, + shift_l_up, + shift_l_down, + NULL, + 0); + + // + blitBufferToBuffer(lbm_buf + 381 * (rectGetWidth(&_scr_size)) + 622, + 18, + 23, + rectGetWidth(&_scr_size), + shift_r_up, + 18); + blitBufferToBuffer(lbm_buf + 228 * (rectGetWidth(&_scr_size)) + 622, + 18, + 23, + rectGetWidth(&_scr_size), + shift_r_down, + 18); + buttonCreate(tool_win, + _scr_size.right - 18, + 1, + 18, + 23, + -1, + -1, + 43, + -1, + shift_r_up, + shift_r_down, + NULL, + 0); + + // + for (index = 0; index < max_art_buttons; index++) { + int btn = buttonCreate(tool_win, + index * (art_scale_width + 1) + 121, + 1, + art_scale_width, + art_scale_height, + index + max_art_buttons + 161, + 58, + 160 + index, + -1, + NULL, + NULL, + NULL, + 0); + buttonSetRightMouseCallbacks(btn, 160 + index, -1, NULL, NULL); + } + + // ELEVATION INC + blitBufferToBuffer(lbm_buf + 431 * (rectGetWidth(&_scr_size)) + 1, + 18, + 23, + rectGetWidth(&_scr_size), + einc_up, + 18); + blitBufferToBuffer(lbm_buf + 325 * (rectGetWidth(&_scr_size)) + 1, + 18, + 23, + rectGetWidth(&_scr_size), + einc_down, + 18); + buttonCreate(tool_win, + 1, + 51, + 18, + 23, + -1, + -1, + 329, + -1, + einc_up, + einc_down, + NULL, + 0); + + // ELEVATION DEC + blitBufferToBuffer(lbm_buf + 456 * (rectGetWidth(&_scr_size)) + 1, + 18, + 23, + rectGetWidth(&_scr_size), + edec_up, + 18); + blitBufferToBuffer(lbm_buf + 350 * (rectGetWidth(&_scr_size)) + 1, + 18, + 23, + rectGetWidth(&_scr_size), + edec_down, + 18); + buttonCreate(tool_win, + 1, + 76, + 18, + 23, + -1, + -1, + 337, + -1, + edec_up, + edec_down, + NULL, + 0); + + // ELEVATION + for (index = 0; index < 4; index++) { + blitBufferToBuffer(lbm_buf + 293 * rectGetWidth(&_scr_size) + 19 * index, + 19, + 26, + rectGetWidth(&_scr_size), + e_num[1], + 19); + } + + view_mode = false; + + // + blitBufferToBuffer(lbm_buf + 169 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + to_iso_up, + 58); + blitBufferToBuffer(lbm_buf + 108 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + to_iso_down, + 58); + + // ROOF + blitBufferToBuffer(lbm_buf + 464 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + roof_up, + 58); + blitBufferToBuffer(lbm_buf + 358 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + roof_down, + 58); + roof_bid = buttonCreate(tool_win, + 64, + 69, + 58, + 13, + -1, + -1, + 'r', + 'r', + roof_up, + roof_down, + NULL, + BUTTON_FLAG_0x01); + + if (tileRoofIsVisible()) { + tile_toggle_roof(false); + } + + // HEX + blitBufferToBuffer(lbm_buf + 464 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + hex_up, + 58); + blitBufferToBuffer(lbm_buf + 358 * (rectGetWidth(&_scr_size)) + 64, + 58, + 13, + rectGetWidth(&_scr_size), + hex_down, + 58); + hex_bid = buttonCreate(tool_win, + 64, + 84, + 58, + 13, + -1, + -1, + 350, + 350, + hex_up, + hex_down, + NULL, + BUTTON_FLAG_0x01); + + // OBJ + blitBufferToBuffer(lbm_buf + 434 * (rectGetWidth(&_scr_size)) + 125, + 66, + 13, + rectGetWidth(&_scr_size), + obj_up, + 66); + blitBufferToBuffer(lbm_buf + 328 * (rectGetWidth(&_scr_size)) + 125, + 66, + 13, + rectGetWidth(&_scr_size), + obj_down, + 66); + obj_bid = buttonCreate(tool_win, + 125, + 54, + 66, + 13, + -1, + -1, + 350, + 350, + obj_up, + obj_down, + NULL, + BUTTON_FLAG_0x01); + + // CRIT + blitBufferToBuffer(lbm_buf + 449 * (rectGetWidth(&_scr_size)) + 125, + 66, + 13, + rectGetWidth(&_scr_size), + crit_up, + 66); + blitBufferToBuffer(lbm_buf + 343 * (rectGetWidth(&_scr_size)) + 125, + 66, + 13, + rectGetWidth(&_scr_size), + crit_down, + 66); + crit_bid = buttonCreate(tool_win, + 125, + 69, + 66, + 13, + -1, + -1, + 351, + 351, + crit_up, + crit_down, + NULL, + BUTTON_FLAG_0x01); + + // SCEN + blitBufferToBuffer(lbm_buf + 434 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + scen_up, + 53); + blitBufferToBuffer(lbm_buf + 328 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + scen_down, + 53); + scen_bid = buttonCreate(tool_win, + 125, + 84, + 66, + 13, + -1, + -1, + 352, + 352, + scen_up, + scen_down, + NULL, + BUTTON_FLAG_0x01); + + // WALL + blitBufferToBuffer(lbm_buf + 434 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + wall_up, + 53); + blitBufferToBuffer(lbm_buf + 328 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + wall_down, + 53); + wall_bid = buttonCreate(tool_win, + 194, + 54, + 53, + 13, + -1, + -1, + 355, + 355, + wall_up, + wall_down, + NULL, + BUTTON_FLAG_0x01); + + // MISC + blitBufferToBuffer(lbm_buf + 464 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + misc_up, + 53); + blitBufferToBuffer(lbm_buf + 358 * (rectGetWidth(&_scr_size)) + 194, + 53, + 13, + rectGetWidth(&_scr_size), + misc_down, + 53); + misc_bid = buttonCreate(tool_win, + 194, + 84, + 53, + 13, + -1, + -1, + 355, + 355, + misc_up, + misc_down, + NULL, + BUTTON_FLAG_0x01); + + // HEIGHT INC + blitBufferToBuffer(lbm_buf + 431 * rectGetWidth(&_scr_size) + 251, + 18, + 23, + rectGetWidth(&_scr_size), + height_inc_up, + 18); + blitBufferToBuffer(lbm_buf + 325 * rectGetWidth(&_scr_size) + 251, + 18, + 23, + rectGetWidth(&_scr_size), + height_inc_down, + 18); + buttonCreate(tool_win, + 251, + 51, + 18, + 23, + -1, + -1, + 371, + -1, + height_dec_up, + height_dec_down, + NULL, + 0); + + // HEIGHT DEC + blitBufferToBuffer(lbm_buf + 456 * rectGetWidth(&_scr_size) + 251, + 18, + 23, + rectGetWidth(&_scr_size), + height_dec_up, + 18); + blitBufferToBuffer(lbm_buf + 350 * rectGetWidth(&_scr_size) + 251, + 18, + 23, + rectGetWidth(&_scr_size), + height_dec_down, + 18); + buttonCreate(tool_win, + 251, + 76, + 18, + 23, + -1, + -1, + 371, + -1, + height_dec_up, + height_dec_down, + NULL, + 0); + + // ARROWS + for (index = 0; index < ROTATION_COUNT; index++) { + } + + // COPY + blitBufferToBuffer(lbm_buf + 435 * (rectGetWidth(&_scr_size)) + 325, + 49, + 19, + rectGetWidth(&_scr_size), + copy_up, + 49); + blitBufferToBuffer(lbm_buf + 329 * (rectGetWidth(&_scr_size)) + 325, + 49, + 19, + rectGetWidth(&_scr_size), + copy_down, + 49); + copy_bid = buttonCreate(tool_win, + 325, + 55, + 49, + 19, + -1, + -1, + 99, + -1, + copy_up, + copy_down, + 0, + 0); + + // PASTE + blitBufferToBuffer(lbm_buf + 457 * (rectGetWidth(&_scr_size)) + 325, + 49, + 19, + rectGetWidth(&_scr_size), + paste_up, + 49); + blitBufferToBuffer(lbm_buf + 351 * (rectGetWidth(&_scr_size)) + 325, + 49, + 19, + rectGetWidth(&_scr_size), + paste_down, + 49); + paste_bid = buttonCreate(tool_win, + 325, + 77, + 49, + 19, + -1, + -1, + 67, + -1, + paste_up, + paste_down, + NULL, + 0); + + // EDIT + blitBufferToBuffer(lbm_buf + 435 * (rectGetWidth(&_scr_size)) + 378, + 49, + 19, + rectGetWidth(&_scr_size), + edit_up, + 49); + blitBufferToBuffer(lbm_buf + 329 * (rectGetWidth(&_scr_size)) + 378, + 49, + 19, + rectGetWidth(&_scr_size), + edit_down, + 49); + edit_bid = buttonCreate(tool_win, + 378, + 55, + 49, + 19, + -1, + -1, + 101, + -1, + edit_up, + edit_down, + NULL, + 0); + + // DELETE + blitBufferToBuffer(lbm_buf + 457 * rectGetWidth(&_scr_size) + 378, + 49, + 19, + rectGetWidth(&_scr_size), + delete_up, + 49); + blitBufferToBuffer(lbm_buf + 351 * rectGetWidth(&_scr_size) + 378, + 49, + 19, + rectGetWidth(&_scr_size), + delete_down, + 49); + delete_bid = buttonCreate(tool_win, + 378, + 77, + 49, + 19, + -1, + -1, + 339, + -1, + delete_up, + delete_down, + NULL, + 0); + + draw_mode = false; + + blitBufferToBuffer(lbm_buf + 169 * rectGetWidth(&_scr_size) + 430, + 45, + 43, + rectGetWidth(&_scr_size), + to_edit_up, + 45); + blitBufferToBuffer(lbm_buf + 108 * rectGetWidth(&_scr_size) + 430, + 45, + 43, + rectGetWidth(&_scr_size), + to_edit_down, + 45); + + blitBufferToBuffer(lbm_buf + 169 * rectGetWidth(&_scr_size) + 327, + 45, + 43, + rectGetWidth(&_scr_size), + copy_group_up, + 45); + blitBufferToBuffer(lbm_buf + 108 * rectGetWidth(&_scr_size) + 327, + 45, + 43, + rectGetWidth(&_scr_size), + copy_group_down, + 45); + + blitBufferToBuffer(lbm_buf + 169 * rectGetWidth(&_scr_size) + 379, + 45, + 43, + rectGetWidth(&_scr_size), + erase_up, + 45); + blitBufferToBuffer(lbm_buf + 108 * rectGetWidth(&_scr_size) + 379, + 45, + 43, + rectGetWidth(&_scr_size), + erase_down, + 45); + + internal_free(lbm_buf); + windowRefresh(tool_win); + + if (bookmarkInit() == -1) { + debugPrint("\nbookmarkInit() Failed!"); + } + + if (categoryInit() == -1) { + debugPrint("\ncategoryInit() Failed!"); + } + + tileScrollBlockingDisable(); + tileScrollLimitingDisable(); + init_mapper_protos(); + _map_init(); + target_init(); + mouseShowCursor(); + + if (settings.mapper.rebuild_protos) { + proto_build_all_texts(); + settings.mapper.rebuild_protos = false; + } return 0; } @@ -249,6 +1329,12 @@ void edit_mapper() // TODO: Incomplete. } +// 0x48AFFC +void mapper_load_toolbar(int a1, int a2) +{ + // TODO: Incomplete. +} + // 0x48B16C void print_toolbar_name(int object_type) { diff --git a/src/mapper/mp_proto.cc b/src/mapper/mp_proto.cc index 3e89993..7678d9c 100644 --- a/src/mapper/mp_proto.cc +++ b/src/mapper/mp_proto.cc @@ -5,4 +5,10 @@ namespace fallout { // 0x559C60 bool can_modify_protos = false; +// 0x4922F8 +void init_mapper_protos() +{ + // TODO: Incomplete. +} + } // namespace fallout diff --git a/src/mapper/mp_proto.h b/src/mapper/mp_proto.h index 2bf6e8d..63cda50 100644 --- a/src/mapper/mp_proto.h +++ b/src/mapper/mp_proto.h @@ -5,6 +5,8 @@ namespace fallout { extern bool can_modify_protos; +void init_mapper_protos(); + } // namespace fallout #endif /* FALLOUT_MAPPER_MP_PROTO_H_ */ diff --git a/src/mapper/mp_targt.cc b/src/mapper/mp_targt.cc new file mode 100644 index 0000000..b9892bd --- /dev/null +++ b/src/mapper/mp_targt.cc @@ -0,0 +1,19 @@ +#include "mapper/mp_targt.h" + +namespace fallout { + +// 0x49B2F0 +void target_override_protection() +{ + // TODO: Incomplete. +} + +// 0x49B424 +int target_init() +{ + // TODO: Incomplete. + + return 0; +} + +} // namespace fallout diff --git a/src/mapper/mp_targt.h b/src/mapper/mp_targt.h new file mode 100644 index 0000000..9e7f071 --- /dev/null +++ b/src/mapper/mp_targt.h @@ -0,0 +1,11 @@ +#ifndef FALLOUT_MAPPER_MP_TARGT_H_ +#define FALLOUT_MAPPER_MP_TARGT_H_ + +namespace fallout { + +void target_override_protection(); +int target_init(); + +} // namespace fallout + +#endif /* FALLOUT_MAPPER_MP_TARGT_H_ */ diff --git a/src/mapper/mp_text.cc b/src/mapper/mp_text.cc new file mode 100644 index 0000000..3d40fb8 --- /dev/null +++ b/src/mapper/mp_text.cc @@ -0,0 +1,13 @@ +#include "mapper/mp_text.h" + +namespace fallout { + +// 0x49DAC4 +int proto_build_all_texts() +{ + // TODO: Incomplete. + + return 0; +} + +} // namespace fallout diff --git a/src/mapper/mp_text.h b/src/mapper/mp_text.h new file mode 100644 index 0000000..b275878 --- /dev/null +++ b/src/mapper/mp_text.h @@ -0,0 +1,10 @@ +#ifndef FALLOUT_MAPPER_MP_TEXT_H_ +#define FALLOUT_MAPPER_MP_TEXT_H_ + +namespace fallout { + +int proto_build_all_texts(); + +} // namespace fallout + +#endif /* FALLOUT_MAPPER_MP_TEXT_H_ */