![]() |
dsekai
World engine for retrocomputers.
|
Modules | |
Tilemap Flags | |
ASN.1 Tilemaps | |
Extremely specific dialect of ASN.1 used to store tilemaps in a compact and simple binary format. | |
Tilemaps JSON Format | |
Tilemaps JSON Paths | |
Paths to map properties in a Tiled json file. | |
Files | |
file | tilemap.h |
Functions and macros pertaining to tilemaps. | |
file | tmjson.h |
Constants and functions for populating a TILEMAP from json. | |
file | tmstruct.h |
Structs representing tilemaps and related objects. | |
Data Structures | |
struct | TILEMAP_COORDS |
X/Y coordinates of a tile on the current map. More... | |
struct | TILESET_TILE |
Tile prototype stored in TILEMAP::tileset. More... | |
struct | TILEMAP_SPAWN |
Defines a spawner to create mobiles in the world. More... | |
struct | TILEMAP |
Information pertaining to in-game world currently loaded. More... | |
Macros | |
#define | TILE_W 16 |
TILESET_TILE width in pixels. | |
#define | TILE_H 16 |
TILESET_TILE height in pixels. | |
#define | TILEMAP_CROP_DEFS_MAX 10 |
Maximum count of TILEMAP::crop_defs. | |
#define | TILEMAP_ITEMS_MAX 20 |
Maximum count of TILEMAP::item_defs. | |
#define | TILEMAP_SPAWNS_MAX 20 |
Maximum count of TILEMAP::spawns. | |
#define | JSON_TOKENS_MAX 4096 |
#define | JSON_PATH_SZ 255 |
#define | TILEMAP_STRPOOL_SZ 1024 |
#define | TILEMAP_NAME_MAX 8 |
Maximum size of TILEMAP::name. | |
#define | TILEMAP_ERROR_BLOCKED -40 |
Return value indicating movement is blocked by terrain. | |
#define | tilemap_get_tile_id(t, x, y) (((t)->tiles[((y * TILEMAP_TW) + x) / 2] >> (0 == x % 2 ? 4 : 0)) & 0x0f) |
Get the TILEMAP::tileset index for the tile at the given coords. | |
#define | tilemap_tile_get_image(tt) ((tt)->image_cache_id) |
Get the pointer to the sprite graphic to use for a ::TILEMAP_TILE. | |
#define | tilemap_is_dirty(x, y, map) (((map)->tiles_flags[((y) * TILEMAP_TW) + (x)] & TILEMAP_TILE_FLAG_DIRTY)) |
#define | tilemap_set_dirty(x, y, map) (map)->tiles_flags[(y * TILEMAP_TW) + x] |= TILEMAP_TILE_FLAG_DIRTY; |
#define | tilemap_unset_dirty(x, y, map) (map)->tiles_flags[(y * TILEMAP_TW) + x] &= ~TILEMAP_TILE_FLAG_DIRTY; |
#define | TILEMAP_JSON_STRBUF_SZ 128 |
Maximum possible length of an individual dialog string. | |
#define | TILEMAP_SCRIPTS_MAX 8 |
Maximum number of SCRIPT structs attached to a tilemap. | |
#define | TILEMAP_TW 40 |
Maximum TILEMAP width in tiles. | |
#define | TILEMAP_TH 40 |
Maximum TILEMAP height in tiles. | |
#define | TILEMAP_TILESETS_MAX 12 |
TILEMAP::tileset maximum length. | |
#define | TILEMAP_SPAWN_NAME_SZ 12 |
#define | SCREEN_TW (SCREEN_MAP_W / TILE_W) |
Screen width in tiles. | |
#define | SCREEN_TH (SCREEN_MAP_H / TILE_H) |
Screen height in tiles. | |
#define | TILEMAP_TS ((TILEMAP_TH * TILEMAP_TW) / 2) |
Functions | |
int16_t | tilemap_load (const char *map_name, struct TILEMAP *t) |
Load tilemap with map_name into the given TILEMAP and prepare it for running in the engine. | |
int8_t | tilemap_collide (uint8_t x, uint8_t y, uint8_t dir, struct TILEMAP *t) |
Detect potential collision between a MOBILE and TILEMAP tile with blocking flags. | |
void | tilemap_advance_tile_id (struct TILEMAP *t, uint16_t x, uint16_t y) SECTION_TILEMAP |
Increment the tile_id on the specified tile coordinates. Useful for editing TILEMAP. | |
int16_t | tilemap_json_load (const RESOURCE_ID id, struct TILEMAP *t) |
Load tilemap specified by id into TILEMAP struct t. | |
void | tilemap_refresh_tiles (struct TILEMAP *t) |
Force a redraw of all tiles on a TILEMAP by marking them dirty. | |
void | tilemap_set_weather (uint8_t weather, struct TILEMAP *t) SECTION_TILEMAP |
Set the dsekai_tilemaps_weather of the given TILEMAP, including starting any related animation effects. | |
void | tilemap_deinit (struct TILEMAP *) SECTION_TILEMAP |
Prepare a TILEMAP for deallocation. | |
#define TILEMAP_CROP_DEFS_MAX 10 |
Maximum count of TILEMAP::crop_defs.
#define TILEMAP_ERROR_BLOCKED -40 |
Return value indicating movement is blocked by terrain.
#define tilemap_get_tile_id | ( | t, | |
x, | |||
y | |||
) | (((t)->tiles[((y * TILEMAP_TW) + x) / 2] >> (0 == x % 2 ? 4 : 0)) & 0x0f) |
Get the TILEMAP::tileset index for the tile at the given coords.
t | MEMORY_PTR to TILEMAP from which to get the tile. |
x | Tile X coordinate in tiles. |
y | Tile Y coordinate in tiles. |
#define TILEMAP_ITEMS_MAX 20 |
Maximum count of TILEMAP::item_defs.
#define TILEMAP_NAME_MAX 8 |
Maximum size of TILEMAP::name.
#define TILEMAP_SPAWNS_MAX 20 |
Maximum count of TILEMAP::spawns.
int8_t tilemap_collide | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | dir, | ||
struct TILEMAP * | t | ||
) |
|
related |
Prepare a TILEMAP for deallocation.
t | MEMORY_PTR to a TILEMAP to deinitialize. |
int16_t tilemap_json_load | ( | const RESOURCE_ID | id, |
struct TILEMAP * | t | ||
) |
Load tilemap specified by id into TILEMAP struct t.
id | A RESOURCE_ID indicating the tilemap to load from disk. |
t | MEMORY_PTR to an empty TILEMAP struct to be loaded into. |
|
related |
Force a redraw of all tiles on a TILEMAP by marking them dirty.
t | MEMORY_PTR to a TILEMAP to redraw. |
|
related |
Set the dsekai_tilemaps_weather of the given TILEMAP, including starting any related animation effects.
t | MEMORY_PTR to a TILEMAP to set the weather of. |
weather | Weather-related Tilemap Flags. |
This will start the relevant animation if necessary.