Add EntranceContext for managing custom entrance tile types
This commit is contained in:
40
src/app/editor/context/entrance_context.h
Normal file
40
src/app/editor/context/entrance_context.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#ifndef YAZE_APP_EDITOR_CONTEXT_ENTRANCE_CONTEXT_H_
|
||||||
|
#define YAZE_APP_EDITOR_CONTEXT_ENTRANCE_CONTEXT_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/status/status.h"
|
||||||
|
#include "app/rom.h"
|
||||||
|
|
||||||
|
namespace yaze {
|
||||||
|
namespace app {
|
||||||
|
namespace editor {
|
||||||
|
|
||||||
|
class EntranceContext {
|
||||||
|
public:
|
||||||
|
absl::Status LoadEntranceTileTypes(ROM& rom) {
|
||||||
|
int offset_low = 0xDB8BF;
|
||||||
|
int offset_high = 0xDB917;
|
||||||
|
|
||||||
|
for (int i = 0; i < 0x2C; i++) {
|
||||||
|
// Load entrance tile types
|
||||||
|
ASSIGN_OR_RETURN(auto value_low, rom.ReadWord(offset_low + i));
|
||||||
|
entrance_tile_types_low_.push_back(value_low);
|
||||||
|
ASSIGN_OR_RETURN(auto value_high, rom.ReadWord(offset_high + i));
|
||||||
|
entrance_tile_types_low_.push_back(value_high);
|
||||||
|
}
|
||||||
|
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<uint16_t> entrance_tile_types_low_;
|
||||||
|
std::vector<uint16_t> entrance_tile_types_high_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace editor
|
||||||
|
} // namespace app
|
||||||
|
} // namespace yaze
|
||||||
|
|
||||||
|
#endif // YAZE_APP_EDITOR_CONTEXT_ENTRANCE_CONTEXT_H_
|
||||||
@@ -48,6 +48,7 @@ absl::Status OverworldEditor::Update() {
|
|||||||
tile16_individual_,
|
tile16_individual_,
|
||||||
*overworld_.mutable_all_tiles_types());
|
*overworld_.mutable_all_tiles_types());
|
||||||
gfx_group_editor_.InitBlockset(tile16_blockset_bmp_);
|
gfx_group_editor_.InitBlockset(tile16_blockset_bmp_);
|
||||||
|
RETURN_IF_ERROR(LoadEntranceTileTypes(*rom()));
|
||||||
all_gfx_loaded_ = true;
|
all_gfx_loaded_ = true;
|
||||||
} else if (!rom()->is_loaded() && all_gfx_loaded_) {
|
} else if (!rom()->is_loaded() && all_gfx_loaded_) {
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/core/editor.h"
|
||||||
|
#include "app/editor/context/entrance_context.h"
|
||||||
#include "app/editor/context/gfx_context.h"
|
#include "app/editor/context/gfx_context.h"
|
||||||
#include "app/editor/modules/gfx_group_editor.h"
|
#include "app/editor/modules/gfx_group_editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
@@ -64,6 +65,7 @@ constexpr absl::string_view kOWMapTable = "#MapSettingsTable";
|
|||||||
class OverworldEditor : public Editor,
|
class OverworldEditor : public Editor,
|
||||||
public SharedROM,
|
public SharedROM,
|
||||||
public GfxContext,
|
public GfxContext,
|
||||||
|
public EntranceContext,
|
||||||
public core::ExperimentFlags {
|
public core::ExperimentFlags {
|
||||||
public:
|
public:
|
||||||
absl::Status Update() final;
|
absl::Status Update() final;
|
||||||
|
|||||||
Reference in New Issue
Block a user