ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/map.h
(Generate patch)

Comparing deliantra/server/include/map.h (file contents):
Revision 1.32 by root, Mon Dec 25 11:25:49 2006 UTC vs.
Revision 1.38 by root, Wed Dec 27 09:28:01 2006 UTC

30#define MAP_H 30#define MAP_H
31 31
32#include "cfperl.h" 32#include "cfperl.h"
33 33
34/* We set this size - this is to make magic map work properly on 34/* We set this size - this is to make magic map work properly on
35 * tiled maps. There is no requirement that this matches the 35 * tiled maps. There is no requirement that this matches the
36 * tiled maps size - it just seemed like a reasonable value. 36 * tiled maps size - it just seemed like a reasonable value.
37 * Magic map code now always starts out putting the player in the 37 * Magic map code now always starts out putting the player in the
38 * center of the map - this makes the most sense when dealing 38 * center of the map - this makes the most sense when dealing
39 * with tiled maps. 39 * with tiled maps.
40 * We also figure out the magicmap color to use as we process the 40 * We also figure out the magicmap color to use as we process the
44#define MAGIC_MAP_SIZE 50 44#define MAGIC_MAP_SIZE 50
45#define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2 45#define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2
46 46
47#define MAP_LAYERS 3 47#define MAP_LAYERS 3
48 48
49/* This is when the map will reset */
50#define MAP_WHEN_RESET(m) ((m)->reset_time)
51
52#define MAP_RESET_TIMEOUT(m) ((m)->reset_timeout)
53#define MAP_DIFFICULTY(m) ((m)->difficulty)
54#define MAP_TIMEOUT(m) ((m)->timeout)
55#define MAP_SWAP_TIME(m) ((m)->swap_time)
56#define MAP_OUTDOORS(m) ((m)->outdoor)
57
58/* mape darkness used to enforce the MAX_DARKNESS value.
59 * but IMO, if it is beyond max value, that should be fixed
60 * on the map or in the code.
61 */
62#define MAP_DARKNESS(m) (m)->darkness
63
64#define MAP_WIDTH(m) (m)->width
65#define MAP_HEIGHT(m) (m)->height
66
67/* Convenient function - total number of spaces is used
68 * in many places.
69 */
70#define MAP_SIZE(m) ((m)->width * (m)->height)
71
72#define MAP_ENTER_X(m) (m)->enter_x
73#define MAP_ENTER_Y(m) (m)->enter_y
74
75#define MAP_TEMP(m) (m)->temp
76#define MAP_PRESSURE(m) (m)->pressure
77#define MAP_HUMID(m) (m)->humid
78#define MAP_WINDSPEED(m) (m)->windspeed
79#define MAP_WINDDIRECTION(m) (m)->winddir
80#define MAP_SKYCOND(m) (m)->sky
81#define MAP_WORLDPARTX(m) (m)->wpartx
82#define MAP_WORLDPARTY(m) (m)->wparty
83#define MAP_NOSMOOTH(m) (m)->nosmooth
84
85/* options passed to ready_map_name and load_original_map */ 49/* options passed to ready_map_name and load_original_map */
86#define MAP_FLUSH 0x1 50#define MAP_FLUSH 0x01
87#define MAP_PLAYER_UNIQUE 0x2 51#define MAP_PLAYER_UNIQUE 0x02
88#define MAP_BLOCK 0x4 52#define MAP_BLOCK 0x04
89#define MAP_STYLE 0x8 53#define MAP_STYLE 0x08
90#define MAP_OVERLAY 0x10 54#define MAP_OVERLAY 0x10
91 55
92/* Values for in_memory below. Should probably be an enumerations */ 56/* Values for in_memory below. Should probably be an enumerations */
93#define MAP_IN_MEMORY 1 57#define MAP_IN_MEMORY 1
94#define MAP_SWAPPED 2 58#define MAP_SWAPPED 2
101 * consistent (eg, op->map, op->x, op->y) 65 * consistent (eg, op->map, op->x, op->y)
102 */ 66 */
103// all those macros are herewith declared legacy 67// all those macros are herewith declared legacy
104#define GET_MAP_FLAGS(M,X,Y) (M)->at((X),(Y)).flags () 68#define GET_MAP_FLAGS(M,X,Y) (M)->at((X),(Y)).flags ()
105#define GET_MAP_LIGHT(M,X,Y) (M)->at((X),(Y)).light 69#define GET_MAP_LIGHT(M,X,Y) (M)->at((X),(Y)).light
106#define GET_MAP_OB(M,X,Y) (M)->at((X),(Y)).bottom 70#define GET_MAP_OB(M,X,Y) (M)->at((X),(Y)).bot
107#define GET_MAP_TOP(M,X,Y) (M)->at((X),(Y)).top 71#define GET_MAP_TOP(M,X,Y) (M)->at((X),(Y)).top
108#define GET_MAP_FACE(M,X,Y,L) (M)->at((X),(Y)).faces[L] 72#define GET_MAP_FACE(M,X,Y,L) (M)->at((X),(Y)).faces[L]
109#define GET_MAP_FACE_OBJ(M,X,Y,L) (M)->at((X),(Y)).faces_obj[L] 73#define GET_MAP_FACE_OBJ(M,X,Y,L) (M)->at((X),(Y)).faces_obj[L]
110#define GET_MAP_MOVE_BLOCK(M,X,Y) (M)->at((X),(Y)).move_block 74#define GET_MAP_MOVE_BLOCK(M,X,Y) (M)->at((X),(Y)).move_block
111#define GET_MAP_MOVE_SLOW(M,X,Y) (M)->at((X),(Y)).move_slow 75#define GET_MAP_MOVE_SLOW(M,X,Y) (M)->at((X),(Y)).move_slow
155 * This puts it all in one place, and should also make it easier 119 * This puts it all in one place, and should also make it easier
156 * to extend information about a space. 120 * to extend information about a space.
157 */ 121 */
158struct mapspace 122struct mapspace
159{ 123{
160 object *bottom; /* lowest object on this space */ 124 object *bot, *top; /* lowest/highest object on this space */
161 object *top; /* Highest object on this space */
162 New_Face *faces[MAP_LAYERS]; /* faces for the 3 layers */ 125 New_Face *faces[MAP_LAYERS]; /* faces for the 3 layers */
163 object *faces_obj[MAP_LAYERS];/* face objects for the 3 layers */ 126 object *faces_obj[MAP_LAYERS];/* face objects for the 3 layers */
164 uint8 flags_; /* flags about this space (see the P_ values above) */ 127 uint8 flags_; /* flags about this space (see the P_ values above) */
165 sint8 light; /* How much light this space provides */ 128 sint8 light; /* How much light this space provides */
166 MoveType move_block; /* What movement types this space blocks */ 129 MoveType move_block; /* What movement types this space blocks */
308 sint16 ACC (RW, pressure); /* barometric pressure (mb) */ 271 sint16 ACC (RW, pressure); /* barometric pressure (mb) */
309 sint8 ACC (RW, humid); /* humitidy of this tile */ 272 sint8 ACC (RW, humid); /* humitidy of this tile */
310 sint8 ACC (RW, windspeed); /* windspeed of this tile */ 273 sint8 ACC (RW, windspeed); /* windspeed of this tile */
311 sint8 ACC (RW, winddir); /* direction of wind */ 274 sint8 ACC (RW, winddir); /* direction of wind */
312 sint8 ACC (RW, sky); /* sky conditions */ 275 sint8 ACC (RW, sky); /* sky conditions */
313 int ACC (RW, wpartx), ACC (RW, wparty); /*Highly fasten conversion between worldmap and weathermap */ 276 int ACC (RW, worldpartx), ACC (RW, worldparty); /*Highly fasten conversion between worldmap and weathermap */
314 struct shopitems *shopitems; /* a semi-colon seperated list of item-types the map's shop will trade in */ 277 struct shopitems *shopitems; /* a semi-colon seperated list of item-types the map's shop will trade in */
315 char *ACC (RO, shoprace); /* the preffered race of the local shopkeeper */ 278 char *ACC (RO, shoprace); /* the preffered race of the local shopkeeper */
316 double ACC (RW, shopgreed); /* how much our shopkeeper overcharges */ 279 double ACC (RW, shopgreed); /* how much our shopkeeper overcharges */
317 sint64 ACC (RW, shopmin); /* minimum price a shop will trade for */ 280 sint64 ACC (RW, shopmin); /* minimum price a shop will trade for */
318 sint64 ACC (RW, shopmax); /* maximum price a shop will offer */ 281 sint64 ACC (RW, shopmax); /* maximum price a shop will offer */
325 maptile (); 288 maptile ();
326 ~maptile (); 289 ~maptile ();
327 void do_destroy (); 290 void do_destroy ();
328 void gather_callbacks (AV *&callbacks, event_type event) const; 291 void gather_callbacks (AV *&callbacks, event_type event) const;
329 292
330 void allocate (); 293 MTH void allocate ();
294 MTH int size () const { return width * height; }
331 295
296 MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0);
297
332 mapspace const &at (uint32 x, uint32 y) const { return spaces [x + width * y]; } 298 mapspace const &at (uint32 x, uint32 y) const { return spaces [x * height + y]; }
333 mapspace &at (uint32 x, uint32 y) { return spaces [x + width * y]; } 299 mapspace &at (uint32 x, uint32 y) { return spaces [x * height + y]; }
334}; 300};
301
302#define for_all_maps(var) for (maptile *var = first_map; var; var = var->next)
335 303
336/* This is used by get_rangevector to determine where the other 304/* This is used by get_rangevector to determine where the other
337 * creature is. get_rangevector takes into account map tiling, 305 * creature is. get_rangevector takes into account map tiling,
338 * so you just can not look the the map coordinates and get the 306 * so you just can not look the the map coordinates and get the
339 * righte value. distance_x/y are distance away, which 307 * righte value. distance_x/y are distance away, which

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines