backend-infra-engineer: Release 0.2.2 snapshot
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
#include "assembly_editor.h"
|
||||
|
||||
#include "ImGuiColorTextEdit/TextEditor.h"
|
||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/modules/text_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::FileDialogWrapper;
|
||||
@@ -278,21 +276,14 @@ void AssemblyEditor::DrawFileTabView() {
|
||||
void AssemblyEditor::DrawFileMenu() {
|
||||
if (ImGui::BeginMenu("File")) {
|
||||
if (ImGui::MenuItem("Open", "Ctrl+O")) {
|
||||
ImGuiFileDialog::Instance()->OpenDialog(
|
||||
"ChooseASMFileDlg", "Open ASM file", ".asm,.txt", ".");
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
ChangeActiveFile(filename);
|
||||
}
|
||||
if (ImGui::MenuItem("Save", "Ctrl+S")) {
|
||||
// TODO: Implement this
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGuiFileDialog::Instance()->Display("ChooseASMFileDlg")) {
|
||||
if (ImGuiFileDialog::Instance()->IsOk()) {
|
||||
ChangeActiveFile(ImGuiFileDialog::Instance()->GetFilePathName());
|
||||
}
|
||||
ImGuiFileDialog::Instance()->Close();
|
||||
}
|
||||
}
|
||||
|
||||
void AssemblyEditor::DrawEditMenu() {
|
||||
@@ -364,5 +355,4 @@ absl::Status AssemblyEditor::Redo() {
|
||||
absl::Status AssemblyEditor::Update() { return absl::OkStatus(); }
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ImGuiColorTextEdit/TextEditor.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/gui/modules/text_editor.h"
|
||||
#include "app/gui/style.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -69,7 +68,6 @@ class AssemblyEditor : public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::SameLine;
|
||||
@@ -78,7 +77,6 @@ struct MemoryEditorWithDiffChecker : public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/dungeon/object_names.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
#include "zelda3/dungeon/room.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -72,11 +72,12 @@ absl::Status DungeonEditor::Update() {
|
||||
|
||||
absl::Status DungeonEditor::Initialize() {
|
||||
auto dungeon_man_pal_group = rom()->palette_group().dungeon_main;
|
||||
|
||||
for (int i = 0; i < 0x100 + 40; i++) {
|
||||
rooms_.emplace_back(zelda3::dungeon::Room(/*room_id=*/i));
|
||||
rooms_.emplace_back(zelda3::Room(/*room_id=*/i));
|
||||
rooms_[i].LoadHeader();
|
||||
rooms_[i].LoadRoomFromROM();
|
||||
if (flags()->kDrawDungeonRoomGraphics) {
|
||||
if (core::ExperimentFlags::get().kDrawDungeonRoomGraphics) {
|
||||
rooms_[i].LoadRoomGraphics();
|
||||
}
|
||||
|
||||
@@ -96,11 +97,11 @@ absl::Status DungeonEditor::Initialize() {
|
||||
LoadDungeonRoomSize();
|
||||
// LoadRoomEntrances
|
||||
for (int i = 0; i < 0x07; ++i) {
|
||||
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, true));
|
||||
entrances_.emplace_back(zelda3::RoomEntrance(*rom(), i, true));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 0x85; ++i) {
|
||||
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, false));
|
||||
entrances_.emplace_back(zelda3::RoomEntrance(*rom(), i, false));
|
||||
}
|
||||
|
||||
// Load the palette group and palette for the dungeon
|
||||
@@ -117,31 +118,36 @@ absl::Status DungeonEditor::Initialize() {
|
||||
}
|
||||
|
||||
absl::Status DungeonEditor::RefreshGraphics() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int block = rooms_[current_room_id_].blocks()[i];
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
current_palette_group_[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
}
|
||||
std::for_each_n(
|
||||
rooms_[current_room_id_].blocks().begin(), 8,
|
||||
[this](int block) -> absl::Status {
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
current_palette_group_[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
return absl::OkStatus();
|
||||
});
|
||||
|
||||
auto sprites_aux1_pal_group = rom()->palette_group().sprites_aux1;
|
||||
for (int i = 9; i < 16; i++) {
|
||||
int block = rooms_[current_room_id_].blocks()[i];
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
sprites_aux1_pal_group[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
}
|
||||
std::for_each_n(
|
||||
rooms_[current_room_id_].blocks().begin() + 8, 8,
|
||||
[this, &sprites_aux1_pal_group](int block) -> absl::Status {
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
sprites_aux1_pal_group[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
return absl::OkStatus();
|
||||
});
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void DungeonEditor::LoadDungeonRoomSize() {
|
||||
std::map<int, std::vector<int>> rooms_by_bank;
|
||||
for (const auto& room : room_size_addresses_) {
|
||||
for (const auto &room : room_size_addresses_) {
|
||||
int bank = room.second >> 16;
|
||||
rooms_by_bank[bank].push_back(room.second);
|
||||
}
|
||||
|
||||
// Process and calculate room sizes within each bank
|
||||
for (auto& bank_rooms : rooms_by_bank) {
|
||||
for (auto &bank_rooms : rooms_by_bank) {
|
||||
// Sort the rooms within this bank
|
||||
std::sort(bank_rooms.second.begin(), bank_rooms.second.end());
|
||||
|
||||
@@ -151,7 +157,7 @@ void DungeonEditor::LoadDungeonRoomSize() {
|
||||
// Identify the room ID for the current room pointer
|
||||
int room_id =
|
||||
std::find_if(room_size_addresses_.begin(), room_size_addresses_.end(),
|
||||
[room_ptr](const auto& entry) {
|
||||
[room_ptr](const auto &entry) {
|
||||
return entry.second == room_ptr;
|
||||
})
|
||||
->first;
|
||||
@@ -315,14 +321,14 @@ void DungeonEditor::DrawRoomSelector() {
|
||||
gui::InputHexWord("Room ID", ¤t_room_id_);
|
||||
gui::InputHex("Palette ID", ¤t_palette_id_);
|
||||
|
||||
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)9);
|
||||
if (ImGuiID child_id = ImGui::GetID((void *)(intptr_t)9);
|
||||
BeginChild(child_id, ImGui::GetContentRegionAvail(), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
int i = 0;
|
||||
for (const auto each_room_name : zelda3::dungeon::kRoomNames) {
|
||||
for (const auto each_room_name : zelda3::kRoomNames) {
|
||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||
current_room_id_ == i, "Dungeon Room Names",
|
||||
core::UppercaseHexByte(i), each_room_name.data());
|
||||
core::HexByte(i), each_room_name.data());
|
||||
if (ImGui::IsItemClicked()) {
|
||||
// TODO: Jump to tab if room is already open
|
||||
current_room_id_ = i;
|
||||
@@ -396,8 +402,8 @@ void DungeonEditor::DrawEntranceSelector() {
|
||||
for (int i = 0; i < 0x85 + 7; i++) {
|
||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||
current_entrance_id_ == i, "Dungeon Entrance Names",
|
||||
core::UppercaseHexByte(i),
|
||||
zelda3::dungeon::kEntranceNames[i].data());
|
||||
core::HexByte(i),
|
||||
zelda3::kEntranceNames[i].data());
|
||||
|
||||
if (ImGui::IsItemClicked()) {
|
||||
current_entrance_id_ = i;
|
||||
@@ -428,12 +434,12 @@ void DungeonEditor::DrawDungeonTabView() {
|
||||
for (int n = 0; n < active_rooms_.Size;) {
|
||||
bool open = true;
|
||||
|
||||
if (active_rooms_[n] > sizeof(zelda3::dungeon::kRoomNames) / 4) {
|
||||
if (active_rooms_[n] > sizeof(zelda3::kRoomNames) / 4) {
|
||||
active_rooms_.erase(active_rooms_.Data + n);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BeginTabItem(zelda3::dungeon::kRoomNames[active_rooms_[n]].data(),
|
||||
if (BeginTabItem(zelda3::kRoomNames[active_rooms_[n]].data(),
|
||||
&open, ImGuiTabItemFlags_None)) {
|
||||
DrawDungeonCanvas(active_rooms_[n]);
|
||||
EndTabItem();
|
||||
@@ -514,7 +520,7 @@ void DungeonEditor::DrawRoomGraphics() {
|
||||
void DungeonEditor::DrawTileSelector() {
|
||||
if (BeginTabBar("##TabBar", ImGuiTabBarFlags_FittingPolicyScroll)) {
|
||||
if (BeginTabItem("Room Graphics")) {
|
||||
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)3);
|
||||
if (ImGuiID child_id = ImGui::GetID((void *)(intptr_t)3);
|
||||
BeginChild(child_id, ImGui::GetContentRegionAvail(), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
DrawRoomGraphics();
|
||||
@@ -543,7 +549,7 @@ void DungeonEditor::DrawObjectRenderer() {
|
||||
|
||||
int selected_object = 0;
|
||||
int i = 0;
|
||||
for (const auto object_name : zelda3::dungeon::Type1RoomObjectNames) {
|
||||
for (const auto object_name : zelda3::Type1RoomObjectNames) {
|
||||
if (ImGui::Selectable(object_name.data(), selected_object == i)) {
|
||||
selected_object = i;
|
||||
current_object_ = i;
|
||||
@@ -577,7 +583,7 @@ void DungeonEditor::DrawObjectRenderer() {
|
||||
if (object_loaded_) {
|
||||
ImGui::Begin("Memory Viewer", &object_loaded_, 0);
|
||||
static MemoryEditor mem_edit;
|
||||
mem_edit.DrawContents((void*)object_renderer_.mutable_memory(),
|
||||
mem_edit.DrawContents((void *)object_renderer_.mutable_memory(),
|
||||
object_renderer_.mutable_memory()->size());
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -586,7 +592,7 @@ void DungeonEditor::DrawObjectRenderer() {
|
||||
// ============================================================================
|
||||
|
||||
void DungeonEditor::CalculateUsageStats() {
|
||||
for (const auto& room : rooms_) {
|
||||
for (const auto &room : rooms_) {
|
||||
if (blockset_usage_.find(room.blockset) == blockset_usage_.end()) {
|
||||
blockset_usage_[room.blockset] = 1;
|
||||
} else {
|
||||
@@ -608,15 +614,15 @@ void DungeonEditor::CalculateUsageStats() {
|
||||
}
|
||||
|
||||
void DungeonEditor::RenderSetUsage(
|
||||
const absl::flat_hash_map<uint16_t, int>& usage_map, uint16_t& selected_set,
|
||||
const absl::flat_hash_map<uint16_t, int> &usage_map, uint16_t &selected_set,
|
||||
int spriteset_offset) {
|
||||
// Sort the usage map by set number
|
||||
std::vector<std::pair<uint16_t, int>> sorted_usage(usage_map.begin(),
|
||||
usage_map.end());
|
||||
std::sort(sorted_usage.begin(), sorted_usage.end(),
|
||||
[](const auto& a, const auto& b) { return a.first < b.first; });
|
||||
[](const auto &a, const auto &b) { return a.first < b.first; });
|
||||
|
||||
for (const auto& [set, count] : sorted_usage) {
|
||||
for (const auto &[set, count] : sorted_usage) {
|
||||
std::string display_str;
|
||||
if (spriteset_offset != 0x00) {
|
||||
display_str = absl::StrFormat("%#02x, %#02x: %d", set,
|
||||
@@ -637,7 +643,7 @@ namespace {
|
||||
// Range for spritesets 0-0x8F
|
||||
// Range for palettes 0-0x47
|
||||
template <typename T>
|
||||
void RenderUnusedSets(const absl::flat_hash_map<T, int>& usage_map, int max_set,
|
||||
void RenderUnusedSets(const absl::flat_hash_map<T, int> &usage_map, int max_set,
|
||||
int spriteset_offset = 0x00) {
|
||||
std::vector<int> unused_sets;
|
||||
for (int i = 0; i < max_set; i++) {
|
||||
@@ -645,7 +651,7 @@ void RenderUnusedSets(const absl::flat_hash_map<T, int>& usage_map, int max_set,
|
||||
unused_sets.push_back(i);
|
||||
}
|
||||
}
|
||||
for (const auto& set : unused_sets) {
|
||||
for (const auto &set : unused_sets) {
|
||||
if (spriteset_offset != 0x00) {
|
||||
Text("%#02x, %#02x", set, (set + spriteset_offset));
|
||||
} else {
|
||||
@@ -755,7 +761,7 @@ void DungeonEditor::DrawUsageGrid() {
|
||||
break;
|
||||
}
|
||||
// Determine if this square should be highlighted
|
||||
const auto& room = rooms_[row * squaresWide + col];
|
||||
const auto &room = rooms_[row * squaresWide + col];
|
||||
|
||||
// Create a button or selectable for each square
|
||||
ImGui::BeginGroup();
|
||||
@@ -828,5 +834,4 @@ void DungeonEditor::DrawUsageGrid() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef YAZE_APP_EDITOR_DUNGEONEDITOR_H
|
||||
#define YAZE_APP_EDITOR_DUNGEONEDITOR_H
|
||||
|
||||
#include "app/core/common.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/gfx_group_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/rom.h"
|
||||
#include "imgui/imgui.h"
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "zelda3/dungeon/room_object.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
constexpr ImGuiTabItemFlags kDungeonTabFlags =
|
||||
@@ -40,9 +39,7 @@ constexpr ImGuiTableFlags kDungeonTableFlags =
|
||||
* tile selector, and object renderer. Additionally, it handles loading room
|
||||
* entrances, calculating usage statistics, and rendering set usage.
|
||||
*/
|
||||
class DungeonEditor : public Editor,
|
||||
public SharedRom,
|
||||
public core::ExperimentFlags {
|
||||
class DungeonEditor : public Editor, public SharedRom {
|
||||
public:
|
||||
DungeonEditor() { type_ = EditorType::kDungeon; }
|
||||
|
||||
@@ -120,9 +117,9 @@ class DungeonEditor : public Editor,
|
||||
std::array<gfx::Bitmap, kNumGfxSheets> graphics_bin_;
|
||||
|
||||
std::vector<gfx::Bitmap*> room_gfx_sheets_;
|
||||
std::vector<zelda3::dungeon::Room> rooms_;
|
||||
std::vector<zelda3::dungeon::RoomEntrance> entrances_;
|
||||
zelda3::dungeon::DungeonObjectRenderer object_renderer_;
|
||||
std::vector<zelda3::Room> rooms_;
|
||||
std::vector<zelda3::RoomEntrance> entrances_;
|
||||
zelda3::DungeonObjectRenderer object_renderer_;
|
||||
|
||||
absl::flat_hash_map<uint16_t, int> spriteset_usage_;
|
||||
absl::flat_hash_map<uint16_t, int> blockset_usage_;
|
||||
@@ -143,7 +140,6 @@ class DungeonEditor : public Editor,
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,52 +1,7 @@
|
||||
#include "editor.h"
|
||||
|
||||
#include "app/core/constants.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
absl::Status DrawEditor(EditorLayoutParams *params) {
|
||||
if (params->editor == nullptr) {
|
||||
return absl::InternalError("Editor is not initialized");
|
||||
}
|
||||
|
||||
// Draw the editors based on h_split and v_split in a recursive manner
|
||||
if (params->v_split) {
|
||||
ImGui::BeginTable("##VerticalSplitTable", 2);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (params->left)
|
||||
RETURN_IF_ERROR(DrawEditor(params->left));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (params->right)
|
||||
RETURN_IF_ERROR(DrawEditor(params->right));
|
||||
|
||||
ImGui::EndTable();
|
||||
} else if (params->h_split) {
|
||||
ImGui::BeginTable("##HorizontalSplitTable", 1);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (params->top)
|
||||
RETURN_IF_ERROR(DrawEditor(params->top));
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
if (params->bottom)
|
||||
RETURN_IF_ERROR(DrawEditor(params->bottom));
|
||||
|
||||
ImGui::EndTable();
|
||||
} else {
|
||||
// No split, just draw the single editor
|
||||
ImGui::Text("%s Editor",
|
||||
kEditorNames[static_cast<int>(params->editor->type())]);
|
||||
RETURN_IF_ERROR(params->editor->Update());
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
#include "app/editor/system/resource_manager.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
/**
|
||||
* @namespace yaze::app::editor
|
||||
* @namespace yaze::editor
|
||||
* @brief Editors are the view controllers for the application.
|
||||
*/
|
||||
namespace editor {
|
||||
@@ -74,32 +73,7 @@ class Editor {
|
||||
EditorContext context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Dynamic Editor Layout Parameters
|
||||
*/
|
||||
typedef struct EditorLayoutParams {
|
||||
bool v_split;
|
||||
bool h_split;
|
||||
int v_split_pos;
|
||||
int h_split_pos;
|
||||
Editor *editor = nullptr;
|
||||
EditorLayoutParams *left = nullptr;
|
||||
EditorLayoutParams *right = nullptr;
|
||||
EditorLayoutParams *top = nullptr;
|
||||
EditorLayoutParams *bottom = nullptr;
|
||||
|
||||
EditorLayoutParams() {
|
||||
v_split = false;
|
||||
h_split = false;
|
||||
v_split_pos = 0;
|
||||
h_split_pos = 0;
|
||||
}
|
||||
} EditorLayoutParams;
|
||||
|
||||
absl::Status DrawEditor(EditorLayoutParams *params);
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_CORE_EDITOR_H
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using namespace ImGui;
|
||||
@@ -32,8 +31,8 @@ using core::FileDialogWrapper;
|
||||
|
||||
namespace {
|
||||
|
||||
bool BeginCentered(const char* name) {
|
||||
ImGuiIO const& io = GetIO();
|
||||
bool BeginCentered(const char *name) {
|
||||
ImGuiIO const &io = GetIO();
|
||||
ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
|
||||
SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGuiWindowFlags flags =
|
||||
@@ -42,19 +41,18 @@ bool BeginCentered(const char* name) {
|
||||
return Begin(name, nullptr, flags);
|
||||
}
|
||||
|
||||
bool IsEditorActive(Editor* editor, std::vector<Editor*>& active_editors) {
|
||||
bool IsEditorActive(Editor *editor, std::vector<Editor *> &active_editors) {
|
||||
return std::find(active_editors.begin(), active_editors.end(), editor) !=
|
||||
active_editors.end();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void EditorManager::SetupScreen(std::string filename) {
|
||||
void EditorManager::Initialize(std::string filename) {
|
||||
if (!filename.empty()) {
|
||||
PRINT_IF_ERROR(rom()->LoadFromFile(filename));
|
||||
}
|
||||
overworld_editor_.InitializeZeml();
|
||||
InitializeCommands();
|
||||
overworld_editor_.Initialize();
|
||||
}
|
||||
|
||||
absl::Status EditorManager::Update() {
|
||||
@@ -66,17 +64,12 @@ absl::Status EditorManager::Update() {
|
||||
DrawInfoPopup();
|
||||
|
||||
if (rom()->is_loaded() && !rom_assets_loaded_) {
|
||||
// Load all of the graphics data from the game.
|
||||
RETURN_IF_ERROR(rom()->LoadAllGraphicsData())
|
||||
// Initialize overworld graphics, maps, and palettes
|
||||
RETURN_IF_ERROR(overworld_editor_.LoadGraphics());
|
||||
rom_assets_loaded_ = true;
|
||||
}
|
||||
|
||||
if (dynamic_layout_)
|
||||
RETURN_IF_ERROR(DrawDynamicLayout())
|
||||
else
|
||||
ManageActiveEditors();
|
||||
ManageActiveEditors();
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -244,12 +237,6 @@ void EditorManager::ManageActiveEditors() {
|
||||
}
|
||||
}
|
||||
|
||||
absl::Status EditorManager::DrawDynamicLayout() {
|
||||
// Dynamic layout for multiple editors to be open at once
|
||||
// Allows for tiling and resizing of editors using ImGui
|
||||
return DrawEditor(&root_layout_);
|
||||
}
|
||||
|
||||
void EditorManager::ManageKeyboardShortcuts() {
|
||||
bool ctrl_or_super = (GetIO().KeyCtrl || GetIO().KeySuper);
|
||||
|
||||
@@ -309,81 +296,6 @@ void EditorManager::ManageKeyboardShortcuts() {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorManager::InitializeCommands() {
|
||||
if (root_layout_.editor == nullptr) {
|
||||
root_layout_.editor = &overworld_editor_;
|
||||
}
|
||||
|
||||
// New editor popup for window management commands
|
||||
static EditorLayoutParams new_layout;
|
||||
if (ImGui::BeginPopup("NewEditor")) {
|
||||
ImGui::Text("New Editor");
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Overworld")) {
|
||||
new_layout.editor = &overworld_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Dungeon")) {
|
||||
new_layout.editor = &dungeon_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Graphics")) {
|
||||
new_layout.editor = &graphics_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Music")) {
|
||||
new_layout.editor = &music_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Palette")) {
|
||||
new_layout.editor = &palette_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Screen")) {
|
||||
new_layout.editor = &screen_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Sprite")) {
|
||||
new_layout.editor = &sprite_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Code")) {
|
||||
new_layout.editor = &assembly_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Settings")) {
|
||||
new_layout.editor = &settings_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
if (ImGui::Button("Message")) {
|
||||
new_layout.editor = &message_editor_;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
editor_context_.command_manager.RegisterPrefix("window", 'w',
|
||||
"window management", "");
|
||||
editor_context_.command_manager.RegisterSubcommand(
|
||||
"window", "vsplit", '/', "vertical split",
|
||||
"split windows vertically and place editor in new window", [this]() {
|
||||
ImGui::OpenPopup("NewEditor");
|
||||
root_layout_.v_split = true;
|
||||
});
|
||||
editor_context_.command_manager.RegisterSubcommand(
|
||||
"window", "hsplit", '-', "horizontal split",
|
||||
"split windows horizontally and place editor in new window", [this]() {
|
||||
ImGui::OpenPopup("NewEditor");
|
||||
root_layout_.h_split = true;
|
||||
});
|
||||
editor_context_.command_manager.RegisterSubcommand(
|
||||
"window", "close", 'd', "close", "close the current editor", [this]() {
|
||||
if (root_layout_.editor != nullptr) {
|
||||
root_layout_.editor = nullptr;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void EditorManager::DrawStatusPopup() {
|
||||
static absl::Status prev_status;
|
||||
if (!status_.ok()) {
|
||||
@@ -415,7 +327,7 @@ void EditorManager::DrawStatusPopup() {
|
||||
void EditorManager::DrawAboutPopup() {
|
||||
if (about_) OpenPopup("About");
|
||||
if (BeginPopupModal("About", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
Text("Yet Another Zelda3 Editor - v%s", core::kYazeVersion.data());
|
||||
Text("Yet Another Zelda3 Editor - v%s", version_.c_str());
|
||||
Text("Written by: scawful");
|
||||
Spacing();
|
||||
Text("Special Thanks: Zarby89, JaredBrian");
|
||||
@@ -434,7 +346,7 @@ void EditorManager::DrawInfoPopup() {
|
||||
if (BeginPopupModal("ROM Information", nullptr,
|
||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
Text("Title: %s", rom()->title().c_str());
|
||||
Text("ROM Size: %s", core::UppercaseHexLongLong(rom()->size()).c_str());
|
||||
Text("ROM Size: %s", core::HexLongLong(rom()->size()).c_str());
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize) ||
|
||||
IsKeyPressed(ImGuiKey_Escape)) {
|
||||
@@ -457,7 +369,7 @@ void EditorManager::DrawYazeMenu() {
|
||||
show_display_settings = !show_display_settings;
|
||||
}
|
||||
PopStyleColor();
|
||||
Text("yaze v%s", core::kYazeVersion.data());
|
||||
Text("yaze v%s", version_.c_str());
|
||||
EndMenuBar();
|
||||
}
|
||||
|
||||
@@ -483,7 +395,7 @@ void EditorManager::DrawYazeMenuBar() {
|
||||
if (manager.GetRecentFiles().empty()) {
|
||||
MenuItem("No Recent Files", nullptr, false, false);
|
||||
} else {
|
||||
for (const auto& filePath : manager.GetRecentFiles()) {
|
||||
for (const auto &filePath : manager.GetRecentFiles()) {
|
||||
if (MenuItem(filePath.c_str())) {
|
||||
OpenRomOrProject(filePath);
|
||||
}
|
||||
@@ -643,7 +555,6 @@ void EditorManager::DrawYazeMenuBar() {
|
||||
}
|
||||
|
||||
if (BeginMenu("View")) {
|
||||
MenuItem("Dynamic Layout", nullptr, &dynamic_layout_);
|
||||
MenuItem("Emulator", nullptr, &show_emulator);
|
||||
Separator();
|
||||
MenuItem("Memory Editor", nullptr, &show_memory_editor);
|
||||
@@ -772,7 +683,7 @@ void EditorManager::LoadRom() {
|
||||
}
|
||||
|
||||
void EditorManager::SaveRom() {
|
||||
if (flags()->kSaveDungeonMaps) {
|
||||
if (core::ExperimentFlags::get().kSaveDungeonMaps) {
|
||||
status_ = screen_editor_.SaveDungeonMaps();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
@@ -783,7 +694,7 @@ void EditorManager::SaveRom() {
|
||||
status_ = rom()->SaveToFile(backup_rom_, save_new_auto_);
|
||||
}
|
||||
|
||||
void EditorManager::OpenRomOrProject(const std::string& filename) {
|
||||
void EditorManager::OpenRomOrProject(const std::string &filename) {
|
||||
if (absl::StrContains(filename, ".yaze")) {
|
||||
status_ = current_project_.Open(filename);
|
||||
if (status_.ok()) {
|
||||
@@ -816,5 +727,4 @@ absl::Status EditorManager::OpenProject() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "app/emu/emulator.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/rom.h"
|
||||
#include "yaze_config.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ namespace editor {
|
||||
* variable points to the currently active editor in the tab view.
|
||||
*
|
||||
*/
|
||||
class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
class EditorManager : public SharedRom {
|
||||
public:
|
||||
EditorManager() {
|
||||
current_editor_ = &overworld_editor_;
|
||||
@@ -46,9 +46,13 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
active_editors_.push_back(&sprite_editor_);
|
||||
active_editors_.push_back(&message_editor_);
|
||||
active_editors_.push_back(&screen_editor_);
|
||||
std::stringstream ss;
|
||||
ss << YAZE_VERSION_MAJOR << "." << YAZE_VERSION_MINOR << "."
|
||||
<< YAZE_VERSION_PATCH;
|
||||
ss >> version_;
|
||||
}
|
||||
|
||||
void SetupScreen(std::string filename = "");
|
||||
void Initialize(std::string filename = "");
|
||||
absl::Status Update();
|
||||
|
||||
auto emulator() -> emu::Emulator & { return emulator_; }
|
||||
@@ -56,10 +60,7 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
|
||||
private:
|
||||
void ManageActiveEditors();
|
||||
absl::Status DrawDynamicLayout();
|
||||
|
||||
void ManageKeyboardShortcuts();
|
||||
void InitializeCommands();
|
||||
|
||||
void DrawStatusPopup();
|
||||
void DrawAboutPopup();
|
||||
@@ -81,16 +82,12 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
bool save_new_auto_ = true;
|
||||
bool show_status_ = false;
|
||||
bool rom_assets_loaded_ = false;
|
||||
bool dynamic_layout_ = false;
|
||||
|
||||
std::string version_ = "";
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
emu::Emulator emulator_;
|
||||
|
||||
std::vector<Editor *> active_editors_;
|
||||
std::vector<EditorLayoutParams> active_layouts_;
|
||||
|
||||
EditorLayoutParams root_layout_;
|
||||
|
||||
Project current_project_;
|
||||
EditorContext editor_context_;
|
||||
@@ -100,7 +97,7 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
DungeonEditor dungeon_editor_;
|
||||
GraphicsEditor graphics_editor_;
|
||||
MusicEditor music_editor_;
|
||||
OverworldEditor overworld_editor_;
|
||||
OverworldEditor overworld_editor_{*rom()};
|
||||
PaletteEditor palette_editor_;
|
||||
ScreenEditor screen_editor_;
|
||||
SpriteEditor sprite_editor_;
|
||||
@@ -110,7 +107,6 @@ class EditorManager : public SharedRom, public core::ExperimentFlags {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_EDITOR_MANAGER_H
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::BeginChild;
|
||||
@@ -297,5 +296,4 @@ void GfxGroupEditor::DrawPaletteViewer() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -43,6 +42,5 @@ class GfxGroupEditor : public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
#endif // YAZE_APP_EDITOR_GFX_GROUP_EDITOR_H
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "graphics_editor.h"
|
||||
|
||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||
#include <filesystem>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "app/core/platform/clipboard.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
@@ -23,7 +25,6 @@
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -515,22 +516,19 @@ absl::Status GraphicsEditor::DrawCgxImport() {
|
||||
gui::TextWithSeparators("Cgx Import");
|
||||
InputInt("BPP", ¤t_bpp_);
|
||||
|
||||
InputText("##CGXFile", cgx_file_name_, sizeof(cgx_file_name_));
|
||||
InputText("##CGXFile", &cgx_file_name_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline("ImportCgxKey", ".CGX,.cgx\0", "Open CGX", [this]() {
|
||||
strncpy(cgx_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(cgx_file_path_));
|
||||
strncpy(cgx_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(cgx_file_name_));
|
||||
if (ImGui::Button("Open CGX")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
cgx_file_name_ = filename;
|
||||
cgx_file_path_ = std::filesystem::absolute(filename).string();
|
||||
is_open_ = true;
|
||||
cgx_loaded_ = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui::Button("Copy CGX Path")) {
|
||||
ImGui::SetClipboardText(cgx_file_path_);
|
||||
ImGui::SetClipboardText(cgx_file_path_.c_str());
|
||||
}
|
||||
|
||||
if (ImGui::Button("Load CGX Data")) {
|
||||
@@ -548,19 +546,15 @@ absl::Status GraphicsEditor::DrawCgxImport() {
|
||||
}
|
||||
|
||||
absl::Status GraphicsEditor::DrawScrImport() {
|
||||
InputText("##ScrFile", scr_file_name_, sizeof(scr_file_name_));
|
||||
InputText("##ScrFile", &scr_file_name_);
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportScrKey", ".SCR,.scr,.BAK\0", "Open SCR", [this]() {
|
||||
strncpy(scr_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(scr_file_path_));
|
||||
strncpy(scr_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(scr_file_name_));
|
||||
is_open_ = true;
|
||||
scr_loaded_ = true;
|
||||
});
|
||||
if (ImGui::Button("Open SCR")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
scr_file_name_ = filename;
|
||||
scr_file_path_ = std::filesystem::absolute(filename).string();
|
||||
is_open_ = true;
|
||||
scr_loaded_ = true;
|
||||
}
|
||||
|
||||
InputInt("SCR Mod", &scr_mod_value_);
|
||||
|
||||
@@ -584,38 +578,35 @@ absl::Status GraphicsEditor::DrawScrImport() {
|
||||
|
||||
absl::Status GraphicsEditor::DrawPaletteControls() {
|
||||
gui::TextWithSeparators("COL Import");
|
||||
InputText("##ColFile", col_file_name_, sizeof(col_file_name_));
|
||||
InputText("##ColFile", &col_file_name_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportColKey", ".COL,.col,.BAK,.bak\0", "Open COL", [this]() {
|
||||
strncpy(col_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(col_file_path_));
|
||||
strncpy(col_file_name_,
|
||||
ImGuiFileDialog::Instance()->GetCurrentFileName().c_str(),
|
||||
sizeof(col_file_name_));
|
||||
status_ = temp_rom_.LoadFromFile(col_file_path_,
|
||||
/*z3_load=*/false);
|
||||
auto col_data_ = gfx::GetColFileData(temp_rom_.data());
|
||||
if (col_file_palette_group_.size() != 0) {
|
||||
col_file_palette_group_.clear();
|
||||
}
|
||||
auto col_file_palette_group_status =
|
||||
gfx::CreatePaletteGroupFromColFile(col_data_);
|
||||
if (col_file_palette_group_status.ok()) {
|
||||
col_file_palette_group_ = col_file_palette_group_status.value();
|
||||
}
|
||||
col_file_palette_ = gfx::SnesPalette(col_data_);
|
||||
if (ImGui::Button("Open COL")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
col_file_name_ = filename;
|
||||
col_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = temp_rom_.LoadFromFile(col_file_path_,
|
||||
/*z3_load=*/false);
|
||||
auto col_data_ = gfx::GetColFileData(temp_rom_.mutable_data());
|
||||
if (col_file_palette_group_.size() != 0) {
|
||||
col_file_palette_group_.clear();
|
||||
}
|
||||
auto col_file_palette_group_status =
|
||||
gfx::CreatePaletteGroupFromColFile(col_data_);
|
||||
if (col_file_palette_group_status.ok()) {
|
||||
col_file_palette_group_ = col_file_palette_group_status.value();
|
||||
}
|
||||
col_file_palette_ = gfx::SnesPalette(col_data_);
|
||||
|
||||
// gigaleak dev format based code
|
||||
decoded_col_ = gfx::scad_format::DecodeColFile(col_file_path_);
|
||||
col_file_ = true;
|
||||
is_open_ = true;
|
||||
});
|
||||
// gigaleak dev format based code
|
||||
decoded_col_ = gfx::scad_format::DecodeColFile(col_file_path_);
|
||||
col_file_ = true;
|
||||
is_open_ = true;
|
||||
}
|
||||
HOVER_HINT(".COL, .BAK");
|
||||
|
||||
if (ImGui::Button("Copy Col Path")) {
|
||||
ImGui::SetClipboardText(col_file_path_);
|
||||
ImGui::SetClipboardText(col_file_path_.c_str());
|
||||
}
|
||||
|
||||
if (rom()->is_loaded()) {
|
||||
@@ -636,17 +627,17 @@ absl::Status GraphicsEditor::DrawPaletteControls() {
|
||||
absl::Status GraphicsEditor::DrawObjImport() {
|
||||
gui::TextWithSeparators("OBJ Import");
|
||||
|
||||
InputText("##ObjFile", obj_file_path_, sizeof(obj_file_path_));
|
||||
InputText("##ObjFile", &obj_file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportObjKey", ".obj,.OBJ,.bak,.BAK\0", "Open OBJ", [this]() {
|
||||
strncpy(file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(file_path_));
|
||||
status_ = temp_rom_.LoadFromFile(file_path_);
|
||||
is_open_ = true;
|
||||
});
|
||||
if (ImGui::Button("Open OBJ")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
obj_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = temp_rom_.LoadFromFile(obj_file_path_);
|
||||
is_open_ = true;
|
||||
obj_loaded_ = true;
|
||||
}
|
||||
HOVER_HINT(".OBJ, .BAK");
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -654,23 +645,22 @@ absl::Status GraphicsEditor::DrawObjImport() {
|
||||
absl::Status GraphicsEditor::DrawTilemapImport() {
|
||||
gui::TextWithSeparators("Tilemap Import");
|
||||
|
||||
InputText("##TMapFile", tilemap_file_path_, sizeof(tilemap_file_path_));
|
||||
InputText("##TMapFile", &tilemap_file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline(
|
||||
"ImportTilemapKey", ".DAT,.dat,.BIN,.bin,.hex,.HEX\0", "Open Tilemap",
|
||||
[this]() {
|
||||
strncpy(tilemap_file_path_,
|
||||
ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(tilemap_file_path_));
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
if (ImGui::Button("Open Tilemap")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
tilemap_file_path_ = std::filesystem::absolute(filename).string();
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
status_ = tilemap_rom_.LoadFromFile(tilemap_file_path_);
|
||||
|
||||
// Extract the high and low bytes from the file.
|
||||
auto decomp_sheet = gfx::lc_lz2::DecompressV2(
|
||||
tilemap_rom_.data(), gfx::lc_lz2::kNintendoMode1);
|
||||
tilemap_loaded_ = true;
|
||||
is_open_ = true;
|
||||
});
|
||||
// Extract the high and low bytes from the file.
|
||||
auto decomp_sheet = gfx::lc_lz2::DecompressV2(tilemap_rom_.data(),
|
||||
gfx::lc_lz2::kNintendoMode1);
|
||||
tilemap_loaded_ = true;
|
||||
is_open_ = true;
|
||||
}
|
||||
HOVER_HINT(".DAT, .BIN, .HEX");
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -678,30 +668,30 @@ absl::Status GraphicsEditor::DrawTilemapImport() {
|
||||
absl::Status GraphicsEditor::DrawFileImport() {
|
||||
gui::TextWithSeparators("BIN Import");
|
||||
|
||||
InputText("##ROMFile", file_path_, sizeof(file_path_));
|
||||
InputText("##ROMFile", &file_path_);
|
||||
SameLine();
|
||||
|
||||
gui::FileDialogPipeline("ImportDlgKey", ".bin,.hex\0", "Open BIN", [this]() {
|
||||
strncpy(file_path_, ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
|
||||
sizeof(file_path_));
|
||||
if (ImGui::Button("Open BIN")) {
|
||||
auto filename = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
file_path_ = filename;
|
||||
status_ = temp_rom_.LoadFromFile(file_path_);
|
||||
is_open_ = true;
|
||||
});
|
||||
}
|
||||
HOVER_HINT(".BIN, .HEX");
|
||||
|
||||
if (Button("Copy File Path")) {
|
||||
ImGui::SetClipboardText(file_path_);
|
||||
ImGui::SetClipboardText(file_path_.c_str());
|
||||
}
|
||||
|
||||
gui::InputHex("BIN Offset", ¤t_offset_);
|
||||
gui::InputHex("BIN Size", &bin_size_);
|
||||
|
||||
if (Button("Decompress BIN")) {
|
||||
if (strlen(file_path_) > 0) {
|
||||
RETURN_IF_ERROR(DecompressImportData(bin_size_))
|
||||
} else {
|
||||
if (file_path_.empty()) {
|
||||
return absl::InvalidArgumentError(
|
||||
"Please select a file before importing.");
|
||||
"Please select a file before decompressing.");
|
||||
}
|
||||
RETURN_IF_ERROR(DecompressImportData(bin_size_))
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
@@ -740,13 +730,12 @@ absl::Status GraphicsEditor::DrawClipboardImport() {
|
||||
absl::Status GraphicsEditor::DrawExperimentalFeatures() {
|
||||
gui::TextWithSeparators("Experimental");
|
||||
if (Button("Decompress Super Donkey Full")) {
|
||||
if (strlen(file_path_) > 0) {
|
||||
RETURN_IF_ERROR(DecompressSuperDonkey())
|
||||
} else {
|
||||
if (file_path_.empty()) {
|
||||
return absl::InvalidArgumentError(
|
||||
"Please select `super_donkey_1.bin` before "
|
||||
"importing.");
|
||||
}
|
||||
RETURN_IF_ERROR(DecompressSuperDonkey())
|
||||
}
|
||||
ImGui::SetItemTooltip(
|
||||
"Requires `super_donkey_1.bin` to be imported under the "
|
||||
@@ -758,7 +747,8 @@ absl::Status GraphicsEditor::DrawMemoryEditor() {
|
||||
std::string title = "Memory Editor";
|
||||
if (is_open_) {
|
||||
static MemoryEditor mem_edit;
|
||||
mem_edit.DrawWindow(title.c_str(), temp_rom_.data(), temp_rom_.size());
|
||||
mem_edit.DrawWindow(title.c_str(), temp_rom_.mutable_data(),
|
||||
temp_rom_.size());
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
@@ -844,5 +834,4 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -4,19 +4,18 @@
|
||||
#include <stack>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/modules/asset_browser.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// "99973","A3D80",
|
||||
@@ -143,16 +142,16 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
bool obj_loaded_ = false;
|
||||
bool tilemap_loaded_ = false;
|
||||
|
||||
char file_path_[256] = "";
|
||||
char col_file_path_[256] = "";
|
||||
char col_file_name_[256] = "";
|
||||
char cgx_file_path_[256] = "";
|
||||
char cgx_file_name_[256] = "";
|
||||
char scr_file_path_[256] = "";
|
||||
char scr_file_name_[256] = "";
|
||||
char obj_file_path_[256] = "";
|
||||
char tilemap_file_path_[256] = "";
|
||||
char tilemap_file_name_[256] = "";
|
||||
std::string file_path_ = "";
|
||||
std::string col_file_path_ = "";
|
||||
std::string col_file_name_ = "";
|
||||
std::string cgx_file_path_ = "";
|
||||
std::string cgx_file_name_ = "";
|
||||
std::string scr_file_path_ = "";
|
||||
std::string scr_file_name_ = "";
|
||||
std::string obj_file_path_ = "";
|
||||
std::string tilemap_file_path_ = "";
|
||||
std::string tilemap_file_name_ = "";
|
||||
|
||||
gui::GfxSheetAssetBrowser asset_browser_;
|
||||
|
||||
@@ -160,7 +159,7 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
|
||||
Rom temp_rom_;
|
||||
Rom tilemap_rom_;
|
||||
zelda3::overworld::Overworld overworld_;
|
||||
zelda3::Overworld overworld_;
|
||||
MemoryEditor cgx_memory_editor_;
|
||||
MemoryEditor col_memory_editor_;
|
||||
PaletteEditor palette_editor_;
|
||||
@@ -196,7 +195,6 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_GRAPHICS_EDITOR_H
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::AcceptDragDropPayload;
|
||||
@@ -472,5 +471,4 @@ absl::Status PaletteEditor::ResetColorToOriginal(
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
namespace palette_internal {
|
||||
@@ -120,7 +119,6 @@ class PaletteEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gfx/tilesheet.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/color.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -167,7 +167,7 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
|
||||
gdata[j] = rom()->data()[pc_ptr_gfx++];
|
||||
}
|
||||
|
||||
std::string label = core::UppercaseHexByte(rdata[j]);
|
||||
std::string label = core::HexByte(rdata[j]);
|
||||
dungeon_map_labels_[d][i][j] = label;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ void ScreenEditor::DrawDungeonMapsTabs() {
|
||||
std::string label =
|
||||
dungeon_map_labels_[selected_dungeon][floor_number][j];
|
||||
screen_canvas_.DrawText(label, (posX * 2), (posY * 2));
|
||||
std::string gfx_id = core::UppercaseHexByte(tile16_id);
|
||||
std::string gfx_id = core::HexByte(tile16_id);
|
||||
screen_canvas_.DrawText(gfx_id, (posX * 2), (posY * 2) + 16);
|
||||
}
|
||||
}
|
||||
@@ -392,13 +392,30 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
||||
sheets_.emplace(1, rom()->gfx_sheets()[213]);
|
||||
sheets_.emplace(2, rom()->gfx_sheets()[214]);
|
||||
sheets_.emplace(3, rom()->gfx_sheets()[215]);
|
||||
int current_tile8 = 0;
|
||||
int tile_data_offset = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 32; j++) {
|
||||
std::vector<uint8_t> tile_data(64, 0); // 8x8 tile (64 bytes
|
||||
int tile_index = current_tile8 + j;
|
||||
int x = (j % 8) * 8;
|
||||
int y = (j / 8) * 8;
|
||||
sheets_[i].Get8x8Tile(tile_index, 0, 0, tile_data, tile_data_offset);
|
||||
tile8_individual_.emplace_back(gfx::Bitmap(8, 8, 4, tile_data));
|
||||
RETURN_VOID_IF_ERROR(tile8_individual_.back().ApplyPalette(
|
||||
*rom()->mutable_dungeon_palette(3)));
|
||||
Renderer::GetInstance().RenderBitmap(&tile8_individual_.back());
|
||||
}
|
||||
tile_data_offset = 0;
|
||||
}
|
||||
dungeon_maps_loaded_ = true;
|
||||
} else {
|
||||
ImGui::Text("Failed to load dungeon map tile16");
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::BeginTable("##DungeonMapToolset", 2, ImGuiTableFlags_SizingFixedFit)) {
|
||||
if (ImGui::BeginTable("##DungeonMapToolset", 2,
|
||||
ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Draw Mode");
|
||||
ImGui::TableSetupColumn("Edit Mode");
|
||||
|
||||
@@ -470,8 +487,13 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
current_tile_canvas_.DrawBackground(ImVec2(64 * 2 + 2, 64 * 2 + 4));
|
||||
current_tile_canvas_
|
||||
.DrawBackground(); // ImVec2(64 * 2 + 2, 64 * 2 + 4));
|
||||
current_tile_canvas_.DrawContextMenu();
|
||||
if (current_tile_canvas_.DrawTilePainter(
|
||||
tile8_individual_[selected_tile8_], 16)) {
|
||||
// Modify the tile16 based on the selected tile and current_tile16_info
|
||||
}
|
||||
current_tile_canvas_.DrawBitmap(tile16_individual_[selected_tile16_], 2,
|
||||
4.0f);
|
||||
current_tile_canvas_.DrawGrid(16.f);
|
||||
@@ -538,8 +560,10 @@ void ScreenEditor::LoadBinaryGfx() {
|
||||
gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000),
|
||||
converted_bin.begin() + ((i + 1) * 0x1000));
|
||||
sheets_.emplace(i, gfx::Bitmap(128, 32, 8, gfx_sheets[i]));
|
||||
sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3));
|
||||
Renderer::GetInstance().RenderBitmap(&sheets_[i]);
|
||||
status_ = sheets_[i].ApplyPalette(*rom()->mutable_dungeon_palette(3));
|
||||
if (status_.ok()) {
|
||||
Renderer::GetInstance().RenderBitmap(&sheets_[i]);
|
||||
}
|
||||
}
|
||||
binary_gfx_loaded_ = true;
|
||||
} else {
|
||||
@@ -589,5 +613,4 @@ void ScreenEditor::DrawToolset() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ namespace editor {
|
||||
* The class inherits from the SharedRom class.
|
||||
*/
|
||||
class ScreenEditor : public SharedRom, public Editor {
|
||||
public:
|
||||
public:
|
||||
ScreenEditor() {
|
||||
screen_canvas_.SetCanvasSize(ImVec2(512, 512));
|
||||
type_ = EditorType::kScreen;
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
|
||||
absl::Status SaveDungeonMaps();
|
||||
|
||||
private:
|
||||
private:
|
||||
void DrawTitleScreenEditor();
|
||||
void DrawNamingScreenEditor();
|
||||
void DrawOverworldMapEditor();
|
||||
@@ -86,12 +85,13 @@ private:
|
||||
bool copy_button_pressed = false;
|
||||
bool paste_button_pressed = false;
|
||||
|
||||
std::vector<uint8_t> all_gfx_;
|
||||
std::array<uint16_t, 4> current_tile16_data_;
|
||||
std::unordered_map<int, gfx::Bitmap> tile16_individual_;
|
||||
std::vector<gfx::Bitmap> tile8_individual_;
|
||||
std::vector<uint8_t> all_gfx_;
|
||||
std::vector<uint8_t> gfx_bin_data_;
|
||||
std::vector<zelda3::screen::DungeonMap> dungeon_maps_;
|
||||
std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
|
||||
std::array<uint16_t, 4> current_tile16_data_;
|
||||
std::vector<uint8_t> gfx_bin_data_;
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
@@ -100,18 +100,17 @@ private:
|
||||
gfx::Tilesheet tile16_sheet_;
|
||||
gfx::InternalTile16 current_tile16_info;
|
||||
|
||||
gui::Canvas current_tile_canvas_{"##CurrentTileCanvas"};
|
||||
gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),
|
||||
gui::CanvasGridSize::k16x16, 2.0f};
|
||||
gui::Canvas screen_canvas_;
|
||||
gui::Canvas tilesheet_canvas_;
|
||||
gui::Canvas tilemap_canvas_{"##TilemapCanvas",
|
||||
ImVec2(128 + 2, (192) + 4),
|
||||
gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
|
||||
gui::CanvasGridSize::k8x8, 2.f};
|
||||
|
||||
zelda3::screen::Inventory inventory_;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "ImGuiFileDialog/ImGuiFileDialog.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -52,7 +51,7 @@ using ImGui::Text;
|
||||
absl::Status Tile16Editor::InitBlockset(
|
||||
const gfx::Bitmap& tile16_blockset_bmp, const gfx::Bitmap& current_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap>& tile16_individual,
|
||||
uint8_t all_tiles_types[0x200]) {
|
||||
std::array<uint8_t, 0x200>& all_tiles_types) {
|
||||
all_tiles_types_ = all_tiles_types;
|
||||
tile16_blockset_bmp_ = tile16_blockset_bmp;
|
||||
tile16_individual_ = tile16_individual;
|
||||
@@ -60,7 +59,7 @@ absl::Status Tile16Editor::InitBlockset(
|
||||
RETURN_IF_ERROR(LoadTile8());
|
||||
ImVector<std::string> tile16_names;
|
||||
for (int i = 0; i < 0x200; ++i) {
|
||||
std::string str = core::UppercaseHexByte(all_tiles_types_[i]);
|
||||
std::string str = core::HexByte(all_tiles_types_[i]);
|
||||
tile16_names.push_back(str);
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ absl::Status Tile16Editor::DrawTileEditControls() {
|
||||
gui::InputHexByte("Palette", ¬ify_palette.mutable_get());
|
||||
notify_palette.apply_changes();
|
||||
if (notify_palette.modified()) {
|
||||
auto palette = palettesets_[current_palette_].main;
|
||||
auto palette = palettesets_[current_palette_].main_;
|
||||
auto value = notify_palette.get();
|
||||
if (notify_palette.get() > 0x04 && notify_palette.get() < 0x06) {
|
||||
palette = palettesets_[current_palette_].aux1;
|
||||
@@ -364,16 +363,10 @@ absl::Status Tile16Editor::UpdateTile16Transfer() {
|
||||
absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||
// Create a button for loading another ROM
|
||||
if (Button("Load ROM")) {
|
||||
ImGuiFileDialog::Instance()->OpenDialog(
|
||||
"ChooseTransferFileDlgKey", "Open Transfer ROM", ".sfc,.smc", ".");
|
||||
auto file_name = core::FileDialogWrapper::ShowOpenFileDialog();
|
||||
transfer_status_ = transfer_rom_.LoadFromFile(file_name);
|
||||
transfer_started_ = true;
|
||||
}
|
||||
gui::FileDialogPipeline(
|
||||
"ChooseTransferFileDlgKey", ".sfc,.smc", std::nullopt, [&]() {
|
||||
std::string filePathName =
|
||||
ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
transfer_status_ = transfer_rom_.LoadFromFile(filePathName);
|
||||
transfer_started_ = true;
|
||||
});
|
||||
|
||||
// TODO: Implement tile16 transfer
|
||||
if (transfer_started_ && !transfer_blockset_loaded_) {
|
||||
@@ -400,5 +393,4 @@ absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -13,18 +13,17 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
/**
|
||||
* @brief Popup window to edit Tile16 data
|
||||
*/
|
||||
class Tile16Editor : public GfxContext, public SharedRom {
|
||||
class Tile16Editor : public gfx::GfxContext, public SharedRom {
|
||||
public:
|
||||
absl::Status InitBlockset(const gfx::Bitmap& tile16_blockset_bmp,
|
||||
const gfx::Bitmap& current_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap>& tile16_individual,
|
||||
uint8_t all_tiles_types[0x200]);
|
||||
std::array<uint8_t, 0x200>& all_tiles_types);
|
||||
|
||||
absl::Status Update();
|
||||
absl::Status DrawMenu();
|
||||
@@ -63,7 +62,7 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
bool priority_tile;
|
||||
int tile_size;
|
||||
|
||||
uint8_t* all_tiles_types_;
|
||||
std::array<uint8_t, 0x200> all_tiles_types_;
|
||||
|
||||
// Tile16 blockset for selecting the tile to edit
|
||||
gui::Canvas blockset_canvas_{"blocksetCanvas", ImVec2(0x100, 0x4000),
|
||||
@@ -91,7 +90,7 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
PaletteEditor palette_editor_;
|
||||
|
||||
gfx::SnesPalette palette_;
|
||||
zelda3::overworld::Overworld transfer_overworld_;
|
||||
zelda3::Overworld transfer_overworld_;
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
@@ -100,6 +99,5 @@ class Tile16Editor : public GfxContext, public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
#endif // YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "app/core/common.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
uint8_t FindMatchingCharacter(char value) {
|
||||
@@ -145,7 +144,7 @@ std::vector<uint8_t> ParseMessageToData(std::string str) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
std::vector<DictionaryEntry> BuildDictionaryEntries(app::Rom* rom) {
|
||||
std::vector<DictionaryEntry> BuildDictionaryEntries(Rom* rom) {
|
||||
std::vector<DictionaryEntry> AllDictionaries;
|
||||
for (int i = 0; i < kNumDictionaryEntries; i++) {
|
||||
std::vector<uint8_t> bytes;
|
||||
@@ -178,5 +177,4 @@ std::vector<DictionaryEntry> BuildDictionaryEntries(app::Rom* rom) {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
const uint8_t kMessageTerminator = 0x7F;
|
||||
@@ -78,7 +77,7 @@ constexpr int kTextDataEnd = 0xE7FFF;
|
||||
constexpr int kNumDictionaryEntries = 97;
|
||||
constexpr int kPointersDictionaries = 0x74703;
|
||||
|
||||
std::vector<DictionaryEntry> BuildDictionaryEntries(app::Rom* rom);
|
||||
std::vector<DictionaryEntry> BuildDictionaryEntries(Rom* rom);
|
||||
|
||||
std::string ReplaceAllDictionaryWords(std::string str,
|
||||
std::vector<DictionaryEntry> dictionary);
|
||||
@@ -278,7 +277,6 @@ ParsedElement FindMatchingElement(const std::string& str);
|
||||
std::string ParseTextDataByte(uint8_t value);
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_MESSAGE_MESSAGE_DATA_H
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "app/gui/style.h"
|
||||
#include "app/rom.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
@@ -88,7 +88,7 @@ absl::Status MessageEditor::Initialize() {
|
||||
|
||||
for (const auto& each_message : list_of_texts_) {
|
||||
std::cout << "Message #" << each_message.ID << " at address "
|
||||
<< core::UppercaseHexLong(each_message.Address) << std::endl;
|
||||
<< core::HexLong(each_message.Address) << std::endl;
|
||||
std::cout << " " << each_message.RawString << std::endl;
|
||||
|
||||
// Each string has a [:XX] char encoded
|
||||
@@ -162,10 +162,6 @@ absl::Status MessageEditor::Update() {
|
||||
}
|
||||
|
||||
void MessageEditor::DrawMessageList() {
|
||||
if (InputText("Search", &search_text_)) {
|
||||
// TODO: ImGui style text filtering
|
||||
}
|
||||
|
||||
if (BeginChild("##MessagesList", ImVec2(0, 0), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
if (BeginTable("##MessagesTable", 3, kMessageTableFlags)) {
|
||||
@@ -177,7 +173,7 @@ void MessageEditor::DrawMessageList() {
|
||||
|
||||
for (const auto& message : list_of_texts_) {
|
||||
TableNextColumn();
|
||||
if (Button(core::UppercaseHexWord(message.ID).c_str())) {
|
||||
if (Button(core::HexWord(message.ID).c_str())) {
|
||||
current_message_ = message;
|
||||
DrawMessagePreview();
|
||||
}
|
||||
@@ -186,7 +182,7 @@ void MessageEditor::DrawMessageList() {
|
||||
TableNextColumn();
|
||||
TextWrapped(
|
||||
"%s",
|
||||
core::UppercaseHexLong(list_of_texts_[message.ID].Address).c_str());
|
||||
core::HexLong(list_of_texts_[message.ID].Address).c_str());
|
||||
}
|
||||
|
||||
EndTable();
|
||||
@@ -256,7 +252,7 @@ void MessageEditor::DrawDictionary() {
|
||||
|
||||
for (const auto& dictionary : all_dictionaries_) {
|
||||
TableNextColumn();
|
||||
Text("%s", core::UppercaseHexWord(dictionary.ID).c_str());
|
||||
Text("%s", core::HexWord(dictionary.ID).c_str());
|
||||
TableNextColumn();
|
||||
Text("%s", dictionary.Contents.c_str());
|
||||
}
|
||||
@@ -336,13 +332,14 @@ void MessageEditor::ReadAllTextDataV2() {
|
||||
current_raw_message.append("[");
|
||||
current_raw_message.append(DICTIONARYTOKEN);
|
||||
current_raw_message.append(":");
|
||||
current_raw_message.append(core::UppercaseHexWord(dictionary));
|
||||
current_raw_message.append(core::HexWord(dictionary));
|
||||
current_raw_message.append("]");
|
||||
|
||||
uint32_t address = core::Get24LocalFromPC(
|
||||
rom()->data(), kPointersDictionaries + (dictionary * 2));
|
||||
rom()->mutable_data(), kPointersDictionaries + (dictionary * 2));
|
||||
uint32_t address_end = core::Get24LocalFromPC(
|
||||
rom()->data(), kPointersDictionaries + ((dictionary + 1) * 2));
|
||||
rom()->mutable_data(),
|
||||
kPointersDictionaries + ((dictionary + 1) * 2));
|
||||
|
||||
for (uint32_t i = address; i < address_end; i++) {
|
||||
parsed_message.push_back(rom()->data()[i]);
|
||||
@@ -435,13 +432,13 @@ void MessageEditor::ReadAllTextData() {
|
||||
current_message_raw.append("[");
|
||||
current_message_raw.append(DICTIONARYTOKEN);
|
||||
current_message_raw.append(":");
|
||||
current_message_raw.append(core::UppercaseHexWord(dictionary));
|
||||
current_message_raw.append(core::HexWord(dictionary));
|
||||
current_message_raw.append("]");
|
||||
|
||||
uint32_t address = core::Get24LocalFromPC(
|
||||
rom()->data(), kPointersDictionaries + (dictionary * 2));
|
||||
rom()->mutable_data(), kPointersDictionaries + (dictionary * 2));
|
||||
uint32_t address_end = core::Get24LocalFromPC(
|
||||
rom()->data(), kPointersDictionaries + ((dictionary + 1) * 2));
|
||||
rom()->mutable_data(), kPointersDictionaries + ((dictionary + 1) * 2));
|
||||
|
||||
for (uint32_t i = address; i < address_end; i++) {
|
||||
temp_bytes_parsed.push_back(rom()->data()[i]);
|
||||
@@ -703,5 +700,4 @@ void MessageEditor::SelectAll() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
constexpr int kGfxFont = 0x70000; // 2bpp format
|
||||
@@ -163,7 +162,6 @@ class MessageEditor : public Editor, public SharedRom {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "app/gui/input.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
absl::Status MusicEditor::Update() {
|
||||
@@ -218,5 +217,4 @@ void MusicEditor::DrawToolset() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
static const char* kGameSongs[] = {"Title",
|
||||
@@ -85,7 +84,6 @@ class MusicEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "app/gui/style.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::BeginChild;
|
||||
@@ -92,7 +91,7 @@ void HandleEntityDragging(zelda3::GameEntity *entity, ImVec2 canvas_p0,
|
||||
ImGui::SetDragDropPayload("ENTITY_PAYLOAD", &entity,
|
||||
sizeof(zelda3::GameEntity));
|
||||
Text("Moving %s ID: %s", entity_type.c_str(),
|
||||
core::UppercaseHexByte(entity->entity_id_).c_str());
|
||||
core::HexByte(entity->entity_id_).c_str());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
MoveEntityOnGrid(dragged_entity, canvas_p0, scrolling, free_movement);
|
||||
@@ -128,7 +127,7 @@ bool DrawEntranceInserterPopup() {
|
||||
|
||||
// TODO: Implement deleting OverworldEntrance objects, currently only hides them
|
||||
bool DrawOverworldEntrancePopup(
|
||||
zelda3::overworld::OverworldEntrance &entrance) {
|
||||
zelda3::OverworldEntrance &entrance) {
|
||||
static bool set_done = false;
|
||||
if (set_done) {
|
||||
set_done = false;
|
||||
@@ -178,7 +177,7 @@ void DrawExitInserterPopup() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit) {
|
||||
bool DrawExitEditorPopup(zelda3::OverworldExit &exit) {
|
||||
static bool set_done = false;
|
||||
if (set_done) {
|
||||
set_done = false;
|
||||
@@ -317,8 +316,8 @@ void DrawItemInsertPopup() {
|
||||
Text("Add Item");
|
||||
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||
for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
||||
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
||||
for (size_t i = 0; i < zelda3::kSecretItemNames.size(); i++) {
|
||||
if (Selectable(zelda3::kSecretItemNames[i].c_str(),
|
||||
i == new_item_id)) {
|
||||
new_item_id = i;
|
||||
}
|
||||
@@ -341,7 +340,7 @@ void DrawItemInsertPopup() {
|
||||
}
|
||||
|
||||
// TODO: Implement deleting OverworldItem objects, currently only hides them
|
||||
bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
|
||||
bool DrawItemEditorPopup(zelda3::OverworldItem &item) {
|
||||
static bool set_done = false;
|
||||
if (set_done) {
|
||||
set_done = false;
|
||||
@@ -351,8 +350,8 @@ bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
|
||||
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||
ImGui::BeginGroup();
|
||||
for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
||||
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
||||
for (size_t i = 0; i < zelda3::kSecretItemNames.size(); i++) {
|
||||
if (Selectable(zelda3::kSecretItemNames[i].c_str(),
|
||||
item.id_ == i)) {
|
||||
item.id_ = i;
|
||||
}
|
||||
@@ -489,5 +488,4 @@ bool DrawSpriteEditorPopup(zelda3::Sprite &sprite) {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity,
|
||||
@@ -23,14 +22,14 @@ void HandleEntityDragging(zelda3::GameEntity *entity, ImVec2 canvas_p0,
|
||||
bool free_movement = false);
|
||||
|
||||
bool DrawEntranceInserterPopup();
|
||||
bool DrawOverworldEntrancePopup(zelda3::overworld::OverworldEntrance &entrance);
|
||||
bool DrawOverworldEntrancePopup(zelda3::OverworldEntrance &entrance);
|
||||
|
||||
void DrawExitInserterPopup();
|
||||
bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit);
|
||||
bool DrawExitEditorPopup(zelda3::OverworldExit &exit);
|
||||
|
||||
void DrawItemInsertPopup();
|
||||
|
||||
bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item);
|
||||
bool DrawItemEditorPopup(zelda3::OverworldItem &item);
|
||||
|
||||
enum MyItemColumnID {
|
||||
MyItemColumnID_ID,
|
||||
@@ -81,7 +80,6 @@ void DrawSpriteInserterPopup();
|
||||
bool DrawSpriteEditorPopup(zelda3::Sprite &sprite);
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_OVERWORLD_ENTITY_H
|
||||
|
||||
@@ -15,20 +15,21 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/color.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/zeml.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/common.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::Renderer;
|
||||
|
||||
using ImGui::BeginChild;
|
||||
using ImGui::BeginTabBar;
|
||||
using ImGui::BeginTabItem;
|
||||
@@ -58,11 +59,11 @@ constexpr int kTile16Size = 0x10;
|
||||
|
||||
absl::Status OverworldEditor::Update() {
|
||||
status_ = absl::OkStatus();
|
||||
if (rom()->is_loaded() && !all_gfx_loaded_) {
|
||||
if (rom_.is_loaded() && !all_gfx_loaded_) {
|
||||
RETURN_IF_ERROR(tile16_editor_.InitBlockset(
|
||||
tile16_blockset_bmp_, current_gfx_bmp_, tile16_individual_,
|
||||
*overworld_.mutable_all_tiles_types()));
|
||||
RETURN_IF_ERROR(LoadEntranceTileTypes(*rom()));
|
||||
ASSIGN_OR_RETURN(entrance_tiletypes_, zelda3::LoadEntranceTileTypes(rom_));
|
||||
all_gfx_loaded_ = true;
|
||||
}
|
||||
|
||||
@@ -96,125 +97,106 @@ void OverworldEditor::DrawToolset() {
|
||||
static bool show_gfx_group = false;
|
||||
static bool show_properties = false;
|
||||
|
||||
if (BeginTable("OWToolset", 22, kToolsetTableFlags, ImVec2(0, 0))) {
|
||||
for (const auto &name : kToolsetColumnNames)
|
||||
ImGui::TableSetupColumn(name.data());
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Button(ICON_MD_UNDO)) {
|
||||
status_ = Undo();
|
||||
}
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Button(ICON_MD_REDO)) {
|
||||
status_ = Redo();
|
||||
}
|
||||
|
||||
TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Button(ICON_MD_ZOOM_OUT)) {
|
||||
ow_map_canvas_.ZoomOut();
|
||||
}
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Button(ICON_MD_ZOOM_IN)) {
|
||||
ow_map_canvas_.ZoomIn();
|
||||
}
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Button(ICON_MD_OPEN_IN_FULL)) {
|
||||
overworld_canvas_fullscreen_ = !overworld_canvas_fullscreen_;
|
||||
}
|
||||
HOVER_HINT("Fullscreen Canvas")
|
||||
|
||||
TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_PAN_TOOL_ALT, current_mode == EditingMode::PAN)) {
|
||||
current_mode = EditingMode::PAN;
|
||||
ow_map_canvas_.set_draggable(true);
|
||||
}
|
||||
HOVER_HINT("Pan (Right click and drag)")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_DRAW, current_mode == EditingMode::DRAW_TILE)) {
|
||||
current_mode = EditingMode::DRAW_TILE;
|
||||
}
|
||||
HOVER_HINT("Draw Tile")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_DOOR_FRONT, current_mode == EditingMode::ENTRANCES))
|
||||
current_mode = EditingMode::ENTRANCES;
|
||||
HOVER_HINT("Entrances")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_DOOR_BACK, current_mode == EditingMode::EXITS))
|
||||
current_mode = EditingMode::EXITS;
|
||||
HOVER_HINT("Exits")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_GRASS, current_mode == EditingMode::ITEMS))
|
||||
current_mode = EditingMode::ITEMS;
|
||||
HOVER_HINT("Items")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_PEST_CONTROL_RODENT,
|
||||
current_mode == EditingMode::SPRITES))
|
||||
current_mode = EditingMode::SPRITES;
|
||||
HOVER_HINT("Sprites")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_ADD_LOCATION,
|
||||
current_mode == EditingMode::TRANSPORTS))
|
||||
current_mode = EditingMode::TRANSPORTS;
|
||||
HOVER_HINT("Transports")
|
||||
|
||||
NEXT_COLUMN()
|
||||
if (Selectable(ICON_MD_MUSIC_NOTE, current_mode == EditingMode::MUSIC))
|
||||
current_mode = EditingMode::MUSIC;
|
||||
HOVER_HINT("Music")
|
||||
|
||||
TableNextColumn();
|
||||
if (Button(ICON_MD_GRID_VIEW)) {
|
||||
show_tile16_editor_ = !show_tile16_editor_;
|
||||
}
|
||||
HOVER_HINT("Tile16 Editor")
|
||||
|
||||
TableNextColumn();
|
||||
if (Button(ICON_MD_TABLE_CHART)) {
|
||||
show_gfx_group = !show_gfx_group;
|
||||
}
|
||||
HOVER_HINT("Gfx Group Editor")
|
||||
|
||||
TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator
|
||||
|
||||
TableNextColumn();
|
||||
if (Button(ICON_MD_CONTENT_COPY)) {
|
||||
std::vector<uint8_t> png_data;
|
||||
if (gfx::ConvertSurfaceToPNG(maps_bmp_[current_map_].surface(),
|
||||
png_data)) {
|
||||
core::CopyImageToClipboard(png_data);
|
||||
} else {
|
||||
status_ = absl::InternalError(
|
||||
"Failed to convert overworld map surface to PNG");
|
||||
if (toolset_table_.column_contents.empty()) {
|
||||
gui::AddTableColumn(toolset_table_, "##Undo", [&]() {
|
||||
if (Button(ICON_MD_UNDO)) status_ = Undo();
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Redo", [&]() {
|
||||
if (Button(ICON_MD_REDO)) status_ = Redo();
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Sep1", ICON_MD_MORE_VERT);
|
||||
gui::AddTableColumn(toolset_table_, "##ZoomOut", [&]() {
|
||||
if (Button(ICON_MD_ZOOM_OUT)) ow_map_canvas_.ZoomOut();
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##ZoomIn", [&]() {
|
||||
if (Button(ICON_MD_ZOOM_IN)) ow_map_canvas_.ZoomIn();
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Fullscreen", [&]() {
|
||||
if (Button(ICON_MD_OPEN_IN_FULL))
|
||||
overworld_canvas_fullscreen_ = !overworld_canvas_fullscreen_;
|
||||
HOVER_HINT("Fullscreen Canvas")
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Sep2", ICON_MD_MORE_VERT);
|
||||
gui::AddTableColumn(toolset_table_, "##Pan", [&]() {
|
||||
if (Selectable(ICON_MD_PAN_TOOL_ALT, current_mode == EditingMode::PAN)) {
|
||||
current_mode = EditingMode::PAN;
|
||||
ow_map_canvas_.set_draggable(true);
|
||||
}
|
||||
}
|
||||
HOVER_HINT("Copy Map to Clipboard");
|
||||
HOVER_HINT("Pan (Right click and drag)");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##DrawTile", [&]() {
|
||||
if (Selectable(ICON_MD_DRAW, current_mode == EditingMode::DRAW_TILE)) {
|
||||
current_mode = EditingMode::DRAW_TILE;
|
||||
}
|
||||
HOVER_HINT("Draw Tile");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Entrances", [&]() {
|
||||
if (Selectable(ICON_MD_DOOR_FRONT,
|
||||
current_mode == EditingMode::ENTRANCES))
|
||||
current_mode = EditingMode::ENTRANCES;
|
||||
HOVER_HINT("Entrances");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Exits", [&]() {
|
||||
if (Selectable(ICON_MD_DOOR_BACK, current_mode == EditingMode::EXITS))
|
||||
current_mode = EditingMode::EXITS;
|
||||
HOVER_HINT("Exits");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Items", [&]() {
|
||||
if (Selectable(ICON_MD_GRASS, current_mode == EditingMode::ITEMS))
|
||||
current_mode = EditingMode::ITEMS;
|
||||
HOVER_HINT("Items");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Sprites", [&]() {
|
||||
if (Selectable(ICON_MD_PEST_CONTROL_RODENT,
|
||||
current_mode == EditingMode::SPRITES))
|
||||
current_mode = EditingMode::SPRITES;
|
||||
HOVER_HINT("Sprites");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Transports", [&]() {
|
||||
if (Selectable(ICON_MD_ADD_LOCATION,
|
||||
current_mode == EditingMode::TRANSPORTS))
|
||||
current_mode = EditingMode::TRANSPORTS;
|
||||
HOVER_HINT("Transports");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Music", [&]() {
|
||||
if (Selectable(ICON_MD_MUSIC_NOTE, current_mode == EditingMode::MUSIC))
|
||||
current_mode = EditingMode::MUSIC;
|
||||
HOVER_HINT("Music");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Tile16Editor", [&]() {
|
||||
if (Button(ICON_MD_GRID_VIEW)) show_tile16_editor_ = !show_tile16_editor_;
|
||||
HOVER_HINT("Tile16 Editor");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##GfxGroupEditor", [&]() {
|
||||
if (Button(ICON_MD_TABLE_CHART)) show_gfx_group = !show_gfx_group;
|
||||
HOVER_HINT("Gfx Group Editor");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##sep3", ICON_MD_MORE_VERT);
|
||||
gui::AddTableColumn(toolset_table_, "##Properties", [&]() {
|
||||
if (Button(ICON_MD_CONTENT_COPY)) {
|
||||
std::vector<uint8_t> png_data;
|
||||
if (gfx::ConvertSurfaceToPNG(maps_bmp_[current_map_].surface(),
|
||||
png_data)) {
|
||||
core::CopyImageToClipboard(png_data);
|
||||
} else {
|
||||
status_ = absl::InternalError(
|
||||
"Failed to convert overworld map surface to PNG");
|
||||
}
|
||||
}
|
||||
HOVER_HINT("Copy Map to Clipboard");
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Palette", [&]() {
|
||||
status_ = DisplayPalette(palette_, overworld_.is_loaded());
|
||||
});
|
||||
gui::AddTableColumn(toolset_table_, "##Sep4", ICON_MD_MORE_VERT);
|
||||
gui::AddTableColumn(toolset_table_, "##Properties",
|
||||
[&]() { Checkbox("Properties", &show_properties); });
|
||||
|
||||
TableNextColumn(); // Palette
|
||||
status_ = DisplayPalette(palette_, overworld_.is_loaded());
|
||||
|
||||
TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator
|
||||
|
||||
TableNextColumn();
|
||||
Checkbox("Properties", &show_properties);
|
||||
|
||||
ImGui::EndTable();
|
||||
} else {
|
||||
gui::DrawTable(toolset_table_);
|
||||
}
|
||||
|
||||
if (show_tile16_editor_) {
|
||||
// Create a table in ImGui for the Tile16 Editor
|
||||
ImGui::Begin("Tile16 Editor", &show_tile16_editor_,
|
||||
ImGuiWindowFlags_MenuBar);
|
||||
status_ = tile16_editor_.Update();
|
||||
@@ -639,7 +621,7 @@ void OverworldEditor::CheckForMousePan() {
|
||||
|
||||
void OverworldEditor::DrawOverworldCanvas() {
|
||||
if (all_gfx_loaded_) {
|
||||
if (flags()->overworld.kLoadCustomOverworld) {
|
||||
if (core::ExperimentFlags::get().overworld.kLoadCustomOverworld) {
|
||||
DrawCustomOverworldMapSettings();
|
||||
} else {
|
||||
DrawOverworldMapSettings();
|
||||
@@ -724,7 +706,7 @@ void OverworldEditor::DrawTile8Selector() {
|
||||
graphics_bin_canvas_.DrawContextMenu();
|
||||
if (all_gfx_loaded_) {
|
||||
int key = 0;
|
||||
for (auto &value : rom()->gfx_sheets()) {
|
||||
for (auto &value : rom_.gfx_sheets()) {
|
||||
int offset = 0x40 * (key + 1);
|
||||
int top_left_y = graphics_bin_canvas_.zero_point().y + 2;
|
||||
if (key >= 1) {
|
||||
@@ -808,7 +790,7 @@ void OverworldEditor::DrawOverworldEntrances(ImVec2 canvas_p0, ImVec2 scrolling,
|
||||
color = ImVec4(255, 255, 255, 200);
|
||||
}
|
||||
ow_map_canvas_.DrawRect(each.x_, each.y_, 16, 16, color);
|
||||
std::string str = core::UppercaseHexByte(each.entrance_id_);
|
||||
std::string str = core::HexByte(each.entrance_id_);
|
||||
|
||||
if (current_mode == EditingMode::ENTRANCES) {
|
||||
HandleEntityDragging(&each, canvas_p0, scrolling, is_dragging_entity_,
|
||||
@@ -891,7 +873,7 @@ void OverworldEditor::DrawOverworldExits(ImVec2 canvas_p0, ImVec2 scrolling) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string str = core::UppercaseHexByte(i);
|
||||
std::string str = core::HexByte(i);
|
||||
ow_map_canvas_.DrawText(str, each.x_, each.y_);
|
||||
}
|
||||
i++;
|
||||
@@ -937,8 +919,8 @@ void OverworldEditor::DrawOverworldItems() {
|
||||
}
|
||||
}
|
||||
std::string item_name = "";
|
||||
if (item.id_ < zelda3::overworld::kSecretItemNames.size()) {
|
||||
item_name = zelda3::overworld::kSecretItemNames[item.id_];
|
||||
if (item.id_ < zelda3::kSecretItemNames.size()) {
|
||||
item_name = zelda3::kSecretItemNames[item.id_];
|
||||
} else {
|
||||
item_name = absl::StrFormat("0x%02X", item.id_);
|
||||
}
|
||||
@@ -1027,22 +1009,22 @@ void OverworldEditor::DrawOverworldSprites() {
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::Save() {
|
||||
if (flags()->overworld.kSaveOverworldMaps) {
|
||||
if (core::ExperimentFlags::get().overworld.kSaveOverworldMaps) {
|
||||
RETURN_IF_ERROR(overworld_.CreateTile32Tilemap());
|
||||
RETURN_IF_ERROR(overworld_.SaveMap32Tiles());
|
||||
RETURN_IF_ERROR(overworld_.SaveMap16Tiles());
|
||||
RETURN_IF_ERROR(overworld_.SaveOverworldMaps());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldEntrances) {
|
||||
if (core::ExperimentFlags::get().overworld.kSaveOverworldEntrances) {
|
||||
RETURN_IF_ERROR(overworld_.SaveEntrances());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldExits) {
|
||||
if (core::ExperimentFlags::get().overworld.kSaveOverworldExits) {
|
||||
RETURN_IF_ERROR(overworld_.SaveExits());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldItems) {
|
||||
if (core::ExperimentFlags::get().overworld.kSaveOverworldItems) {
|
||||
RETURN_IF_ERROR(overworld_.SaveItems());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldProperties) {
|
||||
if (core::ExperimentFlags::get().overworld.kSaveOverworldProperties) {
|
||||
RETURN_IF_ERROR(overworld_.SaveMapProperties());
|
||||
}
|
||||
return absl::OkStatus();
|
||||
@@ -1050,7 +1032,7 @@ absl::Status OverworldEditor::Save() {
|
||||
|
||||
absl::Status OverworldEditor::LoadGraphics() {
|
||||
// Load the Link to the Past overworld.
|
||||
RETURN_IF_ERROR(overworld_.Load(*rom()))
|
||||
RETURN_IF_ERROR(overworld_.Load(rom_))
|
||||
palette_ = overworld_.current_area_palette();
|
||||
|
||||
// Create the area graphics image
|
||||
@@ -1066,10 +1048,10 @@ absl::Status OverworldEditor::LoadGraphics() {
|
||||
|
||||
// Copy the tile16 data into individual tiles.
|
||||
auto tile16_data = overworld_.tile16_blockset_data();
|
||||
tile16_individual_.reserve(zelda3::overworld::kNumTile16Individual);
|
||||
tile16_individual_.reserve(zelda3::kNumTile16Individual);
|
||||
|
||||
// Loop through the tiles and copy their pixel data into separate vectors
|
||||
for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) {
|
||||
for (uint i = 0; i < zelda3::kNumTile16Individual; i++) {
|
||||
std::vector<uint8_t> tile_data(kTile16Size * kTile16Size, 0x00);
|
||||
|
||||
// Copy the pixel data for the current tile into the vector
|
||||
@@ -1092,7 +1074,7 @@ absl::Status OverworldEditor::LoadGraphics() {
|
||||
}
|
||||
|
||||
// Render the overworld maps loaded from the ROM.
|
||||
for (int i = 0; i < zelda3::overworld::kNumOverworldMaps; ++i) {
|
||||
for (int i = 0; i < zelda3::kNumOverworldMaps; ++i) {
|
||||
overworld_.set_current_map(i);
|
||||
auto palette = overworld_.current_area_palette();
|
||||
RETURN_IF_ERROR(Renderer::GetInstance().CreateAndRenderBitmap(
|
||||
@@ -1100,7 +1082,7 @@ absl::Status OverworldEditor::LoadGraphics() {
|
||||
overworld_.current_map_bitmap_data(), maps_bmp_[i], palette));
|
||||
}
|
||||
|
||||
if (flags()->overworld.kDrawOverworldSprites) {
|
||||
if (core::ExperimentFlags::get().overworld.kDrawOverworldSprites) {
|
||||
RETURN_IF_ERROR(LoadSpriteGraphics());
|
||||
}
|
||||
|
||||
@@ -1235,7 +1217,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
|
||||
|
||||
std::vector<std::future<void>> futures;
|
||||
// Loop through the tiles and copy their pixel data into separate vectors
|
||||
for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) {
|
||||
for (uint i = 0; i < zelda3::kNumTile16Individual; i++) {
|
||||
futures.push_back(std::async(
|
||||
std::launch::async,
|
||||
[&](int index) {
|
||||
@@ -1259,7 +1241,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
|
||||
}
|
||||
|
||||
// Render the bitmaps of each tile.
|
||||
for (uint id = 0; id < zelda3::overworld::kNumTile16Individual; id++) {
|
||||
for (uint id = 0; id < zelda3::kNumTile16Individual; id++) {
|
||||
RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_));
|
||||
Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]);
|
||||
}
|
||||
@@ -1385,8 +1367,9 @@ absl::Status OverworldEditor::UpdateUsageStats() {
|
||||
if (BeginChild("UnusedSpritesetScroll", ImVec2(0, 0), true,
|
||||
ImGuiWindowFlags_HorizontalScrollbar)) {
|
||||
for (int i = 0; i < 0x81; i++) {
|
||||
auto entrance_name = rom()->resource_label()->GetLabel(
|
||||
"Dungeon Entrance Names", core::UppercaseHexByte(i));
|
||||
auto entrance_name = rom_.resource_label()->CreateOrGetLabel(
|
||||
"Dungeon Entrance Names", core::HexByte(i),
|
||||
zelda3::kEntranceNames[i].data());
|
||||
std::string str = absl::StrFormat("%#x - %s", i, entrance_name);
|
||||
if (Selectable(str.c_str(), selected_entrance_ == i,
|
||||
overworld_.entrances().at(i).deleted
|
||||
@@ -1500,7 +1483,7 @@ void OverworldEditor::DrawDebugWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::InitializeZeml() {
|
||||
void OverworldEditor::Initialize() {
|
||||
// Load zeml string from layouts/overworld.zeml
|
||||
std::string layout = gui::zeml::LoadFile("overworld.zeml");
|
||||
// Parse the zeml string into a Node object
|
||||
@@ -1511,24 +1494,23 @@ void OverworldEditor::InitializeZeml() {
|
||||
gui::zeml::Bind(&*layout_node_.GetNode("OverworldTileSelector"),
|
||||
[this]() { status_ = DrawTileSelector(); });
|
||||
gui::zeml::Bind(&*layout_node_.GetNode("OwUsageStats"), [this]() {
|
||||
if (rom()->is_loaded()) {
|
||||
if (rom_.is_loaded()) {
|
||||
status_ = UpdateUsageStats();
|
||||
}
|
||||
});
|
||||
gui::zeml::Bind(&*layout_node_.GetNode("owToolset"),
|
||||
[this]() { DrawToolset(); });
|
||||
gui::zeml::Bind(&*layout_node_.GetNode("OwTile16Editor"), [this]() {
|
||||
if (rom()->is_loaded()) {
|
||||
if (rom_.is_loaded()) {
|
||||
status_ = tile16_editor_.Update();
|
||||
}
|
||||
});
|
||||
gui::zeml::Bind(&*layout_node_.GetNode("OwGfxGroupEditor"), [this]() {
|
||||
if (rom()->is_loaded()) {
|
||||
if (rom_.is_loaded()) {
|
||||
status_ = gfx_group_editor_.Update();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
||||
#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
||||
|
||||
#include <cmath>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "app/editor/editor.h"
|
||||
#include "app/editor/graphics/gfx_group_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/graphics/tile16_editor.h"
|
||||
#include "app/editor/overworld/entity.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/zeml.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
constexpr uint k4BPP = 4;
|
||||
@@ -65,32 +56,6 @@ constexpr absl::string_view kTileSelectorTab = "##TileSelectorTabBar";
|
||||
constexpr absl::string_view kOWEditTable = "##OWEditTable";
|
||||
constexpr absl::string_view kOWMapTable = "#MapSettingsTable";
|
||||
|
||||
constexpr int kEntranceTileTypePtrLow = 0xDB8BF;
|
||||
constexpr int kEntranceTileTypePtrHigh = 0xDB917;
|
||||
constexpr int kNumEntranceTileTypes = 0x2C;
|
||||
|
||||
class EntranceContext {
|
||||
public:
|
||||
absl::Status LoadEntranceTileTypes(Rom& rom) {
|
||||
int offset_low = kEntranceTileTypePtrLow;
|
||||
int offset_high = kEntranceTileTypePtrHigh;
|
||||
|
||||
for (int i = 0; i < kNumEntranceTileTypes; i++) {
|
||||
// Load entrance tile types
|
||||
ASSIGN_OR_RETURN(auto value_low, rom.ReadWord(offset_low + i));
|
||||
entrance_tile_types_low_.push_back(value_low);
|
||||
ASSIGN_OR_RETURN(auto value_high, rom.ReadWord(offset_high + i));
|
||||
entrance_tile_types_low_.push_back(value_high);
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint16_t> entrance_tile_types_low_;
|
||||
std::vector<uint16_t> entrance_tile_types_high_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class OverworldEditor
|
||||
* @brief Manipulates the Overworld and OverworldMap data in a Rom.
|
||||
@@ -107,15 +72,11 @@ class EntranceContext {
|
||||
* Provides access to the GfxGroupEditor and Tile16Editor through popup windows.
|
||||
*
|
||||
*/
|
||||
class OverworldEditor : public Editor,
|
||||
public SharedRom,
|
||||
public EntranceContext,
|
||||
public GfxContext,
|
||||
public core::ExperimentFlags {
|
||||
class OverworldEditor : public Editor, public gfx::GfxContext {
|
||||
public:
|
||||
OverworldEditor() { type_ = EditorType::kOverworld; }
|
||||
OverworldEditor(Rom& rom) : rom_(rom) { type_ = EditorType::kOverworld; }
|
||||
|
||||
void InitializeZeml();
|
||||
void Initialize();
|
||||
|
||||
absl::Status Update() final;
|
||||
absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
|
||||
@@ -130,9 +91,6 @@ class OverworldEditor : public Editor,
|
||||
|
||||
auto overworld() { return &overworld_; }
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
int jump_to_tab() { return jump_to_tab_; }
|
||||
int jump_to_tab_ = -1;
|
||||
|
||||
@@ -281,6 +239,8 @@ class OverworldEditor : public Editor,
|
||||
std::vector<std::vector<uint8_t>> tile8_individual_data_;
|
||||
std::vector<gfx::Bitmap> tile8_individual_;
|
||||
|
||||
Rom& rom_;
|
||||
|
||||
Tile16Editor tile16_editor_;
|
||||
GfxGroupEditor gfx_group_editor_;
|
||||
PaletteEditor palette_editor_;
|
||||
@@ -296,14 +256,15 @@ class OverworldEditor : public Editor,
|
||||
gfx::BitmapTable current_graphics_set_;
|
||||
gfx::BitmapTable sprite_previews_;
|
||||
|
||||
zelda3::overworld::Overworld overworld_;
|
||||
zelda3::OWBlockset refresh_blockset_;
|
||||
zelda3::Overworld overworld_;
|
||||
zelda3::OverworldBlockset refresh_blockset_;
|
||||
|
||||
zelda3::Sprite current_sprite_;
|
||||
|
||||
zelda3::overworld::OverworldEntrance current_entrance_;
|
||||
zelda3::overworld::OverworldExit current_exit_;
|
||||
zelda3::overworld::OverworldItem current_item_;
|
||||
zelda3::OverworldEntrance current_entrance_;
|
||||
zelda3::OverworldExit current_exit_;
|
||||
zelda3::OverworldItem current_item_;
|
||||
zelda3::OverworldEntranceTileTypes entrance_tiletypes_;
|
||||
|
||||
zelda3::GameEntity* current_entity_;
|
||||
zelda3::GameEntity* dragged_entity_;
|
||||
@@ -317,11 +278,15 @@ class OverworldEditor : public Editor,
|
||||
gui::Canvas graphics_bin_canvas_{"GraphicsBin", kGraphicsBinCanvasSize,
|
||||
gui::CanvasGridSize::k16x16};
|
||||
gui::Canvas properties_canvas_;
|
||||
|
||||
gui::Table toolset_table_{"##ToolsetTable0", 22, kToolsetTableFlags};
|
||||
gui::Table map_settings_table_{kOWMapTable.data(), 8, kOWMapFlags,
|
||||
ImVec2(0, 0)};
|
||||
|
||||
gui::zeml::Node layout_node_;
|
||||
absl::Status status_;
|
||||
};
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/zelda3/sprite/sprite.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::BeginTable;
|
||||
@@ -191,7 +190,7 @@ void SpriteEditor::DrawSpritesList() {
|
||||
int i = 0;
|
||||
for (const auto each_sprite_name : zelda3::kSpriteDefaultNames) {
|
||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||
current_sprite_id_ == i, "Sprite Names", core::UppercaseHexByte(i),
|
||||
current_sprite_id_ == i, "Sprite Names", core::HexByte(i),
|
||||
zelda3::kSpriteDefaultNames[i].data());
|
||||
if (ImGui::IsItemClicked()) {
|
||||
current_sprite_id_ = i;
|
||||
@@ -275,5 +274,4 @@ void SpriteEditor::DrawCustomSpritesMetadata() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
constexpr ImGuiTabItemFlags kSpriteTabFlags =
|
||||
@@ -111,7 +110,6 @@ class SpriteEditor : public SharedRom, public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SPRITE_EDITOR_H
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
/**
|
||||
* @brief Namespace for the ZSprite format from Zarby's ZSpriteMaker.
|
||||
@@ -390,7 +389,6 @@ struct ZSprite {
|
||||
|
||||
} // namespace zsprite
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SPRITE_ZSPRITE_H
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
ImGuiKey MapKeyToImGuiKey(char key) {
|
||||
@@ -139,5 +138,4 @@ void CommandManager::LoadKeybindings(const std::string &filepath) {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -8,16 +8,15 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
ImGuiKey MapKeyToImGuiKey(char key);
|
||||
|
||||
class CommandManager {
|
||||
public:
|
||||
public:
|
||||
CommandManager() = default;
|
||||
~CommandManager() = default;
|
||||
|
||||
|
||||
using Command = std::function<void()>;
|
||||
|
||||
struct CommandInfo {
|
||||
@@ -27,7 +26,9 @@ public:
|
||||
std::string desc;
|
||||
CommandInfo(Command command, char mnemonic, const std::string &name,
|
||||
const std::string &desc)
|
||||
: command(std::move(command)), mnemonic(mnemonic), name(name),
|
||||
: command(std::move(command)),
|
||||
mnemonic(mnemonic),
|
||||
name(name),
|
||||
desc(desc) {}
|
||||
CommandInfo() = default;
|
||||
};
|
||||
@@ -72,12 +73,11 @@ public:
|
||||
void SaveKeybindings(const std::string &filepath);
|
||||
void LoadKeybindings(const std::string &filepath);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::unordered_map<std::string, CommandInfoOrPrefix> commands_;
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
class ConstantManager {
|
||||
@@ -27,23 +26,23 @@ class ConstantManager {
|
||||
ImGui::Text("Overworld constants");
|
||||
ImGui::Separator();
|
||||
ImGui::Text("OverworldCustomASMHasBeenApplied: %d",
|
||||
zelda3::overworld::OverworldCustomASMHasBeenApplied);
|
||||
zelda3::OverworldCustomASMHasBeenApplied);
|
||||
ImGui::Text("OverworldCustomAreaSpecificBGPalette: %d",
|
||||
zelda3::overworld::OverworldCustomAreaSpecificBGPalette);
|
||||
zelda3::OverworldCustomAreaSpecificBGPalette);
|
||||
ImGui::Text("OverworldCustomAreaSpecificBGEnabled: %d",
|
||||
zelda3::overworld::OverworldCustomAreaSpecificBGEnabled);
|
||||
zelda3::OverworldCustomAreaSpecificBGEnabled);
|
||||
ImGui::Text("OverworldCustomMainPaletteArray: %d",
|
||||
zelda3::overworld::OverworldCustomMainPaletteArray);
|
||||
zelda3::OverworldCustomMainPaletteArray);
|
||||
ImGui::Text("OverworldCustomMainPaletteEnabled: %d",
|
||||
zelda3::overworld::OverworldCustomMainPaletteEnabled);
|
||||
zelda3::OverworldCustomMainPaletteEnabled);
|
||||
ImGui::Text("OverworldCustomMosaicArray: %d",
|
||||
zelda3::overworld::OverworldCustomMosaicArray);
|
||||
zelda3::OverworldCustomMosaicArray);
|
||||
ImGui::Text("OverworldCustomMosaicEnabled: %d",
|
||||
zelda3::overworld::OverworldCustomMosaicEnabled);
|
||||
zelda3::OverworldCustomMosaicEnabled);
|
||||
ImGui::Text("OverworldCustomAnimatedGFXArray: %d",
|
||||
zelda3::overworld::OverworldCustomAnimatedGFXArray);
|
||||
zelda3::OverworldCustomAnimatedGFXArray);
|
||||
ImGui::Text("OverworldCustomAnimatedGFXEnabled: %d",
|
||||
zelda3::overworld::OverworldCustomAnimatedGFXEnabled);
|
||||
zelda3::OverworldCustomAnimatedGFXEnabled);
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
@@ -71,7 +70,6 @@ class ConstantManager {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_CONSTANT_MANAGER_H
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <system/extension.h>
|
||||
#include <yaze.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
void ExtensionManager::LoadExtension(const std::string& filename,
|
||||
@@ -81,5 +80,4 @@ void ExtensionManager::ExecuteExtensionUI(yaze_editor_context* context) {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#ifndef YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||
#define YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||
|
||||
#include <system/extension.h>
|
||||
#include <yaze.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
class ExtensionManager {
|
||||
@@ -23,7 +22,6 @@ class ExtensionManager {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||
|
||||
@@ -5,60 +5,59 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using core::ExperimentFlags;
|
||||
using ImGui::BeginMenu;
|
||||
using ImGui::Checkbox;
|
||||
using ImGui::EndMenu;
|
||||
using ImGui::MenuItem;
|
||||
using ImGui::Separator;
|
||||
|
||||
struct FlagsMenu : public core::ExperimentFlags {
|
||||
struct FlagsMenu {
|
||||
void Draw() {
|
||||
if (BeginMenu("Overworld Flags")) {
|
||||
Checkbox("Enable Overworld Sprites",
|
||||
&mutable_flags()->overworld.kDrawOverworldSprites);
|
||||
&ExperimentFlags::get().overworld.kDrawOverworldSprites);
|
||||
Separator();
|
||||
Checkbox("Save Overworld Maps",
|
||||
&mutable_flags()->overworld.kSaveOverworldMaps);
|
||||
&ExperimentFlags::get().overworld.kSaveOverworldMaps);
|
||||
Checkbox("Save Overworld Entrances",
|
||||
&mutable_flags()->overworld.kSaveOverworldEntrances);
|
||||
&ExperimentFlags::get().overworld.kSaveOverworldEntrances);
|
||||
Checkbox("Save Overworld Exits",
|
||||
&mutable_flags()->overworld.kSaveOverworldExits);
|
||||
&ExperimentFlags::get().overworld.kSaveOverworldExits);
|
||||
Checkbox("Save Overworld Items",
|
||||
&mutable_flags()->overworld.kSaveOverworldItems);
|
||||
&ExperimentFlags::get().overworld.kSaveOverworldItems);
|
||||
Checkbox("Save Overworld Properties",
|
||||
&mutable_flags()->overworld.kSaveOverworldProperties);
|
||||
&ExperimentFlags::get().overworld.kSaveOverworldProperties);
|
||||
Checkbox("Load Custom Overworld",
|
||||
&mutable_flags()->overworld.kLoadCustomOverworld);
|
||||
&ExperimentFlags::get().overworld.kLoadCustomOverworld);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (BeginMenu("Dungeon Flags")) {
|
||||
Checkbox("Draw Dungeon Room Graphics",
|
||||
&mutable_flags()->kDrawDungeonRoomGraphics);
|
||||
&ExperimentFlags::get().kDrawDungeonRoomGraphics);
|
||||
Separator();
|
||||
Checkbox("Save Dungeon Maps", &mutable_flags()->kSaveDungeonMaps);
|
||||
Checkbox("Save Dungeon Maps", &ExperimentFlags::get().kSaveDungeonMaps);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
Checkbox("Use built-in file dialog",
|
||||
&mutable_flags()->kNewFileDialogWrapper);
|
||||
Checkbox("Enable Console Logging", &mutable_flags()->kLogToConsole);
|
||||
&ExperimentFlags::get().kNewFileDialogWrapper);
|
||||
Checkbox("Enable Console Logging", &ExperimentFlags::get().kLogToConsole);
|
||||
Checkbox("Enable Texture Streaming",
|
||||
&mutable_flags()->kLoadTexturesAsStreaming);
|
||||
&ExperimentFlags::get().kLoadTexturesAsStreaming);
|
||||
Checkbox("Log Instructions to Debugger",
|
||||
&mutable_flags()->kLogInstructions);
|
||||
Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes);
|
||||
Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups);
|
||||
Checkbox("Save Graphics Sheets", &mutable_flags()->kSaveGraphicsSheet);
|
||||
Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput);
|
||||
&ExperimentFlags::get().kLogInstructions);
|
||||
Checkbox("Save All Palettes", &ExperimentFlags::get().kSaveAllPalettes);
|
||||
Checkbox("Save Gfx Groups", &ExperimentFlags::get().kSaveGfxGroups);
|
||||
Checkbox("Save Graphics Sheets",
|
||||
&ExperimentFlags::get().kSaveGraphicsSheet);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_UTILS_FLAGS_H_
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <vector>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// System history manager, undo and redo.
|
||||
@@ -26,7 +25,6 @@ class HistoryManager {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_HISTORY_MANAGER_H
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
PopupManager::PopupManager() {
|
||||
@@ -15,5 +14,5 @@ PopupManager::~PopupManager() {
|
||||
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
|
||||
} // namespace yaze
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define YAZE_APP_EDITOR_POPUP_MANAGER_H
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// ImGui popup manager.
|
||||
@@ -15,7 +14,7 @@ class PopupManager {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_POPUP_MANAGER_H
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// System resource manager.
|
||||
@@ -24,7 +23,6 @@ class ResourceManager {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SYSTEM_RESOURCE_MANAGER_H
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
using ImGui::BeginChild;
|
||||
@@ -79,5 +78,4 @@ absl::Status SettingsEditor::DrawKeyboardShortcuts() {
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "app/editor/editor.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace editor {
|
||||
|
||||
// Simple representation for a tree
|
||||
@@ -226,7 +225,6 @@ class SettingsEditor : public Editor {
|
||||
};
|
||||
|
||||
} // namespace editor
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_SETTINGS_EDITOR_H_
|
||||
|
||||
Reference in New Issue
Block a user