Refactor OverworldMap class

This commit is contained in:
Justin Scofield
2022-07-19 18:23:35 +00:00
parent 51454ab651
commit 9f2041be70
4 changed files with 204 additions and 199 deletions

View File

@@ -16,20 +16,26 @@ namespace zelda3 {
class OverworldMap {
public:
int parent_ = 0;
int index_ = 0;
int message_id_ = 0;
int gfx_ = 0;
int palette_ = 0;
bool initialized_ = false;
bool large_map_ = false;
uchar sprite_graphics_[3];
uchar sprite_palette_[3];
uchar musics[4];
uchar* gfxPtr = new uchar[512 * 512];
uchar* mapblockset16_ = nullptr;
uchar* currentOWgfx16Ptr_ = nullptr;
uchar* allGfx16Ptr_ = nullptr;
OverworldMap(int index, ROM& rom, const std::vector<gfx::Tile16>& tiles16);
void BuildMap(int count, int game_state, uchar* map_parent,
OWMapTiles& map_tiles);
auto SetLargeMap(bool is_set) { large_map_ = is_set; }
auto IsLargeMap() { return large_map_; }
private:
void LoadAreaInfo();
void BuildTileset(int gameState);
void BuildTiles16Gfx(int count);
void CopyTile(int x, int y, int xx, int yy, int offset, gfx::TileInfo tile,
uchar* gfx16Pointer, uchar* gfx8Pointer);
void CopyTileToMap(int x, int y, int xx, int yy, int offset,
gfx::TileInfo tile, uchar* gfx16Pointer,
uchar* gfx8Pointer);
void CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
uchar* sourcebmpPtr);
void CopyTile8bpp16From8(int xP, int yP, int tileID, uchar* destbmpPtr,
uchar* sourcebmpPtr);
ROM rom_;
gfx::Bitmap gfxBitmap;
@@ -38,22 +44,20 @@ class OverworldMap {
uchar* staticgfx = new uchar[16];
std::vector<std::vector<ushort>> tiles_used_;
OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16, int index);
void BuildMap(int count, int game_state, uchar* map_parent,
OWMapTiles& map_tiles);
void CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
uchar* sourcebmpPtr);
void CopyTile8bpp16From8(int xP, int yP, int tileID, uchar* destbmpPtr,
uchar* sourcebmpPtr);
private:
void BuildTiles16Gfx(int count);
void CopyTile(int x, int y, int xx, int yy, int offset, gfx::TileInfo tile,
uchar* gfx16Pointer, uchar* gfx8Pointer);
void CopyTileToMap(int x, int y, int xx, int yy, int offset,
gfx::TileInfo tile, uchar* gfx16Pointer,
uchar* gfx8Pointer);
void BuildTileset(int gameState);
int parent_ = 0;
int index_ = 0;
int message_id_ = 0;
int area_graphics_ = 0;
int area_palette_ = 0;
bool initialized_ = false;
bool large_map_ = false;
uchar sprite_graphics_[3];
uchar sprite_palette_[3];
uchar area_music_[4];
uchar* gfxPtr = new uchar[512 * 512];
uchar* mapblockset16_ = nullptr;
uchar* currentOWgfx16Ptr_ = nullptr;
uchar* allGfx16Ptr_ = nullptr;
};
} // namespace zelda3