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
00027 #include "Buzz_inc.h"
00028 #include "externs.h"
00029 extern char Month[12][11];
00030 extern char Nums[30][7],AI[2];
00031 extern struct mStr Mis;
00032 #define DELAYCNT 50
00033
00034 struct Astros *abuf;
00035
00036 #if 1
00037 char tame[29][40]={
00038 "ORBITAL SATELLITE",
00039 "LUNAR FLYBY",
00040 "MERCURY FLYBY",
00041 "VENUS FLYBY",
00042 "MARS FLYBY",
00043 "JUPITER FLYBY",
00044 "SATURN FLYBY",
00045 "LUNAR PROBE LANDING",
00046 "DURATION LEVEL F",
00047 "DURATION LEVEL E",
00048 "DURATION LEVEL D",
00049 "DURATION LEVEL C",
00050 "DURATION LEVEL B",
00051 "ONE-PERSON CRAFT",
00052 "TWO-PERSON CRAFT",
00053 "THREE-PERSON CRAFT",
00054 "MINISHUTTLE",
00055 "FOUR-PERSON CRAFT",
00056 "MANNED ORBITAL",
00057 "MANNED LUNAR PASS",
00058 "MANNED LUNAR ORBIT",
00059 "MANNED RESCUE ATTEMPT",
00060 "MANNED LUNAR LANDING",
00061 "ORBITING LAB",
00062 "MANNED DOCKING",
00063 "WOMAN IN SPACE",
00064 "SPACE WALK",
00065 "MANNED SPACE MISSION"
00066 };
00067 #endif
00068
00069 i16 TPoints[2];
00070 extern char Mon[12][4];
00071
00072 void BigArrowLt(int,int);
00073 void BigArrowRt(int,int);
00074 void EndRt(int,int);
00075 void EndLt(int,int);
00076 void Display_ARROW(char,int,int);
00077
00078 void Display_ARROW(char num,int x,int y)
00079 {
00080
00081 PatchHdrSmall P;
00082 int do_fix = 0;
00083 GXHEADER local,local2;
00084 FILE *in;
00085 in=sOpen("ARROWS.BUT","rb",0);
00086 fseek(in,(num)*(sizeof P),SEEK_CUR);
00087 fread(&P,sizeof P,1,in);
00088 SwapPatchHdrSmall(&P);
00089 fseek(in,P.offset,SEEK_SET);
00090 if (P.w * P.h != P.size)
00091 {
00092
00093
00094
00095 if ((P.w+1) * P.h == P.size) {
00096
00097 P.w++;
00098 do_fix = 1;
00099 }
00100 P.size = P.w * P.h;
00101 }
00102 GV(&local,P.w,P.h); GV(&local2,P.w,P.h);
00103 gxGetImage(&local2,x,y,x+P.w-1,y+P.h-1,0);
00104 fread(local.vptr,P.size,1,in);
00105 fclose(in);
00106
00107
00108 gxPutImage(&local,gxSET,x,y,0);
00109 DV(&local); DV(&local2);
00110 return;
00111 }
00112
00113 void Museum(char plr)
00114 {
00115 int i,tots=7,beg;
00116 char AName[7][22]={"DIRECTORS RANKING","SPACE HISTORY","MISSION RECORDS","PRESTIGE SUMMARY",
00117 "HARDWARE EFFICIENCY","ASTRONAUT HISTORY","EXIT THE MUSEUM"};
00118 char AImg[7]={8,9,10,11,13,14,0};
00119
00120 if (Data->P[plr].AstroCount==0) {
00121 memcpy(&AName[5][0],&AName[6][0],22);
00122 AImg[5]=AImg[6];
00123 tots=6;
00124 }
00125 else if (plr==1) strncpy(&AName[5][0],"COSMO",5);
00126
00127 AImg[3]+=plr;
00128
00129 music_start(M_THEME);
00130 beg=0;
00131
00132 do {
00133 if (beg==0) beg=(Data->P[plr].AstroCount>0)? 7 : 6;
00134 else {
00135 FadeOut(2,pal,10,0,0);
00136
00137 DrawSpaceport(plr);
00138 PortPal(plr);
00139 RectFill(166,191,318,198,3);
00140 grSetColor(0);PrintAt(257,197,"CASH:");DispMB(285,197,Data->P[plr].Cash);
00141 grSetColor(11);PrintAt(256,196,"CASH:");DispMB(284,196,Data->P[plr].Cash);
00142 grSetColor(0);if (Data->Season==0) PrintAt(166,197,"SPRING 19");
00143 else PrintAt(166,197,"FALL 19");DispNum(0,0,Data->Year);
00144 grSetColor(11);if (Data->Season==0) PrintAt(165,196,"SPRING 19");
00145 else PrintAt(165,196,"FALL 19");DispNum(0,0,Data->Year);
00146
00147 FadeIn(2,pal,10,0,0);
00148 }
00149
00150 strncpy(IDT,(plr==0) ?"i700":"i701",4);
00151 strncpy(IKEY,(plr==0) ? "k603":"k604",4);
00152 i=BChoice(plr,tots,&AName[0][0],&AImg[0]);
00153
00154 switch(i) {
00155 case 1: RankMe(plr); break;
00156 case 2: strncpy(IDT,"i130",4);strncpy(IKEY,"k031",4);
00157 ShowSpHist(plr);break;
00158 case 3: strncpy(IDT,"i131",4);strncpy(IKEY,"k321",4);
00159 Records(plr);break;
00160 case 4: strncpy(IDT,"i132",4);strncpy(IKEY,"k033",4);
00161 ShowPrest(plr);break;
00162 case 5: strncpy(IDT,"i034",4);ShowHard(plr);break;
00163 case 6: strncpy(IDT,(plr==0)? "i133" :"i134",4);
00164 strncpy(IKEY,(plr==0)? "k035" :"k441",4);
00165 if (Data->P[plr].AstroCount>0) ShowAstrosHist(plr);
00166 break;
00167 case 7: default: break;
00168 }
00169 strncpy(IDT,"i000",4);strncpy(IKEY,"k000",4);
00170 } while (i!=beg);
00171 music_stop();
00172 return;
00173 }
00174
00175 void ShowPrest(char plr)
00176 {
00177 char pos=-1,pos2=-1;
00178 int i,j;
00179
00180 for(j=0;j<2;j++)
00181 for(i=0;i<28;i++)
00182 TPoints[j]+=(int) Data->Prestige[i].Points[j];
00183
00184
00185 FadeOut(2,pal,5,0,0);
00186 PortPal(plr);
00187 gxClearDisplay(0,0);
00188 ShBox(0,0,319,22);ShBox(0,24,319,199);
00189 InBox(4,27,315,196);
00190 RectFill(5,28,314,195,0);
00191
00192
00193 ShBox(6,29,56,101);
00194 InBox(17,46,44,62);
00195
00196 InBox(70,42,174,92);
00197
00198 ShBox(179,29,313,101);
00199 ShBox(58,29,313,101);
00200
00201 InBox(70,42,174,92);InBox(185,42,304,92);
00202
00203
00204 IOBox(243,3,316,19);
00205 ShBox(6,104,313,194); InBox(10,127,309,191);RectFill(11,128,308,190,0);
00206
00207 ShBox(297,129,307,158);ShBox(297,160,307,189);
00208
00209 DispBig(8,5,"PRESTIGE SUMMARY",0,-1);
00210 DispBig(14,109,"EVENTS",0,-1);
00211 grSetColor(11);
00212 PrintAt(140,120,"1ST:");
00213 PrintAt(175,120,"2ND:");
00214 PrintAt(212,120,"SUBS:");
00215 PrintAt(254,120,"FAIL:");
00216 grSetColor(1);PrintAt(257,13,"CONTINUE");
00217 PrintAt(17,39,"FIRST:");
00218 PrintAt(19,81,"DATE:");
00219 grSetColor(11);PrintAt(71,37,"# SPACE FIRSTS:");
00220 PrintAt(187,37,"TOTAL POINTS:");grSetColor(1);
00221 grSetColor(6);PrintAt(210,99,"USA");PrintAt(90,99,"USA");
00222 grSetColor(9);PrintAt(261,99,"USSR");PrintAt(135,99,"USSR");
00223 UPArrow(299,131);DNArrow(299,162);
00224 DPrest(plr,&pos,&pos2);
00225 FadeIn(2,pal,5,0,0);
00226
00227 WaitForMouseUp();
00228 while(1)
00229 {
00230 GetMouse();
00231
00232 if ((x>=245 && y>=5 && x<=314 && y<=17 && mousebuttons>0) || key==K_ENTER) {
00233 InBox(245,5,314,17);
00234 if (key>0) {delay(300);key=0;};
00235 WaitForMouseUp();
00236 OutBox(245,5,314,17); key=0;
00237 strcpy(IDT,"i000");strcpy(IKEY,"k000");
00238 return;
00239 }
00240 pButton(297,129,307,158,BackOne(plr,&pos,&pos2),key>>8,72);
00241 pButton(297,160,307,189,ForOne(plr,&pos,&pos2),key>>8,80);
00242 Button2(15,129,160,133,Move2(plr,&pos,&pos2,0),key,49);
00243 Button2(15,136,160,140,Move2(plr,&pos,&pos2,1),key,50);
00244 Button2(15,143,160,147,Move2(plr,&pos,&pos2,2),key,51);
00245 Button2(15,150,160,154,Move2(plr,&pos,&pos2,3),key,52);
00246 Button2(15,157,160,161,Move2(plr,&pos,&pos2,4),key,53);
00247 Button2(15,164,160,168,Move2(plr,&pos,&pos2,5),key,54);
00248 Button2(15,171,160,175,Move2(plr,&pos,&pos2,6),key,55);
00249 Button2(15,178,160,182,Move2(plr,&pos,&pos2,7),key,56);
00250 Button2(15,185,160,189,Move2(plr,&pos,&pos2,8),key,57);
00251 key=0;
00252 };
00253 }
00254
00255 void Move2(char plr, char *pos, char *pos2, char val )
00256 {
00257 *pos2 = *pos + val;
00258 if (*pos2>=21) {*pos2+=1;}
00259 DPrest(plr,pos,pos2);
00260 }
00261
00262 void BackOne(char plr, char *pos,char *pos2)
00263 {
00264 if (*pos2== -1) return;
00265 *pos2-=1;
00266 if (*pos2==21) *pos2-=1;
00267 if (*pos==21) *pos-=1;
00268 if(*pos2 < *pos) *pos -=1;
00269 DPrest(plr,pos,pos2);
00270 return;
00271 }
00272
00273 void ForOne(char plr, char *pos,char *pos2)
00274 {
00275 if (*pos2==27) return;
00276 *pos2+=1;
00277 if (*pos2==21) *pos2+=1;
00278 if (*pos==21) *pos+=1;
00279 if(*pos > 19) ;
00280 else if (*pos2 > *pos+8) *pos+=1;
00281 if (*pos>18) *pos=18;
00282 DPrest(plr,pos,pos2);
00283 return;
00284 }
00285
00286
00287 void DPrest(char plr,char *pos,char *pos2)
00288 {
00289 int i,j=0,tmp,tt;
00290
00291
00292 RectFill(12,129,295,190,0);
00293 RectFill(70,31,175,40,3);RectFill(183,31,300,40,3);
00294 if (*pos2==-1) {grSetColor(11);PrintAt(71,37,"SPACE FIRSTS:");PrintAt(187,37,"TOTAL POINTS:");}
00295 else {grSetColor(1);PrintAt(71,37,"ATTEMPTS:");PrintAt(187,37,"POINTS:");}
00296
00297 grSetColor(2);tt=0;
00298 for(i=*pos;i<*pos+9+tt;i++,j++) {
00299 if (i==21) {
00300 i++;
00301 tt=1;
00302 }
00303 if(i==*pos2) grSetColor(11);
00304 if(i==-1)
00305 PrintAt(15,133+7*j,"SUMMARY");
00306 else {
00307 PrintAt(15,133+7*j,&tame[i][0]);
00308 if(i==*pos2) grSetColor(11); else grSetColor(12);
00309 DispNum(150,133+7*j,Data->Prestige[i].Add[0]);
00310 DispNum(185,133+7*j,Data->Prestige[i].Add[1]);
00311 DispNum(228,133+7*j,Data->Prestige[i].Add[2]);
00312 DispNum(265,133+7*j,Data->Prestige[i].Add[3]);
00313 }
00314 grSetColor(2);
00315 }
00316 RectFill(71,43,173,91,6+3*plr);
00317 RectFill(186,43,303,91,6+3*plr);
00318 RectFill(10,86,55,92,3);
00319 grSetColor(3);
00320 for(i=1;i<3;i++)
00321 pline(71,91-16*i,173,91-16*i);
00322 if(*pos2 != -1) {
00323 if (Data->Prestige[*pos2].Place == -1 && Data->Prestige[*pos2].Year==0)
00324 RectFill(18,47,43,61,3);
00325 else FlagSm(Data->Prestige[*pos2].Place,18,47);
00326
00327 i = maxx(Data->Prestige[*pos2].Goal[0],Data->Prestige[*pos2].Goal[1]);
00328 if (i!=0) {
00329 j=Data->Prestige[*pos2].Goal[0];
00330 tmp=Data->Prestige[*pos2].Goal[1];
00331
00332 RectFill(85,(int) 91-48*((float)j/i),111,91,5);
00333 RectFill(133,(int) 91-48*((float)tmp/i),159,91,8);
00334 grSetColor(11);
00335 if (j!=0) DispNum(94,88,j);
00336 if (tmp!=0) DispNum(142,88,tmp);
00337 if (Data->Prestige[*pos2].Year!=0)
00338 {
00339 PrintAt(10,91,Mon[Data->Prestige[*pos2].Month]);
00340 PrintAt(0,0," 19");
00341 DispNum(0,0,Data->Prestige[*pos2].Year);
00342 }
00343
00344 }
00345
00346 grSetColor(3);
00347 for(i=0;i<3;i++) pline(186,79-12*i,303,79-12*i);
00348 i = maxx(abs(Data->Prestige[*pos2].Points[0]),abs(Data->Prestige[*pos2].Points[1]));
00349 grSetColor(5);pline(205,67,231,67);
00350 grSetColor(8);pline(258,67,284,67);
00351 if (i != 0) {
00352 j=Data->Prestige[*pos2].Points[0];
00353 tmp=Data->Prestige[*pos2].Points[1];
00354 RectFill(205,67,231,67-(float)j*24/i,5);
00355 RectFill(258,67,284,67-(float)tmp*24/i,8);
00356 grSetColor(11);
00357 if (j!=0) DispNum(212,(j>0)? 65:73,j);
00358 if (tmp!=0) DispNum(267,(tmp>0)?65:73,tmp);
00359 }
00360 }
00361 else {
00362 j=0;tmp=0;
00363 for(i=0;i<28;i++) {
00364 j+=(Data->Prestige[i].Place == 0) ? 1 : 0;
00365 tmp+=(Data->Prestige[i].Place == 1) ? 1 : 0;
00366 }
00367 i = maxx(j,tmp);
00368 if (i != 0) {
00369 if (j==tmp) RectFill(18,47,43,61,3);
00370 else if (j>tmp) FlagSm(0,18,47);
00371 else FlagSm(1,18,47);
00372 RectFill(85,(int) 91-48*((float)j/i),111,91,5);
00373 RectFill(133,(int) 91-48*((float)tmp/i),159,91,8);
00374 grSetColor(11);
00375 if (j!=0) DispNum(94,88,j);
00376 if (tmp!=0) DispNum(142,88,tmp);
00377 } else RectFill(18,47,43,61,3);
00378
00379 j=0;tmp=0;
00380 for(i=0;i<28;i++){
00381 j+=Data->Prestige[i].Points[0];
00382 tmp+=Data->Prestige[i].Points[1];
00383 }
00384 grSetColor(3);
00385 for(i=0;i<3;i++)
00386 pline(186,79-12*i,303,79-12*i);
00387 i = maxx(abs(j),abs(tmp));
00388 pline(205,67,231,67);
00389 pline(258,67,284,67);
00390 if (i != 0) {
00391 RectFill(205,67,231,67-(float)j*24/i,5);
00392 RectFill(258,67,284,67-(float)tmp*24/i,8);
00393 grSetColor(11);
00394 if (j!=0) DispNum(212,(j>0)? 65:73,j);
00395 if (tmp!=0) DispNum(267,(tmp>0)?65:73,tmp);
00396 }
00397 }
00398
00399 return;
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418 void ShowSpHist(char plr)
00419 {
00420 int pos;
00421
00422 FadeOut(2,pal,5,0,0);
00423 PatchMe(0,0,0,0,0,32);
00424 memset(screen,0x00,64000);
00425 if ((Data->Year == 57 && Data->Season == 0) || Data->P[plr].PastMis == 0)
00426 pos = (Data->Year-57)*2+Data->Season;
00427 else pos = (Data->P[plr].History[Data->P[plr].PastMis-1].MissionYear - 57)*2 +
00428 ((Data->P[plr].History[Data->P[plr].PastMis-1].Month <=5) ? 0 : 1);
00429
00430 ORBox(0,0,319,22,3);
00431 DispBig(48,5,"MISSION HISTORY",0,-1);
00432 IOBox(243,3,316,19);
00433 InBox(3,3,31,19);
00434 FlagSm(plr,4,4);
00435 grSetColor(1);
00436 PrintAt(259,13,"CONTINUE");
00437
00438 ORBox(0,24,319,199,3);
00439 IRBox(4,28,315,170,0);
00440 IRBox(4,174,315,195,0);
00441 ORBox(7,176,49,193,3);
00442 ORBox(51,176,93,193,3);
00443 ORBox(95,176,224,193,3);
00444 ORBox(226,176,268,193,3);
00445 ORBox(270,176,312,193,3);
00446 Display_ARROW(0,23,178);
00447 Display_ARROW(1,63,178);
00448 Display_ARROW(2,239,178);
00449 Display_ARROW(3,285,178);
00450 DrawMisHist(plr,&pos);
00451 FadeIn(2,pal,5,0,0);
00452
00453 WaitForMouseUp();
00454 while(1)
00455 {
00456 GetMouse();
00457 Mission_Data_Buttons(plr,&pos);
00458
00459 if ((x>=245 && y>=5 && x<=314 && y<=17 && mousebuttons>0) || key==K_ENTER)
00460 {
00461 InBox(245,5,314,17);
00462 if (key>0) {delay(300);key=0;};
00463 WaitForMouseUp();
00464 OutBox(245,5,314,17);
00465 return;
00466 }
00467 pButton(7,176,49,193,FullRewind(plr,&pos),key>>8,71);
00468 pButton(51,176,93,193,RewindOne(plr,&pos),key>>8,75);
00469 pButton(226,176,268,193,FastOne(plr,&pos),key>>8,77);
00470 pButton(270,176,312,193,FullFast(plr,&pos),key>>8,79);
00471 key=0;
00472 };
00473 }
00474
00475 void Mission_Data_Buttons(char plr, int *where)
00476 {
00477 char index,yr,season,j,temp=0;
00478
00479
00480
00481 if(Data->P[plr].PastMis==0) return;
00482 index=0;
00483 season =*where % 2;
00484 yr=(*where-season)/2 +57;
00485 while(yr > Data->P[plr].History[index].MissionYear) index++;
00486 if(Data->P[plr].History[index].MissionYear > yr) return;
00487
00488 if (season == 1) {
00489 while(Data->P[plr].History[index].Month < 6) index++;
00490 if(Data->P[plr].History[index].MissionYear > yr) return;
00491 }
00492
00493 do{
00494 if(Data->P[plr].History[index].Month > 6 && season ==0) break;
00495
00496 j = (Data->P[plr].History[index].Month < 6) ? Data->P[plr].History[index].Month
00497 : Data->P[plr].History[index].Month - 6;
00498
00499 Button2( 13+49*j,40*(1+temp),62+49*j,40*(2+temp) ,Draw_Mis_Stats(plr,index,where,0),key,0x31+temp);
00500
00501 temp++;index++;
00502 } while(Data->P[plr].History[index].MissionYear == yr);
00503 }
00504
00505 void FastOne(char plr,int *where)
00506 {
00507
00508 int last;
00509
00510 if(Data->P[plr].PastMis == 0) return ;
00511
00512 last =(Data->P[plr].History[Data->P[plr].PastMis-1].MissionYear - 57)*2 +
00513 ((Data->P[plr].History[Data->P[plr].PastMis-1].Month <= 5) ? 0 : 1);
00514
00515 if (*where >= last) return;
00516 *where +=1;
00517 DrawMisHist(plr,where);
00518 return;
00519 }
00520
00521 void FullRewind(char plr, int *where)
00522 {
00523 *where=0;
00524 DrawMisHist(plr,where);
00525 return;
00526 }
00527
00528 void RewindOne(char plr, int *where)
00529 {
00530 if(Data->P[plr].PastMis == 0) return;
00531
00532 if(!(*where == 0)) *where -=1;
00533 DrawMisHist(plr,where);
00534 return;
00535 }
00536
00537
00538 void FullFast(char plr, int *where)
00539 {
00540 if (Data->P[plr].PastMis == 0) return;
00541 *where=(Data->P[plr].History[Data->P[plr].PastMis-1].MissionYear - 57)*2 +
00542 ((Data->P[plr].History[Data->P[plr].PastMis-1].Month <=5) ? 0 : 1);
00543 DrawMisHist(plr,where);
00544 }
00545
00546 void DrawMisHist(char plr,int *where)
00547 {
00548 char cYr[5],mtext[51];
00549 char yr,season,i,j,index=0,prog,planet,pmis,temp=0,temp2=11;
00550
00551
00552
00553
00554 for(i=0;i<Data->P[plr].PastMis;i++)
00555 {
00556 if (Data->P[plr].History[i].MissionCode==55 || Data->P[plr].History[i].MissionCode==56)
00557 {
00558 for (j=0;j<4;j++)
00559 if (Data->P[plr].History[i].Man[0][j]!=-1)
00560 {
00561 Data->P[plr].History[i].Man[1][j]=Data->P[plr].History[i].Man[0][j];
00562 Data->P[plr].History[i].Man[0][j]=-1;
00563 }
00564 }
00565 }
00566 yr=(*where-(*where % 2))/2 +57;
00567 season =*where % 2;
00568 ORBox(95,176,224,193,3);
00569 sprintf(cYr,"%d",1900+yr);
00570 DispBig(103+(yr-57)*4,178,cYr,0,-1);
00571
00572 RectFill(5,29,314,169,0);
00573 grSetColor(7+3*plr);
00574 for(i=0;i<7;i++) pline(13+49*i,29,13+49*i,169);
00575
00576 grSetColor(12);
00577 if (*where % 2 ==0) for(i=0;i<6;i++) {
00578 strncpy(cYr,Month[i],3);cYr[3]=0;
00579 PrintAt(29+49*i,36,cYr);
00580 }
00581 else for(i=0;i<6;i++){
00582 strncpy(cYr,Month[i+6],3);cYr[3]=0;
00583 PrintAt(29+49*i,36,cYr);
00584 }
00585
00586
00587
00588
00589 while(yr > Data->P[plr].History[index].MissionYear) index++;
00590 if(Data->P[plr].History[index].MissionYear > yr) {
00591
00592 return;
00593 }
00594
00595 if (season == 1) {
00596 while(Data->P[plr].History[index].Month<6 && yr==Data->P[plr].History[index].MissionYear) index++;
00597 if(Data->P[plr].History[index].MissionYear > yr) {
00598
00599 return;
00600 }
00601 }
00602
00603 do {
00604 if (Data->P[plr].History[index].Month>=6 && season ==0) break;
00605 j = (Data->P[plr].History[index].Month < 6) ? Data->P[plr].History[index].Month
00606 : Data->P[plr].History[index].Month - 6;
00607
00608
00609
00610
00611 if (Data->P[plr].History[index].Hard[1][0]>0)
00612 {
00613 sprintf(mtext,"%s",Data->P[plr].History[index].MissionName[1]);
00614 grSetColor(11);
00615 PrintAt(35+49*j-strlen(mtext)/2*5,45+40*temp,mtext);
00616 if (Data->P[plr].History[index].Man[0][0]!=-1 && Data->P[plr].History[index].Hard[1][0]!=-1)
00617 {
00618 PatchMe(plr,10+49*j,50+40*temp,Data->P[plr].History[index].Hard[0][0],
00619 Data->P[plr].History[index].Patch[0],32);
00620 }
00621 if (Data->P[plr].History[index].Man[1][0]!=-1 && Data->P[plr].History[index].Hard[1][0]!=-1)
00622 {
00623 PatchMe(plr,42+49*j,50+40*temp,Data->P[plr].History[index].Hard[1][0],
00624 Data->P[plr].History[index].Patch[1],32);
00625 }
00626 if (Data->P[plr].History[index].Hard[1][0]!=-1 && Data->P[plr].History[index].Hard[1][0]!=-1)
00627 {
00628 if (Data->P[plr].History[index].Hard[0][0]!=-1 && Data->P[plr].History[index].Man[0][0]!=-1)
00629 {
00630 planet=0;prog=Data->P[plr].History[index].Hard[0][0];
00631 SmHardMe(plr,44+38*j,50+40*temp,prog,planet,64);
00632 }
00633 pmis = Data->P[plr].History[index].MissionCode;
00634 if (pmis==55 || pmis==56) temp2=0;
00635 else temp2=11;
00636 planet=0;prog=Data->P[plr].History[index].Hard[1][0];
00637 SmHardMe(plr,44+(38+temp2)*j,50+40*temp,prog,planet,64);
00638 }
00639
00640
00641
00642
00643
00644
00645
00646
00647 }
00648 else
00649 {
00650
00651 if (Data->P[plr].History[index].Hard[0][0]!=-1 && Data->P[plr].History[index].Man[0][0]!=-1)
00652 {
00653 PatchMe(plr,10+49*j,50+40*temp,Data->P[plr].History[index].Hard[0][0],
00654 Data->P[plr].History[index].Patch[0],32);
00655 }
00656 if (Data->P[plr].History[index].Hard[1][0]!=-1 && Data->P[plr].History[index].Man[1][0]!=-1) prog=Data->P[plr].History[index].Hard[1][0];
00657 else
00658 {
00659 prog = (Data->P[plr].History[index].Hard[0][0] != -1) ?
00660 Data->P[plr].History[index].Hard[0][0] :
00661 Data->P[plr].History[index].Hard[0][3]+5;
00662 }
00663 pmis = Data->P[plr].History[index].MissionCode;
00664 if (prog==6 && pmis == 9) planet =2;
00665 else if(prog == 6 && pmis == 10) planet = 3;
00666 else if(prog == 6 && pmis == 11) planet = 1;
00667 else if(prog == 6 && pmis == 12) planet = 4;
00668 else if(prog == 6 && pmis == 13) planet = 5;
00669 else if(pmis == 0) planet = 7;
00670 else if(pmis == 1) planet = 7;
00671 else if(pmis == 7) planet = 6;
00672 else if(pmis == 8) planet = 6;
00673 else planet=0;
00674 sprintf(mtext,"%s",Data->P[plr].History[index].MissionName[0]);
00675 grSetColor(11);
00676 PrintAt(35+49*j-strlen(mtext)/2*5,45+40*temp,mtext);
00677 SmHardMe(plr,44+49*j,50+40*temp,prog,planet,64);
00678 }
00679 temp++;
00680 index++;
00681 } while (Data->P[plr].History[index].MissionYear == yr);
00682
00683 return;
00684 }
00685
00686 void BigArrowLt(int a,int b)
00687 {
00688 grSetColor(4);
00689 grMoveTo(a,b);grLineTo(a,b+13);grMoveTo(a+9,b);grLineTo(a+9,b+13);
00690 grSetColor(2);
00691 grMoveTo(a+1,b);grLineTo(a+8,b+6);grMoveTo(a+1,b+13);grLineTo(a+8,b+7);
00692 grMoveTo(a+10,b);grLineTo(a+17,b+6);grMoveTo(a+10,b+13);grLineTo(a+17,b+7);
00693 return;
00694 }
00695
00696 void BigArrowRt(int a,int b)
00697 {
00698 grSetColor(4);
00699 grMoveTo(a,b);grLineTo(a,b+13);grMoveTo(a+9,b);grLineTo(a+9,b+13);
00700 grSetColor(2);
00701 grMoveTo(a-1,b);grLineTo(a-8,b+6);grMoveTo(a-1,b+13);grLineTo(a-8,b+7);
00702 grMoveTo(a+8,b);grLineTo(a+1,b+6);grMoveTo(a+8,b+13);grLineTo(a+1,b+7);
00703 return;
00704 }
00705
00706 void EndLt(int a,int b)
00707 {
00708 grSetColor(4);
00709 grMoveTo(a,b);grLineTo(a,b+11);grMoveTo(a+9,b-1);grLineTo(a+9,b+12);
00710 grSetColor(2);
00711 grMoveTo(a,b-1);grLineTo(a-2,b-1);grLineTo(a-2,b+12);grLineTo(a,b+12);
00712
00713
00714 grMoveTo(a+1,b+5);grLineTo(a+8,b-1);
00715 grMoveTo(a+1,b+6);grLineTo(a+8,b+12);
00716
00717 return;
00718 }
00719
00720 void EndRt(int a,int b)
00721 {
00722 grSetColor(4);
00723 grMoveTo(a,b);grLineTo(a,b+13);grMoveTo(a+9,b+1);grLineTo(a+9,b+12);
00724 grSetColor(2);
00725 grMoveTo(a+9,b);grLineTo(a+11,b);grLineTo(a+11,b+13);grLineTo(a+9,b+13);
00726 grMoveTo(a+1,b);grLineTo(a+8,b+6);grMoveTo(a+1,b+13);grLineTo(a+8,b+7);
00727 return;
00728 }
00729
00730 void ShowAstrosHist(char plr)
00731 {
00732 char pos=0,pos2=0,glorf=0;
00733 GV(&vhptr2,112,55);
00734 abuf=(struct Astros *) buffer;
00735 if(Data->P[plr].AstroCount == 0 ) return;
00736 memcpy(abuf,Data->P[plr].Pool,sizeof(Data->P[plr].Pool));
00737 qsort((void *)abuf,Data->P[plr].AstroCount,sizeof(struct Astros),astcomp);
00738
00739 FadeOut(2,pal,5,0,0);
00740 RectFill(1,39,157,184,3);
00741 DispBig(67,71,"NO",0,-1);
00742 DispBig(41,90,"MISSION",0,-1);
00743 DispBig(27,109,"EXPERIENCE",0,-1);
00744 gxGetImage(&vhptr2,22,69,133,123,0);
00745 PatchMe(0,0,0,0,0,32);
00746 gxClearDisplay(0,0);
00747
00748 ORBox(0,0,319,22,3);
00749 if(plr==0) DispBig(45,4,"ASTRONAUT HISTORY",0,-1);
00750 else DispBig(45,4,"COSMONAUT HISTORY",0,-1);
00751 IRBox(243,3,316,19,0);
00752 ORBox(245,5,314,17,3);
00753 InBox(3,3,31,19);
00754 if(plr==0) FlagSm(0,4,4);
00755 else FlagSm(1,4,4);
00756 grSetColor(1);
00757 PrintAt(259,13,"CONTINUE");
00758 ShBox(0,24,158,199);
00759 ShBox(161,24,319,199);
00760 InBox(233,29,314,80);
00761 InBox(287,104,309,134);
00762 IRBox(165,175,315,196,0);
00763 IRBox(6,185,153,197,0);
00764 ORBox(8,187,151,195,3);
00765 IRBox(6,26,153,38,0);
00766 ORBox(8,28,151,36,3);
00767 grSetColor(11);
00768 PrintAt(165,32,"NAME:");
00769 PrintAt(165,60,"TENURE:");
00770 PrintAt(165,78,"MISSIONS: ");
00771 PrintAt(165,89,"PRESTIGE: ");
00772 PrintAt(165,99,"SKILLS:");
00773 PrintAt(165,149,"SPACE DURATION:");
00774 PrintAt(165,159,"LOCATION: ");
00775 grSetColor(6);
00776 PrintAt(174,107,"CAPSULE PILOT: ");
00777 PrintAt(174,115,"L.M. PILOT: ");
00778 PrintAt(174,123,"E.V.A.: ");
00779 PrintAt(174,131,"DOCKING: ");
00780 PrintAt(174,139,"ENDURANCE: ");
00781 ORBox(167,177,202,194,3);
00782 ORBox(204,177,239,194,3);
00783 ORBox(241,177,276,194,3);
00784 ORBox(278,177,313,194,3);
00785
00786
00787
00788
00789
00790 Display_ARROW(0,179,179);
00791 Display_ARROW(1,213,179);
00792 Display_ARROW(2,250,179);
00793 Display_ARROW(3,290,179);
00794 grSetColor(11);
00795 PrintAt(37,34,"PREVIOUS MISSION");
00796 PrintAt(47,193,"NEXT MISSION");
00797 DisplAst(plr,&pos,&pos2);
00798 DisplAstData(plr,&pos,&pos2);
00799 FadeIn(2,pal,5,0,0);
00800
00801 WaitForMouseUp();
00802 while(1)
00803 {
00804 GetMouse();
00805
00806 if ((x>=245 && y>=5 && x<=314 && y<=17 && mousebuttons > 0) || key==K_ENTER) {
00807 InBox(245,5,314,17);
00808 if (key>0) {delay(300);key=0;};
00809 WaitForMouseUp();
00810 OutBox(245,5,314,17);
00811 DV(&vhptr2);
00812 key=0;
00813 return;
00814 }
00815 pButton(8,187,151,195,UpAstroData(plr,&pos,&pos2),key>>8,80);
00816 pButton(8,28,151,36,DownAstroData(plr,&pos,&pos2),key>>8,72);
00817 pButton(167,177,202,194,ShowAstroBack(plr,&pos,&pos2),key>>8,71);
00818 pButton(204,177,239,194,ShowAstroDown(plr,&pos,&pos2),key>>8,75);
00819 pButton(241,177,276,194,ShowAstroUp(plr,&pos,&pos2),key>>8,77);
00820 pButton(278,177,313,194,ShowAstroFor(plr,&pos,&pos2),key>>8,79);
00821 if(key>='A' && key<='Z') {
00822 glorf=0;
00823 while(abuf[glorf].Name[0] < key && glorf< Data->P[plr].AstroCount-1) glorf++;
00824 pos=glorf;
00825 DisplAst(plr,&pos,&pos2);
00826 key=0;
00827 }
00828 key=0;
00829 };
00830 }
00831
00832 void DisplAst(char plr, char *where, char *where2)
00833 {
00834 char temp[11]="GROUP \0";
00835 char Ast_Name[11];
00836 if(Data->P[plr].AstroCount == 0) return;
00837
00838 RectFill(165,39,230,35,3);
00839 RectFill(165,49,230,45,3);
00840 RectFill(172,68,230,63,3);
00841 RectFill(211,78,229,73,3);
00842 RectFill(214,89,231,84,3);
00843 RectFill(250,107,263,102,3);
00844 RectFill(223,115,241,110,3);
00845 RectFill(202,123,218,118,3);
00846 RectFill(216,131,240,126,3);
00847 RectFill(230,139,254,134,3);
00848 RectFill(248,149,272,144,3);
00849 RectFill(216,159,318,154,3);
00850 RectFill(220,169,280,164,3);
00851 RectFill(288,105,308,133,3);
00852 RectFill(239,83,306,97,3);
00853 grSetColor(1);
00854 if ((plr==0 && abuf[*where].Missions>=4) || abuf[*where].Hero==1) Display_ARROW(4,289,105);
00855 else if ((plr==1 && abuf[*where].Missions>=4) || abuf[*where].Hero==1) Display_ARROW(5,290,105);
00856 if (abuf[*where].Missions>0) Display_ARROW(6,245,83);
00857 DispNum(213,78,abuf[*where].Missions);
00858 DispNum(216,89,abuf[*where].Prestige);
00859 DispNum(250,149,abuf[*where].Days);
00860 DispNum(252,107,abuf[*where].Cap);
00861 DispNum(225,115,abuf[*where].LM);
00862 DispNum(202,123,abuf[*where].EVA);
00863 DispNum(218,131,abuf[*where].Docking);
00864 DispNum(232,139,abuf[*where].Endurance);
00865 DispNum(173,68,abuf[*where].Active/2);
00866 PrintAt(0,0," YEARS");
00867 memset(Ast_Name,0x00,sizeof Ast_Name);
00868 strncpy(Ast_Name,abuf[*where].Name,10);
00869 PrintAt(165,39,Ast_Name);
00870 grSetColor(11);
00871 strcat(temp,(char *)Nums[abuf[*where].Group]);
00872 PrintAt(165,49,temp);
00873 grSetColor(12);
00874 DispNum(225,169,*where+1);
00875 PrintAt(0,0," OF ");
00876 DispNum(0,0,Data->P[plr].AstroCount);
00877 DispLoc(plr,where);
00878 DisplAstData(plr,where,where2);
00879 GradRect(234,30,313,79,plr);
00880 AstFaces(plr,234,30,abuf[*where].Face);
00881
00882 }
00883
00884 void ShowAstroUp(char plr,char *where,char *where2)
00885 {
00886 if(*where == Data->P[plr].AstroCount - 1) return;
00887 *where2=0;
00888 (*where)++;
00889 DisplAst(plr,where,where2);
00890 }
00891
00892 void ShowAstroDown(char plr, char *where,char *where2)
00893 {
00894 if(*where == 0) return;
00895 *where2=0;
00896 (*where)--;
00897 DisplAst(plr,where,where2);
00898 }
00899
00900 void ShowAstroBack(char plr, char *where,char *where2)
00901 {
00902 if(*where == 0) return;
00903 *where=0;
00904 *where2=0;
00905 DisplAst(plr,where,where2);
00906 }
00907
00908 void ShowAstroFor(char plr, char *where,char *where2)
00909 {
00910 if(*where == Data->P[plr].AstroCount - 1) return;
00911 *where=Data->P[plr].AstroCount-1;
00912 *where2=0;
00913 DisplAst(plr,where,where2);
00914 }
00915
00916 void DispLoc(char plr,char *where)
00917 {
00918 int ass;
00919
00920 grSetColor(9);
00921 ass=abuf[*where].Assign;
00922 switch(abuf[*where].Status){
00923 case 0:if (ass==0)
00924 {
00925 if(plr==0) PrintAt(216,159,"COMPLEX");
00926 else PrintAt(216,159,"CENTER");
00927 return;
00928 }
00929 PrintAt(216,159,Data->P[plr].Manned[ass-1].Name);
00930 return;
00931 case 1:if (plr==0) PrintAt(216,159,"ARLINGTON CEMETARY");
00932 else PrintAt(216,159,"KREMLIN WALL");
00933 return;
00934 case 2:PrintAt(216,159,"RETIRED");return;
00935 case 3:PrintAt(216,159,"INJURED");return;
00936 case 4: case 5: case 6:PrintAt(216,159,"BASIC TRAINING");return;
00937 case 7: case 8: case 9: case 10:
00938 switch(abuf[*where].Focus)
00939 {
00940 case 1:PrintAt(216,159,"ADV. CAPSULE");return;
00941 case 2:PrintAt(216,159,"ADV. L.E.M.");return;
00942 case 3:PrintAt(216,159,"ADV. E.V.A.");return;
00943 case 4:PrintAt(216,159,"ADV. DOCKING");return;
00944 case 5:PrintAt(216,159,"ADV. ENDURANCE");return;
00945 }
00946 }
00947 }
00948
00949 void DisplAstData(char plr, char *where,char *where2)
00950 {
00951 int num=abuf[*where].MissionNum[*where2],num2;
00952
00953 RectFill(1,40,157,182,3);
00954 if(abuf[*where].Missions == 0){
00955 gxPutImage(&vhptr2,gxSET,22,69,0);
00956
00957 return;
00958 }
00959 grSetColor(2);
00960 pline(20,111,138,111);
00961 grSetColor(4);
00962 pline(20,113,138,113);
00963
00964
00965 if (Data->P[plr].History[num].Hard[0][0]!=-1)
00966 PatchMe(plr,7,41,Data->P[plr].History[num].Hard[0][0],Data->P[plr].History[num].Patch[0],32);
00967 else PatchMe(plr,7,41,Data->P[plr].History[num].Hard[1][0],Data->P[plr].History[num].Patch[1],32);
00968
00969 grSetColor(1);
00970 PrintAt(43,53,"PRESTIGE: ");
00971 DispNum(93,53,Data->P[plr].History[num].Prestige);
00972 PrintAt(43,63,"DURATION: ");
00973 switch(Data->P[plr].History[num].Duration)
00974 {
00975 case 1:PrintAt(93,63,"A");break;
00976 case 2:PrintAt(93,63,"B");break;
00977 case 3:PrintAt(93,63,"C");break;
00978 case 4:PrintAt(93,63,"D");break;
00979 case 5:PrintAt(93,63,"E");break;
00980 case 6:PrintAt(93,63,"F");break;
00981 default:break;
00982 }
00983 PrintAt(10,83,"DESCRIPTION: ");
00984
00985 grSetColor(9);
00986 PrintAt(43,45,&Data->P[plr].History[num].MissionName[0][0]);
00987
00988 GetMisType(Data->P[plr].History[num].MissionCode);
00989 PrintAt(10,93,Mis.Abbr);
00990
00991 if(*where2==abuf[*where].Missions-1){
00992 RectFill(1,114,157,184,3);
00993
00994 return;
00995 }
00996 num2=abuf[*where].MissionNum[*where2+1];
00997 if (num2<1 && num2>56) return;
00998
00999
01000 if (Data->P[plr].History[num2].Hard[0][0]!=-1)
01001 PatchMe(plr,7,116,Data->P[plr].History[num2].Hard[0][0],Data->P[plr].History[num2].Patch[0],32);
01002 else PatchMe(plr,7,116,Data->P[plr].History[num2].Hard[1][0],Data->P[plr].History[num2].Patch[1],32);
01003
01004 grSetColor(9);
01005 PrintAt(43,120,&Data->P[plr].History[num2].MissionName[0][0]);
01006
01007 GetMisType(Data->P[plr].History[num2].MissionCode);
01008 PrintAt(10,168,Mis.Abbr);
01009
01010 grSetColor(1);
01011 PrintAt(43,128,"PRESTIGE: ");
01012 DispNum(93,128,Data->P[plr].History[num2].Prestige);
01013 PrintAt(43,138,"DURATION: ");
01014 switch(Data->P[plr].History[num2].Duration)
01015 {
01016 case 1:PrintAt(93,138,"A");break;
01017 case 2:PrintAt(93,138,"B");break;
01018 case 3:PrintAt(93,138,"C");break;
01019 case 4:PrintAt(93,138,"D");break;
01020 case 5:PrintAt(93,138,"E");break;
01021 case 6:PrintAt(93,138,"F");break;
01022 default:break;
01023 }
01024 PrintAt(10,158,"DESCRIPTION: ");
01025
01026 return;
01027 }
01028
01029 void DownAstroData(char plr, char *where,char *where2)
01030 {
01031 if(*where2 == 0) return;
01032 else *where2-=2;
01033 DisplAstData(plr,where,where2);
01034 return;
01035 }
01036
01037 void UpAstroData(char plr,char *where,char *where2)
01038 {
01039 if ((*where2+2)<=abuf[*where].Missions-1) *where2+=2;
01040 else return;
01041
01042
01043 DisplAstData(plr,where,where2);
01044 return;
01045 }
01046
01047 int astcomp(const void *no1, const void *no2)
01048 {
01049 return strcmp(((struct Astros *) no1)->Name,((struct Astros *) no2)->Name);
01050 }
01051
01052