2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2002, 2003 Gordon McNutt
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
20 // gmcnutt@users.sourceforge.net
33 extern char *TERRAIN_MAP_MAGIC;
39 struct terrain_palette * palette;
40 struct terrain **terrain;
42 void *handle; /* pointer to session handle */
43 int saved; /* 1 iff already saved */
46 /* added to support composite maps */
47 int submap_w; /* submap width */
48 int submap_h; /* submap height */
49 char composite : 1; /* save as composite */
52 extern struct terrain_map *terrain_map_new(const char *tag,
55 struct terrain_palette * pal);
56 #define terrain_map_ref(map) ((map)->refcount++)
57 extern void terrain_map_unref(struct terrain_map *map);
58 extern struct terrain_map *terrain_map_clone(struct terrain_map *orig,
60 extern void terrain_map_rotate(struct terrain_map *map, int degree);
61 extern void terrain_map_blit(struct terrain_map *dest, int dest_x,
62 int dest_y, struct terrain_map *src,
63 int src_x, int src_y, int w, int h);
64 extern void terrain_map_fill(struct terrain_map *map, int x, int y, int w, int h, struct terrain *fill);
65 extern void terrain_map_print(FILE * fp, int indent,
66 struct terrain_map *map);
67 extern void print_horizontal_guideline (FILE * fp, int indent,
68 struct terrain_map *map);
70 extern void terrain_map_save(struct save *, void *val);
71 extern void terrain_map_blend(struct terrain_map *map,
74 struct terrain **nonsup,
75 struct terrain *range[16]);
78 static inline void terrain_map_set_terrain(struct terrain_map *map, int x, int y, struct terrain *val)
80 map->terrain[y * map->w + x] = val;
84 static inline struct terrain *terrain_map_get_terrain(struct terrain_map *map, int x, int y)
86 return map->terrain[y * map->w + x];