3 * Structs for objects on the map and their type definitions, and routines to
4 * initialize these and load and save them from/to files.
12 #include <stdio.h> /* for FILE typedef */
13 #include <stdint.h> /* for uint8_t */
14 #include "yx_uint16.h" /* for yx_uint16 coordinates */
19 /* Player is non-standard: single and of a hard-coded type. */
28 /* Structs for standard map objects. */
33 char type; /* Map object type identifier (see MapObjDef.id). */
34 struct yx_uint16 pos; /* Coordinate of object on map. */
39 struct MapObj map_obj;
44 struct MapObj map_obj;
50 /* Structs for map object *type* definitions. Values common to all members of
51 * a single monster or item type are harvested from these.
56 struct MapObjDef * next;
57 char m_or_i; /* Is it item or monster? "i" for items, "m" for monsters. */
58 char id; /* Unique identifier of the map object type to describe. */
59 char mapchar; /* Map object symbol to appear on map.*/
60 char * desc; /* String describing map object in the game log. */
65 struct MapObjDef map_obj_def;
70 struct MapObjDef map_obj_def;
71 uint8_t hitpoints_start; /* Hitpoints each monster starts with. */
76 /* Initialize map object type definitions from file at path "filename". */
77 extern void init_map_object_defs(struct World * world, char * filename);
81 /* Build into memory starting at "start" chain of "n" map objects of type
84 extern void * build_map_objects(struct World * world, void * start, char def_id,
89 /* Write to/read from file chain of map objects starting/to start in memory at
92 extern uint8_t write_map_objects(struct World * world, void * start,
94 extern uint8_t read_map_objects(struct World * world, void * start,
99 /* Get pointer to the map object definition of identifier "def_id". */
100 extern struct MapObjDef * get_map_obj_def(struct World * world, char def_id);