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.33 by root, Mon Dec 25 14:43:23 2006 UTC vs.
Revision 1.34 by root, Mon Dec 25 14:54:44 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/* Convenient function - total number of spaces is used
65 * in many places.
66 */
67#define MAP_SIZE(m) ((m)->width * (m)->height)
68
69#define MAP_ENTER_X(m) (m)->enter_x
70#define MAP_ENTER_Y(m) (m)->enter_y
71
72#define MAP_TEMP(m) (m)->temp
73#define MAP_PRESSURE(m) (m)->pressure
74#define MAP_HUMID(m) (m)->humid
75#define MAP_WINDSPEED(m) (m)->windspeed
76#define MAP_WINDDIRECTION(m) (m)->winddir
77#define MAP_SKYCOND(m) (m)->sky
78#define MAP_WORLDPARTX(m) (m)->wpartx
79#define MAP_WORLDPARTY(m) (m)->wparty
80#define MAP_NOSMOOTH(m) (m)->nosmooth
81
82/* options passed to ready_map_name and load_original_map */ 49/* options passed to ready_map_name and load_original_map */
83#define MAP_FLUSH 0x1 50#define MAP_FLUSH 0x01
84#define MAP_PLAYER_UNIQUE 0x2 51#define MAP_PLAYER_UNIQUE 0x02
85#define MAP_BLOCK 0x4 52#define MAP_BLOCK 0x04
86#define MAP_STYLE 0x8 53#define MAP_STYLE 0x08
87#define MAP_OVERLAY 0x10 54#define MAP_OVERLAY 0x10
88 55
89/* Values for in_memory below. Should probably be an enumerations */ 56/* Values for in_memory below. Should probably be an enumerations */
90#define MAP_IN_MEMORY 1 57#define MAP_IN_MEMORY 1
91#define MAP_SWAPPED 2 58#define MAP_SWAPPED 2
98 * consistent (eg, op->map, op->x, op->y) 65 * consistent (eg, op->map, op->x, op->y)
99 */ 66 */
100// all those macros are herewith declared legacy 67// all those macros are herewith declared legacy
101#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 ()
102#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
103#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
104#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
105#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]
106#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]
107#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
108#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
152 * 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
153 * to extend information about a space. 120 * to extend information about a space.
154 */ 121 */
155struct mapspace 122struct mapspace
156{ 123{
157 object *bottom; /* lowest object on this space */ 124 object *bot, *top; /* lowest/highest object on this space */
158 object *top; /* Highest object on this space */
159 New_Face *faces[MAP_LAYERS]; /* faces for the 3 layers */ 125 New_Face *faces[MAP_LAYERS]; /* faces for the 3 layers */
160 object *faces_obj[MAP_LAYERS];/* face objects for the 3 layers */ 126 object *faces_obj[MAP_LAYERS];/* face objects for the 3 layers */
161 uint8 flags_; /* flags about this space (see the P_ values above) */ 127 uint8 flags_; /* flags about this space (see the P_ values above) */
162 sint8 light; /* How much light this space provides */ 128 sint8 light; /* How much light this space provides */
163 MoveType move_block; /* What movement types this space blocks */ 129 MoveType move_block; /* What movement types this space blocks */
305 sint16 ACC (RW, pressure); /* barometric pressure (mb) */ 271 sint16 ACC (RW, pressure); /* barometric pressure (mb) */
306 sint8 ACC (RW, humid); /* humitidy of this tile */ 272 sint8 ACC (RW, humid); /* humitidy of this tile */
307 sint8 ACC (RW, windspeed); /* windspeed of this tile */ 273 sint8 ACC (RW, windspeed); /* windspeed of this tile */
308 sint8 ACC (RW, winddir); /* direction of wind */ 274 sint8 ACC (RW, winddir); /* direction of wind */
309 sint8 ACC (RW, sky); /* sky conditions */ 275 sint8 ACC (RW, sky); /* sky conditions */
310 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 */
311 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 */
312 char *ACC (RO, shoprace); /* the preffered race of the local shopkeeper */ 278 char *ACC (RO, shoprace); /* the preffered race of the local shopkeeper */
313 double ACC (RW, shopgreed); /* how much our shopkeeper overcharges */ 279 double ACC (RW, shopgreed); /* how much our shopkeeper overcharges */
314 sint64 ACC (RW, shopmin); /* minimum price a shop will trade for */ 280 sint64 ACC (RW, shopmin); /* minimum price a shop will trade for */
315 sint64 ACC (RW, shopmax); /* maximum price a shop will offer */ 281 sint64 ACC (RW, shopmax); /* maximum price a shop will offer */
324 void do_destroy (); 290 void do_destroy ();
325 void gather_callbacks (AV *&callbacks, event_type event) const; 291 void gather_callbacks (AV *&callbacks, event_type event) const;
326 292
327 void allocate (); 293 void allocate ();
328 294
295 int size () const { return width * height; }
296
329 mapspace const &at (uint32 x, uint32 y) const { return spaces [x + width * y]; } 297 mapspace const &at (uint32 x, uint32 y) const { return spaces [x + width * y]; }
330 mapspace &at (uint32 x, uint32 y) { return spaces [x + width * y]; } 298 mapspace &at (uint32 x, uint32 y) { return spaces [x + width * y]; }
331}; 299};
332 300
333/* This is used by get_rangevector to determine where the other 301/* This is used by get_rangevector to determine where the other

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines