Files
yaze/src/app/zelda3/overworld_map.h
2022-08-07 12:40:46 -04:00

73 lines
1.8 KiB
C++

#ifndef YAZE_APP_ZELDA3_OVERWORLD_MAP_H
#define YAZE_APP_ZELDA3_OVERWORLD_MAP_H
#include <imgui/imgui.h>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <vector>
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"
namespace yaze {
namespace app {
namespace zelda3 {
static constexpr int kTileOffsets[] = {0, 8, 4096, 4104};
class OverworldMap {
public:
OverworldMap(int index, ROM& rom, const std::vector<gfx::Tile16>& tiles16);
absl::Status BuildMap(int count, int game_state, uchar* map_parent);
auto GetBitmap() { return bitmap_; }
auto GetCurrentGraphicsSet() { return current_graphics_sheet_set; }
auto SetLargeMap(bool is_set) { large_map_ = is_set; }
auto IsLargeMap() { return large_map_; }
private:
void LoadAreaInfo();
absl::Status BuildTileset(int game_state);
absl::Status BuildTiles16Gfx(int count);
// TODO: Find the SDL_Surface way to do this.
void CopyTile(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* ow_blockset);
int parent_ = 0;
int index_ = 0;
int world_ = 0;
int message_id_ = 0;
int area_graphics_ = 0;
int area_palette_ = 0;
uchar sprite_graphics_[3];
uchar sprite_palette_[3];
uchar area_music_[4];
uchar static_graphics_[16];
bool initialized_ = false;
bool large_map_ = false;
ROM rom_;
OWMapTiles map_tiles_;
gfx::Bitmap bitmap_;
std::vector<gfx::Tile16> tiles16_;
absl::flat_hash_map<int, gfx::Bitmap> current_graphics_sheet_set;
};
} // namespace zelda3
} // namespace app
} // namespace yaze
#endif