diff options
Diffstat (limited to 'kon/konrmtile.h')
| -rw-r--r-- | kon/konrmtile.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/kon/konrmtile.h b/kon/konrmtile.h new file mode 100644 index 0000000..bae2ada --- /dev/null +++ b/kon/konrmtile.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: MIT */ +/* + * konrmtile.h + * + * Copyright (c) 2026 KonAki + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef KONRMTILE_H +#define KONRMTILE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*** definition ***/ + +/* where the pieces of one RPG Maker map tile come from in the tileset pictures, with nothing drawn. a tile is one whole piece + from a picture, or for an autotile four quarters that fit together with their neighbours. everything is counted in half tiles, + so for a picture made of 48 pixel tiles a half tile is 24 pixels. mzmap writes the tileset's picture names in order: + sheet 0 is A1, 1 A2, 2 A3, 3 A4, 4 A5, 5 B, 6 C, 7 D and 8 E */ + +#define KON_RM_SHEETS 9 + +typedef struct kon_rmQuad { + int sheet; + int sx, sy; /* where the piece starts in the picture */ + int dx, dy; /* where it goes inside the tile, 0 or 1 for a quarter */ + int w, h; /* 2 and 2 for a whole tile, 1 and 1 for a quarter */ +} kon_rmQuad_t; + +/* fills quads (room for 4) and returns how many there are: 0 for an empty tile or one that is not drawn, 1 for a whole tile, + 4 for an autotile. frame is the animation count, water and waterfalls move with it and it is 0 for a still picture */ +int kon_rmTileQuads(int tileId, int frame, kon_rmQuad_t quads[4]); + +/* how many half tiles wide and tall a picture of that sheet has to be to hold every piece of it, for checking a loaded picture. + returns 0 for a sheet number that does not exist */ +int kon_rmSheetSize(int sheet, int *columns, int *rows); + +/* 1 for the tiles that are drawn above the characters: the ones marked with a star, flags is the tile's flags from its tileset */ +int kon_rmTileIsHigher(int flags); + +/* 1 for a tile that is an autotile, 1 for one that moves */ +int kon_rmTileIsAutotile(int tileId); +int kon_rmTileIsAnimated(int tileId); + +#ifdef __cplusplus +} +#endif +#endif |
