yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
inventory.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_INVENTORY_H
2#define YAZE_APP_ZELDA3_INVENTORY_H
3
4#include "absl/status/status.h"
9#include "rom/rom.h"
10#include "zelda3/game_data.h"
11
12namespace yaze {
13namespace zelda3 {
14
15constexpr int kInventoryStart = 0x6564A;
16// ItemIcons base address in SNES format (0x0DF629)
17constexpr int kItemIconsPtr = 0x0DF629;
18
22struct ItemIcon {
23 uint16_t tile_tl; // Top-left tile word (vhopppcc cccccccc format)
24 uint16_t tile_tr; // Top-right tile word
25 uint16_t tile_bl; // Bottom-left tile word
26 uint16_t tile_br; // Bottom-right tile word
27 std::string name; // Human-readable name for debugging
28};
29
36class Inventory {
37 public:
43 absl::Status Create(Rom* rom, GameData* game_data = nullptr);
44
45 // Clear ROM-derived logical state without moving queued Bitmap owners.
46 void ResetForReload();
47
48 auto& bitmap() { return bitmap_; }
49 auto& tilesheet() { return tilesheets_bmp_; }
50 auto& palette() { return palette_; }
51 auto& item_icons() { return item_icons_; }
52
53 private:
58 absl::Status BuildTileset(Rom* rom);
59
64 absl::Status LoadItemIcons(Rom* rom);
65
66 std::vector<uint8_t> data_;
68
69 std::vector<uint8_t> tilesheets_;
70 std::vector<uint8_t> test_;
73
75 std::vector<gfx::TileInfo> tiles_;
76 std::vector<ItemIcon> item_icons_;
77 GameData* game_data_ = nullptr;
78};
79
80} // namespace zelda3
81} // namespace yaze
82
83#endif // YAZE_APP_ZELDA3_INVENTORY_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:64
Inventory manages the inventory screen graphics and layout.
Definition inventory.h:36
absl::Status BuildTileset(Rom *rom)
Build the tileset from 2BPP graphics.
Definition inventory.cc:55
absl::Status Create(Rom *rom, GameData *game_data=nullptr)
Initialize and load inventory screen data from ROM.
Definition inventory.cc:14
gfx::SnesPalette palette_
Definition inventory.h:72
std::vector< uint8_t > data_
Definition inventory.h:66
std::vector< ItemIcon > item_icons_
Definition inventory.h:76
gfx::Bitmap tilesheets_bmp_
Definition inventory.h:71
std::vector< uint8_t > test_
Definition inventory.h:70
absl::Status LoadItemIcons(Rom *rom)
Load individual item icons from ROM.
Definition inventory.cc:82
std::vector< gfx::TileInfo > tiles_
Definition inventory.h:75
std::vector< uint8_t > tilesheets_
Definition inventory.h:69
constexpr int kItemIconsPtr
Definition inventory.h:17
constexpr int kInventoryStart
Definition inventory.h:15
Represents a single item icon (2x2 tiles = 4 tile words)
Definition inventory.h:22