Rearranging some files and namespaces
This commit is contained in:
@@ -38,7 +38,7 @@ static TileInfo GetTilesInfo(ushort tile) {
|
||||
return TileInfo(tid, p, v, h, o);
|
||||
}
|
||||
|
||||
void Overworld::Load(Utils::ROM rom) {
|
||||
void Overworld::Load(Data::ROM rom) {
|
||||
rom_ = rom;
|
||||
for (int i = 0; i < 0x2B; i++) {
|
||||
// tileLeftEntrance.push_back(
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Graphics/Tile.h"
|
||||
#include "OverworldMap.h"
|
||||
|
||||
#include "Utils/ROM.h"
|
||||
#include "Data/ROM.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
@@ -24,7 +24,7 @@ class Overworld {
|
||||
Overworld() = default;
|
||||
~Overworld();
|
||||
|
||||
void Load(Utils::ROM rom);
|
||||
void Load(Data::ROM rom);
|
||||
|
||||
char* overworldMapPointer = new char[0x40000];
|
||||
Graphics::Bitmap* overworldMapBitmap;
|
||||
@@ -35,7 +35,7 @@ class Overworld {
|
||||
GLuint owactualMapTexture;
|
||||
|
||||
private:
|
||||
Utils::ROM rom_;
|
||||
Data::ROM rom_;
|
||||
int gameState = 1;
|
||||
bool isLoaded = false;
|
||||
byte mapParent[160];
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "OverworldMap.h"
|
||||
|
||||
#include "Data/ROM.h"
|
||||
#include "Graphics/Tile.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Data {
|
||||
@@ -7,7 +10,7 @@ namespace Data {
|
||||
using namespace Core;
|
||||
using namespace Graphics;
|
||||
|
||||
OverworldMap::OverworldMap(Utils::ROM rom,
|
||||
OverworldMap::OverworldMap(Data::ROM rom,
|
||||
const std::vector<Graphics::Tile16> tiles16,
|
||||
byte index)
|
||||
: rom_(rom), index(index), tiles16_(tiles16), parent(index) {
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <memory>
|
||||
|
||||
#include "Data/ROM.h"
|
||||
#include "Graphics/Bitmap.h"
|
||||
#include "Graphics/Tile.h"
|
||||
#include "Utils/ROM.h"
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Data {
|
||||
@@ -31,17 +32,21 @@ class OverworldMap {
|
||||
Graphics::Bitmap mapblockset16Bitmap;
|
||||
Graphics::Bitmap gfxBitmap;
|
||||
|
||||
byte* staticgfx = new byte[16]; // Need to be used to display map and not pre render it!
|
||||
byte* staticgfx =
|
||||
new byte[16]; // Need to be used to display map and not pre render it!
|
||||
ushort** tilesUsed;
|
||||
|
||||
bool needRefresh = false;
|
||||
Utils::ROM rom_;
|
||||
Data::ROM rom_;
|
||||
|
||||
byte *currentOWgfx16Ptr = new byte[(128 * 512) / 2];
|
||||
byte* currentOWgfx16Ptr = new byte[(128 * 512) / 2];
|
||||
std::vector<Graphics::Tile16> tiles16_;
|
||||
|
||||
OverworldMap(Utils::ROM rom, const std::vector<Graphics::Tile16> tiles16, byte index);
|
||||
void BuildMap(byte* mapParent, int count, int gameState, ushort** allmapsTilesLW, ushort** allmapsTilesDW, ushort** allmapsTilesSP);
|
||||
OverworldMap(Data::ROM rom, const std::vector<Graphics::Tile16> tiles16,
|
||||
byte index);
|
||||
void BuildMap(byte* mapParent, int count, int gameState,
|
||||
ushort** allmapsTilesLW, ushort** allmapsTilesDW,
|
||||
ushort** allmapsTilesSP);
|
||||
void CopyTile8bpp16(int x, int y, int tile, int* destbmpPtr,
|
||||
int* sourcebmpPtr);
|
||||
void CopyTile8bpp16From8(int xP, int yP, int tileID, int* destbmpPtr,
|
||||
@@ -61,7 +66,7 @@ class OverworldMap {
|
||||
|
||||
void SetColorsPalette(int index, ImVec4 main, ImVec4 animated, ImVec4 aux1,
|
||||
ImVec4 aux2, ImVec4 hud, ImVec4 bgrcolor, ImVec4 spr,
|
||||
ImVec4 spr2);
|
||||
ImVec4 spr2);
|
||||
|
||||
void BuildTileset(int gameState);
|
||||
};
|
||||
@@ -1,14 +1,8 @@
|
||||
#include "ROM.h"
|
||||
|
||||
#define ROMMAPPING_LOCATION_SNES_RESERVED -1
|
||||
#define ROMMAPPING_LOCATION_SRAM -2
|
||||
#define ROMMAPPING_LOCATION_WRAM -3
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Utils {
|
||||
|
||||
using namespace Graphics;
|
||||
namespace Data {
|
||||
|
||||
void ROM::LoadFromFile(const std::string &path) {
|
||||
FILE *file = fopen(path.c_str(), "r+");
|
||||
@@ -32,16 +26,16 @@ void ROM::LoadFromFile(const std::string &path) {
|
||||
}
|
||||
|
||||
std::vector<tile8> ROM::ExtractTiles(TilePreset &preset) {
|
||||
std::cout << "Begin ROM::ExtractTiles" << std::endl;
|
||||
|
||||
std::cout << "Extracting tiles..." << std::endl;
|
||||
uint filePos = 0;
|
||||
uint size_out = 0;
|
||||
uint size = preset.length;
|
||||
int tilePos = preset.pcTilesLocation;
|
||||
std::vector<tile8> rawTiles;
|
||||
|
||||
filePos = getRomPosition(preset, tilePos, preset.SNESTilesLocation);
|
||||
|
||||
std::cout << "ROM Position: " << filePos << " from "
|
||||
<< preset.SNESTilesLocation << std::endl;
|
||||
|
||||
// decompress the graphics
|
||||
char *data = (char *)malloc(sizeof(char) * size);
|
||||
memcpy(data, (rom_data_ + filePos), size);
|
||||
@@ -52,7 +46,6 @@ std::vector<tile8> ROM::ExtractTiles(TilePreset &preset) {
|
||||
std::cout << alttp_decompression_error << std::endl;
|
||||
return rawTiles;
|
||||
}
|
||||
|
||||
// unpack the tiles based on their depth
|
||||
unsigned tileCpt = 0;
|
||||
std::cout << "Unpacking tiles..." << std::endl;
|
||||
@@ -62,8 +55,9 @@ std::vector<tile8> ROM::ExtractTiles(TilePreset &preset) {
|
||||
rawTiles.push_back(newTile);
|
||||
tileCpt++;
|
||||
}
|
||||
std::cout << "End ROM::ExtractTiles" << std::endl;
|
||||
std::cout << "Done unpacking tiles" << std::endl;
|
||||
free(data);
|
||||
std::cout << "Done extracting tiles." << std::endl;
|
||||
return rawTiles;
|
||||
}
|
||||
|
||||
@@ -118,6 +112,6 @@ short ROM::AddressFromBytes(byte addr1, byte addr2) {
|
||||
return (short)((addr1 << 8) | (addr2));
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Data
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "Core/Constants.h"
|
||||
#include "Graphics/Tile.h"
|
||||
#include "compressions/alttpcompression.h"
|
||||
@@ -19,7 +18,7 @@
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Utils {
|
||||
namespace Data {
|
||||
|
||||
using byte = unsigned char;
|
||||
using ushort = unsigned short;
|
||||
@@ -61,7 +60,7 @@ class ROM {
|
||||
unsigned char title[21] = "ROM Not Loaded";
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Data
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
|
||||
@@ -413,7 +413,7 @@ void Editor::DrawProjectEditor() {
|
||||
const float GRID_STEP = 8.0f;
|
||||
float x = fmodf(scrolling.x, GRID_STEP);
|
||||
float y = fmodf(scrolling.y, GRID_STEP);
|
||||
draw_list->AddImage((void*)(intptr_t)value,
|
||||
draw_list->AddImage((void *)(SDL_Surface *)value,
|
||||
ImVec2(canvas_p0.x + x, canvas_p0.y),
|
||||
ImVec2(canvas_p0.x + x, canvas_p1.y));
|
||||
x += GRID_STEP;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Core/Constants.h"
|
||||
#include "Core/Icons.h"
|
||||
#include "OverworldEditor.h"
|
||||
#include "Utils/ROM.h"
|
||||
#include "Data/ROM.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
@@ -40,7 +40,7 @@ class Editor {
|
||||
void *rom_data_;
|
||||
bool isLoaded = true;
|
||||
|
||||
Utils::ROM rom;
|
||||
Data::ROM rom;
|
||||
TextEditor asm_editor_;
|
||||
TextEditor::LanguageDefinition language65816Def;
|
||||
OverworldEditor overworld_editor_;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#include "Core/Icons.h"
|
||||
#include "Data/Overworld.h"
|
||||
#include "Data/OW/Overworld.h"
|
||||
#include "Graphics/Palette.h"
|
||||
#include "Graphics/Scene.h"
|
||||
#include "Graphics/Tile.h"
|
||||
@@ -21,7 +21,7 @@ class OverworldEditor {
|
||||
public:
|
||||
void Update();
|
||||
|
||||
void SetRom(Utils::ROM &rom) { rom_ = rom; }
|
||||
void SetRom(Data::ROM &rom) { rom_ = rom; }
|
||||
|
||||
private:
|
||||
void DrawToolset();
|
||||
@@ -33,7 +33,7 @@ class OverworldEditor {
|
||||
|
||||
bool show_changelist_ = false;
|
||||
|
||||
Utils::ROM rom_;
|
||||
Data::ROM rom_;
|
||||
Data::Overworld overworld;
|
||||
Graphics::Scene current_scene_;
|
||||
Graphics::Bitmap allgfxBitmap;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "Bitmap.h"
|
||||
|
||||
#include "Utils/ROM.h"
|
||||
#include "Data/ROM.h"
|
||||
#include "rommapping.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -10,16 +10,16 @@ namespace Graphics {
|
||||
int GetPCGfxAddress(char *romData, char id) {
|
||||
char **info1, **info2, **info3, **info4;
|
||||
int gfxPointer1 =
|
||||
lorom_snes_to_pc((romData[Constants::gfx_1_pointer + 1] << 8) +
|
||||
(romData[Constants::gfx_1_pointer]),
|
||||
lorom_snes_to_pc((romData[Core::Constants::gfx_1_pointer + 1] << 8) +
|
||||
(romData[Core::Constants::gfx_1_pointer]),
|
||||
info1);
|
||||
int gfxPointer2 =
|
||||
lorom_snes_to_pc((romData[Constants::gfx_2_pointer + 1] << 8) +
|
||||
(romData[Constants::gfx_2_pointer]),
|
||||
lorom_snes_to_pc((romData[Core::Constants::gfx_2_pointer + 1] << 8) +
|
||||
(romData[Core::Constants::gfx_2_pointer]),
|
||||
info2);
|
||||
int gfxPointer3 =
|
||||
lorom_snes_to_pc((romData[Constants::gfx_3_pointer + 1] << 8) +
|
||||
(romData[Constants::gfx_3_pointer]),
|
||||
lorom_snes_to_pc((romData[Core::Constants::gfx_3_pointer + 1] << 8) +
|
||||
(romData[Core::Constants::gfx_3_pointer]),
|
||||
info3);
|
||||
|
||||
char gfxGamePointer1 = romData[gfxPointer1 + id];
|
||||
@@ -27,8 +27,7 @@ int GetPCGfxAddress(char *romData, char id) {
|
||||
char gfxGamePointer3 = romData[gfxPointer3 + id];
|
||||
|
||||
return lorom_snes_to_pc(
|
||||
Utils::AddressFromBytes(gfxGamePointer1, gfxGamePointer2,
|
||||
gfxGamePointer3),
|
||||
Data::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
|
||||
info4);
|
||||
}
|
||||
|
||||
@@ -45,7 +44,7 @@ char *CreateAllGfxDataRaw(char *romData) {
|
||||
unsigned int uncompressedSize = 0;
|
||||
unsigned int compressedSize = 0;
|
||||
|
||||
for (int i = 0; i < Constants::NumberOfSheets; i++) {
|
||||
for (int i = 0; i < Core::Constants::NumberOfSheets; i++) {
|
||||
isbpp3[i] = ((i >= 0 && i <= 112) || // Compressed 3bpp bg
|
||||
(i >= 115 && i <= 126) || // Uncompressed 3bpp sprites
|
||||
(i >= 127 && i <= 217) // Compressed 3bpp sprites
|
||||
@@ -53,15 +52,16 @@ char *CreateAllGfxDataRaw(char *romData) {
|
||||
|
||||
// uncompressed sheets
|
||||
if (i >= 115 && i <= 126) {
|
||||
data = new char[Constants::Uncompressed3BPPSize];
|
||||
data = new char[Core::Constants::Uncompressed3BPPSize];
|
||||
int startAddress = GetPCGfxAddress(romData, (char)i);
|
||||
for (int j = 0; j < Constants::Uncompressed3BPPSize; j++) {
|
||||
for (int j = 0; j < Core::Constants::Uncompressed3BPPSize; j++) {
|
||||
data[j] = romData[j + startAddress];
|
||||
}
|
||||
} else {
|
||||
data = alttp_decompress_gfx(
|
||||
(char *)romData, GetPCGfxAddress(romData, (char)i),
|
||||
Constants::UncompressedSheetSize, &uncompressedSize, &compressedSize);
|
||||
data = alttp_decompress_gfx((char *)romData,
|
||||
GetPCGfxAddress(romData, (char)i),
|
||||
Core::Constants::UncompressedSheetSize,
|
||||
&uncompressedSize, &compressedSize);
|
||||
}
|
||||
|
||||
for (int j = 0; j < sizeof(data); j++) {
|
||||
@@ -83,7 +83,7 @@ void CreateAllGfxData(char *romData, char *allgfx16Ptr) {
|
||||
int sheetPosition = 0;
|
||||
|
||||
// 8x8 tile
|
||||
for (int s = 0; s < Constants::NumberOfSheets; s++) // Per Sheet
|
||||
for (int s = 0; s < Core::Constants::NumberOfSheets; s++) // Per Sheet
|
||||
{
|
||||
for (int j = 0; j < 4; j++) // Per Tile Line Y
|
||||
{
|
||||
@@ -161,9 +161,9 @@ void CreateAllGfxData(char *romData, char *allgfx16Ptr) {
|
||||
}
|
||||
|
||||
if (isbpp3[s]) {
|
||||
sheetPosition += Constants::Uncompressed3BPPSize;
|
||||
sheetPosition += Core::Constants::Uncompressed3BPPSize;
|
||||
} else {
|
||||
sheetPosition += Constants::UncompressedSheetSize;
|
||||
sheetPosition += Core::Constants::UncompressedSheetSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
// #include "GL/glew.h"
|
||||
#include "Utils/ROM.h"
|
||||
#include "Core/Constants.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Graphics {
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class Bitmap {
|
||||
public:
|
||||
Bitmap() = default;
|
||||
@@ -33,7 +30,7 @@ class Bitmap {
|
||||
char *pixel_data_;
|
||||
};
|
||||
|
||||
static bool isbpp3[Constants::NumberOfSheets];
|
||||
static bool isbpp3[Core::Constants::NumberOfSheets];
|
||||
|
||||
int GetPCGfxAddress(char *romData, char id);
|
||||
char *CreateAllGfxDataRaw(char *romData);
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
|
||||
#include "png.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace Application {
|
||||
namespace Graphics {
|
||||
|
||||
Reference in New Issue
Block a user