summaryrefslogtreecommitdiff
path: root/kon/konrmmap.h
diff options
context:
space:
mode:
authorKonAki <konaki@anokonaki.org>2026-10-15 14:57:24 +0800
committerKonAki <konaki@anokonaki.org>2026-10-15 14:57:24 +0800
commiteef87380a41357bc3bb52149ec33f1787ebd2b40 (patch)
tree17a9eac41d940c2733a24a60644eee0cd9798973 /kon/konrmmap.h
parentdcdff7cbf60eb04546c9174ae12c067bc6b4a405 (diff)
add walking and terrain checks to rmmap
Diffstat (limited to 'kon/konrmmap.h')
-rw-r--r--kon/konrmmap.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/kon/konrmmap.h b/kon/konrmmap.h
index 6274822..27bbe40 100644
--- a/kon/konrmmap.h
+++ b/kon/konrmmap.h
@@ -144,6 +144,47 @@ int kon_rmEventPage(const kon_rmEvent_t *event, int mapId, const kon_rmState_t *
/* layer is 0 to 5, the four tile layers, the shadows and the regions. 0 outside of the map or for a layer that is not there */
int kon_rmTile(const kon_rmMap_t *map, int layer, int x, int y);
+/*** walking ***/
+
+/* the directions RPG Maker uses, the numbers on a keypad */
+#define KON_RM_DOWN 2
+#define KON_RM_LEFT 4
+#define KON_RM_RIGHT 6
+#define KON_RM_UP 8
+
+/* the flags of a tile in a tileset, the tile layers of the map read from the top one down. a tile past the end of the flags
+ has none. these are RPG Maker's own bits, in kon_rmFlags and below */
+#define KON_RM_FLAG_NO_EFFECT 0x10 /* a star in the editor: this tile does not decide whether you can walk */
+#define KON_RM_FLAG_LADDER 0x20
+#define KON_RM_FLAG_BUSH 0x40
+#define KON_RM_FLAG_COUNTER 0x80
+#define KON_RM_FLAG_DAMAGE 0x100
+
+int kon_rmFlags(const kon_rmTileset_t *tileset, int tile);
+
+/* is x, y inside the map, once a map that loops has wrapped it. loops are the map's scroll type */
+int kon_rmValid(const kon_rmMap_t *map, int x, int y);
+
+/* wraps x or y for a map that loops that way, other positions stay as they are */
+int kon_rmRoundX(const kon_rmMap_t *map, int x);
+int kon_rmRoundY(const kon_rmMap_t *map, int y);
+
+/* can something on x, y leave this tile going dir, as far as the tiles say. no events and no outside of the map here */
+int kon_rmPassable(const kon_rmMap_t *map, const kon_rmTileset_t *tileset, int x, int y, int dir);
+
+/* can it step from x, y to the next tile in dir: the next tile is on the map, and both tiles let it through, the one it is
+ on on the way out and the next on the way in. what an event on the tile would say about it is for the game to ask */
+int kon_rmCanWalk(const kon_rmMap_t *map, const kon_rmTileset_t *tileset, int x, int y, int dir);
+
+/* the terrain tag a tile is marked with in the editor, 0 for none, 0 outside of the map. the top layer that has one wins */
+int kon_rmTerrainTag(const kon_rmMap_t *map, const kon_rmTileset_t *tileset, int x, int y);
+
+/* the region painted on x, y, 0 for none */
+int kon_rmRegion(const kon_rmMap_t *map, int x, int y);
+
+/* 1 when any of the layers of that tile has the flag, 0 outside of the map */
+int kon_rmHasFlag(const kon_rmMap_t *map, const kon_rmTileset_t *tileset, int x, int y, int flag);
+
#ifdef __cplusplus
}
#endif