expand entrance room constants in Zelda3 and enhance OverworldMap class with mosaic handling.
This commit is contained in:
@@ -10,6 +10,34 @@
|
|||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace zelda3 {
|
namespace zelda3 {
|
||||||
|
|
||||||
|
// EXPANDED to 0x78000 to 0x7A000
|
||||||
|
constexpr int kEntranceRoomEXP = 0x078000;
|
||||||
|
constexpr int kEntranceScrollEdgeEXP = 0x078200;
|
||||||
|
constexpr int kEntranceCameraYEXP = 0x078A00;
|
||||||
|
constexpr int kEntranceCameraXEXP = 0x078C00;
|
||||||
|
constexpr int kEntranceYPositionEXP = 0x078E00;
|
||||||
|
constexpr int kEntranceXPositionEXP = 0x079000;
|
||||||
|
constexpr int kEntranceCameraYTriggerEXP = 0x079200;
|
||||||
|
constexpr int kEntranceCameraXTriggerEXP = 0x079400;
|
||||||
|
constexpr int kEntranceBlocksetEXP = 0x079600;
|
||||||
|
constexpr int kEntranceFloorEXP = 0x079700;
|
||||||
|
constexpr int kEntranceDungeonEXP = 0x079800;
|
||||||
|
constexpr int kEntranceDoorEXP = 0x079900;
|
||||||
|
constexpr int kEntranceLadderBgEXP = 0x079A00;
|
||||||
|
constexpr int kEntranceScrollingEXP = 0x079B00;
|
||||||
|
constexpr int kEntranceScrollQuadrantEXP = 0x079C00;
|
||||||
|
constexpr int kEntranceExitEXP = 0x079D00;
|
||||||
|
constexpr int kEntranceMusicEXP = 0x079F00;
|
||||||
|
constexpr int kEntranceExtraEXP = 0x07A000;
|
||||||
|
constexpr int kEntranceTotalEXP = 0xFF;
|
||||||
|
constexpr int kEntranceTotal = 0x84;
|
||||||
|
constexpr int kEntranceLinkSpawn = 0x00;
|
||||||
|
constexpr int kEntranceNorthTavern = 0x43;
|
||||||
|
constexpr int kEntranceEXP = 0x07F000;
|
||||||
|
|
||||||
|
constexpr int kEntranceCameraY = 0x014D45; // 0x14AA9 // 2bytes each room
|
||||||
|
constexpr int kEntranceCameraX = 0x014E4F; // 0x14BB3 // 2bytes
|
||||||
|
|
||||||
constexpr int kNumOverworldEntrances = 129;
|
constexpr int kNumOverworldEntrances = 129;
|
||||||
constexpr int kNumOverworldHoles = 0x13;
|
constexpr int kNumOverworldHoles = 0x13;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "app/gfx/snes_tile.h"
|
#include "app/gfx/snes_tile.h"
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "app/zelda3/overworld/overworld.h"
|
#include "app/zelda3/overworld/overworld.h"
|
||||||
#include "util/hex.h"
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -149,8 +148,8 @@ void OverworldMap::LoadAreaInfo() {
|
|||||||
if ((index_ >= kSpecialWorldMapIdStart && index_ <= 0x8A &&
|
if ((index_ >= kSpecialWorldMapIdStart && index_ <= 0x8A &&
|
||||||
index_ != 0x88) ||
|
index_ != 0x88) ||
|
||||||
index_ == 0x94) {
|
index_ == 0x94) {
|
||||||
area_graphics_ =
|
area_graphics_ = (*rom_)[kOverworldSpecialGfxGroup +
|
||||||
(*rom_)[kOverworldSpecialGfxGroup + (parent_ - kSpecialWorldMapIdStart)];
|
(parent_ - kSpecialWorldMapIdStart)];
|
||||||
area_palette_ = (*rom_)[kOverworldSpecialPalGroup + 1];
|
area_palette_ = (*rom_)[kOverworldSpecialPalGroup + 1];
|
||||||
} else if (index_ == 0x88) {
|
} else if (index_ == 0x88) {
|
||||||
area_graphics_ = 0x51;
|
area_graphics_ = 0x51;
|
||||||
@@ -288,12 +287,67 @@ void OverworldMap::LoadCustomOverworldData() {
|
|||||||
{
|
{
|
||||||
subscreen_overlay_ = 0x0093;
|
subscreen_overlay_ = 0x0093;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the main palette values.
|
||||||
|
if (index_ < 0x40) // LW
|
||||||
|
{
|
||||||
|
area_palette_ = 0;
|
||||||
|
} else if (index_ >= 0x40 && index_ < 0x80) // DW
|
||||||
|
{
|
||||||
|
area_palette_ = 1;
|
||||||
|
} else if (index_ >= 0x80 && index_ < 0xA0) // SW
|
||||||
|
{
|
||||||
|
area_palette_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index_ == 0x03 || index_ == 0x05 || index_ == 0x07) // LW Death Mountain
|
||||||
|
{
|
||||||
|
area_palette_ = 2;
|
||||||
|
} else if (index_ == 0x43 || index_ == 0x45 ||
|
||||||
|
index_ == 0x47) // DW Death Mountain
|
||||||
|
{
|
||||||
|
area_palette_ = 3;
|
||||||
|
} else if (index_ == 0x88) // Triforce room
|
||||||
|
{
|
||||||
|
area_palette_ = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the mosaic values.
|
||||||
|
switch (index_) {
|
||||||
|
case 0x00: // Leaving Skull Woods / Lost Woods
|
||||||
|
case 0x40:
|
||||||
|
mosaic_expanded_ = {false, true, false, true};
|
||||||
|
break;
|
||||||
|
case 0x02: // Going into Skull woods / Lost Woods west
|
||||||
|
case 0x0A:
|
||||||
|
case 0x42:
|
||||||
|
case 0x4A:
|
||||||
|
mosaic_expanded_ = {false, false, true, false};
|
||||||
|
break;
|
||||||
|
case 0x0F: // Going into Zora's Domain North
|
||||||
|
case 0x10: // Going into Skull Woods / Lost Woods North
|
||||||
|
case 0x11:
|
||||||
|
case 0x50:
|
||||||
|
case 0x51:
|
||||||
|
mosaic_expanded_ = {true, false, false, false};
|
||||||
|
break;
|
||||||
|
case 0x80: // Leaving Zora's Domain, the Master Sword area, and the
|
||||||
|
// Triforce area
|
||||||
|
case 0x81:
|
||||||
|
case 0x88:
|
||||||
|
mosaic_expanded_ = {false, true, false, false};
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverworldMap::SetupCustomTileset(uint8_t asm_version) {
|
void OverworldMap::SetupCustomTileset(uint8_t asm_version) {
|
||||||
area_palette_ = (*rom_)[OverworldCustomMainPaletteArray + index_];
|
area_palette_ = (*rom_)[OverworldCustomMainPaletteArray + index_];
|
||||||
mosaic_ = (*rom_)[OverworldCustomMosaicArray + index_] != 0x00;
|
mosaic_ = (*rom_)[OverworldCustomMosaicArray + index_] != 0x00;
|
||||||
|
|
||||||
|
uint8_t mosaicByte = (*rom_)[OverworldCustomMosaicArray + index_];
|
||||||
|
mosaic_expanded_ = {(mosaicByte & 0x08) != 0x00, (mosaicByte & 0x04) != 0x00,
|
||||||
|
(mosaicByte & 0x02) != 0x00, (mosaicByte & 0x01) != 0x00};
|
||||||
|
|
||||||
// This is just to load the GFX groups for ROMs that have an older version
|
// This is just to load the GFX groups for ROMs that have an older version
|
||||||
// of the Overworld ASM already applied.
|
// of the Overworld ASM already applied.
|
||||||
if (asm_version >= 0x01 && asm_version != 0xFF) {
|
if (asm_version >= 0x01 && asm_version != 0xFF) {
|
||||||
@@ -397,7 +451,8 @@ void OverworldMap::LoadSpritesBlocksets() {
|
|||||||
|
|
||||||
void OverworldMap::LoadMainBlocksets() {
|
void OverworldMap::LoadMainBlocksets() {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
static_graphics_[i] = (*rom_)[rom_->version_constants().kOverworldGfxGroups2 +
|
static_graphics_[i] =
|
||||||
|
(*rom_)[rom_->version_constants().kOverworldGfxGroups2 +
|
||||||
(main_gfx_id_ * 8) + i];
|
(main_gfx_id_ * 8) + i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,12 +464,6 @@ void OverworldMap::LoadMainBlocksets() {
|
|||||||
// of the 5A sheet, so this will need some special manipulation to make work
|
// of the 5A sheet, so this will need some special manipulation to make work
|
||||||
// during the BuildBitmap step (or a new one specifically for animating).
|
// during the BuildBitmap step (or a new one specifically for animating).
|
||||||
void OverworldMap::DrawAnimatedTiles() {
|
void OverworldMap::DrawAnimatedTiles() {
|
||||||
std::cout << "static_graphics_[6] = " << util::HexByte(static_graphics_[6])
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << "static_graphics_[7] = " << util::HexByte(static_graphics_[7])
|
|
||||||
<< std::endl;
|
|
||||||
std::cout << "static_graphics_[8] = " << util::HexByte(static_graphics_[8])
|
|
||||||
<< std::endl;
|
|
||||||
if (static_graphics_[7] == 0x5B) {
|
if (static_graphics_[7] == 0x5B) {
|
||||||
static_graphics_[7] = 0x5A;
|
static_graphics_[7] = 0x5A;
|
||||||
} else {
|
} else {
|
||||||
@@ -606,8 +655,8 @@ absl::Status OverworldMap::LoadPalette() {
|
|||||||
(area_palette_ * 4) + 1];
|
(area_palette_ * 4) + 1];
|
||||||
uint8_t pal3 = (*rom_)[rom_->version_constants().kOverworldMapPaletteGroup +
|
uint8_t pal3 = (*rom_)[rom_->version_constants().kOverworldMapPaletteGroup +
|
||||||
(area_palette_ * 4) + 2];
|
(area_palette_ * 4) + 2];
|
||||||
uint8_t pal4 =
|
uint8_t pal4 = (*rom_)[kOverworldSpritePaletteGroup +
|
||||||
(*rom_)[kOverworldSpritePaletteGroup + (sprite_palette_[game_state_] * 2)];
|
(sprite_palette_[game_state_] * 2)];
|
||||||
uint8_t pal5 = (*rom_)[kOverworldSpritePaletteGroup +
|
uint8_t pal5 = (*rom_)[kOverworldSpritePaletteGroup +
|
||||||
(sprite_palette_[game_state_] * 2) + 1];
|
(sprite_palette_[game_state_] * 2) + 1];
|
||||||
|
|
||||||
|
|||||||
@@ -211,6 +211,8 @@ class OverworldMap : public gfx::GfxContext {
|
|||||||
std::array<uint8_t, 4> area_music_;
|
std::array<uint8_t, 4> area_music_;
|
||||||
std::array<uint8_t, 16> static_graphics_;
|
std::array<uint8_t, 16> static_graphics_;
|
||||||
|
|
||||||
|
std::array<bool, 4> mosaic_expanded_;
|
||||||
|
|
||||||
std::vector<uint8_t> current_blockset_;
|
std::vector<uint8_t> current_blockset_;
|
||||||
std::vector<uint8_t> current_gfx_;
|
std::vector<uint8_t> current_gfx_;
|
||||||
std::vector<uint8_t> bitmap_data_;
|
std::vector<uint8_t> bitmap_data_;
|
||||||
|
|||||||
Reference in New Issue
Block a user