void AI_Begin(char plr) { int i; FILE *fin; int32_t len[2]; for (i = 0; i < 768; i++) { pal[i] = 0; } fin = sOpen("TURN.BUT", "rb", 0); fread(&pal, 768, 1, fin); len[0] = fread(screen, 1, MAX_X * MAX_Y, fin); fclose(fin); RLED_img((char *)screen, vhptr.vptr, (unsigned int)len[0], vhptr.w, vhptr.h); gxClearDisplay(0, 0); ShBox(0, 60, 319, 80); grSetColor(6 + plr * 3); if (plr == 0) { DispBig(15, 64, "DIRECTOR OF THE UNITED STATES", 0, -1); } else { DispBig(30, 64, "CHIEF DESIGNER OF THE USSR", 0, -1); } grSetColor(11); grMoveTo(175, 122); if (Data->Season == 0) { PrintAt(0, 0, "SPRING 19"); } else { PrintAt(0, 0, "FALL 19"); } DispNum(0, 0, Data->Year); gxVirtualDisplay(&vhptr, 1 + 110 * plr, 1, 30, 85, 30 + 107, 85 + 93, 0); grSetColor(11); PrintAt(60, 58, "COMPUTER TURN: THINKING..."); music_start(M_SOVTYP); FadeIn(2, pal, 10, 0, 0); colss = 0; }
void MisRev(char plr, int pres) { if (!AI[plr]) { music_start((pres > 0) ? M_SUCCESS : M_UNSUCC); } FadeOut(2, pal, 10, 0, 0); gxClearDisplay(0, 0); ShBox(0, 0, 319, 22); InBox(3, 3, 30, 19); IOBox(243, 3, 316, 19); DispBig(40, 5, "MISSION REVIEW", 0, -1); grSetColor(1); PrintAt(258, 13, "CONTINUE"); FlagSm(plr, 4, 4); key = 0; Draw_Mis_Stats(plr, Data->P[plr].PastMis - 1, 0, 1); key = 0; gxClearDisplay(0, 0); return; }
void DrawFuture(char plr,int mis,char pad) { int i,j; FILE *fin; unsigned sz; strcpy(IKEY,"k011");strcpy(IDT,"i011"); JointFlag=0; // initialize joint flag F1=F2=F3=F4=FMen=F5=0; for (i=0;i<5;i++) lck[i]=status[i]=0; FadeOut(2,pal,10,0,0); Load_FUT_BUT(); fin=sOpen("FMIN.IMG","rb",0); fread(&pal[0],768,1,fin); sz=fread(screen,1,MAX_X*MAX_Y,fin); fclose(fin); RLED_img((char *)screen,(char *)vhptr.vptr,sz,vhptr.w,vhptr.h); gxClearDisplay(0,0); gr_sync (); if (pad==2) JointFlag=0; // third pad automatic no joint mission else if (Data->P[plr].LaunchFacility[pad+1] == 1) { if (Data->P[plr].Future[pad+1].MissionCode==0) JointFlag=1; // if no mission then set joint flag else if (Data->P[plr].Future[pad+1].part==1) // check if the part of that second mission is set { JointFlag=1; Data->P[plr].Future[pad+1].MissionCode=0; // clear mission Data->P[plr].Future[pad+1].part=0; }; }; if (pad==1 || pad==0) { if (Data->P[plr].LaunchFacility[pad+1]==1) JointFlag=1; } i=Data->Year;j=Data->Season; TRACE3("--- Setting i=Year (%d), j=Season (%d)", i, j); if ((i==60 && j==0) || (i==62 && j==0) || (i==64 && j==0) || (i==66 && j==0) || (i==69 && j==1) || (i==71 && j==1) || (i==73 && j==1)) { gxVirtualVirtual(&vhptr,1,2,12,11,&vhptr,198,153,gxSET); /* Mars */ MarFlag=1; } else MarFlag=0; if ((i==60 || i==64 || i==68 || i==72 || i==73 || i==77)) { gxVirtualVirtual(&vhptr,14,2,64,54,&vhptr,214,130,gxSET); /* Jup */ JupFlag=1; } else JupFlag=0; if (i==61 || i==66 || i==72) { gxVirtualVirtual(&vhptr,66,2,114,53,&vhptr,266,135,gxSET); /* Sat */ SatFlag=1; } else SatFlag=0; RectFill(1,1,318,21,3);RectFill(317,22,318,198,3);RectFill(1,197,316,198,3); RectFill(1,22,2,196,3);OutBox(0,0,319,199);InBox(3,3,30,19); InBox(3,22,316,196); IOBox(242,3,315,19); ShBox(5,24,183,47); ShBox(5,24,201,47); //name box ShBox(5,74,41,82); // RESET ShBox(5,49,53,72); //dur/man ShBox(43,74,53,82); // lock ShBox(80,74,90,82); ShBox(117,74,127,82); ShBox(154,74,164,82); ShBox(191,74,201,82); ShBox(5,84,16,130); //arrows up ShBox(5,132,16,146); //middle box ShBox(5,148,16,194); // down ShBox(203,24,238,31); // new right boxes RectFill(206,36,235,44,7); ShBox(203,33,238,47); InBox(205,35,236,45); UPArrow(8,95);DNArrow(8,157); gxVirtualDisplay(&vh,140,5,5,132,15,146,0); Toggle(5,1);draw_Pie(0);OutBox(5,49,53,72); Toggle(1,1);TogBox(55,49,0); Toggle(2,1);TogBox(92,49,0); Toggle(3,1);TogBox(129,49,0); FMen=F1=F2=F3=F4=F5=0; for (i=1;i<4;i++){ if (status[i]!=0) { Toggle(i,1); } }; if (JointFlag==0) { F4=2;lck[4]=1; Toggle(4,1); InBox(191,74,201,82); PlaceRX(5); TogBox(166,49,1); } else { F4=0; lck[4]=0; status[4]=0; Toggle(4,1); OutBox(191,74,201,82); ClearRX(5); TogBox(166,49,0); }; gr_sync (); Missions(plr,8,37,mis,1); GetMinus(plr); grSetColor(5); /* lines of text are 1:8,30 2:8,37 3:8,44 */ switch(pad) { // These used to say Pad 1, 2, 3 -Leon case 0: PrintAt(8,30,"PAD A:");break; case 1: PrintAt(8,30,"PAD B:");break; case 2: PrintAt(8,30,"PAD C:");break; default:break; }; grSetColor(1); PrintAt(9,80,"RESET"); PrintAt(256,13,"CONTINUE"); grSetColor(11); if (Data->Season==0) PrintAt(200,9,"SPRING"); else PrintAt(205,9,"FALL"); PrintAt(206,16,"19"); DispNum(0,0,Data->Year); grSetColor(1); FlagSm(plr,4,4); DispBig(40,5,"FUTURE MISSIONS",0,-1); FadeIn(2,pal,10,0,0); return; }
void DrawReview(char plr) { int clr, i, cte, P_value; char Fired_Flag = 0, Reset_Flag = 0; if (Data->P[plr].PresRev[0] != 0x7F) { FadeOut(2, pal, 10, 0, 0); } PortPal(plr); gxClearDisplay(0, 0); if (Data->P[plr].PresRev[0] == 0x7F) { Fired_Flag = 1; Data->P[plr].PresRev[0] = 16; } else if (Data->P[plr].PresRev[0] >= 16) { Reset_Flag = 1; Data->P[plr].PresRev[0] = 15; } ShBox(0, 0, 319, 22); ShBox(0, 24, 319, 199); FlagSm(plr, 4, 4); RectFill(5, 28, 314, 195, 0); RectFill(5, 122, 314, 195, 0); ShBox(6, 123, 313, 194); RectFill(7, 124, 312, 193, 9); InBox(11, 128, 307, 189); RectFill(12, 129, 306, 188, 7); ShBox(6, 29, 177, 121); ShBox(179, 29, 313, 121); InBox(182, 32, 309, 117); InBox(3, 3, 30, 19); IOBox(243, 3, 316, 19); if (plr == 0) { DispBig(40, 5, "PRESIDENTIAL REVIEW", 0, -1); } else { DispBig(40, 5, "POLITBURO REVIEW", 0, -1); } grSetColor(1); PrintAt(257, 13, "CONTINUE"); grSetColor(1); PrintAt(59, 36, "JOB PERFORMANCE"); grSetColor(6); PrintAt(8, 46, "GOOD"); grSetColor(1); PrintAt(8, 77, "FAIR"); grSetColor(9); PrintAt(8, 109, "POOR"); grSetColor(1); DispNum(154, 117, Data->Year - 1); DispNum(126, 117, Data->Year - 2); DispNum(97, 117, Data->Year - 3); DispNum(70, 117, Data->Year - 4); DispNum(42, 117, Data->Year - 5); RectFill(32, 39, 172, 111, 0); GradRect(33, 39, 171, 74, 0); GradRect(33, 75, 171, 110, 0); grSetColor(3); pline(60, 40, 60, 110); pline(88, 40, 88, 110); pline(116, 40, 116, 110); pline(144, 40, 144, 110); pline(33, 48, 171, 48); pline(33, 57, 171, 57); pline(33, 66, 171, 66); pline(33, 75, 171, 75); pline(33, 84, 171, 84); pline(33, 93, 171, 93); pline(33, 102, 171, 102); InBox(32, 39, 172, 111); for (i = 0; i < 5; i++) if (Data->P[plr].PresRev[i] > 16) { Data->P[plr].PresRev[i] = 16; } for (i = 0; i < 5; i++) { cte = 0; if (Data->P[plr].PresRev[i] < 8) { if (Data->P[plr].PresRev[i] == 7) { cte = 73; } else { cte = 40 + Data->P[plr].PresRev[i] * 5; } } else if (Data->P[plr].PresRev[i] > 8) { if (Data->P[plr].PresRev[i] == 9) { cte = 77; } else { cte = 80 + (Data->P[plr].PresRev[i] - 10) * 5; } }; if (Data->P[plr].PresRev[i] == 8) { cte = 73; } RectFill(166 - i * 28, 75, 151 - i * 28, cte, 5 + ((Data->P[plr].PresRev[i] <= 8) ? 0 : 3)); grSetColor(6 + ((Data->P[plr].PresRev[i] <= 8) ? 0 : 3)); pline(167 - i * 28, 75, 167 - i * 28, cte); } if (Fired_Flag == 1) { clr = 0; for (i = 0; i < Data->P[plr].AstroCount; i++) if (Data->P[plr].Pool[i].Status == AST_ST_DEAD) { clr++; } Data->P[plr].PresRev[0] = (clr >= 2) ? 17 : 16; } DrawRevText(plr, Data->P[plr].PresRev[0]); if (Data->P[plr].PresRev[0] == 17) { Data->P[plr].PresRev[0] = 16; } P_value = 0; // 0 pres. 1 v.p. if (plr == 0) { if (Data->P[plr].PresRev[0] <= 4 || Data->P[plr].PresRev[0] >= 11) { P_value = 0; } else { P_value = 1; } }; if (plr == 1) { if (Data->P[plr].PresRev[0] <= 4 || Data->P[plr].PresRev[0] >= 12) { P_value = 0; } else { P_value = 1; } } if (plr == 0) { if (Data->Year <= 60) { if (P_value == 0) { PresPict(0); } else { PresPict(1); } } else if (Data->Year >= 61 && Data->Year <= 63) { if (P_value == 0) { PresPict(2); } else { PresPict(3); } } else if (Data->Year >= 64 && Data->Year <= 68) { if (P_value == 0) { PresPict(4); } else { PresPict(5); } } else if (Data->Year >= 69 && Data->Year <= 73) { if (P_value == 0) { PresPict(6); } else { PresPict(7); } } else if (Data->Year >= 74 && Data->Year <= 76) { if (P_value == 0) { PresPict(8); } else { PresPict(9); } } else if (Data->Year >= 77) { if (P_value == 0) { PresPict(10); } else { PresPict(11); } } } if (plr == 1) { if (Data->Year < 61) { if (P_value == 0) { PresPict(14); } else { PresPict(15); } } else if (Data->Year <= 64) { if (P_value == 0) { PresPict(12); } else { PresPict(13); } } else if (Data->Year >= 65) { if (P_value == 0) { PresPict(16); } else { PresPict(17); } } } if (Reset_Flag == 1) { Data->P[plr].PresRev[0] = 16; } FadeIn(2, pal, 10, 0, 0); return; }
void DrawLimbo(char plr) { int i; FadeOut(2,pal,10,0,0); strcpy(IDT,"i039");strcpy(IKEY,"k039"); gxClearDisplay(0,0); ShBox(0,0,319,22);InBox(3,3,30,19);IOBox(243,3,316,19); grSetColor(1);PrintAt(258,13,"CONTINUE"); if (plr==0) DispBig(36,5,"ASTRONAUT COMPLEX",0,-1); else DispBig(40,5,"COSMONAUT CENTER",0,-1); ShBox(0,24,158,199); InBox(9,51,90,102); RectFill(25,129,153,195,0);RectFill(5,129,19,195,0); ShBox(6,130,18,161);ShBox(6,163,18,194); UPArrow(8,133);DNArrow(8,166); ShBox(161,24,319,72);InBox(165,28,315,42);RectFill(166,29,314,41,7); ShBox(161,74,319,199);InBox(165,77,315,89);RectFill(166,78,314,88,10); RectFill(10,52,89,101,7+plr*3); InBox(165,46,315,67);RectFill(166,47,314,66,0); ShBox(167,48,239,65);ShBox(241,48,313,65); InBox(167,48,239,65); InBox(4,128,20,196); InBox(24,128,154,196); // new boxes OutBox(0,24,158,47);OutBox(0,105,158,128); InBox(9,28,148,42);InBox(9,108,148,123); grSetColor(20); PrintAt(180,55,"TRANSFER"); if (plr==0) PrintAt(178,62,"ASTRONAUT"); else PrintAt(178,62,"COSMONAUT"); PrintAt(256,55,"FACILITY");PrintAt(254,62,"TRANSFER"); RectFill(166,78,314,88,10); grSetColor(11);PrintAt(185,85,"TRANSFER TO LOCATION"); for (i=0;i<5;i++) { IOBox(165,93+21*i,238,111+21*i); IOBox(242,93+21*i,315,111+21*i); if (Data->P[plr].Manned[i].Num<0) { InBox(167,95+21*i,236,109+21*i); grSetColor(17); } else grSetColor(11); lenprogname=(7-strlen(Data->P[plr].Manned[i].Name))*3; //lenprogname=(7-lenprogname)*2 PrintAt(181+lenprogname,101+21*i,Data->P[plr].Manned[i].Name); PrintAt(181,107+21*i,"PROGRAM"); grSetColor(11); PrintAt(257,107+21*i,"TRAINING"); //grMoveTo(254,101+21*i); This remmed out to manually place the Adv. Training names so they could be centered -Leon switch(i) { case 0: PrintAt(258,101+21*i,"CAPSULE");break; case 1: PrintAt(271,101+21*i,"L.M.");break; case 2: PrintAt(268,101+21*i,"E.V.A.");break; case 3: PrintAt(259,101+21*i,"DOCKING");break; case 4: PrintAt(252,101+21*i,"ENDURANCE");break; default: break; } } grSetColor(11);PrintAt(187,37,"OPERATION SELECTION"); grSetColor(20); //PrintAt(258,13,"CONTINUE"); PrintAt(15,37,"NAME:"); PrintAt(17,118,"GROUP:"); PrintAt(88,118,"TENURE:"); grSetColor(11); PrintAt(102,60,"MOOD:"); PrintAt(102,68,"CAP:"); PrintAt(102,76,"L.M.:"); PrintAt(102,84,"EVA:"); PrintAt(102,92,"DOCK:"); PrintAt(102,100,"END:"); FlagSm(plr,4,4); return; }
void DrawStatistics(char Win) { GXHEADER local; char AImg[7] = {8, 9, 10, 11, 13, 14, 0}; char Digit[2]; int starty, qty, i; FILE *fin; strncpy(helptextIndex, "i145", 4); strncpy(keyhelpIndex, "k045", 4); FadeOut(2, pal, 10, 0, 0); PortPal(0); gxClearDisplay(0, 0); ShBox(35, 33, 288, 159); InBox(40, 69, 111, 109); InBox(116, 69, 283, 109); InBox(40, 114, 111, 154); InBox(116, 114, 283, 154); IOBox(191, 40, 280, 62); Flag(41, 70, Win); Flag(41, 115, other(Win)); DispBig(48, 44, "STATISTICS", 1, -1); DispBig(215, 45, "EXIT", 1, -1); grSetColor(6); PrintAt(122, 78, "WINNING DIRECTOR: "); grSetColor(8); if (AI[Win]) { PrintAt(0, 0, "COMPUTER"); sprintf(&Digit[0], "%d", Data->P[Win].Track[3]); PrintAt(0, 0, &Digit[0]); } else if (Win == 0) { PrintAt(0, 0, &Data->P[Data->Def.Plr1].Name[0]); } else { PrintAt(0, 0, &Data->P[ Data->Def.Plr2 ].Name[0]); } grSetColor(6); PrintAt(122, 125, "LOSING DIRECTOR: "); grSetColor(8); if (AI[other(Win)]) { PrintAt(0, 0, "COMPUTER"); sprintf(&Digit[0], "%d", Data->P[other(Win)].Track[3]); PrintAt(0, 0, &Digit[0]); } else if (Win == 0) { PrintAt(0, 0, &Data->P[Data->Def.Plr2].Name[0]); } else { PrintAt(0, 0, &Data->P[ Data->Def.Plr1 ].Name[0]); } qty = 6; starty = 118; GV(&local, 30, 19); fin = sOpen("PORTBUT.BUT", "rb", 0); OutBox(152, 41, 183, 61); //directors ranking for (i = 0; i < qty; i++) { if (i <= 4 && AI[Win] == 0) { OutBox(starty + (i * 33), 87, 31 + starty + (i * 33), 107); } if (i <= 4 && AI[other(Win)] == 0) { OutBox(starty + (i * 33), 132, 31 + starty + (i * 33), 152); } fseek(fin, AImg[i] * 570, SEEK_SET); fread((char *)local.vptr, 570, 1, fin); if (i == 0) { gxPutImage(&local, gxSET, 153, 42, 0); } else { if (AI[Win] == 0) { gxPutImage(&local, gxSET, starty + ((i - 1) * 33) + 1, 88, 0); } if (AI[other(Win)] == 0) { gxPutImage(&local, gxSET, starty + ((i - 1) * 33) + 1, 133, 0); } } } fclose(fin); DV(&local); FadeIn(2, pal, 10, 0, 0); return; }