backend-infra-engineer: Post v0.3.9-hotfix7 snapshot (build cleanup)
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
# Draw Routine Fixes - Phase 2
|
||||
|
||||
## Status
|
||||
**Owner:** ai-dungeon-specialist
|
||||
**Created:** 2025-12-07
|
||||
**Status:** Partial Complete - Build Verified
|
||||
|
||||
## Summary
|
||||
|
||||
This document tracks fixes for specific dungeon object draw routines and outline sizing issues identified during testing. These issues complement the Phase 1 diagonal/edge/spacing fixes.
|
||||
|
||||
## Issues to Fix
|
||||
|
||||
### Issue 1: Block 0x5E Draw Routine Inverted
|
||||
**Object:** 0x5E (RoomDraw_RightwardsBlock2x2spaced2_1to16)
|
||||
**Problem:** Draw routine is inverted for the simple block pattern
|
||||
**ASM Reference:** bank_01.asm line 363
|
||||
**Fix Required:** Review tile ordering and column-major vs row-major layout
|
||||
|
||||
### Issue 2: Vertical Pegs Wrong Outline Shape
|
||||
**Objects:** 0x95 (DownwardsPots2x2), 0x96 (DownwardsHammerPegs2x2)
|
||||
**Problem:** Selection outline shows 2x2 square but should be vertical single row (1 tile wide)
|
||||
**ASM Reference:** RoomDraw_DownwardsPots2x2_1to16, RoomDraw_DownwardsHammerPegs2x2_1to16
|
||||
**Analysis:** The pots/pegs are 2x2 objects that repeat vertically with 2-row spacing (0x100). However, user reports they should display as 1-tile-wide vertical strips. Need to verify actual drawn dimensions from ASM.
|
||||
**Fix Required:** Update dimension calculations in CalculateObjectDimensions and ObjectDimensionTable
|
||||
|
||||
### Issue 3: Thick Rail Horizontal/Vertical Draw Issues
|
||||
**Objects:** 0x5D (RightwardsBigRail1x3), 0x88 (DownwardsBigRail3x1)
|
||||
**Problem:** Repeats far left edge rather than inner parts of the thick rail
|
||||
**ASM Reference:** RoomDraw_RightwardsBigRail1x3_1to16plus5, RoomDraw_DownwardsBigRail3x1_1to16plus5
|
||||
**Analysis:** ASM shows:
|
||||
- First draws a 2x2 block, then advances tile pointer by 8
|
||||
- Then draws middle section (1x3 tiles per iteration)
|
||||
- Finally draws end cap (2 tiles)
|
||||
**Fix Required:** Fix draw routine to draw: left cap → middle repeating → right cap
|
||||
|
||||
### Issue 4: Large Decor Outline Too Small, Draw Routine Repeats Incorrectly
|
||||
**Problem:** Large decoration objects have outlines that are too small and draw routines that repeat when they shouldn't
|
||||
**Fix Required:** Identify specific objects and verify repetition count logic (size+1 vs size)
|
||||
|
||||
### Issue 5: Ceiling 0xC0 Doesn't Draw Properly
|
||||
**Object:** 0xC0 (RoomDraw_4x4BlocksIn4x4SuperSquare)
|
||||
**Problem:** Object doesn't draw at all or draws incorrectly
|
||||
**ASM Reference:** bank_01.asm lines 1779-1831
|
||||
**Analysis:** Uses complex 4x4 super-square pattern with 8 buffer pointers ($BF through $D4). Draws 4x4 blocks in a grid pattern based on size parameters B2 and B4.
|
||||
**Fix Required:** Implement proper super-square drawing routine
|
||||
|
||||
### Issue 6: 0xF99 Chest Outline Correct But Draw Routine Repeats
|
||||
**Object:** 0xF99 (RoomDraw_Chest - Type 3 chest)
|
||||
**Problem:** Outline is correct but draw routine repeats when it shouldn't
|
||||
**ASM Reference:** RoomDraw_Chest at bank_01.asm line 4707
|
||||
**Analysis:** Chest should only draw once (single 2x2 pattern), not repeat based on size
|
||||
**Fix Required:** Remove size-based repetition from chest draw routine
|
||||
|
||||
### Issue 7: Pit Edges Outlines Too Thin
|
||||
**Problem:** Pit edge outlines shouldn't be single tile thin based on direction
|
||||
**Objects:** Various pit edge objects
|
||||
**Fix Required:** Update pit edge dimension calculations to include proper width based on direction
|
||||
|
||||
### Issue 8: 0x3D Tall Torches Wrong Top Half Graphics
|
||||
**Object:** 0x3D (mapped to RoomDraw_RightwardsPillar2x4spaced4_1to16)
|
||||
**Problem:** Bottom half draws correctly but top half with fire draws pegs instead
|
||||
**ASM Reference:** bank_01.asm line 330 - uses RoomDraw_RightwardsPillar2x4spaced4_1to16 (same as 0x39)
|
||||
**Analysis:** Object 0x3D and 0x39 share the same draw routine but use different tile data. Need to verify tile data offset is correct.
|
||||
**Fix Required:** Verify tile data loading for 0x3D or create dedicated draw routine
|
||||
|
||||
## Implementation Status
|
||||
|
||||
### Completed Fixes
|
||||
1. **Block 0x5E** ✅ - Fixed tile ordering in DrawRightwardsBlock2x2spaced2_1to16 to use column-major order
|
||||
2. **Thick Rails 0x5D/0x88** ✅ - Rewrote DrawRightwardsBigRail and DrawDownwardsBigRail to correctly draw cap-middle-cap pattern
|
||||
3. **Chest 0xF99** ✅ - Fixed chest to draw single 2x2 pattern without size-based repetition
|
||||
4. **Large Decor 0xFEB** ✅ - Created Single4x4 routine (routine 113) - no repetition, correct 32x32 outline
|
||||
5. **Water Grate 0xFED** ✅ - Created Single4x3 routine (routine 114) - no repetition, correct 32x24 outline
|
||||
6. **Big Chest 0xFB1** ✅ - Mapped to Single4x3 routine (routine 114) - no repetition
|
||||
7. **Blue Rupees 0xF92** ✅ - Created DrawRupeeFloor routine (routine 115) - special 6x8 pattern with gaps
|
||||
|
||||
### Pending Investigation
|
||||
8. **Rails 0x022** - Uses RoomDraw_RightwardsHasEdge1x1_1to16_plus3 - needs internal rail drawing
|
||||
9. **Ceiling 0xC0** - Draw4x4BlocksIn4x4SuperSquare may have tile loading issue
|
||||
10. **Vertical Pegs 0x95/0x96** - Current dimensions look correct. May be UI display issue.
|
||||
11. **Pit Edges** - Need specific object IDs to investigate
|
||||
12. **Torches 0x3D** - May be ROM tile data issue (verify data at 0x807A)
|
||||
|
||||
## New Routines Added
|
||||
- Routine 113: DrawSingle4x4 - Single 4x4 block, no repetition
|
||||
- Routine 114: DrawSingle4x3 - Single 4x3 block, no repetition
|
||||
- Routine 115: DrawRupeeFloor - Special 6x8 pattern with gaps at rows 2 and 5
|
||||
|
||||
## Files Modified
|
||||
|
||||
- `src/zelda3/dungeon/object_drawer.cc`
|
||||
- `src/zelda3/dungeon/object_drawer.h`
|
||||
- `docs/internal/agents/draw_routine_fixes_phase2.md`
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
# Draw Routine Fixes - Handoff Document
|
||||
|
||||
**Status:** Handoff
|
||||
**Owner:** draw-routine-engineer
|
||||
**Created:** 2025-12-07
|
||||
**Last Session:** 2025-12-07
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
This session made significant progress on dungeon object draw routines. Many fixes were completed, but some objects still have minor issues requiring further investigation.
|
||||
|
||||
---
|
||||
|
||||
## Completed Fixes ✅
|
||||
|
||||
| Object ID | Name | Fix Applied |
|
||||
|-----------|------|-------------|
|
||||
| 0x5E | Block | Fixed column-major tile ordering |
|
||||
| 0x5D/0x88 | Thick Rails | Fixed cap-middle-cap pattern |
|
||||
| 0xF99 | Chest | Changed to DrawSingle2x2 (no size-based repeat) |
|
||||
| 0xFB1 | Big Chest | Changed to DrawSingle4x3 (no repeat) |
|
||||
| 0xF92 | Blue Rupees | Implemented DrawRupeeFloor per ASM (3x8 pattern) |
|
||||
| 0xFED | Water Grate | Changed to DrawSingle4x3 (no repeat) |
|
||||
| 0x3A | Wall Decors | Fixed spacing from 6 to 8 tiles |
|
||||
| 0x39/0x3D | Pillars | Fixed spacing from 6 to 4 tiles |
|
||||
| 0xFEB | Large Decor | Now 64x64 (4x4 tile16s = 8x8 tile8s) |
|
||||
| 0x138-0x13B | Spiral Stairs | Fixed to 4x3 pattern per ASM |
|
||||
| 0xC0/0xC2 | SuperSquare Ceilings | Dimensions now use size parameter |
|
||||
| 0xFE6 | Pit | Uses DrawActual4x4 (32x32, no repeat) |
|
||||
| 0x55-0x56 | Wall Torches | Fixed to 1x8 column with 12-tile spacing |
|
||||
| 0x22 | Small Rails | Now CORNER+MIDDLE*count+END pattern |
|
||||
| 0x23-0x2E | Carpet Trim | Now CORNER+MIDDLE*count+END pattern |
|
||||
|
||||
---
|
||||
|
||||
## Known Issues - Need Further Work ⚠️
|
||||
|
||||
### 1. Horizontal vs Vertical Rails Asymmetry
|
||||
**Objects:** 0x22 (horizontal) vs vertical counterparts
|
||||
**Issue:** Horizontal rails now work with CORNER+MIDDLE+END pattern, but vertical rails may not be updated to match.
|
||||
**Files to check:**
|
||||
- `DrawDownwardsHasEdge1x1_*` routines
|
||||
- Look for routines mapped to 0x8A-0x8E (vertical equivalents)
|
||||
|
||||
### 2. Diagonal Ceiling Outlines (0xA0-0xA3)
|
||||
**Issue:** Draw routine is correct (triangular fill), but outline dimensions still too large for selection purposes.
|
||||
**Current state:**
|
||||
- Draw: `count = (size & 0x0F) + 4`
|
||||
- Outline: `count = (size & 0x0F) + 2` (still too big)
|
||||
**Suggestion:** May need special handling in selection code rather than dimension calculation, since triangles only fill half the bounding box.
|
||||
|
||||
### 3. Torch Object 0x3D
|
||||
**Issue:** Top half draws pegs instead of fire graphics.
|
||||
**Likely cause:** ROM tile data issue - tiles at offset 0x807A may be incorrect or tile loading is wrong.
|
||||
**Uses same routine as pillars (0x39).**
|
||||
|
||||
### 4. Vertical Pegs 0x95/0x96
|
||||
**Issue:** Outline appears square (2x2) but should be vertical single row.
|
||||
**May be UI/selection display issue rather than draw routine.**
|
||||
|
||||
---
|
||||
|
||||
## Pending Tasks 📋
|
||||
|
||||
### High Priority
|
||||
1. **0xDC Chest Platform** - Complex routine with multiple segments, not currently working
|
||||
2. **Staircases audit** - Objects 0x12D-0x137, 0x21B-0x221, 0x226-0x229, 0x233
|
||||
|
||||
### Medium Priority
|
||||
3. **Vertical rail patterns** - Match horizontal rail fixes
|
||||
4. **Pit edges** - Need specific object IDs to investigate
|
||||
|
||||
### Low Priority
|
||||
5. **Diagonal ceiling selection** - May need UI-level fix
|
||||
|
||||
---
|
||||
|
||||
## Key Formulas Reference
|
||||
|
||||
### Size Calculations (from ASM)
|
||||
|
||||
| Pattern | Formula |
|
||||
|---------|---------|
|
||||
| GetSize_1to16 | `count = (size & 0x0F) + 1` |
|
||||
| GetSize_1to16_timesA | `count = (size & 0x0F + 1) * A` |
|
||||
| GetSize_1to15or26 | `count = size; if 0, count = 26` |
|
||||
| GetSize_1to15or32 | `count = size; if 0, count = 32` |
|
||||
| SuperSquare | `size_x = (size & 0x0F) + 1; size_y = ((size >> 4) & 0x0F) + 1` |
|
||||
|
||||
### Rail Pattern Structure
|
||||
```
|
||||
[CORNER tile 0] -> [MIDDLE tile 1 × count] -> [END tile 2]
|
||||
```
|
||||
|
||||
### Tile Ordering
|
||||
Most routines use **COLUMN-MAJOR** order: tiles advance down each column, then right.
|
||||
|
||||
---
|
||||
|
||||
## Files Modified
|
||||
|
||||
- `src/zelda3/dungeon/object_drawer.cc` - Main draw routines and mappings
|
||||
- `src/zelda3/dungeon/object_drawer.h` - Added DrawActual4x4 declaration
|
||||
- `src/zelda3/dungeon/draw_routines/special_routines.cc` - Spiral stairs fix
|
||||
- `docs/internal/agents/draw_routine_tracker.md` - Tracking document
|
||||
|
||||
---
|
||||
|
||||
## Testing Notes
|
||||
|
||||
- Log file at `logs/dungeon-object-draw.log` shows object draw data
|
||||
- Most testing was done on limited room set - need broader room testing
|
||||
- Use grep on log file to find specific object draws: `grep "obj=0xXX" logs/dungeon-object-draw.log`
|
||||
|
||||
---
|
||||
|
||||
## Next Steps for Continuation
|
||||
|
||||
1. Test the rail fixes in rooms with both horizontal and vertical rails
|
||||
2. Find and fix the vertical rail equivalents (likely routines 23-28 or similar)
|
||||
3. Investigate 0xDC chest platform ASM in detail
|
||||
4. Consider UI-level fix for diagonal ceiling selection bounds
|
||||
|
||||
Reference in New Issue
Block a user