housekeeping, accessors, gui, etc

This commit is contained in:
scawful
2023-11-20 21:12:02 -05:00
parent 4ef2540d15
commit bbe76ac83c
12 changed files with 99 additions and 83 deletions

View File

@@ -165,7 +165,7 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) {
blocks[12 + i] = (uchar)(spriteGfx[SpriteTileset + 64][i] + 115);
} // 12-16 sprites
auto gfx_buffer_data = rom()->GetGraphicsBuffer();
auto gfx_buffer_data = rom()->graphics_buffer();
// Into "room gfx16" 16 of them
int sheetPos = 0;
@@ -173,7 +173,6 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) {
int d = 0;
int ioff = blocks[i] * 2048;
while (d < 2048) {
// NOTE LOAD BLOCKSETS SOMEWHERE FIRST
uchar mapByte = gfx_buffer_data[d + ioff];
if (i < 4) {
mapByte += 0x88;
@@ -191,9 +190,9 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) {
void Room::LoadAnimatedGraphics() {
int gfx_ptr =
core::SnesToPc(rom()->GetVersionConstants().kGfxAnimatedPointer);
core::SnesToPc(rom()->version_constants().kGfxAnimatedPointer);
auto gfx_buffer_data = rom()->GetGraphicsBuffer();
auto gfx_buffer_data = rom()->graphics_buffer();
auto rom_data = rom()->vector();
int data = 0;
while (data < 512) {

View File

@@ -26,7 +26,7 @@ class DungeonObjectRenderer {
};
void CreateVramFromRoomBlockset() {
// auto bitmap_manager = rom()->BitmapManager();
// auto bitmap_manager = rom()->bitmap_manager();
// uint16_t room_id = 0;
// auto room_blockset = rom()->room_blockset_ids[room_id];

View File

@@ -588,7 +588,7 @@ absl::Status Overworld::SaveMap32Tiles() {
for (int i = 0; i < num_32x32_tiles; ++i) {
int base_addr =
rom()->GetVersionConstants().kMap32TileTL + i * kQuadrantsPer32x32Tile;
rom()->version_constants().kMap32TileTL + i * kQuadrantsPer32x32Tile;
auto write_quadrant_to_rom = [&](int quadrant,
auto get_tile) -> absl::Status {
@@ -630,10 +630,10 @@ absl::Status Overworld::SaveMap32Tiles() {
uint16_t Overworld::GenerateTile32(int index, int quadrant, int dimension) {
// The addresses of the four 32x32 pixel tiles in the ROM.
const uint32_t map32address[4] = {rom()->GetVersionConstants().kMap32TileTL,
rom()->GetVersionConstants().kMap32TileTR,
rom()->GetVersionConstants().kMap32TileBL,
rom()->GetVersionConstants().kMap32TileBR};
const uint32_t map32address[4] = {rom()->version_constants().kMap32TileTL,
rom()->version_constants().kMap32TileTR,
rom()->version_constants().kMap32TileBL,
rom()->version_constants().kMap32TileBR};
return (ushort)(rom_[map32address[dimension] + quadrant + (index)] +
(((rom_[map32address[dimension] + (index) +
@@ -727,10 +727,10 @@ absl::Status Overworld::DecompressAllMapTiles() {
for (int i = 0; i < 160; i++) {
auto p1 = GetOwMapGfxHighPtr(
rom()->data(), i,
rom()->GetVersionConstants().kCompressedAllMap32PointersHigh);
rom()->version_constants().kCompressedAllMap32PointersHigh);
auto p2 = GetOwMapGfxLowPtr(
rom()->data(), i,
rom()->GetVersionConstants().kCompressedAllMap32PointersLow);
rom()->version_constants().kCompressedAllMap32PointersLow);
int ttpos = 0;
if (p1 >= highest) {

View File

@@ -209,6 +209,9 @@ class Overworld : public SharedROM, public core::ExperimentFlags {
auto isLoaded() const { return is_loaded_; }
void SetCurrentMap(int i) { current_map_ = i; }
auto MapTiles() const { return map_tiles_; }
auto mutable_map_tiles() { return &map_tiles_; }
absl::Status LoadPrototype(ROM &rom_, const std::string &tilemap_filename);
private:

View File

@@ -286,7 +286,7 @@ void OverworldMap::LoadSpritesBlocksets() {
for (int i = 0; i < 4; i++) {
static_graphics_[12 + i] =
(rom_[rom_.GetVersionConstants().kSpriteBlocksetPointer +
(rom_[rom_.version_constants().kSpriteBlocksetPointer +
(sprite_graphics_[game_state_] * 4) + i] +
static_graphics_base);
}
@@ -294,14 +294,14 @@ void OverworldMap::LoadSpritesBlocksets() {
void OverworldMap::LoadMainBlocksets() {
for (int i = 0; i < 8; i++) {
static_graphics_[i] = rom_[rom_.GetVersionConstants().kOverworldGfxGroups2 +
static_graphics_[i] = rom_[rom_.version_constants().kOverworldGfxGroups2 +
(world_index_ * 8) + i];
}
}
void OverworldMap::LoadAreaGraphicsBlocksets() {
for (int i = 0; i < 4; i++) {
uchar value = rom_[rom_.GetVersionConstants().kOverworldGfxGroups1 +
uchar value = rom_[rom_.version_constants().kOverworldGfxGroups1 +
(area_graphics_ * 4) + i];
if (value != 0) {
static_graphics_[3 + i] = value;
@@ -330,7 +330,7 @@ void OverworldMap::LoadAreaGraphics() {
gfx::SNESPalette OverworldMap::GetPalette(const std::string& group, int index,
int previousIndex, int limit) {
if (index == 255) {
index = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup +
index = rom_[rom_.version_constants().overworldMapPaletteGroup +
(previousIndex * 4)];
}
if (index != 255) {
@@ -351,11 +351,11 @@ void OverworldMap::LoadPalette() {
area_palette_ = std::min(area_palette_, 0xA3);
uchar pal0 = 0;
uchar pal1 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup +
uchar pal1 = rom_[rom_.version_constants().overworldMapPaletteGroup +
(area_palette_ * 4)];
uchar pal2 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup +
uchar pal2 = rom_[rom_.version_constants().overworldMapPaletteGroup +
(area_palette_ * 4) + 1];
uchar pal3 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup +
uchar pal3 = rom_[rom_.version_constants().overworldMapPaletteGroup +
(area_palette_ * 4) + 2];
uchar pal4 =
rom_[overworldSpritePaletteGroup + (sprite_palette_[game_state_] * 2)];
@@ -369,7 +369,7 @@ void OverworldMap::LoadPalette() {
// Additional handling of `pal3` and `parent_`
if (pal3 == 255) {
pal3 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup +
pal3 = rom_[rom_.version_constants().overworldMapPaletteGroup +
(previousPalId * 4) + 2];
}
if (parent_ < 0x40) {
@@ -416,7 +416,7 @@ void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
}
absl::Status OverworldMap::BuildTileset() {
all_gfx_ = rom_.GetGraphicsBuffer();
all_gfx_ = rom_.graphics_buffer();
current_gfx_.resize(0x10000, 0x00);
for (int i = 0; i < 0x10; i++) {