src/hcode/btech/mech.status.c

Go to the documentation of this file.
00001 /*
00002  * Author: Markus Stenberg <fingon@iki.fi>
00003  *
00004  *  Copyright (c) 1996 Markus Stenberg
00005  *  Copyright (c) 1998-2002 Thomas Wouters
00006  *  Copyright (c) 2000-2002 Cord Awtry
00007  *  Copyright (c) 1999-2005 Kevin Stevens
00008  *       All rights reserved
00009  */
00010 
00011 #include "config.h"
00012 
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 #include <math.h>
00016 #include <sys/file.h>
00017 
00018 #include "mech.h"
00019 #include "mech.events.h"
00020 #include "failures.h"
00021 #include "coolmenu.h"
00022 #include "create.h"
00023 #include "mycool.h"
00024 #include "mech.partnames.h"
00025 #include "p.mech.los.h"
00026 #include "p.mech.utils.h"
00027 #include "p.mech.scan.h"
00028 #include "p.mech.status.h"
00029 #include "p.mech.build.h"
00030 #include "p.mech.update.h"
00031 #include "p.mech.tech.commands.h"
00032 #include "p.bsuit.h"
00033 #include "p.mech.tech.do.h"
00034 #include "p.mech.combat.h"
00035 #include "p.mech.tag.h"
00036 #include "p.mech.enhanced.criticals.h"
00037 #include "p.mech.contacts.h"
00038 #include "p.btechstats.h"
00039 #include "p.mech.notify.h"
00040 #include "mech.tech.h"
00041 
00042 static int doweird = 0;
00043 static char *weirdbuf;
00044 
00045 #define PHY_AXE         1
00046 #define PHY_SWORD   2
00047 #define PHY_MACE    3
00048 #define PHY_SAW     4
00049 
00050 void DisplayTarget(dbref player, MECH * mech)
00051 {
00052         int arc;
00053         MECH *tempMech = NULL;
00054         char location[50];
00055         char buff[100], buff1[100];
00056 
00057         if(MechTarget(mech) != -1) {
00058                 tempMech = getMech(MechTarget(mech));
00059                 if(tempMech) {
00060                         if(InLineOfSight(mech, tempMech, MechX(tempMech),
00061                                                          MechY(tempMech), FaMechRange(mech, tempMech))) {
00062                                 sprintf(buff,
00063                                                 "Target: %s\t   Range: %.1f hexes   Bearing: %d deg\n",
00064                                                 GetMechToMechID(mech, tempMech), FaMechRange(mech,
00065                                                                                                                                          tempMech),
00066                                                 FindBearing(MechFX(mech), MechFY(mech),
00067                                                                         MechFX(tempMech), MechFY(tempMech)));
00068                                 notify(player, buff);
00069                                 arc = InWeaponArc(mech, MechFX(tempMech), MechFY(tempMech));
00070                                 strcpy(buff, tprintf("Target in %s Weapons Arc",
00071                                                                          (arc & TURRETARC) ? "Turret" :
00072                                                                          GetArcID(mech, arc)));
00073                                 if(MechAim(mech) == NUM_SECTIONS
00074                                    || MechAimType(mech) != MechType(tempMech))
00075                                         strcpy(location, "None");
00076                                 else
00077                                         ArmorStringFromIndex(MechAim(mech), location,
00078                                                                                  MechType(tempMech),
00079                                                                                  MechMove(tempMech));
00080                                 sprintf(buff1, "\t   Aimed Shot Location: %s", location);
00081                                 strcat(buff, buff1);
00082                         } else
00083                                 sprintf(buff, "Target: NOT in line of sight!\n");
00084                 }
00085                 notify(player, buff);
00086         } else if(MechTargX(mech) != -1 && MechTargY(mech) != -1) {
00087                 if(MechStatus(mech) & LOCK_BUILDING)
00088                         notify_printf(player, "Target: Building at %d %d\n",
00089                                                   MechTargX(mech), MechTargY(mech));
00090                 else if(MechStatus(mech) & LOCK_HEX)
00091                         notify_printf(player, "Target: Hex %d %d\n", MechTargX(mech),
00092                                                   MechTargY(mech));
00093                 else
00094                         notify_printf(player, "Target: %d %d\n", MechTargX(mech),
00095                                                   MechTargY(mech));
00096 
00097         }
00098         if(MechPKiller(mech))
00099                 notify(player, "Weapon Safeties are %ch%crOFF%cn.\n");
00100         if(GotPilot(mech) && HasBoolAdvantage(MechPilot(mech), "maneuvering_ace"))
00101                 notify_printf(player, "Turn Mode: %s",
00102                                           GetTurnMode(mech) ? "TIGHT" : "NORMAL");
00103         if(MechChargeTarget(mech) > 0 && mudconf.btech_newcharge) {
00104                 tempMech = getMech(MechChargeTarget(mech));
00105                 if(!tempMech)
00106                         return;
00107                 if(InLineOfSight(mech, tempMech, MechX(tempMech), MechY(tempMech),
00108                                                  FaMechRange(mech, tempMech))) {
00109                         notify_printf(player, "ChargeTarget: %s\t  ChargeTimer: %d\n",
00110                                                   GetMechToMechID(mech, tempMech),
00111                                                   MechChargeTimer(mech) / 2);
00112                 } else {
00113                         notify_printf(player,
00114                                                   "ChargeTarget: NOT in line of sight!\t Timer: %d\n",
00115                                                   MechChargeTimer(mech) / 2);
00116                 }
00117         }
00118 }
00119 
00120 void show_miscbrands(MECH * mech, dbref player)
00121 {
00122 /*   notify(player, tprintf("Radio: %s (%3d range)     Computer: %s (%d Scan / %d LRS / %d Tac)", brands[BOUNDED(1, MechRadio(mech), 5)+RADIO_INDEX].name, (int) MechRadioRange(mech), brands[BOUNDED(1, MechComputer(mech), 5)+COMPUTER_INDEX].name, (int) MechScanRange(mech), (int) MechLRSRange(mech), (int) MechTacRange(mech))); */
00123 }
00124 
00125 void PrintGenericStatus(dbref player, MECH * mech, int own, int usex)
00126 {
00127         MECH *tempMech = NULL;
00128         MAP *map = FindObjectsData(mech->mapindex);
00129         char buff[100];
00130         char mech_name[100];
00131         char mech_ref[100];
00132         char move_type[50];
00133 
00134         strcpy(mech_name,
00135                    usex ? MechType_Name(mech) : silly_atr_get(mech->mynum,
00136                                                                                                           A_MECHNAME));
00137         strcpy(mech_ref,
00138                    usex ? MechType_Ref(mech) : silly_atr_get(mech->mynum, A_MECHREF));
00139 
00140         switch (MechType(mech)) {
00141         case CLASS_MW:
00142                 notify_printf(player, "MechWarrior: %-18.18s ID:[%s]",
00143                                           Name(player), MechIDS(mech, 0));
00144                 notify_printf(player, "MaxSpeed: %3d", (int) MMaxSpeed(mech));
00145                 break;
00146         case CLASS_BSUIT:
00147                 sprintf(buff, "%s Name: %-18.18s  ID:[%s]   %s Reference: %s",
00148                                 GetBSuitName(mech), mech_name, MechIDS(mech, 0),
00149                                 GetBSuitName(mech), mech_ref);
00150                 notify(player, buff);
00151                 notify_printf(player,
00152                                           "MaxSpeed: %3d                  JumpRange: %d",
00153                                           (int) MMaxSpeed(mech), JumpSpeedMP(mech, map));
00154                 show_miscbrands(mech, player);
00155                 if(MechPilot(mech) == -1)
00156                         notify(player, "Leader: NONE");
00157                 else {
00158                         sprintf(buff, "%s Leader Name: %-16.16s %s Leader injury: %d",
00159                                         GetBSuitName(mech), Name(MechPilot(mech)),
00160                                         GetBSuitName(mech), MechPilotStatus(mech));
00161                         notify(player, buff);
00162                 }
00163 
00164                 sprintf(buff, "Max Suits: %d", MechMaxSuits(mech));
00165                 notify(player, buff);
00166 
00167                 Mech_ShowFlags(player, mech, 0, 0);
00168 
00169                 if(Jumping(mech)) {
00170                         sprintf(buff, "JUMPING --> %3d,%3d", MechGoingX(mech),
00171                                         MechGoingY(mech));
00172                         if((MechStatus(mech) & DFA_ATTACK) && MechDFATarget(mech) != -1) {
00173                                 tempMech = getMech(MechDFATarget(mech));
00174                                 sprintf(buff + strlen(buff),
00175                                                 "  Death From Above Target: %s",
00176                                                 GetMechToMechID(mech, tempMech));
00177                         }
00178                         notify(player, buff);
00179                 }
00180                 break;
00181         case CLASS_MECH:
00182                 sprintf(buff, "Mech Name: %-18.18s  ID:[%s]   Mech Reference: %s",
00183                                 mech_name, MechIDS(mech, 0), mech_ref);
00184                 notify(player, buff);
00185                 notify_printf(player,
00186                                           "Tonnage:   %3d     MaxSpeed: %3d       JumpRange: %d",
00187                                           MechTons(mech), (int) MMaxSpeed(mech), JumpSpeedMP(mech,
00188                                                                                                                                                  map));
00189                 show_miscbrands(mech, player);
00190                 if(MechPilot(mech) == -1)
00191                         notify(player, "Pilot: NONE");
00192                 else {
00193                         sprintf(buff, "Pilot Name: %-28.28s Pilot Injury: %d",
00194                                         Name(MechPilot(mech)), MechPilotStatus(mech));
00195                         notify(player, buff);
00196                 }
00197                 Mech_ShowFlags(player, mech, 0, 0);
00198                 if(!Jumping(mech) && !Fallen(mech) && Started(mech) &&
00199                    (MechChargeTarget(mech) != -1)) {
00200                         tempMech = getMech(MechChargeTarget(mech));
00201                         if(tempMech) {
00202                                 sprintf(buff, "CHARGING --> %s", GetMechToMechID(mech,
00203                                                                                                                                  tempMech));
00204                                 notify(player, buff);
00205                         }
00206                 }
00207                 if(Jumping(mech)) {
00208                         sprintf(buff, "JUMPING --> %3d,%3d", MechGoingX(mech),
00209                                         MechGoingY(mech));
00210                         if((MechStatus(mech) & DFA_ATTACK) && MechDFATarget(mech) != -1) {
00211                                 tempMech = getMech(MechDFATarget(mech));
00212                                 sprintf(buff + strlen(buff),
00213                                                 "  Death From Above Target: %s",
00214                                                 GetMechToMechID(mech, tempMech));
00215                         }
00216                         notify(player, buff);
00217                 }
00218                 break;
00219         case CLASS_VTOL:
00220         case CLASS_VEH_GROUND:
00221         case CLASS_VEH_NAVAL:
00222         case CLASS_AERO:
00223         case CLASS_DS:
00224         case CLASS_SPHEROID_DS:
00225                 switch (MechMove(mech)) {
00226                 case MOVE_TRACK:
00227                         strcpy(move_type, "Tracked");
00228                         break;
00229                 case MOVE_WHEEL:
00230                         strcpy(move_type, "Wheeled");
00231                         break;
00232                 case MOVE_HOVER:
00233                         strcpy(move_type, "Hover");
00234                         break;
00235                 case MOVE_VTOL:
00236                         strcpy(move_type, "VTOL");
00237                         break;
00238                 case MOVE_FLY:
00239                         strcpy(move_type, "Flight");
00240                         break;
00241                 case MOVE_HULL:
00242                         strcpy(move_type, "Displacement Hull");
00243                         break;
00244                 case MOVE_SUB:
00245                         strcpy(move_type, "Submarine");
00246                         break;
00247                 case MOVE_FOIL:
00248                         strcpy(move_type, "Hydrofoil");
00249                         break;
00250                 default:
00251                         strcpy(move_type, "Magic");
00252                         break;
00253                 }
00254                 if(MechMove(mech) != MOVE_NONE) {
00255                         sprintf(buff,
00256                                         "Vehicle Name: %-15.15s  ID:[%s]   Vehicle Reference: %s",
00257                                         mech_name, MechIDS(mech, 0), mech_ref);
00258                         notify(player, buff);
00259                         sprintf(buff,
00260                                         "Tonnage:   %3d      %s: %3d       Movement Type: %s",
00261                                         MechTons(mech),
00262                                         is_aero(mech) ? "Max thrust" : "FlankSpeed",
00263                                         (int) MMaxSpeed(mech), move_type);
00264                         notify(player, buff);
00265                         show_miscbrands(mech, player);
00266                         if(MechPilot(mech) == -1)
00267                                 notify(player, "Pilot: NONE");
00268                         else {
00269                                 sprintf(buff, "Pilot Name: %-28.28s Pilot Injury: %d",
00270                                                 Name(MechPilot(mech)), MechPilotStatus(mech));
00271                                 notify(player, buff);
00272                         }
00273                 } else {
00274                         sprintf(buff, "Name: %-15.15s  ID:[%s]   Reference: %s",
00275                                         mech_name, MechIDS(mech, 0), mech_ref);
00276                         notify(player, buff);
00277                 }
00278                 if(MechType(mech) != CLASS_VTOL && !is_aero(mech))
00279                         if(GetSectInt(mech, TURRET)) {
00280                                 if(MechTankCritStatus(mech) & TURRET_JAMMED)
00281                                         notify(player, "     TURRET JAMMED");
00282                                 else if(MechTankCritStatus(mech) & TURRET_LOCKED)
00283                                         notify(player, "     TURRET LOCKED");
00284                         }
00285                 if(FlyingT(mech) && Landed(mech))
00286                         notify(player, "LANDED");
00287                 Mech_ShowFlags(player, mech, 0, 0);
00288         }
00289 }
00290 
00291 void PrintShortInfo(dbref player, MECH * mech)
00292 {
00293         char buff[100];
00294         char typespecific[50];
00295 
00296         switch (MechType(mech)) {
00297         case CLASS_VTOL:
00298                 sprintf(typespecific, " VSPD: %3.1f ", MechVerticalSpeed(mech));
00299                 break;
00300         case CLASS_MECH:
00301                 sprintf(typespecific, " HT: %3d/%3d/%-3d ",
00302                                 (int) (10. * MechPlusHeat(mech)),
00303                                 (int) (10. * MechActiveNumsinks(mech)), (int) (10. * MechMinusHeat(mech)));
00304                 break;
00305         case CLASS_AERO:
00306         case CLASS_DS:
00307         case CLASS_SPHEROID_DS:
00308                 sprintf(typespecific, " VSPD: %3.1f  ANG: %2d  HT: %3d/%3d ",
00309                                 MechVerticalSpeed(mech), MechDesiredAngle(mech),
00310                                 (int) (10 * MechPlusHeat(mech)),
00311                                 (int) (10 * MechActiveNumsinks(mech)));
00312                 break;
00313         case CLASS_VEH_NAVAL:
00314                 if(MechMove(mech) == MOVE_FOIL)
00315                         sprintf(typespecific, " VSPD: %3.1f ", MechVerticalSpeed(mech));
00316                 /* FALLTHROUGH */
00317         case CLASS_VEH_GROUND:
00318                 /* XXX This won't work for subs with turrets.. are they possible ? */
00319                 if(GetSectOInt(mech, TURRET)) {
00320                         sprintf(typespecific, " TUR: %3d ",
00321                                         AcceptableDegree(MechTurretFacing(mech) +
00322                                                                          MechFacing(mech)));
00323                         break;
00324                 }
00325                 /* FALLTHROUGH */
00326         default:
00327                 typespecific[0] = '\0';
00328                 break;
00329         }
00330 
00331         snprintf(buff, 100,
00332                          "LOC: %3d,%3d,%3d  HD: %3d/%3d  SP: %3.1f/%3.1f %s ST:%s",
00333                          MechX(mech), MechY(mech), MechZ(mech), MechFacing(mech),
00334                          MechDesiredFacing(mech), MechSpeed(mech), MechDesiredSpeed(mech),
00335                          typespecific, getStatusString(mech, 2));
00336         buff[99] = '\0';
00337         notify(player, buff);
00338         DisplayTarget(player, mech);
00339 }
00340 
00341 #define HEAT_LEVEL_LGREEN 0
00342 #define HEAT_LEVEL_BGREEN 7
00343 #define HEAT_LEVEL_LYELLOW 13
00344 #define HEAT_LEVEL_BYELLOW 16
00345 #define HEAT_LEVEL_LRED 18
00346 #define HEAT_LEVEL_BRED 24
00347 #define HEAT_LEVEL_TOP 40
00348 
00349 #define HEAT_LEVEL_NONE 27
00350 
00351 static char *MakeHeatScaleInfo(MECH * mech, char *fillchar, char *heatstr,
00352                                                            int length)
00353 {
00354         int counter = 0, heat = MechPlusHeat(mech), minheat =
00355                 MechMinusHeat(mech), start = 0;
00356         char state = 1;
00357 
00358         memset(heatstr, 0, sizeof(char) * length);
00359 
00360         strcat(heatstr, "%cx%ch");
00361 
00362         if(minheat > HEAT_LEVEL_NONE)
00363                 start = minheat - HEAT_LEVEL_NONE;
00364 
00365         if(heat <= start) {
00366                 heat = 0;
00367                 state = 0;
00368         } else
00369                 heat -= start;
00370 
00371         if(start)
00372                 strcat(heatstr, "<%cx%ch");
00373         else
00374                 strcat(heatstr, " %cx%ch");
00375 
00376         for(counter = start; counter < minheat; counter++) {
00377                 strncat(heatstr, &fillchar[(short) state], 1);
00378                 if(heat && !--heat)
00379                         state = 0;
00380         }
00381         if(state)
00382                 state++;
00383 
00384         strcat(heatstr, "%cg%ch|%c%cg");
00385         for(; counter < minheat + HEAT_LEVEL_BGREEN; counter++) {
00386                 strncat(heatstr, &fillchar[(short) state], 1);
00387                 if(heat && !--heat)
00388                         state = 0;
00389         }
00390         if(state)
00391                 state++;
00392 
00393         strcat(heatstr, "%ch");
00394         for(; counter < minheat + HEAT_LEVEL_LYELLOW; counter++) {
00395                 strncat(heatstr, &fillchar[(short) state], 1);
00396                 if(heat && !--heat)
00397                         state = 0;
00398         }
00399         if(state)
00400                 state++;
00401 
00402         strcat(heatstr, "%c%cy%ch|%c%cy");
00403         for(; counter < minheat + HEAT_LEVEL_BYELLOW; counter++) {
00404                 strncat(heatstr, &fillchar[(short) state], 1);
00405                 if(heat && !--heat)
00406                         state = 0;
00407         }
00408         if(state)
00409                 state++;
00410 
00411         strcat(heatstr, "%ch");
00412         for(; counter < minheat + HEAT_LEVEL_LRED; counter++) {
00413                 strncat(heatstr, &fillchar[(short) state], 1);
00414                 if(heat && !--heat)
00415                         state = 0;
00416         }
00417         if(state)
00418                 state++;
00419 
00420         strcat(heatstr, "%c%cr%ch|%c%cr");
00421         for(; counter < minheat + HEAT_LEVEL_BRED; counter++) {
00422                 strncat(heatstr, &fillchar[(short) state], 1);
00423                 if(heat && !--heat)
00424                         state = 0;
00425         }
00426         if(state)
00427                 state++;
00428 
00429         strcat(heatstr, "%ch");
00430         for(; counter < minheat + HEAT_LEVEL_TOP; counter++) {
00431                 strncat(heatstr, &fillchar[(short) state], 1);
00432                 if(heat && !--heat)
00433                         state = 0;
00434         }
00435         strcat(heatstr, "%cw%ch|%c");
00436         return heatstr;
00437 }
00438 
00439 void PrintHeatBar(dbref player, MECH * mech)
00440 {
00441         char subbuff[256];
00442         char buff[256];
00443         char heatstr[9] = ".:::::::";
00444 
00445         MakeHeatScaleInfo(mech, heatstr, subbuff, 256);
00446         snprintf(buff, 256, "Temp:%s", subbuff);
00447         notify(player, buff);
00448 }
00449 
00450 void PrintInfoStatus(dbref player, MECH * mech, int own)
00451 {
00452         char buff[256];
00453         MECH *tempMech;
00454         int f;
00455 
00456         switch (MechType(mech)) {
00457         case CLASS_MECH:
00458                 snprintf(buff, 256,
00459                                  "X, Y, Z:%3d,%3d,%3d  Excess Heat:  %3d deg C.  Heat Production:  %3d deg C.",
00460                                  MechX(mech), MechY(mech), MechZ(mech),
00461                                  (int) (10. * MechHeat(mech)),
00462                                  (int) (10. * MechPlusHeat(mech)));
00463                 notify(player, buff);
00464                 snprintf(buff, 256,
00465                                  "Speed:      %%ch%%cg%3d%%cn KPH  Heading:      %%ch%%cg%3d%%cn deg     Heat Sinks:       %3d",
00466                                  (int) (MechSpeed(mech)), MechFacing(mech),
00467                                  MechActiveNumsinks(mech));
00468                 notify(player, buff);
00469                 sprintf(buff,
00470                                 "Des. Speed: %3d KPH  Des. Heading: %3d deg     Heat Dissipation: %3d deg C.",
00471                                 (int) MechDesiredSpeed(mech), MechDesiredFacing(mech),
00472                                 (int) (10. * MechMinusHeat(mech)));
00473                 notify(player, buff);
00474                 
00475                 if(MechLateral(mech))
00476                         notify_printf(player, "You are moving laterally %s",
00477                                                   LateralDesc(mech));
00478                 break;
00479         case CLASS_VEH_GROUND:
00480         case CLASS_VEH_NAVAL:
00481         case CLASS_VTOL:
00482         case CLASS_AERO:
00483         case CLASS_DS:
00484         case CLASS_SPHEROID_DS:
00485                 snprintf(buff, 256,
00486                                  "X, Y, Z:%3d,%3d,%3d  Heat Sinks:          %3d       %s",
00487                                  MechX(mech), MechY(mech), MechZ(mech),
00488                                  MechActiveNumsinks(mech),
00489                                  is_aero(mech) ? tprintf("%s angle: %%ch%%cg%d%%cn",
00490                                                                                  MechDesiredAngle(mech) >=
00491                                                                                  0 ? "Climbing" : "Diving",
00492                                                                                  abs(MechDesiredAngle(mech))) : "");
00493                 notify(player, buff);
00494                 if(FlyingT(mech) || MechMove(mech) == MOVE_SUB) {
00495                         sprintf(buff,
00496                                         "Speed:      %%ch%%cg%3d%%cn KPH  Vertical Speed:      %%ch%%cg%3d%%cn KPH   Des. Speed %3d KPH",
00497                                         (int) (MechSpeed(mech)), (int) (MechVerticalSpeed(mech)),
00498                                         (int) (MechDesiredSpeed(mech)));
00499                         notify(player, buff);
00500                         f = MAX(0, AeroFuel(mech));
00501                         if(MechMove(mech) == MOVE_SUB) {
00502                                 sprintf(buff, "Heading: %3d KPH  Des. Heading: %3d deg",
00503                                                 (int) MechFacing(mech), MechDesiredFacing(mech));
00504                         } else if(AeroFreeFuel(mech)) {
00505                                 sprintf(buff,
00506                                                 "Heading:    %%ch%%cg%3d%%cn deg  Des. Heading:        %3d deg   Fuel: Unlimited",
00507                                                 MechFacing(mech), MechDesiredFacing(mech));
00508                         } else {
00509                                 sprintf(buff,
00510                                                 "Heading:    %%ch%%cg%3d%%cn deg  Des. Heading:        %3d deg   Fuel: %d (%.2f %%)",
00511                                                 MechFacing(mech), MechDesiredFacing(mech), f,
00512                                                 100.0 * f / AeroFuelOrig(mech));
00513                         }
00514 
00515                         notify(player, buff);
00516                 } else if(MechMove(mech) != MOVE_NONE) {
00517                         sprintf(buff,
00518                                         "Speed:      %%ch%%cg%3d%%cn KPH  Heading:      %%ch%%cg%3d%%cn deg",
00519                                         (int) (MechSpeed(mech)), MechFacing(mech));
00520                         notify(player, buff);
00521                         sprintf(buff, "Des. Speed: %3d KPH  Des. Heading: %3d deg",
00522                                         (int) MechDesiredSpeed(mech), MechDesiredFacing(mech));
00523                         notify(player, buff);
00524 
00525                 }
00526                 ShowTurretFacing(player, 0, mech);
00527                 if(MechHasHeat(mech)) {
00528                         notify_printf(player, "Excess Heat:%3d deg  Heat Production:     %3d deg   Heat Dissipation: %3d deg",
00529                                 (int) (10. * MechHeat(mech)), (int) (10. * MechPlusHeat(mech)),
00530                                 (int) (10. * MechMinusHeat(mech)));
00531                 }
00532                 break;
00533         case CLASS_MW:
00534         case CLASS_BSUIT:
00535                 sprintf(buff,
00536                                 "X, Y, Z:%3d,%3d,%3d  Speed:      %%ch%%cg%3d%%cn KPH  Heading:      %%ch%%cg%3d%%cn deg",
00537                                 MechX(mech), MechY(mech), MechZ(mech),
00538                                 (int) (MechSpeed(mech)), MechFacing(mech));
00539                 notify(player, buff);
00540                 sprintf(buff,
00541                                 "                     Des. Speed: %3d KPH  Des. Heading: %3d deg",
00542                                 (int) MechDesiredSpeed(mech), MechDesiredFacing(mech));
00543                 notify(player, buff);
00544                 break;
00545         }
00546 
00547         if(MechHasHeat(mech)) {
00548                 PrintHeatBar(player, mech);
00549 
00550                 // Little extra space to preserve formatting.
00551 //              if(MechTarget(mech) == -1 && MechTargX(mech) == -1)
00552 //                      notify(player, "  ");
00553         }
00554         notify(player, "  ");
00555         // Show our locked target info (hex or unit).   
00556         DisplayTarget(player, mech);
00557 
00558         if(MechCarrying(mech) > 0)
00559                 if((tempMech = getMech(MechCarrying(mech))))
00560                         notify_printf(player, "Towing %s.", GetMechToMechID(mech,
00561                                                                                                                                 tempMech));
00562 }
00563 
00564 /* Status commands! */
00565 void mech_status(dbref player, void *data, char *buffer)
00566 {
00567         MECH *mech = (MECH *) data;
00568         int doweap = 0, doinfo = 0, doarmor = 0, doshort = 0, doheat = 0, loop;
00569         int i;
00570         int usex = 0;
00571         char buf[LBUF_SIZE];
00572         char subbuff[256];
00573 
00574         doweird = 0;
00575         cch(MECH_USUALSM);
00576         if(!buffer || !strlen(buffer))
00577                 // No arguments, we'll go with our default 'status' output.
00578                 doweap = doinfo = doarmor = doheat = 1;
00579         else {
00580                 // Argument provided, only show certain parts.
00581                 for(loop = 0; buffer[loop]; loop++) {
00582                         switch (toupper(buffer[loop])) {
00583                         case 'R':
00584                                 doweap = doinfo = doarmor = doheat = usex = 1;
00585                                 break;
00586                         case 'A':
00587                                 // Armor status
00588                                 if(toupper(buffer[loop + 1]) == 'R')
00589                                         while (buffer[loop + 1] && buffer[loop + 1] != ' ')
00590                                                 loop++;
00591                                 doarmor = 1;
00592                                 break;
00593                         case 'I':
00594                                 // Speed/Heading/Heat
00595                                 doinfo = 1;
00596                                 if(toupper(buffer[loop + 1]) == 'N')
00597                                         while (buffer[loop + 1] && buffer[loop + 1] != ' ')
00598                                                 loop++;
00599                                 break;
00600                         case 'W':
00601                                 // Weapons list.
00602                                 doweap = 1;
00603                                 if(toupper(buffer[loop + 1]) == 'E')
00604                                         while (buffer[loop + 1] && buffer[loop + 1] != ' ')
00605                                                 loop++;
00606                                 break;
00607                         case 'N':
00608                                 // Really weird status display.
00609                                 doweird = 1;
00610                                 break;
00611                         case 'S':
00612                                 // Very short one-line status.
00613                                 doshort = 1;
00614                                 break;
00615                         case 'H':
00616                                 // Just the heat bar.
00617                                 doheat = 1;
00618                                 break;
00619                         }
00620                 }
00621         }
00622 
00623         // Very short one-line status.
00624         if(doshort) {
00625                 PrintShortInfo(player, mech);
00626                 return;
00627         }
00628 
00629         // Really weird status display.
00630         if(doweird) {
00631                 sprintf(buf, "%s %s %d %d/%d/%d %d ", MechType_Ref(mech),
00632                                 MechType_Name(mech), MechTons(mech),
00633                                 (int) (MechMaxSpeed(mech) / MP1) * 2 / 3,
00634                                 (int) (MechMaxSpeed(mech) / MP1),
00635                                 (int) (MechJumpSpeed(mech) / MP1), MechActiveNumsinks(mech));
00636                 weirdbuf = buf;
00637 
00638         } else if(!doheat || (doarmor | doinfo | doweap))
00639                 PrintGenericStatus(player, mech, 1, usex);
00640 
00641         // Show our armor diagram.
00642         if(doarmor) {
00643                 if(!doweird) {
00644                         PrintArmorStatus(player, mech, 1);
00645                         notify(player, " ");
00646                 } else {
00647                         for(i = 0; i < NUM_SECTIONS; i++)
00648                                 if(GetSectOArmor(mech, i)) {
00649                                         if(GetSectORArmor(mech, i))
00650                                                 sprintf(buf + strlen(buf), "%d|%d|%d ",
00651                                                                 GetSectOArmor(mech, i), GetSectOInt(mech, i),
00652                                                                 GetSectORArmor(mech, i));
00653                                         else
00654                                                 sprintf(buf + strlen(buf), "%d|%d ",
00655                                                                 GetSectOArmor(mech, i), GetSectOInt(mech, i));
00656                                 }
00657                 }
00658         }
00659 
00660         // Standard heat/heading/dive/etc.
00661         if(doinfo && !doweird) {
00662                 PrintInfoStatus(player, mech, 1);
00663                 //notify(player, " ");
00664         }
00665 
00666         // Show our heat bar by itself.
00667         if(!doinfo && doheat && MechHasHeat(mech)) { 
00668                 PrintHeatBar(player, mech);
00669         }
00670 
00671         // Weapons readout.
00672         if(doweap)
00673                 PrintWeaponStatus(mech, player);
00674 
00675         // Really strange, short status info.
00676         if(doweird)
00677                 notify(player, buf);
00678 }
00679 
00680 void mech_critstatus(dbref player, void *data, char *buffer)
00681 {
00682         MECH *mech = (MECH *) data;
00683         char *args[1];
00684         int index;
00685 
00686         cch(MECH_USUALSM);
00687         if(!CheckData(player, mech))
00688                 return;
00689         DOCHECK(MechType(mech) == CLASS_MW, "Huh?");
00690         DOCHECK(mech_parseattributes(buffer, args, 1) != 1,
00691                         "You must specify a section to list the criticals for!");
00692         index = ArmorSectionFromString(MechType(mech), MechMove(mech), args[0]);
00693         DOCHECK(index == -1, "Invalid section!");
00694         DOCHECK(!GetSectOInt(mech, index), "Invalid section!");
00695         CriticalStatus(player, mech, index);
00696 }
00697 
00698 static int wspec_weaps[MAX_WEAPONS_PER_MECH];
00699 static int wspec_weapcount;
00700 
00701 char *part_name(int type, int brand)
00702 {
00703         char *c;
00704         static char buffer[SBUF_SIZE];
00705 
00706         if(type == EMPTY)
00707                 return "Empty";
00708         c = get_parts_long_name(type, brand);
00709         if(!c)
00710                 return NULL;
00711         strcpy(buffer, c);
00712         if(!strcmp(c, "LifeSupport"))
00713                 strcpy(buffer, "Life Support");
00714         else if(!strcmp(c, "TripleStrengthMyomer"))
00715                 strcpy(buffer, "Triple Strength Myomer");
00716         else
00717                 strcpy(buffer, c);
00718         if((c = strstr(buffer, "Actuator")))
00719                 if(c != buffer)
00720                         strcpy(c, " Actuator");
00721         while ((c = strchr(buffer, '_')))
00722                 *c = ' ';
00723         while ((c = strchr(buffer, '.')))
00724                 *c = ' ';
00725         return buffer;
00726 }
00727 
00728 char *part_name_long(int type, int brand)
00729 {
00730         char *c;
00731         static char buffer[SBUF_SIZE];
00732 
00733         if(type == EMPTY)
00734                 return "Empty";
00735         c = get_parts_vlong_name(type, brand);
00736         if(!c)
00737                 return NULL;
00738         strcpy(buffer, c);
00739         if(!strcmp(c, "LifeSupport"))
00740                 strcpy(buffer, "Life Support");
00741         else if(!strcmp(c, "TripleStrengthMyomer"))
00742                 strcpy(buffer, "Triple Strength Myomer");
00743         else
00744                 strcpy(buffer, c);
00745         if((c = strstr(buffer, "Actuator")))
00746                 if(c != buffer)
00747                         strcpy(c, " Actuator");
00748         while ((c = strchr(buffer, '_')))
00749                 *c = ' ';
00750         while ((c = strchr(buffer, '.')))
00751                 *c = ' ';
00752         return buffer;
00753 }
00754 
00755 char *pos_part_name(MECH * mech, int index, int loop)
00756 {
00757         int t, b;
00758         char *c;
00759 
00760         if(index < 0 || index >= NUM_SECTIONS || loop < 0 ||
00761            loop >= NUM_CRITICALS) {
00762                 SendError(tprintf("INVALID: For mech #%d, %d/%d was requested.",
00763                                                   mech->mynum, index, loop));
00764                 return "--?LocationBug?--";
00765         }
00766         t = GetPartType(mech, index, loop);
00767         b = GetPartBrand(mech, index, loop);
00768         if(t == Special(HAND_OR_FOOT_ACTUATOR)) {
00769                 if(index == LLEG || index == RLEG || MechIsQuad(mech))
00770                         return "Foot Actuator";
00771                 return "Hand Actuator";
00772         }
00773         if(t == Special(SHOULDER_OR_HIP)) {
00774                 if(index == LLEG || index == RLEG || MechIsQuad(mech))
00775                         return "Hip";
00776                 return "Shoulder";
00777         }
00778         if(!(c = part_name(t, b)))
00779                 return "--?ErrorInTemplate?--";
00780         return c;
00781 
00782 }
00783 
00784 static char *wspec_fun(int i)
00785 {
00786         static char buf[MBUF_SIZE];
00787         int j;
00788 
00789         buf[0] = 0;
00790         if(!i)
00791                 if(mudconf.btech_erange)
00792                         sprintf(buf, WSDUMP_MASKS_ER);
00793                 else
00794                         sprintf(buf, WSDUMP_MASKS_NOER);
00795         else {
00796                 i--;
00797                 j = wspec_weaps[i];
00798                 if(mudconf.btech_erange)
00799                         sprintf(buf, WSDUMP_MASK_ER, MechWeapons[j].name,
00800                                         MechWeapons[j].heat, MechWeapons[j].damage,
00801                                         MechWeapons[j].min, MechWeapons[j].shortrange,
00802                                         MechWeapons[j].medrange, GunRange(j), EGunRange(j),
00803                                         MechWeapons[j].vrt);
00804                 else
00805                         sprintf(buf, WSDUMP_MASK_NOER, MechWeapons[j].name,
00806                                         MechWeapons[j].heat, MechWeapons[j].damage,
00807                                         MechWeapons[j].min, MechWeapons[j].shortrange,
00808                                         MechWeapons[j].medrange, GunRange(j), MechWeapons[j].vrt);
00809         }
00810         return buf;
00811 }
00812 
00813 void mech_weaponspecs(dbref player, void *data, char *buffer)
00814 {
00815         MECH *mech = (MECH *) data;
00816         int loop;
00817         unsigned char weaparray[MAX_WEAPS_SECTION];
00818         unsigned char weapdata[MAX_WEAPS_SECTION];
00819         int critical[MAX_WEAPS_SECTION];
00820 
00821 /*   unsigned char weaps[8 * MAX_WEAPS_SECTION]; */
00822         int num_weaps;
00823         int index;
00824         int duplicate, ii;
00825         coolmenu *c;
00826 
00827         wspec_weapcount = 0;
00828         if(!CheckData(player, mech))
00829                 return;
00830         for(loop = 0; loop < NUM_SECTIONS; loop++) {
00831                 num_weaps = FindWeapons(mech, loop, weaparray, weapdata, critical);
00832                 for(index = 0; index < num_weaps; index++) {
00833                         duplicate = 0;
00834                         for(ii = 0; ii < wspec_weapcount; ii++)
00835                                 if(weaparray[index] == wspec_weaps[ii])
00836                                         duplicate = 1;
00837                         if(!duplicate && wspec_weapcount < MAX_WEAPONS_PER_MECH)
00838                                 wspec_weaps[wspec_weapcount++] = weaparray[index];
00839                 }
00840         }
00841         DOCHECK(!wspec_weapcount, "You have no weapons!");
00842         if(strcmp(MechType_Name(mech), MechType_Ref(mech)))
00843                 c = SelCol_FunStringMenuK(1,
00844                                                                   tprintf("Weapons statistics for %s: %s",
00845                                                                                   MechType_Name(mech),
00846                                                                                   MechType_Ref(mech)), wspec_fun,
00847                                                                   wspec_weapcount + 1);
00848         else
00849                 c = SelCol_FunStringMenuK(1, tprintf("Weapons statistics for %s",
00850                                                                                          MechType_Ref(mech)), wspec_fun,
00851                                                                   wspec_weapcount + 1);
00852         ShowCoolMenu(player, c);
00853         KillCoolMenu(c);
00854 }
00855 
00856 char *critstatus_func(MECH * mech, char *arg)
00857 {
00858         static char buffer[MBUF_SIZE];
00859         char *tmp;
00860         int index, i, max_crits;
00861         int type;
00862 
00863         if(!arg || !*arg)
00864                 return "#-1 INVALID SECTION";
00865 
00866         index = ArmorSectionFromString(MechType(mech), MechMove(mech), arg);
00867         if(index == -1 || !GetSectOInt(mech, index))
00868                 return "#-1 INVALID SECTION";
00869 
00870         buffer[0] = '\0';
00871         max_crits = CritsInLoc(mech, index);
00872         for(i = 0; i < max_crits; i++) {
00873                 if(buffer[0])
00874                         sprintf(buffer, "%s,", buffer);
00875                 sprintf(buffer, "%s%d|", buffer, i + 1);
00876                 type = GetPartType(mech, index, i);
00877                 if(IsAmmo(type))
00878                         type = FindAmmoType(mech, index, i);
00879                 tmp = get_parts_long_name(type, GetPartBrand(mech, index, i));
00880                 sprintf(buffer, "%s|%s", buffer, tmp ? tmp : "Empty");
00881                 sprintf(buffer, "%s|%d", buffer, (PartIsNonfunctional(mech, index,
00882                                                                                                                           i)
00883                                                                                   && type != EMPTY && (!IsCrap(type)
00884                                                                                                                            ||
00885                                                                                                                            SectIsDestroyed
00886                                                                                                                            (mech,
00887                                                                                                                                 index))) ? -1
00888                                 : PartTempNuke(mech, index, i));
00889                 sprintf(buffer, "%s|%d", buffer,
00890                                 IsWeapon(type) ? 1 : IsAmmo(type) ? 2 : IsActuator(type) ? 3 :
00891                                 IsCargo(type) ? 4 : (IsCrap(type) || type == EMPTY) ? 5 : 0);
00892         }
00893         return buffer;
00894 }
00895 
00896 char *armorstatus_func(MECH * mech, char *arg)
00897 {
00898         static char buffer[MBUF_SIZE];
00899         char **locs;
00900         int index;
00901         int iter, curarm, curint, totarm, totint;
00902 
00903         if(!arg || !*arg)
00904                 return "#-1 INVALID SECTION";
00905 
00906         if(strcmp(arg, "all") == 0) {
00907                 locs = ProperSectionStringFromType(MechType(mech), MechMove(mech));
00908                 curarm = totarm = curint = totint = 0;
00909                 for(iter = 0; locs[iter]; iter++) {
00910                         curarm += GetSectArmor(mech, iter) + GetSectRArmor(mech, iter);
00911                         totarm += GetSectOArmor(mech, iter) + GetSectORArmor(mech, iter);
00912                         curint += GetSectInt(mech, iter);
00913                         totint += GetSectOInt(mech, iter);
00914                 }
00915                 buffer[0] = '\0';
00916                 snprintf(buffer, MBUF_SIZE, "%d/%d|%d/%d", curarm, totarm, curint,
00917                                  totint);
00918                 return buffer;
00919         }
00920 
00921         index = ArmorSectionFromString(MechType(mech), MechMove(mech), arg);
00922         if(index == -1 || !GetSectOInt(mech, index))
00923                 return "#-1 INVALID SECTION";
00924 
00925         buffer[0] = '\0';
00926         snprintf(buffer, MBUF_SIZE, "%d/%d|%d/%d|%d/%d",
00927                          GetSectArmor(mech, index), GetSectOArmor(mech, index),
00928                          GetSectInt(mech, index), GetSectOInt(mech, index),
00929                          GetSectRArmor(mech, index), GetSectORArmor(mech, index));
00930         return buffer;
00931 }
00932 
00933 /* weaponstatus_func. Returns a string containing:
00934    
00935    <weapon number> | <weapon (long) name> | <number of crits> |
00936         <part quality> | <weapon recycle time> | <recycle time left> |
00937         <weapon type> | <weapon status>
00938    [ , <next weapon> ]
00939         
00940    Weapon number is the number of the weapon in this particular 'mech.
00941    Long weapon name is 'agra.mediumlaser' and such.
00942    Weapon type is as defined in mech.h:
00943            #define TBEAM      0
00944            #define TMISSILE   1
00945            #define TARTILLERY 2
00946            #define TAMMO      3
00947            #define THAND      4
00948    Weapon status is:
00949         0 - weapon operational
00950         1 - weapon (temporarily) glitched
00951         2 - weapon destroyed/flooded
00952 */
00953 
00954 char *weaponstatus_func(MECH * mech, char *arg)
00955 {
00956         static char buffer[MBUF_SIZE];
00957         int count, sect, loopsect, i, type, totalcount = 0;
00958         unsigned char weaparray[MAX_WEAPS_SECTION];
00959         unsigned char weapdata[MAX_WEAPS_SECTION];
00960         int criticals[MAX_WEAPS_SECTION];
00961 
00962         if(!arg)
00963                 sect = -1;
00964         else if(!*arg)
00965                 return "#-1 INVALID SECTION";
00966         else if((sect = ArmorSectionFromString(MechType(mech),
00967                                                                                    MechMove(mech), arg)) == -1
00968                         || !GetSectOInt(mech, sect))
00969                 return "#-1 INVALID SECTION";
00970 
00971         buffer[0] = '\0';
00972         for((sect == -1) ? (loopsect = 0) : (loopsect = sect);
00973                 (sect == -1) ? (loopsect < NUM_SECTIONS) : (loopsect < sect + 1);
00974                 loopsect++) {
00975                 count = FindWeapons(mech, loopsect, weaparray, weapdata, criticals);
00976                 for(i = 0; i < count; i++, totalcount++) {
00977                         if(buffer[0])
00978                                 sprintf(buffer, "%s,", buffer);
00979                         type = Weapon2I(GetPartType(mech, loopsect, criticals[i]));
00980                         sprintf(buffer, "%s%d|%s|%d|%d|%d|%d|%d|%d", buffer,
00981                                         totalcount, get_parts_long_name(I2Weapon(type),
00982                                                                                                         GetPartBrand(mech,
00983                                                                                                                                  loopsect,
00984                                                                                                                                  criticals
00985                                                                                                                                  [i])),
00986                                         GetWeaponCrits(mech, type), GetPartBrand(mech, loopsect,
00987                                                                                                                          criticals[i]),
00988                                         MechWeapons[type].vrt, weapdata[i],
00989                                         MechWeapons[type].type, PartIsNonfunctional(mech,
00990                                                                                                                                 loopsect,
00991                                                                                                                                 criticals[i])
00992                                         ? 2 : PartTempNuke(mech, loopsect, criticals[i]) ? 1 : 0);
00993                 }
00994         }
00995         return buffer;
00996 }
00997 
00998 char *critslot_func(MECH * mech, char *buf_section, char *buf_critnum,
00999                                         char *buf_flag)
01000 {
01001         int index, crit, flag, type;
01002         static char buffer[MBUF_SIZE];
01003 
01004         index =
01005                 ArmorSectionFromString(MechType(mech), MechMove(mech), buf_section);
01006         if(index == -1)
01007                 return "#-1 INVALID SECTION";
01008         if(!GetSectOInt(mech, index))
01009                 return "#-1 INVALID SECTION";
01010         crit = atoi(buf_critnum);
01011         if(crit < 1 || crit > CritsInLoc(mech, index))
01012                 return "#-1 INVALID CRITICAL";
01013         crit--;
01014         if(!buf_flag)
01015                 flag = 0;
01016         else if(strcasecmp(buf_flag, "NAME") == 0)
01017                 flag = 0;
01018         else if(strcasecmp(buf_flag, "STATUS") == 0)
01019                 flag = 1;
01020         else if(strcasecmp(buf_flag, "DATA") == 0)
01021                 flag = 2;
01022         else if(strcasecmp(buf_flag, "MAXAMMO") == 0)
01023                 flag = 3;
01024         else if(strcasecmp(buf_flag, "AMMOTYPE") == 0)
01025                 flag = 4;
01026         else if(strcasecmp(buf_flag, "MODE") == 0)
01027                 flag = 5;
01028         else if(strcasecmp(buf_flag, "HALFTON") == 0)
01029                 flag = 6;
01030         else
01031                 flag = 0;
01032 
01033         type = GetPartType(mech, index, crit);
01034 
01035         if(flag == 1) {
01036                 if(PartIsDisabled(mech, index, crit))
01037                         return "Disabled";
01038                 if(PartIsDestroyed(mech, index, crit))
01039                         return "Destroyed";
01040                 return "Operational";
01041         } else if(flag == 2) {
01042                 snprintf(buffer, MBUF_SIZE, "%d", GetPartData(mech, index, crit));
01043                 return buffer;
01044         } else if(flag == 3) {
01045                 if(!IsAmmo(type))
01046                         return "#-1 NOT AMMO";
01047                 snprintf(buffer, MBUF_SIZE, "%d", FullAmmo(mech, index, crit));
01048                 return buffer;
01049         } else if(flag == 4) {
01050                 if(!IsAmmo(type))
01051                         return "#-1 NOT AMMO";
01052                 type = FindAmmoType(mech, index, crit);
01053         } else if(flag == 5) {
01054                 int weapindex;
01055                 if(!IsWeapon(type))
01056                         return "#-1 NOT AMMO OR WEAPON";
01057                 else {
01058                         weapindex = Weapon2I(type);
01059                         snprintf(buffer, MBUF_SIZE, "%c%c",
01060                                          GetWeaponFireModeLetter_Model_Mode(weapindex,
01061                                                                                                                 GetPartFireMode(mech,
01062                                                                                                                                                 index,
01063                                                                                                                                                 crit)),
01064                                          GetWeaponAmmoModeLetter_Model_Mode(weapindex,
01065                                                                                                                 GetPartAmmoMode(mech,
01066                                                                                                                                                 index,
01067                                                                                                                                                 crit)));
01068                         return buffer;
01069                 }
01070         } else if(flag == 6) {
01071                 if(!IsAmmo(type))
01072                         return "#-1 NOT AMMO";
01073                 snprintf(buffer, MBUF_SIZE, "%d", GetPartFireMode(mech, index, crit) & HALFTON_MODE ? 1 : 0);
01074                 return buffer;
01075 
01076         }
01077 
01078         if(type == EMPTY || IsCrap(type))
01079                 return "Empty";
01080         if(flag == 0)
01081 #ifndef BT_COMPLEXREPAIRS
01082                 type = alias_part(mech, type);
01083 #else
01084                 type = alias_part(mech, type, index);
01085 #endif
01086         snprintf(buffer, MBUF_SIZE, "%s",
01087                          get_parts_vlong_name(type, GetPartBrand(mech, index, crit)));
01088         return buffer;
01089 }
01090 
01091 void CriticalStatus(dbref player, MECH * mech, int index)
01092 {
01093         int loop, i;
01094         char buffer[MBUF_SIZE];
01095         int type, data, wFireMode;
01096         int max_crits = CritsInLoc(mech, index);
01097         char **foo;
01098         int count = 0;
01099         coolmenu *cm;
01100 
01101         Create(foo, char *, NUM_CRITICALS + 1);
01102 
01103         for(i = 0; i < max_crits; i++) {
01104                 loop = ((i % 2) ? (max_crits / 2) : 0) + i / 2;
01105                 sprintf(buffer, "%2d ", loop + 1);
01106                 type = GetPartType(mech, index, loop);
01107                 data = GetPartData(mech, index, loop);
01108                 wFireMode = GetPartFireMode(mech, index, loop);
01109                 if(IsAmmo(type)) {
01110                         char trash[50];
01111 
01112                         strcat(buffer, &MechWeapons[Ammo2WeaponI(type)].name[3]);
01113                         strcat(buffer, GetAmmoDesc_Model_Mode(Ammo2WeaponI(type),
01114                                                                                                   GetPartAmmoMode(mech, index,
01115                                                                                                                                   loop)));
01116                         strcat(buffer, " Ammo");
01117 
01118                         if(!PartIsNonfunctional(mech, index, loop)) {
01119                                 sprintf(trash, " (%d)", data);
01120                                 strcat(buffer, trash);
01121                         }
01122 
01123                 } else {
01124                         if(IsWeapon(type) && (wFireMode & OS_MODE))
01125                                 strcat(buffer, "OS ");
01126                         strcat(buffer, pos_part_name(mech, index, loop));
01127                         if(IsWeapon(type) && (((wFireMode & OS_MODE) &&
01128                                                                    (wFireMode & OS_USED)) ||
01129                                                                   (wFireMode & ROCKET_FIRED)))
01130                                 strcat(buffer, " (Empty)");
01131                                 if(wFireMode & WILL_JETTISON_MODE)
01132                                         strcat(buffer, " (backpack)");
01133                 }
01134 
01135                 if(PartIsBroken(mech, index, loop) && type != EMPTY &&
01136                    (!IsCrap(type) || SectIsDestroyed(mech, index)))
01137                         strcat(buffer, PartIsDestroyed(mech, index, loop) ?
01138                                    " (Destroyed)" : " (Broken)");
01139                 else if(PartIsDisabled(mech, index, loop) && type != EMPTY)
01140                         strcat(buffer, " (Disabled)");
01141                 else if(PartIsDamaged(mech, index, loop) && type != EMPTY)
01142                         strcat(buffer, " (Damaged)");
01143 
01144                 foo[count++] = strdup(buffer);
01145         }
01146 
01147         ArmorStringFromIndex(index, buffer, MechType(mech), MechMove(mech));
01148         strcat(buffer, " Criticals");
01149         cm = SelCol_StringMenu(2, buffer, foo);
01150         ShowCoolMenu(player, cm);
01151         KillCoolMenu(cm);
01152         KillText(foo);
01153 }
01154 
01155 char *evaluate_ammo_amount(int now, int max)
01156 {
01157         int f = (now * 100) / max;
01158 
01159         if(f >= 50)
01160                 return "%ch%cg";
01161         if(f >= 25)
01162                 return "%ch%cy";
01163         return "%ch%cr";
01164 }
01165 
01166 void PrintWeaponStatus(MECH * mech, dbref player)
01167 {
01168         unsigned char weaparray[MAX_WEAPS_SECTION];
01169         unsigned char weapdata[MAX_WEAPS_SECTION];
01170         int critical[MAX_WEAPS_SECTION];
01171         unsigned char ammoweap[8 * MAX_WEAPS_SECTION];
01172         unsigned short ammo[8 * MAX_WEAPS_SECTION];
01173         unsigned short ammomax[8 * MAX_WEAPS_SECTION];
01174         unsigned int modearray[8 * MAX_WEAPS_SECTION];
01175         char tmpbuf[MBUF_SIZE];
01176         int count, ammoweapcount;
01177         int loop;
01178         int ii, i = 0;
01179         char weapname[80], *tmpc;
01180         char weapbuff[120];
01181         char tempbuff[160];
01182         char location[80];
01183         char astrAmmoSpacer[52];
01184         int running_sum = 0;
01185         short ammo_mode;
01186 
01187         if((MechSpecials(mech) & ECM_TECH) ||
01188            (MechSpecials2(mech) & STEALTH_ARMOR_TECH) ||
01189            (MechSpecials2(mech) & NULLSIGSYS_TECH) ||
01190            (MechSpecials(mech) & SLITE_TECH) ||
01191            HasC3(mech) ||
01192            HasC3i(mech) ||
01193            (MechSpecials(mech) & MASC_TECH) ||
01194            (MechSpecials2(mech) & SUPERCHARGER_TECH) ||
01195            (MechSpecials(mech) & TRIPLE_MYOMER_TECH) ||
01196            (MechSpecials2(mech) & ANGEL_ECM_TECH) || HasTAG(mech) ||
01197            (MechInfantrySpecials(mech) & FC_INFILTRATORII_STEALTH_TECH)) {
01198                 strcpy(tempbuff, "AdvTech: ");
01199 
01200                 if(MechSpecials(mech) & ECM_TECH) {
01201                         sprintf(tempbuff + strlen(tempbuff), "ECM(%s)  ",
01202                                         (MechStatus2(mech) & ECM_DESTROYED) ? "%ch%crXX%cn"
01203                                         : ECMEnabled(mech) ? (ECMActive(mech) ? "%ch%cgECM%cn" :
01204                                                                                   "%ch%crECM%cn") : ECCMEnabled(mech)
01205                                         ? "%ch%cgECCM%cn" : ECMCountered(mech) ? "%crOff%cn" :
01206                                         "%cgOff%cn");
01207                 }
01208 
01209                 if(MechSpecials2(mech) & ANGEL_ECM_TECH) {
01210                         sprintf(tempbuff + strlen(tempbuff), "AngelECM(%s)  ",
01211                                         (!HasWorkingAngelECMSuite(mech)) ? "%ch%crXX%cn"
01212                                         : AngelECMEnabled(mech) ? (AngelECMActive(mech) ?
01213                                                                                            "%ch%cgECM%cn" :
01214                                                                                            "%ch%crECM%cn") :
01215                                         AngelECCMEnabled(mech) ? "%ch%cgECCM%cn" :
01216                                         ECMCountered(mech) ? "%crOff%cn" : "%cgOff%cn");
01217 
01218                 }
01219 
01220                 if(MechInfantrySpecials(mech) & FC_INFILTRATORII_STEALTH_TECH) {
01221                         sprintf(tempbuff + strlen(tempbuff), "PersonalECM(%s)  ",
01222                                         PerECMEnabled(mech) ? (PerECMActive(mech) ?
01223                                                                                    "%ch%cgECM%cn" : "%ch%crECM%cn") :
01224                                         PerECCMEnabled(mech) ? "%ch%cgECCM%cn" :
01225                                         ECMCountered(mech) ? "%crOff%cn" : "%cgOff%cn");
01226 
01227                 }
01228 
01229                 if(MechSpecials2(mech) & STEALTH_ARMOR_TECH) {
01230                         sprintf(tempbuff + strlen(tempbuff), "SthArmor(%s)  ",
01231                                         (MechStatus2(mech) & ECM_DESTROYED) ? "%ch%crXX%cn"
01232                                         : StealthArmorActive(mech) ? "%ch%cgOn%cn" : "%cgRdy%cn");
01233                 }
01234 
01235                 if(MechSpecials2(mech) & NULLSIGSYS_TECH) {
01236                         sprintf(tempbuff + strlen(tempbuff), "NullSigSys(%s)  ",
01237                                         NullSigSysDest(mech) ? "%ch%crXX%cn" :
01238                                         NullSigSysActive(mech) ? "%ch%cgOn%cn" : "%cgRdy%cn");
01239                 }
01240 
01241                 if(MechSpecials(mech) & SLITE_TECH) {
01242                         sprintf(tempbuff + strlen(tempbuff), "SLITE(%s)  ",
01243                                         (MechCritStatus(mech) & SLITE_DEST) ? "%cr%chXX%cn"
01244                                         : (MechStatus2(mech) & SLITE_ON) ? "%ch%cgOn%cn" :
01245                                         "%cgOff%cn");
01246                 }
01247 
01248                 if(HasC3m(mech))
01249                         sprintf(tempbuff + strlen(tempbuff), "%sC3M%%cn  ",
01250                                         C3Destroyed(mech) ? "%cr" :
01251                                         AnyECMDisturbed(mech) ? "%cy" :
01252                                         MechC3NetworkSize(mech) > 0 ? "%cg%ch" : "%cg");
01253 
01254                 if(HasC3s(mech))
01255                         sprintf(tempbuff + strlen(tempbuff), "%sC3S%%cn  ",
01256                                         C3Destroyed(mech) ? "%cr" :
01257                                         AnyECMDisturbed(mech) ? "%cy" :
01258                                         MechC3NetworkSize(mech) > 0 ? "%cg%ch" : "%cg");
01259 
01260                 if(HasC3i(mech))
01261                         sprintf(tempbuff + strlen(tempbuff), "%sC3i%%cn  ",
01262                                         C3iDestroyed(mech) ? "%cr" :
01263                                         AnyECMDisturbed(mech) ? "%cy" :
01264                                         MechC3iNetworkSize(mech) > 0 ? "%cg%ch" : "%cg");
01265 
01266                 if(MechSpecials(mech) & TRIPLE_MYOMER_TECH)
01267                         sprintf(tempbuff + strlen(tempbuff), "TSM(%s)  ",
01268                                         ((MechHeat(mech) >= 9.0) ? "%ch%cgOn%cn" : "%cgOff%cn"));
01269 
01270                 if(HasTAG(mech)) {
01271                         sprintf(tempbuff + strlen(tempbuff), "TAG(%s)  ",
01272                                         isTAGDestroyed(mech) ? "%cr%chXX%cn" :
01273                                         ((getMech(TAGTarget(mech)) <= 0) ||
01274                                          (TaggedBy(getMech(TAGTarget(mech))) !=
01275                                           mech->mynum)) ? (TagRecycling(mech) ?
01276                                                                            "%cy%chNot Rdy%cn" : "%cgRdy%cn") :
01277                                         tprintf("%s%s%%cn",
01278                                                         (TagRecycling(mech) ? "%cy%ch" : "%ch"),
01279                                                         GetMechToMechID(mech, getMech(TAGTarget(mech)))));
01280                 }
01281 
01282                 if(MechSpecials2(mech) & SUPERCHARGER_TECH)
01283                         sprintf(tempbuff + strlen(tempbuff), "SCHARGE: %s%d%%cn (%s)",
01284                                         MechSChargeCounter(mech) >
01285                                         3 ? "%ch%cr" : MechSChargeCounter(mech) >
01286                                         0 ? "%ch%cy" : "%cg", MechSChargeCounter(mech),
01287                                         MechStatus(mech) & SCHARGE_ENABLED ? "On" : "Off");
01288 
01289                 if(MechSpecials(mech) & MASC_TECH)
01290                         sprintf(tempbuff + strlen(tempbuff), "MASC: %s%d%%cn (%s)",
01291                                         MechMASCCounter(mech) >
01292                                         3 ? "%ch%cr" : MechMASCCounter(mech) >
01293                                         0 ? "%ch%cy" : "%cg", MechMASCCounter(mech),
01294                                         MechStatus(mech) & MASC_ENABLED ? "On" : "Off");
01295 
01296                 notify(player, tempbuff);
01297                 tempbuff[0] = 0;
01298         }
01299 
01300         if(MechSpecials2(mech) & CARRIER_TECH) {
01301                 strcpy(tempbuff, "Carrier: ");
01302 
01303                 sprintf(tempbuff + strlen(tempbuff),
01304                                 "%d tons free, %d tons max unit size",
01305                                 (CargoSpace(mech) / 100), CarMaxTon(mech));
01306                 notify(player, tempbuff);
01307                 tempbuff[0] = 0;
01308         }
01309 
01310         if((MechSpecials(mech) & AA_TECH) ||
01311            (MechSpecials(mech) & BEAGLE_PROBE_TECH) ||
01312            (MechSpecials2(mech) & BLOODHOUND_PROBE_TECH)) {
01313 
01314                 strcpy(tempbuff, "AdvSensors:");
01315 
01316                 if(MechSpecials(mech) & AA_TECH)
01317                         sprintf(tempbuff + strlen(tempbuff), " Radar");
01318 
01319                 if(MechSpecials(mech) & BEAGLE_PROBE_TECH)
01320                         sprintf(tempbuff + strlen(tempbuff), " BeagleProbe");
01321 
01322                 if(MechSpecials2(mech) & BLOODHOUND_PROBE_TECH)
01323                         sprintf(tempbuff + strlen(tempbuff), " BloodhoundProbe");
01324 
01325                 notify(player, tempbuff);
01326                 tempbuff[0] = 0;
01327         }
01328 
01329         if((MechInfantrySpecials(mech) & CS_PURIFIER_STEALTH_TECH) ||
01330            (MechInfantrySpecials(mech) & DC_KAGE_STEALTH_TECH) ||
01331            (MechInfantrySpecials(mech) & FWL_ACHILEUS_STEALTH_TECH) ||
01332            (MechInfantrySpecials(mech) & FC_INFILTRATOR_STEALTH_TECH) ||
01333            (MechInfantrySpecials(mech) & FC_INFILTRATORII_STEALTH_TECH)) {
01334 
01335                 strcpy(tempbuff, "AdvItems:");
01336 
01337                 if(MechInfantrySpecials(mech) & CS_PURIFIER_STEALTH_TECH)
01338                         sprintf(tempbuff + strlen(tempbuff), " PurifierStealth");
01339 
01340                 if(MechInfantrySpecials(mech) & DC_KAGE_STEALTH_TECH)
01341                         sprintf(tempbuff + strlen(tempbuff), " KageStealth");
01342 
01343                 if(MechInfantrySpecials(mech) & FWL_ACHILEUS_STEALTH_TECH)
01344                         sprintf(tempbuff + strlen(tempbuff), " AchileusStealth");
01345 
01346                 if(MechInfantrySpecials(mech) & FC_INFILTRATOR_STEALTH_TECH)
01347                         sprintf(tempbuff + strlen(tempbuff), " InfiltratorStealth");
01348 
01349                 if(MechInfantrySpecials(mech) & FC_INFILTRATORII_STEALTH_TECH)
01350                         sprintf(tempbuff + strlen(tempbuff), " InfiltratorIIStealth");
01351 
01352                 notify(player, tempbuff);
01353                 tempbuff[0] = 0;
01354         }
01355 
01356         if((MechInfantrySpecials(mech) & INF_SWARM_TECH) ||
01357            (MechInfantrySpecials(mech) & INF_MOUNT_TECH) ||
01358            (MechInfantrySpecials(mech) & INF_ANTILEG_TECH) ||
01359            (MechInfantrySpecials(mech) & CAN_JETTISON_TECH)) {
01360 
01361                 strcpy(tempbuff, "Special Actions:");
01362 
01363                 if(MechInfantrySpecials(mech) & INF_MOUNT_TECH)
01364                         sprintf(tempbuff + strlen(tempbuff), " MountFriends");
01365 
01366                 if(MechInfantrySpecials(mech) & INF_SWARM_TECH)
01367                         sprintf(tempbuff + strlen(tempbuff), " SwarmAttack");
01368 
01369                 if(MechInfantrySpecials(mech) & INF_ANTILEG_TECH)
01370                         sprintf(tempbuff + strlen(tempbuff), " AntiLegAttack");
01371 
01372                 if(MechInfantrySpecials(mech) & CAN_JETTISON_TECH)
01373                         sprintf(tempbuff + strlen(tempbuff), " BackPackJettison");
01374 
01375                 notify(player, tempbuff);
01376                 tempbuff[0] = 0;
01377         }
01378 
01379         if(MechInfantrySpecials(mech) & MUST_JETTISON_TECH) {
01380                 strcpy(tempbuff,
01381                            "Requirements: Must jettison backpack before using special abilities or jumping");
01382                 notify(player, tempbuff);
01383                 tempbuff[0] = 0;
01384         }
01385 #define SHOWSECTSTAT(a) \
01386          (SectIsDestroyed(mech, a) ? "%ch%cx*****%c" : \
01387          (MechSections(mech)[(a)].recycle > 0) ? \
01388          tprintf("%-5d", (MechSections(mech)[(a)].recycle / WEAPON_TICK) \
01389          + (MechSections(mech)[(a)].recycle%WEAPON_TICK)) : "%cgReady%c")
01390 
01391         UpdateRecycling(mech);
01392         if(MechType(mech) == CLASS_MECH && !doweird) {
01393                 tempbuff[0] = 0;
01394 
01395 #define SHOWPHYSTATUS(a,b) \
01396          (!canUsePhysical(mech,a,b) ? "%ch%crXX%c" : \
01397          (MechSections(mech)[(a)].recycle > 0) ? \
01398                 tprintf("%-3d", (MechSections(mech)[(a)].recycle / WEAPON_TICK) + \
01399         + (MechSections(mech)[(a)].recycle%WEAPON_TICK)) : "%cgRdy%c")
01400 
01401 #define SHOW(part,loc) \
01402                 sprintf(tempbuff + strlen(tempbuff), "%s: %s  ", part, loc)
01403 
01404                 SHOW(MechIsQuad(mech) ? "FLLEG" : "LARM", SHOWSECTSTAT(LARM));
01405                 SHOW(MechIsQuad(mech) ? "FRLEG" : "RARM", SHOWSECTSTAT(RARM));
01406                 SHOW(MechIsQuad(mech) ? "RLLEG" : "LLEG", SHOWSECTSTAT(LLEG));
01407                 SHOW(MechIsQuad(mech) ? "RRLEG" : "RLEG", SHOWSECTSTAT(RLEG));
01408 
01409                 if(hasPhysical(mech, LARM, PHY_AXE))
01410                         SHOW("Axe[LA]", SHOWPHYSTATUS(LARM, PHY_AXE));
01411 
01412                 if(hasPhysical(mech, RARM, PHY_AXE))
01413                         SHOW("Axe[RA]", SHOWPHYSTATUS(RARM, PHY_AXE));
01414 
01415                 if(hasPhysical(mech, LARM, PHY_SWORD))
01416                         SHOW("Sword[LA]", SHOWPHYSTATUS(LARM, PHY_SWORD));
01417 
01418                 if(hasPhysical(mech, RARM, PHY_SWORD))
01419                         SHOW("Sword[RA]", SHOWPHYSTATUS(RARM, PHY_SWORD));
01420 
01421                 if(hasPhysical(mech, LARM, PHY_MACE))
01422                         SHOW("Mace[LA]", SHOWPHYSTATUS(LARM, PHY_MACE));
01423 
01424                 if(hasPhysical(mech, RARM, PHY_MACE))
01425                         SHOW("Mace[RA]", SHOWPHYSTATUS(RARM, PHY_MACE));
01426 
01427                 if(hasPhysical(mech, LARM, PHY_SAW))
01428                         SHOW("Saw[LA]", SHOWPHYSTATUS(LARM, PHY_SAW));
01429 
01430                 if(hasPhysical(mech, RARM, PHY_SAW))
01431                         SHOW("Saw[RA]", SHOWPHYSTATUS(RARM, PHY_SAW));
01432 
01433                 notify(player, tempbuff);
01434 
01435                 if(MechStatus(mech) & FLIPPED_ARMS)
01436                         notify(player, "*** Mech arms are flipped into the rear arc ***");
01437         } else if(MechType(mech) == CLASS_BSUIT && !doweird) {
01438                 for(i = 0; i < NUM_BSUIT_MEMBERS; i++)
01439                         if(GetSectInt(mech, i))
01440                                 break;
01441                 if(i < NUM_BSUIT_MEMBERS) {
01442                         sprintf(tempbuff, "Team status (special attacks): %s",
01443                                         SHOWSECTSTAT(i));
01444                         notify(player, tempbuff);
01445                 }
01446 
01447         } else if(((MechType(mech) == CLASS_VEH_GROUND) ||
01448                            (MechType(mech) == CLASS_VTOL)) && !doweird) {
01449 
01450                 *tempbuff = 0;
01451 
01452                 if(MechSections(mech)[FSIDE].recycle) {
01453                         sprintf(tempbuff + strlen(tempbuff),
01454                                         "Vehicle status (charge): %s", SHOWSECTSTAT(FSIDE));
01455                 }
01456 
01457                 if(*tempbuff)
01458                         notify(player, tempbuff);
01459         }
01460 
01461         ammoweapcount = FindAmmunition(mech, ammoweap, ammo, ammomax, modearray, 0);
01462         if(!doweird) {
01463                 notify(player,
01464                            "==================WEAPON SYSTEMS===========================AMMUNITION========");
01465                 if(MechType(mech) == CLASS_BSUIT)
01466                         notify(player,
01467                                    "------ Weapon --------- [##] Holder ------ Status ||--- Ammo Type ---- Rounds");
01468                 else
01469                         notify(player,
01470                                    "------ Weapon --------- [##] Location ---- Status ||--- Ammo Type ---- Rounds");
01471         }
01472         for(loop = 0; loop < NUM_SECTIONS; loop++) {
01473                 count = FindWeapons(mech, loop, weaparray, weapdata, critical);
01474                 if(count <= 0)
01475                         continue;
01476                 ArmorStringFromIndex(loop, tempbuff, MechType(mech), MechMove(mech));
01477                 sprintf(location, "%-14.14s", tempbuff);
01478                 if(doweird) {
01479                         strcpy(location, tempbuff);
01480                         if((tmpc = strchr(location, ' ')))
01481                                 *tmpc = '_';
01482                 }
01483                 for(ii = 0; ii < count; ii++) {
01484                         if(IsAMS(weaparray[ii]))
01485                                 sprintf(weapbuff, " %-16.16s %c%c%c%c%c [%2d] ",
01486                                                 &MechWeapons[weaparray[ii]].name[3],
01487                                                 ' ',
01488                                                 (MechStatus(mech) & AMS_ENABLED) ? ' ' : 'O',
01489                                                 (MechStatus(mech) & AMS_ENABLED) ? 'O' : 'F',
01490                                                 (MechStatus(mech) & AMS_ENABLED) ? 'N' : 'F',
01491                                                 ' ', running_sum + ii);
01492                         else {
01493                                 if(GetPartFireMode(mech, loop, critical[ii]) & OS_MODE)
01494                                         strcpy(tmpbuf, "OS ");
01495                                 else
01496                                         tmpbuf[0] = 0;
01497                                 strcat(tmpbuf, &MechWeapons[weaparray[ii]].name[3]);
01498                                 sprintf(weapbuff, " %-16.16s %c%c%c%c%c [%2d] ", tmpbuf,
01499                                                 (GetPartFireMode(mech, loop,
01500                                                                                  critical[ii]) & REAR_MOUNT) ? 'R' :
01501                                                 ' ',
01502                                                 (((GetPartFireMode(mech, loop, critical[ii]) &
01503                                                    OS_USED)
01504                                                   || (GetPartFireMode(mech, loop, critical[ii]) &
01505                                                           ROCKET_FIRED)) ? '-' : (GetPartFireMode(mech,
01506                                                                                                                                           loop,
01507                                                                                                                                           critical
01508                                                                                                                                           [ii]) &
01509                                                                                                           OS_MODE) ? 'O' : ' '),
01510                                                 GetWeaponAmmoModeLetter(mech, loop, critical[ii]),
01511                                                 GetWeaponFireModeLetter(mech, loop, critical[ii]),
01512                                                 ((GetPartFireMode(mech, loop, critical[ii]) & ON_TC)
01513                                                  && (!(MechCritStatus(mech) & TC_DESTROYED))) ? 'T'
01514                                                 : (GetPartFireMode(mech, loop, critical[ii]) &
01515                                                    IS_JETTISONED_MODE) ? 'J' : (GetPartFireMode(mech,
01516                                                                                                                                                 loop,
01517                                                                                                                                                 critical
01518                                                                                                                                                 [ii])
01519                                                                                                                 & WILL_JETTISON_MODE)
01520                                                 ? 'P' : ' ', running_sum + ii);
01521                         }
01522                         if(doweird)
01523                                 sprintf(weirdbuf + strlen(weirdbuf), "%s|%s",
01524                                                 &MechWeapons[weaparray[ii]].name[3], location);
01525                         strcat(weapbuff, location);
01526 
01527                         if(PartIsBroken(mech, loop, critical[ii]) ||
01528                            PartTempNuke(mech, loop, critical[ii]) == FAIL_DESTROYED)
01529                                 strcat(weapbuff, "%ch%cx*****%c  || ");
01530                         else if(PartIsDisabled(mech, loop, critical[ii]))
01531                                 strcat(weapbuff, "%crDISABLE%c|| ");
01532                         else if(PartTempNuke(mech, loop, critical[ii])) {
01533                                 switch (PartTempNuke(mech, loop, critical[ii])) {
01534                                 case FAIL_JAMMED:
01535                                         strcat(weapbuff, "%crJAMMED%c || ");
01536                                         break;
01537                                 case FAIL_SHORTED:
01538                                         strcat(weapbuff, "%crSHORTED%c|| ");
01539                                         break;
01540                                 case FAIL_EMPTY:
01541                                         strcat(weapbuff, " %crEMPTY%c || ");
01542                                         break;
01543                                 case FAIL_DUD:
01544                                         strcat(weapbuff, "%crDUD%c    || ");
01545                                         break;
01546                                 case FAIL_AMMOJAMMED:
01547                                         strcat(weapbuff, "%crAMMOJAM%c|| ");
01548                                         break;
01549                                 }
01550                         } else if(GetPartFireMode(mech, loop,
01551                                                                           critical[ii]) & ROCKET_FIRED)
01552                                 strcat(weapbuff, "%ch%cxEmpty%c  || ");
01553                         else if(weapdata[ii])
01554                                 strcat(weapbuff,
01555                                            tprintf(" %2d    || ",
01556                                                            weapdata[ii] / WEAPON_TICK +
01557                                                            (weapdata[ii] % WEAPON_TICK ? 1 : 0)));
01558                         else if(countDamagedSlotsFromCrit(mech, loop, critical[ii]))
01559                                 strcat(weapbuff, "%crDAMAGED%c|| ");
01560                         else
01561                                 strcat(weapbuff, "%cgReady%c  || ");
01562 
01563                         if((ii + running_sum) < ammoweapcount) {
01564                                 ammo_mode =
01565                                         GetWeaponAmmoModeLetter_Model_Mode(ammoweap[ii +
01566                                                                                                                                 running_sum],
01567                                                                                                            modearray[ii +
01568                                                                                                                                  running_sum]);
01569                                 sprintf(weapname, "%-16.16s %c",
01570                                                 &MechWeapons[ammoweap[ii + running_sum]].name[3],
01571                                                 ammo_mode);
01572                                 sprintf(tempbuff, "  %s%3d%s",
01573                                                 evaluate_ammo_amount(ammo[ii + running_sum],
01574                                                                                          ammomax[ii + running_sum]),
01575                                                 ammo[ii + running_sum], "%cn");
01576                                 strcat(weapname, tempbuff);
01577                                 if(doweird) {
01578                                         if(ammo_mode && ammo_mode != ' ')
01579                                                 sprintf(weirdbuf + strlen(weirdbuf), "|%s|%d|%c ",
01580                                                                 &MechWeapons[ammoweap[ii +
01581                                                                                                           running_sum]].name[3],
01582                                                                 ammo[ii + running_sum], ammo_mode);
01583                                         else
01584                                                 sprintf(weirdbuf + strlen(weirdbuf), "|%s|%d ",
01585                                                                 &MechWeapons[ammoweap[ii +
01586                                                                                                           running_sum]].name[3],
01587                                                                 ammo[ii + running_sum]);
01588                                 }
01589                         } else {
01590                                 if(doweird)
01591                                         strcat(weirdbuf, " ");
01592                                 sprintf(weapname, "   ");
01593                         }
01594                         strcat(weapbuff, weapname);
01595                         if(!doweird)
01596                                 notify(player, weapbuff);
01597                 }
01598                 running_sum += count;
01599         }
01600 
01601         if(running_sum < ammoweapcount) {
01602                 while (running_sum < ammoweapcount) {
01603                         strcpy(astrAmmoSpacer,
01604                                    "                                                 || ");
01605                         ammo_mode =
01606                                 GetWeaponAmmoModeLetter_Model_Mode(ammoweap[running_sum],
01607                                                                                                    modearray[running_sum]);
01608                         sprintf(weapname, "%-16.16s %c",
01609                                         &MechWeapons[ammoweap[running_sum]].name[3], ammo_mode);
01610                         sprintf(tempbuff, "  %s%3d%s",
01611                                         evaluate_ammo_amount(ammo[running_sum],
01612                                                                                  ammomax[running_sum]),
01613                                         ammo[running_sum], "%cn");
01614                         strcat(astrAmmoSpacer, weapname);
01615                         strcat(astrAmmoSpacer, tempbuff);
01616 
01617                         notify(player, astrAmmoSpacer);
01618 
01619                         /*
01620                            if (doweird) {
01621                            if (ammo_mode && ammo_mode != ' ')
01622                            sprintf(weirdbuf + strlen(weirdbuf), "|%s|%d|%c ",
01623                            &MechWeapons[ammoweap[running_sum]].name[3], ammo[running_sum], ammo_mode);
01624                            else
01625                            sprintf(weirdbuf + strlen(weirdbuf), "|%s|%d ",
01626                            &MechWeapons[ammoweap[running_sum]].name[3], ammo[running_sum]);
01627                            }
01628                          */
01629                         running_sum++;
01630                 }
01631         }
01632 }
01633 
01634 /*
01635  * Picks the character to show for the armor location on enemy scans.
01636  */
01637 int ArmorEvaluateSerious(MECH * mech, int loc, int flag, int *opt)
01638 {
01639         int a = -1;
01640         int b = -1;
01641         int c = -1;
01642 
01643         if(flag & 256) {
01644                 // Aero SI
01645                 a = ((1 + (b = AeroSI(mech))) * 100) / (AeroSIOrig(mech) + 1);
01646         } else if(flag & 2) {
01647                 if(SectIntsRepair(mech, loc))
01648                 c = 5;                          /* Blue */
01649                 a = (((b = GetSectInt(mech, loc)) + 1) * 100) / (GetSectOInt(mech, loc) + 1);
01650         } else if(flag & 4) {
01651                 if(SectRArmorRepair(mech, loc))
01652                 c = 5;                          /* Blue */
01653                 a = ((1 + (b = GetSectRArmor(mech, loc))) * 100) / (GetSectORArmor(mech, loc) + 1);
01654         } else {
01655                 if(SectArmorRepair(mech, loc))
01656                 c = 5;                          /* Blue */
01657                 a = ((1 + (b = GetSectArmor(mech, loc))) * 100) / (GetSectOArmor(mech, loc) + 1);
01658         }
01659         
01660         *opt = b;
01661         // Blue (Character 5 in armordamltrstr)
01662         if(c > 0)
01663                 return c;
01664         // Yarr, we're breached.
01665         if(!b)
01666                 return 4;
01667         // Armor condition level characters.
01668         if(a > 90)
01669                 return 0;
01670         if(a > 70)
01671                 return 1;
01672         if(a > 45)
01673                 return 2;
01674         return 3;
01675 }
01676 
01677 /* bright green, dark green, bright yellow, dark red, black */
01678 static char *armordamcolorstr[] = { "%ch%cg", "%cg", "%ch%cy", "%cr", "%ch%cx", "%ch%cb" };
01679 /* Armor location character (enemy scan). Last on is for armor being repaired. */
01680 static char *armordamltrstr = "OoxX*?";
01681 
01682 char *PrintArmorDamageColor(MECH * mech, int loc, int flag)
01683 {
01684         int a;
01685 
01686         return armordamcolorstr[ArmorEvaluateSerious(mech, loc, flag, &a)];
01687 }
01688 
01689 char *PrintArmorDamageString(MECH * mech, int loc, int flag)
01690 {
01691         int a;
01692         static char foo[6];
01693 
01694         // Zero out our armor string.
01695         for(a = 0; a < 4; a++)
01696                 foo[a] = 0;
01697         
01698         // Put a single character representing the section's health in front of array.
01699         foo[0] = armordamltrstr[ArmorEvaluateSerious(mech, loc, flag, &a)];
01700         
01701         if(flag & 1) {
01702                 if(flag & 8)
01703                         sprintf(foo, "%1d", (flag & 32) ? ((a + 9) / 10) : a);
01704                 else if(flag & 128)
01705                         sprintf(foo, "%3d", a);
01706                 else
01707                         sprintf(foo, "%2d", a);
01708 
01709                 if((flag & 16) && foo[0] == ' ')
01710                         foo[0] = '0';
01711         } else
01712                 foo[1] = (flag & 8 ? 0 : foo[0]);
01713         return foo;
01714 }
01715 
01716 char *ArmorKeyInfo(dbref player, int keyn, int owner)
01717 {
01718         static char str[20];
01719 
01720         if(owner) {
01721                 str[0] = 0;
01722                 return str;
01723         }
01724         if(keyn == 1) {
01725                 strcpy(str, "Key");
01726                 return str;
01727         }
01728         if(keyn > 6) {
01729                 strcpy(str, "   ");
01730                 return str;
01731         }
01732         sprintf(str, "%s%c%c%%c ", armordamcolorstr[6 - keyn],
01733                         armordamltrstr[6 - keyn], armordamltrstr[6 - keyn]);
01734         return str;
01735 }
01736 
01737 /* Params: a = location, b = flag (0/1=owner, 2 = internal, 4 = rear, 8 = minifield), 16 = zero-padding, 32 = MW, 64 = show spaces if destroyed loc */
01738 
01739 char *show_armor(MECH * mech, int loc, int flag)
01740 {
01741         static char foo[32];
01742 
01743         if(flag & 256)
01744                 sprintf(foo, "%s%s%%c", PrintArmorDamageColor(mech, 0, flag), PrintArmorDamageString(mech, loc, flag));
01745         else if(!GetSectInt(mech, loc) && !(flag & 64))
01746                 sprintf(foo, (flag & 32) ? " " : (flag & 128) ? "   " : "  ");
01747         else
01748                 sprintf(foo, "%s%s%%c", PrintArmorDamageColor(mech, loc, flag),
01749                                 PrintArmorDamageString(mech, loc, flag));
01750         return foo;
01751 }
01752 
01753 /* Don't indent the entire next section -- it contains ASCII graphics */
01754 /* *INDENT-OFF* */
01755 
01756 /* Fancy idea.. :-) */
01757 
01758 /* Just get da desc from string, strtok'ed with \ns. */
01759 
01760 /* 1-6 at beginning of line = key */
01761 
01762 /* &SI| = SI (aeros/ds) */
01763 
01764 /* &+num = armor */
01765 
01766 /* &-num = rear armor  */
01767 
01768 /* && = & */
01769 
01770 /* &:num = internal */
01771 
01772 /* &(stuff = len 1 column */
01773 
01774 /* &)stuff = len 3 column (DSs) */
01775 
01776 /* @<num><char> Shown only if loc <num> is intact */
01777 
01778 /* !<num><num2><char> Shown only if loc <num> or loc <num2> is intact */
01779 
01780 /* 0 on empty line ends the script */
01781 
01782 
01783 #ifdef WEIGHTVARIABLE_STATUS
01784 
01785 /*
01786  Light Bipedal BattleMech:
01787           __                   __                    __
01788        __( 9)__             __(**)__              __( 9)__
01789       /99|99|99\           /99|99|99\            /99|99|99\
01790      (99/-\/-\99)         (    \/    )          (99/-\/-\99)
01791        / /  \ \               /  \                / /  \ \
01792       (99|  |99)             /    \              (99|  |99)
01793 */
01794 
01795 char *lightmechdesc =
01796     "7         FRONT                REAR                INTERNAL\n"
01797     "1          @7_@7_                   @7_@7_                    @7_@7_\n"
01798     "2       @2_@2_@7(&+7@7)@3_@3_             @2_@2_@7(@7*@7*@7)@3_@3_              @2_@2_@7(&:7@7)@3_@3_\n"
01799     "3      @2/&+2!24|&+4!43|&+3@3\\           @2/&-2!24|&-4!34|&-3@3\\            @2/&:2!24|&:4!34|&:3@3\\\n"
01800     "4     @0(&+0!05/@2-@4\\@4/@3-!16\\&+1@1)         @0(    @4\\@4/    @1)          @0(&:0!05/@2-@4\\@4/@3-!16\\&:1@1)\n"
01801     "5       @5/ @5/  @6\\ @6\\               @5/  @6\\                @5/ @5/  @6\\ @6\\\n"
01802     "6      @5(&+5@5|  @6|&+6@6)             @5/    @6\\              @5(&:5@5|  @6|&:6@6)\n0";
01803 
01804 /*
01805  Heavy Bipedal Battlemech
01806           __                   __                    __
01807        __( 9)__             __(**)__              __( 9)__
01808       /99|99|99\           /99|99|99\            /99|99|99\
01809      (99/|==|\99)         (   |==|   )          (99/|==|\99)
01810        /  /\  \               /  \                /  /\  \
01811       (99/  \99)             /    \              (99/  \99)
01812 
01813 */
01814 
01815 char *heavymechdesc =
01816     "7         FRONT                REAR                INTERNAL\n"
01817     "1          @7_@7_                   @7_@7_                    @7_@7_\n"
01818     "2       @2_@2_@7(&+7@7)@3_@3_             @2_@2_@7(@7*@7*@7)@3_@3_              @2_@2_@7(&:7@7)@3_@3_\n"
01819     "3      @2/&+2!24|&+4!43|&+3@3\\           @2/&-2!24|&-4!34|&-3@3\\            @2/&:2!24|&:4!34|&:3@3\\\n"
01820     "4     @0(&+0!05/@4|@4=@4=@4|!16\\&+1@1)         @0(   !54|@4=@4=!64|   @1)          @0(&:0!05/@4|@4=@4=@4|!16\\&:1@1)\n"
01821     "5       @5/  @5/@6\\  @6\\               @5/  @6\\                @5/  @5/@6\\  @6\\\n"
01822     "6      @5(&+5@5/  @6\\&+6@6)             @5/    @6\\              @5(&:5@5/  @6\\&:6@6)\n0";
01823 
01824 /*
01825  Medium Bipedal Battlemech
01826           __                   __                    __
01827        __( 9)__               (**)                  ( 9)
01828       /99|99|99\           /99|99|99\            /99|99|99\
01829      (99/\__/\99)         (   \__/   )          (99/\__/\99)
01830        / /  \ \               /  \                / /  \ \
01831       (99|  |99)             /    \              (99|  |99)
01832 
01833 */
01834 char *mediummechdesc =
01835 
01836     "7         FRONT                REAR                INTERNAL\n"
01837     "1          @7_@7_                   @7_@7_                    @7_@7_\n"
01838     "2       @2_@2_@7(&+7@7)@3_@3_             @2_@2_@7(@7*@7*@7)@3_@3_              @2_@2_@7(&:7@7)@3_@3_\n"
01839     "3      @2/&+2!24|&+4!43|&+3@3\\           @2/&-2!24|&-4!34|&-3@3\\            @2/&:2!24|&:4!34|&:3@3\\\n"
01840     "4     @0(&+0!05/@4\\@4_@4_@4/!16\\&+1@1)         @0(   @4\\@4_@4_@4/   @1)          @0(&:0!05/@4\\@4_@4_@4/!16\\&:1@1)\n"
01841     "5       @5/ @5/  @6\\ @6\\               @5/  @6\\                @5/ @5/  @6\\ @6\\\n"
01842     "6      @5(&+5@5|  @6|&+6@6)             @5/    @6\\              @5(&:5@5|  @6|&:6@6)\n0";
01843 
01844 /*
01845  Assault Bipedal Battlemech
01846           __                   __                    __
01847        __[ 9]__             __[**]__              __[ 9]__
01848       /99|99|99\           /99|99|99\            /99|99|99\
01849      (99||==||99)         (   ||||   )          (99||==||99)
01850        / \||/ \               \||/                / \||/ \
01851       (99/  \99)             /    \              (99/  \99)
01852 
01853 */
01854 
01855 char *assaultmechdesc =
01856     "7         FRONT                REAR                INTERNAL\n"
01857     "1          @7_@7_                   @7_@7_                    @7_@7_\n"
01858     "2       @2_@2_@7[&+7@7]@3_@3_             @2_@2_@7[@7*@7*@7]@3_@3_              @2_@2_@7[&:7@7]@3_@3_\n"
01859     "3      @2/&+2!24|&+4!43|&+3@3\\           @2/&-2!24|&-4!34|&-3@3\\            @2/&:2!24|&:4!34|&:3@3\\\n"
01860     "4     @0(&+0@2|@4|@4=@4=@4|@3|&+1@1)         @0(   @4|@4|@4|@4|   @1)          @0(&:0@2|@4|@4=@4=@4|@3|&:1@1)\n"
01861     "5       @5/ @4\\@4|@4|@4/ @6\\               @4\\@4|@4|@4/                @5/ @4\\@4|@4|@4/ @6\\\n"
01862     "6      @5(&+5@5/  @6\\&+6@6)             @5/    @6\\              @5(&:5@5/  @6\\&:6@6)\n0";
01863 
01864 
01865 #else /* WEIGHTVARIABLE_STATUS */
01866 
01867 /* 
01868   Bipedal BattleMech:
01869          ( 9)                 (**)                  ( 9)
01870       /99|99|99\           /99|99|99\            /99|99|99\
01871      (99/ || \99)         (   |  |   )          (99/ || \99)
01872        /  /\  \               /  \                /  /\  \
01873       (99/  \99)             /    \              (99/  \99)
01874 */
01875 
01876 char *mechdesc =
01877     "1         FRONT                REAR                INTERNAL\n"
01878     "2         @7(&+7@7)                 @7(@7*@7*@7)                  @7(&:7@7)\n"
01879     "3      @2/&+2!24|&+4!43|&+3@3\\           @2/&-2!24|&-4!34|&-3@3\\            @2/&:2!24|&:4!34|&:3@3\\\n"
01880     "4     @0(&+0!05/ !54|!64| !16\\&+1@1)         @0(   !54|  !64|   @1)          @0(&:0!05/ !54|!64| !16\\&:1@1)\n"
01881     "5       @5/  @5/@6\\  @6\\               @5/  @6\\                @5/  @5/@6\\  @6\\\n"
01882     "6      @5(&+5@5/  @6\\&+6@6)             @5/    @6\\              @5(&:5@5/  @6\\&:6@6)\n0";
01883 
01884 #endif /* WEIGHTVARIABLE_STATUS */
01885 
01886 /*
01887   Quadruped BattleMech:
01888          FRONT                REAR                INTERNAL
01889            ___                                      ___
01890    ___  __/ 9 \_  ___                       ___  __/ 9 \_  ___
01891   ( 99\(99|99|99)/99 )     (99|99|99)      ( 99\(99|99|99)/99 )
01892    \ \(99/    \99)/ /                       \ \(99/    \99)/ /
01893     \ \||      ||/ /                         \ \||      ||/ /
01894     /_/__\    /__\_\                         /_/__\    /__\_\
01895 */
01896 
01897 char *quaddesc =
01898     "7         FRONT                REAR                INTERNAL\n"
01899     "1           @7_@7_@7_                                      @7_@7_@7_\n"
01900     "2   @5_@5_@5_  @2_@2_@7/&+7 @7\\@3_  @6_@6_@6_                       @5_@5_@5_  @2_@2_@7/&:7 @7\\@3_  @6_@6_@6_\n"
01901     "3  @5( &+5@5\\@2(&+2!24|&+4!43|&+3@3)@6/&+6 @6)     @2(&-2!24|&-4!43|&-3@3)      @5( &:5@5\\@2(&:2!24|&:4!43|&:3@3)@6/&:6 @6)\n"
01902     "4   @5\\ @5\\!05(&+0@0/    @1\\&+1!16)@6/ @6/                       @5\\ @5\\!05(&:0@0/    @1\\&:1!16)@6/ @6/\n"
01903     "5    @5\\ @5\\@0|@0|      @1|@1|@6/ @6/                         @5\\ @5\\@0|@0|      @1|@1|@6/ @6/\n"
01904     "6    @5/@5_!05/@0_@0_@0\\    @1/@1_@1_!16\\@6_@6\\                         @5/@5_!05/@0_@0_@0\\    @1/@1_@1_!16\\@6_@6\\\n0";
01905 
01906 /*
01907   MechWarrior
01908                        (9)
01909                      /9|9|9\
01910                     (9/ _ \9)
01911                      (9/ \9)
01912 */
01913 
01914 char *mwdesc =
01915     "1                       @7(&:7@7)\n"
01916     "2                     @2/&:2@4|&:4@4|&:3@3\\\n"
01917     "6                    @0(&:0@0/ @4_ @1\\&:1@1)\n"
01918     "7                     @5(&:5@5/ @6\\&:6@6)\n0";
01919 
01920 
01921 /*
01922   Naval vehicle
01923 
01924          FRONT                    INTERNAL
01925          ./99\.                    ./99\. 
01926         |'.--.`|                  |'.--.`|
01927         |`|99|'|                  |`|99|'|
01928         |\`--'/|                  |\`--'/|  
01929         |99><99|                  |99><99|  
01930         |./||\.|                  |./||\.|  
01931         || 99 ||                  || 99 ||  
01932          `~~~~'                    `~~~~' 
01933 */
01934 
01935 char *shipdesc =
01936     "7         FRONT                    INTERNAL\n"
01937     "1         @2.@2/&+2@2\\@2.                    @2.@2/&:2@2\\@2. \n"
01938     "2        @2|@2'@4.@4-@4-@4.@2`@2|                  @2|@2'@4.@4-@4-@4.@2`@2|\n"
01939     "3        @2|@2`@4|&+4@4|@2'@2|                  @2|@2`@4|&:4@4|@2'@2|\n"
01940     "4        !20|!04\\@4`@4-@4-@4'!14/!12|                  !20|!04\\@4`@4-@4-@4'!14/!12|  \n"
01941     "5        @0|&+0@0>@1<&+1@1|                  @0|&:0@0>@1<&:1@1|  \n"
01942     "7        @0|!03.!03/!03|!13|!13\\!13.@1|                  @0|!03.!03/!03|!13|!13\\!13.@1|  \n"
01943     "7        @0|@3| &+3 @3|@1|                  @0|@3| &:3 @3|@1|  \n"
01944     "7         !03`@3~@3~@3~@3~!13'                    !03`@3~@3~@3~@3~!13' \n"
01945     "0";
01946 
01947 /*
01948   Hydrofoil vehicle:
01949          FRONT                    INTERNAL
01950          ./\.                       ./\.
01951       ___|99|___                 ___|99|___
01952       ---|><|---                 ---|><|---
01953         ||99||                     ||99|| 
01954      __|99::99|__               __|99::99|__
01955      --_|'99`|_--               --_|'99`|_--
01956         `~~~~'                     `~~~~'
01957 */
01958 
01959 char *foildesc =
01960     "7         FRONT                    INTERNAL\n"
01961     "7         @2.@2/@2\\@2.                       @2.@2/@2\\@2.\n"
01962     "1      @2_@2_@2_@2|&+2@2|@2_@2_@2_                 @2_@2_@2_@2|&:2@2|@2_@2_@2_\n"
01963     "2      @2-@2-@2-@2|!24>!24<@2|@2-@2-@2-                 @2-@2-@2-@2|!24>!24<@2|@2-@2-@2-\n"
01964     "3        !04|@4|&+4@4|!14|                     !04|@4|&:4@4|!14| \n"
01965     "4     @0_@0_@0|&+0!01:!01:&+1@1|@1_@1_               @0_@0_@0|&:0!01:!01:&:1@1|@1_@1_\n"
01966     "5     @0-@0-@0_@0|!03'&+3!13`@1|@1_@1-@1-               @0-@0-@0_@0|!03'&:3!13`@1|@1_@1-@1-\n"
01967     "7        !03`@3~@3~@3~@3~!13'                     !03`@3~@3~@3~@3~!13'\n"
01968     "0";
01969 
01970 /*
01971   Submarine vehicle:
01972 
01973         FRONT                     INTERNAL
01974          --                         --      
01975        =|99|=                     =|99|=    
01976        |\__/|                     |\__/|    
01977       | |99| |                   | |99| |   
01978       |99||99|                   |99||99|   
01979        \|--|/                     \|--|/    
01980        =|99|=                     =|99|=    
01981 */
01982 
01983 char *subdesc =
01984     "7        FRONT                     INTERNAL\n"
01985     "1         @2-@2-                         @2-@2-      \n"
01986     "1       @2=@2|&+2@2|@2=                     @2=@2|&:2@2|@2=    \n"
01987     "1       !02|!24\\@4_@4_!24/!12|                     !02|!24\\@4_@4_!24/!12|    \n"
01988     "1      @0| @4|&+4@4| @1|                   @0| @4|&:4@4| @1|   \n"
01989     "1      @0|&+0@0|@1|&+1@1|                   @0|&:0@0|@1|&:1@1|   \n"
01990     "1       @0\\!03|@3-@3-!13|@1/                     @0\\!03|@3-@3-!13|@1/    \n"
01991     "1       !03=@3|&+3@3|!13=                     !03=@3|&:3@3|!13=    \n"
01992     "0";
01993 
01994 /*
01995   Aero
01996               /^^\
01997             /|`18'|\
01998      |     |_|.--.|_|     |
01999      |      /||  ||\      |
02000      |    /'.-|--|-.`\    |
02001      |---'18| |20| |20`---|
02002      `--_____\||||/_____--'
02003              '===='
02004  */
02005 
02006 char *aerodesc =
02007     "7              @0/@0^@0^@0\\\n"
02008     "1            @1/@1|@0`&+0@0'@2|@2\\\n"
02009     "2     @1|     @1|@1_@1|.--.@2|@2_@2|     @2|\n"
02010     "3     @1|      @1/@1||&SI|||@2\\      @2|\n"
02011     "4     @1|    @1/@1'@1.@1-@3|@3-@3-@3|@2-@2.@2`@2\\    @2|\n"
02012     "5     @1|@1-@1-@1-'&+1@1| @3|&+3@3| @2|&+2`---@2|\n"
02013     "6     @1`@1-@1-@1_@1_@1_@1_@1_\\||||/@2_@2_@2_@2_@2_@2-@2-'\n"
02014     "7             @1'===='\n0";
02015 
02016 /*
02017   Spheroid Dropship
02018           FRONT
02019           _______
02020          /`.999,'\
02021         |999|~|999|
02022         |  |   |  |
02023         |999|_|999|
02024          \,'999`./
02025           ~~~~~~~
02026 */
02027 
02028 char *spher_ds_desc =
02029     "7          FRONT\n"
02030     "1          @1_@1_@1_@1_@1_@1_@1_\n"
02031     "2         @1/!15`!15.&)+5!05,!05'@0\\\n"
02032     "3        @1|&)+1@1|@1~@0|&)+0@0|\n"
02033     "4        !12|  !12|   !03|  !03|\n"
02034     "5        @2|&)+2@2|@4_@3|&)+3@3|\n"
02035     "6         @2\\!24,!24'&)+4!34`!34.@3/\n"
02036     "7          @4~@4~@4~@4~@4~@4~@4~\n0";
02037 
02038 /*
02039   Aerodine Dropship
02040        .--.     
02041      ,`.99.'.   
02042      |.|__|.|   
02043     | | 99 | |  
02044     | |:  :| |  
02045    |'99|--|99`| 
02046    |  .'99`.  | 
02047    `|`_\~~/_`|' 
02048 */
02049 
02050 char *aerod_ds_desc =
02051     "7           .--.\n"
02052     "1         ,`.&+5.'.\n"
02053     "2         |.|__|.|\n"
02054     "3        | | ?? | |\n"
02055     "4        | |:  :| |\n"
02056     "5       |'&+1|--|&+0`|\n"
02057     "6       |  .'&+4`.  |\n"
02058     "7       `|`_\\~~/_`|'\n0";
02059 
02060 /*
02061   Vehicle (with turret):
02062           FRONT                                INTERNAL
02063          ,`.99,'.                              ,`.99,'.
02064         |  |__|  |                            |  |__|  |
02065         |  |99|  |                            |  |99|  |
02066         |99|~~|99|                            |99|~~|99|
02067          \,'99`./                              \,'99`./
02068           ~~~~~~                                ~~~~~~
02069 */
02070 
02071 char *vehdesc =
02072     "1          FRONT                                INTERNAL\n"
02073     "2         @0,@0`!02.&+2!12,@1'@1.                              @0,@0`!02.&:2!12,@1'@1.\n"
02074     "3        @0|  !02|@4_@4_!12|  @1|                            @0|  !02|@4_@4_!12|  @1|\n"
02075     "4        @0|  @4|&+4@4|  @1|                            @0|  @4|&:4@4|  @1|\n"
02076     "5        @0|&+0@4|@4~@4~@4|&+1@1|                            @0|&:0@4|@4~@4~@4|&:1@1|\n"
02077     "6         @0\\!03,!03'&+3!13`!13.@1/                              @0\\!03,!03'&:3!13`!13.@1/\n"
02078     "7          @3~@3~@3~@3~@3~@3~                                @3~@3~@3~@3~@3~@3~\n0";
02079 
02080 /*
02081   Vehicle (no turret, by design)
02082           FRONT                                INTERNAL
02083          ,`.99,'.                              ,`.99,'.
02084         |  |__|  |                            |  |__|  |
02085         |  |  |  |                            |  |  |  |
02086         |99|~~|99|                            |99|~~|99|
02087          \,'99`./                              \,'99`./
02088           ~~~~~~                                ~~~~~~
02089 */
02090 
02091 char *veh_not_desc =
02092     "1          FRONT                                INTERNAL\n"
02093     "2         @0,@0`!02.&+2!12,@1'@1.                              @0,@0`!02.&:2!12,@1'@1.\n"
02094     "3        @0|  !02|@2_@2_!12|  @1|                            @0|  !02|@2_@2_!12|  @1|\n"
02095     "4        @0|  @0|  @1|  @1|                            @0|  @0|  @1|  @1|\n"
02096     "5        @0|&+0@0|!01~!01~@1|&+1@1|                            @0|&:0@0|!01~!01~@1|&:1@1|\n"
02097     "6         @0\\!03,!03'&+3!13`!13.@1/                              @0\\!03,!03'&:3!13`!13.@1/\n"
02098     "7          @3~@3~@3~@3~@3~@3~                                @3~@3~@3~@3~@3~@3~\n0";
02099 
02100 /*
02101   VTOL
02102         FRONT                               INTERNAL
02103      .   ..   .                            .   ..   .   
02104      \\ `__` //                            \\ `__` //   
02105       \\.99.//                              \\.99.//    
02106      __\\  //__                            __\\  //__   
02107     (99|(99)|99)                          (99|(99)|99)  
02108     *--|// \\--*                          *--|// \\--*  
02109        //99 \\                               //99 \\    
02110       //\__/ \\                             //\__/ \\   
02111       ~       ~                             ~       ~   
02112 */
02113 
02114 
02115 char *vtoldesc =
02116     "7        FRONT                               INTERNAL\n"
02117     "7     @5.   @2.@2.   @5.                            @5.   @2.@2.   @5.   \n"
02118     "1     @5\\@5\\ @2`@2_@2_@2` @5/@5/                            @5\\@5\\ @2`@2_@2_@2` @5/@5/   \n"
02119     "2      @5\\@5\\@2.&+2@2.@5/@5/                              @5\\@5\\@2.&:2@2.@5/@5/    \n"
02120     "3     @0_@0_@5\\@5\\  @5/@5/@1_@1_                            @0_@0_@5\\@5\\  @5/@5/@1_@1_   \n"
02121     "4    @0(&+0!05|@5(&+5@5)!15|&+1@1)                          @0(&:0!05|@5(&:5@5)!15|&:1@1)  \n"
02122     "5    @0*@0-@0-@0|@5/@5/ @5\\@5\\@1-@1-@1*                          @0*@0-@0-@0|@5/@5/ @5\\@5\\@1-@1-@1*  \n"
02123     "6       @5/@5/&+3 @5\\@5\\                               @5/@5/&:3 @5\\@5\\    \n"
02124     "7      @5/@5/@3\\@3_@3_@3/ @5\\@5\\                             @5/@5/@3\\@3_@3_@3/ @5\\@5\\   \n"
02125     "7      @5~       @5~                             @5~       @5~   \n0";
02126 
02127 /* 
02128  Battlesuit
02129 
02130  SQUAD STATUS
02131   Member#      1  2  3  4  5
02132    Health      99 99 99 99 99
02133    Armor       99 99 99 99 99
02134 
02135 */
02136 
02137 
02138 char *bsuitdesc =
02139     "7 SQUAD STATUS\n"
02140     "7   Member#      @01  @12  @23  @34  @45  @56  @67  @78\n"
02141     "7   Health      &:0 &:1 &:2 &:3 &:4 &:5 &:6 &:7\n"
02142     "7   Armor       &+0 &+1 &+2 &+3 &+4 &+5 &+6 &+7\n"
02143     "7\n0";
02144 
02145 /* *INDENT-ON* */
02146 
02147 /* See if the 'mech has a 'custom' template (@mechstatus attr)
02148  * if so, exec() it to evaluate color/newlines.
02149  */
02150 static int get_statustemplate_attr(dbref player, MECH * mech, char *result)
02151 {
02152         char *buf, *bufc, *statattr = silly_atr_get(mech->mynum, A_MECHSTATUS);
02153 
02154         if(!statattr || !*statattr)
02155                 return 0;
02156         buf = bufc = alloc_lbuf("mech status");
02157         exec(buf, &bufc, 0, player, mech->mynum,
02158                  EV_STRIP_AROUND | EV_NO_COMPRESS | EV_NO_LOCATION | EV_NOFCHECK |
02159                  EV_NOTRACE | EV_FIGNORE, &statattr, NULL, 0);
02160         /* this is safe because tmpbuf is larger than LBUF_SIZE */
02161         strcpy(result, buf);
02162         strcat(result, "\n0");
02163         free_lbuf(buf);
02164         return 1;
02165 }
02166 
02167 void PrintArmorStatus(dbref player, MECH * mech, int owner)
02168 {
02169         char tmpbuf[8192];
02170         char *p, *q, *r;
02171         char destbuf[8192];
02172         int flag;
02173         int gflag = 0;
02174         int odd = 0;
02175 
02176         /* All we need is proper source for stuff */
02177         if(!get_statustemplate_attr(player, mech, tmpbuf)) {
02178                 switch (MechType(mech)) {
02179                 case CLASS_MW:
02180                         strcpy(tmpbuf, mwdesc);
02181                         gflag |= 8 | 32;
02182                         break;
02183                 case CLASS_MECH:
02184                         if(MechIsQuad(mech))
02185                                 strcpy(tmpbuf, quaddesc);
02186 #ifdef WEIGHTVARIABLE_STATUS
02187                         else {
02188                                 if(MechTons(mech) <= 35)
02189                                         strcpy(tmpbuf, lightmechdesc);
02190                                 else if(MechTons(mech) > 35 && MechTons(mech) <= 55)
02191                                         strcpy(tmpbuf, mediummechdesc);
02192                                 else if(MechTons(mech) > 55 && MechTons(mech) <= 75)
02193                                         strcpy(tmpbuf, heavymechdesc);
02194                                 else if(MechTons(mech) > 75)
02195                                         strcpy(tmpbuf, assaultmechdesc);
02196                                 else
02197                                         strcpy(tmpbuf, heavymechdesc);
02198                         }
02199 #else /* WEIGHTVARIABLE_STATUS */
02200                         else
02201                                 strcpy(tmpbuf, mechdesc);
02202 #endif /* WEIGHTVARIABLE_STATUS */
02203                         break;
02204                 case CLASS_BSUIT:
02205                         strcpy(tmpbuf, bsuitdesc);
02206                         break;
02207                 case CLASS_VTOL:
02208                         strcpy(tmpbuf, vtoldesc);
02209                         break;
02210                 case CLASS_AERO:
02211                         gflag |= 16;
02212                         strcpy(tmpbuf, aerodesc);
02213                         break;
02214                 case CLASS_DS:
02215                         strcpy(tmpbuf, aerod_ds_desc);
02216                         gflag |= 64;
02217                         break;
02218                 case CLASS_SPHEROID_DS:
02219                         strcpy(tmpbuf, spher_ds_desc);
02220                         break;
02221                 case CLASS_VEH_GROUND:
02222                         if(GetSectOInt(mech, TURRET))
02223                                 strcpy(tmpbuf, vehdesc);
02224                         else
02225                                 strcpy(tmpbuf, veh_not_desc);
02226                         break;
02227                 case CLASS_VEH_NAVAL:
02228                         if(MechMove(mech) == MOVE_FOIL)
02229                                 strcpy(tmpbuf, foildesc);
02230                         else if(MechMove(mech) == MOVE_HULL)
02231                                 strcpy(tmpbuf, shipdesc);
02232                         else
02233                                 strcpy(tmpbuf, subdesc);
02234                         break;
02235                 default:
02236                         strcpy(tmpbuf,
02237                                    " This 'toy' is of unknown type. It has yet to be templated\n for status.\n0");
02238                         break;
02239                 }
02240         }
02241         p = strtok(tmpbuf, "\n");
02242         while (p && *p != '0') {
02243                 if(*p >= '1' && *p <= '7')
02244                         strcpy(destbuf, ArmorKeyInfo(player, (int) *p - '0', owner));
02245                 else
02246                         destbuf[0] = 0;
02247                 r = &destbuf[strlen(destbuf)];
02248                 for(q = p + 1; *q; q++)
02249                         if(*q == '@' && isdigit(*(q + 1))) {
02250                                 q++;
02251                                 if(GetSectInt(mech, (int) (*q - '0')))
02252                                         *r++ = *(q + 1);
02253                                 else
02254                                         *r++ = ' ';
02255                                 q++;
02256                         } else if(*q == '!' && isdigit(*(q + 1)) && isdigit(*(q + 2))) {
02257                                 q++;
02258                                 if(GetSectInt(mech, (int) (*q - '0')) ||
02259                                    GetSectInt(mech, (int) (*(q + 1) - '0')))
02260                                         *r++ = *(q + 2);
02261                                 else
02262                                         *r++ = ' ';
02263                                 q++;
02264                                 q++;
02265                         } else if(*q == '&' && (*(q + 1) == '+' || *(q + 1) == '-' ||
02266                                                                         *(q + 1) == ':' || *(q + 1) == '(' ||
02267                                                                         *(q + 1) == ')' || *(q + 1) == 'S')) {
02268                                 if(*(q + 1) == '(') {
02269                                         gflag |= 8;
02270                                         q++;
02271                                         odd = 1;
02272                                 }
02273                                 if(*(q + 1) == ')') {
02274                                         gflag |= 128;
02275                                         q++;
02276                                         odd = 1;
02277                                 }
02278                                 if(*(q + 1) == 'S') {
02279                                         gflag |= 256;
02280                                         q++;
02281                                         odd = 1;
02282                                 }
02283                                 /* Geez, we got armor token to distribute here. */
02284                                 flag = owner;
02285                                 q++;
02286                                 switch (*q) {
02287                                 case '-':
02288                                         flag += 2;
02289                                 case ':':
02290                                         flag += 2;
02291                                         break;
02292                                 }
02293                                 strcpy(r, show_armor(mech, (int) (*(q + 1) - '0'),
02294                                                                          flag | gflag));
02295                                 r += strlen(r);
02296                                 if(odd) {
02297                                         gflag = 0;
02298                                         odd = 0;
02299                                 }
02300                                 q++;
02301                         } else
02302                                 *r++ = *q;
02303                 *r = 0;
02304                 notify(player, destbuf);
02305                 p = strtok(NULL, "\n");
02306         }
02307 }
02308 
02309 /*
02310  * Figure out if we have a certain kind of physical weapon.
02311  */
02312 int hasPhysical(MECH * objMech, int wLoc, int wPhysType)
02313 {
02314         int wType;
02315         int wSize;
02316 
02317         switch (wPhysType) {
02318         case PHY_AXE:
02319                 wType = AXE;
02320                 wSize = MechTons(objMech) / 15;
02321                 break;
02322 
02323         case PHY_SWORD:
02324                 wType = SWORD;
02325                 wSize = MechTons(objMech) / 15;
02326                 break;
02327 
02328         case PHY_MACE:
02329                 wType = MACE;
02330                 wSize = MechTons(objMech) / 15;
02331                 break;
02332 
02333         case PHY_SAW:
02334                 wType = DUAL_SAW;
02335                 wSize = 7;
02336                 break;
02337 
02338         default:
02339                 return 0;
02340         }                                                       // end switch()
02341 
02342         return FindObjWithDest(objMech, wLoc, I2Special(wType)) >= wSize;
02343 }                                                               // end hasPhysical()
02344 
02345 int canUsePhysical(MECH * objMech, int wLoc, int wPhysType)
02346 {
02347         int tRet = 1;
02348 
02349         switch (wPhysType) {
02350         case PHY_AXE:
02351         case PHY_SWORD:
02352                 if(SectIsDestroyed(objMech, wLoc))
02353                         tRet = 0;
02354                 else if(!OkayCritSectS2(objMech, wLoc, 0, SHOULDER_OR_HIP))
02355                         tRet = 0;
02356                 else if(!OkayCritSectS2(objMech, wLoc, 3, HAND_OR_FOOT_ACTUATOR))
02357                         tRet = 0;
02358                 break;
02359 
02360         case PHY_MACE:
02361                 if(SectIsDestroyed(objMech, LARM) || SectIsDestroyed(objMech, RARM))
02362                         tRet = 0;
02363                 else if((!OkayCritSectS2(objMech, LARM, 0, SHOULDER_OR_HIP)) ||
02364                                 (!OkayCritSectS2(objMech, RARM, 0, SHOULDER_OR_HIP)))
02365                         tRet = 0;
02366                 else if((!OkayCritSectS2(objMech, LARM, 3, HAND_OR_FOOT_ACTUATOR))
02367                                 || (!OkayCritSectS2(objMech, RARM, 3, HAND_OR_FOOT_ACTUATOR)))
02368                         tRet = 0;
02369                 break;
02370 
02371         case PHY_SAW:
02372                 if(SectIsDestroyed(objMech, wLoc))
02373                         tRet = 0;
02374                 else if(!OkayCritSectS2(objMech, wLoc, 0, SHOULDER_OR_HIP))
02375                         tRet = 0;
02376                 break;
02377 
02378         default:
02379                 tRet = 0;
02380         }                                                       // end switch()
02381 
02382         return tRet;
02383 }                                                               // end canUsePhysical()

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