24#define TILEMAP_FLAG_WEATHER_MASK 0x0f
26#define TILEMAP_FLAG_WEATHER_SNOW 0x01
27#define TILEMAP_FLAG_WEATHER_RAIN 0x02
29#define TILEMAP_FLAG_EDITABLE 0x10
37#define TILEMAP_ERROR_BLOCKED -40
43#define TILESET_FLAG_BLOCK 0x01
50#define TILESET_FLAG_FARMABLE 0x02
56#define TILESET_FLAG_ACTIVE 0x80
62#define TILEMAP_TILE_FLAG_DIRTY 0x01
70#define tilemap_get_tile_id( t, x, y ) (((t)->tiles[((y * TILEMAP_TW) + x) / 2] >> (0 == x % 2 ? 4 : 0)) & 0x0f)
73# define tilemap_tile_get_image( tt ) ((tt)->ascii)
79# define tilemap_tile_get_image( tt ) ((tt)->image_cache_id)
88#define tilemap_is_dirty( x, y, map ) (((map)->tiles_flags[((y) * TILEMAP_TW) + (x)] & TILEMAP_TILE_FLAG_DIRTY))
90#define tilemap_set_dirty( x, y, map ) (map)->tiles_flags[(y * TILEMAP_TW) + x] |= TILEMAP_TILE_FLAG_DIRTY;
92#define tilemap_unset_dirty( x, y, map ) (map)->tiles_flags[(y * TILEMAP_TW) + x] &= ~TILEMAP_TILE_FLAG_DIRTY;
98uint16_t tilemap_fix_asset_path(
99 char* path_in, uint16_t path_in_sz,
const char* map_path );
114void tilemap_refresh_tiles(
struct TILEMAP* t );
125void tilemap_set_weather( uint8_t weather,
struct TILEMAP* t ) SECTION_TILEMAP;
135 uint8_t x, uint8_t y, uint8_t dir,
struct TILEMAP* t );
149void tilemap_deinit(
struct TILEMAP* ) SECTION_TILEMAP;
163uint16_t tilemap_fix_asset_path(
164 char* path_in, uint16_t path_in_sz,
const char* map_path
166 uint16_t path_sz_out = 0,
170 path_sz_out = dio_char_idx_r( map_path, map_path_sz, PLATFORM_DIR_SEP );
175 path_in_sz > path_sz_out + 2
178 memory_strncpy_ptr( path_in, map_path, path_sz_out );
181 path_in[path_sz_out++] = PLATFORM_DIR_SEP;
184 path_in[path_sz_out] =
'\0';
186 debug_printf( 2,
"map directory: %s", path_in );
189 error_printf(
"unable to fit map path into buffer!" );
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.
Definition: tilemap.c:13
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.
Definition: tilemap.c:114
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.
Definition: tilemap.c:133
int16_t memory_strnlen_ptr(const char *s, uint16_t l)
Get the size of a string, up to a specified maximum.
Information pertaining to in-game world currently loaded.
Definition: tmstruct.h:87
Definitions and functions for reading an ASN.1-formatted TILEMAP.
Constants and functions for populating a TILEMAP from json.