Remove rom namespace

This commit is contained in:
scawful
2022-07-09 22:52:07 -04:00
parent 31f1850800
commit 982cc789fe
10 changed files with 18 additions and 21 deletions

View File

@@ -12,6 +12,6 @@ int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3);
} // namespace core
} // namespace app
} // namespace premia
} // namespace yaze
#endif

View File

@@ -47,7 +47,7 @@ class Editor {
bool is_loaded_ = true;
bool asm_is_loaded = false;
rom::ROM rom_;
ROM rom_;
gui::Canvas canvas_;
AssemblyEditor assembly_editor_;
OverworldEditor overworld_editor_;

View File

@@ -29,7 +29,7 @@ namespace yaze {
namespace app {
namespace editor {
void OverworldEditor::SetupROM(rom::ROM &rom) { rom_ = rom; }
void OverworldEditor::SetupROM(ROM &rom) { rom_ = rom; }
void OverworldEditor::Update() {
if (rom_.isLoaded() && !all_gfx_loaded_) {

View File

@@ -17,7 +17,7 @@ static constexpr unsigned int k4BPP = 4;
class OverworldEditor {
public:
void SetupROM(app::rom::ROM &rom);
void SetupROM(ROM &rom);
void Update();
private:
@@ -31,7 +31,7 @@ class OverworldEditor {
void LoadBlockset();
void LoadGraphics();
rom::ROM rom_;
ROM rom_;
zelda3::Overworld overworld_;
gfx::SNESPalette palette_;

View File

@@ -17,7 +17,6 @@
namespace yaze {
namespace app {
namespace rom {
void ROM::Close() {
if (is_loaded_) {
@@ -76,8 +75,8 @@ char *ROM::Decompress(int pos, int size, bool reversed) {
length =
(ushort)(((current_rom_[pos] << 8) | current_rom_[pos + 1]) & 0x3FF);
pos += 2; // Advance 2 bytes in ROM
} else { // Normal Command
} else { // Normal Command
cmd = (uchar)((databyte >> 5) & 0x07);
length = (uchar)(databyte & 0x1F);
pos += 1; // Advance 1 byte in ROM
@@ -235,8 +234,8 @@ int ROM::GetPCGfxAddress(uint8_t id) {
uint8_t gfxGamePointer2 = current_rom_[gfxPtr2 + id];
uint8_t gfxGamePointer3 = current_rom_[gfxPtr3 + id];
return core::SnesToPc(
core::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3));
return core::SnesToPc(core::AddressFromBytes(gfxGamePointer1, gfxGamePointer2,
gfxGamePointer3));
}
// 0-112 -> compressed 3bpp bgr -> (decompressed each) 0x600 chars
@@ -281,6 +280,5 @@ char *ROM::CreateAllGfxDataRaw() {
return buffer;
}
} // namespace rom
} // namespace app
} // namespace yaze

View File

@@ -19,7 +19,6 @@
namespace yaze {
namespace app {
namespace rom {
class ROM {
public:
@@ -29,7 +28,8 @@ class ROM {
void LoadFromFile(const std::string& path);
char* Decompress(int pos, int size = 0x800, bool reversed = false);
gfx::SNESPalette ExtractPalette(uint addr, int bpp);
uchar* SNES3bppTo8bppSheet(uchar* buffer_in, int sheet_id = 0, int size = 0x1000);
uchar* SNES3bppTo8bppSheet(uchar* buffer_in, int sheet_id = 0,
int size = 0x1000);
SDL_Texture* DrawGraphicsSheet(int offset);
int GetPCGfxAddress(uint8_t id);
@@ -59,7 +59,6 @@ class ROM {
std::shared_ptr<SDL_Renderer> sdl_renderer_;
};
} // namespace rom
} // namespace app
} // namespace yaze

View File

@@ -25,7 +25,7 @@ static TileInfo GetTilesInfo(ushort tile) {
return TileInfo(tid, p, v, h, o);
}
void Overworld::Load(app::rom::ROM& rom, uchar* allGfxPtr) {
void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
rom_ = rom;
allGfx16Ptr = allGfxPtr;

View File

@@ -19,7 +19,7 @@ namespace zelda3 {
class Overworld {
public:
void Load(app::rom::ROM& rom, uchar* allGfxPtr);
void Load(ROM& rom, uchar* allGfxPtr);
auto GetTiles16() const { return tiles16; }
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
auto GetMapBlockset16Ptr() { return mapblockset16; }
@@ -35,7 +35,7 @@ class Overworld {
void FetchLargeMaps();
void LoadOverworldMap();
app::rom::ROM rom_;
ROM rom_;
int gameState = 1;
bool isLoaded = false;
uchar mapParent[160];

View File

@@ -14,8 +14,8 @@ namespace zelda3 {
using namespace core;
using namespace gfx;
OverworldMap::OverworldMap(app::rom::ROM& rom,
const std::vector<gfx::Tile16>& tiles16, int index_)
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) {

View File

@@ -30,14 +30,14 @@ class OverworldMap {
uchar* currentOWgfx16Ptr_ = nullptr;
uchar* allGfx16Ptr_ = nullptr;
app::rom::ROM rom_;
ROM rom_;
gfx::Bitmap gfxBitmap;
std::vector<gfx::Tile16> tiles16_;
uchar* staticgfx = new uchar[16];
std::vector<std::vector<ushort>> tiles_used_;
OverworldMap(app::rom::ROM& rom, const std::vector<gfx::Tile16>& tiles16,
OverworldMap(ROM& rom, const std::vector<gfx::Tile16>& tiles16,
int index);
void BuildMap(uchar* mapParent, int count, int gameState,
std::vector<std::vector<ushort>>& allmapsTilesLW,