diff --git a/src/yaze.cc b/src/yaze.cc index b38399a7..88fb729f 100644 --- a/src/yaze.cc +++ b/src/yaze.cc @@ -1,6 +1,7 @@ #include "yaze.h" #include "app/rom.h" +#include "app/zelda3/overworld/overworld.h" void yaze_init(yaze_flags* flags) { if (flags == nullptr) { @@ -69,4 +70,23 @@ snes_color yaze_get_color_from_paletteset(const z3_rom* rom, int palette_set, } return color_struct; +} + +z3_overworld* yaze_load_overworld(const z3_rom* rom) { + if (rom->impl == nullptr) { + return nullptr; + } + + yaze::app::Rom* internal_rom = static_cast(rom->impl); + + yaze::app::zelda3::Overworld* internal_overworld = + new yaze::app::zelda3::Overworld(); + auto load_ow = internal_overworld->Load(internal_rom); + if (!load_ow.ok()) { + return nullptr; + } + + z3_overworld* overworld = new z3_overworld(); + overworld->impl = internal_overworld; + return overworld; } \ No newline at end of file diff --git a/src/yaze.h b/src/yaze.h index 9cfc2871..0d99330e 100644 --- a/src/yaze.h +++ b/src/yaze.h @@ -10,6 +10,7 @@ extern "C" { #include "base/snes_color.h" #include "base/sprite.h" +#include "base/overworld.h" typedef struct yaze_flags yaze_flags; typedef struct z3_rom z3_rom; @@ -63,6 +64,8 @@ void yaze_unload_rom(z3_rom* rom); snes_color yaze_get_color_from_paletteset(const z3_rom* rom, int palette_set, int palette, int color); +z3_overworld* yaze_load_overworld(const z3_rom* rom); + #ifdef __cplusplus } #endif