mis_m.c

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005 Michael K. McCarty & Fritz Bronner
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 // Interplay's BUZZ ALDRIN's RACE into SPACE
00019 //
00020 // Formerly -=> LiftOff : Race to the Moon :: IBM version MCGA
00021 // Copyright 1991 by Strategic Visions, Inc.
00022 // Designed by Fritz Bronner
00023 // Programmed by Michael K McCarty
00024 //
00025 
00026 #include "Buzz_inc.h"
00027 #include "externs.h"
00028 #include "mis.h"
00029 #include "utils.h"
00030 #include "options.h"
00031 #include "logging.h"
00032 
00033 #define MIS_SET 0             // FAILURES ON
00034 
00035 LOG_DEFAULT_CATEGORY(mission);
00036 
00037 extern struct MisAst MA[2][4];
00038 extern Equipment *MH[2][8];
00039 extern struct MisEval Mev[60]; 
00040 extern char MANNED[2],STEP,pal2[768],STEPnum,FINAL,AI[2],CAP[2],LM[2],DOC[2],EVA[2],fEarly,mcc,JOINT;
00041 extern char DMFake;
00042 extern int AUDIO;
00043 char MFlag,death,durx,MPad,Unm,SCRUBS,noDock,InSpace;
00044 char Dock_Skip; /**< used for mission branching */
00045 extern struct mStr Mis;
00046 
00047 extern ui16 MisStat;
00048 extern char pCnt,tMen,BIG;            // Counter for pAry
00049 extern i16 pAry[15];         /**< Array for Presige Firsts compelted */
00050 extern REPLAY Rep;
00051 
00052 void Tick(char);
00053 
00054 #define NowSaf MH[Mev[STEP].pad][Mev[STEP].Class]->MisSaf
00055 
00056 void GetFailStat(struct XFails *Now,char *FName,int rnum)
00057 {
00058   DEBUG2("->GetFailStat(struct XFails *Now,char *FName,int rnum %d)", rnum);
00059   int i;
00060   FILE *fin;
00061   long count;
00062   struct Fdt {
00063     char Code[6];
00064     long offset;
00065     i16 size;
00066   } Pul;
00067 
00068   fin=sOpen("FAILS.CDR","rb",0);
00069   count=44;
00070   fread(&count,sizeof count,1,fin);  // never written to file
00071     Swap32bit(count);
00072   fread(&Pul,sizeof Pul,1,fin);
00073     Swap32bit(Pul.offset);
00074     Swap16bit(Pul.size);
00075   i=0;
00076   while (xstrncasecmp(Pul.Code,FName,4)!=0 && i<count) {
00077      fread(&Pul,sizeof Pul,1,fin);
00078          Swap32bit(Pul.offset);
00079          Swap16bit(Pul.size);
00080      i++;
00081   }
00082   if (i==count) {fclose(fin);return;}
00083 
00084   fseek(fin,Pul.offset,SEEK_SET);
00085 
00086     if (rnum<0) { // Unmanned portion
00087       do {
00088          fread(Now,sizeof (struct XFails),1,fin);
00089                 Swap32bit(Now->per);    // Only need to swap this one since we're checking only that
00090                 
00091       } while (Now->per!=rnum);
00092     }
00093   else {
00094       do {
00095          fread(Now,sizeof (struct XFails),1,fin);
00096                 Swap32bit(Now->per);
00097                 Swap16bit(Now->code);
00098                 Swap16bit(Now->val);
00099                 Swap16bit(Now->xtra);
00100                 Swap16bit(Now->fail);
00101       } while (Now->per<=rnum);
00102     };
00103 
00104   fclose(fin);
00105   DEBUG1("<-GetFailStat()");
00106 }
00107 
00108 void MisCheck(char plr,char mpad)
00109 {
00110    int tomflag=0; // toms checking flag
00111    int val,safety,save,PROBLEM,i,lc,durxx;
00112    struct XFails Now;
00113    unsigned char gork=0;
00114 
00115    lc = 0; /* XXX check uninitialized */
00116 
00117    STEPnum=STEP;
00118    FINAL=STEP=MFlag=0; // Clear Everything
00119    Unm=MANNED[0]+MANNED[1];
00120    Dock_Skip=0;  // used for mission branching
00121    MPad=mpad;
00122    SCRUBS=noDock=InSpace=0;
00123 
00124    
00125 
00126    if (!AI[plr] && BIG==0) {
00127       //FadeOut(1,pal,100,128,1);
00128       if (plr==1) {
00129          RectFill(189,173,249,196,55);
00130          for (i=190;i<250;i+=2) {
00131             grPutPixel(i,178,61);
00132             grPutPixel(i,184,61);
00133             grPutPixel(i,190,61);
00134             }
00135          lc=191;
00136          }
00137       else if (plr==0) {
00138          RectFill(73,173,133,196,55);
00139          for (i=73;i<133;i+=2) {
00140             grPutPixel(i,178,61);
00141             grPutPixel(i,184,61);
00142             grPutPixel(i,190,61);
00143             }
00144          lc=76;
00145          }
00146       } // END if (!AI[plr])
00147 
00148   if (!AI[plr] && BIG==0) Tick(2);
00149   Mev[0].trace=0;
00150   death=0;
00151 
00152   durxx=durx=-1;
00153   if (Data->P[plr].Mission[mpad].Duration>0) {
00154     durxx=Data->P[plr].Mission[mpad].Duration-1;
00155     Data->P[plr].Mission[mpad].Duration=0;
00156   }
00157   if (JOINT==1) {
00158       durxx=maxx(durxx,Data->P[plr].Mission[mpad+1].Duration-1);
00159       Data->P[plr].Mission[mpad+1].Duration=0;
00160   }
00161 
00162   do {
00163      if (STEP>30 || STEP<0) delay(20);
00164 
00165      if (Dock_Skip==1) {
00166         if (Mev[Mev[STEP].trace].loc==8)
00167            Mev[STEP].trace++;  // skip over docking.
00168      }
00169 
00170      // Duration Hack Part 1 of 3   (during the Duration stuff)
00171      if ((Mev[STEP].loc==27 || Mev[STEP].loc==28) && durx>0) {
00172         
00173         if (Mev[STEP].StepInfo!=1) {
00174            durx=-1;  // end durations
00175            Data->P[plr].Mission[MPad+Mev[STEP].pad].Duration=
00176               minn(1,maxx(1,Data->P[plr].Mission[MPad+Mev[STEP].pad].Duration));
00177         }
00178         else {
00179            Data->P[plr].Mission[MPad+Mev[STEP].pad].Duration++;
00180            durx--;
00181            if ((Data->Def.Lev1==0 && plr==0) || (Data->Def.Lev2==0 && plr==1))
00182               Mev[STEP].dice=MisRandom();
00183            else Mev[STEP].dice=random(100)+1;
00184            Mev[STEP].rnum=random(10000);  // reroll failure type
00185            Mev[STEP].trace=STEP;
00186         }
00187      }
00188 
00189     if (Mev[STEP].Name[0]=='A' || Mev[STEP].StepInfo==9 || Mev[STEP].StepInfo==19)
00190       STEP=Mev[STEP].trace;
00191     else {
00192      if (Mev[STEP].trace!=0) STEP=Mev[STEP].trace;
00193      else {
00194         Mev[STEP].trace=STEP+1;
00195         STEP++;
00196      }
00197     }
00198 
00199     // Duration Hack Part 2 of 3    (set up durx for duration use)
00200     if ((Mev[STEP].loc==27 || Mev[STEP].loc==28) && durx==-1) {
00201         durx=durxx;
00202         Data->P[plr].Mission[MPad+Mev[STEP].pad].Duration=1;
00203     }
00204 
00205     if (Mev[STEP].Name[0]=='A') {
00206         grSetColor(11);
00207         if (!AI[plr] && BIG==0) {
00208            if (plr==0) {x=5;y=112;RectFill(2,107,140,115,3);}
00209            else {x=82,y=8;RectFill(78,2,241,10,3);}
00210            PrintAt(x,y,"COUNTDOWN");
00211            if (plr==0) {
00212             RectFill(188,107,294,113,3);
00213             grSetColor(1);
00214             PrintAt(190,112,(Mev[STEP].pad==0) ? "PRIMARY LAUNCH":"SECOND LAUNCH");
00215            }
00216            else {
00217             RectFill(244,56,314,62,3);
00218             grSetColor(1);
00219             PrintAt(246,61,(Mev[STEP].pad==0) ? "PRIMARY PAD":"SECOND PAD");
00220            }
00221 
00222         }
00223         memset(Name,0x00,sizeof Name);
00224         strcpy(Name,Mev[STEP].Name);
00225         Name[0]='#';  // Launch Code
00226         PlaySequence(plr,STEP,Name,0); // Special Case #47236
00227     };
00228 
00229     // Necessary to keep code from crashing on bogus mission step
00230     while (Mev[STEP].E==NULL) {
00231       STEP++;
00232     }
00233 
00234     // Draw Mission Step Name
00235     if (!AI[plr] && BIG==0) {
00236       if (!(fEarly && STEP!=0)) {
00237         if (plr==0) {x=5;y=112;RectFill(2,107,140,115,3);}
00238         else {x=82,y=8;RectFill(78,2,241,10,3);}
00239         grSetColor(11); MisStep(x,y,Mev[STEP].loc);
00240         if (plr==0) {
00241           RectFill(188,107,294,113,3);
00242           grSetColor(1);
00243           PrintAt(190,112,(Mev[STEP].pad==0) ? "PRIMARY LAUNCH":"SECOND LAUNCH");
00244         }
00245         else {
00246           RectFill(244,56,314,62,3);
00247           grSetColor(1);
00248           PrintAt(246,61,(Mev[STEP].pad==0) ? "PRIMARY PAD":"SECOND PAD");
00249         }
00250       }
00251     }
00252 
00253 
00254     // SAFETY FACTOR STUFF
00255 
00256     safety=Mev[STEP].E->MisSaf;
00257 
00258     if ((Mev[STEP].Name[0]=='A') && MH[Mev[STEP].pad][7]!=NULL)
00259     {  // boosters involved
00260       safety+=MH[Mev[STEP].pad][7]->Safety;
00261       safety=safety/2;
00262     }
00263    
00264     // Duration Hack Part 3 of 3
00265     if (Mev[STEP].loc==28 || Mev[STEP].loc==27) {
00266       safety=Mev[STEP].E->MisSaf;  // needs to be for both
00267       if (InSpace==2) safety=(MH[0][0]->MisSaf+MH[1][0]->MisSaf)/2;   //joints
00268     }
00269 
00270     if (strncmp(Mev[STEP].E->Name,"DO",2)==0) {
00271       if (Mev[STEP].loc==1 || Mev[STEP].loc==2)
00272          safety=Mev[STEP].E->MSF;
00273       }
00274 
00275     val=Mev[STEP].dice;
00276     safety+=Mev[STEP].asf;
00277 
00278     if (safety>=100) safety=99;
00279     save=(Mev[STEP].E->SaveCard==1)? 1 : 0;
00280 
00281     PROBLEM = val > safety;
00282 
00283     if (!AI[plr] && options.want_cheats)
00284         PROBLEM = 0;
00285 
00286     DEBUG6("step %c:%s safety %d rolled %d%s", Mev[STEP].Name[0], S_Name[Mev[STEP].loc],
00287             safety, val,
00288             PROBLEM ? " problem" : (options.want_cheats ? " cheating" : ""));
00289 
00290     if (!AI[plr] && BIG==0) 
00291       if (!(fEarly && STEP!=0))
00292         lc=MCGraph(plr,lc,maxx(0,safety),maxx(0,val),PROBLEM);  // Graph Chart
00293 
00294     if (PROBLEM && save==1) {    // Failure Saved
00295       Mev[STEP].E->SaveCard--;    // Deduct SCard
00296       PROBLEM=0;   // Fix problem
00297       }
00298 
00299 
00300    // Debug Code Only
00301 #if MIS_SET
00302    if (!AI[plr]) {               //&& TOM && NOFAIL 
00303      memset(Text,0x00,sizeof Text);
00304      strcpy(Text,"FAIL:\0");
00305      strcpy(&Text[5],S_Name[Mev[STEP].loc]);
00306      
00307      PROBLEM=Request(0,Text,6);
00308      
00309    }
00310 #endif
00311     
00312    // Fix wrong anim thing for the Jt Durations
00313       if (Mev[STEP].loc==28 || Mev[STEP].loc==27) {
00314          strcpy(Mev[STEP].Name,(plr==0)?"_BUSC0\0":"_BSVC0");
00315          Mev[STEP].Name[5]=Mev[STEP].E->ID[1];
00316       }
00317 
00318    if (PROBLEM==1) {    //Step Problem
00319 
00320 #if MIS_SET
00321      if (!AI[plr] ) DebugSetFailure(Text);  // && TOM && NOFAIL
00322 #endif
00323 
00324      // for the unmanned mission
00325        if (MANNED[Mev[STEP].pad]==0 && MANNED[other(Mev[STEP].pad)]==0)
00326        Mev[STEP].rnum=(-1)*(random(5)+1);
00327 
00328      // Unmanned also
00329      if (MANNED[Mev[STEP].pad]==0 && noDock==0)
00330        Mev[STEP].rnum=(-1)*(random(5)+1);
00331 
00332       memset(&Now,0x00,sizeof Now);
00333 
00334 
00335      //***************TC Special little HMOON EVA FAILURE FIX
00336 
00337          tomflag = 0;
00338          if (Mev[STEP].Name[0]=='H' && Mev[STEP].Name[1]=='M')
00339       {
00340    
00341          gork=Data->P[plr].Mission[mpad].Prog;
00342          if (gork==2) strcpy(Mev[STEP].Name,(plr==0)?"HUM3C1":"HSM3C1");
00343          else if (gork==3) strcpy(Mev[STEP].Name,(plr==0)?"HUM3C2":"HSM3C2");
00344          else strcpy(Mev[STEP].Name,(plr==0)?"HUM3C3":"HSM3C3");
00345          tomflag = 1;
00346       };
00347 
00348 
00349 
00350      //:::::: Failure docking klugge
00351 
00352       if (Mev[STEP].Name[0]=='I')
00353       {
00354        gork=Data->P[plr].Mission[mpad].Prog;
00355        if (gork==2) strcpy(Mev[STEP].Name,(plr==0)?"IUM4C1":"ISM4C1");
00356         else if (gork==3) strcpy(Mev[STEP].Name,(plr==0)?"IUM4C2":"ISM4C2");
00357          else strcpy(Mev[STEP].Name,(plr==0)?"IUM4C3":"ISM4C3");
00358       };
00359 
00360 // *********** TOM's FAIL HMOON KLUDGE
00361 
00362       if (tomflag) GetFailStat(&Now,Mev[STEP].FName,7595); // if HMOON FAILURE
00363         else GetFailStat(&Now,Mev[STEP].FName,Mev[STEP].rnum);       // all others
00364 
00365 
00366       VerifyData();
00367       memset(Name,0x00,sizeof Name);
00368       memcpy(Name,Mev[STEP].Name,strlen(Mev[STEP].Name)); // copy orig failure
00369       Name[strlen(Name)]=0x30+(Now.fail/10);
00370       Name[strlen(Name)]=0x30+Now.fail%10;
00371       Name[strlen(Name)]=0x00;
00372 
00373       
00374    
00375 
00376       //:::::: STEP FAILURE :::::::::
00377       //:::::::::::::::::::::::::::::
00378 
00379       PlaySequence(plr,STEP,Name,1);
00380       if (!AI[plr]) Tick(2);  //reset dials
00381 
00382       FailEval(plr,Now.code,Now.text,Now.val,Now.xtra);
00383     } else {   // Step Success
00384 
00385       if (Mev[STEP].loc==28 || Mev[STEP].loc==27) {
00386          strcpy(Mev[STEP].Name,(plr==0)?"bUC0":"bSC0");
00387          Mev[STEP].Name[5]=Mev[STEP].E->ID[1];
00388       }
00389 
00390       if (strncmp(Mev[STEP].E->Name,"DO",2)==0) {
00391         if (Mev[STEP].loc==2) Data->P[plr].DMod=2;
00392       }
00393 
00394      //::::::::::::::::::::::::::::::::::
00395      //::: SUCCESS: Docking klugge ::::::
00396      //::::::::::::::::::::::::::::::::::
00397      if (Mev[STEP].Name[0]=='I')
00398       {
00399        gork=Data->P[plr].Mission[mpad].Prog;
00400        if (gork==2) strcpy(Mev[STEP].Name,(plr==0)?"IUM4C1":"ISM4C1");
00401         else if (gork==3) strcpy(Mev[STEP].Name,(plr==0)?"IUM4C2":"ISM4C2");
00402          else strcpy(Mev[STEP].Name,(plr==0)?"IUM4C3":"ISM4C3");
00403       };
00404 
00405      if (Mev[STEP].Name[0]=='e' && Data->P[plr].Mission[mpad].MissionCode==7)
00406        strcpy(Mev[STEP].Name,(plr==0)?"VUP1":"VSP1");
00407 
00408       //:::::: STEP SUCCESS :::::::::
00409       //:::::::::::::::::::::::::::::
00410       // Female step klugge
00411       // third parameter (0 -> MALE) (2 -> FEMALE)
00412       //:::::::::::::::::::::::::::::
00413 
00414       gork=0;
00415 
00416       gork = ((MA[0][0].A!=NULL && MA[0][0].A->Sex && EVA[0]==0)
00417            || (MA[0][1].A!=NULL && MA[0][1].A->Sex && EVA[0]==1) 
00418            || (MA[0][2].A!=NULL && MA[0][2].A->Sex && EVA[0]==2) 
00419            || (MA[0][3].A!=NULL && MA[0][3].A->Sex && EVA[0]==3)
00420            || (MA[1][0].A!=NULL && MA[1][0].A->Sex && EVA[1]==0)
00421            || (MA[1][1].A!=NULL && MA[1][1].A->Sex && EVA[1]==1) 
00422            || (MA[1][2].A!=NULL && MA[1][2].A->Sex && EVA[1]==2) 
00423            || (MA[1][3].A!=NULL && MA[1][3].A->Sex && EVA[1]==3));
00424 
00425      //if (!((mcc==9 || mcc==11) && (Mev[STEP].Name[0]=='W')))
00426        PlaySequence(plr,STEP,Mev[STEP].Name,(gork==1) ? 2 : 0 );  // Play Animations
00427 
00428       VerifyData();
00429       if (Mev[STEP].sgoto==100) Mev[STEP].trace=0x7F;
00430       else if (Mev[STEP].sgoto!=0) Mev[STEP].trace=Mev[STEP].sgoto;
00431       else Mev[STEP].trace=STEP+1;
00432 
00433       if (!(strncmp(Mev[STEP].E->Name,"DO",2)==0 && Mev[STEP].loc==0x02)) {
00434          Mev[STEP].E->MisSucc++; // set for all but docking power on
00435       }
00436 
00437         Mev[STEP].StepInfo=1;
00438 
00439        // Bottom of success statement
00440     }
00441 
00442    if (Mev[STEP].loc==0x7f || Mev[STEP].sgoto==100) // force mission end
00443       Mev[STEP].trace=0x7f;
00444 
00445    if ((mcc==10 || mcc==12 || mcc==13) && STEP==2) Mev[STEP].trace=0x7f;
00446      if (STEP>30 || STEP<0) {
00447         delay(20);
00448      }
00449 
00450    if (Mev[STEP].Prest!=0) {
00451      pAry[pCnt++]=STEP;
00452    }
00453 
00454   if (Mev[STEP].sgoto==Mev[STEP].fgoto && Mev[STEP].trace!=0x7f)
00455      Mev[STEP].trace=Mev[STEP].sgoto;
00456 
00457   if (Mev[STEP].loc==8 && Mev[STEP].StepInfo==1) noDock=1;
00458 
00459   if (Mev[STEP].loc==0 && MANNED[Mev[STEP].pad]>0) InSpace++;
00460   if (Mev[STEP].loc==4 && MANNED[Mev[STEP].pad]>0) InSpace--;
00461 
00462   // these two lines fix a problem with Lab Missions failing on launch and
00463   // ending the mission.
00464   // Yet another in the ongoing series of special cases.
00465   //
00466 
00467   if (Mev[STEP].trace==0x7f && STEP==3) {
00468      switch(Mis.Index) {
00469       case 19: case 22: case 23: case 30:
00470       case 32: case 35: case 36: case 37:
00471          InSpace=1;
00472          Mev[STEP].trace=Mev[STEP].dgoto;
00473       default: break;
00474      }
00475   }
00476 //  if (Mev[STEP].trace==0x7f && InSpace>0) Mev[STEP].trace=STEP+1;
00477 
00478  } while(Mev[STEP].trace!=0x7f);            // End mission
00479   
00480   if (!AI[plr] && death==0) delay(1000);
00481 
00482   if ((MA[0][0].A!=NULL && MA[0][0].A->Status==1)
00483         || (MA[0][1].A!=NULL && MA[0][1].A->Status==1) 
00484         || (MA[0][2].A!=NULL && MA[0][2].A->Status==1) 
00485         || (MA[0][3].A!=NULL && MA[0][3].A->Status==1)
00486         || (MA[1][0].A!=NULL && MA[1][0].A->Status==1)
00487         || (MA[1][1].A!=NULL && MA[1][1].A->Status==1) 
00488         || (MA[1][2].A!=NULL && MA[1][2].A->Status==1) 
00489         || (MA[1][3].A!=NULL && MA[1][3].A->Status==1))
00490   {  // Mission Death
00491     if (!AI[plr]) {
00492      if (BIG==0) {
00493        memset(&pal[64*3],0x00,64*3);  //Specs: 0x08
00494        gxSetDisplayPalette(pal);
00495        if (plr==0) RectFill(2,107,140,115,3);
00496         else RectFill(78,2,241,10,3);
00497        if (plr==0) RectFill(188,107,294,113,3);
00498        else RectFill(244,56,314,62,3);
00499      }
00500      PlaySequence(plr,STEP,(plr==0)?"UFUN":"SFUN",0);
00501     }
00502     if (!AI[plr]) delay(1000);
00503     death=1;
00504   }
00505   else {
00506    death=0;
00507   };
00508   
00509   return;
00510 }
00511 
00512 int MCGraph(char plr,int lc,int safety,int val,char prob)
00513 {
00514    int i;
00515    if (plr==1 && !AI[plr]) {
00516       RectFill(lc-2,195,lc,195-safety*22/100,11);
00517       RectFill(lc-2,195,lc,195-(safety-Mev[STEP].asf)*22/100,6);
00518       for (i=195;i>195-val*22/100;i--) {
00519          RectFill(lc-2,195,lc,i,21);
00520          delay(15);
00521          }
00522       if (val>safety && prob==0) {RectFill(lc-2,195,lc,195-val*22/100,9);lc=191;}
00523       else if (val>safety) {RectFill(lc-2,195,lc,195-val*22/100,9);lc+=5;}
00524        else
00525        {  
00526         if (lc>=241) {
00527           grSetColor(55);RectFill(189,173,249,196,55);
00528           for (i=190;i<250;i+=2) {
00529              grPutPixel(i,178,61);
00530              grPutPixel(i,184,61);
00531              grPutPixel(i,190,61);
00532             }
00533           RectFill(189,195,191,195-safety*22/100,11);
00534           RectFill(189,195,191,195-(safety-Mev[STEP].asf)*22/100,6);
00535           RectFill(189,195,191,195-val*22/100,21);
00536           if (Mev[STEP].asf>0) RectFill(189,195-safety*22/100,191,195-safety*22/100,11);
00537 
00538           lc=196;
00539          }
00540         else lc+=5;
00541        }
00542       }
00543    else if (plr==0 && !AI[plr]) {
00544       RectFill(lc-2,195,lc,195-safety*22/100,11);
00545       RectFill(lc-2,195,lc,195-(safety-Mev[STEP].asf)*22/100,6);
00546       for (i=195;i>195-val*22/100;i--) {
00547          RectFill(lc-2,195,lc,i,21);
00548          delay(15);
00549          }
00550       if (val>safety && prob==0) {RectFill(lc-2,195,lc,195-val*22/100,9);lc=76;}
00551       else if (val>safety) {RectFill(lc-2,195,lc,195-val*22/100,9);lc+=5;}
00552        else
00553        {
00554         if (lc>=126)
00555          {
00556           RectFill(73,173,133,196,55);
00557           for (i=73;i<133;i+=2)
00558            {
00559             grPutPixel(i,178,61);
00560             grPutPixel(i,184,61);
00561             grPutPixel(i,190,61);
00562            }
00563            RectFill(74,195,76,195-safety*22/100,11);
00564            RectFill(74,195,76,195-(safety-Mev[STEP].asf)*22/100,6);
00565            RectFill(74,195,76,195-val*22/100,21);
00566            if (Mev[STEP].asf>0) RectFill(74,195-safety*22/100,76,195-safety*22/100,11);
00567            lc=81;
00568          }
00569         else lc+=5;
00570        }
00571       }               
00572    return lc;
00573 }
00574 
00575 #define F_ALL 0
00576 #define F_ONE 1
00577 
00578 void F_KillCrew(char mode,struct Astros *Victim)
00579 {
00580   int k=0, p = 0;
00581   struct Astros *Guy;
00582 
00583   Guy = NULL; /* XXX check uninitialized */
00584 
00585   // Reset Hardware
00586   if (Victim >= &Data->P[1].Pool[0]) p = 1;
00587 
00588   if ( (Data->Def.Lev1 == 0 && p == 0 ) || ( Data->Def.Lev2 == 0 && p == 1) )
00589     Mev[STEP].E->Safety/=2;
00590   else Mev[STEP].E->Safety=Mev[STEP].E->Base;
00591 
00592   if (mode==F_ALL) {
00593     for(k=0;k<MANNED[Mev[STEP].pad];k++) {  // should work in news
00594       Guy=MA[Mev[STEP].pad][k].A;
00595       if (Guy!=NULL) {
00596         Guy->Status=1;
00597         Guy->Special=3;
00598         Guy->RetReas=8;
00599         Guy->Assign=Guy->Moved=Guy->Crew=Guy->Task=Guy->Una=0;
00600         tMen++;
00601         death=1;
00602       }
00603     }
00604   }
00605   else if (mode==F_ONE) {  // should work in news
00606     if (Victim==NULL) return;
00607     Victim->Status=1;
00608     Victim->Special=3;
00609     Victim->RetReas=8;
00610     Victim->Assign=Victim->Moved=Victim->Crew=Victim->Task=0;
00611 
00612     /* XXX this code was here, but Guy wsa not initialized */
00613     // Guy->Una=0;
00614 
00615     tMen++;
00616     //death=1;
00617   }
00618 }
00619 
00620 
00621 #define F_RET 0
00622 #define F_INJ 1
00623 
00624 void F_IRCrew(char mode,struct Astros *Guy)
00625 {
00626    if (Guy->Status==1) return;   // guy already dead
00627    if (Guy==NULL) return;  
00628    if (mode==F_RET) {  // should work in news
00629       Guy->Status=2;
00630       Guy->RDelay=1;   // Retire begginning of next season
00631       Guy->RetReas=9;
00632       Guy->Assign=Guy->Moved=Guy->Crew=Guy->Task=Guy->Una=0;
00633       }
00634    else if (mode==F_INJ) {
00635       Guy->Status=3;
00636       Guy->IDelay=3;  // Injured for a year
00637       Guy->Special=4;
00638       Guy->Assign=Guy->Moved=Guy->Crew=Guy->Task=Guy->Una=0;
00639       }
00640 }
00641 
00642 int FailEval(char plr,int type,char *text,int val,int xtra)
00643 {
00644    int FNote=0,temp,k,ctr;
00645    char PROBLEM=0;
00646    struct Astros *crw;
00647 
00648    temp = 0; /* XXX check uninitialized */
00649 
00650    if (!(strncmp(Mev[STEP].E->Name,"DO",2)==0 && Mev[STEP].loc==0x02)) {
00651      Mev[STEP].E->MisFail++;  // set failure for all but docking power on
00652    }
00653    Mev[STEP].StepInfo=1003;
00654    FNote=5;  // Mission Failure
00655 
00656    if (Unm==0) {
00657      Mev[STEP].trace=0x7f;
00658      if (type==12) DestroyPad(plr,MPad+Mev[STEP].pad,20,0);
00659      if (!AI[plr]) temp=FailureMode(plr,FNote,text);
00660 
00661      //Special Case for PhotoRecon with Lunar Probe
00662      if (Mev[STEP].loc==20 && mcc==8)  
00663         Mev[STEP-1].E->MisFail++;
00664      return 0;
00665    };
00666    
00667   Mev[STEP].StepInfo=0;
00668 
00669     switch(type) {
00670 
00671        case 0: // Failure has no effect on Mission
00672       case 20:   // don't want to test for crew experience
00673          FNote=0;
00674          Mev[STEP].StepInfo=50;
00675          if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00676          else Mev[STEP].trace=STEP+1;
00677            break;
00678 
00679 
00680        case 2:  // End of Mission Failure
00681         FNote=5;
00682            Mev[STEP].StepInfo=1000+Mev[STEP].loc;
00683         Mev[STEP].trace=0x7f;
00684            break;
00685 
00686 
00687      case 5:  // Stranded Step  (temp)
00688        case 3:  // Kill ALL Crew and END Mission
00689          if (type==5) FNote=4;
00690          FNote=8;
00691          if (InSpace>0 && MANNED[Mev[STEP].pad]==0 && strncmp(Mev[STEP].E->ID,"M2",2)==0) {
00692            Mev[STEP].pad=other(Mev[STEP].pad);  // for Kicker-C problems
00693            F_KillCrew(F_ALL,0);
00694            Mev[STEP].pad=other(Mev[STEP].pad);
00695          }
00696             else F_KillCrew(F_ALL,0);
00697 
00698             Mev[STEP].StepInfo=4600+Mev[STEP].loc;
00699          Mev[STEP].trace=0x7F;
00700             break; 
00701 
00702        case 4:  // Branch to Alternate Step
00703          FNote=1;
00704            Mev[STEP].StepInfo=1900+Mev[STEP].loc;
00705 
00706          if (Mev[STEP].fgoto==-1) {  // End of Mission Flag
00707              if (Mev[STEP].PComp>0) Mev[STEP].PComp=4;
00708             Mev[STEP].trace=0x7F;  // End of Mission Signal
00709             FNote=5;
00710              }
00711          else if (Mev[STEP].fgoto!=-2) {  // Alternate Step is other num
00712              if (Mev[STEP].PComp>0) Mev[STEP].PComp=4;
00713             Mev[STEP].trace=Mev[STEP].fgoto;
00714              }
00715          else Mev[STEP].trace=STEP+1;
00716            break;
00717 
00718        case 6:   // Reduce Safety by VAL% temp
00719          FNote=0;
00720          Mev[STEP].E->MisSaf-=abs(val);
00721            if (Mev[STEP].E->MisSaf<=0)
00722             Mev[STEP].E->MisSaf=1;
00723            Mev[STEP].StepInfo=900+Mev[STEP].loc;
00724         if (Mev[STEP].fgoto==-1 && Unm==0) Mev[STEP].trace=0x7F;
00725         else Mev[STEP].trace=STEP+1;
00726            break;
00727 
00728        case 7:   // Reduce Safety by VAL% perm
00729          FNote=0;
00730          Mev[STEP].E->Safety-=abs(val);
00731            if (Mev[STEP].E->Safety<=0)
00732             Mev[STEP].E->Safety=1;
00733            Mev[STEP].StepInfo=1700+Mev[STEP].loc;
00734          if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00735          else Mev[STEP].trace=STEP+1;
00736            break;
00737 
00738        case 9:  // Recheck Step
00739          FNote=2;
00740          Mev[STEP].StepInfo=9;
00741 //         Mev[STEP].rnum=random(10000)+1;  // new failure roll
00742 //         Mev[STEP].dice=random(100)+1;    // new die roll
00743          Mev[STEP].trace=STEP;            // redo step
00744            break; 
00745 
00746        case 12:  // Subtract VAL% from Safety, repair Pad for XTRA (launch only)
00747          FNote=5;
00748          Mev[STEP].E->MisSaf-=abs(val);
00749            if (Mev[STEP].E->MisSaf<=0)
00750             Mev[STEP].E->MisSaf=1;
00751            Mev[STEP].StepInfo=1600+Mev[STEP].loc;
00752 
00753          DestroyPad(plr,MPad+Mev[STEP].pad,abs(xtra),0);  // Destroy Pad
00754 
00755          Mev[STEP].trace=0x7F; // signal end of mission
00756          break;
00757 
00758       case 13: // Kill Crew, repair Pad for VAL
00759          FNote=8;
00760            F_KillCrew(F_ALL,0);
00761          DestroyPad(plr,Mev[STEP].pad+MPad,(val==0)?abs(xtra):abs(val),0);  // Destroy Pad
00762            Mev[STEP].StepInfo=4500+Mev[STEP].loc;
00763          Mev[STEP].trace=0x7F;
00764            break;
00765 
00766        case 15:  // Give option to Scrub  1%->20% negative of part
00767          FNote=3;
00768          Mev[STEP].E->MisSaf-=random(20)+1;
00769          if (Mev[STEP].E->MisSaf<=0)
00770             Mev[STEP].E->MisSaf=1;
00771            Mev[STEP].StepInfo=15;
00772            break;
00773 
00774        case 16: // VAL% injury,   XTRA% death
00775          FNote=0;
00776            Mev[STEP].StepInfo=1100+Mev[STEP].loc;
00777 
00778            for(k=0;k<MANNED[Mev[STEP].pad];k++) {
00779               if (random(100)>=val) {
00780                F_IRCrew(F_INJ,MA[Mev[STEP].pad][k].A);
00781                  Mev[STEP].StepInfo=2100+Mev[STEP].loc;
00782                FNote=9;
00783                  }
00784               }; // for
00785 
00786            ctr=0;
00787 
00788            for(k=0;k<MANNED[Mev[STEP].pad];k++) {
00789               if (Data->P[plr].Pool[temp].Status==2) {
00790                  if (random(100)>xtra) {
00791                   F_KillCrew(F_ONE,MA[Mev[STEP].pad][k].A);
00792                      Mev[STEP].StepInfo=3100+Mev[STEP].loc;
00793                   FNote=8;
00794                      ctr++;
00795                     }
00796                  }
00797               }
00798 
00799            if (ctr==MANNED[Mev[STEP].pad]) {
00800             Mev[STEP].StepInfo=4100+Mev[STEP].loc;
00801             Mev[STEP].trace=0x7F;
00802             }
00803          else if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00804          else Mev[STEP].trace=STEP+1;
00805 
00806         if (Mev[STEP].FName[3]==0x30) Mev[STEP].trace=0x7f;
00807 
00808            break;
00809 
00810 
00811 
00812        case 17: // VAL% survial and XTRA% if injury and retirement
00813            Mev[STEP].StepInfo=1300+Mev[STEP].loc;
00814            for(k=0;k<MANNED[Mev[STEP].pad];k++) {
00815               if (random(100)>=xtra) {
00816                F_IRCrew(F_RET,MA[Mev[STEP].pad][k].A);
00817                  Mev[STEP].StepInfo=2300+Mev[STEP].loc;
00818                FNote=9;
00819                  }
00820               };
00821          ctr=0;
00822            for(k=0;k<MANNED[Mev[STEP].pad];k++) {
00823               if (random(100)>=val) {
00824                F_KillCrew(F_ONE,MA[Mev[STEP].pad][k].A);
00825                  Mev[STEP].StepInfo=3300+Mev[STEP].loc;
00826                FNote=8;
00827                ctr++;
00828                  }
00829               }; // for
00830 
00831            if (ctr==MANNED[Mev[STEP].pad]) {
00832             Mev[STEP].StepInfo=4100+Mev[STEP].loc;
00833             Mev[STEP].trace=0x7F;
00834             }
00835          else if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00836          else Mev[STEP].trace=STEP+1;
00837            break;
00838 
00839        case 18:    // set MFlag from VAL, branch if already set
00840            if ((MFlag&val) > 0) {
00841             FNote=1;
00842             Mev[STEP].StepInfo=1800+Mev[STEP].loc;
00843             if (Mev[STEP].fgoto==-1) {Mev[STEP].trace=0x7F;FNote=0;}
00844             else if (Mev[STEP].fgoto!=-2) Mev[STEP].trace=Mev[STEP].fgoto;
00845             else Mev[STEP].trace=STEP+1;
00846             }
00847            else {
00848             FNote=0;
00849             Mev[STEP].StepInfo=18;
00850             MFlag=MFlag|val;
00851             if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00852             else Mev[STEP].trace=STEP+1;
00853             };
00854            break;
00855 
00856       case 19:   // Set mission flag and recheck step
00857            if ((MFlag&val) > 0) {
00858             Mev[STEP].StepInfo=1200+Mev[STEP].loc;
00859             FNote=2;
00860             }
00861            else {
00862             FNote=2;
00863             Mev[STEP].StepInfo=19;
00864             MFlag=MFlag|val;
00865             };
00866          Mev[STEP].trace=STEP;            // recheck step
00867 //         Mev[STEP].rnum=random(10000)+1;  // new failure roll
00868 //         Mev[STEP].dice=random(100)+1;    // new die roll
00869            break;
00870 
00871 
00872        case 22: // one man % survival :: EVA
00873            Mev[STEP].StepInfo=19;
00874            if (random(100)>val) {
00875             FNote=8;
00876             crw=(EVA[Mev[STEP].pad]!=-1) ? MA[Mev[STEP].pad][EVA[Mev[STEP].pad]].A : MA[other(Mev[STEP].pad)][EVA[other(Mev[STEP].pad)]].A;
00877             F_KillCrew(F_ONE,crw);
00878 
00879             if (Mev[STEP].Name[6]==0x36) death=1;  // one man lem
00880 
00881                Mev[STEP].StepInfo=3200+Mev[STEP].loc;
00882             Mev[STEP].trace=STEP+1;
00883               };
00884            break;
00885 
00886        case 23: // VAL% retirement, hardware cut %XTRA perm
00887          FNote=0;
00888            Mev[STEP].StepInfo=23+Mev[STEP].loc;
00889            for(k=0;k<MANNED[Mev[STEP].pad];k++) {
00890               if (random(100)>=val) {
00891                FNote=9;
00892                F_IRCrew(F_RET,MA[Mev[STEP].pad][k].A);
00893                  Mev[STEP].StepInfo=2400+Mev[STEP].loc;
00894                ctr++;
00895                  }
00896               };
00897          Mev[STEP].E->Safety-=xtra;
00898          if (Mev[STEP].E->Safety<=0)
00899             Mev[STEP].E->Safety=1;
00900 
00901          if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00902          else if (Mev[STEP].fgoto!=-2) Mev[STEP].trace=Mev[STEP].fgoto;
00903          else Mev[STEP].trace=STEP+1;
00904            break;
00905 
00906        case 24:   // Reduce Safety by VAL% perm :: hardware recovered
00907          FNote=5;
00908          Mev[STEP].E->Safety-=abs(val);
00909            if (Mev[STEP].E->Safety<=0)
00910             Mev[STEP].E->Safety=1;
00911            Mev[STEP].StepInfo=800+Mev[STEP].loc;
00912          Mev[STEP].trace=0x7F;
00913 
00914            break;
00915 
00916       case 25:    // Mission Failure recover Minishuttle
00917          FNote=5;
00918          Mev[STEP].StepInfo=700;
00919          Mev[STEP].trace=0x7F;   // End of Mission
00920          break;               
00921 
00922       case 26: // Subtract VAL% from Equip perm and branch to alternate
00923          FNote=1;
00924          Mev[STEP].StepInfo=1926;
00925          Mev[STEP].E->Safety-=abs(val);
00926            if (Mev[STEP].E->Safety<=0)
00927             Mev[STEP].E->Safety=1;
00928       
00929          if (Mev[STEP].fgoto==-1) {Mev[STEP].trace=0x7F;FNote=7;}
00930          else if (Mev[STEP].fgoto!=-2) Mev[STEP].trace=Mev[STEP].fgoto;
00931          else Mev[STEP].trace=STEP+1;
00932            break;
00933 
00934 
00935        case 30:  // Duration Failure
00936          FNote=7;
00937            Mev[STEP].StepInfo=1950;
00938          Mev[STEP].trace=STEP+1;
00939            break;
00940 
00941    case 31:  // kill EVA and LM people and branch VAL steps
00942       //Dock_Skip=1;
00943       Mev[STEP].trace=Mev[STEP].dgoto;
00944       Mev[STEP].StepInfo=3100+STEP;
00945 
00946       if (strncmp(Mev[STEP].E->ID,"C4",2)==0) {
00947          F_KillCrew(F_ALL,0);
00948          Mev[STEP].StepInfo=4100+STEP;
00949       }
00950       else {
00951         if (JOINT==0) {
00952           F_KillCrew(F_ONE,MA[0][EVA[0]].A);
00953           if (LM[0]!=EVA[0]) F_KillCrew(F_ONE,MA[0][LM[0]].A);
00954         }
00955         else {
00956           F_KillCrew(F_ONE,MA[1][EVA[1]].A);
00957           if (LM[1]!=EVA[1]) F_KillCrew(F_ONE,MA[1][LM[1]].A);
00958         }
00959       }      
00960       death=1;
00961       break;
00962    
00963        case 33:  // Kill Crew on All Capsules (happens only on dockings)
00964          if (type==5) FNote=4;
00965          FNote=8;
00966         if (MANNED[Mev[STEP].pad]>0) F_KillCrew(F_ALL,0);
00967         if (MANNED[other(Mev[STEP].pad)]>0)  {
00968            Mev[STEP].pad=other(Mev[STEP].pad);  // switch pad for a sec
00969            F_KillCrew(F_ALL,0);
00970            Mev[STEP].pad=other(Mev[STEP].pad);  // restore current pad
00971         }
00972            Mev[STEP].StepInfo=4600+Mev[STEP].loc;
00973          Mev[STEP].trace=0x7F;
00974            break; 
00975 
00976        case 1: case 8: case 10: case 11: case 14: case 21: case 27:
00977       case 28: case 29: default:
00978          FNote=0;
00979          Mev[STEP].StepInfo=50;
00980          if (Mev[STEP].fgoto==-1) Mev[STEP].trace=0x7F;
00981          else Mev[STEP].trace=STEP+1;
00982            break; // nothing : continue steps
00983     };
00984 
00985   if ((Mev[STEP].Name[0]=='A') && MH[Mev[STEP].pad][7]!=NULL)  
00986   {  // boosters involved
00987      if (MH[Mev[STEP].pad][4]->Safety==MH[Mev[STEP].pad][4]->Base)
00988        MH[Mev[STEP].pad][7]->Safety=MH[Mev[STEP].pad][7]->Base;
00989   }
00990 
00991   VerifySF(plr);  // Keep all safety's within the proper ranges
00992 
00993   // check for all astro's that are dead.  End mission if this is the case.
00994    while(bioskey(1)) bioskey(0);
00995    key=0;
00996    
00997    if (!AI[plr]) temp=FailureMode(plr,FNote,text);
00998 
00999    if (temp==0 && FNote==3) Mev[STEP].trace=STEP+1;
01000    else if (FNote==3) {Mev[STEP].StepInfo+=1000;SCRUBS=1;}
01001 
01002     if (SCRUBS==1) {
01003       if (Mev[STEP].loc==8 && noDock==1) PROBLEM=1;
01004       
01005       if (PROBLEM==0) {
01006          if (Mev[STEP].fgoto==-1) {  // End of Mission Flag
01007              if (Mev[STEP].PComp>0) Mev[STEP].PComp=4;
01008             Mev[STEP].trace=0x7F;  // End of Mission Signal
01009             FNote=5;
01010              }
01011          else if (Mev[STEP].fgoto!=-2) {  // Alternate Step is other num
01012              if (Mev[STEP].PComp>0) Mev[STEP].PComp=4;
01013            Mev[STEP].trace=Mev[STEP].fgoto;
01014              }
01015          else Mev[STEP].trace=STEP+1;
01016       }
01017     }
01018 
01019   if (strncmp(Mev[STEP].E->ID,"M3",2)==0) death=0;  //what???
01020 
01021   // New death branching code
01022   if (death==1) {
01023      if (Mev[STEP].dgoto==0) Mev[STEP].trace=0x7f;
01024      else if (Mev[STEP].dgoto>0) Mev[STEP].trace=Mev[STEP].dgoto;
01025   }
01026 
01027    if (type==9 || type==19) {
01028      Mev[STEP].trace=STEP;
01029      Mev[STEP].rnum=random(10000)+1;  // new failure roll
01030      Mev[STEP].dice=random(100)+1;    // new die roll
01031    }
01032 
01033   death=0;
01034   return FNote;
01035 }
01036 
01037 
01038 // EOF
01039 #if MIS_SET
01040 
01041 void DebugSetFailure(char *Text)
01042 {
01043  int fin,k=0,i,j;
01044  long len[2],length;
01045  char D[4],A[6];
01046  GXHEADER local;
01047 
01048  GV(&local,216,84);
01049  gxGetImage(&local,70,29,285,112,0);
01050 
01051  grSetColor(1);
01052  ShBox(70,29,285,112);
01053  InBox(76,34,279,46);RectFill(77,35,278,45,7);
01054  grSetColor(1);PrintAt(139,42,"FAILURE ENTRY");
01055  InBox(76,49,279,68);RectFill(77,50,278,67,7);
01056  InBox(141,76,174,86);RectFill(142,77,173,85,10);
01057 
01058  grSetColor(1);PrintAt(112,83,"RNUM:   ");
01059  DispNum(0,0,Mev[STEP].rnum);
01060  InBox(141,91,174,101);RectFill(142,92,173,100,10);
01061  grSetColor(1);PrintAt(102,98,"NEW:");
01062 
01063  for(i=0;i<5;i++)
01064   {
01065    OutBox(187+i*12,74,197+i*12,82);
01066    sprintf(&D[0],"%d",i);
01067    grSetColor(11);
01068    PrintAt(190+i*12,80,&D[0]);
01069   }
01070  grSetColor(11);
01071  for(i=0;i<5;i++)
01072   {
01073    OutBox(187+i*12,84,197+i*12,92);
01074    sprintf(&D[0],"%d",i+5);
01075    grSetColor(11);
01076    PrintAt(190+i*12,90,&D[0]);
01077   }
01078 
01079  OutBox(187,95,245,103);grSetColor(11);PrintAt(202,101,"ENTER");
01080  grSetColor(11);
01081  PrintAt(82,57,"ENTER THE NEW FAILURE NUMBER FOR");
01082  PrintAt(82,64,Text);
01083  memset(A,0x00,sizeof A);i=0; //reset i
01084  
01085  while(1)
01086   {
01087    key=0;
01088         WaitForMouseUp();
01089    GetMouse();
01090 
01091    if ((key==K_ENTER ) || (x>=187 && y>=95 && x<=245 && y<=103 && mousebuttons>0))
01092     { 
01093      InBox(187,95,245,103); 
01094         WaitForMouseUp();
01095      
01096      if (i>0) {
01097        i=atoi(&A[0]);
01098        Mev[STEP].rnum=maxx(minn(9999,i),0);
01099      }
01100      gxPutImage(&local,gxSET,70,29,0);
01101      DV(&local);
01102      key=0;
01103      return;
01104     }
01105      if (i<4 && key>='0' && key<='9')
01106       {
01107       j=key-0x30;
01108       if (j<5) InBox(187+j*12,74,197+j*12,82);
01109        else InBox(187+(j-5)*12,84,197+(j-5)*12,92);
01110         A[i++]=key;
01111       
01112       if (key>0) delay(150);
01113       RectFill(142,92,173,100,10);
01114         grSetColor(1);PrintAt(144,98,&A[0]);
01115       if (j<5) OutBox(187+j*12,74,197+j*12,82);
01116        else OutBox(187+(j-5)*12,84,197+(j-5)*12,92); 
01117       
01118        key=0;
01119       }
01120      if (i>0 && key==0x08)
01121       {
01122       
01123        A[--i]=0x00;
01124         grSetColor(1);
01125       RectFill(142,92,173,100,10);
01126       PrintAt(144,98,&A[0]);
01127       
01128         key=0;
01129       }
01130     for(j=0;j<5;j++)
01131      {
01132       if (x>=187+j*12 && y>=74 && x<=197+j*12 && y<=82 && mousebuttons>0 && i<4)
01133        {
01134         
01135         InBox(187+j*12,74,197+j*12,82);
01136         key=j+0x30;
01137         A[i++]=key;
01138                 WaitForMouseUp();
01139         if (key>0) delay(150);
01140         RectFill(142,92,173,100,10);
01141          grSetColor(1);PrintAt(150,98,&A[0]);
01142          key=0;
01143         OutBox(187+j*12,74,197+j*12,82);
01144         
01145        }    
01146      }
01147     for(j=0;j<5;j++)
01148      {
01149       if (x>=187+j*12 && y>=84 && x<=197+j*12 && y<=92 && mousebuttons>0 && i<4)
01150        {
01151         
01152         InBox(187+j*12,84,197+j*12,92);
01153         key=j+0x35;
01154         A[i++]=key;
01155                 WaitForMouseUp();
01156         if (k>0) delay(150);
01157         RectFill(142,92,173,100,10);
01158         grSetColor(1);PrintAt(150,98,&A[0]);
01159          key=0;
01160         OutBox(187+j*12,84,197+j*12,92);
01161         
01162        }    
01163      }
01164   }  
01165 }
01166 
01167 #endif

Generated on Fri Sep 28 00:35:27 2007 for raceintospace by  doxygen 1.5.3