Add Dungeon room entrances to DungeonEditor
This commit is contained in:
@@ -53,6 +53,7 @@ absl::Status DungeonEditor::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadDungeonRoomSize();
|
LoadDungeonRoomSize();
|
||||||
|
LoadRoomEntrances();
|
||||||
|
|
||||||
// Load the palette group and palette for the dungeon
|
// Load the palette group and palette for the dungeon
|
||||||
full_palette_ =
|
full_palette_ =
|
||||||
@@ -169,7 +170,14 @@ void DungeonEditor::UpdateDungeonRoomView() {
|
|||||||
TableNextRow();
|
TableNextRow();
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
|
TAB_BAR("##DungeonRoomTabBar");
|
||||||
|
TAB_ITEM("Rooms");
|
||||||
DrawRoomSelector();
|
DrawRoomSelector();
|
||||||
|
END_TAB_ITEM();
|
||||||
|
TAB_ITEM("Entrances");
|
||||||
|
DrawEntranceSelector();
|
||||||
|
END_TAB_ITEM();
|
||||||
|
END_TAB_BAR();
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
DrawDungeonTabView();
|
DrawDungeonTabView();
|
||||||
@@ -289,14 +297,13 @@ void DungeonEditor::DrawRoomSelector() {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (const auto each_room_name : zelda3::dungeon::kRoomNames) {
|
for (const auto each_room_name : zelda3::dungeon::kRoomNames) {
|
||||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
current_room_id_ == i, "Dungeon Room Names", each_room_name.data(),
|
current_room_id_ == i, "Dungeon Room Names",
|
||||||
zelda3::dungeon::kRoomNames[i].data());
|
core::UppercaseHexByte(i), zelda3::dungeon::kRoomNames[i].data());
|
||||||
if (ImGui::IsItemClicked()) {
|
if (ImGui::IsItemClicked()) {
|
||||||
if (active_rooms_.contains(i)) {
|
// TODO: Jump to tab if room is already open
|
||||||
current_room_id_ = i;
|
current_room_id_ = i;
|
||||||
} else {
|
if (!active_rooms_.contains(i)) {
|
||||||
active_rooms_.push_back(i);
|
active_rooms_.push_back(i);
|
||||||
current_room_id_ = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
@@ -306,6 +313,100 @@ void DungeonEditor::DrawRoomSelector() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DungeonEditor::DrawEntranceSelector() {
|
||||||
|
if (rom()->is_loaded()) {
|
||||||
|
gui::InputHexWord("Entrance ID",
|
||||||
|
&entrances_[current_entrance_id_].entrance_id_);
|
||||||
|
|
||||||
|
gui::InputHexWord("Room ID", &entrances_[current_entrance_id_].room_, 50.f,
|
||||||
|
true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("Dungeon ID",
|
||||||
|
&entrances_[current_entrance_id_].dungeon_id_, 50.f,
|
||||||
|
true);
|
||||||
|
|
||||||
|
gui::InputHexByte("Blockset", &entrances_[current_entrance_id_].blockset_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
gui::InputHexByte("Music", &entrances_[current_entrance_id_].music_, 50.f,
|
||||||
|
true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("Floor", &entrances_[current_entrance_id_].floor_);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
gui::InputHexWord("Player X ",
|
||||||
|
&entrances_[current_entrance_id_].x_position_);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexWord("Player Y ",
|
||||||
|
&entrances_[current_entrance_id_].y_position_);
|
||||||
|
|
||||||
|
gui::InputHexWord("Camera X",
|
||||||
|
&entrances_[current_entrance_id_].camera_trigger_x_);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexWord("Camera Y",
|
||||||
|
&entrances_[current_entrance_id_].camera_trigger_y_);
|
||||||
|
|
||||||
|
gui::InputHexWord("Scroll X ",
|
||||||
|
&entrances_[current_entrance_id_].camera_x_);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexWord("Scroll Y ",
|
||||||
|
&entrances_[current_entrance_id_].camera_y_);
|
||||||
|
|
||||||
|
gui::InputHexWord("Exit", &entrances_[current_entrance_id_].exit_, 50.f,
|
||||||
|
true);
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("Camera Boundaries");
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("\t\t\t\t\tNorth East South West");
|
||||||
|
gui::InputHexByte("Quadrant",
|
||||||
|
&entrances_[current_entrance_id_].camera_boundary_qn_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qe_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qs_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qw_,
|
||||||
|
50.f, true);
|
||||||
|
|
||||||
|
gui::InputHexByte("Full room",
|
||||||
|
&entrances_[current_entrance_id_].camera_boundary_fn_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fe_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fs_,
|
||||||
|
50.f, true);
|
||||||
|
ImGui::SameLine();
|
||||||
|
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fw_,
|
||||||
|
50.f, true);
|
||||||
|
|
||||||
|
if (ImGui::BeginChild("EntranceSelector", ImVec2(0, 0), true,
|
||||||
|
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||||
|
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());
|
||||||
|
|
||||||
|
if (ImGui::IsItemClicked()) {
|
||||||
|
current_entrance_id_ = i;
|
||||||
|
if (!active_rooms_.contains(i)) {
|
||||||
|
active_rooms_.push_back(entrances_[i].room_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DungeonEditor::DrawDungeonTabView() {
|
void DungeonEditor::DrawDungeonTabView() {
|
||||||
static int next_tab_id = 0;
|
static int next_tab_id = 0;
|
||||||
|
|
||||||
@@ -479,6 +580,18 @@ void DungeonEditor::DrawObjectRenderer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DungeonEditor::LoadRoomEntrances() {
|
||||||
|
for (int i = 0; i < 0x07; ++i) {
|
||||||
|
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 0x85; ++i) {
|
||||||
|
entrances_.emplace_back(zelda3::dungeon::RoomEntrance(*rom(), i, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
void DungeonEditor::CalculateUsageStats() {
|
void DungeonEditor::CalculateUsageStats() {
|
||||||
// Create a hash map of the usage for elements of each Dungeon Room such as
|
// Create a hash map of the usage for elements of each Dungeon Room such as
|
||||||
// the blockset, spriteset, palette, etc. This is so we can keep track of
|
// the blockset, spriteset, palette, etc. This is so we can keep track of
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "zelda3/dungeon/room.h"
|
#include "zelda3/dungeon/room.h"
|
||||||
|
#include "zelda3/dungeon/room_entrance.h"
|
||||||
#include "zelda3/dungeon/room_object.h"
|
#include "zelda3/dungeon/room_object.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -51,6 +52,7 @@ class DungeonEditor : public Editor,
|
|||||||
|
|
||||||
void DrawToolset();
|
void DrawToolset();
|
||||||
void DrawRoomSelector();
|
void DrawRoomSelector();
|
||||||
|
void DrawEntranceSelector();
|
||||||
|
|
||||||
void DrawDungeonTabView();
|
void DrawDungeonTabView();
|
||||||
void DrawDungeonCanvas(int room_id);
|
void DrawDungeonCanvas(int room_id);
|
||||||
@@ -59,6 +61,8 @@ class DungeonEditor : public Editor,
|
|||||||
void DrawTileSelector();
|
void DrawTileSelector();
|
||||||
void DrawObjectRenderer();
|
void DrawObjectRenderer();
|
||||||
|
|
||||||
|
void LoadRoomEntrances();
|
||||||
|
|
||||||
void CalculateUsageStats();
|
void CalculateUsageStats();
|
||||||
void DrawUsageStats();
|
void DrawUsageStats();
|
||||||
void DrawUsageGrid();
|
void DrawUsageGrid();
|
||||||
@@ -84,6 +88,7 @@ class DungeonEditor : public Editor,
|
|||||||
bool refresh_graphics_ = false;
|
bool refresh_graphics_ = false;
|
||||||
bool show_object_render_ = false;
|
bool show_object_render_ = false;
|
||||||
|
|
||||||
|
uint16_t current_entrance_id_ = 0;
|
||||||
uint16_t current_room_id_ = 0;
|
uint16_t current_room_id_ = 0;
|
||||||
uint64_t current_palette_id_ = 0;
|
uint64_t current_palette_id_ = 0;
|
||||||
uint64_t current_palette_group_id_ = 0;
|
uint64_t current_palette_group_id_ = 0;
|
||||||
@@ -105,6 +110,7 @@ class DungeonEditor : public Editor,
|
|||||||
|
|
||||||
std::vector<gfx::Bitmap*> room_gfx_sheets_;
|
std::vector<gfx::Bitmap*> room_gfx_sheets_;
|
||||||
std::vector<zelda3::dungeon::Room> rooms_;
|
std::vector<zelda3::dungeon::Room> rooms_;
|
||||||
|
std::vector<zelda3::dungeon::RoomEntrance> entrances_;
|
||||||
std::vector<gfx::BitmapManager> room_graphics_;
|
std::vector<gfx::BitmapManager> room_graphics_;
|
||||||
zelda3::dungeon::DungeonObjectRenderer object_renderer_;
|
zelda3::dungeon::DungeonObjectRenderer object_renderer_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user