update Inventory::Create to return a status

This commit is contained in:
scawful
2024-05-28 17:56:44 -04:00
parent 23f0311ec9
commit 3201f0c152
3 changed files with 6 additions and 5 deletions

View File

@@ -10,12 +10,12 @@ namespace app {
namespace zelda3 {
namespace screen {
void Inventory::Create() {
absl::Status Inventory::Create() {
data_.reserve(256 * 256);
for (int i = 0; i < 256 * 256; i++) {
data_.push_back(0xFF);
}
PRINT_IF_ERROR(BuildTileset())
RETURN_IF_ERROR(BuildTileset())
for (int i = 0; i < 0x500; i += 0x08) {
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos)));
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos + 0x02)));
@@ -64,8 +64,9 @@ void Inventory::Create() {
}
bitmap_.Create(256, 256, 8, data_);
bitmap_.ApplyPalette(palette_);
RETURN_IF_ERROR(bitmap_.ApplyPalette(palette_));
rom()->RenderBitmap(&bitmap_);
return absl::OkStatus();
}
absl::Status Inventory::BuildTileset() {

View File

@@ -21,7 +21,7 @@ class Inventory : public SharedRom {
auto Tilesheet() const { return tilesheets_bmp_; }
auto Palette() const { return palette_; }
void Create();
absl::Status Create();
private:
absl::Status BuildTileset();