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_;

View File

@@ -39,6 +39,13 @@ class Sprite {
auto GetRealX() const { return bounding_box_.x; }
auto GetRealY() const { return bounding_box_.y; }
auto id() const { return id_; }
auto x() const { return x_; }
auto y() const { return y_; }
auto nx() const { return nx_; }
auto ny() const { return ny_; }
auto layer() const { return layer_; }
auto subtype() const { return subtype_; }
auto& keyDrop() const { return key_drop_; }
auto Width() const { return bounding_box_.w; }
auto Height() const { return bounding_box_.h; }
@@ -47,6 +54,7 @@ class Sprite {
private:
Bytes current_gfx_;
bool overworld_;
uchar map_id_;
uchar id_;
uchar x_;
@@ -55,6 +63,10 @@ class Sprite {
uchar ny_;
uchar overlord_ = 0;
std::string name_;
int subtype_;
int layer_;
int map_x_;
int map_y_;
Bytes preview_gfx_;
@@ -67,6 +79,7 @@ class Sprite {
int width_ = 16;
int height_ = 16;
int key_drop_;
};
} // namespace zelda3