Update AssignWorldTiles

This commit is contained in:
Justin Scofield
2022-07-19 14:31:33 +00:00
parent 7b356112f6
commit 3be2f67003
2 changed files with 20 additions and 21 deletions

View File

@@ -9,7 +9,7 @@ namespace zelda3 {
using namespace core;
void Overworld::Load(ROM& rom) {
void Overworld::Load(ROM &rom) {
rom_ = rom;
mapblockset16.Create(128, 8192, 8, 1048576);
@@ -66,7 +66,7 @@ void Overworld::AssembleMap32Tiles() {
void Overworld::AssembleMap16Tiles() {
int tpos = core::constants::map16Tiles;
auto rom_data = rom_.data();
for (int i = 0; i < 4096; i += 1) // 3760
for (int i = 0; i < 4096; i += 1) // 3760
{
gfx::TileInfo t0 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
tpos += 2;
@@ -80,15 +80,13 @@ void Overworld::AssembleMap16Tiles() {
}
}
void Overworld::AssignWorldTiles(std::vector<std::vector>>& world, int x, int y, int sx, int sy, int tpos) {
world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] =
tiles32[tpos].tile0_;
world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] =
tiles32[tpos].tile1_;
world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
tiles32[tpos].tile2_;
void Overworld::AssignWorldTiles(std::vector<std::vector<ushort>> &world, int x,
int y, int sx, int sy, int tpos) {
world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile0_;
world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile1_;
world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] = tiles32[tpos].tile2_;
world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
tiles32[tpos].tile3_;
tiles32[tpos].tile3_;
}
void Overworld::DecompressAllMapTiles() {
@@ -210,7 +208,7 @@ void Overworld::FetchLargeMaps() {
overworld_maps_[136].large_map_ = false;
bool mapChecked[64];
for (auto& each : mapChecked) {
for (auto &each : mapChecked) {
each = false;
}
int xx = 0;
@@ -274,6 +272,6 @@ void Overworld::LoadOverworldMap() {
overworldMapBitmap.CreateTexture(renderer);
}
} // namespace zelda3
} // namespace app
} // namespace yaze
} // namespace zelda3
} // namespace app
} // namespace yaze

View File

@@ -19,17 +19,18 @@ namespace app {
namespace zelda3 {
class Overworld {
public:
void Load(ROM& rom);
public:
void Load(ROM &rom);
auto GetTiles16() const { return tiles16; }
auto GetCurrentGfxSetPtr() { return currentOWgfx16.GetData(); }
auto GetMapBlockset16Ptr() { return mapblockset16.GetData(); }
private:
private:
ushort GenerateTile32(int i, int k, int dimension);
void AssembleMap32Tiles();
void AssembleMap16Tiles();
void AssignWorldTiles(std::vector<std::vector>>& world, int x, int y, int sx, int sy, int tpos);
void AssignWorldTiles(std::vector<std::vector<ushort>> &world, int x,
int y, int sx, int sy, int tpos);
void DecompressAllMapTiles();
void FetchLargeMaps();
void LoadOverworldMap();
@@ -62,8 +63,8 @@ class Overworld {
};
};
} // namespace zelda3
} // namespace app
} // namespace yaze
} // namespace zelda3
} // namespace app
} // namespace yaze
#endif