joeylib2/examples/spacetaxi/spacetaxi.h

66 lines
2.9 KiB
C

// Space Taxi (JoeyLib port) -- host-side declarations.
//
// The game itself lives in the host-independent simulation (stSim.h):
// physics, collision, the fare machine, the level hooks, the title
// intro and the level intro all run there in the C64's own units and
// are verified tick-for-tick against a VICE trace of the original.
// This header is the JoeyLib side: the renderer that paints the
// simulation's screen RAM and sprite frame, the audio sink, the
// level loader and the front-end flow in spacetaxi.c.
#ifndef SPACETAXI_H
#define SPACETAXI_H
#include <joey/joey.h>
#include "stSim.h"
// Diagnostics. The logger drags in vsnprintf (with newlib that pulls the
// whole formatted-output and float-conversion family, ~45 KB) plus a
// multi-KB ring buffer, and the game has no need of either. That is
// unaffordable on the IIgs, whose bank-0 BSS budget cannot spare the
// ring, and on the X68000, which ships on a Human68k floppy with about
// 330 KB of usable space for the binary AND its levels. Both compile it
// out; the ports with room keep it.
#if defined(__W65816__) || defined(JOEYLIB_PLATFORM_X68000)
#define ST_LOG_RESET() ((void)0)
#define ST_LOG(...) ((void)0)
#else
#define ST_LOG_RESET() jlLogReset()
#define ST_LOG(...) jlLogF(__VA_ARGS__)
#endif
// Level loading through the JoeyLib data path (DATA/levels/...).
bool stLevelLoad(StLevelT *out, const char *path);
// Renderer: paints dirty screen cells with the live charset and draws
// the eight sprites of the last marshaled frame with save-under.
void stRenderInit(jlSurfaceT *stage);
// A word on the stage before the slow part of startup: loading the cel
// bank and the first level takes long enough that the host's desktop
// would otherwise sit there with nothing to look at.
void stRenderLoading(jlSurfaceT *stage);
void stRenderShutdown(void);
void stRenderFrame(jlSurfaceT *stage, StSimT *sim);
// Drop the sprite cache and force a full repaint (new scene). Also
// leaves the title's logo mode (below).
void stRenderSceneChanged(StSimT *sim);
// Title screen only: draw the logo's four flip-book frames from one
// tile held in reserved palette slots, so the flip and the colour
// cycle are palette writes instead of repainting 103 (and 407) cells.
// Call after stRenderSceneChanged, which turns it back off.
void stRenderTitleLogo(StSimT *sim);
// Level intro only: cycle the starfield's ring palette slots so the warp
// animates without a single pixel moving. Call after
// stRenderSceneChanged, which turns it back off.
void stRenderIntroStars(void);
void stRenderPrewarm(jlSurfaceT *stage, StSimT *sim);
// Ready a level's hook cels before its ride (evicts the previous level's).
void stRenderLevelCels(jlSurfaceT *stage, const StLevelT *level);
// Audio sink setup and the per-tick release timers ($4320).
void stAudioInit(void);
void stAudioShutdown(void);
void stAudioTick(void);
#endif