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 "yx_uint16.h" /* for yx_uint16 coordinates */
18 /* Player is non-standard: single and of a hard-coded type. */
22 unsigned char hitpoints;
27 /* Structs for standard map objects. */
32 char type; /* Map object type identifier (see MapObjDef.id). */
33 struct yx_uint16 pos; /* Coordinate of object on map. */
38 struct MapObj map_obj;
43 struct MapObj map_obj;
44 unsigned char hitpoints;
49 /* Structs for map object *type* definitions. Values common to all members of
50 * a single monster or item type are harvested from these.
55 struct MapObjDef * next;
56 char m_or_i; /* Is it item or monster? "i" for items, "m" for monsters. */
57 char id; /* Unique identifier of the map object type to describe. */
58 char mapchar; /* Map object symbol to appear on map.*/
59 char * desc; /* String describing map object in the game log. */
64 struct MapObjDef map_obj_def;
69 struct MapObjDef map_obj_def;
70 unsigned char hitpoints_start; /* Hitpoints each monster starts with. */
75 /* Initialize map object type definitions from file at path "filename". */
76 extern void init_map_object_defs(struct World * world, char * filename);
80 /* Build into memory starting at "start" chain of "n" map objects of type
83 extern void * build_map_objects(struct World * world, void * start, char def_id,
88 /* Write to/read from file chain of map objects starting/to start in memory at
91 extern void write_map_objects(struct World * world, void * start, FILE * file);
92 extern void read_map_objects(struct World * world, void * start, FILE * file);
96 /* Get pointer to the map object definition of identifier "def_id". */
97 extern struct MapObjDef * get_map_obj_def(struct World * world, char def_id);