expand tile library, consolidate rom features, work on overworld tile16 selection

This commit is contained in:
Justin Scofield
2022-06-20 17:54:14 -04:00
parent f7d793ecc2
commit f11e8f2aac
17 changed files with 222 additions and 239 deletions

View File

@@ -22,7 +22,6 @@ Overworld::~Overworld() {
free(allmapsTilesSP);
delete[] overworldMapPointer;
delete[] owactualMapPointer;
}
}
@@ -55,17 +54,17 @@ void Overworld::Load(app::rom::ROM& rom) {
DecompressAllMapTiles();
// Map Initialization :
for (int i = 0; i < 160; i++) {
allmaps.push_back(OverworldMap(rom_, tiles16, (uchar)i));
}
FetchLargeMaps();
LoadOverworldMap();
// for (int i = 0; i < 160; i++) {
// allmaps.push_back(OverworldMap(rom_, tiles16, (uchar)i));
// }
// FetchLargeMaps();
// LoadOverworldMap();
auto size = tiles16.size();
for (int i = 0; i < 160; i++) {
allmaps[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
allmapsTilesDW, allmapsTilesSP);
}
// auto size = tiles16.size();
// for (int i = 0; i < 160; i++) {
// allmaps[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
// allmapsTilesDW, allmapsTilesSP);
// }
isLoaded = true;
}
@@ -298,10 +297,8 @@ void Overworld::FetchLargeMaps() {
}
void Overworld::LoadOverworldMap() {
overworldMapBitmap = new Bitmap(128, 128, overworldMapPointer);
owactualMapBitmap = new Bitmap(512, 512, owactualMapPointer);
overworldMapBitmap = new Bitmap(128, 128, 8, overworldMapPointer);
// Mode 7
char* ptr = overworldMapPointer;
int pos = 0;
@@ -317,30 +314,7 @@ void Overworld::LoadOverworldMap() {
}
}
// ColorPalette cp = overworldMapBitmap.Palette;
// for (int i = 0; i < 256; i += 2)
// {
// //55B27 = US LW
// //55C27 = US DW
// cp.Entries[i / 2] = getColor((short)((ROM.DATA[0x55B27 + i + 1] << 8) +
// ROM.DATA[0x55B27 + i]));
// int k = 0;
// int j = 0;
// for (int y = 10; y < 14; y++)
// {
// for (int x = 0; x < 15; x++)
// {
// cp.Entries[145 + k] = Palettes.globalSprite_Palettes[0][j];
// k++;
// j++;
// }
// k++;
// }
// }
// overworldMapBitmap.Palette = cp;
// owactualMapBitmap.Palette = cp;
overworld_map_texture = overworldMapBitmap->CreateTexture(rom_.Renderer());
}
} // namespace zelda3

View File

@@ -1,6 +1,7 @@
#ifndef YAZE_APP_DATA_OVERWORLD_H
#define YAZE_APP_DATA_OVERWORLD_H
#include <SDL2/SDL.h>
#include <rommapping.h>
#include <memory>
@@ -26,9 +27,6 @@ class Overworld {
char* overworldMapPointer = new char[0x40000];
gfx::Bitmap* overworldMapBitmap;
char* owactualMapPointer = new char[0x40000];
gfx::Bitmap* owactualMapBitmap;
private:
app::rom::ROM rom_;
int gameState = 1;
@@ -48,6 +46,13 @@ class Overworld {
std::vector<ushort> tileLeftEntrance;
std::vector<ushort> tileRightEntrance;
std::shared_ptr<uchar> mapblockset16;
std::shared_ptr<uchar> currentOWgfx16Ptr;
gfx::Bitmap mapblockset16Bitmap;
SDL_Texture* overworld_map_texture;
int map32address[4] = {
core::constants::map32TilesTL, core::constants::map32TilesTR,
core::constants::map32TilesBL, core::constants::map32TilesBR};