Refactor overworld constants

This commit is contained in:
scawful
2024-12-31 17:50:19 -05:00
parent 1a5d5befb9
commit 5e1e2901ff
4 changed files with 28 additions and 31 deletions

View File

@@ -291,9 +291,9 @@ absl::Status Overworld::LoadOverworldMaps() {
}
void Overworld::LoadTileTypes() {
for (int i = 0; i < 0x200; i++) {
for (int i = 0; i < kNumTileTypes; ++i) {
all_tiles_types_[i] =
rom()->data()[rom()->version_constants().overworldTilesType + i];
rom()->data()[rom()->version_constants().kOverworldTilesType + i];
}
}

View File

@@ -93,6 +93,7 @@ constexpr int kOverworldEntranceExpandedFlagPos = 0x0DB895; // 0xB8
constexpr int kOverworldCompressedMapPos = 0x058000;
constexpr int kOverworldCompressedOverflowPos = 0x137FFF;
constexpr int kNumTileTypes = 0x200;
constexpr int kMap16Tiles = 0x78000;
constexpr int kNumOverworldMaps = 160;
constexpr int kNumTile16Individual = 4096;
@@ -242,8 +243,8 @@ class Overworld : public SharedRom, public core::ExperimentFlags {
OverworldMapTiles map_tiles_;
std::array<uint8_t, 160> map_parent_;
std::array<uint8_t, 0x200> all_tiles_types_;
std::array<uint8_t, kNumOverworldMaps> map_parent_;
std::array<uint8_t, kNumTileTypes> all_tiles_types_;
std::vector<gfx::Tile16> tiles16_;
std::vector<gfx::Tile32> tiles32_;
std::vector<uint16_t> tiles32_list_;

View File

@@ -377,12 +377,12 @@ void OverworldMap::LoadMainBlocksets() {
// of the 5A sheet, so this will need some special manipulation to make work
// during the BuildBitmap step (or a new one specifically for animating).
void OverworldMap::DrawAnimatedTiles() {
std::cout << "static_graphics_[6] = "
<< core::HexByte(static_graphics_[6]) << std::endl;
std::cout << "static_graphics_[7] = "
<< core::HexByte(static_graphics_[7]) << std::endl;
std::cout << "static_graphics_[8] = "
<< core::HexByte(static_graphics_[8]) << std::endl;
std::cout << "static_graphics_[6] = " << core::HexByte(static_graphics_[6])
<< std::endl;
std::cout << "static_graphics_[7] = " << core::HexByte(static_graphics_[7])
<< std::endl;
std::cout << "static_graphics_[8] = " << core::HexByte(static_graphics_[8])
<< std::endl;
if (static_graphics_[7] == 0x5B) {
static_graphics_[7] = 0x5A;
} else {
@@ -436,7 +436,7 @@ absl::Status SetColorsPalette(Rom& rom, int index, gfx::SnesPalette& current,
// contains 7 colors width wide) There is 16 color per line so 16*Y
// Left side of the palette - Main, Animated
std::vector<gfx::SnesColor> new_palette(256);
std::array<gfx::SnesColor, 256> new_palette = {};
// Main Palette, Location 0,2 : 35 colors [7x5]
int k = 0;
@@ -487,8 +487,7 @@ absl::Status SetColorsPalette(Rom& rom, int index, gfx::SnesPalette& current,
k = 0;
for (int y = 8; y < 9; y++) {
for (int x = 1; x < 8; x++) {
auto pal_group = rom.palette_group().sprites_aux1;
new_palette[x + (16 * y)] = pal_group[1][k];
new_palette[x + (16 * y)] = rom.palette_group().sprites_aux1[1][k];
k++;
}
}
@@ -497,8 +496,7 @@ absl::Status SetColorsPalette(Rom& rom, int index, gfx::SnesPalette& current,
k = 0;
for (int y = 8; y < 9; y++) {
for (int x = 9; x < 16; x++) {
auto pal_group = rom.palette_group().sprites_aux3;
new_palette[x + (16 * y)] = pal_group[0][k];
new_palette[x + (16 * y)] = rom.palette_group().sprites_aux3[0][k];
k++;
}
}
@@ -507,8 +505,7 @@ absl::Status SetColorsPalette(Rom& rom, int index, gfx::SnesPalette& current,
k = 0;
for (int y = 9; y < 13; y++) {
for (int x = 1; x < 16; x++) {
auto pal_group = rom.palette_group().global_sprites;
new_palette[x + (16 * y)] = pal_group[0][k];
new_palette[x + (16 * y)] = rom.palette_group().global_sprites[0][k];
k++;
}
}
@@ -535,8 +532,7 @@ absl::Status SetColorsPalette(Rom& rom, int index, gfx::SnesPalette& current,
k = 0;
for (int y = 15; y < 16; y++) {
for (int x = 1; x < 16; x++) {
auto pal_group = rom.palette_group().armors;
new_palette[x + (16 * y)] = pal_group[0][k];
new_palette[x + (16 * y)] = rom.palette_group().armors[0][k];
k++;
}
}