Removed constants namespace
This commit is contained in:
@@ -28,7 +28,6 @@ using uchar = unsigned char;
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace core {
|
||||
namespace constants {
|
||||
|
||||
//===========================================================================================
|
||||
// 65816 LanguageDefinition
|
||||
@@ -1232,7 +1231,6 @@ static const std::string TileTypeNames[] = {
|
||||
"$FE Door X top? (unused?)",
|
||||
"$FF Door X top? (unused?)"};
|
||||
|
||||
} // namespace constants
|
||||
} // namespace core
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -34,7 +34,7 @@ void BuildTiles16Gfx(uchar *mapblockset16, uchar *currentOWgfx16Ptr,
|
||||
auto xx = 0;
|
||||
|
||||
// Number of tiles16 3748? // its 3752
|
||||
for (auto i = 0; i < core::constants::NumberOfMap16; i++) {
|
||||
for (auto i = 0; i < core::NumberOfMap16; i++) {
|
||||
// 8x8 tile draw
|
||||
// gfx8 = 4bpp so everyting is /2
|
||||
auto tiles = allTiles[i];
|
||||
|
||||
@@ -64,22 +64,22 @@ void ROM::LoadAllGraphicsData() {
|
||||
auto data = new uchar[2048];
|
||||
int buffer_pos = 0;
|
||||
|
||||
for (int i = 0; i < core::constants::NumberOfSheets; i++) {
|
||||
for (int i = 0; i < core::NumberOfSheets; i++) {
|
||||
// uncompressed sheets
|
||||
if (i >= 115 && i <= 126) {
|
||||
data = new uchar[core::constants::Uncompressed3BPPSize];
|
||||
data = new uchar[core::Uncompressed3BPPSize];
|
||||
int startAddress = GetGraphicsAddress(i);
|
||||
for (int j = 0; j < core::constants::Uncompressed3BPPSize; j++) {
|
||||
for (int j = 0; j < core::Uncompressed3BPPSize; j++) {
|
||||
data[j] = current_rom_[j + startAddress];
|
||||
}
|
||||
} else {
|
||||
auto gfx_addr = GetGraphicsAddress(i);
|
||||
data = Decompress(gfx_addr, core::constants::UncompressedSheetSize);
|
||||
data = Decompress(gfx_addr, core::UncompressedSheetSize);
|
||||
}
|
||||
|
||||
gfx::Bitmap tilesheet_bmp(
|
||||
core::constants::kTilesheetWidth, core::constants::kTilesheetHeight,
|
||||
core::constants::kTilesheetDepth, SNES3bppTo8bppSheet(data));
|
||||
core::kTilesheetWidth, core::kTilesheetHeight,
|
||||
core::kTilesheetDepth, SNES3bppTo8bppSheet(data));
|
||||
tilesheet_bmp.CreateTexture(sdl_renderer_);
|
||||
graphics_bin_[i] = tilesheet_bmp;
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ void Overworld::Load(ROM &rom) {
|
||||
DecompressAllMapTiles();
|
||||
|
||||
// Map Initialization
|
||||
for (int i = 0; i < constants::NumberOfOWMaps; i++) {
|
||||
for (int i = 0; i < core::NumberOfOWMaps; i++) {
|
||||
overworld_maps_.emplace_back(rom_, tiles16, i);
|
||||
}
|
||||
FetchLargeMaps();
|
||||
LoadOverworldMap();
|
||||
|
||||
auto size = tiles16.size();
|
||||
for (int i = 0; i < constants::NumberOfOWMaps; i++) {
|
||||
for (int i = 0; i < core::NumberOfOWMaps; i++) {
|
||||
overworld_maps_[i].BuildMap(size, gameState, mapParent, map_tiles_);
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ void Overworld::AssembleMap32Tiles() {
|
||||
}
|
||||
|
||||
void Overworld::AssembleMap16Tiles() {
|
||||
int tpos = core::constants::map16Tiles;
|
||||
int tpos = core::map16Tiles;
|
||||
auto rom_data = rom_.data();
|
||||
for (int i = 0; i < 4096; i += 1) // 3760
|
||||
for (int i = 0; i < 4096; i += 1) // 3760
|
||||
{
|
||||
gfx::TileInfo t0 = gfx::GetTilesInfo((uintptr_t)(rom_data + tpos));
|
||||
tpos += 2;
|
||||
@@ -96,13 +96,13 @@ void Overworld::DecompressAllMapTiles() {
|
||||
int sy = 0;
|
||||
int c = 0;
|
||||
for (int i = 0; i < 160; i++) {
|
||||
int map_high_ptr = constants::compressedAllMap32PointersHigh;
|
||||
int map_high_ptr = core::compressedAllMap32PointersHigh;
|
||||
int p1 = (rom_.data()[(map_high_ptr) + 2 + (3 * i)] << 16) +
|
||||
(rom_.data()[(map_high_ptr) + 1 + (3 * i)] << 8) +
|
||||
(rom_.data()[(map_high_ptr + (3 * i))]);
|
||||
p1 = SnesToPc(p1);
|
||||
|
||||
int map_low_ptr = constants::compressedAllMap32PointersLow;
|
||||
int map_low_ptr = core::compressedAllMap32PointersLow;
|
||||
int p2 = (rom_.data()[(map_low_ptr) + 2 + (3 * i)] << 16) +
|
||||
(rom_.data()[(map_low_ptr) + 1 + (3 * i)] << 8) +
|
||||
(rom_.data()[(map_low_ptr + (3 * i))]);
|
||||
@@ -130,48 +130,16 @@ void Overworld::DecompressAllMapTiles() {
|
||||
for (int y = 0; y < 16; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
auto tidD = (ushort)((bytes2[ttpos] << 8) + bytes[ttpos]);
|
||||
|
||||
int tpos = tidD;
|
||||
if (tpos < tiles32.size()) {
|
||||
if (i < 64) {
|
||||
map_tiles_.light_world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile0_;
|
||||
map_tiles_
|
||||
.light_world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile1_;
|
||||
map_tiles_
|
||||
.light_world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile2_;
|
||||
map_tiles_
|
||||
.light_world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile3_;
|
||||
AssignWorldTiles(map_tiles_.light_world, x, y, sx, sy, tpos);
|
||||
} else if (i < 128 && i >= 64) {
|
||||
map_tiles_.dark_world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile0_;
|
||||
map_tiles_
|
||||
.dark_world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile1_;
|
||||
map_tiles_
|
||||
.dark_world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile2_;
|
||||
map_tiles_
|
||||
.dark_world[(x * 2) + 1 + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile3_;
|
||||
AssignWorldTiles(map_tiles_.dark_world, x, y, sx, sy, tpos);
|
||||
} else {
|
||||
map_tiles_.special_world[(x * 2) + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile0_;
|
||||
map_tiles_
|
||||
.special_world[(x * 2) + 1 + (sx * 32)][(y * 2) + (sy * 32)] =
|
||||
tiles32[tpos].tile1_;
|
||||
map_tiles_
|
||||
.special_world[(x * 2) + (sx * 32)][(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile2_;
|
||||
map_tiles_.special_world[(x * 2) + 1 + (sx * 32)]
|
||||
[(y * 2) + 1 + (sy * 32)] =
|
||||
tiles32[tpos].tile3_;
|
||||
AssignWorldTiles(map_tiles_.special_world, x, y, sx, sy, tpos);
|
||||
}
|
||||
}
|
||||
|
||||
ttpos += 1;
|
||||
}
|
||||
}
|
||||
@@ -272,6 +240,6 @@ void Overworld::LoadOverworldMap() {
|
||||
overworldMapBitmap.CreateTexture(renderer);
|
||||
}
|
||||
|
||||
} // namespace zelda3
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
} // namespace zelda3
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -52,8 +52,8 @@ private:
|
||||
std::vector<OverworldMap> overworld_maps_;
|
||||
|
||||
const int map32address[4] = {
|
||||
core::constants::map32TilesTL, core::constants::map32TilesTR,
|
||||
core::constants::map32TilesBL, core::constants::map32TilesBR};
|
||||
core::map32TilesTL, core::map32TilesTR,
|
||||
core::map32TilesBL, core::map32TilesBR};
|
||||
|
||||
enum Dimension {
|
||||
map32TilesTL = 0,
|
||||
|
||||
@@ -16,51 +16,49 @@ namespace yaze {
|
||||
namespace app {
|
||||
namespace zelda3 {
|
||||
|
||||
using namespace core;
|
||||
|
||||
OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16,
|
||||
int index_)
|
||||
: parent_(index_), index_(index_), rom_(rom), tiles16_(tiles16) {
|
||||
if (index_ != 0x80 && index_ <= 150 &&
|
||||
rom_.data()[constants::overworldMapSize + (index_ & 0x3F)] != 0) {
|
||||
rom_.data()[core::overworldMapSize + (index_ & 0x3F)] != 0) {
|
||||
large_map_ = true;
|
||||
}
|
||||
|
||||
if (index_ < 64) {
|
||||
sprite_graphics_[0] = rom_.data()[constants::overworldSpriteset + parent_];
|
||||
sprite_graphics_[0] = rom_.data()[core::overworldSpriteset + parent_];
|
||||
sprite_graphics_[1] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 64];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 64];
|
||||
sprite_graphics_[2] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
gfx_ = rom_.data()[constants::mapGfx + parent_];
|
||||
palette_ = rom_.data()[constants::overworldMapPalette + parent_];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
gfx_ = rom_.data()[core::mapGfx + parent_];
|
||||
palette_ = rom_.data()[core::overworldMapPalette + parent_];
|
||||
sprite_palette_[0] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_];
|
||||
rom_.data()[core::overworldSpritePalette + parent_];
|
||||
sprite_palette_[1] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 64];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 64];
|
||||
sprite_palette_[2] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
musics[0] = rom_.data()[constants::overworldMusicBegining + parent_];
|
||||
musics[1] = rom_.data()[constants::overworldMusicZelda + parent_];
|
||||
musics[2] = rom_.data()[constants::overworldMusicMasterSword + parent_];
|
||||
musics[3] = rom_.data()[constants::overworldMusicAgahim + parent_];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
musics[0] = rom_.data()[core::overworldMusicBegining + parent_];
|
||||
musics[1] = rom_.data()[core::overworldMusicZelda + parent_];
|
||||
musics[2] = rom_.data()[core::overworldMusicMasterSword + parent_];
|
||||
musics[3] = rom_.data()[core::overworldMusicAgahim + parent_];
|
||||
} else if (index_ < 128) {
|
||||
sprite_graphics_[0] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[1] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[2] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
gfx_ = rom_.data()[constants::mapGfx + parent_];
|
||||
palette_ = rom_.data()[constants::overworldMapPalette + parent_];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
gfx_ = rom_.data()[core::mapGfx + parent_];
|
||||
palette_ = rom_.data()[core::overworldMapPalette + parent_];
|
||||
sprite_palette_[0] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[1] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[2] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
|
||||
musics[0] = rom_.data()[constants::overworldMusicDW + (parent_ - 64)];
|
||||
musics[0] = rom_.data()[core::overworldMusicDW + (parent_ - 64)];
|
||||
} else {
|
||||
if (index_ == 0x94) {
|
||||
parent_ = 128;
|
||||
@@ -84,32 +82,32 @@ OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16,
|
||||
parent_ = 136;
|
||||
}
|
||||
|
||||
message_id_ = rom_.data()[constants::overworldMessages + parent_];
|
||||
message_id_ = rom_.data()[core::overworldMessages + parent_];
|
||||
|
||||
sprite_graphics_[0] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[1] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_graphics_[2] =
|
||||
rom_.data()[constants::overworldSpriteset + parent_ + 128];
|
||||
rom_.data()[core::overworldSpriteset + parent_ + 128];
|
||||
sprite_palette_[0] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[1] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
sprite_palette_[2] =
|
||||
rom_.data()[constants::overworldSpritePalette + parent_ + 128];
|
||||
rom_.data()[core::overworldSpritePalette + parent_ + 128];
|
||||
|
||||
palette_ = rom_.data()[constants::overworldSpecialPALGroup + parent_ - 128];
|
||||
palette_ = rom_.data()[core::overworldSpecialPALGroup + parent_ - 128];
|
||||
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
||||
gfx_ = rom_.data()[constants::overworldSpecialGFXGroup + (parent_ - 128)];
|
||||
palette_ = rom_.data()[constants::overworldSpecialPALGroup + 1];
|
||||
gfx_ = rom_.data()[core::overworldSpecialGFXGroup + (parent_ - 128)];
|
||||
palette_ = rom_.data()[core::overworldSpecialPALGroup + 1];
|
||||
} else if (index_ == 0x88) {
|
||||
gfx_ = 81;
|
||||
palette_ = 0;
|
||||
} else // pyramid bg use 0x5B map
|
||||
{
|
||||
gfx_ = rom_.data()[constants::mapGfx + parent_];
|
||||
palette_ = rom_.data()[constants::overworldMapPalette + parent_];
|
||||
gfx_ = rom_.data()[core::mapGfx + parent_];
|
||||
palette_ = rom_.data()[core::overworldMapPalette + parent_];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,15 +119,15 @@ void OverworldMap::BuildMap(int count, int game_state, uchar* map_parent,
|
||||
|
||||
if (parent_ != index_ && !initialized_) {
|
||||
if (index_ >= 0x80 && index_ <= 0x8A && index_ != 0x88) {
|
||||
gfx_ = rom_.data()[core::constants::overworldSpecialGFXGroup +
|
||||
gfx_ = rom_.data()[core::overworldSpecialGFXGroup +
|
||||
(parent_ - 128)];
|
||||
palette_ = rom_.data()[core::constants::overworldSpecialPALGroup + 1];
|
||||
palette_ = rom_.data()[core::overworldSpecialPALGroup + 1];
|
||||
} else if (index_ == 0x88) {
|
||||
gfx_ = 81;
|
||||
palette_ = 0;
|
||||
} else {
|
||||
gfx_ = rom_.data()[core::constants::mapGfx + parent_];
|
||||
palette_ = rom_.data()[core::constants::overworldMapPalette + parent_];
|
||||
gfx_ = rom_.data()[core::mapGfx + parent_];
|
||||
palette_ = rom_.data()[core::overworldMapPalette + parent_];
|
||||
}
|
||||
|
||||
initialized_ = true;
|
||||
@@ -300,7 +298,7 @@ void OverworldMap::BuildTileset(int gameState) {
|
||||
staticgfx[11] = 115 + 7;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
staticgfx[12 + i] =
|
||||
(uchar)(rom_.data()[constants::sprite_blockset_pointer +
|
||||
(uchar)(rom_.data()[core::sprite_blockset_pointer +
|
||||
(sprite_graphics_[gameState] * 4) + i] +
|
||||
115);
|
||||
}
|
||||
@@ -308,20 +306,20 @@ void OverworldMap::BuildTileset(int gameState) {
|
||||
// Main Blocksets
|
||||
for (int i = 0; i < 8; i++) {
|
||||
staticgfx[i] =
|
||||
rom_.data()[constants::overworldgfxGroups2 + (indexWorld * 8) + i];
|
||||
rom_.data()[core::overworldgfxGroups2 + (indexWorld * 8) + i];
|
||||
}
|
||||
|
||||
if (rom_.data()[constants::overworldgfxGroups + (gfx_ * 4)] != 0) {
|
||||
staticgfx[3] = rom_.data()[constants::overworldgfxGroups + (gfx_ * 4)];
|
||||
if (rom_.data()[core::overworldgfxGroups + (gfx_ * 4)] != 0) {
|
||||
staticgfx[3] = rom_.data()[core::overworldgfxGroups + (gfx_ * 4)];
|
||||
}
|
||||
if (rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 1] != 0) {
|
||||
staticgfx[4] = rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 1];
|
||||
if (rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 1] != 0) {
|
||||
staticgfx[4] = rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 1];
|
||||
}
|
||||
if (rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 2] != 0) {
|
||||
staticgfx[5] = rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 2];
|
||||
if (rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 2] != 0) {
|
||||
staticgfx[5] = rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 2];
|
||||
}
|
||||
if (rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 3] != 0) {
|
||||
staticgfx[6] = rom_.data()[constants::overworldgfxGroups + (gfx_ * 4) + 3];
|
||||
if (rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 3] != 0) {
|
||||
staticgfx[6] = rom_.data()[core::overworldgfxGroups + (gfx_ * 4) + 3];
|
||||
}
|
||||
|
||||
// Hardcoded overworld GFX Values, for death mountain
|
||||
|
||||
Reference in New Issue
Block a user