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; using namespace core;
void Overworld::Load(ROM& rom) { void Overworld::Load(ROM &rom) {
rom_ = rom; rom_ = rom;
mapblockset16.Create(128, 8192, 8, 1048576); mapblockset16.Create(128, 8192, 8, 1048576);
@@ -80,13 +80,11 @@ void Overworld::AssembleMap16Tiles() {
} }
} }
void Overworld::AssignWorldTiles(std::vector<std::vector>>& world, int x, int y, int sx, int sy, int tpos) { void Overworld::AssignWorldTiles(std::vector<std::vector<ushort>> &world, int x,
world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] = int y, int sx, int sy, int tpos) {
tiles32[tpos].tile0_; world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile0_;
world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] = world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] = tiles32[tpos].tile1_;
tiles32[tpos].tile1_; world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] = tiles32[tpos].tile2_;
world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
tiles32[tpos].tile2_;
world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] = world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
tiles32[tpos].tile3_; tiles32[tpos].tile3_;
} }
@@ -210,7 +208,7 @@ void Overworld::FetchLargeMaps() {
overworld_maps_[136].large_map_ = false; overworld_maps_[136].large_map_ = false;
bool mapChecked[64]; bool mapChecked[64];
for (auto& each : mapChecked) { for (auto &each : mapChecked) {
each = false; each = false;
} }
int xx = 0; int xx = 0;

View File

@@ -19,17 +19,18 @@ namespace app {
namespace zelda3 { namespace zelda3 {
class Overworld { class Overworld {
public: public:
void Load(ROM& rom); void Load(ROM &rom);
auto GetTiles16() const { return tiles16; } auto GetTiles16() const { return tiles16; }
auto GetCurrentGfxSetPtr() { return currentOWgfx16.GetData(); } auto GetCurrentGfxSetPtr() { return currentOWgfx16.GetData(); }
auto GetMapBlockset16Ptr() { return mapblockset16.GetData(); } auto GetMapBlockset16Ptr() { return mapblockset16.GetData(); }
private: private:
ushort GenerateTile32(int i, int k, int dimension); ushort GenerateTile32(int i, int k, int dimension);
void AssembleMap32Tiles(); void AssembleMap32Tiles();
void AssembleMap16Tiles(); 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 DecompressAllMapTiles();
void FetchLargeMaps(); void FetchLargeMaps();
void LoadOverworldMap(); void LoadOverworldMap();