2021-04-18 16:36:29 +00:00
|
|
|
|
/// Uncompressed 16-color 16×16 image format with palette, used for map tiles
|
|
|
|
|
/// -------------------------------------------------------------------------
|
2024-05-26 17:39:06 +00:00
|
|
|
|
extern "C" {
|
2021-04-18 16:36:29 +00:00
|
|
|
|
|
|
|
|
|
typedef dot_rect_t(TILE_W, TILE_H) mpn_plane_t;
|
|
|
|
|
typedef Planar<mpn_plane_t> mpn_image_t;
|
|
|
|
|
|
2024-01-17 08:03:39 +00:00
|
|
|
|
struct mpn_header_t {
|
2021-04-22 16:43:11 +00:00
|
|
|
|
char magic[4]; // = "MPTN"
|
2023-10-26 09:37:38 +00:00
|
|
|
|
|
|
|
|
|
// Stored minus 1. (Probably because MIKO_K.MPN contains 256 tiles and ZUN
|
|
|
|
|
// absolutely wanted to store this value in a single byte regardless.)
|
|
|
|
|
uint8_t count;
|
|
|
|
|
|
2021-04-18 16:36:29 +00:00
|
|
|
|
int8_t unused;
|
2024-01-17 08:03:39 +00:00
|
|
|
|
};
|
2021-04-22 16:43:11 +00:00
|
|
|
|
|
2021-04-18 16:36:29 +00:00
|
|
|
|
#if (GAME == 2)
|
2023-03-18 11:49:39 +00:00
|
|
|
|
extern uint8_t mpn_count; // Stored minus 1.
|
2021-04-18 16:36:29 +00:00
|
|
|
|
extern mpn_image_t *mpn_images;
|
|
|
|
|
extern Palette8 mpn_palette;
|
2021-04-22 16:43:11 +00:00
|
|
|
|
|
2021-04-18 16:36:29 +00:00
|
|
|
|
// Reads the .MPN file with the given [fn] into the newly reallocated
|
|
|
|
|
// [mpn_images], and sets [mpn_count] and [mpn_palette] accordingly.
|
|
|
|
|
// Returns 0 if allocation succeeded and the tiles were read into
|
|
|
|
|
// [mpn_images], -1 otherwise.
|
|
|
|
|
int pascal mpn_load(const char *fn);
|
2021-04-22 16:43:11 +00:00
|
|
|
|
|
2021-04-18 16:36:29 +00:00
|
|
|
|
// Like mpn_load(), but sets the hardware palette to the one in [fn]'s
|
|
|
|
|
// header.
|
|
|
|
|
int pascal mpn_load_palette_show(const char *fn);
|
2021-04-22 16:43:11 +00:00
|
|
|
|
|
2023-03-15 18:55:16 +00:00
|
|
|
|
// Blits the given [image] from the currently loaded .MPN to
|
|
|
|
|
// (⌊left/8⌋*8, top).
|
2023-03-18 11:49:39 +00:00
|
|
|
|
// ZUN landmine: Does not restrict [image] to ([mpn_count] + 1), which
|
|
|
|
|
// matters in conjunction with tile_area_init_and_put_both().
|
2024-05-26 17:39:06 +00:00
|
|
|
|
extern "C++" {
|
2023-03-15 18:55:16 +00:00
|
|
|
|
void pascal mpn_put_8(screen_x_t left, vram_y_t top, int image);
|
2024-05-26 17:39:06 +00:00
|
|
|
|
}
|
2023-03-15 18:55:16 +00:00
|
|
|
|
|
2021-04-18 16:36:29 +00:00
|
|
|
|
void mpn_free(void);
|
|
|
|
|
#endif
|
2024-05-26 17:39:06 +00:00
|
|
|
|
}
|
2021-04-18 16:36:29 +00:00
|
|
|
|
/// -------------------------------------------------------------------------
|