Add Overworld accessors and enhance testing framework

- Introduced new methods in `Controller`, `EditorManager`, and `OverworldEditor` to access the `Overworld` instance, improving modularity and interaction with the overworld data.
- Added `GetTile` method in `Overworld` to retrieve tile data based on coordinates, enhancing functionality for tile manipulation.
- Implemented a new testing framework with automated GUI tests, including `CanvasSelectionTest` and `FrameworkSmokeTest`, to validate user interactions and ensure robustness.
- Updated `CMakeLists.txt` to include new test files and dependencies, streamlining the build process for testing.
- Refactored logging behavior to ensure proper file handling during logging operations, improving reliability in logging outputs.
This commit is contained in:
scawful
2025-09-30 19:32:34 -04:00
parent dcfdcf71d3
commit 5cc5c08122
14 changed files with 374 additions and 9 deletions

View File

@@ -32,6 +32,7 @@ class Controller {
auto window() -> SDL_Window * { return window_.window_.get(); }
void set_active(bool active) { active_ = active; }
auto active() const { return active_; }
auto overworld() -> yaze::zelda3::Overworld* { return editor_manager_.overworld(); }
private:
friend int ::main(int argc, char **argv);

View File

@@ -101,6 +101,7 @@ class EditorManager {
absl::Status SetCurrentRom(Rom* rom);
auto GetCurrentRom() -> Rom* { return current_rom_; }
auto GetCurrentEditorSet() -> EditorSet* { return current_editor_set_; }
auto overworld() -> yaze::zelda3::Overworld* { return &current_editor_set_->overworld_editor_.overworld(); }
// Get current session's feature flags (falls back to global if no session)
core::FeatureFlags::Flags* GetCurrentFeatureFlags() {

View File

@@ -94,6 +94,7 @@ class OverworldEditor : public Editor, public gfx::GfxContext {
absl::Status Find() override { return absl::UnimplementedError("Find"); }
absl::Status Save() override;
absl::Status Clear() override;
zelda3::Overworld& overworld() { return overworld_; }
/**
* @brief Apply ZSCustomOverworld ASM patch to upgrade ROM version

View File

@@ -278,6 +278,15 @@ class Overworld {
auto expanded_entrances() const { return expanded_entrances_; }
void set_current_map(int i) { current_map_ = i; }
void set_current_world(int world) { current_world_ = world; }
uint16_t GetTile(int x, int y) const {
if (current_world_ == 0) {
return map_tiles_.light_world[y][x];
} else if (current_world_ == 1) {
return map_tiles_.dark_world[y][x];
} else {
return map_tiles_.special_world[y][x];
}
}
auto map_tiles() const { return map_tiles_; }
auto mutable_map_tiles() { return &map_tiles_; }
auto all_items() const { return all_items_; }