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 corpse_id; /* ID of object type killed monster changes to. */
72 uint8_t hitpoints_start; /* Hitpoints each monster starts with. */
77 /* Initialize map object type definitions from file at path "filename". */
78 extern void init_map_object_defs(struct World * world, char * filename);
82 /* Free item / monster definitions in map object chain starting at "md_start" /
85 extern void free_item_defs(struct ItemDef * id_start);
86 extern void free_monster_defs(struct MonsterDef * md_start);
90 /* Build into memory starting at "start" chain of "n" map objects of type
93 extern void * build_map_objects(struct World * world, void * start, char def_id,
98 /* Write to/read from file chain of map objects starting/to start in memory at
101 extern uint8_t write_map_objects(struct World * world, void * start,
103 extern uint8_t read_map_objects(struct World * world, void * start,
107 /* Free items / monsters in map object chain starting at "item" / "monster". */
108 extern void free_items(struct Item * item);
109 extern void free_monsters(struct Monster * monster);
111 /* Get pointer to the map object definition of identifier "def_id". */
112 extern struct MapObjDef * get_map_obj_def(struct World * world, char def_id);