ast1.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 /** \file ast1.c Astronaut Recruitment
00026  */
00027 
00028 #include "Buzz_inc.h"
00029 #include "externs.h"
00030 
00031 extern char MCol[110],sel[30],MaxSel;
00032 extern struct ManPool *Men;
00033 
00034 void DispEight(char now,char loc)
00035 {
00036   int i,start;
00037   start=now-loc;
00038   for (i=start;i<start+8;i++) {
00039     if (MCol[i]==1) grSetColor(8);
00040     else grSetColor( 6+(Men[i].Sex+1)*6 );
00041     PrintAt(189,136+(i-start)*8,&Men[i].Name[0]);
00042   };
00043   RectFill(206,48,306,52,3);
00044   RectFill(221,57,306,61,3);
00045   RectFill(293,66,301,70,3);
00046   RectFill(274,98,281,102,3);
00047   grSetColor(1);
00048   if (Men[now].Sex==0) PrintAt(206,52,"MR. ");
00049   else PrintAt(206,52,"MS. ");
00050   PrintAt(0,0,&Men[now].Name[0]);
00051   DispNum(294,70,Men[now].Cap);
00052   DispNum(275,102,Men[now].Endurance);
00053   return;
00054 } /* End of Disp8 */
00055 
00056 void DispEight2(int nw,int lc,int cnt)
00057 {
00058   int i,start,num;
00059   start=nw-lc;
00060   num= (cnt<8) ? cnt : 8;
00061 
00062   grSetColor(11);
00063   for (i=start;i<start+num;i++) {
00064     if (sel[i]!=-1) {
00065       grSetColor( 6+(Men[sel[i]].Sex+1)*6 );
00066       PrintAt(28,136+(i-start)*8,&Men[ sel[i] ].Name[0]);
00067     }
00068    }
00069 
00070    RectFill(45,48,145,52,3);
00071    RectFill(60,57,145,61,3);
00072    RectFill(132,66,140,70,3);
00073    RectFill(113,98,120,102,3);
00074    RectFill(292,36,310,41,7);
00075    grSetColor(11);
00076    DispNum(292,41,MaxSel-cnt);
00077   if (cnt>0) {
00078     grSetColor(1);
00079     if (Men[sel[nw]].Sex==0) PrintAt(45,52,"MR. ");
00080     else PrintAt(45,52,"MS. ");
00081     PrintAt(0,0,&Men[sel[nw]].Name[0]);
00082     DispNum(133,70,Men[sel[nw]].Cap);
00083     DispNum(114,102,Men[sel[nw]].Endurance);
00084   };
00085   return;
00086 }
00087 
00088 
00089 void DrawAstCheck(char plr)
00090 {
00091   int i,pos,ad=0;
00092 
00093   pos = 0; /* XXX check uninitialized */
00094 
00095   if (Data->P[plr].AstroDelay>0) ad=1;
00096   
00097   FadeOut(2,pal,10,0,0);
00098   gxClearDisplay(0,0);
00099   ShBox(80,44,237,155);
00100   InBox(87,49,230,103);RectFill(88,50,229,102,7+plr*3);
00101   IOBox(98,133,150,149);IOBox(166,133,218,149);
00102   grSetColor(5);
00103   if (plr==0) PrintAt(96,60,"ASTRONAUT");
00104   else PrintAt(96,60,"COSMONAUT");
00105   PrintAt(0,0," RECRUITMENT");
00106   grSetColor(11);
00107   PrintAt(97,73,"GROUP ");
00108   switch (Data->P[plr].AstroLevel) {
00109     case 0:PrintAt(0,0,"I");pos=ASTRO_POOL_LVL1;break;
00110     case 1:PrintAt(0,0,"II");pos=ASTRO_POOL_LVL2;break;
00111     case 2:PrintAt(0,0,"III");pos=ASTRO_POOL_LVL3;break;
00112     case 3:PrintAt(0,0,"IV");pos=ASTRO_POOL_LVL4;break;
00113     case 4:PrintAt(0,0,"V");pos=ASTRO_POOL_LVL5;break;
00114   };
00115   if (Data->Season==0) PrintAt(166,73,"SPRING 19"); else PrintAt(166,73,"FALL 19");
00116   DispNum(0,0,Data->Year);
00117   if (Data->P[plr].AstroLevel==0) i=20; else i=15;
00118   if (ad==0) {
00119     DispNum(116,86,pos);
00120     PrintAt(0,0," POSITIONS TO FILL");
00121     PrintAt(135,97,"COST: ");DispNum(0,0,i);PrintAt(0,0," MB");
00122   }else {
00123     DispNum(116,86,Data->P[plr].AstroDelay);
00124     PrintAt(0,0," SEASON");
00125     if (Data->P[plr].AstroDelay!=1) PrintAt(0,0,"S");
00126     PrintAt(0,0," TO WAIT");
00127     PrintAt(110,97,"FOR THE NEW RECRUITS");
00128   }
00129   grSetColor(1);
00130 
00131   if (ad==1) {
00132     PrintAt(99,113,"  YOU CANNOT RECRUIT");
00133     if (plr==0) PrintAt(100,122,"ASTRONAUTS THIS TURN");
00134     else PrintAt(100,122,"COSMONAUTS THIS TURN");
00135     grSetColor(8);
00136     PrintAt(113,143,"EXIT");
00137     PrintAt(181,143,"EXIT");
00138   };
00139 
00140  if (ad==0) {
00141   if (Data->P[plr].Cash<i) {
00142     PrintAt(99,113,"YOU CANNOT AFFORD");
00143     if (plr==0) PrintAt(100,122,"ASTRONAUTS THIS TURN");
00144     else PrintAt(100,122,"COSMONAUTS THIS TURN");
00145     grSetColor(8);
00146     PrintAt(113,143,"EXIT");
00147     PrintAt(181,143,"EXIT");
00148   } else {
00149     PrintAt(98,113,"DO YOU WISH TO RECRUIT");
00150     if (plr==0) PrintAt(100,122,"ASTRONAUTS THIS TURN");
00151     else PrintAt(100,122,"COSMONAUTS THIS TURN");
00152     grSetColor(6);PrintAt(116,143,"Y");grSetColor(1);PrintAt(0,0,"ES");
00153     grSetColor(6);PrintAt(187,143,"N");grSetColor(1);PrintAt(0,0,"O");
00154   };
00155  };
00156   FlagSm(plr,4,4);
00157   FadeIn(2,pal,10,0,0);
00158   
00159   return;
00160 }
00161 
00162 /** Draw selection screen for Astronaut recruitment
00163  * 
00164  */
00165 void DrawAstSel(char plr)
00166 {
00167   
00168   strcpy(IDT,"i012");
00169   strcpy(IKEY,"k012");
00170   FadeOut(2,pal,10,0,0);
00171   gxClearDisplay(0,0);
00172   ShBox(0,0,319,22);
00173   ShBox(0,24,158,199); ShBox(161,24,319,199);
00174   RectFill(5,129,19,195,0); RectFill(166,129,180,195,0);
00175   RectFill(25,129,153,195,0); RectFill(186,129,314,195,0);
00176   ShBox(6,130,18,161);  ShBox(6,163,18,194);
00177   ShBox(167,130,179,161); ShBox(167,163,179,194);
00178   IOBox(243,3,316,19); IOBox(5,109,153,125);
00179   IOBox(166,109,315,125);
00180   InBox(4,128,20,196);  InBox(24,128,154,196);
00181   InBox(185,128,315,196); InBox(165,128,181,196);
00182   InBox(3,3,30,19);
00183   UPArrow(9,133);DNArrow(9,166); //Left
00184   UPArrow(170,133);DNArrow(170,166); //Right
00185   grSetColor(1);
00186   PrintAt(258,13,"CONTINUE");
00187   DispBig(35,5,"RECRUITMENT",0,-1);
00188   FlagSm(plr,4,4);
00189 
00190   InBox(3,27,155,44);RectFill(4,28,154,43,7);
00191   InBox(164,27,316,44);RectFill(165,28,315,43,7);
00192 
00193   grSetColor(1);
00194   if (plr==0) PrintAt(22,34,"ASTRONAUT SELECTION");
00195   else PrintAt(22,34,"COSMONAUT SELECTION");
00196   PrintAt(192,34,"POOL OF APPLICANTS");
00197 
00198   grSetColor(11);
00199   PrintAt(12,41,"GROUP ");
00200   switch (Data->P[plr].AstroLevel) {
00201     case 0:PrintAt(0,0,"I");break;
00202     case 1:PrintAt(0,0,"II");break;
00203     case 2:PrintAt(0,0,"III");break;
00204     case 3:PrintAt(0,0,"IV");break;
00205     case 4:PrintAt(0,0,"V");break;
00206   };
00207 
00208   PrintAt(185,41,"REMAINING POSITIONS:");
00209 
00210   if (Data->Season==0) PrintAt(86,41,"SPRING 19"); else PrintAt(86,41,"FALL 19");
00211   DispNum(0,0,Data->Year);
00212   grSetColor(9);
00213   PrintAt(12,52,"NAME:");  PrintAt(173,52,"NAME:");
00214   PrintAt(12,61,"SERVICE:");PrintAt(173,61,"SERVICE:");
00215   PrintAt(12,70,"SKILLS:");PrintAt(173,70,"SKILLS:");
00216   grSetColor(11);
00217   PrintAt(54,70,"CAPSULE PILOT:");PrintAt(215,70,"CAPSULE PILOT:");
00218   grSetColor(11);PrintAt(54,78,"L.M. PILOT: ");grSetColor(1);PrintAt(0,0,"--");
00219   grSetColor(11);PrintAt(215,78,"L.M. PILOT: ");grSetColor(1);PrintAt(0,0,"--");
00220   grSetColor(11);PrintAt(54,86,"E.V.A.: ");grSetColor(1);PrintAt(0,0,"--");
00221   grSetColor(11);PrintAt(215,86,"E.V.A.: ");grSetColor(1);PrintAt(0,0,"--");
00222   grSetColor(11);PrintAt(54,94,"DOCKING: ");grSetColor(1);PrintAt(0,0,"--");
00223   grSetColor(11);PrintAt(215,94,"DOCKING: ");grSetColor(1);PrintAt(0,0,"--");
00224   grSetColor(11);PrintAt(54,102,"ENDURANCE:");PrintAt(215,102,"ENDURANCE:");
00225   grSetColor(6);
00226   PrintAt(38,119,"D");grSetColor(1);PrintAt(0,0,"ISMISS APPLICANT");
00227   grSetColor(6);PrintAt(197,119,"R");grSetColor(1);PrintAt(0,0,"ECRUIT APPLICANT");
00228   
00229   return;
00230 }
00231 
00232 void AstSel(char plr)
00233 {
00234 char i,j,k,BarA,BarB,MaxMen,Index,now,now2,max,min,count,fem=0,ksel=0;
00235 FILE *fin;
00236 i=j=k=BarA=BarB=MaxMen=Index=now=now2=max=min=count=0;
00237 music_start(M_DRUMSM);
00238 DrawAstCheck(plr);
00239   WaitForMouseUp();
00240   i=0;
00241   while (i==0)
00242    {
00243     key=0;GetMouse();
00244     if ((x>=100 && y>=135 && x<=148 && y<=147 && mousebuttons>0) || key=='Y')
00245      {
00246       
00247       InBox(100,135,148,147);
00248       WaitForMouseUp();
00249       if (Data->P[plr].AstroLevel==0) Index=20; else Index=15;
00250       if (Data->P[plr].Cash>=Index) i=1; else i=2;
00251       if (Data->P[plr].AstroDelay>0) i=2;
00252       if (key>0) delay(150);
00253       OutBox(100,135,148,147); 
00254      }
00255     if ((x>=168 && y>=135 && x<=216 && y<=147 && mousebuttons>0)
00256       || key=='N' || key==K_ESCAPE || key==K_ENTER)
00257      {
00258       
00259       InBox(168,135,216,147);
00260       WaitForMouseUp();
00261       if (key>0) delay(150);
00262       i=2;OutBox(168,135,216,147);
00263      }
00264   };
00265   if (i==2) {music_stop();return;} /* too poor for astronauts or NO */
00266   BarA=0;BarB=0;
00267   DrawAstSel(plr);
00268   
00269   ShBox(26,130+BarA*8,152,138+BarA*8); ShBox(187,130+BarB*8,313,138+BarB*8);
00270   
00271   memset(sel,-1,sizeof(sel));
00272   memset(MCol,0x00,sizeof(MCol));
00273   Men=(struct ManPool *) buffer;
00274   fin = sOpen("MEN.DAT","rb",1);   /* Open Astronaut Data File  */
00275   fseek(fin,((sizeof (struct ManPool))*106)*plr,SEEK_SET);
00276   fread(Men,(sizeof (struct ManPool))*106,1,fin);
00277   fclose(fin);
00278   switch(Data->P[plr].AstroLevel) {
00279     case 0: MaxMen=10;  MaxSel=ASTRO_POOL_LVL1;  Index=0;
00280         if (Data->P[plr].Female==1) {MaxMen+=3;fem=1;}
00281         Data->P[plr].Cash-=5;
00282         Data->P[plr].Spend[0][2]+=5;
00283         break;
00284     case 1: MaxMen=17;  MaxSel=ASTRO_POOL_LVL2;  Index=14;
00285         if (Data->P[plr].Female==1) {MaxMen+=3;fem=1;}
00286         break;
00287     case 2: MaxMen=19;  MaxSel=ASTRO_POOL_LVL3;  Index=35;
00288         if (Data->P[plr].Female==1) {MaxMen+=3;fem=1;}
00289         break;
00290     case 3: MaxMen=27;  MaxSel=ASTRO_POOL_LVL4;  Index=58;
00291         break;
00292     case 4: MaxMen=19;  MaxSel=ASTRO_POOL_LVL5;  Index=86;
00293         break;
00294   }; /* End of switch */
00295   Data->P[plr].Cash-=15;
00296   Data->P[plr].Spend[0][2]+=15;
00297   now=Index;max=Index+MaxMen;min=Index;
00298   now2=0;count=0;  /* counter for # selected */
00299   
00300   DispEight(now,BarB);
00301   DispEight2(now2,BarA,count);
00302   FadeIn(2,pal,10,0,0);
00303   
00304   WaitForMouseUp();
00305   while (1)
00306   {
00307    key=0;GetMouse();
00308    for (i=0;i<8;i++)
00309     {  // Right Select Box
00310      if (((x>=188 && y>=(131+i*8) && x<=312 && y<=(137+i*8) && mousebuttons>0)
00311       || (key==RT_ARROW && ksel==1)) && (now-BarB+i)<=max)
00312       {
00313         
00314        if (ksel==1) ksel=0;
00315          RectFill(186,129,314,195,0);
00316          now-=BarB; now+=i;BarB=i;
00317         ShBox(187,130+BarB*8,313,138+BarB*8);
00318         DispEight(now,BarB);
00319          WaitForMouseUp();
00320          
00321       }
00322      if (((x>=27 && y>=(131+i*8) && x<=151 && y<=(137+i*8) && mousebuttons>0)
00323       || (key==LT_ARROW && ksel==0)) && (now2-BarA+i)<=(count-1))
00324       { // Left Select Box
00325          
00326        if (ksel==0) ksel=1;
00327         RectFill(26,129,153,195,0);
00328         now2-=BarA; now2+=i;BarA=i;
00329         ShBox(26,130+BarA*8,152,138+BarA*8);
00330         DispEight2(now2,BarA,count);
00331          WaitForMouseUp();
00332          
00333       }
00334     }
00335     //else
00336     if (((x>=6 && y>=130 && x<=18 && y<=161 && mousebuttons>0) || (key==UP_ARROW && ksel==1)) && count>0)
00337      { /* Lft Up */
00338         InBox(6,130,18,161);
00339       for (i=0;i<50;i++)
00340        {
00341          key=0;
00342          GetMouse();
00343          delay(10);
00344          if (mousebuttons==0) {
00345         
00346          if (BarA==0)
00347          if (now2>0) {
00348           now2--;
00349           RectFill(26,129,153,195,0);
00350           ShBox(26,130+BarA*8,152,138+BarA*8);
00351           DispEight2(now2,BarA,count);
00352          };
00353          if (BarA>0) {
00354           RectFill(26,129,153,195,0);
00355           BarA--;now2--;
00356           ShBox(26,130+BarA*8,152,138+BarA*8);
00357           DispEight2(now2,BarA,count);
00358          };
00359           
00360          i=51;
00361         }
00362        }
00363       while (mousebuttons==1 || key==UP_ARROW)
00364        {
00365         delay(100);
00366         
00367          if (BarA==0)
00368          if (now2>0) {
00369           now2--;
00370           RectFill(26,129,153,195,0);
00371           ShBox(26,130+BarA*8,152,138+BarA*8);
00372           DispEight2(now2,BarA,count);
00373          };
00374          if (BarA>0) {
00375           RectFill(26,129,153,195,0);
00376           BarA--;now2--;
00377           ShBox(26,130+BarA*8,152,138+BarA*8);
00378           DispEight2(now2,BarA,count);
00379          };
00380           
00381         key=0;
00382         GetMouse();
00383        }
00384         //WaitForMouseUp();
00385          OutBox(6,130,18,161);delay(10);
00386      }
00387      else
00388      if (((x>=6 && y>=163 && x<=18 && y<=194 && mousebuttons>0) || (key==DN_ARROW && ksel==1)) && count>0)
00389       { /* Lft Dwn */
00390         InBox(6,163,18,194);
00391        for (i=0;i<50;i++)
00392        {
00393          key=0;
00394          GetMouse();
00395          delay(10);
00396          if (mousebuttons==0) {
00397          
00398         if (BarA==7)
00399          if (now2 < count-1) {
00400           now2++;
00401           RectFill(26,129,153,195,0);
00402           ShBox(26,130+BarA*8,152,138+BarA*8);
00403           DispEight2(now2,BarA,count);
00404          };
00405         if (BarA<7)
00406          if (now2<count-1) {
00407           RectFill(26,129,153,195,0);
00408           BarA++;now2++;
00409           ShBox(26,130+BarA*8,152,138+BarA*8);
00410           DispEight2(now2,BarA,count);
00411          };
00412          
00413          i=51;
00414         }
00415        }
00416       while (mousebuttons==1 || key==DN_ARROW)
00417        {
00418         delay(100);
00419         
00420         if (BarA==7)
00421          if (now2 < count-1) {
00422           now2++;
00423           RectFill(26,129,153,195,0);
00424           ShBox(26,130+BarA*8,152,138+BarA*8);
00425           DispEight2(now2,BarA,count);
00426          };
00427         if (BarA<7)
00428          if (now2<count-1) {
00429           RectFill(26,129,153,195,0);
00430           BarA++;now2++;
00431           ShBox(26,130+BarA*8,152,138+BarA*8);
00432           DispEight2(now2,BarA,count);
00433          };
00434         
00435         key=0;
00436         GetMouse();
00437        }
00438         // WaitForMouseUp();
00439           OutBox(6,163,18,194);delay(10);
00440       }
00441       else
00442       if ((x>=167 && y>=130 && x<=179 && y<=161 && mousebuttons>0) || (key==UP_ARROW && ksel==0))
00443        { /* Rt Up */
00444          InBox(167,130,179,161);
00445         for (i=0;i<50;i++)
00446        {
00447          key=0;
00448          GetMouse();
00449          delay(10);
00450          if (mousebuttons==0) {
00451          
00452           if (BarB==0)
00453            if (now > min) {
00454             now--;
00455             RectFill(186,129,314,195,0);
00456             ShBox(187,130+BarB*8,313,138+BarB*8);
00457             DispEight(now,BarB);
00458            };   
00459          if (BarB>0) {
00460           RectFill(186,129,314,195,0);
00461           BarB--;now--;
00462           ShBox(187,130+BarB*8,313,138+BarB*8);
00463           DispEight(now,BarB);
00464          };
00465         
00466          i=51;
00467         }
00468        }
00469       while (mousebuttons==1 || key==UP_ARROW)
00470        {
00471         delay(100);
00472         
00473           if (BarB==0)
00474            if (now > min) {
00475             now--;
00476             RectFill(186,129,314,195,0);
00477             ShBox(187,130+BarB*8,313,138+BarB*8);
00478             DispEight(now,BarB);
00479            };   
00480          if (BarB>0) {
00481           RectFill(186,129,314,195,0);
00482           BarB--;now--;
00483           ShBox(187,130+BarB*8,313,138+BarB*8);
00484           DispEight(now,BarB);
00485          };
00486         
00487         key=0;
00488         GetMouse();
00489        }
00490          // WaitForMouseUp();
00491           OutBox(167,130,179,161);delay(10);
00492         }
00493       else
00494       if ((x>=167 && y>=163 && x<=179 && y<=194 && mousebuttons>0) || (key==DN_ARROW && ksel==0))
00495        { /* Rt Dwn */
00496           InBox(167,163,179,194);
00497          for (i=0;i<50;i++)
00498        {
00499          key=0;
00500          GetMouse();
00501          delay(10);
00502          if (mousebuttons==0) {
00503          
00504           if (BarB==7)
00505            if (now <= max) {
00506            if (now<max) now++;
00507            RectFill(186,129,314,195,0);
00508            ShBox(187,130+BarB*8,313,138+BarB*8);
00509            DispEight(now,BarB);
00510           };
00511          if (BarB<7) {
00512           RectFill(186,129,314,195,0);
00513           BarB++;now++;
00514           ShBox(187,130+BarB*8,313,138+BarB*8);
00515           DispEight(now,BarB);
00516          };
00517          
00518           i=51;
00519         }
00520        }
00521       while (mousebuttons==1 || key==DN_ARROW)
00522        {
00523         delay(100);
00524         
00525           if (BarB==7)
00526            if (now <= max) {
00527            if (now<max) now++;
00528            RectFill(186,129,314,195,0);
00529            ShBox(187,130+BarB*8,313,138+BarB*8);
00530            DispEight(now,BarB);
00531           };
00532          if (BarB<7) {
00533           RectFill(186,129,314,195,0);
00534           BarB++;now++;
00535           ShBox(187,130+BarB*8,313,138+BarB*8);
00536           DispEight(now,BarB);
00537          };
00538         
00539         key=0;
00540         GetMouse();
00541        }
00542         // WaitForMouseUp();
00543          OutBox(167,163,179,194);delay(10);
00544        }
00545       else
00546       if ((x>=7 && y>=111 && x<=151 && y<=123 && count>0 && mousebuttons>0) || (key=='D' && count>0))
00547        { /* Dismiss */
00548          InBox(7,111,151,123);
00549          count--;
00550           MCol[sel[now2]]=0;
00551           for (i=now2;i<count+1;i++)
00552          sel[i]=sel[i+1];
00553       sel[i]=-1;  /* remove astronaut from left */
00554       if (now2==count) {
00555         if (now2>0) now2--;
00556         if (BarA>0) BarA--;
00557       };
00558       RectFill(26,129,153,195,0);
00559       ShBox(26,130+BarA*8,152,138+BarA*8);
00560       DispEight2(now2,BarA,count);
00561       DispEight(now,BarB);
00562       
00563       WaitForMouseUp();
00564         if (key>0) delay(110);
00565       OutBox(7,111,151,123);
00566        }
00567       else
00568       if ((x>=164 && y>=111 && x<=313 && y<=123 && MCol[now]==0 && mousebuttons>0) || (key=='R' && MCol[now]==0))
00569        { /* Recruit */
00570          InBox(168,111,313,123);
00571          if (count<MaxSel) {
00572            sel[count]=now; /* move astronaut into left */
00573            MCol[now]=1;
00574            count++;
00575            if (BarB==7)
00576              if (now < max) {
00577                now++;
00578                RectFill(186,129,314,195,0);
00579                ShBox(187,130+BarB*8,313,138+BarB*8);
00580                DispEight(now,BarB);
00581              };
00582            if (BarB<7) {
00583              RectFill(186,129,314,195,0);
00584              BarB++;now++;
00585              ShBox(187,130+BarB*8,313,138+BarB*8);
00586              DispEight(now,BarB);
00587            };
00588 
00589           RectFill(26,129,153,195,0);
00590           ShBox(26,130+BarA*8,152,138+BarA*8);
00591           DispEight2(now2,BarA,count);
00592        };
00593        
00594        WaitForMouseUp();
00595       if (key>0) delay(110);
00596        OutBox(168,111,313,123);
00597      };
00598 
00599       if ((x>=245 && y>=5 && x<=314 && y<=17 && mousebuttons>0) || key==K_ENTER) {   /* Exit - not til done */
00600        if (fem==1) {
00601          j=0;
00602          for (i=0;i<count;i++) if (Men[sel[i]].Sex==1) j++;
00603          if (j>0) fem=0;
00604          else Help("i100");
00605          }
00606        if (fem==0 && count == MaxSel) {
00607      InBox(245,5,314,17);
00608      WaitForMouseUp();
00609     if (key>0) delay(150);
00610      for (i=0;i<count;i++) {
00611        strcpy(&Data->P[plr].Pool[i+Data->P[plr].AstroCount].Name[0],&Men[sel[i]].Name[0]);
00612        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Sex=Men[sel[i]].Sex;
00613        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Cap=Men[sel[i]].Cap;
00614        Data->P[plr].Pool[i+Data->P[plr].AstroCount].LM=Men[sel[i]].LM;
00615        Data->P[plr].Pool[i+Data->P[plr].AstroCount].EVA=Men[sel[i]].EVA;
00616        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Docking=Men[sel[i]].Docking;
00617        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Endurance=Men[sel[i]].Endurance;
00618        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Status=4;
00619        Data->P[plr].Pool[i+Data->P[plr].AstroCount].TrainingLevel=1;
00620        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Group=Data->P[plr].AstroLevel;
00621        Data->P[plr].Pool[i+Data->P[plr].AstroCount].CR=random(2)+1;
00622        Data->P[plr].Pool[i+Data->P[plr].AstroCount].CL=random(2)+1;
00623        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Task=0;
00624        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Crew=0;
00625        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Una=0;
00626        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Pool=0;
00627        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Compat=random(10)+1;
00628        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Mood=85+5*random(4);
00629        Data->P[plr].Pool[i+Data->P[plr].AstroCount].Face=random(77);
00630        if (Data->P[plr].Pool[i+Data->P[plr].AstroCount].Sex==1) 
00631          Data->P[plr].Pool[i+Data->P[plr].AstroCount].Face=77+random(8);    
00632        k=random(10)+1;
00633        if (k>6) {
00634          k=random(2);
00635          if (k==0) Data->P[plr].Pool[i+Data->P[plr].AstroCount].Endurance--;
00636          else Data->P[plr].Pool[i+Data->P[plr].AstroCount].Cap--;
00637        };
00638        for (j=0;j<3;j++) {
00639          k=random(3);
00640          switch(k)
00641          {
00642            case 0: Data->P[plr].Pool[i+Data->P[plr].AstroCount].LM--;
00643                break;
00644            case 1: Data->P[plr].Pool[i+Data->P[plr].AstroCount].EVA--;
00645                break;
00646            case 2: Data->P[plr].Pool[i+Data->P[plr].AstroCount].Docking--;
00647                break;
00648            default: break;
00649          }
00650        };
00651      };
00652      Data->P[plr].AstroLevel++;
00653      Data->P[plr].AstroCount+=count;
00654        switch(Data->P[plr].AstroLevel) {
00655          case 1:Data->P[plr].AstroDelay=6;break;
00656          case 2: case 3: Data->P[plr].AstroDelay=4;break;
00657          case 4: Data->P[plr].AstroDelay=8;break;
00658          case 5: Data->P[plr].AstroDelay=99;break;
00659       };
00660      OutBox(245,5,314,17);
00661     music_stop();
00662      return;  /* Done */
00663        };
00664       };
00665   }
00666 }

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