This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | mech_findcenter (dbref player, void *data, char *buffer) |
const char * | GetTerrainName_base (int t) |
const char * | GetTerrainName (MAP *map, int x, int y) |
void | mech_navigate (dbref player, void *data, char *buffer) |
char | GetLRSMechChar (MECH *mech, MECH *tempMech) |
void | mech_lrsmap (dbref player, void *data, char *buffer) |
char * | TerrainColor (char terrain, int elev) |
void | TacMapTerr (MAP *mech_map, int x, int y, char *terr, char *elev, int isdown) |
char ** | MakeMapText (dbref player, MECH *mech, MAP *mech_map, int x, int y, int xw, int yw, int labels, int dohexlos) |
void | mech_tacmap (dbref player, void *data, char *buffer) |
void | mech_enterbase (dbref player, void *data, char *buffer) |
Definition at line 286 of file mech.maps.c.
References c, IsDS, MechMove, MechSeemsFriend, MOVE_BIPED, MOVE_FLY, MOVE_FOIL, MOVE_HOVER, MOVE_HULL, MOVE_QUAD, MOVE_SUB, MOVE_TRACK, MOVE_VTOL, and MOVE_WHEEL.
Referenced by GetLRSMech().
00287 { 00288 char c = 'u'; 00289 00290 if(mech == other) 00291 return '*'; 00292 if(IsDS(other)) 00293 c = 'd'; 00294 switch (MechMove(other)) { 00295 case MOVE_FLY: 00296 c = 'a'; 00297 case MOVE_BIPED: 00298 c = 'b'; 00299 break; 00300 case MOVE_QUAD: 00301 c = 'q'; 00302 break; 00303 case MOVE_TRACK: 00304 c = 't'; 00305 break; 00306 case MOVE_WHEEL: 00307 c = 'w'; 00308 break; 00309 case MOVE_HOVER: 00310 c = 'h'; 00311 break; 00312 case MOVE_VTOL: 00313 c = 'v'; 00314 break; 00315 case MOVE_HULL: 00316 c = 'n'; 00317 break; 00318 case MOVE_SUB: 00319 c = 's'; 00320 break; 00321 case MOVE_FOIL: 00322 c = 'f'; 00323 break; 00324 } 00325 if(!MechSeemsFriend(mech, other)) 00326 c = toupper(c); 00327 return c; 00328 }
const char* GetTerrainName | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 124 of file mech.maps.c.
References GetTerrain, and GetTerrainName_base().
Referenced by mech_navigate().
00125 { 00126 return GetTerrainName_base(GetTerrain(map, x, y)); 00127 }
const char* GetTerrainName_base | ( | int | t | ) |
Definition at line 89 of file mech.maps.c.
References BRIDGE, BUILDING, FIRE, GRASSLAND, HEAVY_FOREST, HIGHWATER, ICE, LIGHT_FOREST, MOUNTAINS, ROAD, ROUGH, SMOKE, WALL, and WATER.
Referenced by GetTerrainName(), and map_load().
00090 { 00091 switch (t) { 00092 case GRASSLAND: 00093 case '_': 00094 return "Grassland"; 00095 case HEAVY_FOREST: 00096 return "Heavy Forest"; 00097 case LIGHT_FOREST: 00098 return "Light Forest"; 00099 case ICE: 00100 return "Ice"; 00101 case BRIDGE: 00102 return "Bridge"; 00103 case HIGHWATER: 00104 case WATER: 00105 return "Water"; 00106 case ROUGH: 00107 return "Rough"; 00108 case MOUNTAINS: 00109 return "Mountains"; 00110 case ROAD: 00111 return "Road"; 00112 case BUILDING: 00113 return "Building"; 00114 case FIRE: 00115 return "Fire"; 00116 case SMOKE: 00117 return "Smoke"; 00118 case WALL: 00119 return "Wall"; 00120 } 00121 return "Unknown"; 00122 }
char** MakeMapText | ( | dbref | player, | |
MECH * | mech, | |||
MAP * | mech_map, | |||
int | x, | |||
int | y, | |||
int | xw, | |||
int | yw, | |||
int | labels, | |||
int | dohexlos | |||
) |
Definition at line 1302 of file mech.maps.c.
References Ansimap, colourize_tac_map(), is_oddcol(), MAP::map_height, MAP::map_width, MAX, MIN, sketch_tac_cliffs(), sketch_tac_dslz(), sketch_tac_map(), sketch_tac_mechs(), sketch_tac_ownmech(), tac_dispcols(), x, and y.
Referenced by map_view(), mech_navigate(), and mech_tacmap().
01304 { 01305 int docolour = Ansimap(player); 01306 int dispcols; 01307 int disprows; 01308 int mapcols; 01309 int left_offset = 0; 01310 int top_offset = 0; 01311 int navigate = 0; 01312 int sx, sy; 01313 int i; 01314 char *base; 01315 int oddcol1; 01316 enum { 01317 MAX_WIDTH = 40, 01318 MAX_HEIGHT = 24, 01319 TOP_LABEL = 3, 01320 LEFT_LABEL = 4, 01321 RIGHT_LABEL = 3 01322 }; 01323 static char sketch_buf[((LEFT_LABEL + 1 + MAX_WIDTH * 3 + RIGHT_LABEL + 01324 1) * (TOP_LABEL + 1 + MAX_HEIGHT * 2) + 2) * 5]; 01325 static char *lines[(TOP_LABEL + 1 + MAX_HEIGHT * 2 + 1) * 5]; 01326 01327 if(labels & 4) { 01328 navigate = 1; 01329 labels = 0; 01330 } 01331 01332 /* 01333 * Figure out the extent of the tac map to draw. 01334 */ 01335 wx = MIN(MAX_WIDTH, wx); 01336 wy = MIN(MAX_HEIGHT, wy); 01337 01338 sx = cx - wx / 2; 01339 sy = cy - wy / 2; 01340 if(!navigate) { 01341 /* 01342 * Only allow navigate maps to include off map hexes. 01343 */ 01344 sx = MAX(0, MIN(sx, map->map_width - wx)); 01345 sy = MAX(0, MIN(sy, map->map_height - wy)); 01346 wx = MIN(wx, map->map_width); 01347 wy = MIN(wy, map->map_height); 01348 } 01349 01350 mapcols = tac_dispcols(wx); 01351 dispcols = mapcols + 1; 01352 disprows = wy * 2 + 1; 01353 oddcol1 = is_oddcol(sx); 01354 01355 if(navigate) { 01356 if(oddcol1) { 01357 /* 01358 * Insert blank line at the top where we can put 01359 * a "__" to make the navigate map look pretty. 01360 */ 01361 top_offset = 1; 01362 disprows++; 01363 } 01364 } else { 01365 /* 01366 * Allow room for the labels. 01367 */ 01368 if(labels & 1) { 01369 left_offset = LEFT_LABEL; 01370 dispcols += LEFT_LABEL + RIGHT_LABEL; 01371 } 01372 if(labels & 2) { 01373 top_offset = TOP_LABEL; 01374 disprows += TOP_LABEL; 01375 } 01376 } 01377 01378 /* 01379 * Create a sketch tac map including terrain and elevation. 01380 */ 01381 sketch_tac_map(sketch_buf, map, mech, sx, sy, wx, wy, dispcols, 01382 top_offset, left_offset, docolour, dohexlos); 01383 01384 /* 01385 * Draw the top and side labels. 01386 */ 01387 if(labels & 1) { 01388 int x; 01389 01390 for(x = 0; x < wx; x++) { 01391 char scratch[4]; 01392 int label = sx + x; 01393 01394 if(label < 0 || label > 999) { 01395 continue; 01396 } 01397 sprintf(scratch, "%3d", label); 01398 base = sketch_buf + left_offset + 1 + x * 3; 01399 base[0] = scratch[0]; 01400 base[1 * dispcols] = scratch[1]; 01401 base[2 * dispcols] = scratch[2]; 01402 } 01403 } 01404 01405 if(labels & 2) { 01406 int y; 01407 01408 for(y = 0; y < wy; y++) { 01409 int label = sy + y; 01410 01411 base = sketch_buf + (top_offset + 1 + y * 2) 01412 * dispcols; 01413 if(label < 0 || label > 999) { 01414 continue; 01415 } 01416 01417 sprintf(base, "%3d", label); 01418 base[3] = ' '; 01419 sprintf(base + (dispcols - RIGHT_LABEL - 1), "%3d", label); 01420 } 01421 } 01422 01423 if(labels & 8) { 01424 if(mech != NULL) { 01425 sketch_tac_ownmech(sketch_buf, map, mech, sx, sy, wx, wy, 01426 dispcols, top_offset, left_offset); 01427 } 01428 sketch_tac_cliffs(sketch_buf, map, sx, sy, wx, wy, dispcols, 01429 top_offset, left_offset, 3); 01430 } else if(labels & 16) { 01431 if(mech != NULL) { 01432 sketch_tac_ownmech(sketch_buf, map, mech, sx, sy, wx, wy, 01433 dispcols, top_offset, left_offset); 01434 } 01435 sketch_tac_cliffs(sketch_buf, map, sx, sy, wx, wy, dispcols, 01436 top_offset, left_offset, 2); 01437 } else if(labels & 32) { 01438 if(mech != NULL) { 01439 sketch_tac_ownmech(sketch_buf, map, mech, sx, sy, wx, wy, 01440 dispcols, top_offset, left_offset); 01441 } 01442 sketch_tac_dslz(sketch_buf, map, mech, sx, sy, wx, wy, dispcols, 01443 top_offset, left_offset, 2, docolour); 01444 } else if(mech != NULL) { 01445 sketch_tac_mechs(sketch_buf, map, mech, sx, sy, wx, wy, dispcols, 01446 top_offset, left_offset, docolour, labels); 01447 } 01448 01449 if(navigate) { 01450 int n = wx / 2; /* Hexagon radius */ 01451 01452 /* 01453 * Navigate hack: erase characters from the sketch map 01454 * to turn it into a pretty hexagonal shaped map. 01455 */ 01456 if(oddcol1) { 01457 /* 01458 * Don't need the last line in this case. 01459 */ 01460 disprows--; 01461 } 01462 01463 for(i = 0; i < n; i++) { 01464 int len; 01465 01466 base = sketch_buf + (i + 1) * dispcols + left_offset; 01467 len = (n - i - 1) * 3 + 1; 01468 memset(base, ' ', len); 01469 base[len] = '_'; 01470 base[len + 1] = '_'; 01471 base[mapcols - len - 2] = '_'; 01472 base[mapcols - len - 1] = '_'; 01473 base[mapcols - len] = '\0'; 01474 01475 base = sketch_buf + (disprows - i - 1) * dispcols + left_offset; 01476 len = (n - i) * 3; 01477 memset(base, ' ', len); 01478 base[mapcols - len] = '\0'; 01479 } 01480 01481 memset(sketch_buf + left_offset, ' ', n * 3 + 1); 01482 sketch_buf[left_offset + n * 3 + 1] = '_'; 01483 sketch_buf[left_offset + n * 3 + 2] = '_'; 01484 sketch_buf[left_offset + n * 3 + 3] = '\0'; 01485 } 01486 01487 if(docolour) { 01488 /* 01489 * If using colour then colourize the sketch map and 01490 * return the result. 01491 */ 01492 return colourize_tac_map(sketch_buf, dispcols, disprows); 01493 } 01494 01495 /* 01496 * If not using colour, the sketch map can be used as is. 01497 */ 01498 for(i = 0; i < disprows; i++) { 01499 lines[i] = sketch_buf + dispcols * i; 01500 } 01501 lines[i] = NULL; 01502 return lines; 01503 }
void mech_enterbase | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 1675 of file mech.maps.c.
References A_AFAIL, A_FAIL, A_LENTER, AeroFuel, args, BuildIsSafe, can_pass_lock, cch, MAP::cf, MAP::cfmax, CLASS_MECH, CLASS_VTOL, did_it(), DOCHECK, EnteringHangar, EVENT_ENTER_HANGAR, Fallen, find_entrance(), find_entrance_by_xy(), FindObjectsData(), FlyingT, getMap(), HexLOSBroadcast(), IsDS, Jumping, Landed, LBUF_SIZE, MECH::mapindex, mech_enter_event(), mech_notify(), mech_parseattributes(), MECH_USUAL, MECHALL, MECHEVENT, MechSpeed, MechType, MechX, MechY, MMaxSpeed, MP1, MAP::mynum, MECH::mynum, mapobj_struct::obj, OODing, SBUF_SIZE, SendError, Standing, tprintf(), mapobj_struct::x, x, mapobj_struct::y, and y.
Referenced by auto_enter_event().
01676 { 01677 MECH *mech = (MECH *) data; 01678 MAP *map, *newmap; 01679 int x, y; 01680 mapobj *mapo; 01681 char target, *tmpc; 01682 char *args[2]; 01683 int argc; 01684 01685 char fail_mesg[SBUF_SIZE]; 01686 01687 argc = mech_parseattributes(buffer, args, 2); 01688 DOCHECK(argc > 1, "Invalid arguments to command!"); 01689 tmpc = args[0]; 01690 if(argc > 0 && *tmpc && !(*(tmpc + 1))) 01691 target = tolower(*tmpc); 01692 else 01693 target = 0; 01694 cch(MECH_USUAL); 01695 map = getMap(mech->mapindex); 01696 /* For now, no dir checks */ 01697 DOCHECK(Jumping(mech), "While in mid-jump? No way."); 01698 DOCHECK(MechType(mech) == CLASS_MECH && (Fallen(mech) || 01699 Standing(mech)), 01700 "Crawl inside? I think not. Stand first."); 01701 DOCHECK(OODing(mech), "While in mid-flight? No way."); 01702 DOCHECK(MechType(mech) == CLASS_VTOL && 01703 AeroFuel(mech) <= 0, "You lack fuel to maneuver in!"); 01704 DOCHECK(FlyingT(mech) && 01705 !Landed(mech), 01706 "You need to land before you can enter the hangar."); 01707 DOCHECK(IsDS(mech), 01708 "Heh, you're trying to be funny, right, a DropShip entering hangar?"); 01709 DOCHECK(fabs(MechSpeed(mech)) * 5 >= MMaxSpeed(mech) && 01710 fabs(MMaxSpeed(mech)) >= MP1, 01711 "You are moving too fast to enter the hangar!"); 01712 DOCHECK(!(mapo = 01713 find_entrance_by_xy(map, MechX(mech), MechY(mech))), 01714 "You see nothing to enter here!"); 01715 /* Wow, *gasp*, we got something to enter */ 01716 if(!(newmap = FindObjectsData(mapo->obj))) { 01717 mech_notify(mech, MECHALL, 01718 "You sense wrongness in fabric of space.."); 01719 SendError(tprintf 01720 ("Error: No map existing for mapindex #%d (@ %d,%d of #%d)", 01721 (int) mapo->obj, mapo->x, mapo->y, mech->mapindex)); 01722 return; 01723 } 01724 if(!find_entrance(newmap, target, &x, &y)) { 01725 mech_notify(mech, MECHALL, 01726 "You sense wrongness in fabric of space.."); 01727 SendError(tprintf 01728 ("Error: No entrance existing for mapindex #%d (@ %d,%d of #%d)", 01729 (int) mapo->obj, mapo->x, mapo->y, mech->mapindex)); 01730 return; 01731 } 01732 01733 if(!can_pass_lock(mech->mynum, newmap->mynum, A_LENTER) && 01734 (BuildIsSafe(newmap) || newmap->cf >= (newmap->cfmax / 2))) { 01735 01736 /* Trigger FAIL & AFAIL */ 01737 memset(fail_mesg, 0, sizeof(fail_mesg)); 01738 snprintf(fail_mesg, LBUF_SIZE, "The hangar is locked."); 01739 01740 did_it(player, newmap->mynum, A_FAIL, fail_mesg, 0, NULL, A_AFAIL, 01741 (char **) NULL, 0); 01742 01743 return; 01744 } 01745 01746 DOCHECK(EnteringHangar(mech), "You are already entering the hangar!"); 01747 /* XXX Check for other mechs in the hex possibly doing this as well (ick) */ 01748 HexLOSBroadcast(map, MechX(mech), MechY(mech), 01749 "The doors at $h start to open.."); 01750 MECHEVENT(mech, EVENT_ENTER_HANGAR, mech_enter_event, 18, (int) target); 01751 }
void mech_findcenter | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 33 of file mech.maps.c.
References cch, FindBearing(), FindHexRange(), MapCoordToRealCoord(), MECH_USUAL, MechFX, MechFY, MechX, MechY, MechZ, notify_printf(), x, and y.
Referenced by turret_findcenter().
00034 { 00035 MECH *mech = (MECH *) data; 00036 float fx, fy; 00037 int x, y; 00038 00039 cch(MECH_USUAL); 00040 x = MechX(mech); 00041 y = MechY(mech); 00042 MapCoordToRealCoord(x, y, &fx, &fy); 00043 notify_printf(player, "Current hex: (%d,%d,%d)\tRange to center: %.2f\t" 00044 "Bearing to center: %d", x, y, MechZ(mech), 00045 FindHexRange(fx, fy, MechFX(mech), MechFY(mech)), 00046 FindBearing(MechFX(mech), MechFY(mech), fx, fy)); 00047 }
void mech_lrsmap | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 630 of file mech.maps.c.
References A_LRSHEIGHT, Ansimap, args, confdata::btech_mw_losmap, cch, CLASS_MW, DOCHECK, getMap(), LRS_COLORMODE, LRS_DISPLAY_HEIGHT, LRS_ELEVCOLORMODE, LRS_ELEVMODE, LRS_TERRAINMODE, MAP::map_height, MECH::mapindex, MapIsDark, mech_parseattributes(), MECH_USUAL, MechLRSRange, MechType, MIN, mudconf, notify, notify_printf(), parse_tacargs(), set_colorscheme(), show_lrs_map(), silly_atr_get(), x, and y.
Referenced by turret_lrsmap().
00631 { 00632 MECH *mech = (MECH *) data; 00633 MAP *map; 00634 int argc, mode = 0; 00635 short x, y; 00636 char *args[5], *str; 00637 int displayHeight = LRS_DISPLAY_HEIGHT; 00638 00639 cch(MECH_USUAL); 00640 00641 if(Ansimap(player)) 00642 mode |= LRS_COLORMODE; 00643 00644 map = getMap(mech->mapindex); 00645 00646 argc = mech_parseattributes(buffer, args, 4); 00647 DOCHECK(!MechLRSRange(mech), "Your system seems to be inoperational."); 00648 if(!parse_tacargs(player, mech, &args[1], argc - 1, 00649 MechLRSRange(mech), &x, &y)) 00650 return; 00651 switch (args[0][0]) { 00652 case 'M': 00653 case 'm': 00654 mode |= LRS_MECHMODE | LRS_TERRAINMODE; 00655 break; 00656 case 'E': 00657 case 'e': 00658 mode |= LRS_ELEVMODE; 00659 break; 00660 case 'C': 00661 case 'c': 00662 mode |= LRS_ELEVMODE | LRS_ELEVCOLORMODE; 00663 break; 00664 case 'T': 00665 case 't': 00666 mode |= LRS_TERRAINMODE; 00667 break; 00668 case 'L': 00669 case 'l': 00670 mode |= LRS_LOSMODE | LRS_TERRAINMODE; 00671 break; 00672 case 'H': 00673 case 'h': 00674 mode |= LRS_LOSMODE | LRS_ELEVMODE; 00675 break; 00676 case 'S': 00677 case 's': 00678 mode |= LRS_LOSMODE | LRS_MECHMODE | LRS_TERRAINMODE; 00679 break; 00680 default: 00681 notify_printf(player, "Unknown LRS sensor type '%s'!", args[0]); 00682 return; 00683 } 00684 00685 if(MapIsDark(map) || (MechType(mech) == CLASS_MW && 00686 mudconf.btech_mw_losmap)) 00687 mode |= LRS_LOSMODE; 00688 00689 str = silly_atr_get(player, A_LRSHEIGHT); 00690 if(*str) { 00691 displayHeight = atoi(str); 00692 if(displayHeight < 10 || displayHeight > 40) { 00693 notify(player, 00694 "Illegal LRSHeight attribute. Must be between 10 and 40"); 00695 displayHeight = LRS_DISPLAY_HEIGHT; 00696 } 00697 } 00698 00699 displayHeight = MIN(displayHeight, 2 * MechLRSRange(mech)); 00700 displayHeight = MIN(displayHeight, map->map_height); 00701 00702 if(!(displayHeight % 2)) 00703 displayHeight++; 00704 00705 set_colorscheme(player); 00706 00707 show_lrs_map(player, mech, map, x, y, displayHeight, mode); 00708 }
void mech_navigate | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 200 of file mech.maps.c.
References args, confdata::btech_mw_losmap, cch, CLASS_MW, DOCHECK, getMap(), GetTerrainName(), MakeMapText(), MAP::map_height, MAP::map_width, MECH::mapindex, MapIsDark, MBUF_SIZE, mech_parseattributes(), MECH_USUAL, MechFacing, MechSpeed, MechTacRange, MechType, MechVerticalSpeed, MechX, MechY, MechZ, mudconf, NAVIGATE_LINES, navigate_sketch_mechs(), notify, parse_tacargs(), set_colorscheme(), x, and y.
Referenced by turret_navigate().
00201 { 00202 MECH *mech = (MECH *) data; 00203 char mybuff[NAVIGATE_LINES][MBUF_SIZE]; 00204 MAP *mech_map; 00205 char **maptext, *args[3]; 00206 int i, dolos, argc; 00207 short x, y; 00208 00209 cch(MECH_USUAL); 00210 00211 mech_map = getMap(mech->mapindex); 00212 00213 dolos = MapIsDark(mech_map) || (MechType(mech) == CLASS_MW && 00214 mudconf.btech_mw_losmap); 00215 00216 DOCHECK(mech_map->map_width <= 0 || mech_map->map_height <= 0, 00217 "Nothing to see on this map, move along."); 00218 00219 argc = mech_parseattributes(buffer, args, 3); 00220 if(!parse_tacargs(player, mech, args, argc, MechTacRange(mech), &x, &y)) 00221 return; 00222 00223 set_colorscheme(player); 00224 maptext = MakeMapText(player, mech, mech_map, x, y, 5, 5, 4, dolos); 00225 00226 sprintf(mybuff[0], 00227 " 0 %.150s", 00228 maptext[0]); 00229 sprintf(mybuff[1], 00230 " ___________ %.150s", 00231 maptext[1]); 00232 sprintf(mybuff[2], 00233 " / \\ Location:%4d,%4d, %3d %.150s", 00234 MechX(mech), MechY(mech), MechZ(mech), maptext[2]); 00235 sprintf(mybuff[3], 00236 " 300 / \\ 60 Terrain: %14s %.150s", 00237 GetTerrainName(mech_map, MechX(mech), MechY(mech)), maptext[3]); 00238 sprintf(mybuff[4], 00239 " / \\ %.150s", 00240 maptext[4]); 00241 sprintf(mybuff[5], 00242 " / \\ %.150s", 00243 maptext[5]); 00244 sprintf(mybuff[6], 00245 "270 ( ) 90 Speed: %6.1f %.150s", 00246 MechSpeed(mech), maptext[6]); 00247 sprintf(mybuff[7], 00248 " \\ / Vertical Speed: %6.1f %.150s", 00249 MechVerticalSpeed(mech), maptext[7]); 00250 sprintf(mybuff[8], 00251 " \\ / Heading: %4d %.150s", 00252 MechFacing(mech), maptext[8]); 00253 sprintf(mybuff[9], 00254 " 240 \\ / 120 %.150s", 00255 maptext[9]); 00256 sprintf(mybuff[10], 00257 " \\___________/ %.150s", 00258 maptext[10]); 00259 sprintf(mybuff[11], " "); 00260 sprintf(mybuff[12], " 180"); 00261 00262 navigate_sketch_mechs(mech, mech_map, x, y, mybuff); 00263 for(i = 0; i < NAVIGATE_LINES; i++) 00264 notify(player, mybuff[i]); 00265 }
void mech_tacmap | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 1508 of file mech.maps.c.
References A_TACSIZE, args, confdata::btech_mw_losmap, cch, CLASS_MW, DOCHECK, getMap(), MakeMapText(), MAP_DISPLAY_HEIGHT, MAP_DISPLAY_WIDTH, MAP::map_height, MAP::map_width, MECH::mapindex, MapIsDark, mech_parseattributes(), MECH_USUAL, MechTacRange, MechType, MechX, MechY, mudconf, notify, parse_tacargs(), set_colorscheme(), silly_atr_get(), x, and y.
Referenced by turret_tacmap().
01509 { 01510 MECH *mech = (MECH *) data; 01511 int argc, i; 01512 short x, y; 01513 int mapx, mapy; 01514 char *args_vec[4]; 01515 char **args = args_vec; 01516 MAP *mech_map; 01517 int displayHeight = MAP_DISPLAY_HEIGHT, displayWidth = MAP_DISPLAY_WIDTH; 01518 char *str; 01519 char **maptext; 01520 int flags = 3, dohexlos = 0; 01521 01522 /* Basic checks for pilot and mech */ 01523 cch(MECH_USUAL); 01524 01525 /* Get the map info */ 01526 mech_map = getMap(mech->mapindex); 01527 mapx = MechX(mech); 01528 mapy = MechY(mech); 01529 01530 /* Various checks for conditions and system of mech */ 01531 argc = mech_parseattributes(buffer, args, 4); 01532 DOCHECK(!MechTacRange(mech), "Your system seems to be inoperational."); 01533 01534 if(MapIsDark(mech_map) || (MechType(mech) == CLASS_MW && 01535 mudconf.btech_mw_losmap)) 01536 dohexlos = 1; 01537 01538 /* Check to see which type of tactical to display 01539 * if they specified a particular one */ 01540 if(argc > 0 && isalpha((unsigned char) args[0][0]) 01541 && args[0][1] == '\0') { 01542 01543 switch (tolower((unsigned char) args[0][0])) { 01544 case 'c': 01545 flags |= 8; /* Show cliffs */ 01546 break; 01547 01548 case 't': 01549 flags |= 16; /* Show tank cliffs */ 01550 break; 01551 01552 case 'l': 01553 dohexlos = 1; 01554 break; 01555 01556 case 'b': 01557 flags |= 32; 01558 break; 01559 01560 default: 01561 notify(player, "Invalid tactical map flag."); 01562 return; 01563 } 01564 01565 args++; 01566 argc--; 01567 } 01568 01569 DOCHECK(dohexlos 01570 && (flags & (8 | 16 | 32)), "You can't see that much here!"); 01571 01572 if(!parse_tacargs(player, mech, args, argc, MechTacRange(mech), &x, &y)) 01573 return; 01574 01575 /* Get the Tacsize attribute from 01576 * the player, if doesn't exist set the height and width to 01577 * default params. If it does exist, check the values and 01578 * make sure they are legit. */ 01579 str = silly_atr_get(player, A_TACSIZE); 01580 if(!*str) { 01581 displayHeight = MAP_DISPLAY_HEIGHT; 01582 displayWidth = MAP_DISPLAY_WIDTH; 01583 } else if(sscanf(str, "%d %d", &displayHeight, &displayWidth) != 2 || 01584 displayHeight > 24 || displayHeight < 5 || displayWidth > 40 || 01585 displayWidth < 5) { 01586 01587 notify(player, 01588 "Illegal Tacsize attribute. Must be in format " 01589 "'Height Width' . Height : 5-24 Width : 5-40"); 01590 displayHeight = MAP_DISPLAY_HEIGHT; 01591 displayWidth = MAP_DISPLAY_WIDTH; 01592 } 01593 01594 /* Everything worked but lets check the mech's tac range 01595 * and the map size */ 01596 displayHeight = (displayHeight <= 2 * MechTacRange(mech) 01597 ? displayHeight : 2 * MechTacRange(mech)); 01598 displayWidth = (displayWidth <= 2 * MechTacRange(mech) 01599 ? displayWidth : 2 * MechTacRange(mech)); 01600 01601 displayHeight = (displayHeight <= mech_map->map_height) 01602 ? displayHeight : mech_map->map_height; 01603 displayWidth = (displayWidth <= mech_map->map_width) 01604 ? displayWidth : mech_map->map_width; 01605 01606 set_colorscheme(player); 01607 01608 /* Get the data to draw the map */ 01609 maptext = 01610 MakeMapText(player, mech, mech_map, x, y, displayWidth, 01611 displayHeight, flags, dohexlos); 01612 01613 /* Draw the map for the player */ 01614 for(i = 0; maptext[i]; i++) 01615 notify(player, maptext[i]); 01616 }
void TacMapTerr | ( | MAP * | mech_map, | |
int | x, | |||
int | y, | |||
char * | terr, | |||
char * | elev, | |||
int | isdown | |||
) |
char* TerrainColor | ( | char | terrain, | |
int | elev | |||
) |