Add FindMetastamp, etc housekeeping

This commit is contained in:
scawful
2023-08-18 17:21:17 -04:00
parent 09df21a439
commit 878b1ee1eb
6 changed files with 55 additions and 13 deletions

View File

@@ -2,8 +2,9 @@
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"
#include "app/gui/canvas.h"
#include "app/rom.h"
namespace yaze {
namespace app {
@@ -16,10 +17,10 @@ void Inventory::Create() {
}
PRINT_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)));
tiles_.push_back(gfx::GetTilesInfo(rom_.toint16(i + kBowItemPos + 0x04)));
tiles_.push_back(gfx::GetTilesInfo(rom_.toint16(i + kBowItemPos + 0x08)));
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos)));
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos + 0x02)));
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos + 0x04)));
tiles_.push_back(gfx::GetTilesInfo(rom()->toint16(i + kBowItemPos + 0x08)));
}
const int offsets[] = {0x00, 0x08, 0x800, 0x808};
auto xx = 0;
@@ -63,13 +64,13 @@ void Inventory::Create() {
}
bitmap_.Create(256, 256, 128, data_);
bitmap_.ApplyPalette(palette_);
rom_.RenderBitmap(&bitmap_);
rom()->RenderBitmap(&bitmap_);
}
absl::Status Inventory::BuildTileset() {
tilesheets_.reserve(6 * 0x2000);
for (int i = 0; i < 6 * 0x2000; i++) tilesheets_.push_back(0xFF);
ASSIGN_OR_RETURN(tilesheets_, rom_.Load2bppGraphics())
ASSIGN_OR_RETURN(tilesheets_, rom()->Load2bppGraphics())
Bytes test;
for (int i = 0; i < 0x4000; i++) {
test_.push_back(tilesheets_[i]);
@@ -78,9 +79,9 @@ absl::Status Inventory::BuildTileset() {
test_.push_back(tilesheets_[i]);
}
tilesheets_bmp_.Create(128, 0x130, 64, test_);
palette_ = rom_.GetPaletteGroup("hud")[0];
palette_ = rom()->GetPaletteGroup("hud")[0];
tilesheets_bmp_.ApplyPalette(palette_);
rom_.RenderBitmap(&tilesheets_bmp_);
rom()->RenderBitmap(&tilesheets_bmp_);
return absl::OkStatus();
}

View File

@@ -14,9 +14,8 @@ namespace zelda3 {
constexpr int kInventoryStart = 0x6564A;
constexpr int kBowItemPos = 0x6F631;
class Inventory {
class Inventory : public SharedROM {
public:
void SetupROM(ROM& rom) { rom_ = rom; }
auto Bitmap() const { return bitmap_; }
auto Tilesheet() const { return tilesheets_bmp_; }
auto Palette() const { return palette_; }
@@ -26,8 +25,6 @@ class Inventory {
private:
absl::Status BuildTileset();
ROM rom_;
Bytes data_;
gfx::Bitmap bitmap_;