void MissionName(int val, int xx, int yy, int len) { TRACE5("->MissionName(val %d, xx %d, yy %d, len %d)", val, xx, yy, len); int i, j = 0; GetMisType(val); grMoveTo(xx, yy); for (i = 0; i < 50; i++) { if (j > len && Mis.Name[i] == ' ') { yy += 7; j = 0; grMoveTo(xx, yy); } else { draw_character(Mis.Name[i]); } j++; if (Mis.Name[i] == '\0') { break; } } TRACE1("<-MissionName"); return; }
void AIVabCheck(char plr, char mis, char prog) { VASqty = 0; //prog=1; 0=UnM : 1=1Mn ... GetMisType(mis); whe[0] = whe[1] = -1; if (prog == 5) { if (Mis.Jt == 0 && Mis.LM == 0 && Mis.Doc == 0) { BuildVAB(plr, mis, 1, 0, prog - 1); CalcSaf(plr, VASqty); whe[0] = Best(); if (Mew[whe[0]].i < 60) { whe[0] = 0; // Weed out low safety's } } } else if (prog >= Mis.mEq && (prog != 0)) { // && (Mis.mVab[0]&0x80 || Mis.mVab[1]&0x80)) ) if (Mis.Jt == 1) { // Joint mission BuildVAB(plr, mis, 1, 0, prog - 1); // first launch CalcSaf(plr, VASqty); whe[0] = Best(); if (Mew[whe[0]].i < 60) { whe[0] = 0; } BuildVAB(plr, mis, 1, 1, prog - 1); CalcSaf(plr, VASqty); whe[1] = Best(); if (Mew[whe[1]].i < 60) { whe[1] = 0; // Weed out low safety's } } else { // RectFill(100,100,200,190,5); // PrintAt(110,110,"MIS ");DispNum(0,0,mis); // PrintAt(110,120,"PRG ");DispNum(0,0,prog); // PauseMouse(); BuildVAB(plr, mis, 1, 0, prog - 1); // PrintAt(110,130,"VAS ");DispNum(0,0,VASQTY); CalcSaf(plr, VASqty); whe[0] = Best(); if (Mew[whe[0]].i < 60) { whe[0] = 0; } } } else if (prog == 0 && prog == Mis.mEq) { // Unmanned Vechicle BuildVAB(plr, mis, 1, 0, prog); // plr,mcode,ty=1,part,prog CalcSaf(plr, VASqty); whe[0] = Best(); // if (Mew[whe[0]].i<30) whe[0]=0; // ShowVA(whe[0]); } return; }
void Rush(char plr) { int i, R1, R2, R3, oR1, oR2, oR3, dgflag[3] = {0, 0, 0}; char pRush = 0; R1 = R2 = R3 = oR1 = oR2 = oR3 = 0; fCsh = 0; DrawRush(plr); pRush = (Data->P[plr].Cash >= 3) ? 1 : 0; fCsh = Data->P[plr].Cash; display::graphics.setForegroundColor(1); music_start((plr == 1) ? M_USMIL : M_USSRMIL); FadeIn(2, display::graphics.palette(), 10, 0, 0); WaitForMouseUp(); while (1) { key = 0; GetMouse(); if (mousebuttons > 0 || key > 0) { if (((y >= 32 && y <= 74 && x >= 280 && x <= 312 && mousebuttons > 0) || (key >= '1' && key <= '3')) && pRush && Data->P[plr].Mission[0].MissionCode && Data->P[plr].Mission[0].part != 1) { /* L1: Row One */ // R1=oR1; if (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && oR1 != 1 && fCsh < 3) { Help("i117"); } R1 = (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && fCsh >= 3) ? 1 : R1; if (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && oR1 != 2 && fCsh < 6) { Help("i117"); } R1 = (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && fCsh >= 6) ? 2 : R1; R1 = ((y >= 32 && y <= 40 && mousebuttons > 0) || key == '1') ? 0 : R1; if (oR1 != R1) { ResetRush(oR1, 0); SetRush(R1, 0); oR1 = R1; } } else if (((x >= 280 && x <= 312 && y >= 90 && y <= 132 && mousebuttons > 0) || (key >= '4' && key <= '6')) && pRush && Data->P[plr].Mission[1].MissionCode && Data->P[plr].Mission[1].part != 1) { /* L2: Row One */ // R2=oR2; if (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && oR2 != 1 && fCsh < 3) { Help("i117"); } R2 = (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && fCsh >= 3) ? 1 : R2; if (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && oR2 != 2 && fCsh < 6) { Help("i117"); } R2 = (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && fCsh >= 6) ? 2 : R2; R2 = ((y >= 90 && y <= 98 && mousebuttons > 0) || key == '4') ? 0 : R2; if (oR2 != R2) { ResetRush(oR2, 1); SetRush(R2, 1); oR2 = R2; } } else if (((x >= 280 && x <= 312 && y >= 148 && y <= 190 && mousebuttons > 0) || (key >= '7' && key <= '9')) && pRush && Data->P[plr].Mission[2].MissionCode && Data->P[plr].Mission[2].part != 1) { /* L3: Row One */ // R3=oR3; if (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && oR3 != 1 && fCsh < 3) { Help("i117"); } R3 = (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && fCsh >= 3) ? 1 : R3; if (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && oR3 != 2 && fCsh < 6) { Help("i117"); } R3 = (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && fCsh >= 6) ? 2 : R3; R3 = ((y >= 148 && y <= 156 && mousebuttons > 0) || key == '7') ? 0 : R3; if (oR3 != R3) { ResetRush(oR3, 2); SetRush(R3, 2); oR3 = R3; } }; // DOWNGRADE MISSION KEYBOARD if (key == 'Q' || key == 'R' || key == 'U') { if (key == 'Q') { i = 0; } else if (key == 'R') { i = 1; } else if (key == 'U') { i = 2; } else { i = 0; } if (Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part != 1) { InBox(91, 41 + i * 58, 264, 59 + i * 58); fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3); if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) { fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0); dgflag[i]++; fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { dgflag[i] = 0; fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(Data->P[plr].Mission[i].MissionCode); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0); fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); if (Data->P[plr].Mission[i].Name[24] == 1) { display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { display::graphics.setForegroundColor(7); draw_string(145, 33 + i * 58, "ORIGINAL MISSION"); draw_string(193, 77 + i * 58, "NO PENALTY"); } //display::graphics.setForegroundColor(7); //draw_string(145,33+i*58,"ORIGINAL MISSION"); //draw_string(193,77+i*58,"NO PENALTY"); } WaitForMouseUp(); OutBox(91, 41 + i * 58, 264, 59 + i * 58); } }; for (i = 0; i < 3; i++) { if (x >= 91 && x <= 264 && y >= 41 + i * 59 && y <= 59 + i * 59 && mousebuttons > 0 && Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part != 1) { // Downgrade InBox(91, 41 + i * 58, 264, 59 + i * 58); fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3); if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) { fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0); dgflag[i]++; fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { dgflag[i] = 0; fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3); display::graphics.setForegroundColor(5); GetMisType(Data->P[plr].Mission[i].MissionCode); draw_string(96, 48 + 58 * i, Mis.Abbr); if (Mis.Dur >= 1) { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0); fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3); if (Data->P[plr].Mission[i].Name[24] == 1) { display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { display::graphics.setForegroundColor(7); draw_string(145, 33 + i * 58, "ORIGINAL MISSION"); draw_string(193, 77 + i * 58, "NO PENALTY"); } //display::graphics.setForegroundColor(7); //draw_string(145,33+i*58,"ORIGINAL MISSION"); //draw_string(193,77+i*58,"NO PENALTY"); } WaitForMouseUp(); OutBox(91, 41 + i * 58, 264, 59 + i * 58); } }; if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { // CONTINUE InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); delay(10); for (i = 0; i < 3; i++) { if (Data->P[plr].Mission[i].MissionCode) { if (dgflag[i] != 0) { Data->P[plr].Mission[i].MissionCode = dg[Data->P[plr].Mission[i].MissionCode][dgflag[i] - 1]; pNeg[plr][i] = 1; } } } if (Data->P[plr].Mission[1].part == 1) { R2 = R1; } if (Data->P[plr].Mission[2].part == 1) { R3 = R2; } if (Data->P[plr].Mission[0].MissionCode && Data->P[plr].Cash >= 3 * R1) { Data->P[plr].Cash -= 3 * R1; Data->P[plr].Mission[0].Month -= R1; Data->P[plr].Mission[0].Rushing = R1; }; if (Data->P[plr].Mission[1].MissionCode && Data->P[plr].Cash >= 3 * R2) { Data->P[plr].Cash -= 3 * R2; Data->P[plr].Mission[1].Month -= R2; Data->P[plr].Mission[1].Rushing = R2; }; if (Data->P[plr].Mission[2].MissionCode && Data->P[plr].Cash >= 3 * R3) { Data->P[plr].Cash -= 3 * R3; Data->P[plr].Mission[2].Month -= R3; Data->P[plr].Mission[2].Rushing = R3; } music_stop(); return; // Done } } } }
void DrawRush(char plr) { int i = 0; int k = 0; int l = 0; int JR = 0; FadeOut(2, display::graphics.palette(), 10, 0, 0); boost::shared_ptr<display::PalettizedSurface> launchPads(Filesystem::readImage("images/lpads.but.1.png")); launchPads->exportPalette(); display::graphics.screen()->clear(0); JR = 0; for (l = 0; l < 3; l++) { if (Data->P[plr].Mission[l].Joint == 1) { JR = 1; } if (Data->P[plr].Mission[l].MissionCode && Data->P[plr].Mission[l].part == 0) { k++; } if (Data->P[plr].Mission[l].Rushing == 1) { Data->P[plr].Cash += 3; } else if (Data->P[plr].Mission[l].Rushing == 2) { Data->P[plr].Cash += 6; } Data->P[plr].Mission[l].Rushing = 0; // Clear Data } if (k == 3) { // Three non joint missions Data->P[plr].Mission[0].Month = 2 + Data->Season * 6; Data->P[plr].Mission[1].Month = 3 + Data->Season * 6; Data->P[plr].Mission[2].Month = 4 + Data->Season * 6; }; if (k == 2 && JR == 0) { // Two non joint missions l = 3; if (Data->P[plr].Mission[0].MissionCode) { Data->P[plr].Mission[0].Month = l + Data->Season * 6; l += 2; }; if (Data->P[plr].Mission[1].MissionCode) { Data->P[plr].Mission[1].Month = l + Data->Season * 6; l += 2; }; if (Data->P[plr].Mission[2].MissionCode) { Data->P[plr].Mission[2].Month = l + Data->Season * 6; } }; if (k == 1 && JR == 0) { // Single Mission Non joint if (Data->P[plr].Mission[0].MissionCode) { Data->P[plr].Mission[0].Month = 4 + Data->Season * 6; } if (Data->P[plr].Mission[1].MissionCode) { Data->P[plr].Mission[1].Month = 4 + Data->Season * 6; } if (Data->P[plr].Mission[2].MissionCode) { Data->P[plr].Mission[2].Month = 4 + Data->Season * 6; } }; if (k == 2 && JR == 1) { // Two launches, one Joint; if (Data->P[plr].Mission[1].part == 1) { // Joint first Data->P[plr].Mission[0].Month = 3 + Data->Season * 6; Data->P[plr].Mission[1].Month = 3 + Data->Season * 6; Data->P[plr].Mission[2].Month = 5 + Data->Season * 6; }; if (Data->P[plr].Mission[2].part == 1) { // Joint second Data->P[plr].Mission[0].Month = 3 + Data->Season * 6; Data->P[plr].Mission[1].Month = 5 + Data->Season * 6; Data->P[plr].Mission[2].Month = 5 + Data->Season * 6; }; }; if (k == 1 && JR == 1) { // Single Joint Launch if (Data->P[plr].Mission[1].part == 1) { // found on pad 1+2 Data->P[plr].Mission[0].Month = 4 + Data->Season * 6; Data->P[plr].Mission[1].Month = 4 + Data->Season * 6; } else { // found on pad 2+3 Data->P[plr].Mission[1].Month = 4 + Data->Season * 6; Data->P[plr].Mission[2].Month = 4 + Data->Season * 6; }; } ShBox(0, 0, 319, 23); IOBox(243, 3, 316, 19); InBox(3, 3, 30, 19); display::graphics.setForegroundColor(1); draw_string(263, 13, "ASSIGN"); draw_small_flag(plr, 4, 4); for (i = 0; i < 3; i++) { if (Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part == 0) { ShBox(0, 25 + i * 58, 80, 82 + i * 58 - 1); ShBox(83, 25 + i * 58, 319, 82 + i * 58 - 1); IOBox(278, 30 + i * 58, 314, 42 + i * 58); IOBox(278, 47 + i * 58, 314, 59 + i * 58); IOBox(278, 64 + i * 58, 314, 76 + i * 58); IOBox(89, 39 + i * 58, 266, 61 + i * 58); display::graphics.setForegroundColor(1); draw_string(89, 33 + i * 58, "SCHEDULE:"); draw_string(88, 69 + i * 58, "RUSHING PENALTY: "); draw_string(88, 77 + i * 58, "DOWNGRADE PENALTY: "); draw_string(199, 69 + i * 58, "COST:"); OutBox(11 , 33 + i * 58, 69, 74 + i * 58); InBox(20, 38 + i * 58, 60, 69 + i * 58); display::graphics.screen()->draw(launchPads, 156 * plr, i * 30, 39, 30, 21, 39 + i * 58); SetRush(Data->P[plr].Mission[i].Rushing, i); display::graphics.setForegroundColor(1); draw_heading(55, 5, "MISSION SCHEDULE", 0, -1); display::graphics.setForegroundColor(5); GetMisType(Data->P[plr].Mission[i].MissionCode); draw_string(96, 48 + 58 * i, Mis.Abbr); int MisCod; MisCod = Data->P[plr].Mission[i].MissionCode; if ((MisCod > 24 && MisCod < 32) || MisCod == 33 || MisCod == 34 || MisCod == 35 || MisCod == 37 || MisCod == 40 || MisCod == 41) // Show duration level only on missions with a Duration step - Leon { switch (Data->P[plr].Mission[i].Duration) { case 1: draw_string(0, 0, ""); break; case 2: draw_string(0, 0, " (B)"); break; case 3: draw_string(0, 0, " (C)"); break; case 4: draw_string(0, 0, " (D)"); break; case 5: draw_string(0, 0, " (E)"); break; case 6: draw_string(0, 0, " (F)"); break; default: draw_string(0, 0, ""); break; } } if (Data->P[plr].Mission[i].Name[24] == 1) { display::graphics.setForegroundColor(9); draw_string(145, 33 + i * 58, "DOWNGRADED MISSION"); draw_string(193, 77 + i * 58, "-3 PRESTIGE"); } else { display::graphics.setForegroundColor(7); draw_string(145, 33 + i * 58, "ORIGINAL MISSION"); draw_string(193, 77 + i * 58, "NO PENALTY"); } display::graphics.setForegroundColor(11); draw_string(288, 38 + 58 * i, &Mon[Data->P[plr].Mission[i].Month - 0][0]); draw_string(288, 55 + 58 * i, &Mon[Data->P[plr].Mission[i].Month - 1][0]); draw_string(288, 72 + 58 * i, &Mon[Data->P[plr].Mission[i].Month - 2][0]); }; /* End if */ }; /* End for i */ return; }
char REvent(char plr) { FILE *fin; int32_t NoMods=1,i=0,j=0; int16_t m; if (NoMods==1) { m=0; if (Data->P[plr].Budget<40) Data->P[plr].Budget=40; if (Data->P[plr].Budget<=50) j=0; if (Data->P[plr].Budget>50 && Data->P[plr].Budget<=90) j=1; if (Data->P[plr].Budget>90 && Data->P[plr].Budget<=110) j=2; if (Data->P[plr].Budget>110 && Data->P[plr].Budget<=140) j=3; if (Data->P[plr].Budget>140 && Data->P[plr].Budget<=160) j=4; if (Data->P[plr].Budget>160) j=5; fin=sOpen("NTABLE.DAT","rb",0); fseek(fin,(sizeof (i16)) * ((plr*60) + (j*10) + random(10)) ,SEEK_SET); fread(&m,sizeof m,1,fin); Swap16bit(m); // m=BudgetMods[Data->P[plr].Level][(j*10)+random(10)]; // orig code fclose(fin); Data->P[plr].Budget+=m; /*grSetColor(15); PrintAt(200,30,"BUDGET MOD: "); if (m<0) {PrintAt(0,0,"-");m*=-1;}; DispNum(0,0,m); PrintAt(200,40,"BUDGET: "); DispNum(0,0,Data->P[plr].Budget); DispNum(100,10,Data->Events[Data->Count]);*/ } /* end if */ if (Data->Year<=60 && Data->Events[Data->Count]>44) return 1; if (Data->Year<=62 && Data->Events[Data->Count]>63) return 1; if (Data->Year<=65 && Data->Events[Data->Count]>80) return 1; switch(Data->Events[Data->Count]) { case 0: NoMods=0;break; // Nothing Event case 1: case 44: case 59: case 63: // Nothing Events case 67: case 68: case 69: case 70: case 71: case 72: case 73: case 74: case 75: case 81: case 86: case 87: case 88: case 90: case 97: case 98: break; // Cash Modifier Events -------------------------- case 30: case 32: evflag=random(10)+1; Data->P[plr].Cash+=evflag; break; case 31: evflag=random(6)+random(6)+random(6)+3; Data->P[plr].Cash+=evflag; break; case 33:if (Data->P[plr].Cash<10) return 1; evflag=Data->P[plr].Cash/10; Data->P[plr].Cash-=evflag; break; // Budget Modifier Events ------------------------ case 9: case 76: // Budget increase of 15 MB Data->P[plr].Budget+=15; NoMods=0; break; case 45: // increase budget by total two 10 side dice this year evflag=random(10)+random(10)+2; Data->P[plr].Budget+=evflag; NoMods=0; break; case 46: // increase budget by 5 MB's Data->P[plr].Budget+=5; NoMods=0; break; case 91: // increase budget by 20MB's in the budget if (Data->Year>65) return 1; Data->P[plr].Budget+=20; NoMods=0; break; case 92: // 20% or 20MB's whichever is less if ((Data->P[plr].Budget/5) < 20) evflag=Data->P[plr].Budget*4/5; else evflag=20; Data->P[plr].Budget-=evflag; break; case 95: // 30% or 30MB's whichever is less if ((Data->P[plr].Budget/3) < 30) evflag=Data->P[plr].Budget*7/10; else evflag=30; Data->P[plr].Budget-=evflag; evflag=Data->P[plr].Budget; break; case 96: // 25% or 25Mb's whichever is less if (Data->Year>72) return 1; if ((Data->P[plr].Budget/4) < 25) evflag=Data->P[plr].Budget*3/4; else evflag=25; Data->P[plr].Budget-=evflag; evflag=Data->P[plr].Budget; break; case 99:// deduct 5 M.B.s from budget Data->P[plr].Budget-=5; break; // RD Modifier Events ---------------------------- case 2: case 12: case 13: case 14: // RD improve by 1 : season case 15: case 16: case 17: case 18: Data->P[plr].RDMods+=1; break; case 3: case 61: case 62:// Minus one on all R&D for ONE year Data->P[plr].RDMods-=1; Data->P[plr].RDYear=-1; break; case 19: // minus 2 on each die roll for R&D this turn Data->P[plr].RDMods-=2; break; case 41: // R&D will decrease for one year Data->P[plr].RDMods-=2; Data->P[plr].RDYear-=2; break; case 42: case 43: /* increment R&D cost by 1 on particular program */ evflag=RDMods(plr,0,1,1); if (evflag==0) return 1; break; // Improve/Subtract Tech to Other players ------------------- case 5: case 47: // Improve tech of plr prog to other's prog evflag=Steal(plr,0,1); if (evflag==0) return 1; break; case 6: case 7: // Lower tech of plr prog to other's prog evflag=Steal(plr,0,-1); if (evflag==0) return 1; break; // Special Events ------------------------------------------- case 8: // Allow females into space program Data->P[plr].Female=1; break; // Launch Affected ------------------------------------------ case 4: // Next Launch must be a manned launch. If the launch // is not so then -10 on Budget //Data->P[plr].Plans=1; break; case 10: /* Launch window for Launch #x is blocked */ { int choice[3] = {0,0,0}; evflag=0; if (Data->P[plr].Mission[0].MissionCode > 0) choice[evflag++] = 1; if (Data->P[plr].Mission[1].MissionCode > 0) choice[evflag++] = 2; if (Data->P[plr].Mission[2].MissionCode > 0) choice[evflag++] = 3; if (evflag==0) return 1; evflag = choice[random(evflag)] - 1; xMODE |= xMODE_CLOUDS; ClrMiss(plr,evflag+3); } break; case 35: // may launch only one mission this year ??? Season?!? evflag=0; if (Data->P[plr].Mission[0].Joint==1 || Data->P[plr].Mission[1].Joint==1) return 1; if (Data->P[plr].Mission[0].MissionCode > 0) evflag+=1; if (Data->P[plr].Mission[1].MissionCode > 0) evflag+=2; if (Data->P[plr].Mission[2].MissionCode > 0) evflag+=4; if (evflag==0) return 1; switch (evflag) { case 1: evflag=0;break; case 2: evflag=0;break; case 3: ClrMiss(plr,1+3);break; case 4: evflag=0;break; case 5: ClrMiss(plr,2+3);break; case 6: ClrMiss(plr,2+3);break; case 7: ClrMiss(plr,1+3);ClrMiss(plr,2+3);break; }; if (evflag==0) return 1; break; case 36: /* damage launch facility */ if (Data->P[plr].Mission[0].MissionCode==0) Data->P[plr].LaunchFacility[0]=15; else return 1; break; // Program Saving cards ------------------------------------ case 11: /* Select program and set safety save to 1 */ evflag=SaveMods(plr,0); if (evflag==0) return 1; break; case 77: // set Save for Capsule Program evflag=SaveMods(plr,3); if (evflag==0) return 1; break; case 93: // set Save for LEM Program evflag=SaveMods(plr,4); if (evflag==0) return 1; break; case 20: /* the most advanced rocket program is affected. drop the safety factor in half. */ evflag=0; for (i=3;i>=0;i--) if (Data->P[plr].Rocket[i].Num>=0 && Data->P[plr].Rocket[i].Safety>50) evflag++; if (evflag==0) return 1; for (i=3;i>=0;i--) if (Data->P[plr].Rocket[i].Num>=0 && Data->P[plr].Rocket[i].Safety>50) { evflag=Data->P[plr].Rocket[i].Safety/2; Data->P[plr].Rocket[i].Safety-=evflag; strcpy(&Name[0],&Data->P[plr].Rocket[i].Name[0]); break; }; break; case 21: // Probes' and Sats' Max SF and RD up 5% */ for (i=1;i<3;i++) { Data->P[plr].Probe[i].MaxRD+=5; Data->P[plr].Probe[i].MaxSafety+=5; }; for (i=1;i<3;i++) { if (Data->P[plr].Probe[i].MaxSafety>=99) Data->P[plr].Probe[i].MaxSafety=99; if (Data->P[plr].Probe[i].MaxRD>Data->P[plr].Probe[i].MaxSafety) Data->P[plr].Probe[i].MaxRD=Data->P[plr].Probe[i].MaxSafety; }; break; case 22: case 84: /* roll six 6-sided dice and add to the current safety factor of the program */ x=random(6)+random(6)+random(6)+random(6)+random(6)+random(6)+6; evflag=NMod(plr,3,1,x); if (evflag==0) return 1; evflag=x; break; case 23: /* this applies to the most advanced rocket program. roll six 6-sided dice and add to the current safety factor. */ x=random(6)+random(6)+random(6)+random(6)+random(6)+random(6)+6; evflag=NMod(plr,2,1,x); if (evflag==0) return 1; evflag=x; break; case 24: /* this for most adv. satellites, roll four 6-sided dice and add to safety factor. */ x=random(6)+random(6)+random(6)+random(6)+4; evflag=NMod(plr,1,1,x); if (evflag==0) return 1; evflag=x; break; case 94: /* this for most adv capsule, roll four 6-sided dice and add to safety factor. */ x=random(6)+random(6)+random(6)+random(6)+4; evflag=NMod(plr,3,1,x); if (evflag==0) return 1; evflag=x; break; case 25: /* the blank is all rockets. R&D can't cure it. the options are to launch one rocket at this setback, or cancel launch. - 20% if no visit to repairs.*/ evflag=DamMod(plr,2,-20,15); if (evflag==0) return 1; break; case 26: /* select most advanced manned program and reduce safety by 25% */ evflag=NMod(plr,3,-1,25); if (evflag==0) return 1; evflag=25; break; case 27: /* select most advanced probe program and reduce safety by 15% */ evflag=NMod(plr,1,-1,15); if (evflag==0) return 1; evflag=15; break; case 79: evflag=NMod(plr,0,-1,20); if (evflag==0) return 1; evflag=20; break; case 28: // hardware cost 50% less this season Data->P[plr].TurnOnly=3; break; case 29: // set the delay of the rockets to 2 == one year for (i=0;i<5;i++) Data->P[plr].Rocket[i].Delay=2; break; case 34: /* 20% loss most advanced capsule */ evflag=NMod(plr,3,-1,20); if (evflag==0) return 1; evflag=20; break; case 37: /* cost 10MB repear or 10% safety loss on the most advanced probe */ evflag=DamMod(plr,1,-10,10); if (evflag==0) return 1; break; case 38: case 39: /* most adv. rocket program 10 MB's or 5% safety loss */ evflag=DamMod(plr,2,-5,10); if (evflag==0) return 1; break; case 40: /* blank a program 10 MB's or 10% safety loss */ evflag=DamMod(plr,0,-10,10); if (evflag==0) return 1; break; case 54: /* most advanced rocket program 15 MB's or 20% safety loss */ evflag=DamMod(plr,2,-20,15); if (evflag==0) return 1; break; case 55: /* most advanced rocket program 20 MB's or 10% safety loss */ evflag=DamMod(plr,3,-10,20); if (evflag==0) return 1; break; case 48: // safety increased for rockets up 5% evflag=SaveMods(plr,2); if (evflag==0) return 1; break; // Astronaut Portion ------------------------------------ case 49: /* pick random astronaut retire, budget minus 5 MB's */ evflag=0; for (i=0;i<Data->P[plr].AstroCount;i++){ if (!(Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED)) evflag++; } if (evflag==0) return 1; Data->P[plr].Budget-=5; i=random(Data->P[plr].AstroCount); while (Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED) i=random(Data->P[plr].AstroCount); Data->P[plr].Pool[i].RDelay=2; Data->P[plr].Pool[i].Mood=10; strcpy(&Name[0],&Data->P[plr].Pool[i].Name[0]); if (plr==1) { Data->P[plr].Pool[i].Status=AST_ST_RETIRED; Data->P[plr].Pool[i].RDelay=0; }; if (Data->P[plr].Pool[i].Status==AST_ST_RETIRED) Replace_Snaut(plr); break; case 50: // backup crew will fly mission evflag=0; for (i=0;i<3;i++) if (Data->P[plr].Mission[i].MissionCode>0) evflag++; if (evflag==0) return 1; i=0; while (Data->P[plr].Mission[i].MissionCode==0) i++; Data->P[plr].Mission[i].PCrew=0; Data->P[plr].Mission[i].Crew=Data->P[plr].Mission[i].BCrew; evflag=i; break; case 51: /* astronaut killed delay all manned missons = 1 */ evflag=0; for (i=0;i<Data->P[plr].AstroCount;i++) if (!(Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED)) evflag++; if (evflag==0) return 1; Data->P[plr].Budget-=5; i=random(Data->P[plr].AstroCount); while (Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED) i=random(Data->P[plr].AstroCount); strcpy(&Name[0],&Data->P[plr].Pool[i].Name[0]); Data->P[plr].Pool[i].Status=AST_ST_DEAD; Data->P[plr].Other=2; xMODE |= xMODE_SPOT_ANIM; //trigger spot anim //cancel manned missions ClrMiss(plr,0+3);ClrMiss(plr,1+3);ClrMiss(plr,2+3); break; case 52: evflag=0; for (i=0;i<Data->P[plr].AstroCount;i++) if (!(Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED)) evflag++; if (evflag==0) return 1; i=random(Data->P[plr].AstroCount); while (Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED) i=random(Data->P[plr].AstroCount); strcpy(&Name[0],&Data->P[plr].Pool[i].Name[0]); Data->P[plr].Pool[i].Status=AST_ST_DEAD; Data->P[plr].Other=2; Replace_Snaut(plr); break; case 60: case 53: evflag=0; for (i=0;i<Data->P[plr].AstroCount;i++) if (!(Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED)) evflag++; if (evflag==0) return 1; i=random(Data->P[plr].AstroCount); while (Data->P[plr].Pool[i].Status==AST_ST_DEAD || Data->P[plr].Pool[i].Status==AST_ST_RETIRED) i=random(Data->P[plr].AstroCount); strcpy(&Name[0],&Data->P[plr].Pool[i].Name[0]); Data->P[plr].Pool[i].Status=AST_ST_INJURED; Data->P[plr].Pool[i].IDelay=2; Data->P[plr].Pool[i].Special=4; Replace_Snaut(plr); break; case 56: /* hardware 50% less this season */ Data->P[plr].TurnOnly=3; break; case 57: for (i=0;i<3;i++) { if (i==0 && plr==0) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"MANKE"); else if (i==1 && plr==0) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"POWELL"); else if (i==2 && plr==0) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"YEAGER"); else if (i==0 && plr==1) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"ILYUSHIN"); else if (i==1 && plr==1) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"SHIBORIN"); else if (i==2 && plr==1) strcpy(&Data->P[plr].Pool[Data->P[plr].AstroCount].Name[0],"DOLGOV"); /* The original bonus astronauts & cosmonauts were: REEVES, CHAMBERLAIN, YEAGER & STIPPOV, SCHLICKBERND, FARGOV -Leon */ Data->P[plr].Pool[Data->P[plr].AstroCount].Status=AST_ST_TRAIN_BASIC_1; Data->P[plr].Pool[Data->P[plr].AstroCount].Face=random(10)+1; Data->P[plr].Pool[Data->P[plr].AstroCount].Service=1; Data->P[plr].Pool[Data->P[plr].AstroCount].Compat=random(10)+1; Data->P[plr].Pool[Data->P[plr].AstroCount].CR=random(2)+1; Data->P[plr].Pool[Data->P[plr].AstroCount].CL=random(2)+1; Data->P[plr].Pool[Data->P[plr].AstroCount].Group=9; Data->P[plr].Pool[Data->P[plr].AstroCount].Mood=85+5*random(4); Data->P[plr].AstroCount++; }; break; case 58: // 50% chance explosion on pad Data->P[plr].TurnOnly=5; break; case 64: /* launch facility repair 10MB's */ for (j=0;j<20;j++) { i=rand()%3; if (Data->P[plr].LaunchFacility[i]==1 && Data->P[plr].Mission[i].MissionCode==0) break; } if (j==20) return 1; /* get which of the three facilities damaged */ Data->P[plr].LaunchFacility[i]=10; break; case 65: // Gemini or Voskhod will cost additional 2MB's per spacecraft if (Data->P[plr].Manned[1].Num<0) return 1; Data->P[plr].Manned[1].UnitCost+=2; // Used to say "InitCost", which effectively disabled this newscast -Leon break; case 83: // Apollo or Soyuz will cost additional 3MB's per spacecraft if (Data->P[plr].Manned[2].Num<0) return 1; Data->P[plr].Manned[2].UnitCost+=3; break; case 66:// mission delay evflag=0; for (i=0;i<3;i++) { if (Data->P[plr].Mission[i].MissionCode>0) { GetMisType(Data->P[plr].Mission[i].MissionCode); if (!Mis.Jt) evflag++; } } if (evflag==0) return 1; i=random(3); while(Data->P[plr].Mission[i].MissionCode==0 || Data->P[plr].Mission[i].Joint==1) i=random(3); evflag=i; memcpy(&Data->P[plr].Future[i],&Data->P[plr].Mission[i],sizeof(struct MissionType)); memset(&Data->P[plr].Mission[i],0x00,sizeof(struct MissionType)); for (i=0;i<Data->P[plr].Future[evflag].Men+1;i++) { j=Data->P[plr].Crew[Data->P[plr].Future[evflag].Prog][Data->P[plr].Future[evflag].PCrew-1][i]-1; Data->P[plr].Pool[j].Prime++; j=Data->P[plr].Crew[Data->P[plr].Future[evflag].Prog][Data->P[plr].Future[evflag].BCrew-1][i]-1; Data->P[plr].Pool[j].Prime++; } break; case 78: /* most advanced capsule 10MB's or 10% safety */ evflag=DamMod(plr,3,-10,10); if (evflag==0) return 1; break; case 80: // Can't Deliver any Cap/Mods this year for (i=0;i<5;i++) Data->P[plr].Manned[i].Delay=2; break; case 82: // Duration E Mission Required Data->P[plr].FuturePlans=5; break; case 85: // Primary Crew Scrubbed - Backup Will Fly evflag=0; for (i=0;i<3;i++) if (Data->P[plr].Mission[i].MissionCode>0) evflag++; if (evflag==0) return 1; i=0; while (Data->P[plr].Mission[i].MissionCode==0) i++; Data->P[plr].Mission[i].Crew=Data->P[plr].Mission[i].BCrew; evflag=i; break; case 89: /* random astronaut not active */ evflag=0; for (i=0;i<Data->P[plr].AstroCount;i++) if (Data->P[plr].Pool[i].Status==AST_ST_ACTIVE) evflag++; if (evflag==0) return 1; i=random(Data->P[plr].AstroCount); while(Data->P[plr].Pool[i].Status!=AST_ST_ACTIVE) i=random(Data->P[plr].AstroCount); strcpy(&Name[0],&Data->P[plr].Pool[i].Name[0]); Data->P[plr].Pool[i].Status= AST_ST_INJURED; Data->P[plr].Pool[i].IDelay=2; break; default: break; } // End of Switch return 0; }
void DisplAstData(char plr, char *where, char *where2) { int num = abuf[*where].MissionNum[*where2], num2; fill_rectangle(1, 40, 157, 182, 3); if (abuf[*where].Missions == 0) { vhptr2->copyTo(display::graphics.screen(), 22, 69); return; } display::graphics.setForegroundColor(2); pline(20, 111, 138, 111); display::graphics.setForegroundColor(4); pline(20, 113, 138, 113); if (Data->P[plr].History[num].Hard[PAD_A][Mission_Capsule] != -1) { PatchMe(plr, 7, 41, Data->P[plr].History[num].Hard[PAD_A][Mission_Capsule], Data->P[plr].History[num].Patch[0], 32); } else { PatchMe(plr, 7, 41, Data->P[plr].History[num].Hard[PAD_B][Mission_Capsule], Data->P[plr].History[num].Patch[1], 32); } display::graphics.setForegroundColor(1); draw_string(43, 53, "PRESTIGE: "); draw_number(93, 53, Data->P[plr].History[num].Prestige); draw_string(43, 63, "DURATION: "); switch (Data->P[plr].History[num].Duration) { case 1: draw_string(93, 63, "A"); break; case 2: draw_string(93, 63, "B"); break; case 3: draw_string(93, 63, "C"); break; case 4: draw_string(93, 63, "D"); break; case 5: draw_string(93, 63, "E"); break; case 6: draw_string(93, 63, "F"); break; default: break; } draw_string(10, 83, "DESCRIPTION: "); display::graphics.setForegroundColor(9); draw_string(43, 45, &Data->P[plr].History[num].MissionName[0][0]); GetMisType(Data->P[plr].History[num].MissionCode); draw_string(10, 93, Mis.Abbr); if (*where2 == abuf[*where].Missions - 1) { fill_rectangle(1, 114, 157, 184, 3); return; } num2 = abuf[*where].MissionNum[*where2 + 1]; if (num2 < 1 || num2 > 56) { return; } //astro history patch fix if (Data->P[plr].History[num2].Hard[PAD_A][Mission_Capsule] != -1) { PatchMe(plr, 7, 116, Data->P[plr].History[num2].Hard[PAD_A][Mission_Capsule], Data->P[plr].History[num2].Patch[0], 32); } else { PatchMe(plr, 7, 116, Data->P[plr].History[num2].Hard[PAD_B][Mission_Capsule], Data->P[plr].History[num2].Patch[1], 32); } display::graphics.setForegroundColor(9); draw_string(43, 120, &Data->P[plr].History[num2].MissionName[0][0]); GetMisType(Data->P[plr].History[num2].MissionCode); draw_string(10, 168, Mis.Abbr); display::graphics.setForegroundColor(1); draw_string(43, 128, "PRESTIGE: "); draw_number(93, 128, Data->P[plr].History[num2].Prestige); draw_string(43, 138, "DURATION: "); switch (Data->P[plr].History[num2].Duration) { case 1: draw_string(93, 138, "A"); break; case 2: draw_string(93, 138, "B"); break; case 3: draw_string(93, 138, "C"); break; case 4: draw_string(93, 138, "D"); break; case 5: draw_string(93, 138, "E"); break; case 6: draw_string(93, 138, "F"); break; default: break; } draw_string(10, 158, "DESCRIPTION: "); return; }
void NewAI(char plr, char frog) { char i, spc[2], prg[2], P_pad, B_pad, hsf, Panic_Check = 0; int mis1, mis2, mis3, val; spc[0] = 0; /* XXX check uninitialized */ prg[0] = frog; mis1 = mis2 = mis3 = P_pad = B_pad = 0; GenPur(plr, 2, frog - 1); if (Data->P[plr].AILunar < 4) { mis1 = 0; mis2 = 0; mis3 = 0; hsf = 0; for (i = 0; i < 3; i++) if (Data->P[plr].Probe[hsf].Safety <= Data->P[plr].Probe[i].Safety) { hsf = i; } RDafford(plr, 0, hsf); if (Data->P[plr].Probe[hsf].Safety < 90) { if (GenPur(plr, 0, hsf)) { RDafford(plr, 0, hsf); } else { RDafford(plr, 0, hsf); } } Data->P[plr].Misc[4].Num = 2; Panic_Check = Panic_Level(plr, &mis1, &mis2); if (!Panic_Check) { if (Data->P[plr].Track[3] == 1) { Strategy_One(plr, &mis1, &mis2, &mis3); } else if (Data->P[plr].Track[3] == 2) { Strategy_Two(plr, &mis1, &mis2, &mis3); } else { Strategy_Thr(plr, &mis1, &mis2, &mis3); } if (mis1 == 53) switch (Data->P[plr].AILunar) { case 1: mis1 = 53; //Apollo behind Gemini if (frog == 2 && (Data->P[plr].AISec == 8 || Data->P[plr].AISec == 9)) { val = Data->P[plr].AISec; if (val < 7) { val = val - 4; } else { val = val - 5; } if (Data->P[plr].Manned[val - 1].Safety >= Data->P[plr].Manned[val - 1].MaxRD - 10) { mis2 = 53; spc[0] = val; } } break; case 2: mis1 = 55; mis2 = 0; break; case 3: mis1 = 56; mis2 = 0; break; default: break; } } } else { switch (Data->P[plr].Track[1]) { case 0: mis1 = 25; mis2 = 20; ++Data->P[plr].Track[1]; break; case 1: mis1 = 25; mis2 = 25; ++Data->P[plr].Track[1]; break; case 2: if (Data->P[plr].Cash <= 0) { Data->P[plr].Cash = 0; } Data->P[plr].Cash += Data->P[plr].Rocket[3].InitCost + 25; if (GenPur(plr, 1, 3)) { RDafford(plr, 1, 3); } else { RDafford(plr, 1, 3); } if (Data->P[plr].Rocket[3].Num >= 0) { Data->P[plr].Track[5] = 1; } Data->P[plr].Buy[1][3] = 0; RDafford(plr, 1, 3); mis1 = 25; ++Data->P[plr].Track[1]; break; case 3: switch (Data->P[plr].DurLevel) { case 0: case 1: mis1 = 25; mis2 = 25; break; case 2: mis1 = 25; mis2 = 7; ++Data->P[plr].Track[1]; break; case 3: case 4: case 5: mis1 = 7; mis2 = 7; ++Data->P[plr].Track[1]; break; default: break; } break; case 4: mis1 = 25; mis2 = 7; ++Data->P[plr].Track[1]; break; case 5: switch (Data->P[plr].DurLevel) { case 0: case 1: case 2: mis1 = 25; break; case 3: mis1 = (PreChe(plr, 18) == 0) ? 26 : 25; break; case 4: case 5: if (PreChe(plr, 1) == plr || PreChe(plr, 7) == plr) { mis1 = 43; } else { mis1 = 7; mis2 = 8; } break; default: break; } ++Data->P[plr].Track[1]; break; case 6: mis1 = 43; ++Data->P[plr].Track[1]; break; case 7: if (PreChe(plr, 19) == 0) { mis1 = 43; } else { mis1 = 46; } ++Data->P[plr].Track[1]; break; case 8: mis1 = 46; ++Data->P[plr].Track[1]; break; case 9: if (PreChe(plr, 20) == 0) { mis1 = 46; }++Data->P[plr].Track[1]; break; case 10: if (PreChe(plr, 20) == 0) { mis1 = 46; } else { mis1 = 54; } break; default: break; } }; // unmanned/manned klugge if (mis1 == 14 && mis2 == 15) { mis2 = 15; mis1 = 14; }; //lunar fly-by/probe landing klugge if (mis1 == 7 && mis2 == 7) if (Data->P[plr].Probe[2].Safety > Data->P[plr].Probe[2].MaxRD - 15) { mis2 = 8; } GetMisType(mis1); // deal with lunar modules if (Mis.LM == 1) { if (Data->P[plr].Track[2] > 0) { if (GenPur(plr, 2, Data->P[plr].Track[2])) { RDafford(plr, 2, Data->P[plr].Track[2]); } else { RDafford(plr, 2, Data->P[plr].Track[2]); } } else { Data->P[plr].Track[2] = 6; if (GenPur(plr, 2, Data->P[plr].Track[2])) { RDafford(plr, 2, Data->P[plr].Track[2]); } else { RDafford(plr, 2, Data->P[plr].Track[2]); } } } if (Mis.Jt == 1) { // JOINT LAUNCH P_pad = -1; if (Data->P[plr].Future[0].MissionCode == 0 && Data->P[plr].LaunchFacility[0] == 1 && Data->P[plr].Future[1].MissionCode == 0 && Data->P[plr].LaunchFacility[1] == 1) { P_pad = 0; } if (mis1 > 0) if (P_pad != -1) { AIFuture(plr, mis1, P_pad, (char *)&prg); } } else { // SINGLE LAUNCH if (mis1 == 54) { prg[0] = 5; } if (mis1 == 7 || mis1 == 8) { prg[0] = 0; } B_pad = -1; P_pad = -1; if (Data->P[plr].Future[0].MissionCode == 0 && Data->P[plr].LaunchFacility[0] == 1) { P_pad = 0; } if (Data->P[plr].Future[1].MissionCode == 0 && Data->P[plr].LaunchFacility[1] == 1) { if (P_pad == 0) { B_pad = 1; } else { P_pad = 1; } } if (Data->P[plr].Future[2].MissionCode == 0 && Data->P[plr].LaunchFacility[2] == 1) { if (P_pad != 0 && B_pad != 1) { if (P_pad == 1) { B_pad = 2; } else if (P_pad == 0 && B_pad == -1) { B_pad = 2; } else { P_pad = 2; } } }; if (mis1 > 0) { if (P_pad != -1) { AIFuture(plr, mis1, P_pad, (char *)&prg); } } if (mis2 > 0) { if (mis2 == 7 || mis2 == 8) { prg[0] = 0; } else { prg[0] = frog; } if (mis2 == 53) { prg[0] = spc[0]; } if (B_pad != -1) { AIFuture(plr, mis2, B_pad, (char *)&prg); } } if (mis3 > 0) { prg[0] = frog; if (B_pad != -1) { AIFuture(plr, mis3, 2, (char *)&prg); } } } if (Data->P[plr].Future[2].MissionCode == 0 && Data->P[plr].LaunchFacility[2] == 1) { if ((mis1 == 0 && frog == 2 && (Data->P[plr].Manned[2].Safety >= Data->P[plr].Manned[2].MaxRD - 10)) || (Data->P[plr].Manned[3].Safety >= Data->P[plr].Manned[3].MaxRD - 10)) { if (PreChe(plr, 27) == 0 && PreChe(other(plr), 27) == 0) { mis3 = 2; } else if (PreChe(plr, 18) == 0 && PreChe(other(plr), 18) == 0) { mis3 = 4; } if (mis3 == 0) { if (PreChe(plr, 27) == 0 && PreChe(other(plr), 27) == 1) { mis3 = 2; } else if (PreChe(plr, 18) == 0 && PreChe(other(plr), 18) == 1) { mis3 = 4; } } frog = prg[0] = Data->P[plr].AISec - 6; } if (mis3 == 0) if (mis1 != 7 && mis1 != 8) { if (mis1 == 7) { mis3 = 8; } else if (mis1 == 8) { mis3 = 7; } if (Data->P[plr].Probe[2].Safety > Data->P[plr].Probe[2].MaxRD - 15) if (PreChe(plr, 7) == 0 || Data->P[plr].Misc[5].Safety < 85) { if (mis3 == 0) { mis3 = 8; } } if ((Data->P[plr].Probe[1].Safety > Data->P[plr].Probe[1].MaxRD - 15) && mis3 == 0) { if (PreChe(plr, 1) == 0 && PreChe(other(plr), 1) == 0 && Data->P[plr].Mission[2].MissionCode != 7) { mis3 = 7; } else if (PreChe(plr, 2) == 0 && PreChe(other(plr), 2) == 0 && Data->P[plr].Mission[2].MissionCode != 11) { mis3 = 11; } else if (PreChe(plr, 3) == 0 && PreChe(other(plr), 3) == 0 && Data->P[plr].Mission[2].MissionCode != 9) { mis3 = 9; } else if (PreChe(plr, 4) == 0 && PreChe(other(plr), 4) == 0 && Data->P[plr].Mission[2].MissionCode != 10) { mis3 = 10; } else if (PreChe(plr, 5) == 0 && PreChe(other(plr), 5) == 0 && Data->P[plr].Mission[2].MissionCode != 12) { mis3 = 12; } else if (PreChe(plr, 6) == 0 && PreChe(other(plr), 6) == 0 && Data->P[plr].Mission[2].MissionCode != 13) { mis3 = 13; } if (mis3 == 0) { if (PreChe(plr, 1) == 0 && PreChe(other(plr), 1) == 1 && Data->P[plr].Mission[2].MissionCode != 7) { mis3 = 7; } else if (PreChe(plr, 2) == 0 && PreChe(other(plr), 2) == 1 && Data->P[plr].Mission[2].MissionCode != 11) { mis3 = 11; } else if (PreChe(plr, 3) == 0 && PreChe(other(plr), 3) == 1 && Data->P[plr].Mission[2].MissionCode != 9) { mis3 = 9; } else if (PreChe(plr, 4) == 0 && PreChe(other(plr), 4) == 1 && Data->P[plr].Mission[2].MissionCode != 10) { mis3 = 10; } else if (PreChe(plr, 5) == 0 && PreChe(other(plr), 5) == 1 && Data->P[plr].Mission[2].MissionCode != 12) { mis3 = 12; } else if (PreChe(plr, 6) == 0 && PreChe(other(plr), 6) == 1 && Data->P[plr].Mission[2].MissionCode != 13) { mis3 = 13; } } } } if (mis3 == 0) { if (GenPur(plr, 0, 0)) { RDafford(plr, 0, 0); } else { RDafford(plr, 0, 0); } if (GenPur(plr, 1, 0)) { RDafford(plr, 1, 0); } else { RDafford(plr, 1, 0); } if (Data->P[plr].Probe[0].Num >= 1 && Data->P[plr].Rocket[0].Num >= 1) { mis3 = 1; } } if (mis3 != 2 || mis3 != 4) { prg[0] = 0; } if (mis3 > 0) { AIFuture(plr, mis3, 2, (char *)&prg); } } AILaunch(plr); return; }
void AIFuture(char plr, char mis, char pad, char *prog) { int i, j; char prime, back, max, men; char fake_prog[2]; if (prog == NULL) { memset(fake_prog, 0, sizeof fake_prog); prog = fake_prog; } GetMisType(mis); for (i = 0; i < (Mis.Jt + 1); i++) { Data->P[plr].Future[pad + i].MissionCode = mis; Data->P[plr].Future[pad + i].part = i; // duration if (Data->P[plr].DurLevel <= 5 && Data->P[plr].Future[pad + i].Duration == 0) { if (Mis.Dur == 1) Data->P[plr].Future[pad + i].Duration = maxx(Mis.Days, minn(Data->P[plr].DurLevel + 1, 6)); else { Data->P[plr].Future[pad + i].Duration = Mis.Days; } } if (Data->P[plr].Mission[0].Duration == Data->P[plr].Future[pad + i].Duration || Data->P[plr].Mission[1].Duration == Data->P[plr].Future[pad + i].Duration) { ++Data->P[plr].Future[pad + i].Duration; } if (pad == 1 && Data->P[plr].Future[0].Duration == Data->P[plr].Future[pad + i].Duration) { ++Data->P[plr].Future[pad + i].Duration; } if (Data->P[plr].Future[pad + i].Duration >= 6) { Data->P[plr].Future[pad + i].Duration = 6; } // one man capsule duration klugge if (Data->P[plr].Future[pad + i].Prog == 1) { if (Data->P[plr].DurLevel == 0) { Data->P[plr].Future[pad + i].Duration = 1; } else { Data->P[plr].Future[pad + i].Duration = 2; } }; // limit duration 'C' one man capsule // lunar mission klugge if (Mis.Lun == 1 || Data->P[plr].Future[pad + i].MissionCode == 55 || Data->P[plr].Future[pad + i].MissionCode == 56 || Data->P[plr].Future[pad + i].MissionCode == 53) { Data->P[plr].Future[pad + i].Duration = 4; } // unmanned duration klugge if (Mis.Days == 0) { Data->P[plr].Future[pad + i].Duration = 0; } Data->P[plr].Future[pad + i].Joint = Mis.Jt; Data->P[plr].Future[pad + i].Month = 0; if (mis == 1) { prog[i] = 0; } Data->P[plr].Future[pad + i].Prog = prog[0]; if (prog[i] > 0 && Mis.Days > 0) { for (j = 1; j < 6; j++) { DumpAstro(plr, j); } TransAstro(plr, prog[i]); //indexed OK if (Data->P[plr].Future[pad + i].PCrew != 0) { prime = Data->P[plr].Future[pad + i].PCrew - 1; } else { prime = -1; } if (Data->P[plr].Future[pad + i].BCrew != 0) { back = Data->P[plr].Future[pad + i].BCrew - 1; } else { back = -1; } max = prog[i]; if (prog[i] > 3) { max = prog[i] - 1; } Data->P[plr].Future[pad + i].Men = max; men = Data->P[plr].Future[pad + i].Men; if (prime != -1) for (j = 0; j < men; j++) { Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][prime][j] - 1].Prime = 0; } if (back != -1) for (j = 0; j < men; j++) { Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][back][j] - 1].Prime = 0; } Data->P[plr].Future[pad + i].PCrew = 0; Data->P[plr].Future[pad + i].BCrew = 0; pc[i] = -1; bc[i] = -1; for (j = 0; j < 8; j++) if (pc[i] == -1 && Data->P[plr].Crew[prog[i]][j][0] != 0 && Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][j][0] - 1].Prime == 0) { pc[i] = j; } if (pc[i] == -1) { // astronaut/duration klugge if (Mis.Days > 0) { Data->P[plr].Future[pad + i].Men = max; } // no astronauts available have to go unmanned Data->P[plr].Future[pad + i].Men = 0; Data->P[plr].Future[pad + i].PCrew = 0; Data->P[plr].Future[pad + i].BCrew = 0; return; } Data->P[plr].Future[pad + i].PCrew = pc[i] + 1; bc[i] = -1; for (j = 0; j < 8; j++) if (bc[i] == -1 && j != pc[i] && Data->P[plr].Crew[prog[i]][j][0] != 0 && Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][j][0] - 1].Prime == 0) { bc[i] = j; } Data->P[plr].Future[pad + i].BCrew = bc[i] + 1; for (j = 0; j < men; j++) { Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][pc[i]][j] - 1].Prime = 4; } for (j = 0; j < men; j++) { Data->P[plr].Pool[Data->P[plr].Crew[prog[i]][bc[i]][j] - 1].Prime = 2; } } else { Data->P[plr].Future[pad + i].Men = 0; Data->P[plr].Future[pad + i].PCrew = 0; Data->P[plr].Future[pad + i].BCrew = 0; } } // joint mission 55 and 56 men klugge if (mis == 55 || mis == 56) { Data->P[plr].Future[pad + 1].Men = Data->P[plr].Future[pad].Men; Data->P[plr].Future[pad + 1].PCrew = Data->P[plr].Future[pad].PCrew; Data->P[plr].Future[pad + 1].BCrew = Data->P[plr].Future[pad].BCrew; Data->P[plr].Future[pad + 1].Prog = Data->P[plr].Future[pad].Prog; Data->P[plr].Future[pad].Men = 0; Data->P[plr].Future[pad].PCrew = 0; Data->P[plr].Future[pad].BCrew = 0; Data->P[plr].Future[pad].Prog = 0; Data->P[plr].Future[pad + 1].Duration = Data->P[plr].Future[pad].Duration; Data->P[plr].Future[pad].Duration = 0; } return; }
void MissionSetup(char plr, char mis) { char i, j, t; DMFake = 0; GetMisType(Data->P[plr].Mission[mis].MissionCode); for (j = 0; j < (1 + Data->P[plr].Mission[mis].Joint); j++) { if ((Mis.mVab[j] & 0x10) > 0 && Data->P[plr].DockingModuleInOrbit > 0) { // DMO Data->P[plr].Mission[mis + j].Hard[Mission_Probe_DM] = 4; DMFake = 1; } if (j == 0) { // Apollo (1) + LM (1) if (Data->P[plr].Mission[mis].Hard[Mission_Capsule] == 2 && Data->P[plr].Mission[mis].Hard[Mission_LM] >= 0) { Data->P[plr].Mission[mis].Hard[Mission_Probe_DM] = 4; DMFake = 1; } } if (j == 1) { // Apollo (2) + LM (1) if (Data->P[plr].Mission[mis + j].Hard[Mission_Capsule] == 2 && Data->P[plr].Mission[mis].Hard[Mission_LM] >= 0) { Data->P[plr].Mission[mis].Hard[Mission_Probe_DM] = 4; DMFake = 1; } } if (Data->P[plr].Mission[mis].MissionCode == Mission_Soyuz_LL) { // Soyuz Kicker-C Data->P[plr].Mission[mis].Hard[Mission_Probe_DM] = 4; DMFake = 1; } if (Data->P[plr].Mission[mis].Hard[Mission_Capsule] == 2) { // Apollo #1 Data->P[plr].Mission[mis].Hard[Mission_Probe_DM] = 4; DMFake = 1; } for (i = Mission_Capsule; i <= Mission_PhotoRecon; i++) { t = Data->P[plr].Mission[mis + j].Hard[i]; MH[j][i] = NULL; // Clear Pointers if (t >= 0) { switch (i) { case Mission_Capsule: case Mission_LM: // Cap - LM MH[j][i] = &Data->P[plr].Manned[t]; if (MH[j][i]->Num && t != 3) { MH[j][i]->Num--; } MH[j][i]->Used++; break; case Mission_Kicker: // Kicker MH[j][i] = &Data->P[plr].Misc[t]; if (MH[j][i]->Num) { MH[j][i]->Num--; } MH[j][i]->Used++; break; case Mission_Probe_DM: // Secondary Equipment if (t != 4) { MH[j][i] = &Data->P[plr].Probe[t]; MH[j][i]->Used++; if (Data->P[plr].Probe[t].Num > 0) { Data->P[plr].Probe[t].Num -= 1; } } else { MH[j][i] = &Data->P[plr].Manned[MISC_HW_DOCKING_MODULE]; if (DMFake == 0) { if (MH[j][i]->Num > 0) { MH[j][i]->Num--; } MH[j][i]->Used++; } }; break; case Mission_PrimaryBooster: // Rocket XX t--; if (t < 4) { MH[j][i] = &Data->P[plr].Rocket[t]; if (MH[j][i]->Num > 0) { MH[j][i]->Num--; } MH[j][i]->Used++; } else { MH[j][i] = &Data->P[plr].Rocket[t - 4]; MH[j][7] = &Data->P[plr].Rocket[ROCKET_HW_BOOSTERS]; MH[j][i]->Used++; MH[j][7]->Used++; if (MH[j][i]->Num > 0) { MH[j][i]->Num--; } if (MH[j][7]->Num > 0) { MH[j][7]->Num--; } }; break; case Mission_EVA: // EVA MH[j][i] = &Data->P[plr].Manned[MISC_HW_EVA_SUITS]; break; case Mission_PhotoRecon: // Photo Recon MH[j][i] = &Data->P[plr].Manned[MISC_HW_PHOTO_RECON]; break; } if (MH[j][i] != NULL) { MH[j][i]->SMods += MH[j][i]->Damage; //Damaged Equipment, Nikakd, 10/8/10 MH[j][i]->MisSaf = MH[j][i]->Safety + MH[j][i]->SMods; if (MH[j][i]->ID[1] >= 0x35 && i == 2 && Data->P[plr].Mission[mis].MissionCode >= 53) switch (Data->P[plr].LMpts) { case 0: MH[j][i]->MisSaf -= 9; break; case 1: MH[j][i]->MisSaf -= 6; break; case 2: MH[j][i]->MisSaf -= 3; break; } } }; // if t>=0 }; // for (0<7) }; // for (0<2) if (DMFake == 1) { Data->P[plr].Mission[mis].Hard[Mission_Probe_DM] = -1; } return; }
void MissionCodes(char plr, char val, char pad) { GetMisType(val); MissionParse(plr, Mis.Code, Mis.Alt, pad); return; }
void MisAnn(char plr, char pad) { int i, j, bud; struct mStr Mis2; char k, hold, Digit[4], HelpFlag = 0; char pad_str[2] = {'A' + pad, '\0'}; for (i = 0; i < 768; i++) { pal[i] = 0; } gxClearDisplay(0, 0); PortPal(plr); ShBox(41, 20, 281, 184); InBox(46, 25, 276, 179); InBox(46, 25, 117, 65); Flag(47, 26, plr); InBox(122, 25, 276, 65); grSetColor(9); PrintAt(127, 33, "SCHEDULED LAUNCH"); //was 154,33 grSetColor(34); PrintAt(127, 40, "LAUNCH FACILITY: "); grSetColor(1); PrintAt(0, 0, "PAD "); PrintAt(0, 0, pad_str); grSetColor(34); PrintAt(127, 47, "DATE: "); grSetColor(1); PrintAt(0, 0, Month[Data->P[plr].Mission[pad].Month]); PrintAt(0, 0, "19"); DispNum(0, 0, Data->Year); grSetColor(1); GetMisType(Data->P[plr].Mission[pad].MissionCode); memcpy(&Mis2, &Mis, sizeof Mis); if ((Mis.mVab[0] & 0x10) == 0x10 && Data->P[plr].DMod <= 0) { i = 0; while (dg[Mis2.Index][i] != 0 && Mis.Doc == 1) { GetMisType(dg[Mis2.Index][i]); i++; } if (dg[Mis2.Index][i] == 0) { Data->P[plr].Mission[pad].MissionCode = 4; // new mission } else { Data->P[plr].Mission[pad].MissionCode = Mis.Index; // new mission } GetMisType(Data->P[plr].Mission[pad].MissionCode); HelpFlag = 1; } PrintAt(127, 54, Mis.Abbr); int MisCod; MisCod = Data->P[plr].Mission[pad].MissionCode; if ((MisCod > 24 && MisCod < 32) || MisCod == 33 || MisCod == 34 || MisCod == 35 || MisCod == 37 || MisCod == 40 || MisCod == 41) // Show duration level only on missions with a Duration step - Leon { switch (Data->P[plr].Mission[pad].Duration) { case 1: PrintAt(0, 0, ""); break; case 2: PrintAt(0, 0, " (B)"); break; case 3: PrintAt(0, 0, " (C)"); break; case 4: PrintAt(0, 0, " (D)"); break; case 5: PrintAt(0, 0, " (E)"); break; case 6: PrintAt(0, 0, " (F)"); break; default: PrintAt(0, 0, ""); break; } } IOBox(57, 68, 118, 84); IOBox(131, 68, 197, 84); IOBox(205, 68, 266, 84); grSetColor(1); PrintAt(65, 78, "CONTINUE"); PrintAt(139, 78, "PLAY FULL"); PrintAt(221, 78, "SCRUB"); grSetColor(9); MisCod = Data->P[plr].Mission[i].MissionCode; PrintAt(65, 78, "C"); PrintAt(139, 78, "P"); PrintAt(221, 78, "S"); //IOBox(85,68,158,84);IOBox(172,68,245,84); //grSetColor(1);PrintAt(102,78,"CONTINUE");PrintAt(189,78,"SCRUB"); //grSetColor(9); //PrintAt(102,78,"C");PrintAt(189,78,"S"); if (Data->P[plr].Mission[pad].Joint == 0) { PrintAt(128, 91, "SINGLE LAUNCH"); } else { PrintAt(131, 91, "JOINT LAUNCH"); PrintAt(49, 101, "PART ONE"); PrintAt(102, 101, "PAD "); //DispNum(0,0,pad); switch (pad) { case 0: PrintAt(0, 0, "A"); break; case 1: PrintAt(0, 0, "B"); break; case 2: PrintAt(0, 0, "C"); break; }; PrintAt(160, 101, "PART TWO"); PrintAt(213, 101, "PAD "); //DispNum(0,0,pad+1); switch (pad + 1) { case 0: PrintAt(0, 0, "A"); break; case 1: PrintAt(0, 0, "B"); break; case 2: PrintAt(0, 0, "C"); break; }; } for (i = 0; i < Data->P[plr].Mission[pad].Joint + 1; i++) { k = 0; if (i == 0) { bud = 49; } else { bud = 160; } for (j = Mission_Capsule; j <= Mission_PrimaryBooster; j++) { hold = Data->P[plr].Mission[pad + i].Hard[j]; switch (j) { case 0: if (hold > -1) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "CAPSULE: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Manned[hold].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Manned[hold].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Manned[hold].Safety + Data->P[plr].Manned[hold].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); // PrintAt(144+i*111,116+14*k,"%"); ++k; }; break; case 1: if (hold > -1) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "KICKER: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Misc[hold].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Misc[hold].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Misc[hold].Safety + Data->P[plr].Misc[hold].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); // DispNum(0,0,Data->P[plr].Misc[hold].Safety); // PrintAt(144+i*111,116+14*k,"%"); ++k; }; break; case 2: if (hold > -1) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "LM: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Manned[hold].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Manned[hold].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Manned[hold].Safety + Data->P[plr].Manned[hold].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); //DispNum(0,0,Data->P[plr].Manned[hold].Safety); //PrintAt(144+i*111,116+14*k,"%"); ++k; }; break; case 3: if (hold > -1) { if (hold < 3) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "PROBE: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Probe[hold].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Probe[hold].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Probe[hold].Safety + Data->P[plr].Probe[hold].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); //DispNum(0,0,Data->P[plr].Probe[hold].Safety); //PrintAt(144+i*111,116+14*k,"%"); ++k; } else if (hold == 4) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "DOCKING: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Misc[hold].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Misc[hold].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Misc[hold].Safety + Data->P[plr].Misc[hold].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); //DispNum(0,0,Data->P[plr].Misc[hold].Safety); //PrintAt(144+i*111,116+14*k,"%"); ++k; } }; break; case 4: if (hold > -1) { if (hold < 5) { grSetColor(7); PrintAt(bud, 109 + 14 * k, "ROCKET: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Rocket[hold - 1].Name[0]); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); Data->P[plr].Rocket[hold - 1].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", Data->P[plr].Rocket[hold - 1].Safety + Data->P[plr].Rocket[hold - 1].Damage); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); //DispNum(0,0,Data->P[plr].Rocket[hold-1].Safety); //PrintAt(144+i*111,116+14*k,"%"); ++k; } else { grSetColor(7); PrintAt(bud, 109 + 14 * k, "ROCKET: "); grSetColor(1); PrintAt(0, 0, &Data->P[plr].Rocket[hold - 5].Name[0]); PrintAt(0, 0, " W/B"); grSetColor(11); PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: "); (Data->P[plr].Rocket[hold - 5].Damage != 0 || Data->P[plr].Rocket[4].Damage != 0) ? grSetColor(9) : grSetColor(1); //Damaged Equipment && Booster's Safety Mod, Nikakd, 10/8/10 sprintf(&Digit[0], "%d", RocketBoosterSafety(Data->P[plr].Rocket[hold - 5].Safety + Data->P[plr].Rocket[hold - 5].Damage, Data->P[plr].Rocket[4].Safety + Data->P[plr].Rocket[4].Damage)); PrintAt(0, 0, &Digit[0]); PrintAt(0, 0, "%"); // DispNum(0,0,(Data->P[plr].Rocket[hold-5].Safety+Data->P[plr].Rocket[4].Safety)/2); // PrintAt(144+i*111,116+14*k,"%"); ++k; } } break; default: break; } } } FadeIn(2, pal, 10, 0, 0); WaitForMouseUp(); if (HelpFlag) { Help("i156"); // Notification of being an Help } while (1) { key = 0; GetMouse(); if ((x >= 59 && y >= 70 && x <= 116 && y <= 82 && mousebuttons > 0) || key == K_ENTER || key == 'C') { InBox(59, 70, 116, 82); WaitForMouseUp(); OutBox(59, 70, 116, 82); FadeOut(2, pal, 10, 0, 0); BIG = 0; return; } else if ((x >= 133 && y >= 70 && x <= 195 && y <= 82 && mousebuttons > 0) || key == K_ENTER || key == 'P') { InBox(133, 70, 195, 82); WaitForMouseUp(); OutBox(133, 70, 195, 82); FadeOut(2, pal, 10, 0, 0); BIG = 1; return; } else if ((x >= 207 && y >= 70 && x <= 264 && y <= 82 && mousebuttons > 0) || key == 'S') { InBox(207, 70, 264, 82); WaitForMouseUp(); OutBox(207, 70, 264, 82); { ClrMiss(plr, pad); } if (Data->P[plr].Mission[pad].MissionCode == 0) { FadeOut(2, pal, 10, 0, 0); return; } } }; }
int AllotPrest(char plr, char mis) { int i, total, other, negs, mcode, mike, P_Goal, N_Goal, S_Goal, ival, cval; char PVal[28]; hero = 0; tMo = Data->P[plr].Mission[mis].Month; tYr = Data->Year; tIDX = bIDX = 0; memset(PVal, 0x00, sizeof PVal); // SETUP INFO mcode = Data->P[plr].Mission[mis].MissionCode; GetMisType(mcode); other = MaxFail(); for (i = 0; i < STEPnum; i++) { if (Mev[i].PComp == 5 && Mev[i].StepInfo == 0) { Mev[i].PComp = 0; Mev[i].Prest = -100; } if ((MANNED[0] + MANNED[1]) > 0) { if (other >= 3000) { Mev[i].PComp = 4; } else if (Mev[i].Prest >= -28 && Mev[i].StepInfo > 2999) { Mev[i].PComp = 4; } } } // FEMALE 'NAUTS PVal[Prestige_WomanInSpace] = (MA[0][0].A != NULL && MA[0][0].A->Sex) || (MA[0][1].A != NULL && MA[0][1].A->Sex) || (MA[0][2].A != NULL && MA[0][2].A->Sex) || (MA[0][3].A != NULL && MA[0][3].A->Sex) || (MA[1][0].A != NULL && MA[1][0].A->Sex) || (MA[1][1].A != NULL && MA[1][1].A->Sex) || (MA[1][2].A != NULL && MA[1][2].A->Sex) || (MA[1][3].A != NULL && MA[1][3].A->Sex); for (i = 0; i < STEPnum; i++) { ival = abs(Mev[i].Prest); cval = Mev[i].PComp; // ival of 100 seems to mean "don't record this in PVal[]" // Regardless of intention, it's out of bounds, so don't access or overwrite it if (ival != 100) { if (Mev[i].StepInfo == 0 && PVal[ival] == 0) { cval = 4; } if (PVal[ival] != 4) { PVal[ival] = cval; } } } // EVA FIX FOR ALTERNATE STEPS LATER IN MISSION if (Mis.EVA == 1 && (PVal[Prestige_Spacewalk] == 0 || PVal[Prestige_Spacewalk] == 5)) { PVal[Prestige_Spacewalk] = 4; } else if (Mis.EVA == 0 && PVal[Prestige_Spacewalk] == 5) { PVal[Prestige_Spacewalk] = 0; } // DOCKING FIX FOR ALTERNATE STEPS LATER IN SESSION if (Mis.Doc == 1 && (PVal[Prestige_MannedDocking] == 0 || PVal[Prestige_MannedDocking] == 5)) { PVal[Prestige_MannedSpaceMission] = 4; } else if (Mis.EVA == 0 && PVal[Prestige_MannedDocking] == 5) { PVal[Prestige_MannedDocking] = 0; } // CLEAR TOTAL VALUE total = 0; negs = 0; // PHOTO RECON if (PVal[Prestige_MannedLunarPass] > 0 && PVal[Prestige_MannedLunarPass] < 4) { Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety += 5; // manned stuff gets 5 } Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety = MIN(Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety, 99); if (death == 1) { for (i = 0; i < 28; i++) if (PVal[i] > 0 && PVal[i] < 4) { PVal[i] = 4; } } // GOAL FILTER: MANNED P_Goal = PosGoal(PVal); N_Goal = NegGoal(PVal); S_Goal = SupGoal(PVal); if (P_Goal == Prestige_MannedLunarLanding) { // make sure EVA was done if (!(PVal[Prestige_Spacewalk] >= 1 && PVal[Prestige_Spacewalk] <= 3)) { P_Goal = Prestige_MannedLunarOrbit; PVal[Prestige_MannedLunarLanding] = 0; } } if ((P_Goal == -1 && S_Goal == -1) && (PVal[Prestige_WomanInSpace] > 0)) { PVal[Prestige_WomanInSpace] = 4; } if (Check_Dock(500) == 2) { // Success Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety += 10; Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety = MIN(Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety, Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].MaxSafety); } else if (Check_Dock(500) == 1) { Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety += 5; Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety = MIN(Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety, Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].MaxSafety); } if (STSp(Prestige_MannedSpaceMission) || STSn(Prestige_MannedSpaceMission)) { PVal[Prestige_MannedSpaceMission] = 0; // Clear All Firsts/Negative Goals } if (STSp(Prestige_MannedOrbital) || STSn(Prestige_MannedOrbital)) { PVal[Prestige_MannedOrbital] = 0; } if (STSp(Prestige_MannedLunarPass) || STSn(Prestige_MannedLunarPass)) { PVal[Prestige_MannedLunarPass] = 0; } if (STSp(Prestige_MannedLunarOrbit) || STSn(Prestige_MannedLunarOrbit)) { PVal[Prestige_MannedLunarOrbit] = 0; } if (STSp(Prestige_MannedLunarLanding) || STSn(Prestige_MannedLunarLanding)) { PVal[Prestige_MannedLunarLanding] = 0; } // DURATION FIRSTS Data->P[plr].Mission[mis].Duration = MAX(Data->P[plr].Mission[mis].Duration, 1); if (!Mis.Dur) { switch (P_Goal) { case Prestige_MannedSpaceMission: mike = 7; Data->P[plr].Mission[mis].Duration = 1; break; case Prestige_MannedOrbital: mike = (Mis.Index <= 6) ? (Data->P[plr].Mission[mis].Duration = 1, 7) : (Data->P[plr].Mission[mis].Duration = 2, 12); break; case Prestige_MannedLunarPass: mike = 11; Data->P[plr].Mission[mis].Duration = 3; break; case Prestige_MannedLunarOrbit: mike = 10; Data->P[plr].Mission[mis].Duration = 4; break; case Prestige_MannedLunarLanding: mike = 10; Data->P[plr].Mission[mis].Duration = 4; break; default: mike = 0; break; } } else { mike = 14 - Data->P[plr].Mission[mis].Duration; } if (mike >= 8 && mike <= 12) if (P_Goal >= 18 || S_Goal >= 18) { PVal[mike] = 1; } //total+=(char) Set_Goal(plr,mike,0); // GOAL POSTIVE if (P_Goal != -1) { total = Set_Goal(plr, P_Goal, 0); if (P_Goal != 27) { total += Set_Goal(plr, 27, 0); PVal[Prestige_MannedSpaceMission] = 0; } //if (!(Data->Prestige[Prestige_MannedSpaceMission].Place==plr || Data->Prestige[Prestige_MannedSpaceMission].mPlace==plr)) // total+=Set_Goal(plr,27,0); } // GOAL NEGATIVE if (N_Goal != -1) { negs += PrestNeg(plr, N_Goal); PVal[N_Goal] = 0; } if (mcode == 32 || mcode == 36) { PVal[Prestige_OrbitingLab] = Check_Lab(); } // TOTAL ALL MISSION FIRSTS for (i = 0; i < 28; i++) { if (PVal[i] == 1 || (PVal[i] == 2 && other < 3000)) { total += Set_Goal(plr, i, 0); } } //else if (PVal[i]==4) negs+=Set_Goal(plr,i,0); // CAPSULE FIRSTS need to check for failure on capsule if ((P_Goal != -1 || S_Goal != -1) && other < 3000 && MANNED[0] > 0 && Data->P[plr].Mission[mis].Hard[Mission_Capsule] != -1) { // Hardware on first part total += Set_Goal(plr, 12 + Data->P[plr].Mission[mis].Prog, 0); } if ((P_Goal != -1 || S_Goal != -1) && other < 3000 && MANNED[1] > 0 && Data->P[plr].Mission[mis + 1].Hard[Mission_Capsule] != -1 && Data->P[plr].Mission[mis + 1].part == 1) { total += Set_Goal(plr, 12 + Data->P[plr].Mission[mis + 1].Prog, 0); } #define DNE(a,b) (Data->Prestige[b].Place==(a) || Data->Prestige[b].mPlace==(a)) if (DNE(plr, Prestige_Duration_F)) { Data->P[plr].DurationLevel = 6; } else if (DNE(plr, Prestige_Duration_E)) { Data->P[plr].DurationLevel = 5; } else if (DNE(plr, Prestige_Duration_D)) { Data->P[plr].DurationLevel = 4; } else if (DNE(plr, Prestige_Duration_C)) { Data->P[plr].DurationLevel = 3; } else if (DNE(plr, Prestige_Duration_B)) { Data->P[plr].DurationLevel = 2; } else if (DNE(plr, Prestige_MannedSpaceMission)) { Data->P[plr].DurationLevel = 1; } // TOTAL ALL MISSION SUBSEQUENTS if (total == 0) { // SET SUBSEQUENT Goal if (S_Goal != -1 && other < 3000) { total = Set_Goal(plr, S_Goal, 0); } for (i = 0; i < 28; i++) { if (PVal[i] == 1 || (PVal[i] == 2 && other < 3000)) { total += Set_Goal(plr, i, 0); } else if (PVal[i] == 3) { Set_Goal(plr, i, 0); } } } // LM POINTS Set_LM(plr, STEPnum); if (mcode >= 48 && mcode <= 52 && other < 3000) { Set_LM(plr, STEPnum); } // ADD IN NEGATIVES AND RETURN MIN of -10 total = ((total + negs) < -10) ? -10 : total + negs; if (!death && total == -10) { total = -7; } return total; }
int U_AllotPrest(char plr, char mis) { int i = 0, total, other, negs, mcode, lun; char PVal[28]; memset(PVal, 0x00, sizeof PVal); // CLEAR TOTAL VALUE total = 0, negs = 0, lun = 0; tMo = Data->P[plr].Mission[mis].Month; tYr = Data->Year; tIDX = bIDX = 0; // SETUP INFO mcode = Data->P[plr].Mission[mis].MissionCode; GetMisType(mcode); lun = Check_Photo(); other = MaxFail(); if ((mcode >= 7 && mcode <= 13) || mcode == 1) { // Unmanned Probes switch (mcode) { case 1: i = 0; break; // O.S. case 7: i = 1; break; // L.F.B. case 8: i = 7; break; // L.P.L. case 9: i = 3; break; case 10: i = 4; break; case 11: i = 2; break; case 12: i = 5; break; case 13: i = 6; break; } if (other == 1) { if (mcode == 10 || mcode == 12 || mcode == 13) { return 0; } total = Set_Goal(plr, i, 0); } else { negs = PrestNeg(plr, i); } if (mcode == 7 || mcode == 8) { if (lun == 1) { // UNMANNED PHOTO RECON Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety += 5; Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety = MIN(Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety, 99); } // if } // if if (mcode == 8 && MaxFail() == 1) { // extra 10 for landing on Moon if (lun == 1) { // UNMANNED PHOTO RECON Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety += 10; Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety = MIN(Data->P[plr].Misc[MISC_HW_PHOTO_RECON].Safety, 99); } // if } // if } // if if (Check_Dock(2) == 2) { Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety += 10; Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety = MIN(Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety, Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].MaxSafety); } else if (Check_Dock(2) == 1) { Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety += 5; Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety = MIN(Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].Safety, Data->P[plr].Misc[MISC_HW_DOCKING_MODULE].MaxSafety); } return total + negs; }