overworld housekeeping
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
#include "overworld_editor.h"
|
#include "overworld_editor.h"
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
@@ -116,7 +117,7 @@ void OverworldEditor::DrawToolset() {
|
|||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::Button(ICON_MD_UPDATE)) {
|
if (ImGui::Button(ICON_MD_UPDATE)) {
|
||||||
overworld_.Load(rom_, allgfxBitmap.GetData());
|
overworld_.Load(rom_);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
#ifndef YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
||||||
#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
#define YAZE_APP_EDITOR_OVERWORLDEDITOR_H
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
@@ -77,7 +80,7 @@ class OverworldEditor {
|
|||||||
ImGuiTableFlags_SizingStretchSame;
|
ImGuiTableFlags_SizingStretchSame;
|
||||||
};
|
};
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace gui
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "app/core/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|||||||
@@ -10,11 +10,8 @@ namespace zelda3 {
|
|||||||
using namespace core;
|
using namespace core;
|
||||||
using namespace gfx;
|
using namespace gfx;
|
||||||
|
|
||||||
|
void Overworld::Load(ROM& rom) {
|
||||||
|
|
||||||
void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
|
|
||||||
rom_ = rom;
|
rom_ = rom;
|
||||||
allGfx16Ptr = allGfxPtr;
|
|
||||||
|
|
||||||
overworldMapPointer = std::make_shared<uchar[]>(0x40000);
|
overworldMapPointer = std::make_shared<uchar[]>(0x40000);
|
||||||
mapblockset16 = std::make_shared<uchar[]>(1048576);
|
mapblockset16 = std::make_shared<uchar[]>(1048576);
|
||||||
@@ -35,8 +32,7 @@ void Overworld::Load(ROM& rom, uchar* allGfxPtr) {
|
|||||||
for (int i = 0; i < 160; i++) {
|
for (int i = 0; i < 160; i++) {
|
||||||
overworld_maps_[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
|
overworld_maps_[i].BuildMap(mapParent, size, gameState, allmapsTilesLW,
|
||||||
allmapsTilesDW, allmapsTilesSP,
|
allmapsTilesDW, allmapsTilesSP,
|
||||||
currentOWgfx16Ptr.get(), allGfx16Ptr,
|
currentOWgfx16Ptr.get(), mapblockset16.get());
|
||||||
mapblockset16.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|||||||
@@ -19,14 +19,11 @@ namespace zelda3 {
|
|||||||
|
|
||||||
class Overworld {
|
class Overworld {
|
||||||
public:
|
public:
|
||||||
void Load(ROM& rom, uchar* allGfxPtr);
|
void Load(ROM& rom);
|
||||||
auto GetTiles16() const { return tiles16; }
|
auto GetTiles16() const { return tiles16; }
|
||||||
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
|
auto GetCurrentGfxSetPtr() { return currentOWgfx16Ptr; }
|
||||||
auto GetMapBlockset16Ptr() { return mapblockset16; }
|
auto GetMapBlockset16Ptr() { return mapblockset16; }
|
||||||
|
|
||||||
std::shared_ptr<uchar[]> overworldMapPointer;
|
|
||||||
gfx::Bitmap overworldMapBitmap;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ushort GenerateTile32(int i, int k, int dimension);
|
ushort GenerateTile32(int i, int k, int dimension);
|
||||||
void AssembleMap32Tiles();
|
void AssembleMap32Tiles();
|
||||||
@@ -44,7 +41,6 @@ class Overworld {
|
|||||||
std::vector<std::vector<ushort>> allmapsTilesDW; // 64 maps * (32*32 tiles)
|
std::vector<std::vector<ushort>> allmapsTilesDW; // 64 maps * (32*32 tiles)
|
||||||
std::vector<std::vector<ushort>> allmapsTilesSP; // 32 maps * (32*32 tiles)
|
std::vector<std::vector<ushort>> allmapsTilesSP; // 32 maps * (32*32 tiles)
|
||||||
|
|
||||||
uchar* allGfx16Ptr = nullptr;
|
|
||||||
std::shared_ptr<uchar[]> mapblockset16;
|
std::shared_ptr<uchar[]> mapblockset16;
|
||||||
std::shared_ptr<uchar[]> currentOWgfx16Ptr;
|
std::shared_ptr<uchar[]> currentOWgfx16Ptr;
|
||||||
|
|
||||||
@@ -53,6 +49,9 @@ class Overworld {
|
|||||||
std::vector<gfx::Tile32> map16tiles;
|
std::vector<gfx::Tile32> map16tiles;
|
||||||
std::vector<OverworldMap> overworld_maps_;
|
std::vector<OverworldMap> overworld_maps_;
|
||||||
|
|
||||||
|
gfx::Bitmap overworldMapBitmap;
|
||||||
|
std::shared_ptr<uchar[]> overworldMapPointer;
|
||||||
|
|
||||||
const int map32address[4] = {
|
const int map32address[4] = {
|
||||||
core::constants::map32TilesTL, core::constants::map32TilesTR,
|
core::constants::map32TilesTL, core::constants::map32TilesTR,
|
||||||
core::constants::map32TilesBL, core::constants::map32TilesBR};
|
core::constants::map32TilesBL, core::constants::map32TilesBR};
|
||||||
|
|||||||
@@ -117,10 +117,8 @@ void OverworldMap::BuildMap(uchar* mapparent_, int count, int gameState,
|
|||||||
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
||||||
std::vector<std::vector<ushort>>& allmapsTilesDW,
|
std::vector<std::vector<ushort>>& allmapsTilesDW,
|
||||||
std::vector<std::vector<ushort>>& allmapsTilesSP,
|
std::vector<std::vector<ushort>>& allmapsTilesSP,
|
||||||
uchar* currentOWgfx16Ptr, uchar* allGfxPtr,
|
uchar* currentOWgfx16Ptr, uchar* mapblockset16) {
|
||||||
uchar* mapblockset16) {
|
|
||||||
currentOWgfx16Ptr_ = currentOWgfx16Ptr;
|
currentOWgfx16Ptr_ = currentOWgfx16Ptr;
|
||||||
allGfx16Ptr_ = allGfxPtr;
|
|
||||||
mapblockset16_ = mapblockset16;
|
mapblockset16_ = mapblockset16;
|
||||||
|
|
||||||
if (large_map_) {
|
if (large_map_) {
|
||||||
@@ -190,6 +188,7 @@ void OverworldMap::CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
|
|||||||
void OverworldMap::CopyTile8bpp16From8(int xP, int yP, int tileID,
|
void OverworldMap::CopyTile8bpp16From8(int xP, int yP, int tileID,
|
||||||
uchar* destbmpPtr, uchar* sourcebmpPtr) {
|
uchar* destbmpPtr, uchar* sourcebmpPtr) {
|
||||||
auto gfx16Data = destbmpPtr;
|
auto gfx16Data = destbmpPtr;
|
||||||
|
// TODO: PSUEDO VRAM
|
||||||
auto gfx8Data = currentOWgfx16Ptr_;
|
auto gfx8Data = currentOWgfx16Ptr_;
|
||||||
|
|
||||||
int offsets[] = {0, 8, 4096, 4104};
|
int offsets[] = {0, 8, 4096, 4104};
|
||||||
@@ -343,7 +342,9 @@ void OverworldMap::BuildTileset(int gameState) {
|
|||||||
staticgfx[7] = 91;
|
staticgfx[7] = 91;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: PSUEDO VRAM DATA HERE
|
||||||
uchar* currentmapgfx8Data = currentOWgfx16Ptr_;
|
uchar* currentmapgfx8Data = currentOWgfx16Ptr_;
|
||||||
|
// TODO: PUT GRAPHICS DATA HERE
|
||||||
uchar const* allgfxData = allGfx16Ptr_;
|
uchar const* allgfxData = allGfx16Ptr_;
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ class OverworldMap {
|
|||||||
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
std::vector<std::vector<ushort>>& allmapsTilesLW,
|
||||||
std::vector<std::vector<ushort>>& allmapsTilesDW,
|
std::vector<std::vector<ushort>>& allmapsTilesDW,
|
||||||
std::vector<std::vector<ushort>>& allmapsTilesSP,
|
std::vector<std::vector<ushort>>& allmapsTilesSP,
|
||||||
uchar* currentOWgfx16Ptr, uchar* allGfxPtr,
|
uchar* currentOWgfx16Ptr, uchar* mapblockset16);
|
||||||
uchar* mapblockset16);
|
|
||||||
void CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
|
void CopyTile8bpp16(int x, int y, int tile, uchar* destbmpPtr,
|
||||||
uchar* sourcebmpPtr);
|
uchar* sourcebmpPtr);
|
||||||
void CopyTile8bpp16From8(int xP, int yP, int tileID, uchar* destbmpPtr,
|
void CopyTile8bpp16From8(int xP, int yP, int tileID, uchar* destbmpPtr,
|
||||||
|
|||||||
Reference in New Issue
Block a user