1#ifndef YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
2#define YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
11#include "absl/status/status.h"
12#include "absl/status/statusor.h"
53 uint8_t normalized_map_id = room_map_id % 0x40;
54 int map_x = normalized_map_id % 8;
55 int map_y = normalized_map_id / 8;
57 game_x_ =
static_cast<uint8_t
>(std::abs(x - (map_x * 512)) / 16);
58 game_y_ =
static_cast<uint8_t
>(std::abs(y - (map_y * 512)) / 16);
62 const void* context =
nullptr)
override {
67 uint8_t normalized_map_id = room_map_id % 0x40;
68 int map_x = normalized_map_id % 8;
69 int map_y = normalized_map_id / 8;
72 game_x_ =
static_cast<uint8_t
>(std::abs(
x_ - (map_x * 512)) / 16);
73 game_y_ =
static_cast<uint8_t
>(std::abs(
y_ - (map_y * 512)) / 16);
86 const std::vector<OverworldItem>& items2) {
87 if (items1.size() != items2.size()) {
92 return a.
x_ == b.x_ && a.
y_ == b.y_ && a.
id_ == b.id_;
95 return std::all_of(items1.begin(), items1.end(),
97 return std::any_of(items2.begin(), items2.end(),
98 [&](const OverworldItem& other) {
99 return is_same_item(it, other);
105 std::vector<OverworldItem> item_array2) {
106 if (item_array1.size() != item_array2.size()) {
111 for (
size_t i = 0; i < item_array1.size(); i++) {
113 for (
size_t j = 0; j < item_array2.size(); j++) {
115 if (item_array1[i].x_ == item_array2[j].x_ &&
116 item_array1[i].y_ == item_array2[j].y_ &&
117 item_array1[i].id_ == item_array2[j].id_) {
131absl::StatusOr<std::vector<OverworldItem>> LoadItems(
132 Rom* rom, std::vector<OverworldMap>& overworld_maps);
133absl::Status SaveItems(
Rom* rom,
const std::vector<OverworldItem>& items);
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Base class for all overworld and dungeon entities.
enum yaze::zelda3::GameEntity::EntityType entity_type_
OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2)
void UpdateMapProperties(uint16_t room_map_id, const void *context=nullptr) override
Update entity properties based on map position.
constexpr int kOverworldItemsBank
constexpr int overworldItemsPointersNew
bool CompareOverworldItems(const std::vector< OverworldItem > &items1, const std::vector< OverworldItem > &items2)
constexpr int overworldItemsAddressBank
constexpr int kNumOverworldMapItemPointers
constexpr int kOverworldItemsAddress
bool CompareItemsArrays(std::vector< OverworldItem > item_array1, std::vector< OverworldItem > item_array2)
constexpr int kOverworldItemsEndData
const std::vector< std::string > kSecretItemNames
constexpr int kOverworldItemsStartDataNew
constexpr int overworldItemsAddress
constexpr int overworldItemsEndData
constexpr int overworldItemsPointers
constexpr int kOverworldItemsPointers
constexpr int overworldItemsStartDataNew
constexpr int kOverworldBombDoorItemLocationsNew
constexpr int overworldBombDoorItemLocationsNew
constexpr int kOverworldItemsPointersNew