housekeeping

This commit is contained in:
Justin Scofield
2022-06-20 14:49:02 -04:00
parent 9c7c9bc1e4
commit f7d793ecc2
19 changed files with 84 additions and 56 deletions

View File

@@ -0,0 +1 @@
#include "app/core/constants.h"

View File

@@ -1,8 +1,10 @@
#include "bitmap.h"
#include <SDL2/SDL.h>
#include <rommapping.h>
#include "rom.h"
#include "app/core/constants.h"
#include "app/rom.h"
namespace yaze {
namespace app {
@@ -28,7 +30,7 @@ int GetPCGfxAddress(char *romData, char id) {
char gfxGamePointer3 = romData[gfxPointer3 + id];
return lorom_snes_to_pc(
AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
yaze::app::rom::AddressFromBytes(gfxGamePointer1, gfxGamePointer2, gfxGamePointer3),
info1);
}

View File

@@ -2,8 +2,10 @@
#define YAZE_APP_UTILS_BITMAP_H
#include <SDL2/SDL.h>
#include <rommapping.h>
#include "Core/constants.h"
#include "app/core/constants.h"
#include "app/rom.h"
namespace yaze {
namespace app {

View File

@@ -1,7 +1,17 @@
#include "palette.h"
#include "snes_palette.h"
#include <SDL2/SDL.h>
#include <imgui/imgui.h>
#include <palette.h>
#include <tile.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
#include <vector>
namespace yaze {
namespace app {
@@ -57,7 +67,7 @@ SNESPalette::SNESPalette(const unsigned char* snes_pal) {
size_ = sizeof(snes_pal) / 2;
for (unsigned i = 0; i < sizeof(snes_pal); i += 2) {
SNESColor col;
col.snes = snes_pal[i + 1] << (uint16_t) 8;
col.snes = snes_pal[i + 1] << (uint16_t)8;
col.snes = col.snes | snes_pal[i];
m_color mColor = convertcolor_snes_to_rgb(col.snes);
col.rgb = ImVec4(mColor.red, mColor.green, mColor.blue, 1.f);

View File

@@ -7,6 +7,8 @@
#include <tile.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
#include <vector>

View File

@@ -13,8 +13,8 @@
#include <unordered_map>
#include <vector>
#include "app/core/constants.h"
#include "app/gfx/palette.h"
#include "app/gfx/snes_palette.h"
namespace yaze {
namespace app {

View File

@@ -14,13 +14,17 @@
#include <unordered_map>
#include <vector>
#include "app/core/constants.h"
#include "app/gfx/palette.h"
#include "app/gfx/snes_palette.h"
namespace yaze {
namespace app {
namespace gfx {
using ushort = unsigned short;
using uchar = unsigned char;
using ulong = unsigned long;
using uint = unsigned int;
// vhopppcc cccccccc
// [0, 1]
// [2, 3]

View File

@@ -18,7 +18,7 @@
namespace yaze {
namespace app {
namespace rom {
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3) {
return (addr1 << 16) | (addr2 << 8) | addr3;
}
@@ -301,6 +301,6 @@ SDL_Texture *ROM::DrawgfxSheet(int offset) {
}
return sheet_texture;
}
} // namespace rom
} // namespace app
} // namespace yaze

View File

@@ -19,7 +19,7 @@
namespace yaze {
namespace app {
namespace rom {
int AddressFromBytes(uchar addr1, uchar addr2, uchar addr3);
class ROM {
@@ -68,6 +68,7 @@ class ROM {
std::shared_ptr<SDL_Renderer> sdl_renderer_;
};
} // namespace rom
} // namespace app
} // namespace yaze

View File

@@ -1,7 +1,7 @@
#include "overworld.h"
#include "gfx/tile.h"
#include "rom.h"
#include "app/gfx/tile.h"
#include "app/rom.h"
namespace yaze {
namespace app {
@@ -41,7 +41,7 @@ static TileInfo GetTilesInfo(ushort tile) {
return TileInfo(tid, p, v, h, o);
}
void Overworld::Load(ROM& rom) {
void Overworld::Load(app::rom::ROM& rom) {
rom_ = rom;
for (int i = 0; i < 0x2B; i++) {
tileLeftEntrance.push_back(constants::overworldEntranceAllowedTilesLeft +

View File

@@ -6,11 +6,11 @@
#include <memory>
#include <vector>
#include "Core/constants.h"
#include "gfx/bitmap.h"
#include "gfx/tile.h"
#include "overworld_map.h"
#include "rom.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/tile.h"
#include "app/rom.h"
#include "app/zelda3/overworld_map.h"
namespace yaze {
namespace app {
@@ -21,7 +21,7 @@ class Overworld {
Overworld() = default;
~Overworld();
void Load(ROM& rom);
void Load(app::rom::ROM& rom);
char* overworldMapPointer = new char[0x40000];
gfx::Bitmap* overworldMapBitmap;
@@ -30,7 +30,7 @@ class Overworld {
gfx::Bitmap* owactualMapBitmap;
private:
ROM rom_;
app::rom::ROM rom_;
int gameState = 1;
bool isLoaded = false;
uchar mapParent[160];

View File

@@ -1,7 +1,11 @@
#include "overworld_map.h"
#include "gfx/tile.h"
#include "rom.h"
#include <cstddef>
#include <memory>
#include "app/gfx/bitmap.h"
#include "app/gfx/tile.h"
#include "app/rom.h"
namespace yaze {
namespace app {
@@ -10,7 +14,7 @@ namespace zelda3 {
using namespace core;
using namespace gfx;
OverworldMap::OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16,
OverworldMap::OverworldMap(app::rom::ROM& rom, const std::vector<gfx::Tile16> tiles16,
uchar index)
: rom_(rom), index(index), tiles16_(tiles16), parent(index) {
if (index != 0x80) {

View File

@@ -3,9 +3,9 @@
#include <cstddef>
#include <memory>
#include "gfx/bitmap.h"
#include "gfx/tile.h"
#include "rom.h"
#include "app/gfx/bitmap.h"
#include "app/gfx/tile.h"
#include "app/rom.h"
namespace yaze {
namespace app {
@@ -37,12 +37,12 @@ class OverworldMap {
ushort** tilesUsed;
bool needRefresh = false;
ROM rom_;
app::rom::ROM rom_;
uchar* currentOWgfx16Ptr = new uchar[(128 * 512) / 2];
std::vector<gfx::Tile16> tiles16_;
OverworldMap(ROM& rom, const std::vector<gfx::Tile16> tiles16, uchar index);
OverworldMap(app::rom::ROM& rom, const std::vector<gfx::Tile16> tiles16, uchar index);
void BuildMap(uchar* mapParent, int count, int gameState,
ushort** allmapsTilesLW, ushort** allmapsTilesDW,
ushort** allmapsTilesSP);