diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c595a773..54818d13 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ on: type: string concurrency: - group: release-${{ github.ref_name != '' && github.ref_name || (github.event.inputs.tag != '' && github.event.inputs.tag || github.run_id) }} + group: release-${{ github.event_name }}-${{ github.ref_name || github.event.inputs.tag || github.run_id }} cancel-in-progress: true permissions: @@ -79,19 +79,27 @@ jobs: if python3 scripts/extract_changelog.py "${VERSION}" > release_notes.md; then echo "Changelog extracted for ${VERSION}" else - printf '# yaze Release Notes\n\nSee docs/C1-changelog.md for full history.\n' > release_notes.md - fi - else - printf '# yaze Release Notes\n\nSee docs/C1-changelog.md for full history.\n' > release_notes.md - fi - echo "---- RELEASE NOTES START ----" - cat release_notes.md - echo "---- RELEASE NOTES END ----" + cat > release_notes.md <<'EOF' + # yaze Release Notes - - name: Store release notes output - id: notes - shell: bash - run: | + See docs/C1-changelog.md for full history. + EOF + fi + else + cat > release_notes.md <<'EOF' + # yaze Release Notes + + See docs/C1-changelog.md for full history. + EOF + fi + echo "---- RELEASE NOTES START ----" + cat release_notes.md + echo "---- RELEASE NOTES END ----" + + - name: Store release notes output + id: notes + shell: bash + run: | { echo 'content<= zelda3::kNumTile16Individual) { + return absl::OutOfRangeError("Current tile16 ID out of range"); + } + + // Update the blockset bitmap that's displayed in the editor + if (tile16_blockset_bmp_.is_active()) { + // Calculate the position of this tile in the blockset bitmap + constexpr int kTilesPerRow = 8; // Standard SNES tile16 layout is 8 tiles per row + int tile_x = (current_tile16_ % kTilesPerRow) * kTile16Size; + int tile_y = (current_tile16_ / kTilesPerRow) * kTile16Size; + + // Copy pixel data from current tile to blockset bitmap + for (int tile_y_offset = 0; tile_y_offset < kTile16Size; ++tile_y_offset) { + for (int tile_x_offset = 0; tile_x_offset < kTile16Size; ++tile_x_offset) { + int src_index = tile_y_offset * kTile16Size + tile_x_offset; + int dst_index = (tile_y + tile_y_offset) * tile16_blockset_bmp_.width() + + (tile_x + tile_x_offset); + + if (src_index < static_cast(current_tile16_bmp_.size()) && + dst_index < static_cast(tile16_blockset_bmp_.size())) { + tile16_blockset_bmp_.WriteToPixel(dst_index, current_tile16_bmp_.data()[src_index]); + } + } + } + + // Mark the blockset bitmap as modified and update the renderer + tile16_blockset_bmp_.set_modified(true); + core::Renderer::Get().UpdateBitmap(&tile16_blockset_bmp_); + } + + util::logf("Updated blockset bitmap for tile %d", current_tile16_); + return absl::OkStatus(); +} + absl::Status Tile16Editor::RegenerateTile16BitmapFromROM() { // Get the current tile16 data from ROM auto* tile_data = GetCurrentTile16Data(); @@ -444,7 +482,7 @@ absl::Status Tile16Editor::RegenerateTile16BitmapFromROM() { return absl::OkStatus(); } -absl::Status Tile16Editor::DrawToCurrentTile16(ImVec2 click_position, +absl::Status Tile16Editor::DrawToCurrentTile16(ImVec2 pos, const gfx::Bitmap* source_tile) { constexpr int kTile8Size = 8; constexpr int kTile16Size = 16; @@ -477,8 +515,8 @@ absl::Status Tile16Editor::DrawToCurrentTile16(ImVec2 click_position, } // Determine which quadrant was clicked - handle the 8x scale factor properly - int quadrant_x = (click_position.x >= kTile8Size) ? 1 : 0; - int quadrant_y = (click_position.y >= kTile8Size) ? 1 : 0; + int quadrant_x = (pos.x >= kTile8Size) ? 1 : 0; + int quadrant_y = (pos.y >= kTile8Size) ? 1 : 0; int start_x = quadrant_x * kTile8Size; int start_y = quadrant_y * kTile8Size; @@ -582,6 +620,12 @@ absl::Status Tile16Editor::DrawToCurrentTile16(ImVec2 click_position, } } + // Write the modified tile16 data back to ROM + RETURN_IF_ERROR(UpdateROMTile16Data()); + + // Update the blockset bitmap displayed in the editor + RETURN_IF_ERROR(UpdateBlocksetBitmap()); + if (live_preview_enabled_) { RETURN_IF_ERROR(UpdateOverworldTilemap()); } @@ -948,6 +992,12 @@ absl::Status Tile16Editor::SetCurrentTile(int tile_id) { current_tile16_ = tile_id; + // Initialize the instance variable with current ROM data + auto tile_result = rom_->ReadTile16(current_tile16_); + if (tile_result.ok()) { + current_tile16_data_ = tile_result.value(); + } + // Extract tile data using the same method as GetTilemapData auto tile_data = gfx::GetTilemapData(*tile16_blockset_, tile_id); diff --git a/src/app/editor/overworld/tile16_editor.h b/src/app/editor/overworld/tile16_editor.h index 6e140f24..85d69191 100644 --- a/src/app/editor/overworld/tile16_editor.h +++ b/src/app/editor/overworld/tile16_editor.h @@ -117,6 +117,7 @@ class Tile16Editor : public gfx::GfxContext { absl::Status RefreshTile16Blockset(); gfx::Tile16* GetCurrentTile16Data(); absl::Status RegenerateTile16BitmapFromROM(); + absl::Status UpdateBlocksetBitmap(); // Manual tile8 input controls void DrawManualTile8Inputs(); @@ -219,7 +220,7 @@ class Tile16Editor : public gfx::GfxContext { gui::CanvasGridSize::k32x32}; gfx::Bitmap current_gfx_bmp_; - gui::Table tile_edit_table_{"##TileEditTable", 3, ImGuiTableFlags_Borders}; + gui::Table tile_edit_table_{"##TileEditTable", 3, ImGuiTableFlags_Borders, ImVec2(0, 0)}; gfx::Tilemap* tile16_blockset_ = nullptr; std::vector current_gfx_individual_; @@ -231,6 +232,9 @@ class Tile16Editor : public gfx::GfxContext { // Callback to notify parent editor when changes are committed std::function on_changes_committed_; + + // Instance variable to store current tile16 data for proper persistence + gfx::Tile16 current_tile16_data_; }; } // namespace editor