Add zelda3::overworld namespace

This commit is contained in:
scawful
2024-04-14 14:37:53 -05:00
parent cc05f1b469
commit b06e22dc0d
14 changed files with 54 additions and 36 deletions

View File

@@ -15,7 +15,7 @@
#include "app/gui/input.h"
#include "app/gui/pipeline.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {
@@ -167,7 +167,7 @@ class GraphicsEditor : public SharedROM {
ROM temp_rom_;
ROM tilemap_rom_;
zelda3::Overworld overworld_;
zelda3::overworld::Overworld overworld_;
MemoryEditor cgx_memory_editor_;
MemoryEditor col_memory_editor_;
PaletteEditor palette_editor_;

View File

@@ -18,7 +18,7 @@
#include "app/gui/pipeline.h"
#include "app/gui/widgets.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {

View File

@@ -17,7 +17,7 @@
#include "app/gui/pipeline.h"
#include "app/gui/widgets.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {
@@ -65,7 +65,7 @@ class GfxGroupEditor : public SharedROM {
std::vector<gfx::Bitmap> tile16_individual_;
gui::BitmapViewer gfx_group_viewer_;
zelda3::Overworld overworld_;
zelda3::overworld::Overworld overworld_;
};
} // namespace editor

View File

@@ -19,7 +19,7 @@
#include "app/gui/style.h"
#include "app/gui/widgets.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {

View File

@@ -18,7 +18,7 @@
#include "app/gui/icons.h"
#include "app/gui/pipeline.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {
@@ -128,7 +128,7 @@ class Tile16Editor : public context::GfxContext, public SharedROM {
PaletteEditor palette_editor_;
gfx::SnesPalette palette_;
zelda3::Overworld transfer_overworld_;
zelda3::overworld::Overworld transfer_overworld_;
gfx::BitmapTable graphics_bin_;

View File

@@ -23,7 +23,7 @@
#include "app/gui/style.h"
#include "app/gui/widgets.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {
@@ -863,8 +863,9 @@ bool IsMouseHoveringOverEntity(const zelda3::OverworldEntity &entity,
return false;
}
void MoveEntityOnGrid(zelda3::OverworldEntity *entity, ImVec2 canvas_p0,
ImVec2 scrolling, bool free_movement = false) {
void MoveEntityOnGrid(zelda3::OverworldEntity *entity,
ImVec2 canvas_p0, ImVec2 scrolling,
bool free_movement = false) {
// Get the mouse position relative to the canvas
const ImGuiIO &io = ImGui::GetIO();
const ImVec2 origin(canvas_p0.x + scrolling.x, canvas_p0.y + scrolling.y);
@@ -883,8 +884,9 @@ void MoveEntityOnGrid(zelda3::OverworldEntity *entity, ImVec2 canvas_p0,
entity->set_y(new_y);
}
void HandleEntityDragging(zelda3::OverworldEntity *entity, ImVec2 canvas_p0,
ImVec2 scrolling, bool &is_dragging_entity,
void HandleEntityDragging(zelda3::OverworldEntity *entity,
ImVec2 canvas_p0, ImVec2 scrolling,
bool &is_dragging_entity,
zelda3::OverworldEntity *&dragged_entity,
zelda3::OverworldEntity *&current_entity,
bool free_movement = false) {
@@ -960,7 +962,8 @@ bool DrawEntranceInserterPopup() {
}
// TODO: Implement deleting OverworldEntrance objects, currently only hides them
bool DrawOverworldEntrancePopup(zelda3::OverworldEntrance &entrance) {
bool DrawOverworldEntrancePopup(
zelda3::overworld::OverworldEntrance &entrance) {
static bool set_done = false;
if (set_done) {
set_done = false;
@@ -1084,7 +1087,7 @@ void DrawExitInserterPopup() {
}
}
bool DrawExitEditorPopup(zelda3::OverworldExit &exit) {
bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit) {
static bool set_done = false;
if (set_done) {
set_done = false;
@@ -1280,8 +1283,8 @@ void DrawItemInsertPopup() {
ImGui::Text("Add Item");
ImGui::BeginChild("ScrollRegion", ImVec2(150, 150), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar);
for (int i = 0; i < zelda3::kSecretItemNames.size(); i++) {
if (ImGui::Selectable(zelda3::kSecretItemNames[i].c_str(),
for (int i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
if (ImGui::Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
i == new_item_id)) {
new_item_id = i;
}
@@ -1304,7 +1307,7 @@ void DrawItemInsertPopup() {
}
// TODO: Implement deleting OverworldItem objects, currently only hides them
bool DrawItemEditorPopup(zelda3::OverworldItem &item) {
bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
static bool set_done = false;
if (set_done) {
set_done = false;
@@ -1314,8 +1317,8 @@ bool DrawItemEditorPopup(zelda3::OverworldItem &item) {
ImGui::BeginChild("ScrollRegion", ImVec2(150, 150), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar);
ImGui::BeginGroup();
for (int i = 0; i < zelda3::kSecretItemNames.size(); i++) {
if (ImGui::Selectable(zelda3::kSecretItemNames[i].c_str(),
for (int i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
if (ImGui::Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
item.id == i)) {
item.id = i;
}
@@ -1348,7 +1351,7 @@ void OverworldEditor::DrawOverworldItems() {
// Get the item's bitmap and real X and Y positions
if (item.room_map_id < 0x40 + (current_world_ * 0x40) &&
item.room_map_id >= (current_world_ * 0x40) && !item.deleted) {
std::string item_name = zelda3::kSecretItemNames[item.id];
std::string item_name = zelda3::overworld::kSecretItemNames[item.id];
ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, ImVec4(255, 0, 0, 150));
@@ -1647,7 +1650,7 @@ absl::Status OverworldEditor::LoadGraphics() {
}
// Render the overworld maps loaded from the ROM.
for (int i = 0; i < zelda3::kNumOverworldMaps; ++i) {
for (int i = 0; i < zelda3::overworld::kNumOverworldMaps; ++i) {
overworld_.set_current_map(i);
auto palette = overworld_.AreaPalette();
gui::BuildAndRenderBitmapPipeline(0x200, 0x200, 0x200,

View File

@@ -25,7 +25,7 @@
#include "app/gui/icons.h"
#include "app/gui/pipeline.h"
#include "app/rom.h"
#include "app/zelda3/overworld.h"
#include "app/zelda3/overworld/overworld.h"
namespace yaze {
namespace app {
@@ -235,11 +235,11 @@ class OverworldEditor : public Editor,
zelda3::OverworldEntity* current_entity_;
int current_entrance_id_ = 0;
zelda3::OverworldEntrance current_entrance_;
zelda3::overworld::OverworldEntrance current_entrance_;
int current_exit_id_ = 0;
zelda3::OverworldExit current_exit_;
zelda3::overworld::OverworldExit current_exit_;
int current_item_id_ = 0;
zelda3::OverworldItem current_item_;
zelda3::overworld::OverworldItem current_item_;
int current_sprite_id_ = 0;
zelda3::Sprite current_sprite_;
@@ -257,7 +257,7 @@ class OverworldEditor : public Editor,
Tile16Editor tile16_editor_;
GfxGroupEditor gfx_group_editor_;
PaletteEditor palette_editor_;
zelda3::Overworld overworld_;
zelda3::overworld::Overworld overworld_;
gui::Canvas ow_map_canvas_{ImVec2(0x200 * 8, 0x200 * 8),
gui::CanvasGridSize::k64x64};