Phase 3: score bar (HARE/SCOOT labels + 5 pips per side)
Draws a score bar across the top 8 rows of the multicolor bitmap at $E000-$E13F (320 bytes), with HARE on the far left, SCOOT on the far right, and 5 pips for each player between them. A pip is 8x8 pixels (2 cells wide x 1 cell tall = 16 bitmap bytes): filled = 1-pixel white border around a 6x6 black block; empty = an 8x8 white square (the border alone). Pips are packed 2 cells each with no gap, so adjacent pip borders merge into a 2-px white vertical divider. Labels use a hand-built 4x8 font (1 byte per row, top 4 bits = 4 pixels) for the 8 chars H/A/R/E/S/C/O/T (64 bytes total). Each font row is expanded 1bpp -> 2bpp via a 16-byte lookup table (expand4): each '1' becomes '11' (white, from color RAM), each '0' becomes '00' (background black, from $D021). score_render() also rewrites the top 40 cells' attributes (screen memory = 0, color RAM = 1) so the score bar's palette is exactly 2 colors. Scores are clamped to 0..5 on render to defend against double-tap bugs in Phase 4.
This commit is contained in:
+9
-3
@@ -1,11 +1,13 @@
|
||||
// main.c — Whack Hare! entry point (Phase 2: display title screen).
|
||||
// main.c — Whack Hare! entry point (Phase 3: score bar).
|
||||
//
|
||||
// Flow:
|
||||
// 1. memmap_setup() — bank out KERNAL/BASIC/CHAR ROM.
|
||||
// 2. show_screen(TITLE) — copy the title bitmap into $E000 and
|
||||
// configure the VIC for multicolor bitmap
|
||||
// mode.
|
||||
// 3. Loop: poll joystick port 1 for fire. When pressed, restore
|
||||
// 3. score_init() — zero both player scores.
|
||||
// 4. score_render() — overlay the score bar on the top 8 rows.
|
||||
// 5. Loop: poll joystick port 1 for fire. When pressed, restore
|
||||
// the C64's default memory config and return from main() (which
|
||||
// ends the program).
|
||||
//
|
||||
@@ -16,13 +18,17 @@
|
||||
#include "memmap.h"
|
||||
#include "screens.h"
|
||||
#include "input.h"
|
||||
#include "score.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
memmap_setup();
|
||||
show_screen(SCREEN_TITLE);
|
||||
|
||||
// Phase 2: just poll for fire on port 1 (the Hare / right joystick).
|
||||
score_init();
|
||||
score_render();
|
||||
|
||||
// Phase 3: just poll for fire on port 1 (the Hare / right joystick).
|
||||
// In Phase 4 this becomes a 50 Hz raster IRQ handler that drives the
|
||||
// full state machine.
|
||||
while (!input_fire(1))
|
||||
|
||||
Reference in New Issue
Block a user