Update Bitmap pointer management
This commit is contained in:
@@ -12,10 +12,8 @@ using namespace gfx;
|
||||
|
||||
void Overworld::Load(ROM& rom) {
|
||||
rom_ = rom;
|
||||
|
||||
overworldMapPointer = std::make_shared<uchar[]>(0x40000);
|
||||
mapblockset16 = std::make_shared<uchar[]>(1048576);
|
||||
currentOWgfx16Ptr = std::make_shared<uchar[]>((128 * 512) / 2);
|
||||
mapblockset16.Create(128, 8192, 8, 1048576);
|
||||
currentOWgfx16.Create(128, 512, 4, (128 * 512) / 2);
|
||||
|
||||
AssembleMap32Tiles();
|
||||
AssembleMap16Tiles();
|
||||
@@ -30,9 +28,9 @@ void Overworld::Load(ROM& rom) {
|
||||
|
||||
auto size = tiles16.size();
|
||||
for (int i = 0; i < 160; i++) {
|
||||
overworld_maps_[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
|
||||
allmapsTilesDW, allmapsTilesSP,
|
||||
currentOWgfx16Ptr.get(), mapblockset16.get());
|
||||
overworld_maps_[i].BuildMap(
|
||||
mapParent, size, gameState, allmapsTilesLW, allmapsTilesDW,
|
||||
allmapsTilesSP, currentOWgfx16.GetData(), mapblockset16.GetData());
|
||||
}
|
||||
|
||||
isLoaded = true;
|
||||
@@ -252,9 +250,8 @@ void Overworld::FetchLargeMaps() {
|
||||
}
|
||||
|
||||
void Overworld::LoadOverworldMap() {
|
||||
overworldMapBitmap.Create(128, 128, 8, overworldMapPointer.get());
|
||||
|
||||
auto ptr = overworldMapPointer;
|
||||
overworldMapBitmap.Create(128, 128, 8, 0x40000);
|
||||
auto ptr = overworldMapBitmap.GetData();
|
||||
|
||||
int pos = 0;
|
||||
for (int sy = 0; sy < 16; sy++) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/psuedo_vram.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld_map.h"
|
||||
@@ -21,8 +22,8 @@ class Overworld {
|
||||
public:
|
||||
void Load(ROM& rom);
|
||||
auto GetTiles16() const { return tiles16; }
|
||||
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
|
||||
auto GetMapBlockset16Ptr() { return mapblockset16; }
|
||||
auto GetCurrentGfxSetPtr() { return currentOWgfx16.GetData(); }
|
||||
auto GetMapBlockset16Ptr() { return mapblockset16.GetData(); }
|
||||
|
||||
private:
|
||||
ushort GenerateTile32(int i, int k, int dimension);
|
||||
@@ -41,17 +42,15 @@ class Overworld {
|
||||
std::vector<std::vector<ushort>> allmapsTilesDW; // 64 maps * (32*32 tiles)
|
||||
std::vector<std::vector<ushort>> allmapsTilesSP; // 32 maps * (32*32 tiles)
|
||||
|
||||
std::shared_ptr<uchar[]> mapblockset16;
|
||||
std::shared_ptr<uchar[]> currentOWgfx16Ptr;
|
||||
gfx::Bitmap mapblockset16;
|
||||
gfx::Bitmap currentOWgfx16;
|
||||
gfx::Bitmap overworldMapBitmap;
|
||||
|
||||
std::vector<gfx::Tile16> tiles16;
|
||||
std::vector<gfx::Tile32> tiles32;
|
||||
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};
|
||||
|
||||
Reference in New Issue
Block a user