2019-12-15 19:17:00 +00:00
|
|
|
#include "defconv.h"
|
|
|
|
|
2019-11-27 20:58:11 +00:00
|
|
|
#if GAME == 5
|
2017-01-11 15:12:39 +00:00
|
|
|
# define PI_SLOT_COUNT 8
|
2019-11-27 20:58:11 +00:00
|
|
|
#else
|
2017-01-11 15:12:39 +00:00
|
|
|
# define PI_SLOT_COUNT 6
|
2019-11-27 20:58:11 +00:00
|
|
|
#endif
|
|
|
|
|
2019-12-15 19:17:00 +00:00
|
|
|
// Global PI file slots.
|
2017-01-11 15:12:39 +00:00
|
|
|
extern PiHeader pi_headers[PI_SLOT_COUNT];
|
|
|
|
extern void far *pi_buffers[PI_SLOT_COUNT];
|
2019-12-15 19:17:00 +00:00
|
|
|
|
|
|
|
// ≥TH03 free any previously loaded PI in the given slot before loading [fn].
|
2017-01-11 15:12:39 +00:00
|
|
|
int DEFCONV pi_load(int slot, const char *fn);
|
2019-12-15 19:17:00 +00:00
|
|
|
|
2017-01-11 15:12:39 +00:00
|
|
|
void DEFCONV pi_palette_apply(int slot);
|
2019-12-15 19:17:00 +00:00
|
|
|
|
2020-10-23 17:27:10 +00:00
|
|
|
// Displays the PI image in slot #[slot] at (⌊left/8⌋*8, top). Horizontally,
|
|
|
|
// the image is cut off at 640 pixels; vertically, it is wrapped if it exceeds
|
|
|
|
// the clipping frame defined via grc_setclip().
|
|
|
|
void DEFCONV pi_put_8(screen_x_t left, vram_y_t top, int slot);
|
2019-12-15 19:17:00 +00:00
|
|
|
|
2020-10-23 17:27:10 +00:00
|
|
|
#define pi_load_put_8_free(slot, fn) \
|
2017-01-11 15:12:39 +00:00
|
|
|
pi_load(slot, (fn)); \
|
|
|
|
pi_palette_apply(slot); \
|
2020-10-23 17:27:10 +00:00
|
|
|
pi_put_8(0, 0, slot); \
|
2017-01-11 15:12:39 +00:00
|
|
|
graph_pi_free(&pi_headers[slot], pi_buffers[slot]);
|