Refactor overworld entity constants for improved naming consistency and readability

This commit is contained in:
scawful
2024-12-31 17:40:15 -05:00
parent 41c31e3193
commit aece708513
3 changed files with 96 additions and 95 deletions

View File

@@ -12,63 +12,21 @@
namespace yaze {
namespace zelda3 {
// List of secret item names
const std::vector<std::string> kSecretItemNames = {
"Nothing", // 0
"Green Rupee", // 1
"Rock hoarder", // 2
"Bee", // 3
"Health pack", // 4
"Bomb", // 5
"Heart ", // 6
"Blue Rupee", // 7
"Key", // 8
"Arrow", // 9
"Bomb", // 10
"Heart", // 11
"Magic", // 12
"Full Magic", // 13
"Cucco", // 14
"Green Soldier", // 15
"Bush Stal", // 16
"Blue Soldier", // 17
"Landmine", // 18
"Heart", // 19
"Fairy", // 20
"Heart", // 21
"Nothing ", // 22
"Hole", // 23
"Warp", // 24
"Staircase", // 25
"Bombable", // 26
"Switch" // 27
};
constexpr int overworldItemsPointers = 0xDC2F9;
constexpr int kOverworldItemsAddress = 0xDC8B9; // 1BC2F9
constexpr int overworldItemsBank = 0xDC8BF;
constexpr int overworldItemsEndData = 0xDC89C; // 0DC89E
constexpr int kOverworldItemsPointers = 0xDC2F9;
constexpr int kOverworldItemsAddress = 0xDC8B9; // 1BC2F9
constexpr int kOverworldItemsBank = 0xDC8BF;
constexpr int kOverworldItemsEndData = 0xDC89C; // 0DC89E
class OverworldItem : public GameEntity {
public:
bool bg2_ = false;
uint8_t id_;
uint8_t game_x_;
uint8_t game_y_;
uint16_t room_map_id_;
int unique_id = 0;
bool deleted = false;
public:
OverworldItem() = default;
OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2) {
this->id_ = id;
this->x_ = x;
this->y_ = y;
this->bg2_ = bg2;
this->room_map_id_ = room_map_id;
this->map_id_ = room_map_id;
this->entity_id_ = id;
this->entity_type_ = kItem;
OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2)
: bg2_(bg2), id_(id), room_map_id_(room_map_id) {
x_ = x;
y_ = y;
map_id_ = room_map_id;
entity_id_ = id;
entity_type_ = kItem;
int map_x = room_map_id - ((room_map_id / 8) * 8);
int map_y = room_map_id / 8;
@@ -96,9 +54,48 @@ public:
<< " X: " << static_cast<int>(game_x_)
<< " Y: " << static_cast<int>(game_y_) << std::endl;
}
bool bg2_ = false;
uint8_t id_;
uint8_t game_x_;
uint8_t game_y_;
uint16_t room_map_id_;
int unique_id = 0;
bool deleted = false;
};
} // namespace zelda3
} // namespace yaze
const std::vector<std::string> kSecretItemNames = {
"Nothing", // 0
"Green Rupee", // 1
"Rock hoarder", // 2
"Bee", // 3
"Health pack", // 4
"Bomb", // 5
"Heart ", // 6
"Blue Rupee", // 7
"Key", // 8
"Arrow", // 9
"Bomb", // 10
"Heart", // 11
"Magic", // 12
"Full Magic", // 13
"Cucco", // 14
"Green Soldier", // 15
"Bush Stal", // 16
"Blue Soldier", // 17
"Landmine", // 18
"Heart", // 19
"Fairy", // 20
"Heart", // 21
"Nothing ", // 22
"Hole", // 23
"Warp", // 24
"Staircase", // 25
"Bombable", // 26
"Switch" // 27
};
#endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
} // namespace zelda3
} // namespace yaze
#endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_