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 "Buzz_inc.h"
00027 #include "externs.h"
00028
00029 void DrawLimbo(char plr)
00030 {
00031 int i;
00032 FadeOut(2,pal,10,0,0);
00033
00034 strcpy(IDT,"i039");strcpy(IKEY,"k039");
00035 gxClearDisplay(0,0);
00036 ShBox(0,0,319,22);InBox(3,3,30,19);IOBox(243,3,316,19);
00037 grSetColor(1);PrintAt(258,13,"CONTINUE");
00038 if (plr==0) DispBig(36,5,"ASTRONAUT COMPLEX",0,-1);
00039 else DispBig(40,5,"COSMONAUT CENTER",0,-1);
00040 ShBox(0,24,158,199);
00041 InBox(9,51,90,102);
00042 RectFill(25,129,153,195,0);RectFill(5,129,19,195,0);
00043 ShBox(6,130,18,161);ShBox(6,163,18,194);
00044 UPArrow(8,133);DNArrow(8,166);
00045 ShBox(161,24,319,72);InBox(165,28,315,42);RectFill(166,29,314,41,7);
00046 ShBox(161,74,319,199);InBox(165,77,315,89);RectFill(166,78,314,88,10);
00047 RectFill(10,52,89,101,7+plr*3);
00048 InBox(165,46,315,67);RectFill(166,47,314,66,0);
00049 ShBox(167,48,239,65);ShBox(241,48,313,65);
00050 InBox(167,48,239,65);
00051 InBox(4,128,20,196); InBox(24,128,154,196);
00052
00053 OutBox(0,24,158,47);OutBox(0,105,158,128);
00054 InBox(9,28,148,42);InBox(9,108,148,123);
00055
00056 grSetColor(20);
00057 PrintAt(180,55,"TRANSFER");
00058 if (plr==0) PrintAt(178,62,"ASTRONAUT");
00059 else PrintAt(178,62,"COSMONAUT");
00060
00061 PrintAt(256,55,"FACILITY");PrintAt(254,62,"TRANSFER");
00062
00063 RectFill(166,78,314,88,10);
00064 grSetColor(11);PrintAt(185,85,"TRANSFER TO LOCATION");
00065
00066 for (i=0;i<5;i++) {
00067 IOBox(165,93+21*i,238,111+21*i);
00068 IOBox(242,93+21*i,315,111+21*i);
00069 if (Data->P[plr].Manned[i].Num<0) {
00070 InBox(167,95+21*i,236,109+21*i);
00071 grSetColor(17);
00072 }
00073 else grSetColor(11);
00074 PrintAt(181,101+21*i,Data->P[plr].Manned[i].Name);
00075 PrintAt(181,107+21*i,"PROGRAM");
00076
00077 grSetColor(11);
00078 PrintAt(258,107+21*i,"TRAINING");
00079 grMoveTo(258,101+21*i);
00080
00081 switch(i) {
00082 case 0: PrintAt(0,0,"CAPSULE");break;
00083 case 1: PrintAt(0,0,"L.M.");break;
00084 case 2: PrintAt(0,0,"E.V.A.");break;
00085 case 3: PrintAt(0,0,"DOCKING");break;
00086 case 4: PrintAt(0,0,"ENDURANCE");break;
00087 default: break;
00088 }
00089
00090
00091 }
00092
00093 grSetColor(11);PrintAt(185,37,"OPERATION SELECTION");
00094
00095 grSetColor(20);
00096
00097 PrintAt(15,37,"NAME:");
00098 PrintAt(17,118,"GROUP:");
00099 PrintAt(88,118,"TENURE:");
00100 grSetColor(11);
00101 PrintAt(102,60,"MOOD:");
00102 PrintAt(102,68,"CAP:");
00103 PrintAt(102,76,"L.M.:");
00104 PrintAt(102,84,"EVA:");
00105 PrintAt(102,92,"DOCK:");
00106 PrintAt(102,100,"END:");
00107 FlagSm(plr,4,4);
00108
00109 return;
00110 }
00111
00112 void Limbo(char plr)
00113 {
00114 int i,M[100],BarA,count,now2,tag=0;
00115 memset(M,-1,sizeof M);
00116 DrawLimbo(plr);
00117 music_start((plr==0)?M_ASTTRNG:M_ASSEMBLY);
00118
00119 now2=BarA=count=0;
00120 ShBox(26,130+BarA*8,152,138+BarA*8);
00121 for (i=0;i<Data->P[plr].AstroCount;i++)
00122 if (Data->P[plr].Pool[i].Status==0 && Data->P[plr].Pool[i].Assign==0) {
00123 M[count++]=i;
00124 };
00125 DispLeft(plr,BarA,count,now2,&M[0]);
00126 if (count>0) LimboText(plr,M[now2]);
00127 FadeIn(2,pal,10,0,0);
00128
00129 while (1)
00130 {
00131 key=0;WaitForMouseUp();key=0;
00132 GetMouse();
00133
00134
00135 for (i=0;i<8;i++) {
00136 if (x>=27 && y>=(131+i*8) && x<=151 && y<=(137+i*8) && mousebuttons>0 && (now2-BarA+i)<=(count-1)) {
00137 now2-=BarA; now2+=i; BarA=i;
00138 RectFill(26,129,153,195,0);
00139 ShBox(26,130+BarA*8,152,138+BarA*8);
00140 DispLeft(plr,BarA,count,now2,&M[0]);
00141 LimboText(plr,M[now2]);
00142 WaitForMouseUp();
00143
00144 }
00145 }
00146
00147 if ((mousebuttons>0 && x>=6 && y>=130 && x<=18 && y<=161 && count>0)|| key==UP_ARROW) {
00148 InBox(6,130,18,161);
00149 for (i=0;i<50;i++)
00150 {
00151 key=0;
00152 GetMouse();
00153 delay(10);
00154 if (mousebuttons==0) {
00155
00156 if (BarA==0 && now2>0) {
00157 now2--;
00158 RectFill(26,129,153,195,0);
00159 ShBox(26,130+BarA*8,152,138+BarA*8);
00160 DispLeft(plr,BarA,count,now2,&M[0]);
00161 LimboText(plr,M[now2]);
00162 };
00163 if (BarA>0) {
00164 RectFill(26,129,153,195,0);
00165 BarA--;now2--;
00166 ShBox(26,130+BarA*8,152,138+BarA*8);
00167 DispLeft(plr,BarA,count,now2,&M[0]);
00168 LimboText(plr,M[now2]);
00169 };
00170
00171 i=51;
00172 }
00173 }
00174 while (mousebuttons==1 || key==UP_ARROW)
00175 {
00176 delay(100);
00177
00178 if (BarA==0 && now2>0) {
00179 now2--;
00180 RectFill(26,129,153,195,0);
00181 ShBox(26,130+BarA*8,152,138+BarA*8);
00182 DispLeft(plr,BarA,count,now2,&M[0]);
00183 LimboText(plr,M[now2]);
00184 };
00185 if (BarA>0) {
00186 RectFill(26,129,153,195,0);
00187 BarA--;now2--;
00188 ShBox(26,130+BarA*8,152,138+BarA*8);
00189 DispLeft(plr,BarA,count,now2,&M[0]);
00190 LimboText(plr,M[now2]);
00191 };
00192
00193 key=0;
00194 GetMouse();
00195 }
00196
00197 OutBox(6,130,18,161);delay(10);
00198 };
00199
00200
00201 if ((mousebuttons>0 && x>=6 && y>=163 && x<=18 && y<=194 && count>0) || key==DN_ARROW) {
00202 InBox(6,163,18,194);
00203 for (i=0;i<50;i++)
00204 {
00205 key=0;
00206 GetMouse();
00207 delay(10);
00208 if (mousebuttons==0) {
00209
00210 if (BarA==7 && (now2 < count-1)) {
00211 now2++;
00212 RectFill(26,129,153,195,0);
00213 ShBox(26,130+BarA*8,152,138+BarA*8);
00214 DispLeft(plr,BarA,count,now2,&M[0]);
00215 LimboText(plr,M[now2]);
00216 };
00217 if (BarA<7 && now2<count-1) {
00218 RectFill(26,129,153,195,0);
00219 BarA++;now2++;
00220 ShBox(26,130+BarA*8,152,138+BarA*8);
00221 DispLeft(plr,BarA,count,now2,&M[0]);
00222 LimboText(plr,M[now2]);
00223 };
00224
00225 i=51;
00226 }
00227 }
00228 while (mousebuttons==1 || key==DN_ARROW)
00229 {
00230 delay(100);
00231
00232 if (BarA==7 && (now2 < count-1)) {
00233 now2++;
00234 RectFill(26,129,153,195,0);
00235 ShBox(26,130+BarA*8,152,138+BarA*8);
00236 DispLeft(plr,BarA,count,now2,&M[0]);
00237 LimboText(plr,M[now2]);
00238 };
00239 if (BarA<7 && now2<count-1) {
00240 RectFill(26,129,153,195,0);
00241 BarA++;now2++;
00242 ShBox(26,130+BarA*8,152,138+BarA*8);
00243 DispLeft(plr,BarA,count,now2,&M[0]);
00244 LimboText(plr,M[now2]);
00245 };
00246
00247 key=0;
00248 GetMouse();
00249 }
00250
00251 OutBox(6,163,18,194);delay(10);
00252 };
00253
00254
00255 if ((mousebuttons>0 && x>=245 && y>=5 && x<=314 && y<=17) || key==K_ENTER ){
00256 InBox(245,5,314,17);
00257 WaitForMouseUp();
00258 if (key>0) delay(150);
00259 OutBox(245,5,314,17);
00260 music_stop();
00261 return;
00262 };
00263
00264
00265 if ((mousebuttons>0 && x>=167 && y>=48 && x<=239 && y<=65) || key==LT_ARROW) {
00266 tag=0;
00267 InBox(167,48,239,65);OutBox(241,48,313,65);
00268 RectFill(166,78,314,88,10);
00269 grSetColor(11);PrintAt(185,85,"TRANSFER TO LOCATION");
00270
00271 }
00272
00273
00274 if ((mousebuttons>0 && x>=241 && y>=48 && x<=313 && y<=65) || key==RT_ARROW) {
00275 tag=1;
00276 InBox(241,48,313,65);OutBox(167,48,239,65);
00277 RectFill(166,78,314,88,10);
00278 grSetColor(11);PrintAt(203,85,"VISIT LOCATION");
00279
00280 }
00281
00282
00283 for (i=0;i<5;i++)
00284 {
00285
00286 if ((tag==0 && Data->P[plr].Manned[i].Num>=0) &&
00287 ((mousebuttons>0 && x>=167 && y>=(95+21*i) && x<=236 && y<=(109+21*i))
00288 || key==0x0030+i)) {
00289 InBox(167,95+21*i,236,109+21*i);
00290 if (key>0) delay(140);
00291 WaitForMouseUp();key=0;
00292 OutBox(167,95+21*i,236,109+21*i);
00293 Data->P[plr].Pool[M[now2]].Assign=i+1;
00294 Data->P[plr].Pool[M[now2]].Una=0;
00295 Data->P[plr].Pool[M[now2]].Moved=0;
00296 for (i=now2;i<count;i++) M[i]=M[i+1];
00297 M[i]=-1;count--;
00298 if (count==0) {RectFill(10,52,89,101,7+plr*3);Clear();}
00299 if (now2==count) {
00300 if (now2>0) now2--;
00301 if (BarA>0) BarA--;
00302 };
00303
00304 RectFill(26,129,153,195,0);
00305 ShBox(26,130+BarA*8,152,138+BarA*8);
00306 DispLeft(plr,BarA,count,now2,&M[0]);
00307
00308 if (count>0) LimboText(plr,M[now2]);
00309
00310 }
00311
00312
00313 if ((tag==1 && Data->P[plr].Manned[i].Num>=0) &&
00314 ((mousebuttons>0 && x>=167 && y>=(95+21*i) && x<=236 && y<=(109+21*i))
00315 || key==0x0030+i)) {
00316 InBox(167,95+21*i,236,109+21*i);
00317 if (key>0) delay(140);
00318 WaitForMouseUp();key=0;
00319 OutBox(167,95+21*i,236,109+21*i);
00320 music_stop();
00321 Programs(plr,i+1);
00322 DrawLimbo(plr);
00323 music_start((plr==0)?M_ASTTRNG:M_ASSEMBLY);
00324
00325 InBox(241,48,313,65);OutBox(167,48,239,65);
00326 RectFill(166,78,314,88,10);
00327 grSetColor(11);PrintAt(203,85,"VISIT LOCATION");
00328 RectFill(26,129,153,195,0);
00329 now2=BarA=count=0;
00330 ShBox(26,130+BarA*8,152,138+BarA*8);
00331 for (i=0;i<Data->P[plr].AstroCount;i++)
00332 if (Data->P[plr].Pool[i].Status==0 && Data->P[plr].Pool[i].Assign==0)
00333 M[count++]=i;
00334 DispLeft(plr,BarA,count,now2,&M[0]);
00335 if (count>0) LimboText(plr,M[now2]);
00336
00337
00338
00339 FadeIn(2,pal,10,0,0);
00340
00341 }
00342
00343
00344
00345 if ((tag==0 && count>0) && ((mousebuttons>0 && x>=244 && y>=(95+21*i) && x<=313 && y<=(109+21*i)) || key==0x0035+i)) {
00346 InBox(244,95+21*i,313,109+21*i);
00347 if (key>0) delay(140);
00348 WaitForMouseUp();key=0;
00349 OutBox(244,95+21*i,313,109+21*i);
00350 if (Data->P[plr].Pool[M[now2]].TrainingLevel>6) Help("i120");
00351 else if (Data->P[plr].Cash<3) Help("i121");
00352 else {
00353 Data->P[plr].Pool[M[now2]].Status=7;
00354 Data->P[plr].Cash-=3;
00355 Data->P[plr].Pool[M[now2]].Focus=i+1;
00356 Data->P[plr].Pool[M[now2]].Assign=0;
00357 Data->P[plr].Pool[M[now2]].Una=0;
00358 Data->P[plr].Pool[M[now2]].Moved=0;
00359 for (i=now2;i<count;i++) M[i]=M[i+1];
00360 M[i]=-1;count--;
00361 if (count==0) {RectFill(10,52,89,101,7+plr*3);Clear();}
00362 if (now2==count) {
00363 if (now2>0) now2--;
00364 if (BarA>0) BarA--;
00365 };
00366 RectFill(26,129,153,195,0);
00367 ShBox(26,130+BarA*8,152,138+BarA*8);
00368 DispLeft(plr,BarA,count,now2,&M[0]);
00369 if (count>0) LimboText(plr,M[now2]);
00370 }
00371 }
00372
00373
00374 if (tag==1 &&
00375 ((mousebuttons>0 && x>=244 && y>=(95+21*i) && x<=313 && y<=(109+21*i)) || key==0x0035+i)) {
00376 InBox(244,95+21*i,313,109+21*i);
00377 if (key>0) delay(140);
00378 WaitForMouseUp();key=0;
00379 OutBox(244,95+21*i,313,109+21*i);
00380 music_stop();
00381 Train(plr,i+1);
00382 DrawLimbo(plr);
00383 music_start((plr==0)?M_ASTTRNG:M_ASSEMBLY);
00384
00385 RectFill(166,78,314,88,10);
00386 grSetColor(11);PrintAt(203,85,"VISIT LOCATION");
00387 InBox(241,48,313,65);OutBox(167,48,239,65);
00388 RectFill(26,129,153,195,0);
00389 now2=BarA=count=0;
00390 ShBox(26,130+BarA*8,152,138+BarA*8);
00391 for (i=0;i<Data->P[plr].AstroCount;i++)
00392 if (Data->P[plr].Pool[i].Status==0 && Data->P[plr].Pool[i].Assign==0)
00393 M[count++]=i;
00394 DispLeft(plr,BarA,count,now2,&M[0]);
00395 if (count>0) LimboText(plr,M[now2]);
00396 FadeIn(2,pal,10,0,0);
00397
00398 }
00399 }
00400
00401 };
00402 }
00403
00404 void Clear(void)
00405 {
00406 RectFill(44,31,145,40,3);RectFill(49,112,60,119,3);
00407 RectFill(123,62,145,77,3);RectFill(128,79,145,92,3);
00408 RectFill(123,95,145,101,3);RectFill(127,113,141,120,3);
00409 RectFill(130,54,155,61,3);
00410 return;
00411 }
00412
00413 void LimboText(char plr,int astro)
00414 {
00415 RectFill(44,31,145,40,3);grSetColor(11);
00416 PrintAt(46,37,Data->P[plr].Pool[astro].Name);
00417 RectFill(49,112,60,119,3);grSetColor(11);
00418 switch (Data->P[plr].Pool[astro].Group) {
00419 case 0: PrintAt(51,118,"I");break;
00420 case 1: PrintAt(51,118,"II");break;
00421 case 2: PrintAt(51,118,"III");break;
00422 case 3: PrintAt(51,118,"IV");break;
00423 case 4: PrintAt(51,118,"V");break;
00424 }
00425 RectFill(123,62,145,77,3);
00426 RectFill(128,79,145,92,3);
00427 RectFill(123,95,145,101,3);
00428 RectFill(130,54,155,61,3);
00429 DispNum(132,60,Data->P[plr].Pool[astro].Mood);
00430 DispNum(125,68,Data->P[plr].Pool[astro].Cap);
00431 DispNum(123,76,Data->P[plr].Pool[astro].LM);
00432 DispNum(131,84,Data->P[plr].Pool[astro].EVA);
00433 DispNum(130,92,Data->P[plr].Pool[astro].Docking);
00434 DispNum(125,100,Data->P[plr].Pool[astro].Endurance);
00435 RectFill(127,113,141,120,3);grSetColor(11);
00436 DispNum(130,118,Data->P[plr].Pool[astro].Active);
00437 AstFaces(plr,10,52,Data->P[plr].Pool[astro].Face);
00438 return;
00439 }
00440
00441
00442