chore: pass flag to overworld map for loading custom data

This commit is contained in:
scawful
2024-08-25 16:50:41 -04:00
parent 57a165bab6
commit 0c9faa7ac4
5 changed files with 21 additions and 7 deletions

View File

@@ -331,6 +331,10 @@ void OverworldEditor::DrawOverworldMapSettings() {
}
}
void OverworldEditor::DrawCustomOverworldMapSettings() {
// TODO: Add @JaredBrian ZSCustomOverworld features to OverworldEditor
}
void OverworldEditor::DrawOverworldMaps() {
int xx = 0;
int yy = 0;
@@ -564,10 +568,13 @@ void OverworldEditor::CheckForMousePan() {
}
}
// TODO: Add @JaredBrian ZSCustomOverworld features to OverworldEditor
void OverworldEditor::DrawOverworldCanvas() {
if (all_gfx_loaded_) {
DrawOverworldMapSettings();
if (flags()->overworld.kLoadCustomOverworld) {
DrawCustomOverworldMapSettings();
} else {
DrawOverworldMapSettings();
}
Separator();
}

View File

@@ -157,6 +157,7 @@ class OverworldEditor : public Editor,
* @brief Draws the overworld map settings. Graphics, palettes, etc.
*/
void DrawOverworldMapSettings();
void DrawCustomOverworldMapSettings();
void RefreshChildMap(int i);
void RefreshOverworldMap();

View File

@@ -86,8 +86,10 @@ absl::Status Overworld::Load(Rom &rom) {
AssembleMap16Tiles();
RETURN_IF_ERROR(DecompressAllMapTiles())
const bool load_custom_overworld = flags()->overworld.kLoadCustomOverworld;
for (int map_index = 0; map_index < kNumOverworldMaps; ++map_index)
overworld_maps_.emplace_back(map_index, rom_, tiles16_);
overworld_maps_.emplace_back(map_index, rom_, tiles16_,
load_custom_overworld);
FetchLargeMaps();
LoadEntrances();
@@ -1516,8 +1518,10 @@ absl::Status Overworld::LoadPrototype(Rom &rom,
AssembleMap16Tiles();
RETURN_IF_ERROR(DecompressProtoMapTiles(tilemap_filename))
const bool load_custom_overworld = flags()->overworld.kLoadCustomOverworld;
for (int map_index = 0; map_index < kNumOverworldMaps; ++map_index)
overworld_maps_.emplace_back(map_index, rom_, tiles16_);
overworld_maps_.emplace_back(map_index, rom_, tiles16_,
load_custom_overworld);
FetchLargeMaps();
LoadEntrances();

View File

@@ -19,11 +19,12 @@ namespace zelda3 {
namespace overworld {
OverworldMap::OverworldMap(int index, Rom& rom,
std::vector<gfx::Tile16>& tiles16)
std::vector<gfx::Tile16>& tiles16,
bool load_custom_data)
: index_(index), parent_(index), rom_(rom), tiles16_(tiles16) {
LoadAreaInfo();
if (flags()->kLoadCustomOverworld) {
if (load_custom_data) {
// If the custom overworld ASM has NOT already been applied, manually set
// the vanilla values.
uint8_t asm_version = rom_[OverworldCustomASMHasBeenApplied];

View File

@@ -67,7 +67,8 @@ constexpr int OverworldCustomTileGFXGroupEnabled = 0x140148;
class OverworldMap : public editor::context::GfxContext {
public:
OverworldMap() = default;
OverworldMap(int index, Rom& rom, std::vector<gfx::Tile16>& tiles16);
OverworldMap(int index, Rom& rom, std::vector<gfx::Tile16>& tiles16,
bool load_custom_data = false);
absl::Status BuildMap(int count, int game_state, int world,
OWBlockset& world_blockset);