- C 95.7%
- Assembly 2%
- Python 1.8%
- Makefile 0.5%
| snes | ||
| tools | ||
| .gitignore | ||
| data.asm | ||
| fighter.c | ||
| fighter.h | ||
| fighter.png | ||
| hdr.asm | ||
| LICENSE | ||
| main.c | ||
| Makefile | ||
| pvsneslibfont.png | ||
| README.md | ||
| snes.h | ||
calc-fighter
A SNES game written in C with PVSnesLib.
Requirements
- GNU make
- PVSnesLib (provides
816-tcc,wla-65816,wlalink,gfx4snes, ...)
PVSNESLIB_HOME must point at the PVSnesLib directory (the one containing
devkitsnes/ and pvsneslib/), in Unix-style path form. The tools under
devkitsnes/bin and devkitsnes/tools must be executable.
This project was built with the copy bundled in SNES-IDE:
export PVSNESLIB_HOME=$HOME/src/SNES-IDE/SNES-IDE-out/bin/pvsneslib
chmod +x $PVSNESLIB_HOME/devkitsnes/bin/* $PVSNESLIB_HOME/devkitsnes/tools/*
Build
export PVSNESLIB_HOME=/path/to/pvsneslib
make
This converts pvsneslibfont.png to .pic/.pal, compiles main.c,
assembles hdr.asm and data.asm, and links calc-fighter.sfc.
Optional switches (environment or make variables):
| Variable | Effect |
|---|---|
FASTROM=1 |
FastROM build (default is SlowROM) |
HIROM=1 |
HiROM build (default is LoROM) |
PVSNESLIB_DEBUG=1 |
Keep intermediate debug files |
hdr.asm defines LOROM/SLOWROM, so keep it consistent with these switches.
Clean
make clean
Game skeleton
| File | Purpose |
|---|---|
main.c |
Setup, game loop, HUD health bars, round restart |
fighter.h / fighter.c |
Fighter state machine, move frame data, hit/hurt boxes, pushbox, sprite drawing |
fighter.png |
Placeholder sprite sheet: 32x32 frames in a vertical strip (frame order is FR_* in fighter.h) |
tools/make_sprites.py |
Regenerates the placeholder fighter.png (~/.venv/bin/python3 -I tools/make_sprites.py) |
Controls: P1 is pad 0, P2 is pad 1. D-pad moves, jumps (up) and crouches (down), Y punches, B kicks, START restarts after a KO.
To add a character: draw a new sheet with the same frame order, and add or change entries in the moves table in fighter.c for its frame data. P2 currently reuses the P1 sheet with red/blue swapped (makeP2Palette in main.c).
Run
Load calc-fighter.sfc in a SNES emulator (e.g. Mesen, bsnes, Snes9x).
License
MIT, see LICENSE. PVSnesLib (and the font and header files derived from it) is also MIT licensed by its authors.