add zelda3::screen namespace

This commit is contained in:
scawful
2024-04-14 13:49:00 -05:00
parent e72b08eae4
commit cc05f1b469
7 changed files with 38 additions and 23 deletions

View File

@@ -117,25 +117,30 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
for (int d = 0; d < 14; d++) {
current_floor_rooms_d.clear();
current_floor_gfx_d.clear();
ASSIGN_OR_RETURN(int ptr,
rom()->ReadWord(zelda3::kDungeonMapRoomsPtr + (d * 2)));
ASSIGN_OR_RETURN(int ptrGFX,
rom()->ReadWord(zelda3::kDungeonMapRoomsPtr + (d * 2)));
ASSIGN_OR_RETURN(
int ptr,
rom()->ReadWord(zelda3::screen::kDungeonMapRoomsPtr + (d * 2)));
ASSIGN_OR_RETURN(
int ptrGFX,
rom()->ReadWord(zelda3::screen::kDungeonMapRoomsPtr + (d * 2)));
ptr |= 0x0A0000; // Add bank to the short ptr
ptrGFX |= 0x0A0000; // Add bank to the short ptr
int pcPtr = core::SnesToPc(ptr); // Contains data for the next 25 rooms
int pcPtrGFX =
core::SnesToPc(ptrGFX); // Contains data for the next 25 rooms
ASSIGN_OR_RETURN(ushort bossRoomD,
rom()->ReadWord(zelda3::kDungeonMapBossRooms + (d * 2)));
ASSIGN_OR_RETURN(
ushort bossRoomD,
rom()->ReadWord(zelda3::screen::kDungeonMapBossRooms + (d * 2)));
ASSIGN_OR_RETURN(nbr_basement_d,
rom()->ReadByte(zelda3::kDungeonMapFloors + (d * 2)));
ASSIGN_OR_RETURN(
nbr_basement_d,
rom()->ReadByte(zelda3::screen::kDungeonMapFloors + (d * 2)));
nbr_basement_d &= 0x0F;
ASSIGN_OR_RETURN(nbr_floor_d,
rom()->ReadByte(zelda3::kDungeonMapFloors + (d * 2)));
ASSIGN_OR_RETURN(
nbr_floor_d,
rom()->ReadByte(zelda3::screen::kDungeonMapFloors + (d * 2)));
nbr_floor_d &= 0xF0;
nbr_floor_d = nbr_floor_d >> 4;
@@ -179,8 +184,8 @@ absl::Status ScreenEditor::LoadDungeonMaps() {
absl::Status ScreenEditor::SaveDungeonMaps() {
for (int d = 0; d < 14; d++) {
int ptr = zelda3::kDungeonMapRoomsPtr + (d * 2);
int ptrGFX = zelda3::kDungeonMapGfxPtr + (d * 2);
int ptr = zelda3::screen::kDungeonMapRoomsPtr + (d * 2);
int ptrGFX = zelda3::screen::kDungeonMapGfxPtr + (d * 2);
int pcPtr = core::SnesToPc(ptr);
int pcPtrGFX = core::SnesToPc(ptrGFX);
@@ -208,9 +213,9 @@ absl::Status ScreenEditor::LoadDungeonMapTile16() {
tile16_sheet_.Init(256, 192, gfx::TileType::Tile16);
for (int i = 0; i < 186; i++) {
int addr = zelda3::kDungeonMapTile16;
if (rom()->data()[zelda3::kDungeonMapExpCheck] != 0xB9) {
addr = zelda3::kDungeonMapTile16Expanded;
int addr = zelda3::screen::kDungeonMapTile16;
if (rom()->data()[zelda3::screen::kDungeonMapExpCheck] != 0xB9) {
addr = zelda3::screen::kDungeonMapTile16Expanded;
}
ASSIGN_OR_RETURN(auto tl, rom()->ReadWord(addr + (i * 8)));

View File

@@ -57,7 +57,7 @@ class ScreenEditor : public SharedROM {
void DrawDungeonMapsTabs();
void DrawDungeonMapsEditor();
std::vector<zelda3::DungeonMap> dungeon_maps_;
std::vector<zelda3::screen::DungeonMap> dungeon_maps_;
std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
std::unordered_map<int, gfx::Bitmap> tile16_individual_;
@@ -74,7 +74,7 @@ class ScreenEditor : public SharedROM {
bool paste_button_pressed = false;
Bytes all_gfx_;
zelda3::Inventory inventory_;
zelda3::screen::Inventory inventory_;
gfx::SnesPalette palette_;
gui::Canvas screen_canvas_;
gui::Canvas tilesheet_canvas_;

View File

@@ -7,6 +7,7 @@
namespace yaze {
namespace app {
namespace zelda3 {
namespace screen {
constexpr int kDungeonMapRoomsPtr = 0x57605; // 14 pointers of map data
constexpr int kDungeonMapFloors = 0x575D9; // 14 words values
@@ -47,8 +48,9 @@ class DungeonMap {
floor_gfx(floor_gfx) {}
};
} // namespace screen
} // namespace zelda3
} // namespace app
} // namespace yaze
#endif // YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H
#endif // YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H

View File

@@ -8,6 +8,7 @@
namespace yaze {
namespace app {
namespace zelda3 {
namespace screen {
void Inventory::Create() {
data_.reserve(256 * 256);
@@ -86,6 +87,7 @@ absl::Status Inventory::BuildTileset() {
return absl::OkStatus();
}
} // namespace screen
} // namespace zelda3
} // namespace app
} // namespace yaze

View File

@@ -2,14 +2,15 @@
#define YAZE_APP_ZELDA3_INVENTORY_H
#include "app/gfx/bitmap.h"
#include "app/gfx/snes_tile.h"
#include "app/gfx/snes_palette.h"
#include "app/rom.h"
#include "app/gfx/snes_tile.h"
#include "app/gui/canvas.h"
#include "app/rom.h"
namespace yaze {
namespace app {
namespace zelda3 {
namespace screen {
constexpr int kInventoryStart = 0x6564A;
constexpr int kBowItemPos = 0x6F631;
@@ -37,8 +38,9 @@ class Inventory : public SharedROM {
std::vector<gfx::TileInfo> tiles_;
};
} // namespace screen
} // namespace zelda3
} // namespace app
} // namespace yaze
#endif
#endif // YAZE_APP_ZELDA3_INVENTORY_H

View File

@@ -10,6 +10,7 @@
namespace yaze {
namespace app {
namespace zelda3 {
namespace screen {
void TitleScreen::Create() {
tiles8Bitmap.Create(128, 512, 8, 0x20000);
@@ -124,6 +125,7 @@ void TitleScreen::LoadTitleScreen() {
pal_selected_ = 2;
}
} // namespace screen
} // namespace zelda3
} // namespace app
} // namespace yaze
} // namespace yaze

View File

@@ -11,6 +11,7 @@
namespace yaze {
namespace app {
namespace zelda3 {
namespace screen {
class TitleScreen {
public:
@@ -74,8 +75,9 @@ class TitleScreen {
gfx::Bitmap tiles8Bitmap; // 0x20000
};
} // namespace screen
} // namespace zelda3
} // namespace app
} // namespace yaze
#endif
#endif // YAZE_APP_ZELDA3_SCREEN_H