src/hcode/btech/map.h

Go to the documentation of this file.
00001 
00002 /*
00003  * $Id: map.h,v 1.2 2005/06/22 15:08:04 av1-op Exp $
00004  *
00005  * Last modified: Sat Jun  6 20:30:40 1998 fingon
00006  *
00007  * Original authors: 
00008  *   4.8.93- rdm created
00009  *   6.16.93- jb modified, added hex_struct
00010  * Since that modified by:
00011  *   '95 - '97: Markus Stenberg <fingon@iki.fi>
00012  *   '98 - '02: Thomas Woutes <thomas@xs4all.net>
00013  */
00014 
00015 #ifndef _MAP_H
00016 #define _MAP_H
00017 
00018 /*
00019    map.h
00020    Structure definitions and what not for the maps for the mechs.
00021 
00022  */
00023 
00024 #define MAX_MECHS_PER_MAP 250
00025 
00026 /* map links */
00027 #define MAP_UP 0
00028 #define MAP_DOWN 1
00029 #define MAP_RIGHT 2
00030 #define MAP_LEFT 3
00031 
00032 /* Map size */
00033 #define MAPX 1000
00034 #define MAPY 1000
00035 #define MAP_NAME_SIZE 30
00036 #define NUM_MAP_LINKS 4
00037 #define DEFAULT_MAP_WIDTH 21
00038 #define DEFAULT_MAP_HEIGHT 11
00039 #define MAP_DISPLAY_WIDTH 21
00040 #define MAP_DISPLAY_HEIGHT 14 
00041 #define MAX_ELEV 9
00042 #define GRASSLAND ' '
00043 #define HEAVY_FOREST '"'
00044 #define LIGHT_FOREST '`'
00045 #define WATER '~'
00046 #define HIGHWATER '?'
00047 #define ROUGH '%'
00048 #define MOUNTAINS '^'
00049 #define ROAD '#'
00050 #define BUILDING '@'
00051 #define FIRE '&'
00052 #define TFIRE '>'
00053 #define SMOKE ':'
00054 #define WALL '='
00055 
00056 #define BRIDGE '/'
00057 #define SNOW   '+'
00058 #define ICE    '-'
00059 
00060 #define UNKNOWN_TERRAIN '$'
00061 
00062 /*
00063  * Various Map flags, for use for setting different affects on the map
00064  */
00065 #define MAPFLAG_MAPO            1       /* (a) We got mapobjs */
00066 #define MAPFLAG_SPEC            2       /* (b) We're using special rules - gravity/temp */
00067 #define MAPFLAG_VACUUM          4       /* (c) We're in vacuum */
00068 #define MAPFLAG_FIRES           8       /* (d) We have eternal fires */
00069 #define MAPFLAG_UNDERGROUND     16      /* (e) We're underground. No ejecting, jumping, 
00070                                            VTOL taking off */
00071 #define MAPFLAG_DARK            32      /* (f) We can't see map beyond sensor range */
00072 #define MAPFLAG_BRIDGESCS       64      /* (g) We can't destroy bridges on this map */
00073 #define MAPFLAG_NOBRIDGIFY      128     /* (h) We shouldn't convert roads into bridges */
00074 #define MAPFLAG_NOFRIENDLYFIRE  256     /* (i) We can't shoot friendlies AT ALL on this map */
00075 
00076 #define TYPE_FIRE  0            /* Fire - datas = counter until next spread, datac = stuff to burn */
00077 #define TYPE_SMOKE 1            /* Smoke - datas = time until it gets lost */
00078 #define TYPE_DEC   2            /* Decoration, like those 2 previous ones. obj = obj# of DS it is related to, datac = char it replaced */
00079 #define TYPE_LAST_DEC 2
00080 #define TYPE_MINE  3            /* datac = type, datas = damage it causes, datai = extra */
00081 #define TYPE_BUILD 4            /* Building obj=# of the internal map */
00082 #define TYPE_LEAVE 5            /* Reference to what happens when U leave ; obj=# of new map */
00083 #define TYPE_ENTRANCE 6         /* datac = dir of entry (0=dontcare), x/y */
00084 
00085 #define TYPE_LINKED  7          /* If this exists, we got a maplink propably */
00086 #define TYPE_BITS    8          /* hangar / mine bit array, if any (in datai) */
00087 #define TYPE_B_LZ    9          /* Land-block */
00088 #define NUM_MAPOBJTYPES 10
00089 
00090 #define BUILDFLAG_CS  1         /* Externally CS */
00091 #define BUILDFLAG_CSI 2         /* Internally CS */
00092 #define BUILDFLAG_DSS 4         /* DontShowStep when someone steps on the base */
00093 #define BUILDFLAG_NOB 8         /* No way to break in */
00094 #define BUILDFLAG_HID 16        /* Really hidden */
00095 
00096 #define MapIsCS(map)       (map->buildflag & BUILDFLAG_CSI)
00097 #define BuildIsCS(map)     (map->buildflag & BUILDFLAG_CS)
00098 #define BuildIsHidden(map) (map->buildflag & (BUILDFLAG_DSS|BUILDFLAG_HID))
00099 #define BuildIsSafe(map)   (map->buildflag & BUILDFLAG_NOB)
00100 #define BuildIsInvis(map)  (map->buildflag & BUILDFLAG_HID)
00101 
00102 #define MapUnderSpecialRules(map)   ((map)->flags & MAPFLAG_SPEC)
00103 #define MapGravityMod(map)          (map)->grav
00104 #define MapGravity                  MapGravityMod
00105 #define MapIsVacuum(map)            ((map)->flags & MAPFLAG_VACUUM)
00106 #define MapTemperature(map)         (map)->temp
00107 #define MapCloudbase(map)           (map)->cloudbase
00108 #define MapIsUnderground(map)       ((map)->flags & MAPFLAG_UNDERGROUND)
00109 #define MapIsDark(map)              ((map)->flags & MAPFLAG_DARK)
00110 #define MapBridgesCS(map)           ((map)->flags & MAPFLAG_BRIDGESCS)
00111 #define MapNoBridgify(map)          ((map)->flags & MAPFLAG_NOBRIDGIFY)
00112 #define MapNoFriendlyFire(map)      ((map)->flags & MAPFLAG_NOFRIENDLYFIRE)
00113 
00114 typedef struct mapobj_struct {
00115     short x, y;
00116     dbref obj;
00117     char type;
00118     char datac;
00119     short datas;
00120     int datai;
00121     struct mapobj_struct *next;
00122 } mapobj;
00123 
00124 #define MECHMAPFLAG_MOVED  1    /* mech has moved since last LOS update */
00125 
00126 #define MECHLOSFLAG_SEEN   0x0001       /* x <mech> has seen <target> (before) */
00127 #define MECHLOSFLAG_SEESP  0x0002       /* x <mech> sees <target> now w/ primary */
00128 #define MECHLOSFLAG_SEESS  0x0004       /* x <mech> sees <target> now w/ secondary */
00129 #define MECHLOSFLAG_SEEC2  0x0008       /* The terrain flag has been calculated */
00130 #define MECHLOSFLAG_MNTN   0x0010       /* Intervening mountain hexes? */
00131 
00132 #define MECHLOSFLAG_WOOD   0x0020       /* The number of intervening woods hexes */
00133 #define MECHLOSFLAG_WOOD2  0x0040       /* Heavywood = 2, Light = 1 */
00134 #define MECHLOSFLAG_WOOD3  0x0080
00135 #define MECHLOSFLAG_WOOD4  0x0100
00136 #define MECHLOSBYTES_WOOD  4
00137 #define MECHLOSMAX_WOOD    16   /* No sensors penetrate this far */
00138 
00139 #define MECHLOSFLAG_WATER  0x0200       /* The number of intervening water hexes */
00140 #define MECHLOSFLAG_WATER2 0x0400
00141 #define MECHLOSFLAG_WATER3 0x0800
00142 #define MECHLOSBYTES_WATER 3
00143 #define MECHLOSMAX_WATER   8    /* No sensors penetrate this far */
00144 
00145 #define MECHLOSFLAG_PARTIAL 0x1000      /* The target's in partial cover for
00146                                            da shooter */
00147 #define MECHLOSFLAG_FIRE    0x2000      /* Fire between mech and target */
00148 #define MECHLOSFLAG_SMOKE   0x4000      /* Smoke between mech and target */
00149 #define MECHLOSFLAG_BLOCK   0x8000      /* Something blocks vision 
00150                                            (elevation propably) */
00151 
00152 typedef struct {
00153     dbref mynum;                        /* My dbref */
00154     unsigned char **map;                /* The map */
00155     char mapname[MAP_NAME_SIZE + 1];
00156 
00157     short map_width;                    /* Width of map <MAPX  */
00158     short map_height;                   /* Height of map */
00159 
00160     char temp;                          /* Temperature, in celsius degrees */
00161     unsigned char grav;                 /* Gravity, if any ; in 1/100 G's */
00162     short cloudbase;
00163     char unused_char;
00164     char mapvis;                        /* Visibility on the map, used as base 
00165                                            for most sensor types */
00166     short maxvis;                       /* maximum visibility (usually mapvis * n) */
00167     char maplight;
00168     short winddir, windspeed;
00169 
00170     /* Now, da wicked stuff */
00171     int flags;
00172 
00173     mapobj *mapobj[NUM_MAPOBJTYPES];
00174     short cf, cfmax;
00175     dbref onmap;
00176     char buildflag;
00177 
00178     unsigned char first_free;           /* First free on da map */
00179     dbref *mechsOnMap;                  /* Mechs on the map */
00180     unsigned short **LOSinfo;           /* Line of sight info */
00181 
00182     /* 1 = mech has moved recently
00183        2 = mech has possible-LOS event ongoing */
00184     char *mechflags;
00185     short moves;                        /* Cheat to prevent idle CPU hoggage */
00186     short movemod;
00187     int sensorflags;
00188 } MAP;
00189 
00190 /* Used by navigate_sketch_map */
00191 #define NAVIGATE_LINES 13
00192 
00193 #include "p.map.bits.h"
00194 #include "p.map.h"
00195 #include "p.map.obj.h"
00196 #include "p.map.dynamic.h"
00197 
00198 extern void newfreemap(dbref key, void **data, int selector);
00199 extern void map_update(dbref obj, void *data);
00200 
00201 #define set_buildflag(a,b) silly_atr_set((a), A_BUILDFLAG, tprintf("%d", (b)))
00202 #define get_buildflag(a) atoi(silly_atr_get((a), A_BUILDFLAG))
00203 #define set_buildcf(a,b) silly_atr_set((a), A_BUILDCF, tprintf("%d %d", (b), (b)))
00204 #endif

Generated on Mon May 28 04:25:21 2007 for BattletechMUX by  doxygen 1.4.7