Merge remote-tracking branch 'refs/remotes/origin/master'
Merge changes made on visual studio repo.
This commit is contained in:
@@ -112,7 +112,7 @@ void GfxGroupEditor::DrawBlocksetViewer(bool sheet_only) {
|
||||
BeginGroup();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
|
||||
auto sheet = rom()->gfx_sheets().at(sheet_id);
|
||||
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id);
|
||||
gui::BitmapCanvasPipeline(blockset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||
0x20, true, false, 22);
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void GfxGroupEditor::DrawRoomsetViewer() {
|
||||
BeginGroup();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int sheet_id = rom()->room_blockset_ids[selected_roomset_][i];
|
||||
auto sheet = rom()->gfx_sheets().at(sheet_id);
|
||||
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id);
|
||||
gui::BitmapCanvasPipeline(roomset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||
0x20, true, false, 23);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void GfxGroupEditor::DrawSpritesetViewer(bool sheet_only) {
|
||||
BeginGroup();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int sheet_id = rom()->spriteset_ids[selected_spriteset_][i];
|
||||
auto sheet = rom()->gfx_sheets().at(115 + sheet_id);
|
||||
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(115 + sheet_id);
|
||||
gui::BitmapCanvasPipeline(spriteset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||
0x20, true, false, 24);
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ absl::Status GraphicsEditor::Update() {
|
||||
status_ = UpdateGfxEdit();
|
||||
TAB_ITEM("Sheet Browser")
|
||||
if (asset_browser_.Initialized == false) {
|
||||
asset_browser_.Initialize(rom()->gfx_sheets());
|
||||
asset_browser_.Initialize(GraphicsSheetManager::GetInstance().gfx_sheets());
|
||||
}
|
||||
asset_browser_.Draw(rom()->gfx_sheets());
|
||||
asset_browser_.Draw(GraphicsSheetManager::GetInstance().gfx_sheets());
|
||||
END_TAB_ITEM()
|
||||
status_ = UpdateScadView();
|
||||
status_ = UpdateLinkGfxView();
|
||||
@@ -117,7 +117,7 @@ void GraphicsEditor::DrawGfxEditToolset() {
|
||||
TableNextColumn();
|
||||
if (Button(ICON_MD_CONTENT_COPY)) {
|
||||
std::vector<uint8_t> png_data =
|
||||
rom()->gfx_sheets().at(current_sheet_).GetPngData();
|
||||
GraphicsSheetManager::GetInstance().gfx_sheets().at(current_sheet_).GetPngData();
|
||||
core::CopyImageToClipboard(png_data);
|
||||
}
|
||||
HOVER_HINT("Copy to Clipboard");
|
||||
@@ -128,12 +128,11 @@ void GraphicsEditor::DrawGfxEditToolset() {
|
||||
int width, height;
|
||||
core::GetImageFromClipboard(png_data, width, height);
|
||||
if (png_data.size() > 0) {
|
||||
rom()
|
||||
->mutable_gfx_sheets()
|
||||
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()
|
||||
->at(current_sheet_)
|
||||
.Create(width, height, 8, png_data);
|
||||
Renderer::GetInstance().UpdateBitmap(
|
||||
&rom()->mutable_gfx_sheets()->at(current_sheet_));
|
||||
&GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(current_sheet_));
|
||||
}
|
||||
}
|
||||
HOVER_HINT("Paste from Clipboard");
|
||||
@@ -153,9 +152,9 @@ void GraphicsEditor::DrawGfxEditToolset() {
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
auto bitmap = rom()->gfx_sheets()[current_sheet_];
|
||||
auto bitmap = GraphicsSheetManager::GetInstance().gfx_sheets()[current_sheet_];
|
||||
auto palette = bitmap.palette();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < palette.size(); i++) {
|
||||
ImGui::SameLine();
|
||||
auto color =
|
||||
ImVec4(palette[i].rgb().x / 255.0f, palette[i].rgb().y / 255.0f,
|
||||
@@ -192,7 +191,7 @@ absl::Status GraphicsEditor::UpdateGfxSheetList() {
|
||||
(int)ms_io->RangeSrcItem); // Ensure RangeSrc item is not clipped.
|
||||
|
||||
int key = 0;
|
||||
for (auto& value : rom()->gfx_sheets()) {
|
||||
for (auto& value : GraphicsSheetManager::GetInstance().gfx_sheets()) {
|
||||
ImGui::BeginChild(absl::StrFormat("##GfxSheet%02X", key).c_str(),
|
||||
ImVec2(0x100 + 1, 0x40 + 1), true,
|
||||
ImGuiWindowFlags_NoDecoration);
|
||||
@@ -281,7 +280,7 @@ absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar |
|
||||
ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
||||
|
||||
gfx::Bitmap& current_bitmap = rom()->mutable_gfx_sheets()->at(sheet_id);
|
||||
gfx::Bitmap& current_bitmap = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id);
|
||||
|
||||
auto draw_tile_event = [&]() {
|
||||
current_sheet_canvas_.DrawTileOnBitmap(tile_size_, ¤t_bitmap,
|
||||
@@ -290,7 +289,7 @@ absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
};
|
||||
|
||||
current_sheet_canvas_.UpdateColorPainter(
|
||||
rom()->mutable_gfx_sheets()->at(sheet_id), current_color_,
|
||||
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id), current_color_,
|
||||
draw_tile_event, tile_size_, current_scale_);
|
||||
|
||||
ImGui::EndChild();
|
||||
@@ -323,7 +322,7 @@ absl::Status GraphicsEditor::UpdateGfxTabView() {
|
||||
current_sheet_ = id;
|
||||
// ImVec2(0x100, 0x40),
|
||||
current_sheet_canvas_.UpdateColorPainter(
|
||||
rom()->mutable_gfx_sheets()->at(id), current_color_,
|
||||
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(id), current_color_,
|
||||
[&]() {
|
||||
|
||||
},
|
||||
@@ -360,12 +359,11 @@ absl::Status GraphicsEditor::UpdatePaletteColumn() {
|
||||
|
||||
if (refresh_graphics_ && !open_sheets_.empty()) {
|
||||
RETURN_IF_ERROR(
|
||||
rom()
|
||||
->mutable_gfx_sheets()
|
||||
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()
|
||||
->data()[current_sheet_]
|
||||
.ApplyPaletteWithTransparent(palette, edit_palette_sub_index_));
|
||||
Renderer::GetInstance().UpdateBitmap(
|
||||
&rom()->mutable_gfx_sheets()->data()[current_sheet_]);
|
||||
&GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->data()[current_sheet_]);
|
||||
refresh_graphics_ = false;
|
||||
}
|
||||
}
|
||||
@@ -387,7 +385,7 @@ absl::Status GraphicsEditor::UpdateLinkGfxView() {
|
||||
link_canvas_.DrawGrid(16.0f);
|
||||
|
||||
int i = 0;
|
||||
for (auto link_sheet : *rom()->mutable_link_graphics()) {
|
||||
for (auto& link_sheet : link_sheets_) {
|
||||
int x_offset = 0;
|
||||
int y_offset = gfx::kTilesheetHeight * i * 4;
|
||||
link_canvas_.DrawContextMenu(&link_sheet);
|
||||
@@ -404,7 +402,7 @@ absl::Status GraphicsEditor::UpdateLinkGfxView() {
|
||||
if (ImGui::Button("Load Link Graphics (Experimental)")) {
|
||||
if (rom()->is_loaded()) {
|
||||
// Load Links graphics from the ROM
|
||||
RETURN_IF_ERROR(rom()->LoadLinkGraphics());
|
||||
ASSIGN_OR_RETURN(link_sheets_, LoadLinkGraphics(*rom()));
|
||||
|
||||
// Split it into the pose data frames
|
||||
// Create an animation step display for the poses
|
||||
|
||||
@@ -159,7 +159,7 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
|
||||
Rom temp_rom_;
|
||||
Rom tilemap_rom_;
|
||||
zelda3::Overworld overworld_;
|
||||
zelda3::Overworld overworld_{ temp_rom_ };
|
||||
MemoryEditor cgx_memory_editor_;
|
||||
MemoryEditor col_memory_editor_;
|
||||
PaletteEditor palette_editor_;
|
||||
@@ -176,6 +176,7 @@ class GraphicsEditor : public SharedRom, public Editor {
|
||||
gfx::Bitmap bin_bitmap_;
|
||||
gfx::Bitmap link_full_sheet_;
|
||||
std::array<gfx::Bitmap, kNumGfxSheets> gfx_sheets_;
|
||||
std::array<gfx::Bitmap, kNumLinkSheets> link_sheets_;
|
||||
|
||||
gfx::PaletteGroup col_file_palette_group_;
|
||||
gfx::SnesPalette z3_rom_palette_;
|
||||
|
||||
@@ -383,10 +383,10 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
||||
|
||||
if (LoadDungeonMapTile16(rom()->graphics_buffer()).ok()) {
|
||||
// TODO: Load roomset gfx based on dungeon ID
|
||||
sheets_.emplace(0, rom()->gfx_sheets()[212]);
|
||||
sheets_.emplace(1, rom()->gfx_sheets()[213]);
|
||||
sheets_.emplace(2, rom()->gfx_sheets()[214]);
|
||||
sheets_.emplace(3, rom()->gfx_sheets()[215]);
|
||||
sheets_.emplace(0, GraphicsSheetManager::GetInstance().gfx_sheets()[212]);
|
||||
sheets_.emplace(1, GraphicsSheetManager::GetInstance().gfx_sheets()[213]);
|
||||
sheets_.emplace(2, GraphicsSheetManager::GetInstance().gfx_sheets()[214]);
|
||||
sheets_.emplace(3, GraphicsSheetManager::GetInstance().gfx_sheets()[215]);
|
||||
int current_tile8 = 0;
|
||||
int tile_data_offset = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
@@ -43,12 +43,12 @@ using ImGui::Text;
|
||||
|
||||
absl::Status Tile16Editor::InitBlockset(
|
||||
const gfx::Bitmap &tile16_blockset_bmp, const gfx::Bitmap ¤t_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap> &tile16_individual,
|
||||
std::array<uint8_t, 0x200> &all_tiles_types) {
|
||||
all_tiles_types_ = all_tiles_types;
|
||||
tile16_blockset_bmp_ = tile16_blockset_bmp;
|
||||
tile16_individual_ = tile16_individual;
|
||||
current_gfx_bmp_ = current_gfx_bmp;
|
||||
current_gfx_bmp_.Create(current_gfx_bmp.width(), current_gfx_bmp.height(),
|
||||
current_gfx_bmp.depth(), current_gfx_bmp.vector());
|
||||
core::Renderer::GetInstance().RenderBitmap(&tile16_blockset_bmp_);
|
||||
RETURN_IF_ERROR(LoadTile8());
|
||||
ImVector<std::string> tile16_names;
|
||||
for (int i = 0; i < 0x200; ++i) {
|
||||
@@ -373,7 +373,7 @@ absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||
|
||||
// TODO: Implement tile16 transfer
|
||||
if (transfer_started_ && !transfer_blockset_loaded_) {
|
||||
PRINT_IF_ERROR(transfer_rom_.LoadAllGraphicsData())
|
||||
ASSIGN_OR_RETURN(transfer_gfx_, LoadAllGraphicsData(transfer_rom_))
|
||||
|
||||
// Load the Link to the Past overworld.
|
||||
PRINT_IF_ERROR(transfer_overworld_.Load(transfer_rom_))
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||
#define YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
@@ -20,9 +23,9 @@ namespace editor {
|
||||
*/
|
||||
class Tile16Editor : public gfx::GfxContext, public SharedRom {
|
||||
public:
|
||||
Tile16Editor(std::array<gfx::Bitmap, zelda3::kNumTile16Individual>& tile16_individual) : tile16_individual_(tile16_individual) {}
|
||||
absl::Status InitBlockset(const gfx::Bitmap &tile16_blockset_bmp,
|
||||
const gfx::Bitmap ¤t_gfx_bmp,
|
||||
const std::vector<gfx::Bitmap> &tile16_individual,
|
||||
std::array<uint8_t, 0x200> &all_tiles_types);
|
||||
|
||||
absl::Status Update();
|
||||
@@ -82,17 +85,17 @@ class Tile16Editor : public gfx::GfxContext, public SharedRom {
|
||||
gui::Canvas transfer_canvas_;
|
||||
gfx::Bitmap transfer_blockset_bmp_;
|
||||
|
||||
std::vector<gfx::Bitmap> tile16_individual_;
|
||||
std::array<gfx::Bitmap, zelda3::kNumTile16Individual>& tile16_individual_;
|
||||
std::vector<gfx::Bitmap> current_gfx_individual_;
|
||||
|
||||
PaletteEditor palette_editor_;
|
||||
|
||||
gfx::SnesPalette palette_;
|
||||
zelda3::Overworld transfer_overworld_;
|
||||
|
||||
absl::Status status_;
|
||||
|
||||
Rom transfer_rom_;
|
||||
zelda3::Overworld transfer_overworld_{ transfer_rom_ };
|
||||
std::array<gfx::Bitmap, kNumGfxSheets> transfer_gfx_;
|
||||
absl::Status transfer_status_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user