Split game code and tests into focused modules #1

Merged
rhett merged 1 commits from chore/split-game-modules into main 2026-10-28 16:22:46 +00:00
Collaborator

Summary

Behavior-preserving architecture work: split the large C game and test files into smaller, focused pieces without adding gameplay or changing artwork.

  • Reduce source/main.c from 1,627 to 260 lines; extract video, scenery, world/movement, actors, battle, story/save, and HUD modules with a shared game.h.
  • Split the 1,235-line test file into maps, story, battle, rendering, movement, and shared support files, preserving assertion bodies and runner order. Largest source/test file is now 403 lines.
  • Update the Makefile to compile real translation units and add make check-host for C behavior tests without an ARM compiler or ROM. make check retains ROM build/header/Python verification.
  • Update README file descriptions and first-edit instructions.

Verification

  • Baseline and refactored C host checks passed with -Wall -Wextra -Werror.
  • All 22 freshly generated scene previews are byte-for-byte identical to the baseline; all four behavior/performance diagnostic lines match.
  • Mechanical comparison found 68 production function bodies, 19 test function bodies, 413 assertion sites, 22 initialized arrays, and test invocation order unchanged.
  • After installing the documented ARM compiler/binutils via Homebrew, full make check passed: ARM compilation/linking, valid 32,768-byte ROM header, all 7 Python tests, and C behavior/rendering/movement/save checks. SRAM_V113 confirmed present in built ROM; final exit status 0.
  • git diff --check clean. make play successfully dispatched the ROM to installed mGBA 0.10.5.

Manual verification remaining

Opening mGBA is not a gameplay verification. Please smoke-test team/ball inventory (with an existing save if available), doors, conversations, a wild encounter, and battling/running away. No manual playthrough claimed.

The large gross diff is moved code, not new gameplay. Existing small palette/scenery duplications are deliberately unchanged.

## Summary Behavior-preserving architecture work: split the large C game and test files into smaller, focused pieces without adding gameplay or changing artwork. - Reduce `source/main.c` from 1,627 to 260 lines; extract video, scenery, world/movement, actors, battle, story/save, and HUD modules with a shared `game.h`. - Split the 1,235-line test file into maps, story, battle, rendering, movement, and shared support files, preserving assertion bodies and runner order. Largest source/test file is now 403 lines. - Update the Makefile to compile real translation units and add `make check-host` for C behavior tests without an ARM compiler or ROM. `make check` retains ROM build/header/Python verification. - Update README file descriptions and first-edit instructions. ## Verification - Baseline and refactored C host checks passed with `-Wall -Wextra -Werror`. - All 22 freshly generated scene previews are byte-for-byte identical to the baseline; all four behavior/performance diagnostic lines match. - Mechanical comparison found 68 production function bodies, 19 test function bodies, 413 assertion sites, 22 initialized arrays, and test invocation order unchanged. - After installing the documented ARM compiler/binutils via Homebrew, full `make check` passed: ARM compilation/linking, valid 32,768-byte ROM header, all 7 Python tests, and C behavior/rendering/movement/save checks. `SRAM_V113` confirmed present in built ROM; final exit status 0. - `git diff --check` clean. `make play` successfully dispatched the ROM to installed mGBA 0.10.5. ## Manual verification remaining Opening mGBA is not a gameplay verification. Please smoke-test team/ball inventory (with an existing save if available), doors, conversations, a wild encounter, and battling/running away. No manual playthrough claimed. The large gross diff is moved code, not new gameplay. Existing small palette/scenery duplications are deliberately unchanged.
LyokoAgents added 1 commit 2026-10-28 16:12:49 +00:00
rhett merged commit 3469f2e6dd into main 2026-10-28 16:22:46 +00:00
rhett deleted branch chore/split-game-modules 2026-10-28 16:22:46 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rory/pokemon-gba#1