housekeeping

This commit is contained in:
Justin Scofield
2022-06-20 14:28:04 -04:00
parent 89c5dcfec6
commit 9c7c9bc1e4
15 changed files with 84 additions and 66 deletions

View File

@@ -43,7 +43,7 @@ class Controller {
};
bool active_;
Editor::Editor editor_;
gui::editor::Editor editor_;
std::shared_ptr<SDL_Window> sdl_window_;
std::shared_ptr<SDL_Renderer> sdl_renderer_;
};

View File

@@ -28,7 +28,7 @@ int GetPCGfxAddress(char *romData, char id) {
char gfxGamePointer3 = romData[gfxPointer3 + id];
return lorom_snes_to_pc(
Data::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
info1);
}

View File

@@ -1,5 +1,7 @@
#include "tile.h"
#include <tile.h>
#include <cassert>
#include <cstdint>
#include <cstdio>
@@ -7,6 +9,12 @@
#include <cstring>
#include <iostream>
#include <regex>
#include <string>
#include <unordered_map>
#include <vector>
#include "app/core/constants.h"
#include "app/gfx/palette.h"
namespace yaze {
namespace app {

View File

@@ -1,15 +1,21 @@
#ifndef YAZE_APP_DATA_TILE_H
#define YAZE_APP_DATA_TILE_H
#ifndef YAZE_APP_GFX_TILE_H
#define YAZE_APP_GFX_TILE_H
#include <tile.h>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <regex>
#include <string>
#include <unordered_map>
#include <vector>
#include "Core/constants.h"
#include "gfx/palette.h"
#include "app/core/constants.h"
#include "app/gfx/palette.h"
namespace yaze {
namespace app {
@@ -100,4 +106,4 @@ class TilePreset {
} // namespace app
} // namespace yaze
#endif
#endif // YAZE_APP_GFX_TILE_H

View File

@@ -1,12 +1,27 @@
#include "rom.h"
#include <filesystem>
#include <compressions/alttpcompression.h>
#include <rommapping.h>
#include <tile.h>
#include "Core/constants.h"
#include <cstddef>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include "app/core/constants.h"
#include "app/gfx/tile.h"
namespace yaze {
namespace app {
namespace Data {
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3) {
return (addr1 << 16) | (addr2 << 8) | addr3;
}
ROM::~ROM() {
if (loaded) {
@@ -287,10 +302,5 @@ SDL_Texture *ROM::DrawgfxSheet(int offset) {
return sheet_texture;
}
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3) {
return (addr1 << 16) | (addr2 << 8) | addr3;
}
} // namespace Data
} // namespace app
} // namespace yaze

View File

@@ -7,18 +7,18 @@
#include <cstddef>
#include <cstring>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include "Core/constants.h"
#include "gfx/tile.h"
#include "app/core/constants.h"
#include "app/gfx/tile.h"
namespace yaze {
namespace app {
namespace Data {
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3);
@@ -52,13 +52,13 @@ class ROM {
private:
bool loaded = false;
bool has_header_ = false;
uchar* current_rom_;
uchar version_;
uchar title[21] = "ROM Not Loaded";
long int size_;
uint uncompressed_size_;
uint compressed_size_;
uint compress_size_;
long int size_;
uchar* current_rom_;
uchar version_;
uchar title[21] = "ROM Not Loaded";
enum rom_type type_ = LoROM;
std::shared_ptr<uchar> rom_ptr_;
@@ -68,7 +68,6 @@ class ROM {
std::shared_ptr<SDL_Renderer> sdl_renderer_;
};
} // namespace Data
} // namespace app
} // namespace yaze

View File

@@ -41,7 +41,7 @@ static TileInfo GetTilesInfo(ushort tile) {
return TileInfo(tid, p, v, h, o);
}
void Overworld::Load(Data::ROM& rom) {
void Overworld::Load(ROM& rom) {
rom_ = rom;
for (int i = 0; i < 0x2B; i++) {
tileLeftEntrance.push_back(constants::overworldEntranceAllowedTilesLeft +

View File

@@ -21,7 +21,7 @@ class Overworld {
Overworld() = default;
~Overworld();
void Load(Data::ROM& rom);
void Load(ROM& rom);
char* overworldMapPointer = new char[0x40000];
gfx::Bitmap* overworldMapBitmap;
@@ -30,7 +30,7 @@ class Overworld {
gfx::Bitmap* owactualMapBitmap;
private:
Data::ROM rom_;
ROM rom_;
int gameState = 1;
bool isLoaded = false;
uchar mapParent[160];

View File

@@ -10,8 +10,8 @@ namespace zelda3 {
using namespace core;
using namespace gfx;
OverworldMap::OverworldMap(Data::ROM& rom,
const std::vector<gfx::Tile16> tiles16, uchar index)
OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16,
uchar index)
: rom_(rom), index(index), tiles16_(tiles16), parent(index) {
if (index != 0x80) {
if (index <= 150) {

View File

@@ -37,13 +37,12 @@ class OverworldMap {
ushort** tilesUsed;
bool needRefresh = false;
Data::ROM rom_;
ROM rom_;
uchar* currentOWgfx16Ptr = new uchar[(128 * 512) / 2];
std::vector<gfx::Tile16> tiles16_;
OverworldMap(Data::ROM& rom, const std::vector<gfx::Tile16> tiles16,
uchar index);
OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16, uchar index);
void BuildMap(uchar* mapParent, int count, int gameState,
ushort** allmapsTilesLW, ushort** allmapsTilesDW,
ushort** allmapsTilesSP);