overworld housekeeping

This commit is contained in:
Justin Scofield
2022-07-11 21:37:20 -04:00
parent bd44cc2c96
commit 56c81ae97e
7 changed files with 21 additions and 22 deletions

View File

@@ -10,11 +10,8 @@ namespace zelda3 {
using namespace core;
using namespace gfx;
void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
void Overworld::Load(ROM& rom) {
rom_ = rom;
allGfx16Ptr = allGfxPtr;
overworldMapPointer = std::make_shared<uchar[]>(0x40000);
mapblockset16 = std::make_shared<uchar[]>(1048576);
@@ -35,8 +32,7 @@ void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
for (int i = 0; i < 160; i++) {
overworld_maps_[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
allmapsTilesDW, allmapsTilesSP,
currentOWgfx16Ptr.get(), allGfx16Ptr,
mapblockset16.get());
currentOWgfx16Ptr.get(), mapblockset16.get());
}
isLoaded = true;

View File

@@ -19,14 +19,11 @@ namespace zelda3 {
class Overworld {
public:
void Load(ROM& rom, uchar* allGfxPtr);
void Load(ROM& rom);
auto GetTiles16() const { return tiles16; }
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
auto GetMapBlockset16Ptr() { return mapblockset16; }
std::shared_ptr<uchar[]> overworldMapPointer;
gfx::Bitmap overworldMapBitmap;
private:
ushort GenerateTile32(int i, int k, int dimension);
void AssembleMap32Tiles();
@@ -44,7 +41,6 @@ class Overworld {
std::vector<std::vector<ushort>> allmapsTilesDW; // 64 maps * (32*32 tiles)
std::vector<std::vector<ushort>> allmapsTilesSP; // 32 maps * (32*32 tiles)
uchar* allGfx16Ptr = nullptr;
std::shared_ptr<uchar[]> mapblockset16;
std::shared_ptr<uchar[]> currentOWgfx16Ptr;
@@ -53,6 +49,9 @@ class Overworld {
std::vector<gfx::Tile32> map16tiles;
std::vector<OverworldMap> overworld_maps_;
gfx::Bitmap overworldMapBitmap;
std::shared_ptr<uchar[]> overworldMapPointer;
const int map32address[4] = {
core::constants::map32TilesTL, core::constants::map32TilesTR,
core::constants::map32TilesBL, core::constants::map32TilesBR};

View File

@@ -117,10 +117,8 @@ void OverworldMap::BuildMap(uchar* mapparent_, int count, int gameState,
std::vector<std::vector<ushort>>& allmapsTilesLW,
std::vector<std::vector<ushort>>& allmapsTilesDW,
std::vector<std::vector<ushort>>& allmapsTilesSP,
uchar* currentOWgfx16Ptr, uchar* allGfxPtr,
uchar* mapblockset16) {
uchar* currentOWgfx16Ptr, uchar* mapblockset16) {
currentOWgfx16Ptr_ = currentOWgfx16Ptr;
allGfx16Ptr_ = allGfxPtr;
mapblockset16_ = mapblockset16;
if (large_map_) {
@@ -190,6 +188,7 @@ void OverworldMap::CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
void OverworldMap::CopyTile8bpp16From8(int xP, int yP, int tileID,
uchar* destbmpPtr, uchar* sourcebmpPtr) {
auto gfx16Data = destbmpPtr;
// TODO: PSUEDO VRAM
auto gfx8Data = currentOWgfx16Ptr_;
int offsets[] = {0, 8, 4096, 4104};
@@ -343,7 +342,9 @@ void OverworldMap::BuildTileset(int gameState) {
staticgfx[7] = 91;
}
// TODO: PSUEDO VRAM DATA HERE
uchar* currentmapgfx8Data = currentOWgfx16Ptr_;
// TODO: PUT GRAPHICS DATA HERE
uchar const* allgfxData = allGfx16Ptr_;
for (int i = 0; i < 16; i++) {

View File

@@ -43,8 +43,7 @@ class OverworldMap {
std::vector<std::vector<ushort>>& allmapsTilesLW,
std::vector<std::vector<ushort>>& allmapsTilesDW,
std::vector<std::vector<ushort>>& allmapsTilesSP,
uchar* currentOWgfx16Ptr, uchar* allGfxPtr,
uchar* mapblockset16);
uchar* currentOWgfx16Ptr, uchar* mapblockset16);
void CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
uchar* sourcebmpPtr);
void CopyTile8bpp16From8(int xP, int yP, int tileID, uchar* destbmpPtr,