add yaze_load_overworld

This commit is contained in:
scawful
2024-08-09 01:43:54 -04:00
parent 022d138d26
commit 596f5926dd
2 changed files with 23 additions and 0 deletions

View File

@@ -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<yaze::app::Rom*>(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;
}

View File

@@ -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