housekeeping

This commit is contained in:
scawful
2024-05-24 20:37:29 -04:00
parent cb309743ea
commit f28e26ef28
3 changed files with 7 additions and 15 deletions

View File

@@ -306,8 +306,9 @@ class BitmapManager {
if (it != bitmap_cache_.end()) { if (it != bitmap_cache_.end()) {
return it->second; return it->second;
} }
throw std::runtime_error( std::cout << absl::StrCat("Bitmap with id ", id, " not found.")
absl::StrCat("Bitmap with id ", id, " not found.")); << std::endl;
return bitmap_cache_.begin()->second;
} }
std::shared_ptr<gfx::Bitmap> const &shared_bitmap(int id) { std::shared_ptr<gfx::Bitmap> const &shared_bitmap(int id) {
auto it = bitmap_cache_.find(id); auto it = bitmap_cache_.find(id);

View File

@@ -76,18 +76,12 @@ class RoomObject : public SharedRom {
height_(16), height_(16),
unique_id_(0) {} unique_id_(0) {}
virtual void Draw() {
// ... Draw function implementation here
}
void GetObjectSize() { void GetObjectSize() {
previous_size_ = size_; previous_size_ = size_;
size_ = 1; size_ = 1;
// Draw();
GetBaseSize(); GetBaseSize();
UpdateSize(); UpdateSize();
size_ = 2; size_ = 2;
// Draw();
GetSizeSized(); GetSizeSized();
UpdateSize(); UpdateSize();
size_ = previous_size_; size_ = previous_size_;
@@ -172,7 +166,6 @@ class Subtype1 : public RoomObject {
int tileCount) int tileCount)
: RoomObject(id, x, y, size, layer), tile_count_(tileCount) { : RoomObject(id, x, y, size, layer), tile_count_(tileCount) {
auto rom_data = rom()->data(); auto rom_data = rom()->data();
name = Type1RoomObjectNames[id & 0xFF];
int pos = int pos =
core::tile_address + core::tile_address +
static_cast<int16_t>( static_cast<int16_t>(
@@ -182,7 +175,7 @@ class Subtype1 : public RoomObject {
sort = (Sorting)(Sorting::Horizontal | Sorting::Wall); sort = (Sorting)(Sorting::Horizontal | Sorting::Wall);
} }
void Draw() override { void Draw() {
for (int s = 0; s < size_ + (tile_count_ == 8 ? 1 : 0); s++) { for (int s = 0; s < size_ + (tile_count_ == 8 ? 1 : 0); s++) {
for (int i = 0; i < tile_count_; i++) { for (int i = 0; i < tile_count_; i++) {
// DrawTile(tiles[i], ((s * 2)) * 8, (i / 2) * 8); // DrawTile(tiles[i], ((s * 2)) * 8, (i / 2) * 8);
@@ -201,7 +194,6 @@ class Subtype2 : public RoomObject {
Subtype2(int16_t id, uint8_t x, uint8_t y, uint8_t size, uint8_t layer) Subtype2(int16_t id, uint8_t x, uint8_t y, uint8_t size, uint8_t layer)
: RoomObject(id, x, y, size, layer) { : RoomObject(id, x, y, size, layer) {
auto rom_data = rom()->data(); auto rom_data = rom()->data();
name = Type2RoomObjectNames[id & 0x7F];
int pos = int pos =
core::tile_address + core::tile_address +
static_cast<int16_t>( static_cast<int16_t>(
@@ -211,7 +203,7 @@ class Subtype2 : public RoomObject {
sort = (Sorting)(Sorting::Horizontal | Sorting::Wall); sort = (Sorting)(Sorting::Horizontal | Sorting::Wall);
} }
void Draw() override { void Draw() {
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
// DrawTile(tiles[i], x_ * 8, (y_ + i) * 8); // DrawTile(tiles[i], x_ * 8, (y_ + i) * 8);
} }
@@ -228,7 +220,6 @@ class Subtype3 : public RoomObject {
Subtype3(int16_t id, uint8_t x, uint8_t y, uint8_t size, uint8_t layer) Subtype3(int16_t id, uint8_t x, uint8_t y, uint8_t size, uint8_t layer)
: RoomObject(id, x, y, size, layer) { : RoomObject(id, x, y, size, layer) {
auto rom_data = rom()->data(); auto rom_data = rom()->data();
name = Type3RoomObjectNames[id & 0xFF];
int pos = int pos =
core::tile_address + core::tile_address +
static_cast<int16_t>( static_cast<int16_t>(
@@ -238,7 +229,7 @@ class Subtype3 : public RoomObject {
sort = (Sorting)(Sorting::Horizontal | Sorting::Wall); sort = (Sorting)(Sorting::Horizontal | Sorting::Wall);
} }
void Draw() override { void Draw() {
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
// DrawTile(tiles[i], x_ * 8, (y_ + i) * 8); // DrawTile(tiles[i], x_ * 8, (y_ + i) * 8);
} }

View File

@@ -123,7 +123,7 @@ class OverworldMap : public editor::context::GfxContext {
int large_index_ = 0; // Quadrant ID [0-3] int large_index_ = 0; // Quadrant ID [0-3]
int world_ = 0; // World ID [0-2] int world_ = 0; // World ID [0-2]
int game_state_ = 0; // Game state [0-2] int game_state_ = 0; // Game state [0-2]
int main_gfx_id_ = 0; // Spr Pal Modifier int main_gfx_id_ = 0; // Main Gfx ID
uint16_t message_id_ = 0; uint16_t message_id_ = 0;
uint8_t area_graphics_ = 0; uint8_t area_graphics_ = 0;