move zelda3 directory to src from app

This commit is contained in:
scawful
2025-10-12 22:01:52 -04:00
parent 9c89ad5843
commit dc9b9d5d10
108 changed files with 2071 additions and 2072 deletions

View File

@@ -174,7 +174,7 @@ Mock ROM includes all these labels from `zelda3::Zelda3Labels`:
| Music Tracks | 64+ | "Title Theme", "Overworld", "Dark World" | | Music Tracks | 64+ | "Title Theme", "Overworld", "Dark World" |
| Graphics Sheets | 128+ | "Link Sprites", "Enemy Pack 1" | | Graphics Sheets | 128+ | "Link Sprites", "Enemy Pack 1" |
See `src/app/zelda3/zelda3_labels.h` for the complete list. See `src/zelda3/zelda3_labels.h` for the complete list.
## Troubleshooting ## Troubleshooting

View File

@@ -71,8 +71,8 @@ CONFIG: Sequence[CMakeSourceBlock] = (
), ),
CMakeSourceBlock( CMakeSourceBlock(
variable="YAZE_APP_ZELDA3_SRC", variable="YAZE_APP_ZELDA3_SRC",
cmake_path=SOURCE_ROOT / "app/zelda3/zelda3_library.cmake", cmake_path=SOURCE_ROOT / "zelda3/zelda3_library.cmake",
directories=(DirectorySpec(SOURCE_ROOT / "app/zelda3"),), directories=(DirectorySpec(SOURCE_ROOT / "zelda3"),),
), ),
CMakeSourceBlock( CMakeSourceBlock(
variable="YAZE_NET_SRC", variable="YAZE_NET_SRC",

View File

@@ -61,7 +61,7 @@ include(util/util.cmake)
include(app/gfx/gfx_library.cmake) include(app/gfx/gfx_library.cmake)
include(app/net/net_library.cmake) include(app/net/net_library.cmake)
include(app/gui/gui_library.cmake) include(app/gui/gui_library.cmake)
include(app/zelda3/zelda3_library.cmake) include(zelda3/zelda3_library.cmake)
include(app/core/core_library.cmake) include(app/core/core_library.cmake)
# Include test support library BEFORE yaze_editor so it can link against it # Include test support library BEFORE yaze_editor so it can link against it

View File

@@ -13,7 +13,7 @@
#include "util/platform_paths.h" #include "util/platform_paths.h"
#include "app/gui/icons.h" #include "app/gui/icons.h"
#include "util/log.h" #include "util/log.h"
#include "app/zelda3/zelda3_labels.h" #include "zelda3/zelda3_labels.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "yaze_config.h" #include "yaze_config.h"

View File

@@ -5,8 +5,8 @@
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "util/log.h" #include "util/log.h"

View File

@@ -5,7 +5,7 @@
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "dungeon_object_interaction.h" #include "dungeon_object_interaction.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"

View File

@@ -6,7 +6,7 @@
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/gfx/arena.h" #include "app/gfx/arena.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/gui/icons.h" #include "app/gui/icons.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"

View File

@@ -15,8 +15,8 @@
#include "dungeon_room_loader.h" #include "dungeon_room_loader.h"
#include "object_editor_card.h" #include "object_editor_card.h"
#include "app/gui/editor_card_manager.h" #include "app/gui/editor_card_manager.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_entrance.h" #include "zelda3/dungeon/room_entrance.h"
#include "app/gui/editor_layout.h" #include "app/gui/editor_layout.h"
#include "app/gui/widgets/dungeon_object_emulator_preview.h" #include "app/gui/widgets/dungeon_object_emulator_preview.h"
#include "app/gui/widgets/palette_editor_widget.h" #include "app/gui/widgets/palette_editor_widget.h"

View File

@@ -6,8 +6,8 @@
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace editor { namespace editor {

View File

@@ -10,9 +10,9 @@
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/gui/modules/asset_browser.h" #include "app/gui/modules/asset_browser.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/dungeon_editor_system.h" #include "zelda3/dungeon/dungeon_editor_system.h"
#include "app/zelda3/dungeon/dungeon_object_editor.h" #include "zelda3/dungeon/dungeon_object_editor.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze::editor { namespace yaze::editor {

View File

@@ -4,8 +4,8 @@
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/rom.h" #include "app/rom.h"
// object_renderer.h removed - using ObjectDrawer for production rendering // object_renderer.h removed - using ObjectDrawer for production rendering
#include "app/zelda3/dungeon/dungeon_object_editor.h" #include "zelda3/dungeon/dungeon_object_editor.h"
#include "app/zelda3/dungeon/dungeon_editor_system.h" #include "zelda3/dungeon/dungeon_editor_system.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"

View File

@@ -8,7 +8,7 @@
#include "app/gfx/performance/performance_profiler.h" #include "app/gfx/performance/performance_profiler.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "util/log.h" #include "util/log.h"
namespace yaze::editor { namespace yaze::editor {

View File

@@ -6,8 +6,8 @@
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_entrance.h" #include "zelda3/dungeon/room_entrance.h"
namespace yaze { namespace yaze {
namespace editor { namespace editor {

View File

@@ -1,8 +1,8 @@
#include "dungeon_room_selector.h" #include "dungeon_room_selector.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_entrance.h" #include "zelda3/dungeon/room_entrance.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "util/hex.h" #include "util/hex.h"

View File

@@ -4,8 +4,8 @@
#include <functional> #include <functional>
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room_entrance.h" #include "zelda3/dungeon/room_entrance.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
namespace yaze { namespace yaze {
namespace editor { namespace editor {

View File

@@ -2,7 +2,7 @@
#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_USAGE_TRACKER_H #define YAZE_APP_EDITOR_DUNGEON_DUNGEON_USAGE_TRACKER_H
#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_map.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
namespace yaze { namespace yaze {
namespace editor { namespace editor {

View File

@@ -11,7 +11,7 @@
#include "app/gui/editor_layout.h" #include "app/gui/editor_layout.h"
#include "app/gui/widgets/dungeon_object_emulator_preview.h" #include "app/gui/widgets/dungeon_object_emulator_preview.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace editor { namespace editor {

View File

@@ -37,7 +37,7 @@
#include "app/gui/theme_manager.h" #include "app/gui/theme_manager.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/test/test_manager.h" #include "app/test/test_manager.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#ifdef YAZE_ENABLE_TESTING #ifdef YAZE_ENABLE_TESTING
#include "app/test/e2e_test_suite.h" #include "app/test/e2e_test_suite.h"
#include "app/test/integrated_test_suite.h" #include "app/test/integrated_test_suite.h"

View File

@@ -13,7 +13,7 @@
#include "app/gui/editor_layout.h" #include "app/gui/editor_layout.h"
#include "app/gui/modules/asset_browser.h" #include "app/gui/modules/asset_browser.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui_memory_editor.h" #include "imgui_memory_editor.h"

View File

@@ -11,8 +11,8 @@
#include "app/gfx/tilemap.h" #include "app/gfx/tilemap.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/screen/dungeon_map.h" #include "zelda3/screen/dungeon_map.h"
#include "app/zelda3/screen/inventory.h" #include "zelda3/screen/inventory.h"
#include "app/gui/editor_layout.h" #include "app/gui/editor_layout.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"

View File

@@ -7,7 +7,7 @@
#include "app/gui/editor_card_manager.h" #include "app/gui/editor_card_manager.h"
#include "app/gui/editor_layout.h" #include "app/gui/editor_layout.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/music/tracker.h" #include "zelda3/music/tracker.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze { namespace yaze {

View File

@@ -1,11 +1,11 @@
#ifndef YAZE_APP_EDITOR_OVERWORLD_ENTITY_H #ifndef YAZE_APP_EDITOR_OVERWORLD_ENTITY_H
#define YAZE_APP_EDITOR_OVERWORLD_ENTITY_H #define YAZE_APP_EDITOR_OVERWORLD_ENTITY_H
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/overworld/overworld_entrance.h" #include "zelda3/overworld/overworld_entrance.h"
#include "app/zelda3/overworld/overworld_exit.h" #include "zelda3/overworld/overworld_exit.h"
#include "app/zelda3/overworld/overworld_item.h" #include "zelda3/overworld/overworld_item.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze { namespace yaze {

View File

@@ -7,7 +7,7 @@
#include "app/gui/color.h" #include "app/gui/color.h"
#include "app/gui/icons.h" #include "app/gui/icons.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze { namespace yaze {

View File

@@ -3,7 +3,7 @@
#include <functional> #include <functional>
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"

View File

@@ -31,9 +31,9 @@
#include "app/gui/style.h" #include "app/gui/style.h"
#include "app/gui/ui_helpers.h" #include "app/gui/ui_helpers.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui_memory_editor.h" #include "imgui_memory_editor.h"
#include "util/file_util.h" #include "util/file_util.h"

View File

@@ -1,382 +1,382 @@
#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H #ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H #define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/editor/editor.h" #include "app/editor/editor.h"
#include "app/editor/graphics/gfx_group_editor.h" #include "app/editor/graphics/gfx_group_editor.h"
#include "app/editor/palette/palette_editor.h" #include "app/editor/palette/palette_editor.h"
#include "app/gui/editor_card_manager.h" #include "app/gui/editor_card_manager.h"
#include "app/editor/overworld/tile16_editor.h" #include "app/editor/overworld/tile16_editor.h"
#include "app/editor/overworld/map_properties.h" #include "app/editor/overworld/map_properties.h"
#include "app/editor/overworld/overworld_entity_renderer.h" #include "app/editor/overworld/overworld_entity_renderer.h"
#include "app/gfx/bitmap.h" #include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/gfx/tilemap.h" #include "app/gfx/tilemap.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/gui/widgets/tile_selector_widget.h" #include "app/gui/widgets/tile_selector_widget.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include <mutex> #include <mutex>
namespace yaze { namespace yaze {
namespace editor { namespace editor {
constexpr unsigned int k4BPP = 4; constexpr unsigned int k4BPP = 4;
constexpr unsigned int kByteSize = 3; constexpr unsigned int kByteSize = 3;
constexpr unsigned int kMessageIdSize = 5; constexpr unsigned int kMessageIdSize = 5;
constexpr unsigned int kNumSheetsToLoad = 223; constexpr unsigned int kNumSheetsToLoad = 223;
constexpr unsigned int kOverworldMapSize = 0x200; constexpr unsigned int kOverworldMapSize = 0x200;
constexpr ImVec2 kOverworldCanvasSize(kOverworldMapSize * 8, constexpr ImVec2 kOverworldCanvasSize(kOverworldMapSize * 8,
kOverworldMapSize * 8); kOverworldMapSize * 8);
constexpr ImVec2 kCurrentGfxCanvasSize(0x100 + 1, 0x10 * 0x40 + 1); constexpr ImVec2 kCurrentGfxCanvasSize(0x100 + 1, 0x10 * 0x40 + 1);
constexpr ImVec2 kBlocksetCanvasSize(0x100 + 1, 0x4000 + 1); constexpr ImVec2 kBlocksetCanvasSize(0x100 + 1, 0x4000 + 1);
constexpr ImVec2 kGraphicsBinCanvasSize(0x100 + 1, kNumSheetsToLoad * 0x40 + 1); constexpr ImVec2 kGraphicsBinCanvasSize(0x100 + 1, kNumSheetsToLoad * 0x40 + 1);
constexpr ImGuiTableFlags kOWMapFlags = constexpr ImGuiTableFlags kOWMapFlags =
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp; ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp;
constexpr absl::string_view kWorldList = constexpr absl::string_view kWorldList =
"Light World\0Dark World\0Extra World\0"; "Light World\0Dark World\0Extra World\0";
constexpr absl::string_view kGamePartComboString = "Part 0\0Part 1\0Part 2\0"; constexpr absl::string_view kGamePartComboString = "Part 0\0Part 1\0Part 2\0";
constexpr absl::string_view kOWMapTable = "#MapSettingsTable"; constexpr absl::string_view kOWMapTable = "#MapSettingsTable";
/** /**
* @class OverworldEditor * @class OverworldEditor
* @brief Manipulates the Overworld and OverworldMap data in a Rom. * @brief Manipulates the Overworld and OverworldMap data in a Rom.
* *
* The `OverworldEditor` class is responsible for managing the editing and * The `OverworldEditor` class is responsible for managing the editing and
* manipulation of the overworld in a game. The user can drag and drop tiles, * manipulation of the overworld in a game. The user can drag and drop tiles,
* modify OverworldEntrance, OverworldExit, Sprite, and OverworldItem * modify OverworldEntrance, OverworldExit, Sprite, and OverworldItem
* as well as change the gfx and palettes used in each overworld map. * as well as change the gfx and palettes used in each overworld map.
* *
* The Overworld itself is a series of bitmap images which exist inside each * The Overworld itself is a series of bitmap images which exist inside each
* OverworldMap object. The drawing of the overworld is done using the Canvas * OverworldMap object. The drawing of the overworld is done using the Canvas
* class in conjunction with these underlying Bitmap objects. * class in conjunction with these underlying Bitmap objects.
* *
* Provides access to the GfxGroupEditor and Tile16Editor through popup windows. * Provides access to the GfxGroupEditor and Tile16Editor through popup windows.
* *
*/ */
class OverworldEditor : public Editor, public gfx::GfxContext { class OverworldEditor : public Editor, public gfx::GfxContext {
public: public:
explicit OverworldEditor(Rom* rom) : rom_(rom) { explicit OverworldEditor(Rom* rom) : rom_(rom) {
type_ = EditorType::kOverworld; type_ = EditorType::kOverworld;
gfx_group_editor_.set_rom(rom); gfx_group_editor_.set_rom(rom);
// MapPropertiesSystem will be initialized after maps_bmp_ and canvas are ready // MapPropertiesSystem will be initialized after maps_bmp_ and canvas are ready
} }
void Initialize(gfx::IRenderer* renderer, Rom* rom); void Initialize(gfx::IRenderer* renderer, Rom* rom);
void Initialize() override; void Initialize() override;
absl::Status Load() override; absl::Status Load() override;
absl::Status Update() final; absl::Status Update() final;
absl::Status Undo() override { return absl::UnimplementedError("Undo"); } absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
absl::Status Redo() override { return absl::UnimplementedError("Redo"); } absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
absl::Status Cut() override { return absl::UnimplementedError("Cut"); } absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
absl::Status Copy() override; absl::Status Copy() override;
absl::Status Paste() override; absl::Status Paste() override;
absl::Status Find() override { return absl::UnimplementedError("Find"); } absl::Status Find() override { return absl::UnimplementedError("Find"); }
absl::Status Save() override; absl::Status Save() override;
absl::Status Clear() override; absl::Status Clear() override;
zelda3::Overworld& overworld() { return overworld_; } zelda3::Overworld& overworld() { return overworld_; }
/** /**
* @brief Apply ZSCustomOverworld ASM patch to upgrade ROM version * @brief Apply ZSCustomOverworld ASM patch to upgrade ROM version
*/ */
absl::Status ApplyZSCustomOverworldASM(int target_version); absl::Status ApplyZSCustomOverworldASM(int target_version);
/** /**
* @brief Update ROM version markers and feature flags after ASM patching * @brief Update ROM version markers and feature flags after ASM patching
*/ */
absl::Status UpdateROMVersionMarkers(int target_version); absl::Status UpdateROMVersionMarkers(int target_version);
int jump_to_tab() { return jump_to_tab_; } int jump_to_tab() { return jump_to_tab_; }
int jump_to_tab_ = -1; int jump_to_tab_ = -1;
// ROM state methods (from Editor base class) // ROM state methods (from Editor base class)
bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); } bool IsRomLoaded() const override { return rom_ && rom_->is_loaded(); }
std::string GetRomStatus() const override { std::string GetRomStatus() const override {
if (!rom_) return "No ROM loaded"; if (!rom_) return "No ROM loaded";
if (!rom_->is_loaded()) return "ROM failed to load"; if (!rom_->is_loaded()) return "ROM failed to load";
return absl::StrFormat("ROM loaded: %s", rom_->title()); return absl::StrFormat("ROM loaded: %s", rom_->title());
} }
// Jump-to functionality // Jump-to functionality
void set_current_map(int map_id) { void set_current_map(int map_id) {
if (map_id >= 0 && map_id < zelda3::kNumOverworldMaps) { if (map_id >= 0 && map_id < zelda3::kNumOverworldMaps) {
current_map_ = map_id; current_map_ = map_id;
current_world_ = map_id / 0x40; // Calculate which world the map belongs to current_world_ = map_id / 0x40; // Calculate which world the map belongs to
} }
} }
/** /**
* @brief Load the Bitmap objects for each OverworldMap. * @brief Load the Bitmap objects for each OverworldMap.
* *
* Calls the Overworld class to load the image data and palettes from the Rom, * Calls the Overworld class to load the image data and palettes from the Rom,
* then renders the area graphics and tile16 blockset Bitmap objects before * then renders the area graphics and tile16 blockset Bitmap objects before
* assembling the OverworldMap Bitmap objects. * assembling the OverworldMap Bitmap objects.
*/ */
absl::Status LoadGraphics(); absl::Status LoadGraphics();
private: private:
void DrawFullscreenCanvas(); void DrawFullscreenCanvas();
void DrawToolset(); void DrawToolset();
void RefreshChildMap(int map_index); void RefreshChildMap(int map_index);
void RefreshOverworldMap(); void RefreshOverworldMap();
void RefreshOverworldMapOnDemand(int map_index); void RefreshOverworldMapOnDemand(int map_index);
void RefreshChildMapOnDemand(int map_index); void RefreshChildMapOnDemand(int map_index);
void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap* map); void RefreshMultiAreaMapsSafely(int map_index, zelda3::OverworldMap* map);
absl::Status RefreshMapPalette(); absl::Status RefreshMapPalette();
void RefreshMapProperties(); void RefreshMapProperties();
absl::Status RefreshTile16Blockset(); absl::Status RefreshTile16Blockset();
void ForceRefreshGraphics(int map_index); void ForceRefreshGraphics(int map_index);
void RefreshSiblingMapGraphics(int map_index, bool include_self = false); void RefreshSiblingMapGraphics(int map_index, bool include_self = false);
void DrawOverworldMaps(); void DrawOverworldMaps();
void DrawOverworldEdits(); void DrawOverworldEdits();
void RenderUpdatedMapBitmap(const ImVec2& click_position, void RenderUpdatedMapBitmap(const ImVec2& click_position,
const std::vector<uint8_t>& tile_data); const std::vector<uint8_t>& tile_data);
/** /**
* @brief Check for changes to the overworld map. * @brief Check for changes to the overworld map.
* *
* This function either draws the tile painter with the current tile16 or * This function either draws the tile painter with the current tile16 or
* group of tile16 data with ow_map_canvas_ and DrawOverworldEdits or it * group of tile16 data with ow_map_canvas_ and DrawOverworldEdits or it
* checks for left mouse button click/drag to select a tile16 or group of * checks for left mouse button click/drag to select a tile16 or group of
* tile16 data from the overworld map canvas. Similar to ZScream selection. * tile16 data from the overworld map canvas. Similar to ZScream selection.
*/ */
void CheckForOverworldEdits(); void CheckForOverworldEdits();
/** /**
* @brief Draw and create the tile16 IDs that are currently selected. * @brief Draw and create the tile16 IDs that are currently selected.
*/ */
void CheckForSelectRectangle(); void CheckForSelectRectangle();
// Selected tile IDs for rectangle operations (moved from local static) // Selected tile IDs for rectangle operations (moved from local static)
std::vector<int> selected_tile16_ids_; std::vector<int> selected_tile16_ids_;
/** /**
* @brief Check for changes to the overworld map. Calls RefreshOverworldMap * @brief Check for changes to the overworld map. Calls RefreshOverworldMap
* and RefreshTile16Blockset on the current map if it is modified and is * and RefreshTile16Blockset on the current map if it is modified and is
* actively being edited. * actively being edited.
*/ */
absl::Status CheckForCurrentMap(); absl::Status CheckForCurrentMap();
void CheckForMousePan(); void CheckForMousePan();
void DrawOverworldCanvas(); void DrawOverworldCanvas();
absl::Status DrawTile16Selector(); absl::Status DrawTile16Selector();
void DrawTile8Selector(); void DrawTile8Selector();
absl::Status DrawAreaGraphics(); absl::Status DrawAreaGraphics();
void UpdateBlocksetSelectorState(); void UpdateBlocksetSelectorState();
absl::Status LoadSpriteGraphics(); absl::Status LoadSpriteGraphics();
/** /**
* @brief Create textures for deferred map bitmaps on demand * @brief Create textures for deferred map bitmaps on demand
* *
* This method should be called periodically to create textures for maps * This method should be called periodically to create textures for maps
* that are needed but haven't had their textures created yet. This allows * that are needed but haven't had their textures created yet. This allows
* for smooth loading without blocking the main thread during ROM loading. * for smooth loading without blocking the main thread during ROM loading.
*/ */
void ProcessDeferredTextures(); void ProcessDeferredTextures();
/** /**
* @brief Ensure a specific map has its texture created * @brief Ensure a specific map has its texture created
* *
* Call this when a map becomes visible or is about to be rendered. * Call this when a map becomes visible or is about to be rendered.
* It will create the texture if it doesn't exist yet. * It will create the texture if it doesn't exist yet.
*/ */
void EnsureMapTexture(int map_index); void EnsureMapTexture(int map_index);
void DrawOverworldProperties(); void DrawOverworldProperties();
void HandleMapInteraction(); void HandleMapInteraction();
// SetupOverworldCanvasContextMenu removed (Phase 3B) - now handled by MapPropertiesSystem // SetupOverworldCanvasContextMenu removed (Phase 3B) - now handled by MapPropertiesSystem
// Canvas pan/zoom helpers (Overworld Refactoring) // Canvas pan/zoom helpers (Overworld Refactoring)
void HandleOverworldPan(); void HandleOverworldPan();
void HandleOverworldZoom(); void HandleOverworldZoom();
void ResetOverworldView(); void ResetOverworldView();
void CenterOverworldView(); void CenterOverworldView();
// Canvas Automation API integration (Phase 4) // Canvas Automation API integration (Phase 4)
void SetupCanvasAutomation(); void SetupCanvasAutomation();
gui::Canvas* GetOverworldCanvas() { return &ow_map_canvas_; } gui::Canvas* GetOverworldCanvas() { return &ow_map_canvas_; }
// Tile operations for automation callbacks // Tile operations for automation callbacks
bool AutomationSetTile(int x, int y, int tile_id); bool AutomationSetTile(int x, int y, int tile_id);
int AutomationGetTile(int x, int y); int AutomationGetTile(int x, int y);
/** /**
* @brief Scroll the blockset canvas to show the current selected tile16 * @brief Scroll the blockset canvas to show the current selected tile16
*/ */
void ScrollBlocksetCanvasToCurrentTile(); void ScrollBlocksetCanvasToCurrentTile();
// Scratch space canvas methods // Scratch space canvas methods
absl::Status DrawScratchSpace(); absl::Status DrawScratchSpace();
absl::Status SaveCurrentSelectionToScratch(int slot); absl::Status SaveCurrentSelectionToScratch(int slot);
absl::Status LoadScratchToSelection(int slot); absl::Status LoadScratchToSelection(int slot);
absl::Status ClearScratchSpace(int slot); absl::Status ClearScratchSpace(int slot);
void DrawScratchSpaceEdits(); void DrawScratchSpaceEdits();
void DrawScratchSpacePattern(); void DrawScratchSpacePattern();
void DrawScratchSpaceSelection(); void DrawScratchSpaceSelection();
void UpdateScratchBitmapTile(int tile_x, int tile_y, int tile_id, int slot = -1); void UpdateScratchBitmapTile(int tile_x, int tile_y, int tile_id, int slot = -1);
absl::Status UpdateUsageStats(); absl::Status UpdateUsageStats();
void DrawUsageGrid(); void DrawUsageGrid();
void DrawDebugWindow(); void DrawDebugWindow();
enum class EditingMode { enum class EditingMode {
MOUSE, // Navigation, selection, entity management via context menu MOUSE, // Navigation, selection, entity management via context menu
DRAW_TILE // Tile painting mode DRAW_TILE // Tile painting mode
}; };
EditingMode current_mode = EditingMode::DRAW_TILE; EditingMode current_mode = EditingMode::DRAW_TILE;
EditingMode previous_mode = EditingMode::DRAW_TILE; EditingMode previous_mode = EditingMode::DRAW_TILE;
// Entity editing state (managed via context menu now) // Entity editing state (managed via context menu now)
enum class EntityEditMode { enum class EntityEditMode {
NONE, NONE,
ENTRANCES, ENTRANCES,
EXITS, EXITS,
ITEMS, ITEMS,
SPRITES, SPRITES,
TRANSPORTS, TRANSPORTS,
MUSIC MUSIC
}; };
EntityEditMode entity_edit_mode_ = EntityEditMode::NONE; EntityEditMode entity_edit_mode_ = EntityEditMode::NONE;
enum OverworldProperty { enum OverworldProperty {
LW_AREA_GFX, LW_AREA_GFX,
DW_AREA_GFX, DW_AREA_GFX,
LW_AREA_PAL, LW_AREA_PAL,
DW_AREA_PAL, DW_AREA_PAL,
LW_SPR_GFX_PART1, LW_SPR_GFX_PART1,
LW_SPR_GFX_PART2, LW_SPR_GFX_PART2,
DW_SPR_GFX_PART1, DW_SPR_GFX_PART1,
DW_SPR_GFX_PART2, DW_SPR_GFX_PART2,
LW_SPR_PAL_PART1, LW_SPR_PAL_PART1,
LW_SPR_PAL_PART2, LW_SPR_PAL_PART2,
DW_SPR_PAL_PART1, DW_SPR_PAL_PART1,
DW_SPR_PAL_PART2, DW_SPR_PAL_PART2,
}; };
int current_world_ = 0; int current_world_ = 0;
int current_map_ = 0; int current_map_ = 0;
int current_parent_ = 0; int current_parent_ = 0;
int current_entrance_id_ = 0; int current_entrance_id_ = 0;
int current_exit_id_ = 0; int current_exit_id_ = 0;
int current_item_id_ = 0; int current_item_id_ = 0;
int current_sprite_id_ = 0; int current_sprite_id_ = 0;
int current_blockset_ = 0; int current_blockset_ = 0;
int game_state_ = 1; int game_state_ = 1;
int current_tile16_ = 0; int current_tile16_ = 0;
int selected_entrance_ = 0; int selected_entrance_ = 0;
int selected_usage_map_ = 0xFFFF; int selected_usage_map_ = 0xFFFF;
bool all_gfx_loaded_ = false; bool all_gfx_loaded_ = false;
bool map_blockset_loaded_ = false; bool map_blockset_loaded_ = false;
bool selected_tile_loaded_ = false; bool selected_tile_loaded_ = false;
bool show_tile16_editor_ = false; bool show_tile16_editor_ = false;
bool show_gfx_group_editor_ = false; bool show_gfx_group_editor_ = false;
bool show_properties_editor_ = false; bool show_properties_editor_ = false;
bool overworld_canvas_fullscreen_ = false; bool overworld_canvas_fullscreen_ = false;
bool middle_mouse_dragging_ = false; bool middle_mouse_dragging_ = false;
bool is_dragging_entity_ = false; bool is_dragging_entity_ = false;
bool dragged_entity_free_movement_ = false; bool dragged_entity_free_movement_ = false;
bool current_map_lock_ = false; bool current_map_lock_ = false;
bool show_custom_bg_color_editor_ = false; bool show_custom_bg_color_editor_ = false;
bool show_overlay_editor_ = false; bool show_overlay_editor_ = false;
bool use_area_specific_bg_color_ = false; bool use_area_specific_bg_color_ = false;
bool show_map_properties_panel_ = false; bool show_map_properties_panel_ = false;
bool show_overlay_preview_ = false; bool show_overlay_preview_ = false;
// Card visibility states - Start hidden to prevent crash // Card visibility states - Start hidden to prevent crash
bool show_overworld_canvas_ = true; bool show_overworld_canvas_ = true;
bool show_tile16_selector_ = false; bool show_tile16_selector_ = false;
bool show_tile8_selector_ = false; bool show_tile8_selector_ = false;
bool show_area_gfx_ = false; bool show_area_gfx_ = false;
bool show_scratch_ = false; bool show_scratch_ = false;
bool show_gfx_groups_ = false; bool show_gfx_groups_ = false;
bool show_usage_stats_ = false; bool show_usage_stats_ = false;
bool show_v3_settings_ = false; bool show_v3_settings_ = false;
// Map properties system for UI organization // Map properties system for UI organization
std::unique_ptr<MapPropertiesSystem> map_properties_system_; std::unique_ptr<MapPropertiesSystem> map_properties_system_;
std::unique_ptr<OverworldEntityRenderer> entity_renderer_; std::unique_ptr<OverworldEntityRenderer> entity_renderer_;
// Scratch space for large layouts // Scratch space for large layouts
// Scratch space canvas for tile16 drawing (like a mini overworld) // Scratch space canvas for tile16 drawing (like a mini overworld)
struct ScratchSpaceSlot { struct ScratchSpaceSlot {
gfx::Bitmap scratch_bitmap; gfx::Bitmap scratch_bitmap;
std::array<std::array<int, 32>, 32> tile_data; // 32x32 grid of tile16 IDs std::array<std::array<int, 32>, 32> tile_data; // 32x32 grid of tile16 IDs
bool in_use = false; bool in_use = false;
std::string name = "Empty"; std::string name = "Empty";
int width = 16; // Default 16x16 tiles int width = 16; // Default 16x16 tiles
int height = 16; int height = 16;
// Independent selection system for scratch space // Independent selection system for scratch space
std::vector<ImVec2> selected_tiles; std::vector<ImVec2> selected_tiles;
std::vector<ImVec2> selected_points; std::vector<ImVec2> selected_points;
bool select_rect_active = false; bool select_rect_active = false;
}; };
std::array<ScratchSpaceSlot, 4> scratch_spaces_; std::array<ScratchSpaceSlot, 4> scratch_spaces_;
int current_scratch_slot_ = 0; int current_scratch_slot_ = 0;
gfx::Tilemap tile16_blockset_; gfx::Tilemap tile16_blockset_;
Rom* rom_; Rom* rom_;
gfx::IRenderer* renderer_; gfx::IRenderer* renderer_;
Tile16Editor tile16_editor_{rom_, &tile16_blockset_}; Tile16Editor tile16_editor_{rom_, &tile16_blockset_};
GfxGroupEditor gfx_group_editor_; GfxGroupEditor gfx_group_editor_;
PaletteEditor palette_editor_; PaletteEditor palette_editor_;
gfx::SnesPalette palette_; gfx::SnesPalette palette_;
gfx::Bitmap selected_tile_bmp_; gfx::Bitmap selected_tile_bmp_;
gfx::Bitmap tile16_blockset_bmp_; gfx::Bitmap tile16_blockset_bmp_;
gfx::Bitmap current_gfx_bmp_; gfx::Bitmap current_gfx_bmp_;
gfx::Bitmap all_gfx_bmp; gfx::Bitmap all_gfx_bmp;
std::array<gfx::Bitmap, zelda3::kNumOverworldMaps> maps_bmp_; std::array<gfx::Bitmap, zelda3::kNumOverworldMaps> maps_bmp_;
gfx::BitmapTable current_graphics_set_; gfx::BitmapTable current_graphics_set_;
std::vector<gfx::Bitmap> sprite_previews_; std::vector<gfx::Bitmap> sprite_previews_;
// Deferred texture creation for performance optimization // Deferred texture creation for performance optimization
// Deferred texture management now handled by gfx::Arena::Get() // Deferred texture management now handled by gfx::Arena::Get()
zelda3::Overworld overworld_{rom_}; zelda3::Overworld overworld_{rom_};
zelda3::OverworldBlockset refresh_blockset_; zelda3::OverworldBlockset refresh_blockset_;
zelda3::Sprite current_sprite_; zelda3::Sprite current_sprite_;
zelda3::OverworldEntrance current_entrance_; zelda3::OverworldEntrance current_entrance_;
zelda3::OverworldExit current_exit_; zelda3::OverworldExit current_exit_;
zelda3::OverworldItem current_item_; zelda3::OverworldItem current_item_;
zelda3::OverworldEntranceTileTypes entrance_tiletypes_ = {}; zelda3::OverworldEntranceTileTypes entrance_tiletypes_ = {};
zelda3::GameEntity* current_entity_ = nullptr; zelda3::GameEntity* current_entity_ = nullptr;
zelda3::GameEntity* dragged_entity_ = nullptr; zelda3::GameEntity* dragged_entity_ = nullptr;
gui::Canvas ow_map_canvas_{"OwMap", kOverworldCanvasSize, gui::Canvas ow_map_canvas_{"OwMap", kOverworldCanvasSize,
gui::CanvasGridSize::k64x64}; gui::CanvasGridSize::k64x64};
gui::Canvas current_gfx_canvas_{"CurrentGfx", kCurrentGfxCanvasSize, gui::Canvas current_gfx_canvas_{"CurrentGfx", kCurrentGfxCanvasSize,
gui::CanvasGridSize::k32x32}; gui::CanvasGridSize::k32x32};
gui::Canvas blockset_canvas_{"OwBlockset", kBlocksetCanvasSize, gui::Canvas blockset_canvas_{"OwBlockset", kBlocksetCanvasSize,
gui::CanvasGridSize::k32x32}; gui::CanvasGridSize::k32x32};
std::unique_ptr<gui::TileSelectorWidget> blockset_selector_; std::unique_ptr<gui::TileSelectorWidget> blockset_selector_;
gui::Canvas graphics_bin_canvas_{"GraphicsBin", kGraphicsBinCanvasSize, gui::Canvas graphics_bin_canvas_{"GraphicsBin", kGraphicsBinCanvasSize,
gui::CanvasGridSize::k16x16}; gui::CanvasGridSize::k16x16};
gui::Canvas properties_canvas_; gui::Canvas properties_canvas_;
gui::Canvas scratch_canvas_{"ScratchSpace", ImVec2(320, 480), gui::CanvasGridSize::k32x32}; gui::Canvas scratch_canvas_{"ScratchSpace", ImVec2(320, 480), gui::CanvasGridSize::k32x32};
absl::Status status_; absl::Status status_;
}; };
} // namespace editor } // namespace editor
} // namespace yaze } // namespace yaze
#endif #endif

View File

@@ -4,7 +4,7 @@
#include "app/core/features.h" #include "app/core/features.h"
#include "app/editor/overworld/entity.h" #include "app/editor/overworld/entity.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "util/hex.h" #include "util/hex.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"

View File

@@ -5,8 +5,8 @@
#include "app/gfx/bitmap.h" #include "app/gfx/bitmap.h"
#include "app/gui/canvas.h" #include "app/gui/canvas.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze { namespace yaze {

View File

@@ -27,9 +27,9 @@
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/gui/style.h" #include "app/gui/style.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui_memory_editor.h" #include "imgui_memory_editor.h"
#include "util/hex.h" #include "util/hex.h"

View File

@@ -12,7 +12,7 @@
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/gui/style.h" #include "app/gui/style.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "util/hex.h" #include "util/hex.h"
#include "util/log.h" #include "util/log.h"

View File

@@ -7,7 +7,7 @@
#include "app/gfx/arena.h" #include "app/gfx/arena.h"
#include "app/gui/icons.h" #include "app/gui/icons.h"
#include "app/gui/input.h" #include "app/gui/input.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "util/hex.h" #include "util/hex.h"
namespace yaze { namespace yaze {

View File

@@ -252,12 +252,11 @@ absl::Status PaletteManager::SaveGroup(const std::string& group_name) {
auto color_it = modified_colors_[group_name].find(palette_idx); auto color_it = modified_colors_[group_name].find(palette_idx);
if (color_it != modified_colors_[group_name].end()) { if (color_it != modified_colors_[group_name].end()) {
for (int color_idx : color_it->second) { for (int color_idx : color_it->second) {
// Calculate ROM address // Calculate ROM address using the helper function
uint32_t address = uint32_t address = GetPaletteAddress(group_name, palette_idx, color_idx);
GetPaletteAddress(group_name, palette_idx, color_idx);
// Write color to ROM // Write color to ROM - write the 16-bit SNES color value
RETURN_IF_ERROR(rom_->WriteColor(address, (*palette)[color_idx])); rom_->WriteShort(address, (*palette)[color_idx].snes());
} }
} }
} }

View File

@@ -1,8 +1,8 @@
#include "app/gui/widgets/dungeon_object_emulator_preview.h" #include "app/gui/widgets/dungeon_object_emulator_preview.h"
#include "app/gfx/backend/irenderer.h" #include "app/gfx/backend/irenderer.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "app/gui/widgets/widget_auto_register.h" #include "app/gui/widgets/widget_auto_register.h"
#include "app/core/window.h" #include "app/core/window.h"
#include <cstdio> #include <cstdio>

View File

@@ -7,7 +7,7 @@
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/test/test_manager.h" #include "app/test/test_manager.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/editor/overworld/tile16_editor.h" #include "app/editor/overworld/tile16_editor.h"
#include "app/gui/icons.h" #include "app/gui/icons.h"

View File

@@ -277,7 +277,7 @@ formatter.EndObject();
Command handlers are designed to work alongside the public C API defined in `incl/yaze.h` and `incl/zelda.h`. Command handlers are designed to work alongside the public C API defined in `incl/yaze.h` and `incl/zelda.h`.
- Handlers use internal C++ classes from `app/zelda3/` - Handlers use internal C++ classes from `zelda3/`
- Output structures align with C API data types where possible - Output structures align with C API data types where possible
- Future: C API bridge will expose commands to external applications - Future: C API bridge will expose commands to external applications

View File

@@ -20,7 +20,7 @@
#include "absl/time/time.h" #include "absl/time/time.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "app/core/project.h" #include "app/core/project.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "cli/handlers/agent/common.h" #include "cli/handlers/agent/common.h"
#include "cli/cli.h" #include "cli/cli.h"
#include "cli/service/ai/ai_service.h" #include "cli/service/ai/ai_service.h"

View File

@@ -1,6 +1,6 @@
#include "cli/cli.h" #include "cli/cli.h"
#include "app/zelda3/dungeon/dungeon_editor_system.h" #include "zelda3/dungeon/dungeon_editor_system.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/declare.h" #include "absl/flags/declare.h"

View File

@@ -2,7 +2,7 @@
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/zelda3/dungeon/dungeon_editor_system.h" #include "zelda3/dungeon/dungeon_editor_system.h"
namespace yaze { namespace yaze {
namespace cli { namespace cli {

View File

@@ -1,5 +1,5 @@
#include "cli/cli.h" #include "cli/cli.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "cli/handlers/game/overworld_inspect.h" #include "cli/handlers/game/overworld_inspect.h"
#include <algorithm> #include <algorithm>

View File

@@ -10,11 +10,11 @@
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_entrance.h" #include "zelda3/overworld/overworld_entrance.h"
#include "app/zelda3/overworld/overworld_exit.h" #include "zelda3/overworld/overworld_exit.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "util/macro.h" #include "util/macro.h"
namespace yaze { namespace yaze {

View File

@@ -2,7 +2,7 @@
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
namespace yaze { namespace yaze {
namespace cli { namespace cli {

View File

@@ -6,7 +6,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/core/project.h" #include "app/core/project.h"
#include "app/zelda3/zelda3_labels.h" #include "zelda3/zelda3_labels.h"
ABSL_DECLARE_FLAG(bool, mock_rom); ABSL_DECLARE_FLAG(bool, mock_rom);

View File

@@ -2,7 +2,7 @@
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
namespace yaze { namespace yaze {
namespace cli { namespace cli {

View File

@@ -7,7 +7,7 @@
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "util/macro.h" #include "util/macro.h"

View File

@@ -9,7 +9,7 @@
#include "app/editor/message/message_data.h" #include "app/editor/message/message_data.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "yaze_config.h" #include "yaze_config.h"
// Static variables for library state // Static variables for library state

View File

@@ -13,9 +13,9 @@
#include "app/gfx/bitmap.h" #include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "dungeon_object_editor.h" #include "dungeon_object_editor.h"
namespace yaze { namespace yaze {

View File

@@ -13,8 +13,8 @@
#include "app/gfx/bitmap.h" #include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -10,7 +10,7 @@
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -4,7 +4,7 @@
#include <cstring> #include <cstring>
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "util/log.h" #include "util/log.h"
// ROM addresses for object data (PC addresses, not SNES) // ROM addresses for object data (PC addresses, not SNES)

View File

@@ -10,9 +10,9 @@
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/snes.h" #include "app/snes.h"
#include "app/zelda3/dungeon/object_drawer.h" #include "zelda3/dungeon/object_drawer.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "util/log.h" #include "util/log.h"
namespace yaze { namespace yaze {

View File

@@ -9,10 +9,10 @@
#include "app/rom.h" #include "app/rom.h"
#include "app/gfx/background_buffer.h" #include "app/gfx/background_buffer.h"
#include "app/zelda3/dungeon/dungeon_rom_addresses.h" #include "zelda3/dungeon/dungeon_rom_addresses.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "app/zelda3/dungeon/room_layout.h" #include "zelda3/dungeon/room_layout.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -2,7 +2,7 @@
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "app/snes.h" #include "app/snes.h"
#include "app/zelda3/dungeon/dungeon_rom_addresses.h" #include "zelda3/dungeon/dungeon_rom_addresses.h"
namespace yaze::zelda3 { namespace yaze::zelda3 {

View File

@@ -6,7 +6,7 @@
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/status/statusor.h" #include "absl/status/statusor.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze::zelda3 { namespace yaze::zelda3 {

View File

@@ -1,7 +1,7 @@
#include "room_object.h" #include "room_object.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/zelda3/dungeon/object_parser.h" #include "zelda3/dungeon/object_parser.h"
#include "util/log.h" #include "util/log.h"
namespace yaze { namespace yaze {

View File

@@ -7,7 +7,7 @@
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/object_parser.h" #include "zelda3/dungeon/object_parser.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -15,8 +15,8 @@
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/snes.h" #include "app/snes.h"
#include "app/zelda3/overworld/overworld_entrance.h" #include "zelda3/overworld/overworld_entrance.h"
#include "app/zelda3/overworld/overworld_exit.h" #include "zelda3/overworld/overworld_exit.h"
#include "util/hex.h" #include "util/hex.h"
#include "util/log.h" #include "util/log.h"
#include "util/macro.h" #include "util/macro.h"

View File

@@ -8,11 +8,11 @@
#include "absl/status/status.h" #include "absl/status/status.h"
#include "app/gfx/snes_tile.h" #include "app/gfx/snes_tile.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld_entrance.h" #include "zelda3/overworld/overworld_entrance.h"
#include "app/zelda3/overworld/overworld_exit.h" #include "zelda3/overworld/overworld_exit.h"
#include "app/zelda3/overworld/overworld_item.h" #include "zelda3/overworld/overworld_item.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -4,7 +4,7 @@
#include <cstdint> #include <cstdint>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "util/macro.h" #include "util/macro.h"
namespace yaze { namespace yaze {

View File

@@ -4,7 +4,7 @@
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
#include "app/zelda3/common.h" #include "zelda3/common.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -8,7 +8,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/zelda3/common.h" #include "zelda3/common.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -1,392 +1,392 @@
#ifndef YAZE_APP_ZELDA3_SPRITE_H #ifndef YAZE_APP_ZELDA3_SPRITE_H
#define YAZE_APP_ZELDA3_SPRITE_H #define YAZE_APP_ZELDA3_SPRITE_H
#include <SDL.h> #include <SDL.h>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/sprite/overlord.h" #include "zelda3/sprite/overlord.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {
static const std::string kSpriteDefaultNames[]{ static const std::string kSpriteDefaultNames[]{
"00 Raven", "00 Raven",
"01 Vulture", "01 Vulture",
"02 Flying Stalfos Head", "02 Flying Stalfos Head",
"03 No Pointer (Empty", "03 No Pointer (Empty",
"04 Pull Switch (good", "04 Pull Switch (good",
"05 Pull Switch (unused", "05 Pull Switch (unused",
"06 Pull Switch (bad", "06 Pull Switch (bad",
"07 Pull Switch (unused", "07 Pull Switch (unused",
"08 Octorock (one way", "08 Octorock (one way",
"09 Moldorm (Boss", "09 Moldorm (Boss",
"0A Octorock (four way", "0A Octorock (four way",
"0B Chicken", "0B Chicken",
"0C Octorock (?", "0C Octorock (?",
"0D Buzzblock", "0D Buzzblock",
"0E Snapdragon", "0E Snapdragon",
"0F Octoballoon", "0F Octoballoon",
"10 Octoballon Hatchlings", "10 Octoballon Hatchlings",
"11 Hinox", "11 Hinox",
"12 Moblin", "12 Moblin",
"13 Mini Helmasaure", "13 Mini Helmasaure",
"14 Gargoyle's Domain Gate", "14 Gargoyle's Domain Gate",
"15 Antifairy", "15 Antifairy",
"16 Sahasrahla / Aginah", "16 Sahasrahla / Aginah",
"17 Bush Hoarder", "17 Bush Hoarder",
"18 Mini Moldorm", "18 Mini Moldorm",
"19 Poe", "19 Poe",
"1A Dwarves", "1A Dwarves",
"1B Arrow in wall", "1B Arrow in wall",
"1C Statue", "1C Statue",
"1D Weathervane", "1D Weathervane",
"1E Crystal Switch", "1E Crystal Switch",
"1F Bug-Catching Kid", "1F Bug-Catching Kid",
"20 Sluggula", "20 Sluggula",
"21 Push Switch", "21 Push Switch",
"22 Ropa", "22 Ropa",
"23 Red Bari", "23 Red Bari",
"24 Blue Bari", "24 Blue Bari",
"25 Talking Tree", "25 Talking Tree",
"26 Hardhat Beetle", "26 Hardhat Beetle",
"27 Deadrock", "27 Deadrock",
"28 Storytellers", "28 Storytellers",
"29 Blind Hideout attendant", "29 Blind Hideout attendant",
"2A Sweeping Lady", "2A Sweeping Lady",
"2B Storytellers", "2B Storytellers",
"2C Lumberjacks", "2C Lumberjacks",
"2D Telepathic Stones", "2D Telepathic Stones",
"2E Multipurpose Sprite", "2E Multipurpose Sprite",
"2F Race Npc", "2F Race Npc",
"30 Person?", "30 Person?",
"31 Fortune Teller", "31 Fortune Teller",
"32 Angry Brothers", "32 Angry Brothers",
"33 Pull for items", "33 Pull for items",
"34 Scared Girl", "34 Scared Girl",
"35 Innkeeper", "35 Innkeeper",
"36 Witch", "36 Witch",
"37 Waterfall", "37 Waterfall",
"38 Arrow Target", "38 Arrow Target",
"39 Average Middle", "39 Average Middle",
"3A Half Magic Bat", "3A Half Magic Bat",
"3B Dash Item", "3B Dash Item",
"3C Village Kid", "3C Village Kid",
"3D Signs? Chicken lady also showed up / Scared ladies outside houses.", "3D Signs? Chicken lady also showed up / Scared ladies outside houses.",
"3E Rock Hoarder", "3E Rock Hoarder",
"3F Tutorial Soldier", "3F Tutorial Soldier",
"40 Lightning Lock", "40 Lightning Lock",
"41 Blue Sword Soldier / Used by guards to detect player", "41 Blue Sword Soldier / Used by guards to detect player",
"42 Green Sword Soldier", "42 Green Sword Soldier",
"43 Red Spear Soldier", "43 Red Spear Soldier",
"44 Assault Sword Soldier", "44 Assault Sword Soldier",
"45 Green Spear Soldier", "45 Green Spear Soldier",
"46 Blue Archer", "46 Blue Archer",
"47 Green Archer", "47 Green Archer",
"48 Red Javelin Soldier", "48 Red Javelin Soldier",
"49 Red Javelin Soldier 2", "49 Red Javelin Soldier 2",
"4A Red Bomb Soldiers", "4A Red Bomb Soldiers",
"4B Green Soldier Recruits", "4B Green Soldier Recruits",
"4C Geldman", "4C Geldman",
"4D Rabbit", "4D Rabbit",
"4E Popo", "4E Popo",
"4F Popo 2", "4F Popo 2",
"50 Cannon Balls", "50 Cannon Balls",
"51 Armos", "51 Armos",
"52 Giant Zora", "52 Giant Zora",
"53 Armos Knights (Boss", "53 Armos Knights (Boss",
"54 Lanmolas (Boss", "54 Lanmolas (Boss",
"55 Fireball Zora", "55 Fireball Zora",
"56 Walking Zora", "56 Walking Zora",
"57 Desert Palace Barriers", "57 Desert Palace Barriers",
"58 Crab", "58 Crab",
"59 Bird", "59 Bird",
"5A Squirrel", "5A Squirrel",
"5B Spark (Left to Right", "5B Spark (Left to Right",
"5C Spark (Right to Left", "5C Spark (Right to Left",
"5D Roller (vertical moving", "5D Roller (vertical moving",
"5E Roller (vertical moving", "5E Roller (vertical moving",
"5F Roller", "5F Roller",
"60 Roller (horizontal moving", "60 Roller (horizontal moving",
"61 Beamos", "61 Beamos",
"62 Master Sword", "62 Master Sword",
"63 Devalant (Non", "63 Devalant (Non",
"64 Devalant (Shooter", "64 Devalant (Shooter",
"65 Shooting Gallery Proprietor", "65 Shooting Gallery Proprietor",
"66 Moving Cannon Ball Shooters (Right", "66 Moving Cannon Ball Shooters (Right",
"67 Moving Cannon Ball Shooters (Left", "67 Moving Cannon Ball Shooters (Left",
"68 Moving Cannon Ball Shooters (Down", "68 Moving Cannon Ball Shooters (Down",
"69 Moving Cannon Ball Shooters (Up", "69 Moving Cannon Ball Shooters (Up",
"6A Ball N' Chain Trooper", "6A Ball N' Chain Trooper",
"6B Cannon Soldier", "6B Cannon Soldier",
"6C Mirror Portal", "6C Mirror Portal",
"6D Rat", "6D Rat",
"6E Rope", "6E Rope",
"6F Keese", "6F Keese",
"70 Helmasaur King Fireball", "70 Helmasaur King Fireball",
"71 Leever", "71 Leever",
"72 Activator for the ponds (where you throw in items", "72 Activator for the ponds (where you throw in items",
"73 Uncle / Priest", "73 Uncle / Priest",
"74 Running Man", "74 Running Man",
"75 Bottle Salesman", "75 Bottle Salesman",
"76 Princess Zelda", "76 Princess Zelda",
"77 Antifairy (Alternate", "77 Antifairy (Alternate",
"78 Village Elder", "78 Village Elder",
"79 Bee", "79 Bee",
"7A Agahnim", "7A Agahnim",
"7B Agahnim Energy Ball", "7B Agahnim Energy Ball",
"7C Hyu", "7C Hyu",
"7D Big Spike Trap", "7D Big Spike Trap",
"7E Guruguru Bar (Clockwise", "7E Guruguru Bar (Clockwise",
"7F Guruguru Bar (Counter Clockwise", "7F Guruguru Bar (Counter Clockwise",
"80 Winder", "80 Winder",
"81 Water Tektite", "81 Water Tektite",
"82 Antifairy Circle", "82 Antifairy Circle",
"83 Green Eyegore", "83 Green Eyegore",
"84 Red Eyegore", "84 Red Eyegore",
"85 Yellow Stalfos", "85 Yellow Stalfos",
"86 Kodongos", "86 Kodongos",
"87 Flames", "87 Flames",
"88 Mothula (Boss", "88 Mothula (Boss",
"89 Mothula's Beam", "89 Mothula's Beam",
"8A Spike Trap", "8A Spike Trap",
"8B Gibdo", "8B Gibdo",
"8C Arrghus (Boss", "8C Arrghus (Boss",
"8D Arrghus spawn", "8D Arrghus spawn",
"8E Terrorpin", "8E Terrorpin",
"8F Slime", "8F Slime",
"90 Wallmaster", "90 Wallmaster",
"91 Stalfos Knight", "91 Stalfos Knight",
"92 Helmasaur King", "92 Helmasaur King",
"93 Bumper", "93 Bumper",
"94 Swimmers", "94 Swimmers",
"95 Eye Laser (Right", "95 Eye Laser (Right",
"96 Eye Laser (Left", "96 Eye Laser (Left",
"97 Eye Laser (Down", "97 Eye Laser (Down",
"98 Eye Laser (Up", "98 Eye Laser (Up",
"99 Pengator", "99 Pengator",
"9A Kyameron", "9A Kyameron",
"9B Wizzrobe", "9B Wizzrobe",
"9C Tadpoles", "9C Tadpoles",
"9D Tadpoles", "9D Tadpoles",
"9E Ostrich (Haunted Grove", "9E Ostrich (Haunted Grove",
"9F Flute", "9F Flute",
"A0 Birds (Haunted Grove", "A0 Birds (Haunted Grove",
"A1 Freezor", "A1 Freezor",
"A2 Kholdstare (Boss", "A2 Kholdstare (Boss",
"A3 Kholdstare's Shell", "A3 Kholdstare's Shell",
"A4 Falling Ice", "A4 Falling Ice",
"A5 Zazak Fireball", "A5 Zazak Fireball",
"A6 Red Zazak", "A6 Red Zazak",
"A7 Stalfos", "A7 Stalfos",
"A8 Bomber Flying Creatures from Darkworld", "A8 Bomber Flying Creatures from Darkworld",
"A9 Bomber Flying Creatures from Darkworld", "A9 Bomber Flying Creatures from Darkworld",
"AA Pikit", "AA Pikit",
"AB Maiden", "AB Maiden",
"AC Apple", "AC Apple",
"AD Lost Old Man", "AD Lost Old Man",
"AE Down Pipe", "AE Down Pipe",
"AF Up Pipe", "AF Up Pipe",
"B0 Right Pip", "B0 Right Pip",
"B1 Left Pipe", "B1 Left Pipe",
"B2 Good bee again?", "B2 Good bee again?",
"B3 Hylian Inscription", "B3 Hylian Inscription",
"B4 Thief?s chest (not the one that follows you", "B4 Thief?s chest (not the one that follows you",
"B5 Bomb Salesman", "B5 Bomb Salesman",
"B6 Kiki", "B6 Kiki",
"B7 Maiden following you in Blind Dungeon", "B7 Maiden following you in Blind Dungeon",
"B8 Monologue Testing Sprite", "B8 Monologue Testing Sprite",
"B9 Feuding Friends on Death Mountain", "B9 Feuding Friends on Death Mountain",
"BA Whirlpool", "BA Whirlpool",
"BB Salesman / chestgame guy / 300 rupee giver guy / Chest game thief", "BB Salesman / chestgame guy / 300 rupee giver guy / Chest game thief",
"BC Drunk in the inn", "BC Drunk in the inn",
"BD Vitreous (Large Eyeball", "BD Vitreous (Large Eyeball",
"BE Vitreous (Small Eyeball", "BE Vitreous (Small Eyeball",
"BF Vitreous' Lightning", "BF Vitreous' Lightning",
"C0 Monster in Lake of Ill Omen / Quake Medallion", "C0 Monster in Lake of Ill Omen / Quake Medallion",
"C1 Agahnim teleporting Zelda to dark world", "C1 Agahnim teleporting Zelda to dark world",
"C2 Boulders", "C2 Boulders",
"C3 Gibo", "C3 Gibo",
"C4 Thief", "C4 Thief",
"C5 Medusa", "C5 Medusa",
"C6 Four Way Fireball Spitters (spit when you use your sword", "C6 Four Way Fireball Spitters (spit when you use your sword",
"C7 Hokku", "C7 Hokku",
"C8 Big Fairy who heals you", "C8 Big Fairy who heals you",
"C9 Tektite", "C9 Tektite",
"CA Chain Chomp", "CA Chain Chomp",
"CB Trinexx", "CB Trinexx",
"CC Another part of trinexx", "CC Another part of trinexx",
"CD Yet another part of trinexx", "CD Yet another part of trinexx",
"CE Blind The Thief (Boss)", "CE Blind The Thief (Boss)",
"CF Swamola", "CF Swamola",
"D0 Lynel", "D0 Lynel",
"D1 Bunny Beam", "D1 Bunny Beam",
"D2 Flopping fish", "D2 Flopping fish",
"D3 Stal", "D3 Stal",
"D4 Landmine", "D4 Landmine",
"D5 Digging Game Proprietor", "D5 Digging Game Proprietor",
"D6 Ganon", "D6 Ganon",
"D7 Copy of Ganon", "D7 Copy of Ganon",
"D8 Heart", "D8 Heart",
"D9 Green Rupee", "D9 Green Rupee",
"DA Blue Rupee", "DA Blue Rupee",
"DB Red Rupee", "DB Red Rupee",
"DC Bomb Refill (1)", "DC Bomb Refill (1)",
"DD Bomb Refill (4)", "DD Bomb Refill (4)",
"DE Bomb Refill (8)", "DE Bomb Refill (8)",
"DF Small Magic Refill", "DF Small Magic Refill",
"E0 Full Magic Refill", "E0 Full Magic Refill",
"E1 Arrow Refill (5)", "E1 Arrow Refill (5)",
"E2 Arrow Refill (10)", "E2 Arrow Refill (10)",
"E3 Fairy", "E3 Fairy",
"E4 Key", "E4 Key",
"E5 Big Key", "E5 Big Key",
"E6 Shield", "E6 Shield",
"E7 Mushroom", "E7 Mushroom",
"E8 Fake Master Sword", "E8 Fake Master Sword",
"E9 Magic Shop dude / His items", "E9 Magic Shop dude / His items",
"EA Heart Container", "EA Heart Container",
"EB Heart Piece", "EB Heart Piece",
"EC Bushes", "EC Bushes",
"ED Cane Of Somaria Platform", "ED Cane Of Somaria Platform",
"EE Mantle", "EE Mantle",
"EF Cane of Somaria Platform (Unused)", "EF Cane of Somaria Platform (Unused)",
"F0 Cane of Somaria Platform (Unused)", "F0 Cane of Somaria Platform (Unused)",
"F1 Cane of Somaria Platform (Unused)", "F1 Cane of Somaria Platform (Unused)",
"F2 Medallion Tablet", "F2 Medallion Tablet",
"F3", "F3",
"F4 Falling Rocks", "F4 Falling Rocks",
"F5", "F5",
"F6", "F6",
"F7", "F7",
"F8", "F8",
"F9", "F9",
"FA", "FA",
"FB", "FB",
"FC", "FC",
"FD", "FD",
"FE", "FE",
"FF", "FF",
}; };
/** /**
* @class Sprite * @class Sprite
* @brief A class for managing sprites in the overworld and underworld. * @brief A class for managing sprites in the overworld and underworld.
*/ */
class Sprite : public GameEntity { class Sprite : public GameEntity {
public: public:
Sprite() = default; Sprite() = default;
Sprite(const std::vector<uint8_t>& src, uint8_t overworld_map_id, uint8_t id, Sprite(const std::vector<uint8_t>& src, uint8_t overworld_map_id, uint8_t id,
uint8_t x, uint8_t y, int map_x, int map_y) uint8_t x, uint8_t y, int map_x, int map_y)
: map_id_(static_cast<int>(overworld_map_id)), : map_id_(static_cast<int>(overworld_map_id)),
id_(id), id_(id),
nx_(x), nx_(x),
ny_(y), ny_(y),
map_x_(map_x), map_x_(map_x),
map_y_(map_y), map_y_(map_y),
current_gfx_(src) { current_gfx_(src) {
entity_type_ = zelda3::GameEntity::EntityType::kSprite; entity_type_ = zelda3::GameEntity::EntityType::kSprite;
entity_id_ = id; entity_id_ = id;
x_ = map_x_; x_ = map_x_;
y_ = map_y_; y_ = map_y_;
overworld_ = true; overworld_ = true;
name_ = kSpriteDefaultNames[id]; name_ = kSpriteDefaultNames[id];
preview_gfx_.resize(64 * 64, 0xFF); preview_gfx_.resize(64 * 64, 0xFF);
} }
Sprite(uint8_t id, uint8_t x, uint8_t y, uint8_t subtype, uint8_t layer) Sprite(uint8_t id, uint8_t x, uint8_t y, uint8_t subtype, uint8_t layer)
: id_(id), nx_(x), ny_(y), subtype_(subtype), layer_(layer) { : id_(id), nx_(x), ny_(y), subtype_(subtype), layer_(layer) {
x_ = x; x_ = x;
y_ = y; y_ = y;
name_ = kSpriteDefaultNames[id]; name_ = kSpriteDefaultNames[id];
if (((subtype & 0x07) == 0x07) && id > 0 && id <= 0x1A) { if (((subtype & 0x07) == 0x07) && id > 0 && id <= 0x1A) {
name_ = kOverlordNames[id - 1]; name_ = kOverlordNames[id - 1];
overlord_ = 1; overlord_ = 1;
} }
} }
void InitSprite(const std::vector<uint8_t>& src, uint8_t overworld_map_id, void InitSprite(const std::vector<uint8_t>& src, uint8_t overworld_map_id,
uint8_t id, uint8_t x, uint8_t y, int map_x, int map_y) { uint8_t id, uint8_t x, uint8_t y, int map_x, int map_y) {
current_gfx_ = src; current_gfx_ = src;
overworld_ = true; overworld_ = true;
map_id_ = static_cast<int>(overworld_map_id); map_id_ = static_cast<int>(overworld_map_id);
id_ = id; id_ = id;
entity_type_ = zelda3::GameEntity::EntityType::kSprite; entity_type_ = zelda3::GameEntity::EntityType::kSprite;
entity_id_ = id; entity_id_ = id;
x_ = map_x_; x_ = map_x_;
y_ = map_y_; y_ = map_y_;
nx_ = x; nx_ = x;
ny_ = y; ny_ = y;
name_ = kSpriteDefaultNames[id]; name_ = kSpriteDefaultNames[id];
map_x_ = map_x; map_x_ = map_x;
map_y_ = map_y; map_y_ = map_y;
preview_gfx_.resize(64 * 64, 0xFF); preview_gfx_.resize(64 * 64, 0xFF);
} }
void Draw(); void Draw();
void DrawSpriteTile(int x, int y, int srcx, int srcy, int pal, void DrawSpriteTile(int x, int y, int srcx, int srcy, int pal,
bool mirror_x = false, bool mirror_y = false, bool mirror_x = false, bool mirror_y = false,
int sizex = 2, int sizey = 2); int sizex = 2, int sizey = 2);
void UpdateMapProperties(uint16_t map_id) override; void UpdateMapProperties(uint16_t map_id) override;
void UpdateCoordinates(int map_x, int map_y); void UpdateCoordinates(int map_x, int map_y);
auto preview_graphics() const { return &preview_gfx_; } auto preview_graphics() const { return &preview_gfx_; }
auto id() const { return id_; } auto id() const { return id_; }
auto set_id(uint8_t id) { id_ = id; } auto set_id(uint8_t id) { id_ = id; }
auto x() const { return x_; } auto x() const { return x_; }
auto y() const { return y_; } auto y() const { return y_; }
auto nx() const { return nx_; } auto nx() const { return nx_; }
auto ny() const { return ny_; } auto ny() const { return ny_; }
auto map_id() const { return map_id_; } auto map_id() const { return map_id_; }
auto map_x() const { return map_x_; } auto map_x() const { return map_x_; }
auto map_y() const { return map_y_; } auto map_y() const { return map_y_; }
auto game_state() const { return game_state_; } auto game_state() const { return game_state_; }
auto layer() const { return layer_; } auto layer() const { return layer_; }
auto subtype() const { return subtype_; } auto subtype() const { return subtype_; }
auto width() const { return width_; } auto width() const { return width_; }
auto height() const { return height_; } auto height() const { return height_; }
auto name() { return name_; } auto name() { return name_; }
auto deleted() const { return deleted_; } auto deleted() const { return deleted_; }
auto set_deleted(bool deleted) { deleted_ = deleted; } auto set_deleted(bool deleted) { deleted_ = deleted; }
auto set_key_drop(int key) { key_drop_ = key; } auto set_key_drop(int key) { key_drop_ = key; }
private: private:
uint8_t map_id_; uint8_t map_id_;
uint8_t game_state_; uint8_t game_state_;
uint8_t id_; uint8_t id_;
uint8_t nx_; uint8_t nx_;
uint8_t ny_; uint8_t ny_;
uint8_t overlord_ = 0; uint8_t overlord_ = 0;
uint8_t lower_x_ = 32; uint8_t lower_x_ = 32;
uint8_t lower_y_ = 32; uint8_t lower_y_ = 32;
uint8_t higher_x_ = 0; uint8_t higher_x_ = 0;
uint8_t higher_y_ = 0; uint8_t higher_y_ = 0;
int width_ = 16; int width_ = 16;
int height_ = 16; int height_ = 16;
int map_x_ = 0; int map_x_ = 0;
int map_y_ = 0; int map_y_ = 0;
int layer_ = 0; int layer_ = 0;
int subtype_ = 0; int subtype_ = 0;
int key_drop_ = 0; int key_drop_ = 0;
bool deleted_ = false; bool deleted_ = false;
bool overworld_; bool overworld_;
std::string name_; std::string name_;
std::vector<uint8_t> preview_gfx_; std::vector<uint8_t> preview_gfx_;
std::vector<uint8_t> current_gfx_; std::vector<uint8_t> current_gfx_;
SDL_Rect bounding_box_; SDL_Rect bounding_box_;
}; };
} // namespace zelda3 } // namespace zelda3
} // namespace yaze } // namespace yaze
#endif #endif

View File

@@ -1,9 +1,9 @@
#include "app/zelda3/zelda3_labels.h" #include "zelda3/zelda3_labels.h"
#include "app/zelda3/common.h" #include "zelda3/common.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/sprite/sprite.h" #include "zelda3/sprite/sprite.h"
#include "app/zelda3/sprite/overlord.h" #include "zelda3/sprite/overlord.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -1,21 +1,21 @@
set( set(
YAZE_APP_ZELDA3_SRC YAZE_APP_ZELDA3_SRC
app/zelda3/dungeon/dungeon_editor_system.cc zelda3/dungeon/dungeon_editor_system.cc
app/zelda3/dungeon/dungeon_object_editor.cc zelda3/dungeon/dungeon_object_editor.cc
app/zelda3/dungeon/object_drawer.cc zelda3/dungeon/object_drawer.cc
app/zelda3/dungeon/object_parser.cc zelda3/dungeon/object_parser.cc
app/zelda3/dungeon/room.cc zelda3/dungeon/room.cc
app/zelda3/dungeon/room_layout.cc zelda3/dungeon/room_layout.cc
app/zelda3/dungeon/room_object.cc zelda3/dungeon/room_object.cc
app/zelda3/music/tracker.cc zelda3/music/tracker.cc
app/zelda3/overworld/overworld.cc zelda3/overworld/overworld.cc
app/zelda3/overworld/overworld_map.cc zelda3/overworld/overworld_map.cc
app/zelda3/screen/dungeon_map.cc zelda3/screen/dungeon_map.cc
app/zelda3/screen/inventory.cc zelda3/screen/inventory.cc
app/zelda3/screen/title_screen.cc zelda3/screen/title_screen.cc
app/zelda3/sprite/sprite.cc zelda3/sprite/sprite.cc
app/zelda3/sprite/sprite_builder.cc zelda3/sprite/sprite_builder.cc
app/zelda3/zelda3_labels.cc zelda3/zelda3_labels.cc
) )
# ============================================================================== # ==============================================================================

View File

@@ -60,8 +60,8 @@
#include "app/core/window.h" #include "app/core/window.h"
#include "app/editor/dungeon/dungeon_editor_v2.h" #include "app/editor/dungeon/dungeon_editor_v2.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include "test_utils.h" #include "test_utils.h"
namespace yaze { namespace yaze {

View File

@@ -5,8 +5,8 @@
#include <string> #include <string>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "testing.h" #include "testing.h"
namespace yaze { namespace yaze {

View File

@@ -1,7 +1,7 @@
#include "integration/dungeon_editor_test.h" #include "integration/dungeon_editor_test.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace test { namespace test {

View File

@@ -6,7 +6,7 @@
#include "app/editor/dungeon/dungeon_editor_v2.h" #include "app/editor/dungeon/dungeon_editor_v2.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace yaze { namespace yaze {

View File

@@ -10,7 +10,7 @@
#include "app/gfx/backend/sdl2_renderer.h" #include "app/gfx/backend/sdl2_renderer.h"
#include "app/gfx/bitmap.h" #include "app/gfx/bitmap.h"
#include "app/gfx/tilemap.h" #include "app/gfx/tilemap.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/core/window.h" #include "app/core/window.h"
namespace yaze { namespace yaze {

View File

@@ -5,9 +5,9 @@
#include <chrono> #include <chrono>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/dungeon_editor_system.h" #include "zelda3/dungeon/dungeon_editor_system.h"
#include "app/zelda3/dungeon/dungeon_object_editor.h" #include "zelda3/dungeon/dungeon_object_editor.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -6,9 +6,9 @@
#define IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS
#endif #endif
#include "app/zelda3/dungeon/object_drawer.h" #include "zelda3/dungeon/object_drawer.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> #include <memory>

View File

@@ -2,9 +2,9 @@
// Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production system) // Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production system)
// instead of the obsolete ObjectRenderer // instead of the obsolete ObjectRenderer
#include "app/zelda3/dungeon/object_drawer.h" #include "zelda3/dungeon/object_drawer.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <memory> #include <memory>

View File

@@ -4,10 +4,10 @@
#include "app/gfx/background_buffer.h" #include "app/gfx/background_buffer.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/object_drawer.h" #include "zelda3/dungeon/object_drawer.h"
#include "app/zelda3/dungeon/object_parser.h" #include "zelda3/dungeon/object_parser.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -2,7 +2,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
namespace yaze { namespace yaze {
namespace test { namespace test {

View File

@@ -5,8 +5,8 @@
#include <string> #include <string>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
#include "testing.h" #include "testing.h"
namespace yaze { namespace yaze {

View File

@@ -5,8 +5,8 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
// Helper function for SNES to PC address conversion // Helper function for SNES to PC address conversion
inline int SnesToPc(int addr) { inline int SnesToPc(int addr) {

View File

@@ -5,8 +5,8 @@
#include <fstream> #include <fstream>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/overworld/overworld.h" #include "zelda3/overworld/overworld.h"
#include "app/zelda3/overworld/overworld_map.h" #include "zelda3/overworld/overworld_map.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -4,9 +4,9 @@
#include "app/gfx/background_buffer.h" #include "app/gfx/background_buffer.h"
#include "app/gfx/snes_palette.h" #include "app/gfx/snes_palette.h"
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/object_drawer.h" #include "zelda3/dungeon/object_drawer.h"
#include "app/zelda3/dungeon/object_parser.h" #include "zelda3/dungeon/object_parser.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

View File

@@ -2,8 +2,8 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "app/rom.h" #include "app/rom.h"
#include "app/zelda3/dungeon/room.h" #include "zelda3/dungeon/room.h"
#include "app/zelda3/dungeon/room_object.h" #include "zelda3/dungeon/room_object.h"
namespace yaze { namespace yaze {
namespace zelda3 { namespace zelda3 {

Some files were not shown because too many files have changed in this diff Show More