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 uint8_t id; /* Unique identifier of individual map object. */
34 char type; /* Map object type identifier (see MapObjDef.id). */
35 struct yx_uint16 pos; /* Coordinate of object on map. */
40 struct MapObj map_obj;
45 struct MapObj map_obj;
51 /* Structs for map object *type* definitions. Values common to all members of
52 * a single monster or item type are harvested from these.
57 struct MapObjDef * next;
58 char m_or_i; /* Is it item or monster? "i" for items, "m" for monsters. */
59 char id; /* Unique identifier of the map object type to describe. */
60 char mapchar; /* Map object symbol to appear on map.*/
61 char * desc; /* String describing map object in the game log. */
66 struct MapObjDef map_obj_def;
71 struct MapObjDef map_obj_def;
72 uint8_t corpse_id; /* ID of object type killed monster changes to. */
73 uint8_t hitpoints_start; /* Hitpoints each monster starts with. */
78 /* Initialize map object type definitions from file at path "filename". */
79 extern void init_map_object_defs(struct World * world, char * filename);
83 /* Free item / monster definitions in map object chain starting at "md_start" /
86 extern void free_item_defs(struct ItemDef * id_start);
87 extern void free_monster_defs(struct MonsterDef * md_start);
91 /* Build into memory starting at "start" chain of "n" map objects of type
94 extern void * build_map_objects(struct World * world, void * start, char def_id,
99 /* Write to/read from file chain of map objects starting/to start in memory at
102 extern uint8_t write_map_objects(struct World * world, void * start,
104 extern uint8_t read_map_objects(struct World * world, void * start,
108 /* Free items / monsters in map object chain starting at "item" / "monster". */
109 extern void free_items(struct Item * item);
110 extern void free_monsters(struct Monster * monster);
112 /* Get pointer to the map object definition of identifier "def_id". */
113 extern struct MapObjDef * get_map_obj_def(struct World * world, char def_id);