Add CopyTile8bpp16 function and refactor usage in OverworldMap

This commit is contained in:
scawful
2024-11-10 17:16:46 -05:00
parent 42db41ebae
commit 0035176f86
4 changed files with 23 additions and 23 deletions

View File

@@ -386,6 +386,19 @@ TileInfo GetTilesInfo(uint16_t tile) {
return TileInfo(tid, p, v, h, o);
}
void CopyTile8bpp16(int x, int y, int tile, std::vector<uint8_t>& bitmap,
std::vector<uint8_t>& blockset) {
int src_pos =
((tile - ((tile / 0x08) * 0x08)) * 0x10) + ((tile / 0x08) * 2048);
int dest_pos = (x + (y * 0x200));
for (int yy = 0; yy < 0x10; yy++) {
for (int xx = 0; xx < 0x10; xx++) {
bitmap[dest_pos + xx + (yy * 0x200)] =
blockset[src_pos + xx + (yy * 0x80)];
}
}
}
} // namespace gfx
} // namespace app
} // namespace yaze

View File

@@ -18,8 +18,8 @@ constexpr int kTilesheetDepth = 8;
constexpr uint8_t kGraphicsBitmap[8] = {0x80, 0x40, 0x20, 0x10,
0x08, 0x04, 0x02, 0x01};
std::vector<uint8_t> SnesTo8bppSheet(const std::vector<uint8_t>& sheet,
int bpp, int num_sheets = 1);
std::vector<uint8_t> SnesTo8bppSheet(const std::vector<uint8_t>& sheet, int bpp,
int num_sheets = 1);
std::vector<uint8_t> Bpp8SnesToIndexed(std::vector<uint8_t> data,
uint64_t bpp = 0);
@@ -41,6 +41,9 @@ std::vector<uint8_t> ConvertBpp(const std::vector<uint8_t>& tiles,
std::vector<uint8_t> Convert3bppTo4bpp(const std::vector<uint8_t>& tiles);
std::vector<uint8_t> Convert4bppTo3bpp(const std::vector<uint8_t>& tiles);
void CopyTile8bpp16(int x, int y, int tile, std::vector<uint8_t>& bitmap,
std::vector<uint8_t>& blockset);
/**
* @brief SNES 16-bit tile metadata container
*