Split game code and tests into focused modules
This commit is contained in:
20 files changed
+2611
-2431
No files matched your search
@@ -9,7 +9,7 @@ Double-click **Build and Play.command** in this folder. It builds your ROM, runs
|
||||
Or open Terminal and run:
|
||||
|
||||
```sh
|
||||
cd ~/gba-game
|
||||
cd ~/Developer/pokemon-gba
|
||||
make play
|
||||
```
|
||||
|
||||
@@ -35,17 +35,25 @@ If those keys do not match your emulator settings, check mGBA's keyboard input s
|
||||
|
||||
### Your first change
|
||||
|
||||
Open `source/main.c` in a text editor. Find:
|
||||
Open `source/actors.c` in a text editor. Find:
|
||||
|
||||
```c
|
||||
static const u16 shirt = RGB(5, 14, 29);
|
||||
TEST_INTERNAL const u16 shirt = RGB(5, 14, 29);
|
||||
```
|
||||
|
||||
Those numbers mean red, green, and blue, each from 0 to 31. Try `RGB(29, 6, 6)` for a red shirt. Save, then double-click **Build and Play.command** again.
|
||||
|
||||
## Project files
|
||||
|
||||
- `source/main.c`: map, character, creature, and game rules.
|
||||
- `source/main.c`: GBA hardware, timers, and the main game loop.
|
||||
- `source/game.h`: shared game types and module declarations.
|
||||
- `source/video.c`: frame buffer, dirty rows, text, and sprite renderer.
|
||||
- `source/scenery.c`: map artwork and the scenery cache.
|
||||
- `source/world.c`: movement, collisions, doors, map travel, and following.
|
||||
- `source/actors.c`: character and creature artwork and drawing.
|
||||
- `source/battle.c`: species, battle rules, and the battle screen.
|
||||
- `source/story.c`: conversations, gifts, and cartridge SRAM saves.
|
||||
- `source/hud.c`: map status, scene drawing, and the team screen.
|
||||
- `source/wild_creatures.h`: original wild-creature sprites and palettes.
|
||||
- `source/start.s`: code that starts the GBA hardware.
|
||||
- `gba.ld`: tells the compiler where cartridge code and working memory go.
|
||||
@@ -53,6 +61,8 @@ Those numbers mean red, green, and blue, each from 0 to 31. Try `RGB(29, 6, 6)`
|
||||
- `Makefile`: builds the game with the installed ARM compiler.
|
||||
- `tests/`: cartridge header, NPC interaction, drawing, house entry/exit, and room collision tests. `make check` also generates scene previews in `build/`.
|
||||
|
||||
Run `make check-host` to check C game behavior on your Mac using only host clang, generating scene previews in `build/`. It does not need a ROM or the ARM compiler. The C tests are grouped by maps, story, battles, rendering, and movement, with shared helpers in `tests/test_support.c`. `make check` builds the ROM, checks its header, runs the ROM-dependent Python tests, and runs these host checks.
|
||||
|
||||
Graphics are drawn into a RAM buffer first. Only the changed spans of each row are copied to the GBA screen during VBlank, so walking does not expose a half-erased character. Full map changes are copied while the display is temporarily blanked.
|
||||
|
||||
The active map's scenery is cached in a separate 76,800-byte RAM buffer. Walking and dialogue cleanup copy background rows from that cache instead of recalculating every pixel. The cache rebuilds when maps change; opening or closing an exterior door updates only its 13×18-pixel patch. Actors and UI are never stored in the scenery cache.
|
||||
@@ -67,7 +77,7 @@ Receiving Sprout or Finn's Poké Balls automatically writes a small cartridge SR
|
||||
|
||||
### Change what Mila says
|
||||
|
||||
Find `dialogue` near the top of `source/main.c`. Each pair of strings is one page of her conversation. Use CAPITAL letters and spaces, with no more than 34 characters on each line. Save and rebuild to try your new conversation.
|
||||
Find `dialogue` in `source/story.c`. Each pair of strings is one page of her conversation. Use CAPITAL letters and spaces, with no more than 34 characters on each line. Save and rebuild to try your new conversation.
|
||||
|
||||
## Mac setup
|
||||
|
||||
|
||||
Reference in new issue
Block a user