big cleanup

This commit is contained in:
scawful
2024-08-20 22:10:35 -04:00
parent dc244ac02d
commit 7b33313281
31 changed files with 291 additions and 215 deletions

View File

@@ -3,7 +3,6 @@
#include <cstdint>
#include <vector>
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h"
@@ -72,9 +71,8 @@ void Room::LoadHeader() {
// Existing room size address calculation...
auto room_size_address = 0xF8000 + (room_id_ * 3);
if (flags()->kLogToConsole)
std::cout << "Room #" << room_id_ << " Address: " << std::hex
<< room_size_address << std::endl;
std::cout << "Room #" << room_id_ << " Address: " << std::hex
<< room_size_address << std::endl;
// Reading bytes for long address construction
uint8_t low = rom()->data()[room_size_address];
@@ -83,15 +81,13 @@ void Room::LoadHeader() {
// Constructing the long address
int long_address = (bank << 16) | (high << 8) | low;
if (flags()->kLogToConsole)
std::cout << std::hex << std::setfill('0') << std::setw(6) << long_address
<< std::endl;
std::cout << std::hex << std::setfill('0') << std::setw(6) << long_address
<< std::endl;
room_size_pointer_ = long_address;
if (long_address == 0x0A8000) {
// Blank room disregard in size calculation
if (flags()->kLogToConsole)
std::cout << "Size of Room #" << room_id_ << ": 0 bytes" << std::endl;
std::cout << "Size of Room #" << room_id_ << ": 0 bytes" << std::endl;
room_size_ = 0;
} else {
// use the long address to calculate the size of the room
@@ -100,9 +96,8 @@ void Room::LoadHeader() {
int next_room_address = 0xF8000 + ((room_id_ + 1) * 3);
if (flags()->kLogToConsole)
std::cout << "Next Room Address: " << std::hex << next_room_address
<< std::endl;
std::cout << "Next Room Address: " << std::hex << next_room_address
<< std::endl;
// Reading bytes for long address construction
uint8_t next_low = rom()->data()[next_room_address];
@@ -112,19 +107,17 @@ void Room::LoadHeader() {
// Constructing the long address
int next_long_address = (next_bank << 16) | (next_high << 8) | next_low;
if (flags()->kLogToConsole)
std::cout << std::hex << std::setfill('0') << std::setw(6)
<< next_long_address << std::endl;
std::cout << std::hex << std::setfill('0') << std::setw(6)
<< next_long_address << std::endl;
// Calculate the size of the room
int room_size = next_long_address - long_address;
room_size_ = room_size;
if (flags()->kLogToConsole)
std::cout << "Size of Room #" << room_id_ << ": " << std::dec
<< room_size << " bytes" << std::endl;
std::cout << "Size of Room #" << room_id_ << ": " << std::dec << room_size
<< " bytes" << std::endl;
}
} catch (const std::exception& e) {
if (flags()->kLogToConsole) std::cout << "Error: " << e.what() << std::endl;
std::cout << "Error: " << e.what() << std::endl;
}
}

View File

@@ -4,7 +4,6 @@
#include <cstdint>
#include <vector>
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h"
@@ -118,7 +117,7 @@ struct ChestData {
struct StaircaseRooms {};
class Room : public SharedRom, public core::ExperimentFlags {
class Room : public SharedRom {
public:
Room() = default;
Room(int room_id) : room_id_(room_id) {}

View File

@@ -7,7 +7,7 @@
#include <vector>
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"

View File

@@ -11,7 +11,7 @@
#include "absl/container/flat_hash_map.h"
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/compression.h"

View File

@@ -6,7 +6,7 @@
#include <unordered_map>
#include <vector>
#include "app/core/common.h"
#include "app/editor/utils/gfx_context.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"

View File

@@ -8,7 +8,7 @@
#include <vector>
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/editor/utils/gfx_context.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_palette.h"

View File

@@ -2,7 +2,7 @@
#include <cstdint>
#include "app/core/common.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"

View File

@@ -3,7 +3,7 @@
#include <cstdint>
#include "app/core/common.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"