Missile Command: arcade rules, crafts, trail system v2, emulator wave skip

Game (examples/MissileCommand):
- Trails rewritten as an analytic flight path (pos is a pure function of
  distance travelled): paint and erase replay the exact same pixels, so
  blinking trails leave zero residue. Smart bombs wiggle (S-curves) with
  deterministic paths; erase band widened to a symmetric 7px so the ±1px
  Bresenham slope jitter between paint/erase endpoints can never leak
  paint ink (verified zero strays across dense frame captures).
- 2600 look: bright steady missile head dot with a flashing trail
  (shared blink phase), trails vanish on death/impact; AA rockets stay
  moving dots.
- Arcade rules: bomber planes (100x mult) and satellites (250x mult)
  cross the sky dropping bombs; max 3 city kills per wave; bonus cities
  at every 10k kept in reserve and deployed between waves; battery
  silos rebuilt and replenished at each wave start (they no longer stay
  dead across levels); center battery fires fast rockets, sides slow.
- Wave-start attack alarm (four falling tones, once); volume U/V/M with
  OSD; sound task zeroes the I2S DMA ring when the queue drains so a
  finished sound's tail no longer loops forever.

Emulator:
- --wave N flag to skip straight to a wave for quick testing
- --dump-interval N rolling frame captures (seq%05d.bmp)
- shim: uxQueueMessagesWaiting added
This commit is contained in:
Dejvino
2026-11-10 23:42:01 +01:00
parent 45ffa87425
commit 0f85c75331
5 changed files with 390 additions and 72 deletions
+7
View File
@@ -63,9 +63,12 @@ int main(int argc, char **argv)
long maxFrames = -1;
const char *dumpPath = nullptr;
bool autoplay = false;
int dumpEvery = 0;
for (int i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--frames") && i + 1 < argc) maxFrames = atol(argv[++i]);
else if (!strcmp(argv[i], "--dump") && i + 1 < argc) dumpPath = argv[++i];
else if (!strcmp(argv[i], "--dump-interval") && i + 1 < argc) dumpEvery = atoi(argv[++i]);
else if (!strcmp(argv[i], "--wave") && i + 1 < argc) emuStartWaveRequest = atoi(argv[++i]);
else if (!strcmp(argv[i], "--autoplay")) autoplay = true;
}
@@ -206,6 +209,10 @@ int main(int argc, char **argv)
if (maxFrames > 0 && --maxFrames == 0) {
running = false;
if (dumpPath) saveBmp(dumpPath);
} else if (dumpEvery > 0 && frame % dumpEvery == 0) {
char path[256];
snprintf(path, sizeof(path), "seq%05d.bmp", frame / dumpEvery);
saveBmp(path);
}
}
+7
View File
@@ -139,6 +139,13 @@ inline int xQueueSend(QueueHandle_t q, const void *item, unsigned /*timeout*/)
return pdTRUE;
}
inline unsigned uxQueueMessagesWaiting(QueueHandle_t q)
{
if (!q) return 0;
std::lock_guard<std::mutex> lk(q->m);
return (unsigned)q->items.size();
}
inline int xQueueReceive(QueueHandle_t q, void *out, unsigned timeout)
{
if (!q) return pdFALSE;