diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef0560bc..2dd0b917 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories(Library/cmake) +include_directories(lib/cmake) include_directories(/usr/local/Cellar/libpng/1.6.37/include/libpng16/) # find libraries -------------------------------------------------------------------------------------------------- @@ -49,7 +49,7 @@ add_executable( app/core/constants.cc app/core/controller.cc app/gfx/bitmap.cc - app/gfx/tile16.cc + app/gfx/snes_tile.cc app/gfx/snes_palette.cc app/zelda3/overworld.cc app/zelda3/overworld_map.cc diff --git a/src/app/editor/editor.cc b/src/app/editor/editor.cc index 7c5888fc..21bacfd5 100644 --- a/src/app/editor/editor.cc +++ b/src/app/editor/editor.cc @@ -11,7 +11,7 @@ #include "app/editor/dungeon_editor.h" #include "app/editor/overworld_editor.h" #include "app/gfx/snes_palette.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" #include "gui/canvas.h" #include "gui/icons.h" diff --git a/src/app/editor/editor.h b/src/app/editor/editor.h index 3295c14a..1fdbf7e8 100644 --- a/src/app/editor/editor.h +++ b/src/app/editor/editor.h @@ -12,7 +12,7 @@ #include "app/editor/dungeon_editor.h" #include "app/editor/overworld_editor.h" #include "app/gfx/snes_palette.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" #include "gui/canvas.h" #include "gui/icons.h" diff --git a/src/app/editor/overworld_editor.cc b/src/app/editor/overworld_editor.cc index d394657e..abfb9e8b 100644 --- a/src/app/editor/overworld_editor.cc +++ b/src/app/editor/overworld_editor.cc @@ -6,7 +6,7 @@ #include "app/gfx/bitmap.h" #include "app/gfx/snes_palette.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/zelda3/overworld.h" #include "gui/icons.h" diff --git a/src/app/editor/overworld_editor.h b/src/app/editor/overworld_editor.h index cb474f2c..6dba8697 100644 --- a/src/app/editor/overworld_editor.h +++ b/src/app/editor/overworld_editor.h @@ -5,7 +5,7 @@ #include "app/gfx/bitmap.h" #include "app/gfx/snes_palette.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/zelda3/overworld.h" #include "gui/icons.h" diff --git a/src/app/gfx/tile16.cc b/src/app/gfx/snes_tile.cc similarity index 79% rename from src/app/gfx/tile16.cc rename to src/app/gfx/snes_tile.cc index 53167afa..f7aa4bbe 100644 --- a/src/app/gfx/tile16.cc +++ b/src/app/gfx/snes_tile.cc @@ -5,12 +5,27 @@ #include #include "app/core/constants.h" -#include "tile.h" +#include "snes_tile.h" namespace yaze { namespace app { namespace gfx { +TileInfo GetTilesInfo(ushort tile) { + // vhopppcc cccccccc + ushort o = 0; + ushort v = 0; + ushort h = 0; + auto tid = (ushort)(tile & 0x3FF); + auto p = (uchar)((tile >> 10) & 0x07); + + o = (ushort)((tile & 0x2000) >> 13); + h = (ushort)((tile & 0x4000) >> 14); + v = (ushort)((tile & 0x8000) >> 15); + + return TileInfo(tid, p, v, h, o); +} + void BuildTiles16Gfx(uchar *mapblockset16, uchar *currentOWgfx16Ptr, std::vector &allTiles) { uchar *gfx16Data = mapblockset16; diff --git a/src/app/gfx/tile.h b/src/app/gfx/snes_tile.h similarity index 93% rename from src/app/gfx/tile.h rename to src/app/gfx/snes_tile.h index 0400acf4..7c74ddf5 100644 --- a/src/app/gfx/tile.h +++ b/src/app/gfx/snes_tile.h @@ -79,6 +79,7 @@ class Tile16 { } }; +TileInfo GetTilesInfo(ushort tile); void BuildTiles16Gfx(uchar* mapblockset16, uchar* currentOWgfx16Ptr, std::vector& allTiles); void CopyTile16(int x, int y, int xx, int yy, int offset, TileInfo tile, diff --git a/src/app/rom.cc b/src/app/rom.cc index 4004c1f2..4ecf06e8 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -13,7 +13,7 @@ #include #include "app/core/constants.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" namespace yaze { namespace app { diff --git a/src/app/rom.h b/src/app/rom.h index 4c137b5f..e93602ed 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -15,7 +15,7 @@ #include "app/core/common.h" #include "app/core/constants.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" namespace yaze { namespace app { diff --git a/src/app/zelda3/overworld.cc b/src/app/zelda3/overworld.cc index 09d7f9bb..82c7727c 100644 --- a/src/app/zelda3/overworld.cc +++ b/src/app/zelda3/overworld.cc @@ -1,6 +1,6 @@ #include "overworld.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" namespace yaze { @@ -10,28 +10,15 @@ namespace zelda3 { using namespace core; using namespace gfx; -static TileInfo GetTilesInfo(ushort tile) { - // vhopppcc cccccccc - ushort o = 0; - ushort v = 0; - ushort h = 0; - auto tid = (ushort)(tile & 0x3FF); - auto p = (uchar)((tile >> 10) & 0x07); - o = (ushort)((tile & 0x2000) >> 13); - h = (ushort)((tile & 0x4000) >> 14); - v = (ushort)((tile & 0x8000) >> 15); - - return TileInfo(tid, p, v, h, o); -} void Overworld::Load(ROM& rom, uchar* allGfxPtr) { rom_ = rom; allGfx16Ptr = allGfxPtr; - overworldMapPointer = std::make_shared(0x40000); - mapblockset16 = std::make_shared(1048576); - currentOWgfx16Ptr = std::make_shared((128 * 512) / 2); + overworldMapPointer = std::make_shared(0x40000); + mapblockset16 = std::make_shared(1048576); + currentOWgfx16Ptr = std::make_shared((128 * 512) / 2); AssembleMap32Tiles(); AssembleMap16Tiles(); diff --git a/src/app/zelda3/overworld.h b/src/app/zelda3/overworld.h index ef3e0c66..1c3ff7fc 100644 --- a/src/app/zelda3/overworld.h +++ b/src/app/zelda3/overworld.h @@ -9,7 +9,7 @@ #include "app/core/constants.h" #include "app/gfx/bitmap.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" #include "app/zelda3/overworld_map.h" diff --git a/src/app/zelda3/overworld_map.cc b/src/app/zelda3/overworld_map.cc index 65460d0c..ce5ced0f 100644 --- a/src/app/zelda3/overworld_map.cc +++ b/src/app/zelda3/overworld_map.cc @@ -1,10 +1,13 @@ #include "overworld_map.h" +#include + #include #include +#include "app/core/common.h" #include "app/gfx/bitmap.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" namespace yaze { diff --git a/src/app/zelda3/overworld_map.h b/src/app/zelda3/overworld_map.h index b645e671..197b4945 100644 --- a/src/app/zelda3/overworld_map.h +++ b/src/app/zelda3/overworld_map.h @@ -3,8 +3,9 @@ #include #include +#include "app/core/common.h" #include "app/gfx/bitmap.h" -#include "app/gfx/tile.h" +#include "app/gfx/snes_tile.h" #include "app/rom.h" namespace yaze { @@ -15,13 +16,13 @@ using ushort = unsigned short; class OverworldMap { public: - int parent_ = 0; - int index_ = 0; - int message_id_ = 0; - int gfx_ = 0; - int palette_ = 0; - bool initialized_ = false; - bool large_map_ = false; + int parent_ = 0; + int index_ = 0; + int message_id_ = 0; + int gfx_ = 0; + int palette_ = 0; + bool initialized_ = false; + bool large_map_ = false; uchar sprite_graphics_[3]; uchar sprite_palette_[3]; uchar musics[4]; @@ -37,8 +38,7 @@ class OverworldMap { uchar* staticgfx = new uchar[16]; std::vector> tiles_used_; - OverworldMap(ROM& rom, const std::vector& tiles16, - int index); + OverworldMap(ROM& rom, const std::vector& tiles16, int index); void BuildMap(uchar* mapParent, int count, int gameState, std::vector>& allmapsTilesLW, std::vector>& allmapsTilesDW, diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bb9735eb..73632bfb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,8 +18,9 @@ add_executable( yaze_test yaze_test.cc ../src/app/rom.cc - ../src/app/gfx/tile16.cc + ../src/app/gfx/snes_tile.cc ../src/app/gfx/snes_palette.cc + ../src/app/core/common.cc ${SNESHACKING_PATH}/compressions/alttpcompression.c ${SNESHACKING_PATH}/compressions/stdnintendo.c ${SNESHACKING_PATH}/tile.c