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 #define DELAYCNT 10
00030
00031 extern struct mStr Mis;
00032
00033 void DrawBudget(char player,char *pStatus)
00034 {
00035 int i,j,max = 0,k,pscale;
00036 char name[20],str[10];
00037
00038
00039 FadeOut(2,pal,10,0,0);
00040 gxClearDisplay(0,0);
00041 ShBox(0,0,319,47);ShBox(0,49,319,67);ShBox(0,69,158,199);
00042 ShBox(161,69,319,199);IOBox(165,27,238,43);
00043 InBox(3,3,74,43);InBox(243,3,314,43);InBox(184,87,313,167);
00044 InBox(166,181,313,194);InBox(4,73,154,133);InBox(4,138,154,196);
00045 InBox(133,140,152,152);InBox(133,154,152,166);
00046 InBox(133,168,152,180);InBox(133,182,152,194);
00047 Flag(4,4,player);
00048 grSetColor(1);
00049 PrintAt(180,37,"CONTINUE"); PrintAt(60,81,"PRESTIGE");
00050 PrintAt(43,145,"EXPENDITURES"); PrintAt(212,79,"BUDGET TRACK");
00051 InBox(184,87,313,167);GradRect(185,88,312,166,player);
00052 GradRect(30,86,140,120,player);GradRect(31,149,124,182,player);
00053 grSetColor(4);
00054
00055 Box(30,148,125,183);
00056 Box(57,85,85,121);Box(85,121,113,85);Box(29,94,141,103);
00057 Box(29,103,141,112);Box(54,148,77,183);Box(77,148,101,183);
00058 Box(30,157,125,165);Box(30,165,125,174);InBox(30,148,125,183);
00059 InBox(29,85,141,121);
00060
00061 k = (player==0) ? 0 : 1;
00062 for(i=0;i<5;i++)
00063 {
00064 max = (max > abs(Data->P[player].PrestHist[i][k])) ? max
00065 : abs(Data->P[player].PrestHist[i][k]);
00066 }
00067 if (player == 0 ) { j=1; k=1;}
00068 else {j=0;k=1;}
00069 for(i=0;i<5;i++)
00070 {
00071 max = (max > abs(Data->P[j].PrestHist[i][k])) ? max
00072 : abs(Data->P[j].PrestHist[i][k]);
00073 }
00074
00075 if(max<20)
00076 {
00077 max=20;
00078 DispNum(6,114,-10);
00079 DispNum(6,122,-20);
00080 DispNum(11,96,10);
00081 DispNum(11,87,20);
00082 }
00083 else
00084 {
00085 DispNum(6,122,-max);
00086 DispNum(6,114,-max/2);
00087 DispNum(11,96,max/2);
00088 DispNum(11,87,max);
00089 }
00090
00091 pscale=max>>1;
00092
00093 BudPict(player);
00094
00095 if (player==0) {
00096 i=0;j=1;grSetColor(5);
00097 }
00098 else {
00099 i=1;j=0;grSetColor(8);
00100 }
00101
00102 grMoveTo(30,103-Data->P[i].PrestHist[4][0]*8/pscale);
00103 grLineTo(57,103-Data->P[i].PrestHist[3][0]*8/pscale);
00104 grLineTo(85,103-Data->P[i].PrestHist[2][0]*8/pscale);
00105 grLineTo(113,103-Data->P[i].PrestHist[1][0]*8/pscale);
00106 grLineTo(140,103-Data->P[i].PrestHist[0][0]*8/pscale);
00107
00108 if(player==0) {grSetColor(8);}
00109 else grSetColor(5);
00110
00111 grMoveTo(30,103-Data->P[j].PrestHist[4][1]*8/pscale);
00112 grLineTo(57,103-Data->P[j].PrestHist[3][1]*8/pscale);
00113 grLineTo(85,103-Data->P[j].PrestHist[2][1]*8/pscale);
00114 grLineTo(113,103-Data->P[j].PrestHist[1][1]*8/pscale);
00115 grLineTo(140,103-Data->P[j].PrestHist[0][1]*8/pscale);
00116
00117 grSetColor(5);
00118 PrintAt(165,89,"200");PrintAt(167,109,"150");
00119 PrintAt(167,129,"100");PrintAt(171,149,"50");
00120 PrintAt(164,169,"0 MB");
00121 grSetColor(1);
00122 if (Data->Season==0) strcpy(&name[0],"SPRING 19"); else strcpy(&name[0],"FALL 19");
00123 sprintf(&str[0],"%d",Data->Year);
00124
00125 strcat(&name[0],&str[0]);
00126 DispBig(122,5,&name[0],0,-1);
00127
00128
00129 grSetColor(11);
00130 PrintAt(177,59,"PROJECTED BUDGET: ");DispMB(0,0,Data->P[player].Budget);
00131 PrintAt(42,59,"CASH: ");DispMB(0,0,Data->P[player].Cash);
00132
00133 grSetColor(1);PrintAt(13,105,"0");
00134 grSetColor(5);
00135 if (Data->Season==1)
00136 {
00137 DispNum(21,130,Data->Year-2);DispChr('F');
00138 DispNum(49,130,Data->Year-1);DispChr('S');
00139 DispNum(77,130,Data->Year-1);DispChr('F');
00140 DispNum(105,130,Data->Year);DispChr('S');
00141 DispNum(133,130,Data->Year);DispChr('F');
00142 }
00143 else
00144 {
00145 DispNum(21,130,Data->Year-2);DispChr('S');
00146 DispNum(49,130,Data->Year-2);DispChr('F');
00147 DispNum(77,130,Data->Year-1);DispChr('S');
00148 DispNum(105,130,Data->Year-1);DispChr('F');
00149 DispNum(133,130,Data->Year);DispChr('S');
00150 }
00151 if (Data->Season==1)
00152 {
00153 DispNum(23,193,Data->Year-2);DispChr('F');
00154 DispNum(46,193,Data->Year-1);DispChr('S');
00155 DispNum(68,193,Data->Year-1);DispChr('F');
00156 DispNum(92,193,Data->Year);DispChr('S');
00157 DispNum(114,193,Data->Year);DispChr('F');
00158 }
00159 else
00160 {
00161 DispNum(23,193,Data->Year-2);DispChr('S');
00162 DispNum(46,193,Data->Year-2);DispChr('F');
00163 DispNum(68,193,Data->Year-1);DispChr('S');
00164 DispNum(92,193,Data->Year-1);DispChr('F');
00165 DispNum(114,193,Data->Year);DispChr('S');
00166 }
00167 grSetColor(4);
00168 grMoveTo(187,147);grLineTo(311,147);
00169 grMoveTo(187,127);grLineTo(311,127);
00170 grMoveTo(187,107);grLineTo(311,107);
00171 for (i=187;i<312;i+=2) {
00172 grPutPixel(i,157,4);
00173 grPutPixel(i,137,4);
00174 grPutPixel(i,117,4);
00175 grPutPixel(i,97,4);
00176 }
00177 grSetColor(4);
00178 DispNum(298,174,Data->Year);
00179 DispNum(271,174,Data->Year-1);
00180 DispNum(248,174,Data->Year-2);
00181 DispNum(222,174,Data->Year-3);
00182 DispNum(194,174,Data->Year-4);
00183
00184 if (player==0) {
00185 for (i=0;i<5;i++) {
00186 RectFill(197+i*26,164-(Data->P[0].BudgetHistory[Data->Year-57+i]*74)/200,190+i*26,164,6);
00187 RectFill(206+i*26,164-(Data->P[1].BudgetHistoryF[Data->Year-57+i]*74)/200,199+i*26,164,9);
00188 RectFill(196+i*26,164-(Data->P[0].BudgetHistory[Data->Year-57+i]*74)/200,190+i*26,163,5);
00189 RectFill(205+i*26,164-(Data->P[1].BudgetHistoryF[Data->Year-57+i]*74)/200,199+i*26,163,8);
00190 }
00191 RectFill(170,185,176,189,6);
00192 RectFill(170,185,175,188,5);
00193 RectFill(297,185,303,189,9);
00194 RectFill(297,185,302,188,8);
00195 grSetColor(1);
00196 PrintAt(181,189,"U.S.A.");
00197 PrintAt(262,189,"U.S.S.R.");
00198 }
00199 if (player==1) {
00200 for (i=0;i<5;i++) {
00201 RectFill(197+i*26,164-(Data->P[1].BudgetHistory[Data->Year-57+i]*74)/200,190+i*26,164,9);
00202 RectFill(206+i*26,164-(Data->P[0].BudgetHistoryF[Data->Year-57+i]*74)/200,199+i*26,164,6);
00203 RectFill(196+i*26,164-(Data->P[1].BudgetHistory[Data->Year-57+i]*74)/200,190+i*26,163,8);
00204 RectFill(205+i*26,164-(Data->P[0].BudgetHistoryF[Data->Year-57+i]*74)/200,199+i*26,163,5);
00205 }
00206 RectFill(170,185,176,189,9);
00207 RectFill(170,185,175,188,8);
00208 RectFill(297,185,303,189,6);
00209 RectFill(297,185,302,188,5);
00210 grSetColor(1);
00211 PrintAt(181,189,"U.S.S.R.");
00212 PrintAt(262,189,"U.S.A.");
00213 }
00214 DrawPastExp(player,pStatus);
00215 FadeIn(2,pal,10,0,0);
00216
00217 return;
00218 }
00219
00220 void BudPict(char poff)
00221 {
00222 PatchHdrSmall P;
00223 GXHEADER local;
00224 unsigned int i,x,y;
00225 FILE *in;
00226 in=sOpen("BUDD.BUT","rb",0);
00227 fseek(in,(poff)*(sizeof P),SEEK_CUR);
00228 fread(&P,sizeof P,1,in);
00229 SwapPatchHdrSmall(&P);
00230 fseek(in,P.offset,SEEK_SET);
00231 GV(&local,P.w,P.h);
00232 fread(local.vptr,P.size,1,in);
00233
00234 gxPutImage(&local,gxSET,245,4,0);
00235 DV(&local);
00236 x=134;y=141;
00237 for (i=2;i<6;i++)
00238 {
00239 y=141+((i-2)*14);
00240 fseek(in,(i)*(sizeof P),SEEK_SET);
00241 fread(&P,sizeof P,1,in);
00242 SwapPatchHdrSmall(&P);
00243 fseek(in,P.offset,SEEK_SET);
00244 GV(&local,P.w,P.h);
00245 fread(local.vptr,P.size,1,in);
00246
00247 gxPutImage(&local,gxSET,x,y,0);
00248 DV(&local);
00249 }
00250 fclose(in);
00251 }
00252
00253
00254 void DrawPastExp(char player,char *pStatus)
00255 {
00256 int i,j;
00257 int max=0;
00258 int pScale=25;
00259
00260 RectFill(31,149,124,182,7+3*player);
00261 grSetColor(4);
00262 Box(30,148,125,183);Box(54,148,77,183);Box(77,148,101,183);
00263 Box(30,157,125,165);Box(30,165,125,174);
00264
00265 for(j=0;j<5;j++)
00266 for(i=0;i<4;i++)
00267 max = (max > Data->P[player].Spend[j][i]) ? max : Data->P[player].Spend[j][i];
00268
00269 if(max<=100)
00270 {
00271 PrintAt(12,150,"100");PrintAt(12,159,"75");
00272 PrintAt(12,167,"50");PrintAt(12,176,"25");
00273 PrintAt(8,185,"0 MB");
00274 }
00275 else
00276 {
00277 pScale = max>>2;
00278 DispNum(12,150,max);
00279 i = (max*3)>>2;DispNum(12,159,i);
00280 i = max>>1;DispNum(12,167,i);
00281 i = max>>2;DispNum(12,176,i);
00282 PrintAt(8,185,"0 MB");
00283 };
00284
00285 for(i=0;i<4;i++)
00286 {
00287 if (pStatus[i]==1)
00288 {
00289 switch(i) {
00290 case 0: grSetColor(11);break;
00291 case 1: grSetColor(8);break;
00292 case 2: grSetColor(5);break;
00293 case 3: grSetColor(16);break;
00294 }
00295 grMoveTo(31,182-(Data->P[player].Spend[4][i]*8)/pScale);
00296 grLineTo(54,182-(Data->P[player].Spend[3][i]*8)/pScale);
00297 grLineTo(77,182-(Data->P[player].Spend[2][i]*8)/pScale);
00298 grLineTo(101,182-(Data->P[player].Spend[1][i]*8)/pScale);
00299 grLineTo(124,182-(Data->P[player].Spend[0][i]*8)/pScale);
00300 }
00301 };
00302 InBox(30,148,125,183);
00303 }
00304
00305 void Budget(char player)
00306 {
00307 char pStatus[]={1,1,1,1};
00308 DrawBudget(player,pStatus);
00309 strcpy(IDT,"i007\0");strcpy(IKEY,"k007\0");
00310 WaitForMouseUp();
00311 while (1)
00312 {
00313 key=0;GetMouse();
00314 if (mousebuttons > 0 || key>0)
00315 {
00316 if ((x>=166 && y>=29 && x<=236 && y<=41 && mousebuttons>0) || key==K_ENTER)
00317 {
00318 InBox(167,29,236,41);
00319 WaitForMouseUp();
00320 if (key>0) delay(150);
00321 OutBox(167,29,236,41);
00322 return;
00323 };
00324 if ((x>=133 && y>=140 && x<=152 && y<152 && mousebuttons>0) || key=='U')
00325 {
00326 pStatus[0] = (pStatus[0]==0) ? 1 : 0;
00327
00328 if (pStatus[0]==1) InBox(133,140,152,152);
00329 else OutBox(133,140,152,152);
00330
00331 WaitForMouseUp();
00332 DrawPastExp(player,pStatus);
00333 }
00334 if ((x>=133 && y>=154 && x<=152 && y<166 && mousebuttons>0) || key=='R')
00335 {
00336 pStatus[1] = (pStatus[1]==0) ? 1 : 0;
00337
00338 if (pStatus[1]==1) InBox(133,154,152,166);
00339 else OutBox(133,154,152,166);
00340
00341 WaitForMouseUp();
00342 DrawPastExp(player,pStatus);
00343 }
00344 if ((x>=133 && y>=168 && x<=152 && y<180 && mousebuttons>0) || key=='C')
00345 {
00346 pStatus[2] = (pStatus[2]==0) ? 1 : 0;
00347
00348 if (pStatus[2]==1) InBox(133,168,152,180);
00349 else OutBox(133,168,152,180);
00350
00351 WaitForMouseUp();
00352 DrawPastExp(player,pStatus);
00353 }
00354 if ((x>=133 && y>=182 && x<=152 && y<194 && mousebuttons>0) || key=='M')
00355 {
00356 pStatus[3] = (pStatus[3]==0) ? 1 : 0;
00357
00358 if (pStatus[3]==1) InBox(133,182,152,194);
00359 else OutBox(133,182,152,194);
00360
00361 WaitForMouseUp();
00362 DrawPastExp(player,pStatus);
00363 }
00364 }
00365 };
00366 }
00367
00368 void DrawViewing(char plr)
00369 {
00370 int i,misnum;
00371 extern char *Months[12];
00372
00373
00374 FadeOut(2,pal,10,0,0);
00375 gxClearDisplay(0,0);
00376 memset(buffer,0x00,BUFFER_SIZE);
00377 ShBox(0,0,319,22);InBox(3,3,30,19);FlagSm(plr,4,4);
00378 IOBox(243,3,316,19);
00379
00380 ShBox(0,24,319,95);
00381 InBox(5,28,314,38);RectFill(6,29,313,37,7);
00382 InBox(5,41,314,91);RectFill(6,42,313,90,0);
00383
00384 ShBox(0,97,319,199);
00385 InBox(5,101,314,112);RectFill(6,102,313,111,10);
00386 InBox(5,114,314,178);RectFill(6,115,313,177,0);
00387 IOBox(4,182,77,196);IOBox(242,182,315,196);
00388 LTArrow(24,186);RTArrow(262,186);
00389 InBox(81,182,238,196);RectFill(82,183,237,195,7);
00390 ShBox(302,116,312,145);UPArrow(304,118);
00391 ShBox(302,147,312,176);DNArrow(304,149);
00392
00393 grSetColor(11);
00394 PrintAt(79,35,"LAST THREE LAUNCHED MISSIONS");
00395 PrintAt(90,108,"PAST CURRENT EVENTS");
00396
00397 grSetColor(1);PrintAt(258,13,"CONTINUE");
00398 DispBig(45,5,"VIEWING STAND",0,-1);
00399
00400 i=Data->P[plr].PastMis-1;
00401 misnum=0;
00402 grSetColor(2);
00403 while (i > (Data->P[plr].PastMis-4) && i>=0) {
00404
00405 GetMisType(Data->P[plr].History[i].MissionCode);
00406
00407 PrintAt(9,49+16*misnum,Data->P[plr].History[i].MissionName[0]);
00408 PrintAt(9,55+16*misnum,Mis.Abbr);
00409 PrintAt(140,49+16*misnum,"PRESTIGE: ");DispNum(0,0,Data->P[plr].History[i].Prestige);
00410
00411 PrintAt(230,49+16*misnum,Months[Data->P[plr].History[i].Month]);
00412 PrintAt(0,0," 19");
00413 DispNum(0,0,Data->P[plr].History[i].MissionYear);
00414 i--;misnum++;
00415 };
00416 if (misnum<3) {
00417 grSetColor(1);
00418 PrintAt(9,49+16*misnum,"NO PAST MISSIONS REMAINING");
00419 }
00420
00421
00422 return;
00423 }
00424
00425 void DrawVText(char got)
00426 {
00427 int xx=10,yy=122,i;
00428 char *buf;
00429 buf=buffer;
00430 grSetColor(1);
00431 for (i=0;i<got;i++) {
00432 while(*buf!='x') buf++;
00433 buf++;
00434 if (strncmp(&buf[0],"IN THE NEWS TODAY",18)==0) grSetColor(11);
00435 if (strncmp(&buf[0],"DEVELOPMENTS IN THE WORLD",24)==0) grSetColor(11);
00436 if (strncmp(&buf[0],"ASTRONAUTS IN THE NEWS",22)==0) grSetColor(11);
00437 if (strncmp(&buf[0],"ALSO IN THE NEWS",16)==0) grSetColor(12);
00438 if (strncmp(&buf[0],"IN COSMONAUT NEWS",17)==0) grSetColor(11);
00439 if (strncmp(&buf[0],"OTHER EVENTS IN THE NEWS",24)==0) grSetColor(12);
00440 if (strncmp(&buf[0],"PLANETARY",9)==0) grSetColor(11);
00441 if (strncmp(&buf[0],"CHECK INTEL",11)==0) grSetColor(11);
00442 }
00443
00444 for(i=0;i<8;i++) {
00445 RectFill(6,yy-4,300,yy+1,0);
00446 grMoveTo(xx,yy);
00447 if (strncmp(&buf[0],"ASTRONAUTS IN THE NEWS",22)==0) grSetColor(11);
00448 if (strncmp(&buf[0],"ALSO IN THE NEWS",16)==0) grSetColor(12);
00449 if (strncmp(&buf[0],"IN COSMONAUT NEWS",17)==0) grSetColor(11);
00450 if (strncmp(&buf[0],"OTHER EVENTS IN THE NEWS",24)==0) grSetColor(12);
00451 if (strncmp(&buf[0],"AND THAT'S THE NEWS",19)==0) grSetColor(11);
00452 if (strncmp(&buf[0],"PLANETARY",9)==0) grSetColor(11);
00453 if (strncmp(&buf[0],"THIS CONCLUDES OUR NEWS",23)==0) grSetColor(11);
00454 if (strncmp(&buf[0],"CHECK INTEL",11)==0) grSetColor(11);
00455
00456 while(buf[0]!='x'&& buf[0]!='\0') {DispChr(buf[0]);buf++;};
00457 yy+=7;
00458 buf++;
00459 if (*buf=='\0') i=9;
00460 }
00461 return;
00462 }
00463
00464 int RetFile(char plr,int card)
00465 {
00466 ONEWS oNews;
00467 int bline,i;
00468 FILE *fin;
00469 memset(buffer,0x00,BUFFER_SIZE);
00470 fin=sOpen("EVENT.TMP","rb",1);
00471 fseek(fin,(card+plr*42)*(sizeof (struct oldNews)),SEEK_SET);
00472 fread(&oNews,sizeof(struct oldNews),1,fin);
00473 fseek(fin,oNews.offset,SEEK_SET);
00474 fread(buffer,oNews.size,1,fin);
00475 fclose(fin);
00476 bline=0;
00477 for (i=0;i<(int)strlen(buffer);i++) if (buffer[i]=='x') bline++;
00478 bline-=8;
00479
00480 RectFill(82,183,237,195,7);
00481 grSetColor(11);
00482 if ((card%2)==1) PrintAt(131,191,"FALL 19");
00483 else PrintAt(128,191,"SPRING 19");
00484 DispNum(0,0,(card>>1)+57);
00485
00486 return bline;
00487 }
00488
00489 void Viewing(char plr)
00490 {
00491 int ctop,bline=0,oset,maxcard;
00492 DrawViewing(plr);
00493 maxcard=oset=Data->P[plr].eCount-1;
00494 bline=RetFile(plr,oset);
00495 ctop=0;
00496 DrawVText(ctop);
00497 InBox(244,184,313,194);
00498 FadeIn(2,pal,10,0,0);
00499 music_start(M_SOVTYP);
00500 WaitForMouseUp();
00501 while (1)
00502 {
00503 key=0;GetMouse();
00504 if (ctop>0 && key==0x4900) {
00505 ctop-=9;
00506 if (ctop<0) ctop=0;
00507 DrawVText(ctop);
00508 bzdelay (DELAYCNT);
00509 }
00510 if (ctop<bline && key==0x5100) {
00511 ctop+=9;
00512 if (ctop>bline) ctop=bline;
00513 DrawVText(ctop);
00514 bzdelay (DELAYCNT);
00515 }
00516 if (ctop>0 && ((mousebuttons>0 && x>=302 && y>=116 && x<=312 && y<=145) || key==UP_ARROW)) {
00517 InBox(302,116,312,145);
00518 ctop--; DrawVText(ctop);
00519 bzdelay (DELAYCNT / 2);
00520 OutBox(302,116,312,145);
00521 }
00522 else if (ctop<bline && ((mousebuttons>0 && x>=302 && y>147 && x<=312 && y<=176) || key==DN_ARROW)) {
00523 InBox(302,147,312,176);
00524 ctop++; DrawVText(ctop);
00525 bzdelay (DELAYCNT / 2);
00526 OutBox(302,147,312,176);
00527 }
00528 else if (oset>0 && ((mousebuttons>0 && x>=6 && y>=184 && x<=75 && y<=194) || key==LT_ARROW))
00529 {
00530 InBox(6,184,75,194);
00531 oset--;
00532 bline=RetFile(plr,oset);
00533 ctop=0; DrawVText(ctop);
00534
00535 if (oset!=0) OutBox(6,184,75,194);
00536 bzdelay (DELAYCNT);
00537 OutBox(244,184,313,194);
00538
00539
00540 }
00541 else if (oset<maxcard && ((mousebuttons>0 && x>=244 && y>=184 && x<=313 && y<=194) || key==RT_ARROW)) {
00542 InBox(244,184,313,194);
00543 oset++;
00544 bline=RetFile(plr,oset);
00545 ctop=0; DrawVText(ctop);
00546
00547 if (oset!=maxcard) OutBox(244,184,313,194);
00548 bzdelay (DELAYCNT);
00549 OutBox(6,184,75,194);
00550
00551
00552 }
00553 else if ((mousebuttons>0 && x>=245 && y>=5 && x<=314 && y<=17) || key==K_ENTER || key==K_ESCAPE) {
00554 InBox(245,5,314,17);
00555 if (key>0) delay(150);
00556
00557 music_stop();
00558 return;
00559 };
00560 }
00561 }
00562
00563