00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "gamedata.h"
00027 #include "Buzz_inc.h"
00028 #include "externs.h"
00029
00030 #define Guy(a,b,c,d) (Data->P[a].Crew[b][c][d]-1)
00031
00032 int ALSpec(int att)
00033 {
00034 int col=0;
00035 if (att>=65) col=16;
00036 if (att<65 && att>=40) col=11;
00037 if (att<40 && att>=20) col=8;
00038 if (att<20) col=0;
00039 if (att==0) col=3;
00040 return col;
00041 }
00042
00043 void AstLevel(char plr,char prog,char crew,char ast)
00044 {
00045 GXHEADER local;
00046 int i,k,man,over=0,temp,val;
00047 char Compat[5],cnt;
00048 i=man=Guy(plr,prog,crew,ast);
00049
00050 cnt=0;for (k=0;k<5;k++) Compat[k]=0;
00051
00052 switch (Data->P[plr].Pool[i].Compat) {
00053 case 1:
00054 if (Data->P[plr].Pool[i].CL==2) Compat[cnt++]=9;
00055 Compat[cnt++]=10;
00056 Compat[cnt++]=1;
00057 Compat[cnt++]=2;
00058 if (Data->P[plr].Pool[i].CR==2) Compat[cnt++]=3;
00059 break;
00060
00061 case 2:
00062 if (Data->P[plr].Pool[i].CL==2) Compat[cnt++]=10;
00063 Compat[cnt++]=1;
00064 Compat[cnt++]=2;
00065 Compat[cnt++]=3;
00066 if (Data->P[plr].Pool[i].CR==2) Compat[cnt++]=4;
00067 break;
00068
00069 case 3: case 4: case 5: case 6: case 7: case 8:
00070 if (Data->P[plr].Pool[i].CL==2) Compat[cnt++]=Data->P[plr].Pool[i].Compat-2;
00071 Compat[cnt++]=Data->P[plr].Pool[i].Compat-1;
00072 Compat[cnt++]=Data->P[plr].Pool[i].Compat;
00073 Compat[cnt++]=Data->P[plr].Pool[i].Compat+1;
00074 if (Data->P[plr].Pool[i].CR==2) Compat[cnt++]=Data->P[plr].Pool[i].Compat+2;
00075 break;
00076
00077 case 9:
00078 if (Data->P[plr].Pool[i].CL==2) Compat[cnt++]=7;
00079 Compat[cnt++]=8;
00080 Compat[cnt++]=9;
00081 Compat[cnt++]=10;
00082 if (Data->P[plr].Pool[i].CR==2) Compat[cnt++]=1;
00083 break;
00084
00085 case 10:
00086 if (Data->P[plr].Pool[i].CL==2) Compat[cnt++]=8;
00087 Compat[cnt++]=9;
00088 Compat[cnt++]=10;
00089 Compat[cnt++]=1;
00090 if (Data->P[plr].Pool[i].CR==2) Compat[cnt++]=2;
00091 break;
00092 };
00093
00094 GV(&local,143,74);
00095
00096 gxGetImage(&local,94,38,236,111,0);
00097 ShBox(94,38,236,95);
00098 InBox(98,41,232,61);RectFill(99,42,231,60,7+plr*3);
00099
00100 grSetColor(12);PrintAt(115,48,"COMPATABILITY");
00101
00102 over=0;val=0;
00103 for (i=0;i<Data->P[plr].Gcnt[prog][crew];i++) {
00104 if (man!=Guy(plr,prog,crew,i)) {
00105 temp=0;
00106 for (k=0;k<cnt;k++)
00107 if (Compat[k]==Data->P[plr].Pool[Guy(plr,prog,crew,i)].Compat) temp++;
00108
00109 if ((plr==1 && Data->Def.Ast2==0) || (plr==0 && Data->Def.Ast1==0)) {
00110 InBox(111,66+9*val,119,72+9*val);
00111 if (temp==0) {RectFill(112,67+9*val,118,71+9*val,9);over++;}
00112 else RectFill(112,67+9*val,118,71+9*val,16);
00113 grSetColor(1);
00114 PrintAt(122,71+9*val,Data->P[plr].Pool[Guy(plr,prog,crew,i)].Name);
00115 }
00116 else if (temp==0) over++;
00117 val++;
00118 }
00119 }
00120 switch(prog) {
00121 case 1: i=16; break;
00122 case 2: i=(over==1)? 9 : 16; break;
00123 case 3: i=(over==1)? 11 : ((over==2) ?9:16) ; break;
00124 case 4: i=(over==1)? 11 : ((over==2) ?9:16) ; break;
00125 case 5: i=(over==1)? 11 : ((over>=2) ?9:16) ; break;
00126 default: i=16;break;
00127 }
00128
00129
00130 if ((plr==1 && Data->Def.Ast2==1) || (plr==0 && Data->Def.Ast1==1)) {
00131 InBox(111,66,119,72);
00132 RectFill(112,67,118,71,i);
00133 grSetColor(1);
00134 PrintAt(122,71,"CREW RELATIONSHIP");
00135 }
00136
00137 if ((plr==1 && Data->Def.Ast2==2) || (plr==0 && Data->Def.Ast1==2)) {
00138 grSetColor(1);
00139 PrintAt(111,71,"NO INFO AT THIS LEVEL");
00140 }
00141
00142
00143
00144
00145 grSetColor(11); PrintAt(124,57,Data->P[plr].Pool[man].Name);
00146
00147 PrintAt(0,0," M:");DispNum(0,0,Data->P[plr].Pool[man].Mood);
00148
00149 key=0;
00150 if (mousebuttons) WaitForMouseUp();
00151 else while (key==0) GetMouse();
00152
00153 gxPutImage(&local,gxSET,94,38,0);
00154 DV(&local);
00155 return;
00156 }
00157
00158
00159 void PlaceEquip(char plr,char prog)
00160 {
00161 int i;
00162 FILE *fin;
00163 GXHEADER local,local2;
00164 SimpleHdr table;
00165
00166 GV(&local,80,50);GV(&local2,80,50);
00167 fin=sOpen("APROG.BUT","rb",0);
00168 fseek(fin,(plr*7+prog)*sizeof_SimpleHdr,SEEK_SET);
00169 fread_SimpleHdr(&table,1,fin);
00170 fseek(fin,14*sizeof_SimpleHdr,SEEK_SET);
00171 fread(&pal[0],768,1,fin);
00172
00173 fseek(fin,table.offset,SEEK_SET);
00174 fread(buffer,table.size,1,fin);
00175 fclose(fin);
00176 RLED_img(buffer,local.vptr,table.size,local.w,local.h);
00177 gxGetImage(&local2,61,28,140,77,0);
00178 for (i=0;i<4000;i++) {
00179 if (local.vptr[i]!=0) local2.vptr[i]=local.vptr[i];
00180 }
00181 gxPutImage(&local,gxSET,61,28,0);
00182 DV(&local),DV(&local2);
00183 return;
00184 }
00185
00186 void DrawProgs(char plr,char prog)
00187 {
00188 int i,j,Name[30];
00189 strcpy((char *)Name,Data->P[plr].Manned[prog-1].Name);
00190 strcat((char *)Name," PROGRAM");
00191 FadeOut(2,pal,10,0,0);
00192 gxClearDisplay(0,0);
00193 grSetColor(1);
00194 ShBox(0,0,319,22);ShBox(0,24,319,81);ShBox(0,83,319,123);
00195 ShBox(0,125,158,199);ShBox(161,125,319,199);
00196 RectFill(25,129,153,195,0);RectFill(5,129,19,195,0);
00197 ShBox(6,130,18,161);ShBox(6,163,18,194);
00198 IOBox(243,86,316,102);IOBox(243,104,316,120);
00199 IOBox(243,3,316,19);
00200 InBox(4,128,20,196);InBox(24,128,154,196);
00201 InBox(60,27,141,78);InBox(3,3,30,19);
00202 UPArrow(9,133);DNArrow(9,166);
00203 PlaceEquip(plr,prog-1);
00204 for (j=0;j<2;j++)
00205 for (i=0;i<4;i++) ShBox(164+77*j,139+i*15,238+77*j,151+i*15);
00206 ShBox(4,86,12,92);
00207 if (prog>=2) ShBox(4,95,12,101);
00208 if (prog>=3) ShBox(4,104,12,110);
00209 if (prog==5) ShBox(4,113,12,119);
00210 FlagSm(plr,4,4);
00211 grSetColor(1);
00212 PrintAt(251,96,"ASSIGN CREW");
00213 PrintAt(253,114,"BREAK CREW");
00214 PrintAt(258,13,"CONTINUE");
00215 grSetColor(5);
00216 PrintAt(185,133,"FLIGHT CREW SELECTION");
00217 grSetColor(7);
00218 PrintAt(152,35,&Data->P[plr].Manned[prog-1].Name[0]);
00219 grSetColor(9);
00220 if (prog==1) PrintAt(152,43,"ONE");
00221 if (prog==2) PrintAt(152,43,"TWO");
00222 if (prog==3 || prog==4) PrintAt(152,43,"THREE");
00223 if (prog==5) PrintAt(152,43,"FOUR");
00224 PrintAt(0,0," PERSON CAPACITY");
00225 grSetColor(7);
00226 PrintAt(152,51,"SAFETY FACTOR: ");
00227 grSetColor(11);
00228 DispNum(0,0,Data->P[plr].Manned[prog-1].Safety);PrintAt(0,0," %");
00229 grSetColor(7);
00230 PrintAt(152,59,"UNIT WEIGHT: ");
00231 grSetColor(11);
00232 DispNum(0,0,Data->P[plr].Manned[prog-1].UnitWeight);
00233 grSetColor(7);
00234 PrintAt(152,67,"DURATION: ");
00235 grSetColor(11);
00236 DispNum(0,0,Data->P[plr].Manned[prog-1].Duration);PrintAt(0,0," DAYS");
00237 grSetColor(7);
00238 PrintAt(152,75,"AVOID FAILURE: ");
00239 grSetColor(11);
00240 if (Data->P[plr].Manned[prog-1].SaveCard>0) PrintAt(0,0,"YES");
00241 else PrintAt(0,0,"NO");
00242 grSetColor(1);
00243 DispBig(40,5,(char *)Name,0,-1);
00244 return;
00245 }
00246
00247
00248
00249
00250
00251
00252
00253 int CheckProgram(char plr,char prog)
00254 {
00255 int check,i;
00256 check=0;
00257 for (i=0;i<Data->P[plr].AstroCount;i++)
00258 if (Data->P[plr].Pool[i].Crew!=0)
00259 ++check;
00260 if (check>0) return(1);
00261 check=0;
00262 for (i=0;i<Data->P[plr].AstroCount;i++)
00263 if (Data->P[plr].Pool[i].Assign==prog)
00264 ++check;
00265 if (prog>=1 && prog<=3 && check>=prog) return(2);
00266 else if ((prog==4 || prog==5) && check>=prog-1) return(2);
00267 else
00268 for (i=0;i<Data->P[plr].AstroCount;i++)
00269 if (Data->P[plr].Pool[i].Assign==prog)
00270 Data->P[plr].Pool[i].Assign=0;
00271 return(0);
00272 }
00273
00274 void FixPrograms(char plr)
00275 {
00276 int i;
00277 for (i=0;i<7;i++)
00278 {
00279 if (Data->P[plr].Manned[i].DCost>0 && Data->P[plr].Manned[i].DCost<=Data->P[plr].Cash)
00280 DamProb(plr,2,i);
00281 };
00282 for (i=0;i<5;i++)
00283 {
00284 if (Data->P[plr].Rocket[i].DCost>0 && Data->P[plr].Rocket[i].DCost<=Data->P[plr].Cash)
00285 DamProb(plr,1,i);
00286 };
00287 for (i=0;i<4;i++)
00288 {
00289 if (Data->P[plr].Misc[i].DCost>0 && Data->P[plr].Misc[i].DCost<=Data->P[plr].Cash)
00290 DamProb(plr,3,i);
00291 };
00292 for (i=0;i<3;i++)
00293 {
00294 if (Data->P[plr].Probe[i].DCost>0 && Data->P[plr].Probe[i].DCost<=Data->P[plr].Cash)
00295 DamProb(plr,0,i);
00296 };
00297 return;
00298 }
00299
00300 void DamProb(char plr,char prog,int chk)
00301 {
00302 int D_Cost,Saf_Loss;
00303 char Digit[4],Name[30];
00304
00305 Saf_Loss = D_Cost = 0;
00306
00307 FadeOut(2,pal,10,0,0);
00308
00309 gxClearDisplay(0,0);
00310 switch(prog)
00311 {
00312 case 0:D_Cost=Data->P[plr].Probe[chk].DCost;
00313 Saf_Loss=Data->P[plr].Probe[chk].Damage;
00314 strcpy((char *)Name,Data->P[plr].Probe[chk].Name);
00315 break;
00316 case 1:D_Cost=Data->P[plr].Rocket[chk].DCost;
00317 Saf_Loss=Data->P[plr].Rocket[chk].Damage;
00318 strcpy((char *)Name,Data->P[plr].Rocket[chk].Name);
00319 break;
00320 case 2:D_Cost=Data->P[plr].Manned[chk].DCost;
00321 Saf_Loss=Data->P[plr].Manned[chk].Damage;
00322 strcpy((char *)Name,Data->P[plr].Manned[chk].Name);
00323 break;
00324 case 3:D_Cost=Data->P[plr].Misc[chk].DCost;
00325 Saf_Loss=Data->P[plr].Misc[chk].Damage;
00326 strcpy((char *)Name,Data->P[plr].Misc[chk].Name);
00327 break;
00328 default:break;
00329 }
00330 ShBox(35,81,288,159);InBox(40,86,111,126);InBox(116,86,283,126);
00331 IOBox(116,130,189,155);IOBox(201,130,274,155);Flag(41,87,plr);
00332 DispBig(121,135,"YES",1,0);DispBig(208,135,"NO",1,0);
00333 DispBig(44,135,"REPAIR",1,-1);
00334 grSetColor(6);
00335 PrintAt(121,95,"DIRECTOR: ");
00336 grSetColor(8);
00337 if (plr==0) PrintAt(0,0,&Data->P[Data->plr[0]].Name[0]);
00338 else PrintAt(0,0,&Data->P[Data->plr[1]].Name[0]);
00339 grSetColor(6);PrintAt(121,104,"DAMAGE: ");
00340 grSetColor(11);
00341 strcat((char *)Name," PROGRAM");
00342 PrintAt(0,0,&Name[0]);
00343 grSetColor(6);
00344 PrintAt(121,113,"DAMAGE COST: ");
00345 grSetColor(1);
00346 sprintf(&Digit[0],"%d",D_Cost);PrintAt(0,0,&Digit[0]);
00347 PrintAt(0,0," M.B.");
00348 grSetColor(6);
00349 PrintAt(121,122,"SAFETY LOSS: ");
00350 grSetColor(1);
00351 sprintf(&Digit[0],"%d",Saf_Loss);PrintAt(0,0,&Digit[0]);
00352 PrintAt(0,0,"%");
00353 FadeIn(2,pal,10,0,0);
00354
00355 WaitForMouseUp();
00356 while(1)
00357 {
00358 key=0;GetMouse();
00359 if (mousebuttons>0 || key>0)
00360 {
00361 if ((x>=118 && y>=132 && x<=187 && y<=153 && mousebuttons>0) || key=='Y')
00362 {
00363 InBox(118,132,187,153);
00364 WaitForMouseUp();
00365 if (key>0) delay(150);
00366 Data->P[plr].Cash-=D_Cost;
00367 switch(prog)
00368 {
00369 case 0:Data->P[plr].Probe[chk].DCost=0;
00370 Data->P[plr].Probe[chk].Damage=0;
00371 break;
00372 case 1:Data->P[plr].Rocket[chk].DCost=0;
00373 Data->P[plr].Rocket[chk].Damage=0;
00374 break;
00375 case 2:Data->P[plr].Manned[chk].DCost=0;
00376 Data->P[plr].Manned[chk].Damage=0;
00377 break;
00378 case 3:Data->P[plr].Misc[chk].DCost=0;
00379 Data->P[plr].Misc[chk].Damage=0;
00380 break;
00381 default:break;
00382 }
00383 return;
00384 }
00385 else
00386 if ((x>=203 && y>=132 && x<=272 && y<=153 && mousebuttons>0) || key=='N')
00387 {
00388 InBox(203,132,272,153);
00389 WaitForMouseUp();
00390 if (key>0) delay(150);
00391 return;
00392 }
00393 }
00394 }
00395 }
00396
00397
00398 void CrewProb(char plr,char prog)
00399 {
00400 if (prog)EMPTY_BODY;
00401
00402 ShBox(75,43,244,173);IOBox(81,152,238,167); InBox(81,70,238,106);
00403 RectFill(82,71,237,105,7+3*plr);
00404 grSetColor(11);
00405 PrintAt(136,162,"CONTINUE");
00406 DispBig(122,50,"PROBLEM",0,-1);
00407 PrintAt(90,80,"THERE ARE CURRENTLY NOT");
00408 PrintAt(90,88,"ENOUGH ");
00409 if (plr==1) PrintAt(0,0,"COSM");
00410 else PrintAt(0,0,"ASTR"); PrintAt(0,0,"ONAUTS IN THE");
00411 PrintAt(90,96,"PROGRAM TO ASSIGN CREWS");
00412
00413 WaitForMouseUp();
00414 while(1)
00415 {
00416 key=0;GetMouse();
00417 if (mousebuttons>0 || key>0)
00418 {
00419 if ((x>=83 && y>=154 && x<=236 && y<=165 && mousebuttons>0) || key==K_ENTER || key==K_ESCAPE)
00420 {
00421 InBox(83,154,236,165);
00422 WaitForMouseUp();
00423 if (key>0) delay(150);
00424 return;
00425 }
00426 }
00427 }
00428 }
00429
00430 void DrawPosition(char prog,int pos)
00431 {
00432
00433 grSetColor(5);
00434 switch(pos)
00435 {
00436 case 1: if (prog==1) PrintAt(17,91,"CAPSULE PILOT - EVA SPECIALIST");
00437 else if (prog==2) PrintAt(17,91,"CAPSULE PILOT - DOCKING SPECIALIST");
00438 else if (prog>=3)
00439 PrintAt(17,91,"COMMAND PILOT");
00440 break;
00441 case 2: if (prog>1 && prog<5)
00442 PrintAt(17,100,"LM PILOT - EVA SPECIALIST");
00443 else if (prog==5) PrintAt(17,100,"LUNAR PILOT");
00444 break;
00445 case 3: if (prog>2 && prog<5)
00446 PrintAt(17,109,"DOCKING SPECIALIST");
00447 else if (prog==5) PrintAt(17,109,"EVA SPECIALIST");
00448 break;
00449 case 4: if (prog==5) PrintAt(17,118,"EVA SPECIALIST");
00450 break;
00451 default:break;
00452 }
00453 grSetColor(1);
00454
00455 return;
00456 }
00457
00458
00459 void Programs(char plr,char prog)
00460 {
00461 int now2,BarA,count,i,M[100],grp,Gcnt[8],max,chk,tst;
00462 char ksel=0;
00463 strcpy(IDT,"i036");strcpy(IKEY,"k036");
00464
00465 for (i=0;i<100;i++) M[i]=-1;
00466 max=prog;
00467 if (max>4) max=4;
00468 if (prog==4) max=3;
00469 now2=0;BarA=count=grp=0;
00470 music_start(M_PRGMTRG);
00471 DrawProgs(plr,prog);
00472 Flts(0,0);
00473 for (i=0;i<8;i++) {
00474 Gcnt[i]=Data->P[plr].Gcnt[prog][i];
00475 if (Gcnt[i]==0) FltsTxt(i,8);
00476 if (Gcnt[i]<max && Gcnt[i]!=0) FltsTxt(i,9);
00477 if (Gcnt[i]==max) FltsTxt(i,1);
00478 };
00479 for (i=0;i<Data->P[plr].AstroCount;i++)
00480 if (Data->P[plr].Pool[i].Assign==prog && Data->P[plr].Pool[i].Crew==0) {
00481 M[count++]=i;
00482 };
00483 ShBox(26,130+BarA*8,152,138+BarA*8);
00484 DispLeft(plr,BarA,count,now2,&M[0]);
00485 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00486 Data->P[plr].Crew[prog][grp][1],
00487 Data->P[plr].Crew[prog][grp][2],
00488 Data->P[plr].Crew[prog][grp][3]);
00489 FadeIn(2,pal,10,0,0);
00490 chk=CheckProgram(plr,prog);
00491
00492 if (chk==0) {if (plr==0) Help("i113");else Help("i114");music_stop();return;}
00493 WaitForMouseUp();
00494 while (1)
00495 {
00496 key=0;GetMouse();
00497 for (i=0;i<8;i++) {
00498 if (x>=27 && y>=(131+i*8) && x<=151 && y<=(137+i*8) && mousebuttons>0 && (now2-BarA+i)<=(count-1)) {
00499
00500 now2-=BarA; now2+=i; BarA=i;
00501 RectFill(26,129,153,195,0);
00502 DispLeft(plr,BarA,count,now2,&M[0]);
00503 ShBox(26,130+BarA*8,152,138+BarA*8);
00504 BarSkill(plr,BarA,now2,&M[0]);
00505 WaitForMouseUp();
00506 ShBox(26,130+BarA*8,152,138+BarA*8);
00507 DispLeft(plr,BarA,count,now2,&M[0]);
00508
00509 }
00510 }
00511 if (mousebuttons > 0 || key>0)
00512 {
00513 if (((x>=6 && y>=130 && x<=18 && y<=161 && mousebuttons>0) || key==UP_ARROW) && count>0)
00514 {
00515 InBox(6,130,18,161);
00516 for (i=0;i<50;i++)
00517 {
00518 key=0;
00519 GetMouse();
00520 delay(10);
00521 if (mousebuttons==0) {
00522
00523 if (BarA==0)
00524 if (now2>0) {
00525 now2--;
00526 RectFill(26,129,153,195,0);
00527 ShBox(26,130+BarA*8,152,138+BarA*8);
00528 DispLeft(plr,BarA,count,now2,&M[0]);
00529 };
00530 if (BarA>0) {
00531 RectFill(26,129,153,195,0);
00532 BarA--;now2--;
00533 ShBox(26,130+BarA*8,152,138+BarA*8);
00534 DispLeft(plr,BarA,count,now2,&M[0]);
00535 };
00536
00537 i=51;
00538 }
00539 }
00540 while (mousebuttons==1 || key==UP_ARROW)
00541 {
00542 delay(100);
00543
00544 if (BarA==0)
00545 if (now2>0) {
00546 now2--;
00547 RectFill(26,129,153,195,0);
00548 ShBox(26,130+BarA*8,152,138+BarA*8);
00549 DispLeft(plr,BarA,count,now2,&M[0]);
00550 };
00551 if (BarA>0) {
00552 RectFill(26,129,153,195,0);
00553 BarA--;now2--;
00554 ShBox(26,130+BarA*8,152,138+BarA*8);
00555 DispLeft(plr,BarA,count,now2,&M[0]);
00556 };
00557
00558 key=0;
00559 GetMouse();
00560 }
00561 OutBox(6,130,18,161);delay(10);
00562 }
00563 else
00564 if (key=='S')
00565 {
00566
00567 ShBox(26,130+BarA*8,152,138+BarA*8);
00568 BarSkill(plr,BarA,now2,&M[0]);
00569
00570 }
00571 else
00572 if (((x>=6 && y>=163 && x<=18 && y<=194 && mousebuttons>0) || key==DN_ARROW) && count>0)
00573 {
00574 InBox(6,163,18,194);
00575 for (i=0;i<50;i++)
00576 {
00577 key=0;
00578 GetMouse();
00579 delay(10);
00580 if (mousebuttons==0) {
00581
00582 if (BarA==7)
00583 if (now2 < count-1) {
00584 now2++;
00585 RectFill(26,129,153,195,0);
00586 ShBox(26,130+BarA*8,152,138+BarA*8);
00587 DispLeft(plr,BarA,count,now2,&M[0]);
00588 };
00589 if (BarA<7)
00590 if (now2<count-1) {
00591 RectFill(26,129,153,195,0);
00592 BarA++;now2++;
00593 ShBox(26,130+BarA*8,152,138+BarA*8);
00594 DispLeft(plr,BarA,count,now2,&M[0]);
00595 };
00596
00597 i=51;
00598 }
00599 }
00600 while (mousebuttons==1 || key==DN_ARROW)
00601 {
00602 delay(100);
00603
00604 if (BarA==7)
00605 if (now2 < count-1) {
00606 now2++;
00607 RectFill(26,129,153,195,0);
00608 ShBox(26,130+BarA*8,152,138+BarA*8);
00609 DispLeft(plr,BarA,count,now2,&M[0]);
00610 };
00611 if (BarA<7)
00612 if (now2<count-1) {
00613 RectFill(26,129,153,195,0);
00614 BarA++;now2++;
00615 ShBox(26,130+BarA*8,152,138+BarA*8);
00616 DispLeft(plr,BarA,count,now2,&M[0]);
00617 };
00618
00619 key=0;
00620 GetMouse();
00621 }
00622
00623 OutBox(6,163,18,194);
00624 }
00625 else
00626 if (((x>=4 && y>=86 && x<=12 && y<=92 && mousebuttons>0) || key=='1') && Gcnt[grp]>=1)
00627 {
00628 InBox(4,86,12,92);
00629 AstLevel(plr,prog,grp,0);
00630 OutBox(4,86,12,92);
00631 }
00632 else
00633 if (((x>=4 && y>=95 && x<=12 && y<=101 && mousebuttons>0) || key=='2') && prog>=2 && Gcnt[grp]>=2)
00634 {
00635 InBox(4,95,12,101);
00636 AstLevel(plr,prog,grp,1);
00637 OutBox(4,95,12,101);
00638 }
00639 else
00640 if (((x>=4 && y>=104 && x<=12 && y<=110 && mousebuttons>0) || key=='3') && prog>=3 && Gcnt[grp]>=3)
00641 {
00642 InBox(4,104,12,110);
00643 AstLevel(plr,prog,grp,2);
00644 OutBox(4,104,12,110);
00645 }
00646 else
00647 if (((x>=4 && y>=113 && x<=12 && y<=119 && mousebuttons>0) || key=='4') && prog>=5 && Gcnt[grp]>=4)
00648 {
00649 InBox(4,113,12,119);
00650 AstLevel(plr,prog,grp,3);
00651 OutBox(4,113,12,119);
00652 }
00653 else
00654 if (key=='C')
00655 {
00656 ClearIt();
00657 ksel=grp;
00658 if (grp==7) grp=0;
00659 else ++grp;
00660 Flts(ksel,grp);
00661 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00662 Data->P[plr].Crew[prog][grp][1],
00663 Data->P[plr].Crew[prog][grp][2],
00664 Data->P[plr].Crew[prog][grp][3]);
00665 if (key>0) delay(150);
00666 }
00667 else
00668 if (x>=164 && y>=139 && x<=238 && y<=151 && mousebuttons>0)
00669 {
00670 ClearIt();
00671 Flts(grp,0);grp=0;
00672 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00673 Data->P[plr].Crew[prog][grp][1],
00674 Data->P[plr].Crew[prog][grp][2],
00675 Data->P[plr].Crew[prog][grp][3]);
00676 WaitForMouseUp();
00677 }
00678 else
00679 if (x>=164 && y>=154 && x<=238 && y<=166 && mousebuttons>0)
00680 {
00681 ClearIt();
00682 Flts(grp,1);grp=1;
00683 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00684 Data->P[plr].Crew[prog][grp][1],
00685 Data->P[plr].Crew[prog][grp][2],
00686 Data->P[plr].Crew[prog][grp][3]);
00687 WaitForMouseUp();
00688 }
00689 else
00690 if (x>=164 && y>=169 && x<=238 && y<=181 && mousebuttons>0)
00691 {
00692 ClearIt();
00693 Flts(grp,2);grp=2;
00694 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00695 Data->P[plr].Crew[prog][grp][1],
00696 Data->P[plr].Crew[prog][grp][2],
00697 Data->P[plr].Crew[prog][grp][3]);
00698 WaitForMouseUp();
00699 }
00700 else
00701 if (x>=164 && y>=184 && x<=238 && y<=196 && mousebuttons>0)
00702 {
00703 ClearIt();
00704 Flts(grp,3);grp=3;
00705 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00706 Data->P[plr].Crew[prog][grp][1],
00707 Data->P[plr].Crew[prog][grp][2],
00708 Data->P[plr].Crew[prog][grp][3]);
00709 WaitForMouseUp();
00710 }
00711 else
00712 if (x>=241 && y>=139 && x<=315 && y<=151 && mousebuttons>0)
00713 {
00714 ClearIt();
00715 Flts(grp,4);grp=4;
00716 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00717 Data->P[plr].Crew[prog][grp][1],
00718 Data->P[plr].Crew[prog][grp][2],
00719 Data->P[plr].Crew[prog][grp][3]);
00720 WaitForMouseUp();
00721 }
00722 else
00723 if (x>=241 && y>=154 && x<=315 && y<=166 && mousebuttons>0)
00724 {
00725 ClearIt();
00726 Flts(grp,5);grp=5;
00727 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00728 Data->P[plr].Crew[prog][grp][1],
00729 Data->P[plr].Crew[prog][grp][2],
00730 Data->P[plr].Crew[prog][grp][3]);
00731 WaitForMouseUp();
00732 }
00733 else
00734 if (x>=241 && y>=169 && x<=315 && y<=181 && mousebuttons>0)
00735 {
00736 ClearIt();
00737 Flts(grp,6);grp=6;
00738 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00739 Data->P[plr].Crew[prog][grp][1],
00740 Data->P[plr].Crew[prog][grp][2],
00741 Data->P[plr].Crew[prog][grp][3]);
00742 WaitForMouseUp();
00743 }
00744 else
00745 if (x>=241 && y>=184 && x<=315 && y<=196 && mousebuttons>0)
00746 {
00747 ClearIt();
00748 Flts(grp,7);grp=7;
00749 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00750 Data->P[plr].Crew[prog][grp][1],
00751 Data->P[plr].Crew[prog][grp][2],
00752 Data->P[plr].Crew[prog][grp][3]);
00753 WaitForMouseUp();
00754 }
00755 else
00756 if (((x>=245 && y>=88 && x<=314 && y<=100 && mousebuttons>0) || key=='A') && Gcnt[grp]<max)
00757 {
00758 if (Data->P[plr].Crew[prog][grp][Gcnt[grp]]==0 && count>0) {
00759 InBox(245,88,314,100);
00760 Data->P[plr].Crew[prog][grp][Gcnt[grp]]=M[now2]+1;
00761
00762 AstNames(Gcnt[grp],&Data->P[plr].Pool[M[now2]].Name[0],Data->P[plr].Pool[M[now2]].Mood);
00763 Data->P[plr].Pool[M[now2]].Crew=grp+1;
00764 Data->P[plr].Pool[M[now2]].Task=Gcnt[grp];
00765 Data->P[plr].Pool[M[now2]].Una=1;
00766 for (i=now2;i<count;i++) M[i]=M[i+1];
00767 M[i]=-1;count--;
00768 if (now2==count) {
00769 if (now2>0) now2--;
00770 if (BarA>0) BarA--;
00771 };
00772 RectFill(26,129,153,195,0);
00773 ShBox(26,130+BarA*8,152,138+BarA*8);
00774 DispLeft(plr,BarA,count,now2,&M[0]);
00775
00776 Gcnt[grp]++;
00777 Data->P[plr].Gcnt[prog][grp]=Gcnt[grp];
00778 if (Gcnt[grp]==max) FltsTxt(grp,1);
00779 else FltsTxt(grp,9);
00780 NewAstList(plr,prog,Data->P[plr].Crew[prog][grp][0],
00781 Data->P[plr].Crew[prog][grp][1],
00782 Data->P[plr].Crew[prog][grp][2],
00783 Data->P[plr].Crew[prog][grp][3]);
00784 WaitForMouseUp();
00785 if (key>0) delay(150);
00786 OutBox(245,88,314,100);
00787 };
00788 }
00789 else
00790 if ((x>=245 && y>=106 && x<=314 && y<=118 && mousebuttons>0) || key=='B')
00791 {
00792 tst=Data->P[plr].Crew[prog][grp][0]-1;
00793 if (Data->P[plr].Pool[tst].Prime>0)
00794 {
00795 OutBox(245,106,314,118);
00796 gxDisplayVirtual(75,43,244,173,0,&vhptr,75,43);
00797 ShBox(75,43,244,173);IOBox(81,152,238,167);
00798 InBox(81,70,238,113);
00799 RectFill(82,71,237,112,7+3*plr);grSetColor(1);
00800 DispBig(122,50,"PROBLEM",0,-1);PrintAt(136,162,"CONTINUE");
00801 grSetColor(11);
00802 PrintAt(88,80,"FLIGHT CREW ");DispNum(0,0,grp+1);PrintAt(0,0," IS ALREADY");
00803 PrintAt(88,88,"ASSIGNED TO THE ");
00804 if (Data->P[plr].Pool[tst].Prime==4 || Data->P[plr].Pool[tst].Prime==3)
00805 PrintAt(0,0,"PRIMARY"); else PrintAt(0,0,"BACKUP");
00806 PrintAt(88,96,"CREW OF A CURRENT MISSION,");
00807 PrintAt(88,104,"CANNOT BREAK THIS CREW.");
00808
00809 WaitForMouseUp();
00810 i=1;
00811 while(i==1)
00812 {
00813 key=0;GetMouse();
00814 if (mousebuttons>0 || key>0)
00815 {
00816 if ((x>=83 && y>=154 && x<=236 && y<=165 && mousebuttons!=0) || key==K_ENTER)
00817 {
00818 InBox(83,154,236,165);
00819 WaitForMouseUp();
00820 OutBox(83,154,236,165);
00821 gxVirtualDisplay(&vhptr,75,43,75,43,244,173,0);
00822 i=2;
00823 }
00824 }
00825 }
00826 }
00827 else if (Data->P[plr].Crew[prog][grp][0]!=0)
00828 {
00829 InBox(245,106,314,118);
00830 while (Gcnt[grp]>0) {
00831 M[count]=Data->P[plr].Crew[prog][grp][Gcnt[grp]-1]-1;
00832 Data->P[plr].Crew[prog][grp][Gcnt[grp]-1]=0;
00833 Data->P[plr].Pool[M[count]].Crew=0;
00834 Data->P[plr].Pool[M[count]].Moved=0;
00835 Data->P[plr].Pool[M[now2]].Una=0;
00836 Gcnt[grp]--;
00837 count++;
00838 };
00839 ClearIt();
00840 RectFill(26,129,153,195,0);
00841 FltsTxt(grp,8);
00842 ShBox(26,130+BarA*8,152,138+BarA*8);
00843 DispLeft(plr,BarA,count,now2,&M[0]);
00844 for (i=1;i<5;i++)
00845 DrawPosition(prog,i);
00846
00847 WaitForMouseUp();
00848 OutBox(245,106,314,118);
00849 };
00850 }
00851 else
00852 if ((x>=245 && y>=5 && x<=314 && y<=17 && mousebuttons>0) || key==K_ENTER)
00853 {
00854 InBox(245,5,314,17);
00855 WaitForMouseUp();
00856 if (key>0) delay(150);
00857 OutBox(245,5,314,17);delay(10);
00858 for (i=0;i<8;i++) {
00859 if (Gcnt[i]<max)
00860 while (Gcnt[i]>0) {
00861 M[count]=Data->P[plr].Crew[prog][i][Gcnt[i]-1]-1;
00862 Data->P[plr].Crew[prog][i][Gcnt[i]-1]=0;
00863 Data->P[plr].Pool[M[count]].Crew=0;
00864 Data->P[plr].Gcnt[prog][i]=0;
00865 Gcnt[i]--;
00866 count++;
00867 };
00868 Data->P[plr].Gcnt[prog][i]=Gcnt[i];
00869 };
00870 for(i=0;i<count;i++) {
00871 Data->P[plr].Pool[M[i]].Assign=0;
00872 };
00873 music_stop();
00874 return;
00875 };
00876 }
00877 };
00878 }
00879
00880
00881
00882 void ClearIt(void)
00883 {
00884
00885 RectFill(16,87,75,91,3);RectFill(5,87,11,91,3);
00886 RectFill(16,96,75,100,3);RectFill(5,96,11,100,3);
00887 RectFill(16,105,75,109,3);RectFill(5,105,11,109,3);
00888 RectFill(16,114,75,118,3);RectFill(5,114,11,118,3);
00889 RectFill(16,87,238,121,3);
00890
00891 return;
00892 }
00893
00894 void NewAstList(char plr,char prog,int M1,int M2,int M3,int M4)
00895 {
00896
00897 RectFill(13,86,231,122,3);
00898 grSetColor(1);
00899 if (M1>0)
00900 {
00901 AstNames(0,&Data->P[plr].Pool[M1-1].Name[0],Data->P[plr].Pool[M1-1].Mood);
00902 AstStats(plr,0,M1-1);
00903 }
00904 else DrawPosition(prog,1);
00905 if (M2>0) {
00906 AstNames(1,&Data->P[plr].Pool[M2-1].Name[0],Data->P[plr].Pool[M2-1].Mood);
00907 AstStats(plr,1,M2-1);
00908 }
00909 else DrawPosition(prog,2);
00910 if (M3>0) {
00911 AstNames(2,&Data->P[plr].Pool[M3-1].Name[0],Data->P[plr].Pool[M3-1].Mood);
00912 AstStats(plr,2,M3-1);
00913 }
00914 else DrawPosition(prog,3);
00915 if (M4>0) {
00916 AstNames(3,&Data->P[plr].Pool[M4-1].Name[0],Data->P[plr].Pool[M4-1].Mood);
00917 AstStats(plr,3,M4-1);
00918 }
00919 else DrawPosition(prog,4);
00920
00921 return;
00922 }
00923
00924
00925
00926
00927 void AstStats(char plr,char man,char num)
00928 {
00929 int y;
00930 grSetColor(1);
00931 y=91+man*9;
00932 PrintAt(113,y,"CA:");DispNum(0,0,Data->P[plr].Pool[num].Cap);
00933 PrintAt(137,y,"LM:");DispNum(0,0,Data->P[plr].Pool[num].LM);
00934 PrintAt(161,y,"EV:");DispNum(0,0,Data->P[plr].Pool[num].EVA);
00935 PrintAt(186,y,"DO:");DispNum(0,0,Data->P[plr].Pool[num].Docking);
00936 PrintAt(211,y,"EN:");DispNum(0,0,Data->P[plr].Pool[num].Endurance);
00937 return;
00938 }
00939
00940 void AstNames(int man,char *name,char att)
00941 {
00942 char col = 0;
00943 switch(man) {
00944 case 0:RectFill(16,87,75,91,3);
00945 RectFill(5,87,11,91,3);
00946 break;
00947 case 1:RectFill(16,96,75,100,3);
00948 RectFill(5,96,11,100,3);
00949 break;
00950 case 2:RectFill(16,105,75,109,3);
00951 RectFill(5,105,11,109,3);
00952 break;
00953 case 3:RectFill(16,114,75,118,3);
00954 RectFill(5,114,11,118,3);
00955 break;
00956 default: break;
00957 };
00958 grSetColor(1);
00959 switch(man) {
00960 case 0: PrintAt(17,91,&name[0]);break;
00961 case 1: PrintAt(17,100,&name[0]);break;
00962 case 2: PrintAt(17,109,&name[0]);break;
00963 case 3: PrintAt(17,118,&name[0]);break;
00964 default: break;
00965 };
00966 if (att>=65) col=16;
00967 if (att<65 && att>=40) col=11;
00968 if (att<40 && att>=20) col=8;
00969 if (att<20) col=0;
00970 if (att==0) col=3;
00971 switch(man) {
00972 case 0: RectFill(5,87,11,91,col);break;
00973 case 1: RectFill(5,96,11,100,col);break;
00974 case 2: RectFill(5,105,11,109,col);break;
00975 case 3: RectFill(5,114,11,118,col);break;
00976 default: break;
00977 };
00978 return;
00979 }
00980
00981 void Flts(char old,char nw)
00982 {
00983
00984 switch (old) {
00985 case 0: OutBox(164,139,238,151);break;
00986 case 1: OutBox(164,154,238,166);break;
00987 case 2: OutBox(164,169,238,181);break;
00988 case 3: OutBox(164,184,238,196);break;
00989 case 4: OutBox(241,139,315,151);break;
00990 case 5: OutBox(241,154,315,166);break;
00991 case 6: OutBox(241,169,315,181);break;
00992 case 7: OutBox(241,184,315,196);break;
00993 };
00994 switch (nw) {
00995 case 0: InBox(164,139,238,151);break;
00996 case 1: InBox(164,154,238,166);break;
00997 case 2: InBox(164,169,238,181);break;
00998 case 3: InBox(164,184,238,196);break;
00999 case 4: InBox(241,139,315,151);break;
01000 case 5: InBox(241,154,315,166);break;
01001 case 6: InBox(241,169,315,181);break;
01002 case 7: InBox(241,184,315,196);break;
01003 };
01004
01005 return;
01006 }
01007
01008 void FltsTxt(char nw,char col)
01009 {
01010 grSetColor(col);
01011
01012 switch(nw) {
01013 case 0:PrintAt(169,147,"FLT. CREW I");break;
01014 case 1:PrintAt(169,162,"FLT. CREW II");break;
01015 case 2:PrintAt(169,177,"FLT. CREW III");break;
01016 case 3:PrintAt(169,192,"FLT. CREW IV");break;
01017 case 4:PrintAt(246,147,"FLT. CREW V");break;
01018 case 5:PrintAt(246,162,"FLT. CREW VI");break;
01019 case 6:PrintAt(246,177,"FLT. CREW VII");break;
01020 case 7:PrintAt(246,192,"FLT. CREW VIII");break;
01021 };
01022
01023 return;
01024 }
01025
01026
01027
01028
01029
01030
01031
01032
01033