intel.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 & Morgan Roarty
00024 //
00025 // Museum Main Files
00026 
00027 #include "gamedata.h"
00028 #include "Buzz_inc.h"
00029 #include "externs.h"
00030 
00031 extern struct mStr Mis;
00032 
00033 extern GXHEADER but;
00034 
00035 void Intel(char plr)
00036 {
00037   char IName[3][22]={"LIBRARY","CIA STATISTICS","EXIT INTELLIGENCE"};
00038   char IImg[3]={15,17,0};
00039   int i,beg;
00040 
00041   // FadeOut(2,pal,10,0,0);
00042     if (plr==1) {
00043         music_start(M_INTELLEG);
00044         strncpy((char *)&IName[1],"KGB",3);
00045     } else {
00046         music_start(M_INTEL);
00047     }
00048   beg=1;
00049 
00050   do {
00051      if (beg) beg=0;
00052      else {
00053         
00054         FadeOut(2,pal,10,0,0);
00055         DrawSpaceport(plr);
00056         PortPal(plr);
00057         RectFill(166,191,318,198,3);
00058         grSetColor(0);PrintAt(257,197,"CASH:");DispMB(285,197,Data->P[plr].Cash);
00059         grSetColor(11);PrintAt(256,196,"CASH:");DispMB(284,196,Data->P[plr].Cash);
00060         grSetColor(0);if (Data->Season==0) PrintAt(166,197,"SPRING 19");
00061         else PrintAt(166,197,"FALL 19");DispNum(0,0,Data->Year);
00062         grSetColor(11);if (Data->Season==0) PrintAt(165,196,"SPRING 19");
00063         else PrintAt(165,196,"FALL 19");DispNum(0,0,Data->Year);
00064         FadeIn(2,pal,10,0,0);
00065         
00066      }
00067      strncpy(IDT,(plr==0) ?"i704":"i705",4);
00068      strncpy(IKEY,(plr==0) ? "k605":"k606",4);
00069 
00070        i=BChoice(plr,3,&IName[0][0],&IImg[0]);
00071        switch(i) {
00072           case 1: strcpy(IDT,"i024");strcpy(IKEY,"k024");
00073              Bre(plr);break;
00074           case 2: strcpy(IDT,"i026");strcpy(IKEY,"k026");
00075              IStat(plr);break;
00076           default: break;
00077        }
00078   } while (i==1 || i==2);      
00079 
00080   music_stop();
00081 }
00082 
00083 
00084 void MisIntel(char plr,char acc)
00085 {
00086  int i=0,mr,j=0,k=0,save[20],lo=0,hi=28,tot=0,nf=0,seg=0;
00087  char mis,found;
00088  static char F[3][14] = {
00089   {6,1,2,3,4,5}, //58 & 59
00090   {13,6,25,7,9,10,11,12,8,14,15,18,16}, //60 to 64
00091   {11,43,38,48,53,54,55,56,42,49,50} // 65 and up
00092  };
00093  static char W[3][16] = {
00094   {11,7,3,1,1,2,2}, //58 & 59
00095   {4,15,1,1,3,3,3,2,2,2,2,1,3,1,1}, //60 to 64
00096   {5,12,3,3,3,3,2,2,1,1,1,1} // 65 and up
00097  };
00098  for (i=0;i<20;i++) save[i]=0;
00099  if (acc==0)
00100    {
00101     switch(Data->Year)
00102      {
00103       case 58:case 59: for(i=1;i<F[0][0];i++) save[i]=F[0][i];break;
00104       case 60:case 61:case 62:case 63:case 64:for(i=1;i<F[1][0];i++) save[i]=F[1][i];break;
00105       default:for(i=1;i<F[2][0];i++) save[i]=F[2][i];break;
00106      }
00107     //i=Data->Year-58;
00108     if (Data->Year<=59) i=0;
00109       else if (Data->Year<=64) i=1;
00110         else i=2;
00111     seg=W[i][0];j=random(100);k=2;nf=0;tot=0;
00112     while (nf==0 && k<W[i][1]) {
00113     tot=tot+W[i][k]*seg;
00114      if (j<=tot) nf=1;
00115        else k++;
00116     };
00117     nf=0;j=0;tot=0;k=k-2;
00118     while(nf==0 && j<20)
00119     {
00120       if (tot==k) nf=1;
00121         else if (save[j]>=1) tot++;
00122       if (nf==0) j++;
00123     };
00124      if (j>0) j=j-1;
00125    }  // end if
00126   else
00127    {
00128     found=0;
00129     // mission intelligence
00130     for (i=0;i<20;i++) save[i]=0;
00131     for (i=0;i<3;i++)
00132   if (Data->P[abs(plr-1)].Future[i].MissionCode>0)
00133      {
00134       mis=Data->P[abs(plr-1)].Future[i].MissionCode;
00135       save[found]=mis;++found;
00136      }
00137     for (i=0;i<3;i++)
00138        if (Data->P[abs(plr-1)].Mission[i].MissionCode>0)
00139      {
00140       mis=Data->P[abs(plr-1)].Mission[i].MissionCode;
00141       save[found]=mis;++found;
00142      }
00143     //}
00144     for (i=lo;i<hi;i++) if (save[i]>0) j++; // Check if event is good.
00145     if (j<=1) {MisIntel(plr,0);return;}
00146     j=random(hi-lo);k=0;
00147     while( (k < (hi-lo)) && (save[j]==0) )
00148       {   // finds candidate
00149        j=random(hi-lo);
00150        k++;
00151       };
00152   if (k>=20) {MisIntel(plr,0);return;}
00153  }
00154  mis=save[j];
00155  mr=Data->P[plr].PastIntel[0].cur;nf=0;
00156  for (i=0;i<mr;i++)
00157    if (Data->P[plr].PastIntel[i].prog==5 && Data->P[plr].PastIntel[i].index==mis)
00158      nf=1;
00159  if (nf==1 || mis>56+plr || mis<0) {HarIntel(plr,0);return;}
00160  SaveIntel(plr,5,(unsigned char) mis);
00161 }
00162 
00163 void XSpec(char plr,char mis,char year)
00164 {
00165  GetMisType(mis);
00166  grSetColor(6);PrintAt(17,75,"CLASS: ");grSetColor(9);
00167  if (Mis.Days>=1) PrintAt(39,81,"MANNED"); else PrintAt(39,81,"UNMANNED");
00168  grSetColor(6);PrintAt(17,96,"TYPE: ");grSetColor(9);
00169  if (Mis.Jt==1) PrintAt(0,0,"JOINT LAUNCH"); else PrintAt(0,0,"SINGLE LAUNCH");
00170  grSetColor(6);PrintAt(17,112,"DOCKING: ");grSetColor(9);
00171  if (Mis.Doc==1) PrintAt(0,0,"YES"); else PrintAt(0,0,"NO");
00172  grSetColor(6);PrintAt(17,128,"DURATION: ");grSetColor(9);
00173  if (Mis.Dur>=1) PrintAt(0,0,"YES"); else PrintAt(0,0,"NO");
00174  grSetColor(1);
00175  PrintAt(33,155,"THE ");if (plr==0) PrintAt(0,0,"CIA ");
00176  else PrintAt(0,0,"KGB ");PrintAt(0,0,"REPORTS THAT THE ");
00177  if (plr==0) PrintAt(0,0,"SOVIET UNION IS");else PrintAt(0,0,"UNITED STATES ARE");
00178  PrintAt(33,169,"PLANNING A ");
00179  grSetColor(9);MissionName(mis,93,169,30);grSetColor(1);
00180  PrintAt(33,183,"SOMETIME IN THE NEXT YEAR.");
00181  TopSecret(plr,37+Data->P[plr].PastIntel[year].sf);
00182 }
00183 
00184 void Special(char p,int ind)
00185 {
00186  
00187  grSetColor(6);
00188  if (ind>=5) PrintAt(17,96,"GROUP: ");
00189    else PrintAt(17,96,"FACILITY: ");grSetColor(9);
00190  switch(ind)
00191   {
00192    case 3:PrintAt(0,0,"TWO");break;
00193    case 4:PrintAt(0,0,"THREE");break;
00194    case 5:PrintAt(0,0,"ONE");break;
00195    case 6:PrintAt(0,0,"TWO");break;
00196    default:break;
00197   }
00198 
00199  if (ind>=5) {grSetColor(6);PrintAt(17,112,"STATUS: ");grSetColor(9);PrintAt(0,0,"TRAINING");}
00200    else {grSetColor(6);PrintAt(17,112,"STATUS: ");grSetColor(9);PrintAt(0,0,"OPERATIONAL");}
00201 
00202  grSetColor(1);
00203  PrintAt(33,155,"THE ");if (p==0) PrintAt(0,0,"CIA ");
00204  else PrintAt(0,0,"KGB ");PrintAt(0,0,"REPORTS THAT THE ");
00205  if (p==0) PrintAt(0,0,"SOVIET UNION HAS ");else PrintAt(0,0,"UNITED STATES HAVE ");
00206  PrintAt(33,169,"PURCHASED ");PrintAt(0,0,"A NEW");
00207  grSetColor(9);
00208  if (ind>=5)
00209    {
00210     PrintAt(0,0," GROUP OF ");
00211      if (p==0) PrintAt(0,0,"COSMO");
00212        else PrintAt(0,0,"ASTRO");PrintAt(0,0,"NAUTS ");
00213    }
00214 
00215    else PrintAt(0,0," LAUNCH FACILITY ");
00216  grSetColor(1);
00217  PrintAt(33,183,"FOR THEIR SPACE PROGRAM");
00218  TopSecret(p,ind);
00219 }
00220 
00221 
00222 void BackIntel(char p,char year)
00223 {
00224  int prg,ind,dur=0,xc,yc;
00225  FILE *fin;
00226  char code,w;
00227  
00228  grSetColor(6);
00229  prg=Data->P[p].PastIntel[year].prog;
00230  ind=Data->P[p].PastIntel[year].index;
00231  grSetColor(6);PrintAt(17,37,"CODE: ");grSetColor(9);
00232  DispNum(0,0,Data->P[p].PastIntel[year].num);DispChr(Data->P[p].PastIntel[year].code);
00233  PrintAt(0,0,"-");if (Data->Season==0) PrintAt(0,0,"S");else PrintAt(0,0,"F");
00234  DispNum(0,0,58+year);
00235  grSetColor(6);PrintAt(17,51,"CODENAME: ");grSetColor(1);xc=39;yc=59;
00236  // CODENAME GOES HERE
00237  code=-1;
00238  if (prg==0) code=ind;
00239    else if (prg==1) code=ind+7;
00240      else if (prg==2) code=ind+12;
00241        else if (prg==5) code=Data->P[p].PastIntel[year].sf-1;
00242  if (code==-1) PrintAt(xc,yc,"TOP SECRET");
00243    else {
00244  w=Data->P[p].PastIntel[year].cdex;
00245  fin=sOpen("CODENAME.DAT","rb",0);     // Get Mission DataFile
00246  fseek(fin,(code*6*20)+(w*20),SEEK_SET); // Find Mission Type
00247  fread(&Name,sizeof Name,1,fin);            // Get new Mission Info
00248  fclose(fin);
00249  PrintAt(xc,yc,&Name[0]); }
00250  if (prg==5) {XSpec(p,ind,year);return;}
00251  grSetColor(6);PrintAt(17,75,"CLASS: ");grSetColor(9);
00252  switch(prg)
00253   {
00254    case 0:if (ind>=5 && ind<=6) {if (p==0) PrintAt(39,82,"COSMO");
00255           else PrintAt(39,81,"ASTRO");PrintAt(0,0,"NAUTS");}
00256         else if (ind>=3 && ind<=4) PrintAt(39,81,"LAUNCH FACILITY");
00257           else PrintAt(39,81,"PROBE");break;
00258    case 1:PrintAt(39,82,"ROCKET");break;
00259    case 2:if (ind<5) PrintAt(39,81,"CAPSULE");
00260         else PrintAt(39,81,"LUNAR MODULE");
00261       break;
00262    case 3:if (ind<3) PrintAt(39,81,"KICKER");
00263         else if (ind==3) PrintAt(39,81,"EVA SUITS");
00264          else if (ind==4) PrintAt(39,81,"DOCKING MODULES");
00265       break;
00266    default:break;
00267   }
00268  if (prg==0 && ind>=3) {Special(p,ind);return;}
00269  
00270  grSetColor(6);PrintAt(17,96,"CREW: ");grSetColor(9);
00271  if (prg==2)
00272    {
00273     if (ind>=0 && ind<=2) DispNum(0,0,ind+1);
00274     else if (ind==3 || ind==4) DispNum(0,0,ind);
00275     else DispNum(0,0,ind-4);
00276     PrintAt(0,0," PERSON");
00277    } else PrintAt(0,0,"NONE");
00278  grSetColor(6);PrintAt(17,112,"PROGRAM: ");grSetColor(9);
00279  switch(prg)
00280   {
00281    case 0:PrintAt(0,0,&Data->P[abs(p-1)].Probe[ind].Name[0]);break;
00282    case 1:PrintAt(0,0,&Data->P[abs(p-1)].Rocket[ind].Name[0]);break;
00283    case 2:PrintAt(0,0,&Data->P[abs(p-1)].Manned[ind].Name[0]);break;
00284    case 3:PrintAt(0,0,&Data->P[abs(p-1)].Misc[ind].Name[0]);break;
00285    default:break;
00286   }
00287  grSetColor(6);PrintAt(17,128,"DURATION: ");grSetColor(9);
00288  switch(prg)
00289   {
00290    case 0:dur=Data->P[abs(p-1)].Probe[ind].Duration;break;
00291    case 1:dur=Data->P[abs(p-1)].Rocket[ind].Duration;break;
00292    case 2:dur=Data->P[abs(p-1)].Manned[ind].Duration;break;
00293    case 3:dur=Data->P[abs(p-1)].Misc[ind].Duration;break;
00294    default:break;
00295   }
00296  if (dur==0) PrintAt(0,0,"NONE");
00297    else {DispNum(0,0,dur);PrintAt(0,0," DAYS");}
00298  grSetColor(1);
00299  PrintAt(33,155,"THE ");if (p==0) PrintAt(0,0,"CIA ");
00300  else PrintAt(0,0,"KGB ");PrintAt(0,0,"REPORTS THAT THE ");
00301  if (p==0) PrintAt(0,0,"SOVIET UNION IS");else PrintAt(0,0,"UNITED STATES ARE");
00302  PrintAt(33,169,"DEVELOPING THE ");
00303  grSetColor(9);
00304  switch(prg)
00305   {
00306    case 0:PrintAt(0,0,&Data->P[abs(p-1)].Probe[ind].Name[0]);break;
00307    case 1:PrintAt(0,0,&Data->P[abs(p-1)].Rocket[ind].Name[0]);break;
00308    case 2:PrintAt(0,0,&Data->P[abs(p-1)].Manned[ind].Name[0]);break;
00309    case 3:PrintAt(0,0,&Data->P[abs(p-1)].Misc[ind].Name[0]);break;
00310    default:break;
00311   }
00312  grSetColor(1);
00313  PrintAt(0,0," AND RATE THE");
00314  PrintAt(33,183,"RELIABILITY AT ABOUT ");
00315  DispNum(0,0,Data->P[p].PastIntel[year].sf);PrintAt(0,0," PERCENT.");
00316  if (prg!=5) TopSecret(p,prg*7+ind);
00317 }
00318 
00319 void HarIntel(char p,char acc)
00320 {
00321  int mr,i,prg=0,ind=0,j=0,k=0,save[28],lo=0,hi=28,tot=0,nf=0,seg=0;
00322 
00323  static char F[10][11] = {
00324   {7,0,7,8,11,14,15,12,12,12}, //58
00325   {4,3,5,17,12,12,12,12,12,12}, //59
00326   {3,16,24,12,12,12,12,12,12,12}, //60
00327   {9,1,4,6,8,11,14,15,17,24}, //61
00328   {10,1,2,4,6,8,11,15,16,17,18}, //62
00329   {5,19,20,9,12,12,12,12,12,12}, //63
00330   {5,9,10,18,12,12,12,12,12,12}, //64
00331   {5,9,10,18,12,12,12,12,12,12}, //65
00332   {5,9,10,18,12,12,12,12,12,12} //66
00333  };
00334  static char W[10][15] = {
00335  {9,8,3,2,1,1,3,1}, //58
00336  {7,11,3,1,1,2,1,1,3,1,1}, //59
00337  {5,13,1,1,2,2,2,2,3,2,1,2,2}, //60
00338  {5,12,2,2,2,2,2,1,3,2,2,2}, //61
00339  {5,10,3,3,2,3,2,3,2,2}, //62
00340  {3,14,3,3,2,3,2,2,2,2,2,2,2,3}, //63
00341  {3,15,3,3,2,3,3,1,2,2,2,2,1,2,3}, // 64
00342  {3,15,3,3,2,3,3,1,2,2,2,2,1,2,3}, //65
00343  {3,15,3,3,2,3,3,1,2,2,2,2,1,2,3} //66
00344  };
00345  for (i=0;i<28;i++) save[i]=0;
00346  if (acc==0)
00347    {
00348     switch(Data->Year)
00349      {
00350       case 58:for(i=1;i<F[0][0];i++) save[F[0][i]]=1;break;
00351       case 59:for(i=1;i<F[0][0];i++) save[F[0][i]]=1;
00352           for(i=1;i<F[1][0];i++) save[F[1][i]]=1;break;
00353       case 60:for(i=1;i<F[0][0];i++) save[F[0][i]]=1;
00354           for(i=1;i<F[1][0];i++) save[F[1][i]]=1;
00355           for(i=1;i<F[2][0];i++) save[F[2][i]]=1;break;
00356       case 61:for(i=1;i<F[2][0];i++) save[F[2][i]]=1;
00357           for(i=1;i<F[3][0];i++) save[F[3][i]]=1;break;
00358       case 62:for(i=1;i<F[4][0];i++) save[F[4][i]]=1;break;
00359       case 63:for(i=1;i<F[4][0];i++) save[F[4][i]]=1;
00360           for(i=1;i<F[5][0];i++) save[F[5][i]]=1;break;
00361       case 64:for(i=1;i<F[4][0];i++) save[F[4][i]]=1;
00362           for(i=1;i<F[5][0];i++) save[F[5][i]]=1;
00363           for(i=1;i<F[6][0];i++) save[F[6][i]]=1;break;
00364       case 65:for(i=1;i<F[4][0];i++) save[F[4][i]]=1;
00365           for(i=1;i<F[5][0];i++) save[F[5][i]]=1;
00366           for(i=1;i<F[7][0];i++) save[F[7][i]]=1;break;
00367       default:for(i=1;i<F[4][0];i++) save[F[4][i]]=1;
00368           for(i=1;i<F[5][0];i++) save[F[5][i]]=1;
00369           for(i=1;i<F[8][0];i++) save[F[8][i]]=1;break;
00370      }
00371     i=Data->Year-58;
00372     if (Data->Year>=66) i=8;
00373     seg=W[i][0];j=random(100);k=2;nf=0;tot=0;
00374     while (nf==0 && k<W[i][1]) {
00375     tot=tot+W[i][k]*seg;
00376      if (j<=tot) nf=1;
00377        else k++;
00378     };
00379     nf=0;j=0;tot=0;k=k-2;
00380     while(nf==0 && j<28)
00381     {
00382       if (tot==k) nf=1;
00383       else if (save[j]==1) tot++;
00384       if (nf==0) j++;
00385     };
00386     if (j>0) j=j-1; //adjust
00387 
00388    }
00389   else
00390    { // accurate programs pick one
00391     for (i=0;i<7;i++)
00392     {
00393       if (Data->P[abs(p-1)].Probe[i].Num>=0) save[i]=1;
00394       if (Data->P[abs(p-1)].Rocket[i].Num>=0) save[i+7]=1;
00395       if (Data->P[abs(p-1)].Manned[i].Num>=0) save[i+14]=1;
00396       if (Data->P[abs(p-1)].Misc[i].Num>=0) save[i+21]=1;
00397     };
00398   save[3]=save[4]=save[5]=save[6]=save[12]=save[13]=save[26]=save[27]=0;
00399   if (Data->P[abs(p-1)].LaunchFacility[1]==1) save[3]=1;
00400   if (Data->P[abs(p-1)].LaunchFacility[2]==1) save[4]=1;
00401   if (Data->P[abs(p-1)].AstroLevel==0) save[5]=1;
00402   if (Data->P[abs(p-1)].AstroLevel==1) save[6]=1;
00403   for (i=lo;i<hi;i++) if (save[i]>0) j++; // Check if event is good.
00404   if (j<=2) {HarIntel(p,0);return;}
00405   j=random(hi-lo);k=0;
00406 
00407   while( (k < (hi-lo)) && (save[j]!=1) ) {   // finds candidate
00408  // DispNum(100,5+k*6,j);
00409   j=random(hi-lo);
00410   k++;
00411   };
00412 
00413   if (k>=28) {HarIntel(p,0);return;}
00414   } // end else
00415 
00416  if (j>=0 && j<7) {prg=0;ind=j;}
00417  else if (j>=7 && j<14) {prg=1;ind=j-7;}
00418  else if (j>=14 && j<21) {prg=2;ind=j-14;}
00419  else if (j>=21 && j<28) {prg=3;ind=j-21;}
00420 
00421   mr=Data->P[p].PastIntel[0].cur;nf=0;
00422  for (i=0;i<mr;i++)
00423    if (Data->P[p].PastIntel[i].prog==prg && Data->P[p].PastIntel[i].index==ind)
00424      nf=1;
00425  if (nf==1 || (prg==1 && ind==5) || (prg==1 && ind==6) || 
00426    (prg==3 && ind==5) || (prg==3 && ind==6)) {MisIntel(p,0);return;}
00427  SaveIntel(p,prg,ind);
00428 }
00429 
00430 
00431 void TopSecret(char plr,char poff)
00432 {
00433   GXHEADER local,local2;
00434   unsigned int j;
00435     SimpleHdr table;
00436   FILE *in;
00437   if (poff<56)
00438     if (plr==1) poff=poff+28;
00439   in=sOpen("INTEL.BUT","rb",0);
00440   fread_SimpleHdr(&table,1,in);
00441   fseek(in,71*sizeof_SimpleHdr,SEEK_SET);
00442   fread(&pal[0],768,1,in);
00443   fseek(in,table.offset,SEEK_SET);
00444   fread(buffer,table.size,1,in);
00445   GV(&local,157,100); GV(&local2,157,100);
00446   RLED_img(buffer,local.vptr,table.size,local.w,local.h);
00447   if (poff!=100)
00448     {
00449      fseek(in,(poff+1)*sizeof_SimpleHdr,SEEK_SET);
00450      fread_SimpleHdr(&table,1,in);
00451      fseek(in,table.offset,SEEK_SET);
00452      fread(buffer,table.size,1,in);     
00453      RLED_img(buffer,local2.vptr,table.size,local.w,local.h);
00454      for (j=0;j<15700;j++)
00455     if(local2.vptr[j]!=0) local.vptr[j]=local2.vptr[j];
00456     }
00457   
00458   gxPutImage(&local,gxSET,153,32,0);
00459   
00460   fclose(in);
00461   DV(&local); DV(&local2);
00462 }
00463 
00464 void SaveIntel(char p,char prg,char ind)
00465 {
00466  char Op[61] = {
00467  0,19,20,20,21,21,21,22,28,24,25,
00468  23,26,27,21,21,21,21,21,21,21,
00469  21,21,21,21,21,21,21,21,21,21,
00470  21,21,21,21,21,21,21,21,21,21,
00471  21,28,28,28,30,30,30,30,30,30,
00472  30,30,31,31,31,31,31};
00473  int mr,sf,j,k;
00474  char ky;
00475  if (prg==5 && ind==0) ind=1;
00476  mr=random(9998)+1;ky=65+random(26);
00477  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].code=ky;
00478  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].num=mr;
00479  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].prog=prg;
00480  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].index=ind;
00481  j=random(100);if (j<33) k=0;else if(j<66) k=1; else k=2;if (p==1) k=k+3;
00482  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].cdex=k;
00483  if (prg==5) sf=Op[ind];
00484    else sf=random(22)+77;
00485  Data->P[p].PastIntel[Data->P[p].PastIntel[0].cur].sf=sf;
00486  if (prg!=5) Data->P[p].Table[prg][ind]=sf;
00487 }
00488 
00489 void Bad(char plr,char pt)
00490 {
00491  
00492  if (pt==1){
00493     ShBox(6,29,130,133);
00494     InBox(8,31,128,131);
00495  grSetColor(9);
00496  PrintAt(17,37,"AGENTS IN THE FIELD");
00497  PrintAt(17,51,"REPORTED HEAVY");
00498  PrintAt(17,65,"ACTIVITY AT ");
00499  if (plr==1) PrintAt(0,0,"THE CAPE"); else PrintAt(0,0,"BAIKONUR");}
00500  if (pt==0) Data->P[plr].PastIntel[Data->Year-58].prog=-1;
00501  
00502 }
00503 
00504 void ImpHard(char plr,char hd,char dx)
00505 { // based on the hardware improve safety factor
00506  switch(hd)
00507   {
00508    case 0:Data->P[plr].Table[0][dx]=Data->P[plr].Probe[dx].MaxRD- random(Data->P[plr].Probe[dx].MaxSafety-Data->P[plr].Probe[dx].MaxRD);break;
00509    case 1:Data->P[plr].Table[1][dx]=Data->P[plr].Rocket[dx].MaxRD- random(Data->P[plr].Rocket[dx].MaxSafety-Data->P[plr].Rocket[dx].MaxRD);break;
00510    case 2:Data->P[plr].Table[2][dx]=Data->P[plr].Manned[dx].MaxRD- random(Data->P[plr].Manned[dx].MaxSafety-Data->P[plr].Manned[dx].MaxRD);break;
00511    case 3:Data->P[plr].Table[3][dx]=Data->P[plr].Misc[dx].MaxRD- random(Data->P[plr].Misc[dx].MaxSafety-Data->P[plr].Misc[dx].MaxRD);break;
00512    default:break;
00513   }
00514 }
00515 
00516 void UpDateTable(char plr)
00517 {  // based on prestige
00518  char i,j,p;
00519  p=other(plr);
00520  if (Data->P[p].LMpts>0)
00521   {
00522    j=random(100);if (j<60) ImpHard(plr,2,5); else ImpHard(plr,2,6);
00523   }
00524  for (i=0;i<28;i++)
00525   {
00526    if (Data->Prestige[i].Place==p || Data->Prestige[i].mPlace==p)
00527      {
00528       switch(i) {
00529       case 0:ImpHard(plr,0,0);break;
00530       case 1:case 2:case 3:case 4:case 5:case 6:ImpHard(plr,0,1);ImpHard(plr,1,1);break;
00531       case 7:ImpHard(plr,0,2);ImpHard(plr,1,1);break;
00532       case 13: ImpHard(plr,2,0);ImpHard(plr,1,1);break;
00533       case 14: ImpHard(plr,2,1);ImpHard(plr,1,2);break;
00534       case 15: ImpHard(plr,2,2);ImpHard(plr,1,2);break;
00535       case 16: ImpHard(plr,2,3);ImpHard(plr,1,2);break;
00536       case 17: ImpHard(plr,2,4);ImpHard(plr,1,3);break;
00537       case 18: ImpHard(plr,1,4);break;
00538       case 19: ImpHard(plr,1,4);j=random(100); if (j<70) ImpHard(plr,3,1); else ImpHard(plr,3,0);break;
00539       case 20: ImpHard(plr,1,4);j=random(100); if (j<70) ImpHard(plr,3,1); else ImpHard(plr,3,0);break;
00540       case 24: ImpHard(plr,3,4);break;
00541      case 26: case 27:ImpHard(plr,3,3);break;
00542       default:break;
00543      } // switch
00544     }  // if
00545    } // for 
00546 }
00547 
00548 void IntelPhase(char plr,char pt)
00549 {
00550  int i,splt,acc,Plr_Level,Acc_Coef;
00551  if (Data->Year==57 || (Data->Year==58 && Data->Season==0)) return;
00552  if (pt)EMPTY_BODY;
00553  splt=random(1000);i=random(1000);
00554  if (plr==0) Plr_Level=Data->Def.Lev1;
00555   else Plr_Level=Data->Def.Lev2;
00556  // stagger accuracy for player levels
00557  if (Plr_Level==0) Acc_Coef=600;
00558   else if (Plr_Level==1) Acc_Coef=500;
00559    else Acc_Coef=400;
00560  if (i<Acc_Coef) acc=1; else acc=0; // 40% accurate
00561  if (splt<500) HarIntel(plr,acc);
00562    else MisIntel(plr,acc);
00563  Data->P[plr].PastIntel[0].cur++;
00564  UpDateTable(plr);
00565 }
00566 
00567 
00568 void DrawBre(char plr)
00569 {
00570   
00571   FadeOut(2,pal,10,0,0);
00572   gxClearDisplay(0,0);
00573   ShBox(0,0,319,22);InBox(3,3,30,19);
00574   IOBox(242,3,315,19);
00575   ShBox(0,24,319,199);RectFill(5,28,314,195,0);
00576   InBox(4,27,315,196);
00577   ShBox(150,29,313,133);InBox(152,31,310,131);RectFill(153,32,310,131,0);
00578   ShBox(132,29,148,80);
00579   ShBox(132,82,148,133);
00580   ShBox(6,29,130,41);InBox(8,31,128,39); //code
00581   ShBox(6,43,130,63);InBox(8,45,128,61); // codename
00582   ShBox(6,65,130,85);InBox(8,67,128,83); // class
00583   ShBox(6,87,130,101);InBox(8,89,128,99); // crew
00584   ShBox(6,103,130,118);InBox(8,105,128,116); // program
00585   ShBox(6,120,130,133);InBox(8,122,128,131); // duration
00586   IOBox(133,30,147,79);IOBox(133,83,147,132);
00587   ShBox(6,135,313,194);RectFill(7,136,312,193,9);InBox(11,139,308,190);RectFill(12,140,307,189,7);
00588   DispBig(34,5,"INTELLIGENCE BRIEFING",1,-1);
00589   FlagSm(plr,4,4);
00590   grSetColor(1);PrintAt(258,13,"CONTINUE");
00591   UPArrow(137,42);DNArrow(137,95);
00592   
00593 }
00594 
00595 void Bre(char plr)
00596 {
00597  int year=Data->P[plr].PastIntel[0].cur-1;
00598  DrawBre(plr);
00599  TopSecret(plr,100); // just the blue background
00600  BackIntel(plr,year);
00601  FadeIn(2,pal,10,0,0);
00602  WaitForMouseUp();
00603  while (1)
00604   {
00605     key=0;GetMouse();
00606     if (mousebuttons > 0 || key>0)  /* Game Play */
00607      {
00608       if ((x>=135 && y>32 && x<=145 && y<=77 && mousebuttons>0) || key==UP_ARROW)
00609        {
00610         InBox(135,32,145,77);
00611         WaitForMouseUp();
00612         if (year>=0 && year+1<=Data->P[plr].PastIntel[0].cur-1)
00613           {
00614            
00615            RectFill(45,32,98,38,3);RectFill(38,54,127,60,3); 
00616            RectFill(38,76,127,82,3);RectFill(16,91,127,98,3);
00617            RectFill(16,107,127,113,3);RectFill(16,123,127,129,3);
00618            RectFill(30,148,300,186,7); 
00619            year++;BackIntel(plr,year);
00620           }
00621         OutBox(135,32,145,77);
00622       }
00623      else
00624      if ((x>=135 && y>85 && x<=145 && y<=130 && mousebuttons>0) || key==DN_ARROW)
00625        {
00626         InBox(135,85,145,130);
00627         WaitForMouseUp();
00628         if (year-1>=0) 
00629            {
00630             
00631             RectFill(45,32,98,38,3);RectFill(38,54,127,60,3); 
00632             RectFill(38,76,127,82,3);RectFill(9,90,127,98,3);
00633             RectFill(9,106,127,115,3);RectFill(9,123,127,130,3);
00634             RectFill(30,148,300,186,7);  
00635             year--;BackIntel(plr,year);
00636            }
00637          OutBox(135,85,145,130);
00638         }
00639       else
00640       if ((x>=244 && y>=5 && x<=313 && y<=17 && mousebuttons>0) || key==K_ENTER)
00641       {
00642         InBox(244,5,313,17);
00643         WaitForMouseUp();
00644        if (key>0) delay(150);
00645         OutBox(244,5,313,17);
00646         break;  /* Done */
00647        };
00648     }
00649   };
00650 }
00651 
00652 void Load_CIA_BUT(void)
00653 {
00654   int i;
00655   FILE *fin;
00656 
00657   fin=sOpen("CIA.BUT","rb",0);
00658   fread(&pal[0],768,1,fin);
00659   i=fread(screen,1,MAX_X*MAX_Y,fin);
00660   PCX_D(screen,(char *)vhptr.vptr,i);
00661   fclose(fin);
00662 }
00663 
00664 
00665 void DrawIStat(char plr)
00666 {
00667  int i;
00668     
00669     FadeOut(2,pal,10,0,0);
00670 
00671     Load_CIA_BUT();
00672     gxClearDisplay(0,0);
00673     Load_RD_BUT(plr);
00674 
00675     ShBox(0,0,319,199);IOBox(242,3,315,19);
00676     InBox(3,22,316,167);InBox(3,3,30,19);
00677 
00678     ShBox(0,160,319,199);IOBox(5,162,77,197);
00679     IOBox(81,162,158,197);IOBox(162,162,239,197);
00680     IOBox(243,162,315,197);
00681     GradRect(4,23,315,159,0);
00682     for (i=4;i<316;i+=2) {
00683       grPutPixel(i,57,11);
00684       grPutPixel(i,91,11);
00685       grPutPixel(i,125,11);
00686     }
00687     grSetColor(9);
00688     DispNum(5,55,75);PrintAt(17,55,"%");
00689     DispNum(5,89,50);PrintAt(17,89,"%");
00690     DispNum(5,123,25);PrintAt(17,123,"%");                  
00691     gxVirtualDisplay(&but,0,0,8,165,74,194,0);  // Unmanned
00692     gxVirtualDisplay(&but,68,0,84,165,155,194,0); // Rocket
00693     gxVirtualDisplay(&but,141,0,165,165,236,194,0);// Manned
00694     gxVirtualDisplay(&but,214,0,246,165,312,194,0);// Misc
00695     grSetColor(6);
00696     DispBig(40,5,"INTELLIGENCE STATS",1,-1);
00697     FlagSm(plr,4,4);
00698     grSetColor(1);PrintAt(258,13,"CONTINUE");
00699     FadeIn(2,pal,10,0,0);
00700     
00701 }
00702 
00703 void ReButs(char old,char nw)
00704 {
00705   
00706   switch(old) {
00707     case 0:OutBox(7,164,75,195);
00708        gxVirtualDisplay(&but,0,0,8,165,74,194,0);// UnManned
00709        break;
00710     case 1:OutBox(83,164,156,195);
00711        gxVirtualDisplay(&but,68,0,84,165,155,194,0);  // Rocket
00712        break;
00713     case 2:OutBox(164,164,237,195);
00714        gxVirtualDisplay(&but,141,0,165,165,236,194,0); // Manned
00715        break;
00716 
00717     case 3:OutBox(245,164,313,195);
00718        gxVirtualDisplay(&but,214,0,246,165,312,194,0);// Misc
00719        break;
00720     default:break;
00721   }
00722   switch(nw) {
00723     case 0:InBox(7,164,75,195);
00724        gxVirtualDisplay(&but,0,31,8,165,74,194,0);// UnManned
00725        break;
00726     case 1:InBox(83,164,156,195);
00727        gxVirtualDisplay(&but,68,31,84,165,155,194,0);  // Rocket
00728        break;
00729     case 2:InBox(164,164,237,195);
00730        gxVirtualDisplay(&but,141,31,165,165,236,194,0); // Manned
00731        break;
00732 
00733     case 3:InBox(245,164,313,195);
00734        gxVirtualDisplay(&but,214,31,246,165,312,194,0);// Misc
00735        break;
00736   }
00737   
00738 }
00739 
00740 void IStat(char plr)
00741 {
00742 int place=-1;
00743 
00744   DrawIStat(plr);
00745   WaitForMouseUp();
00746   while (1)
00747   {
00748     key=0;GetMouse();
00749     if (mousebuttons > 0 || key>0)  /* Game Play */
00750     {
00751      if (((x>=7 && y>=164 && x<=75 && y<=195 && mousebuttons>0) || key=='U') && place!=0)
00752       {
00753         InBox(7,164,75,195);
00754         WaitForMouseUp();
00755         OutBox(7,164,75,195);
00756         ReButs(place,0);
00757         place=0;
00758         IInfo(plr,place,0);
00759         /* UnManned */
00760       };
00761       if (((x>=83 && y>=164 && x<=156 && y<=195 && mousebuttons>0) || key=='R') && place!=1)
00762        {
00763          InBox(83,164,156,195);
00764          WaitForMouseUp();
00765          OutBox(83,164,156,195);
00766          ReButs(place,1);
00767          place=1;
00768          IInfo(plr,place,0);
00769          /* Rocket */
00770        };
00771       if (((x>=164 && y>=164 && x<=237 && y<=195 && mousebuttons>0) || key=='C') && place!=2)
00772        {
00773          InBox(164,164,237,195);
00774          WaitForMouseUp();
00775          OutBox(164,164,237,195);
00776          /* MANNED */
00777          ReButs(place,2);
00778          place=2;
00779          IInfo(plr,place,0);
00780        };
00781       if (((x>=245 && y>=164 && x<=313 && y<=195 && mousebuttons>0) || key=='M') && place!=3)
00782       {
00783         InBox(245,164,313,195);
00784         WaitForMouseUp();
00785         OutBox(245,164,313,195);
00786         ReButs(place,3);
00787         place=3;
00788         IInfo(plr,place,0);
00789         /* MISC */
00790       };
00791       if ((x>=244 && y>=5 && x<=314 && y<=17 && mousebuttons>0) || key==K_ENTER)
00792       {
00793         InBox(244,5,314,17);
00794         WaitForMouseUp();
00795        if (key>0) delay(150);
00796         OutBox(244,5,314,17);
00797         Del_RD_BUT();
00798         break;  /* Done */
00799       };
00800     }
00801   };
00802 }
00803 void DispIt(int x1,int y1,int x2, int y2,int s,int t)
00804 {
00805   GXHEADER local,local2;
00806   int i,w,h;
00807   unsigned char *src,*dest;
00808 
00809     w=x2-x1+1;h=y2-y1+1;
00810     GV(&local,w,h); GV(&local2,w,h);
00811     gxClearVirtual(&local,0);gxClearVirtual(&local2,0);
00812     gxGetImage(&local2,s,t,s+w-1,t+h-1,0);
00813     gxVirtualVirtual(&vhptr,x1,y1,x2,y2,&local,0,0,gxSET);
00814     src=local.vptr;dest=local2.vptr;
00815     for (i=0;i<w*h;i++) {
00816         if (*src)
00817             *dest = *src;
00818         dest++; src++;
00819     }
00820     
00821     gxPutImage(&local2,gxSET,s,t,0);
00822     
00823     DV(&local);DV(&local2);
00824 }
00825 
00826 void IInfo(char plr,char loc,char w)
00827 {
00828   int i,sfu,sfs;
00829   
00830   if (w==0) {
00831     GradRect(4,23,315,159,0);
00832     for (i=4;i<316;i+=2) {
00833       grPutPixel(i,57,11);
00834       grPutPixel(i,91,11);
00835       grPutPixel(i,125,11);
00836     }
00837     grSetColor(9);
00838     DispNum(5,55,75);PrintAt(17,55,"%");
00839     DispNum(5,89,50);PrintAt(17,89,"%");
00840     DispNum(5,123,25);PrintAt(17,123,"%");                  
00841     //gxDisplayVirtual(4,23,315,159,0,&vhptr,4,23);
00842   } //else gxVirtualDisplay(&vhptr,4,23,4,23,315,159,0);
00843 
00844  grSetColor(1);
00845   switch(loc) {
00846     case 1: //PrintAt(137,150,"ROCKETS");
00847        for (i=0;i<4;i++)
00848         {
00849          sfu=-1;sfs=-1;
00850          if (plr==0) {if (Data->P[0].Rocket[i].Num>=0) sfu=Data->P[0].Rocket[i].Safety;sfs=Data->P[0].Table[1][i];}
00851            else if (plr==1) {if (Data->P[1].Rocket[i].Num>=0) sfs=Data->P[1].Rocket[i].Safety;sfu=Data->P[1].Table[1][i];}
00852          switch(i)
00853           {
00854            case 0:if (sfu>0)
00855             {RectFill(19,159-sfu*136/100,27,159,6);
00856              RectFill(19,159-sfu*136/100,26,158,5);
00857              DispIt(101,1,115,57,11,104);};
00858               if (sfs>0)
00859             {RectFill(50,159-sfs*136/100,58,159,9);
00860              RectFill(50,159-sfs*136/100,57,158,8);
00861              DispIt(125,1,149,85,33,75);};
00862               break;
00863            case 1:if (sfu>0)
00864             {
00865              RectFill(78,159-sfu*136/100,86,159,6);
00866              RectFill(78,159-sfu*136/100,85,158,5);
00867              DispIt(115,0,124,68,73,92);};
00868               if (sfs>0)
00869             {
00870              RectFill(103,159-sfs*136/100,111,159,9);
00871              RectFill(103,159-sfs*136/100,110,158,8);
00872              DispIt(151,1,170,95,88,65);};
00873               break;
00874            case 2:if (sfu>0)
00875             {
00876              RectFill(159,159-sfu*136/100,167,159,6);
00877              RectFill(159,159-sfu*136/100,166,158,5);
00878              DispIt(172,1,209,133,130,27);};
00879               if (sfs>0)
00880             {
00881              RectFill(200,159-sfs*136/100,208,159,9);
00882              RectFill(200,159-sfs*136/100,207,158,8);
00883              DispIt(211,1,243,133,172,27);};
00884              break;
00885            case 3:if (sfu>0)
00886             {
00887              RectFill(260,159-sfu*136/100,268,159,6);
00888              RectFill(260,159-sfu*136/100,267,158,5);
00889              DispIt(245,1,285,137,231,23);};
00890                if (sfs>0)
00891              {
00892               RectFill(302,159-sfs*136/100,310,159,9);
00893               RectFill(302,159-sfs*136/100,309,158,8);
00894               DispIt(287,1,318,132,274,28);};
00895                break;
00896            default:break;
00897           }
00898         };
00899         break;
00900     case 2: //PrintAt(137,150,"CAPSULES");
00901        for (i=0;i<5;i++)
00902         {
00903          sfu=-1;sfs=-1;
00904          if (plr==0) {if (Data->P[0].Manned[i].Num>=0) sfu=Data->P[0].Manned[i].Safety;sfs=Data->P[0].Table[2][i];}
00905            else if (plr==1) {if (Data->P[1].Manned[i].Num>=0) sfs=Data->P[1].Manned[i].Safety;sfu=Data->P[1].Table[2][i];}
00906          switch(i)
00907           {
00908            case 0:if (sfu>0) {
00909              RectFill(13,159-sfu*136/100,21,159,6);
00910              RectFill(13,159-sfu*136/100,20,158,5);
00911              DispIt(12,91,25,116,11,137);};
00912               if (sfs>0) {
00913             RectFill(41,159-sfs*136/100,49,159,9);
00914             RectFill(41,159-sfs*136/100,48,158,8);
00915             DispIt(0,56,26,89,27,123);};
00916                break;
00917            case 1:
00918         if (sfu>0) {
00919           RectFill(70,159-sfu*136/100,78,159,6);
00920           RectFill(70,159-sfu*136/100,77,158,5);
00921           DispIt(27,98,49,127,59,127);};
00922         if (sfs>0) {
00923           RectFill(97,159-sfs*136/100,105,159,9);
00924           RectFill(97,159-sfs*136/100,104,158,8);
00925           DispIt(28,62,49,96,84,122);};
00926               break;
00927            case 2:
00928         if (sfu>0) {
00929           RectFill(132,159-sfu*136/100,140,159,6);
00930           RectFill(132,159-sfu*136/100,139,158,5);
00931           DispIt(95,77,117,127,117,106);};
00932         if (sfs>0) {
00933           RectFill(174,159-sfs*136/100,182,159,9);
00934           RectFill(174,159-sfs*136/100,181,158,8);
00935           DispIt(119,97,170,140,144,113);};
00936               break;
00937            case 3:
00938         if (sfu>0) {
00939           RectFill(210,159-sfu*136/100,218,159,6);
00940           RectFill(210,159-sfu*136/100,217,158,5);
00941           DispIt(3,1,16,54,203,103);};
00942         if (sfs>0) {
00943           RectFill(232,159-sfs*136/100,240,159,9);
00944           RectFill(232,159-sfs*136/100,239,158,8);
00945           DispIt(18,1,32,48,223,109);};
00946               break;
00947            case 4:
00948         if (sfu>0) {
00949           RectFill(269,159-sfu*136/100,277,159,6);
00950           RectFill(269,159-sfu*136/100,276,158,5);
00951           DispIt(34,1,65,60,248,97);};
00952         if (sfs>0) {
00953           RectFill(305,159-sfs*136/100,313,159,9);
00954           RectFill(305,159-sfs*136/100,312,158,8);
00955           DispIt(67,1,100,60,281,97);};
00956               break;
00957         default:break;
00958            }
00959           }
00960         break;
00961     case 0: //PrintAt(100,150,"SATELLITES & LM'S");
00962         sfu=-1;sfs=-1;
00963         if (plr==0) {if (Data->P[0].Manned[6].Num>=0) sfu=Data->P[0].Manned[6].Safety;sfs=Data->P[0].Table[2][6];}
00964           else if (plr==1) {if (Data->P[1].Manned[6].Num>=0) sfs=Data->P[1].Manned[6].Safety;sfu=Data->P[1].Table[2][6]; }
00965         if (sfu>0) {
00966           RectFill(25,159-sfu*136/100,33,159,6);
00967           RectFill(25,159-sfu*136/100,32,158,5);
00968           DispIt(60,153,88,176,9,132);};
00969         if (sfs>0) {
00970           RectFill(61,159-sfs*136/100,69,159,9);
00971           RectFill(61,159-sfs*136/100,68,158,8);
00972           DispIt(31,153,56,182,41,126);}; 
00973         sfu=-1;sfs=-1;
00974         if (plr==0) {if (Data->P[0].Manned[5].Num>=0) sfu=Data->P[0].Manned[5].Safety;sfs=Data->P[0].Table[2][5];}
00975           else if (plr==1) {if (Data->P[1].Manned[5].Num>=0) sfs=Data->P[1].Manned[5].Safety;sfu=Data->P[1].Table[2][5];}
00976         if (sfu>0) {
00977           RectFill(101,159-sfu*136/100,109,159,6);
00978           RectFill(101,159-sfu*136/100,108,158,5);
00979           DispIt(1,153,29,182,83,128);
00980           };
00981         if (sfs>0) {
00982           RectFill(132,159-sfs*136/100,140,159,9);
00983           RectFill(132,159-sfs*136/100,139,158,8);
00984           DispIt(90,151,119,176,112,131);   
00985          };
00986         for (i=0;i<3;i++)
00987            {
00988         sfu=-1;sfs=-1;
00989         if (plr==0) {if (Data->P[0].Probe[i].Num>=0) sfu=Data->P[0].Probe[i].Safety;sfs=Data->P[0].Table[0][i];}
00990           else if (plr==1) {if (Data->P[1].Probe[i].Num>=0) sfs=Data->P[1].Probe[i].Safety;sfu=Data->P[1].Table[0][i];}
00991         switch(i)
00992           {
00993            case 0:
00994         if (sfu>0) {
00995           RectFill(152,159-sfu*136/100,160,159,6);
00996           RectFill(152,159-sfu*136/100,159,158,5);
00997           DispIt(58,180,71,196,147,138);};
00998         if (sfs>0) {
00999           RectFill(173,159-sfs*136/100,181,159,9);
01000           RectFill(173,159-sfs*136/100,180,158,8);
01001           DispIt(73,180,89,195,165,139);};
01002                break;
01003            case 1:
01004         if (sfu>0) {
01005           RectFill(212,159-sfu*136/100,220,159,6);
01006           RectFill(212,159-sfu*136/100,219,158,5);
01007           DispIt(91,178,115,195,198,139);};
01008         if (sfs>0) {
01009           RectFill(237,159-sfs*136/100,245,159,9);
01010           RectFill(237,159-sfs*136/100,244,158,8);
01011           DispIt(153,142,176,166,227,132);};
01012                break;
01013            case 2:
01014         if (sfu>0) {
01015           RectFill(272,159-sfu*136/100,280,159,6);
01016           RectFill(272,159-sfu*136/100,279,158,5);
01017           DispIt(121,142,151,166,253,132);};
01018         if (sfs>0) {
01019           RectFill(302,159-sfs*136/100,310,159,9);
01020           RectFill(302,159-sfs*136/100,309,158,8);
01021           DispIt(178,142,201,160,284,138);};
01022                break;
01023          default:break;
01024           }
01025          }
01026         break;
01027     case 3: //PrintAt(100,150,"ADDITIONAL PROGRAMS");
01028         sfu=-1;sfs=-1;
01029         if (plr==0) {if (Data->P[0].Misc[3].Num>=0) sfu=Data->P[0].Misc[3].Safety;sfs=Data->P[0].Table[3][3];}
01030           else if (plr==1) {if (Data->P[1].Misc[3].Num>=0) sfs=Data->P[1].Misc[3].Safety;sfu=Data->P[1].Table[3][3];}
01031         if (sfu>0) {
01032           RectFill(19,159-sfu*136/100,27,159,6);
01033           RectFill(19,159-sfu*136/100,26,158,5);
01034           DispIt(68,65,76,75,17,145);};
01035         if (sfs>0) {
01036           RectFill(30,159-sfs*136/100,38,159,9);
01037           RectFill(30,159-sfs*136/100,37,158,8);
01038           DispIt(78,65,86,75,31,145);};
01039 
01040         sfu=-1;sfs=-1;
01041         if (plr==0) {if (Data->P[0].Misc[4].Num>=0) sfu=Data->P[0].Misc[4].Safety;sfs=Data->P[0].Table[3][4];}
01042           else if (plr==1) {if (Data->P[1].Misc[4].Num>=0) sfs=Data->P[1].Misc[4].Safety;sfu=Data->P[1].Table[3][4];}
01043         if (sfu>0) {
01044           RectFill(72,159-sfu*136/100,80,159,6);
01045           RectFill(72,159-sfu*136/100,79,158,5);
01046           DispIt(88,62,100,75,64,143);};
01047         if (sfs>0) {
01048           RectFill(91,159-sfs*136/100,99,159,9);
01049           RectFill(91,159-sfs*136/100,98,158,8);
01050           DispIt(102,66,114,75,84,147);};
01051 
01052          sfu=-1;sfs=-1;
01053          if (plr==0) {if (Data->P[0].Rocket[4].Num>=0) sfu=Data->P[0].Rocket[4].Safety;sfs=Data->P[0].Table[1][4];}
01054            else if (plr==1) {if (Data->P[1].Rocket[4].Num>=0) sfs=Data->P[1].Rocket[4].Safety;sfu=Data->P[1].Table[1][4];}
01055 
01056         if (sfu>0) {
01057           RectFill(118,159-sfu*136/100,126,159,6);
01058           RectFill(118,159-sfu*136/100,125,158,5);
01059           DispIt(1,120,14,151,113,125);};
01060         if (sfs>0) {
01061           RectFill(143,159-sfs*136/100,151,159,9);
01062           RectFill(143,159-sfs*136/100,150,158,8);
01063           DispIt(16,130,31,151,134,135);};
01064 
01065         sfu=-1;sfs=-1;
01066         if (plr==0) {if (Data->P[0].Misc[0].Num>=0) sfu=Data->P[0].Misc[0].Safety;sfs=Data->P[0].Table[3][0];}
01067           else if (plr==1) {if (Data->P[1].Misc[0].Num>=0) sfs=Data->P[1].Misc[0].Safety;sfu=Data->P[1].Table[3][0];}
01068         if (sfu>0) {
01069           RectFill(173,159-sfu*136/100,181,159,6);
01070           RectFill(173,159-sfu*136/100,180,158,5);
01071           DispIt(33,140,47,151,165,145);};
01072         if (sfs>0) {
01073           RectFill(195,159-sfs*136/100,203,159,9);
01074           RectFill(195,159-sfs*136/100,202,158,8);
01075           DispIt(49,138,61,151,188,143);};
01076 
01077         sfu=-1;sfs=-1;
01078         if (plr==0) {if (Data->P[0].Misc[1].Num>=0) sfu=Data->P[0].Misc[1].Safety;sfs=Data->P[0].Table[3][1];}
01079           else if (plr==1) {if (Data->P[1].Misc[1].Num>=0) sfs=Data->P[1].Misc[1].Safety;sfu=Data->P[1].Table[3][1];}
01080         if (sfu>0) {
01081           RectFill(226,159-sfu*136/100,234,159,6);
01082           RectFill(226,159-sfu*136/100,233,158,5);
01083           DispIt(63,131,75,151,219,136);};
01084         if (sfs>0) {
01085           RectFill(246,159-sfs*136/100,254,159,9);
01086           RectFill(246,159-sfs*136/100,253,158,8);
01087           DispIt(77,129,88,151,240,134);};
01088 
01089       sfu=-1;sfs=-1;
01090         if (plr==1) {if (Data->P[1].Misc[2].Num>=0) sfs=Data->P[1].Misc[2].Safety;}
01091           else if (plr==0) sfs=Data->P[0].Table[3][2];
01092         if (sfs>0){
01093           RectFill(296,159-sfs*136/100,304,159,9);
01094           RectFill(296,159-sfs*136/100,303,158,8);
01095           DispIt(51,77,93,127,266,106);};
01096         break;
01097     default:break;
01098   };
01099   
01100 }
01101 
01102 /* EOF */

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