dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
tmstruct.h
Go to the documentation of this file.
1
2#ifndef TMSTRUCTS_H
3#define TMSTRUCTS_H
4
15#include "scstruct.h"
16
18#define TILEMAP_SCRIPTS_MAX 8
20#define TILEMAP_TW 40
22#define TILEMAP_TH 40
24#define TILEMAP_TILESETS_MAX 12
25#define TILEMAP_SPAWN_NAME_SZ 12
27#define SCREEN_TW (SCREEN_MAP_W / TILE_W)
29#define SCREEN_TH (SCREEN_MAP_H / TILE_H)
30#define TILEMAP_TS ((TILEMAP_TH * TILEMAP_TW) / 2)
31
35 uint8_t x;
37 uint8_t y;
38};
39
43 RESOURCE_NAME image_name;
44 unsigned char ascii;
46 uint8_t flags;
52};
53
54/* TODO: Move spawner to mostruct.h for consistency. */
61 char name[TILEMAP_SPAWN_NAME_SZ];
62 /* TODO: Allow a range of coordinates in which to spawn. */
63 /* TODO: Allow multiple spawns from single spawner. */
69 RESOURCE_NAME sprite_name;
70 unsigned char ascii;
72 uint16_t flags;
80 int16_t script_id;
81};
82
87struct TILEMAP {
91 uint8_t flags;
102 uint8_t tiles[(TILEMAP_TH * TILEMAP_TW) / 2];
108 char strpool[TILEMAP_STRPOOL_SZ];
109 /* \brief Scripts available to attach to any MOBILE. */
110 struct SCRIPT scripts[TILEMAP_SCRIPTS_MAX];
115 /* struct WARP warps[TILEMAP_WARPS_MAX]; */
116};
117
120#endif /* !TMSTRUCTS_H */
121
uint16_t TILEMAP_GID
Globally unique identifier for TILEMAP objects.
Definition: gid.h:26
uint16_t SPAWN_GID
Globally unique identifier for TILEMAP_SPAWN objects.
Definition: gid.h:24
#define TILEMAP_NAME_MAX
Maximum size of TILEMAP::name.
Definition: src/config.h:254
#define TILEMAP_SPAWNS_MAX
Maximum count of TILEMAP::spawns.
Definition: src/config.h:232
#define TILEMAP_CROP_DEFS_MAX
Maximum count of TILEMAP::crop_defs.
Definition: src/config.h:212
#define TILEMAP_ITEMS_MAX
Maximum count of TILEMAP::item_defs.
Definition: src/config.h:222
#define TILEMAP_TILESETS_MAX
TILEMAP::tileset maximum length.
Definition: tmstruct.h:24
#define TILEMAP_SCRIPTS_MAX
Maximum number of SCRIPT structs attached to a tilemap.
Definition: tmstruct.h:18
#define TILEMAP_TH
Maximum TILEMAP height in tiles.
Definition: tmstruct.h:22
#define TILEMAP_TW
Maximum TILEMAP width in tiles.
Definition: tmstruct.h:20
Structs representing behavior scripts.
Definition of a crop to be stored with the TILEMAP on which the crop may be grown.
Definition: cropdef.h:39
An instance of an item in the world.
Definition: itstruct.h:91
Contains immutable state for scripts attached to a TILEMAP.
Definition: scstruct.h:34
X/Y coordinates of a tile on the current map.
Definition: tmstruct.h:33
uint8_t y
Vertical coordinate in tiles.
Definition: tmstruct.h:37
uint8_t x
Horizontal coordinate in tiles.
Definition: tmstruct.h:35
Defines a spawner to create mobiles in the world.
Definition: tmstruct.h:59
char name[TILEMAP_SPAWN_NAME_SZ]
Internal name of a spawned MOBILE.
Definition: tmstruct.h:61
int16_t script_id
Index of TILEMAP::scripts attached to mobiles spawned.
Definition: tmstruct.h:80
uint16_t flags
dsekai_mobile_flags to pass to spawned MOBILE::flags.
Definition: tmstruct.h:72
struct TILEMAP_COORDS coords
Tile-based coordinates at which to spawn.
Definition: tmstruct.h:65
RESOURCE_NAME sprite_name
RESOURCE_NAME for the MOBILE::sprite on a spawned MOBILE.
Definition: tmstruct.h:69
SPAWN_GID gid
Unique identifying number for this spawner loaded from tilemap.
Definition: tmstruct.h:78
Information pertaining to in-game world currently loaded.
Definition: tmstruct.h:87
uint8_t tiles_flags[TILEMAP_TH *TILEMAP_TW]
Special flag bitfields indicating each tile's behavior.
Definition: tmstruct.h:104
struct TILESET_TILE tileset[TILEMAP_TILESETS_MAX]
Array of prototype tiles all map tiles are based on.
Definition: tmstruct.h:100
TILEMAP_GID gid
Globally unique ID for this tilemap.
Definition: tmstruct.h:98
uint8_t tiles[(TILEMAP_TH *TILEMAP_TW)/2]
Array of 4-bit numbers representing tiles composing the map.
Definition: tmstruct.h:102
uint8_t flags
Current Tilemap Flags.
Definition: tmstruct.h:91
char strpool[TILEMAP_STRPOOL_SZ]
Strings used in dialog/signs on this map.
Definition: tmstruct.h:108
struct CROP_DEF crop_defs[TILEMAP_CROP_DEFS_MAX]
Crops able to be grown on this map.
Definition: tmstruct.h:114
struct ITEM item_defs[TILEMAP_ITEMS_MAX]
Items able to be collected on this map.
Definition: tmstruct.h:112
char name[TILEMAP_NAME_MAX]
Tilemap name.
Definition: tmstruct.h:89
struct TILEMAP_SPAWN spawns[TILEMAP_SPAWNS_MAX]
Mobile spawns on this map.
Definition: tmstruct.h:106
Tile prototype stored in TILEMAP::tileset.
Definition: tmstruct.h:41
RESOURCE_NAME image_name
Indentifier for graphical asset representing this tile.
Definition: tmstruct.h:43
uint8_t flags
Flags indicating behavior for this tile.
Definition: tmstruct.h:46
uint16_t image_cache_id
Index of the tile image loaded in the Unilayer Graphics Cache.
Definition: tmstruct.h:51