yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_item.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
2#define YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
3
4#include <cstdint>
5#include <iomanip>
6#include <iostream>
7#include <string>
8#include <vector>
9
10#include "app/zelda3/common.h"
11
12namespace yaze {
13namespace zelda3 {
14
15constexpr int kNumOverworldMapItemPointers = 0x80;
16constexpr int kOverworldItemsPointers = 0xDC2F9;
17constexpr int kOverworldItemsAddress = 0xDC8B9; // 1BC2F9
18constexpr int kOverworldItemsBank = 0xDC8BF;
19constexpr int kOverworldItemsEndData = 0xDC89C; // 0DC89E
20
21class OverworldItem : public GameEntity {
22 public:
23 OverworldItem() = default;
24 OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2)
25 : bg2_(bg2), id_(id), room_map_id_(room_map_id) {
26 x_ = x;
27 y_ = y;
28 map_id_ = room_map_id;
29 entity_id_ = id;
31
32 int map_x = room_map_id - ((room_map_id / 8) * 8);
33 int map_y = room_map_id / 8;
34
35 game_x_ = static_cast<uint8_t>(std::abs(x - (map_x * 512)) / 16);
36 game_y_ = static_cast<uint8_t>(std::abs(y - (map_y * 512)) / 16);
37 }
38
39 void UpdateMapProperties(uint16_t room_map_id) override {
40 room_map_id_ = room_map_id;
41
42 if (room_map_id_ >= 64) {
43 room_map_id_ -= 64;
44 }
45
46 int map_x = room_map_id_ - ((room_map_id_ / 8) * 8);
47 int map_y = room_map_id_ / 8;
48
49 game_x_ = static_cast<uint8_t>(std::abs(x_ - (map_x * 512)) / 16);
50 game_y_ = static_cast<uint8_t>(std::abs(y_ - (map_y * 512)) / 16);
51
52 std::cout << "Item: " << std::hex << std::setw(2) << std::setfill('0')
53 << static_cast<int>(id_) << " MapId: " << std::hex << std::setw(2)
54 << std::setfill('0') << static_cast<int>(room_map_id_)
55 << " X: " << static_cast<int>(game_x_)
56 << " Y: " << static_cast<int>(game_y_) << std::endl;
57 }
58
59 bool bg2_ = false;
60 uint8_t id_;
61 uint8_t game_x_;
62 uint8_t game_y_;
63 uint16_t room_map_id_;
64 int unique_id = 0;
65 bool deleted = false;
66};
67
68const std::vector<std::string> kSecretItemNames = {
69 "Nothing", // 0
70 "Green Rupee", // 1
71 "Rock hoarder", // 2
72 "Bee", // 3
73 "Health pack", // 4
74 "Bomb", // 5
75 "Heart ", // 6
76 "Blue Rupee", // 7
77 "Key", // 8
78 "Arrow", // 9
79 "Bomb", // 10
80 "Heart", // 11
81 "Magic", // 12
82 "Full Magic", // 13
83 "Cucco", // 14
84 "Green Soldier", // 15
85 "Bush Stal", // 16
86 "Blue Soldier", // 17
87 "Landmine", // 18
88 "Heart", // 19
89 "Fairy", // 20
90 "Heart", // 21
91 "Nothing ", // 22
92 "Hole", // 23
93 "Warp", // 24
94 "Staircase", // 25
95 "Bombable", // 26
96 "Switch" // 27
97};
98
99} // namespace zelda3
100} // namespace yaze
101
102#endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_
enum yaze::zelda3::GameEntity::EntityType entity_type_
void UpdateMapProperties(uint16_t room_map_id) override
OverworldItem(uint8_t id, uint16_t room_map_id, int x, int y, bool bg2)
Zelda 3 specific classes and functions.
constexpr int kOverworldItemsBank
constexpr int kNumOverworldMapItemPointers
constexpr int kOverworldItemsAddress
constexpr int kOverworldItemsEndData
const std::vector< std::string > kSecretItemNames
constexpr int kOverworldItemsPointers
Main namespace for the application.
Definition controller.cc:18