예제 #1
0
void AI_Begin(char plr)
{
    boost::shared_ptr<display::PalettizedSurface> countrySeals(Filesystem::readImage("images/turn.but.0.png"));
    countrySeals->exportPalette();

    display::graphics.screen()->clear(0);
    ShBox(0, 60, 319, 80);
    display::graphics.setForegroundColor(6 + plr * 3);

    if (plr == 0) {
        draw_heading(15, 64, "DIRECTOR OF THE UNITED STATES", 0, -1);
    } else {
        draw_heading(30, 64, "CHIEF DESIGNER OF THE USSR", 0, -1);
    }

    display::graphics.setForegroundColor(11);
    grMoveTo(175, 122);

    if (Data->Season == 0) {
        draw_string(0, 0, "SPRING 19");
    } else {
        draw_string(0, 0, "FALL 19");
    }

    draw_number(0, 0, Data->Year);
    display::graphics.screen()->draw(countrySeals, 110 * plr, 0, 107, 93, 30, 85);
    display::graphics.setForegroundColor(11);
    draw_string(60, 58, "COMPUTER TURN:  THINKING...");
    music_start(M_SOVTYP);
    FadeIn(2, display::graphics.palette(), 10, 0, 0);
    colss = 0;
}
예제 #2
0
void MisRev(char plr, int pres)
{
    if (!AI[plr]) {
        music_start((pres > 0) ? M_SUCCESS : M_UNSUCC);
    }

    FadeOut(2, display::graphics.palette(), 10, 0, 0);
    display::graphics.screen()->clear(0);
    ShBox(0, 0, 319, 22);
    InBox(3, 3, 30, 19);
    IOBox(243, 3, 316, 19);
    draw_heading(40, 5, "MISSION REVIEW", 0, -1);
    display::graphics.setForegroundColor(1);
    draw_string(258, 13, "CONTINUE");
    draw_small_flag(plr, 4, 4);

    key = 0;
    Draw_Mis_Stats(plr, Data->P[plr].PastMissionCount - 1, 0, 1);
    key = 0;
    display::graphics.screen()->clear(0);
    return;
}
예제 #3
0
void
CompassWidget::draw_all(int bearing, int heading, int distance, int accuracy)
{
	display->colour(false);
	
	// Main outer circle
	display->circle(x + (size/2), y + (size/2), (size/2) - (COMPASS_DASH_SIZE/2));
	
	// Dashes round the edge
	draw_heading(-heading);
	
	// Arrow
	draw_bearing(-(heading + bearing));
	
	// Inner ring for distance/accuracy
	double ratio;
	if (distance != 0)
		ratio = ((double)accuracy) / ((double)distance);
	else
		ratio = 1.0;
	
	display->circle(x + (size/2), y + (size/2),
	                ((double)((size/2) - COMPASS_DASH_SIZE)) * MAX(MIN(ratio, 1.0),0.1));
}
예제 #4
0
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;
}
예제 #5
0
void DrawLimbo(char plr)
{
    int i;
    int lenprogname;  // Variable to hold and manipulate length of program name
    FadeOut(2, 10, 0, 0);

    helpText = "i039";
    keyHelpText = "k039";
    display::graphics.screen()->clear();
    ShBox(0, 0, 319, 22);
    InBox(3, 3, 30, 19);
    IOBox(243, 3, 316, 19);
    display::graphics.setForegroundColor(1);
    draw_string(258, 13, "CONTINUE");

    if (plr == 0) {
        draw_heading(36, 5, "ASTRONAUT COMPLEX", 0, -1);
    } else {
        draw_heading(40, 5, "COSMONAUT CENTER", 0, -1);
    }

    ShBox(0, 24, 158, 199);
    InBox(9, 51, 90, 102);
    fill_rectangle(25, 129, 153, 195, 0);
    fill_rectangle(5, 129, 19, 195, 0);
    ShBox(6, 130, 18, 161);
    ShBox(6, 163, 18, 194);
    draw_up_arrow(8, 133);
    draw_down_arrow(8, 166);
    ShBox(161, 24, 319, 72);
    InBox(165, 28, 315, 42);
    fill_rectangle(166, 29, 314, 41, 7);
    ShBox(161, 74, 319, 199);
    InBox(165, 77, 315, 89);
    fill_rectangle(166, 78, 314, 88, 10);
    fill_rectangle(10, 52, 89, 101, 7 + plr * 3);
    InBox(165, 46, 315, 67);
    fill_rectangle(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);

    display::graphics.setForegroundColor(20);
    draw_string(180, 55, "TRANSFER");

    if (plr == 0) {
        draw_string(178, 62, "ASTRONAUT");
    } else {
        draw_string(178, 62, "COSMONAUT");
    }

    draw_string(256, 55, "FACILITY");
    draw_string(254, 62, "TRANSFER");

    fill_rectangle(166, 78, 314, 88, 10);
    display::graphics.setForegroundColor(11);
    draw_string(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);
            display::graphics.setForegroundColor(17);
        } else {
            display::graphics.setForegroundColor(11);
        }

        lenprogname = (7 - strlen(Data->P[plr].Manned[i].Name)) * 3;
        //lenprogname=(7-lenprogname)*2
        draw_string(181 + lenprogname, 101 + 21 * i, Data->P[plr].Manned[i].Name);
        draw_string(181, 107 + 21 * i, "PROGRAM");

        display::graphics.setForegroundColor(11);
        draw_string(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:
            draw_string(258, 101 + 21 * i, "CAPSULE");
            break;

        case 1:
            draw_string(271, 101 + 21 * i, "L.M.");
            break;

        case 2:
            draw_string(268, 101 + 21 * i, "E.V.A.");
            break;

        case 3:
            draw_string(259, 101 + 21 * i, "DOCKING");
            break;

        case 4:
            draw_string(252, 101 + 21 * i, "ENDURANCE");
            break;

        default:
            break;
        }


    }

    display::graphics.setForegroundColor(11);
    draw_string(187, 37, "OPERATION SELECTION");

    display::graphics.setForegroundColor(20);
    //draw_string(256,13,"CONTINUE");
    draw_string(15, 37, "NAME:");
    draw_string(17, 118, "GROUP:");
    draw_string(88, 118, "TENURE:");
    display::graphics.setForegroundColor(11);
    draw_string(102, 60, "MOOD:");
    draw_string(102, 68, "CAP:");
    draw_string(102, 76, "L.M.:");
    draw_string(102, 84, "EVA:");
    draw_string(102, 92, "DOCK:");
    draw_string(102, 100, "END:");
    draw_small_flag(plr, 4, 4);

    return;
}
예제 #6
0
void PadDraw(char plr, char pad)
{
    int i, j, k, l;
    int missions;     // Variable for how many missions each 'naut has flown

    FadeOut(2, 10, 0, 0);
    display::graphics.screen()->clear();
    ShBox(0, 0, 319, 22);
    ShBox(0, 24, 319, 198);
    InBox(3, 3, 30, 19);
    IOBox(243, 3, 316, 19);
    InBox(167, 27, 316, 176);
    fill_rectangle(168, 28, 315, 175, 0);
    IOBox(167, 179, 316, 195);
    ShBox(4, 28, 162, 43);
    InBox(6, 30, 160, 41);
    ShBox(4, 46, 162, 61);
    InBox(6, 48, 160, 59);
    ShBox(4, 68, 162, 97);
    InBox(6, 70, 160, 95);
    ShBox(56, 64, 110, 74);
    InBox(57, 65, 109, 73);
    ShBox(4, 180, 162, 195);
    InBox(6, 182, 160, 193); //sched. duration
    InBox(6, 99, 160, 178);
    display::graphics.setForegroundColor(9);
    draw_string(18, 190, "SCHEDULED DURATION: ");
    display::graphics.setForegroundColor(7);
    int MisCod;
    MisCod = Data->P[plr].Mission[pad].MissionCode;

    if ((MisCod > 24 && MisCod < 37) || MisCod == 40 || MisCod == 41 || MisCod == 43 || MisCod == 44 || MisCod > 45)
        // Show Duration level for manned missions with Duration steps (this keeps the Mission[pad].Duration
        // variable from continuing to show Duration level if mission is scrubbed or downgraded) - Leon
    {
        switch (Data->P[plr].Mission[pad].Duration) {
        case 1:
            draw_string(0, 0, "A");
            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, "NONE");
            break;
        }
    } else {
        if (Data->P[plr].Mission[pad].PCrew - 1 >= 0 || Data->P[plr].Mission[pad].BCrew - 1 >= 0) {
            draw_string(0, 0, "A");
        } else {
            draw_string(0, 0, "NONE");
        }
    }

    display::graphics.setForegroundColor(7);
    draw_string(65, 71, "MISSION");
    draw_small_flag(plr, 4, 4);

    if (Data->P[plr].LaunchFacility[pad] == 1 && Data->P[plr].Mission[pad].MissionCode) {
        PadPict(2 + plr);
    } else if (Data->P[plr].LaunchFacility[pad] == 1 && Data->P[plr].Mission[pad].MissionCode == Mission_None) {
        PadPict(4 + plr);
    } else if (Data->P[plr].LaunchFacility[pad] > 1) {
        PadPict(0 + plr);
    }

    display::graphics.setForegroundColor(1);
    draw_string(15, 37, "STATUS: ");
    display::graphics.setForegroundColor(9);

    if (Data->P[plr].LaunchFacility[pad] == 1) {
        draw_string(0, 0, "OPERATIONAL");
    } else {
        draw_string(0, 0, "DESTROYED");
    }

    display::graphics.setForegroundColor(1);

    if (Data->P[plr].LaunchFacility[pad] > 1) {
        draw_string(15, 56, "REPAIR COST: ");
        display::graphics.setForegroundColor(9);
        draw_number(0, 0, Data->P[plr].LaunchFacility[pad]);
        draw_string(0, 0, "MB");

        if (Data->P[plr].Cash < Data->P[plr].LaunchFacility[pad]) {
            InBox(169, 181, 314, 193);
        }
    } else {
        display::graphics.setForegroundColor(9);

        if (Data->P[plr].Mission[pad].MissionCode == Mission_None) {
            draw_string(15, 56, "NO LAUNCH SCHEDULED");
            InBox(169, 181, 314, 193);
        } else {
            draw_string(15, 56, "PRE-MISSION CHECK");
        }
    }

    display::graphics.setForegroundColor(1);
    draw_string(258, 13, "CONTINUE");

    if (Data->P[plr].LaunchFacility[pad] == 1) {
        display::graphics.setForegroundColor(9);
        draw_string(210, 189, "S");
        display::graphics.setForegroundColor(1);
        draw_string(0, 0, "CRUB MISSION");
    } else {
        display::graphics.setForegroundColor(9);
        draw_string(205, 189, "F");
        display::graphics.setForegroundColor(1);
        draw_string(0, 0, "IX LAUNCH PAD");
    }

    draw_heading(37, 5, "LAUNCH FACILITY", 0, -1);

    switch (pad) {
    case 0:
        draw_heading(201, 5, "A", 0, -1);
        break;

    case 1:
        draw_heading(201, 5, "B", 0, -1);
        break;

    case 2:
        draw_heading(201, 5, "C", 0, -1);
        break;
    }

    display::graphics.setForegroundColor(6);
    MissionName(Data->P[plr].Mission[pad].MissionCode, 11, 81, 20);
    display::graphics.setForegroundColor(1);

    // joint mission part
    if (Data->P[plr].Mission[pad].Joint == 1) {
        ShBox(38, 91, 131, 101);
        InBox(39, 92, 130, 100);
        display::graphics.setForegroundColor(1);

        if (Data->P[plr].Mission[pad].part == 0) {
            draw_string(53, 98, "PRIMARY PART");
        } else {
            draw_string(44, 98, "SECONDARY PART");
        }
    }

    // Hardware to Use

    i = Data->P[plr].Mission[pad].Prog;
    j = Data->P[plr].Mission[pad].PCrew - 1;
    l = Data->P[plr].Mission[pad].BCrew - 1;

    // Crews
    display::graphics.setForegroundColor(7);
    draw_string(13, 107, "PRIMARY CREW  ");

    if (j >= 0) {
        display::graphics.setForegroundColor(11); // Now display the crew number, for player's easy reference - Leon

        if (j == 0) {
            draw_string(0, 0, "(CREW I)");
        }

        if (j == 1) {
            draw_string(0, 0, "(CREW II)");
        }

        if (j == 2) {
            draw_string(0, 0, "(CREW III)");
        }

        if (j == 3) {
            draw_string(0, 0, "(CREW IV)");
        }

        if (j == 4) {
            draw_string(0, 0, "(CREW V)");
        }

        if (j == 5) {
            draw_string(0, 0, "(CREW VI)");
        }

        if (j == 6) {
            draw_string(0, 0, "(CREW VII)");
        }

        if (j == 7) {
            draw_string(0, 0, "(CREW VIII)");
        }

        for (k = 0; k < Data->P[plr].CrewCount[i][j]; k++) {
            // Draw a morale box for each crew member - Leon
            display::graphics.setForegroundColor(1);
            fill_rectangle(13, 110 + 7 * k, 20, 110 + 7 * k, 2); // Top
            fill_rectangle(13, 110 + 7 * k, 13, 116 + 7 * k, 2); // Left
            fill_rectangle(13, 116 + 7 * k, 20, 116 + 7 * k, 4); // Bottom
            fill_rectangle(21, 110 + 7 * k, 21, 116 + 7 * k, 4); // Right

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood >= 65) {
                fill_rectangle(14, 111 + 7 * k, 20, 115 + 7 * k, 16);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood < 65 && Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood >= 40) {
                fill_rectangle(14, 111 + 7 * k, 20, 115 + 7 * k, 11);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood < 40 && Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood >= 20) {
                fill_rectangle(14, 111 + 7 * k, 20, 115 + 7 * k, 8);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood < 20) {
                fill_rectangle(14, 111 + 7 * k, 20, 115 + 7 * k, 0);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Mood == 0) {
                fill_rectangle(14, 111 + 7 * k, 20, 115 + 7 * k, 3);
            }

            display::graphics.setForegroundColor(1);

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Sex == 1) {
                display::graphics.setForegroundColor(5);    // Show female 'nauts in blue
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].RetirementDelay > 0) {
                display::graphics.setForegroundColor(0);    // Show anyone who's announced retirement in black
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Sex == 1 && Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].RetirementDelay > 0) {
                display::graphics.setForegroundColor(7);
            }

            // Show name in purple if 'naut is female AND has announced retirement
            draw_string(25, 115 + 7 * k, &Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Name[0]);
            missions = Data->P[plr].Pool[Data->P[plr].Crew[i][j][k] - 1].Missions;

            if (missions > 0) {
                draw_string(0, 0, " (");
                draw_number(0, 0, missions);
                draw_string(0, 0, ")");
            }
        }

        if (l == -1) {
            draw_string(25, 174, "UNAVAILABLE");
        }
    }

    display::graphics.setForegroundColor(7);
    draw_string(13, 145, "BACKUP CREW  ");

    if (l >= 0) {
        display::graphics.setForegroundColor(11); // Now display the crew number, for player's easy reference - Leon

        if (l == 0) {
            draw_string(0, 0, "(CREW I)");
        }

        if (l == 1) {
            draw_string(0, 0, "(CREW II)");
        }

        if (l == 2) {
            draw_string(0, 0, "(CREW III)");
        }

        if (l == 3) {
            draw_string(0, 0, "(CREW IV)");
        }

        if (l == 4) {
            draw_string(0, 0, "(CREW V)");
        }

        if (l == 5) {
            draw_string(0, 0, "(CREW VI)");
        }

        if (l == 6) {
            draw_string(0, 0, "(CREW VII)");
        }

        if (l == 7) {
            draw_string(0, 0, "(CREW VIII)");
        }

        for (k = 0; k < Data->P[plr].CrewCount[i][l]; k++) {
            // Draw a morale box for each crew member - Leon
            display::graphics.setForegroundColor(1);
            fill_rectangle(13, 148 + 7 * k, 20, 148 + 7 * k, 2); // Top
            fill_rectangle(13, 148 + 7 * k, 13, 154 + 7 * k, 2); // Left
            fill_rectangle(13, 154 + 7 * k, 20, 154 + 7 * k, 4); // Bottom
            fill_rectangle(21, 148 + 7 * k, 21, 154 + 7 * k, 4); // Right

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood >= 65) {
                fill_rectangle(14, 149 + 7 * k, 20, 153 + 7 * k, 16);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood < 65 && Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood >= 40) {
                fill_rectangle(14, 149 + 7 * k, 20, 153 + 7 * k, 11);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood < 40 && Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood >= 20) {
                fill_rectangle(14, 149 + 7 * k, 20, 153 + 7 * k, 8);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood < 20) {
                fill_rectangle(14, 149 + 7 * k, 20, 153 + 7 * k, 0);
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Mood == 0) {
                fill_rectangle(14, 149 + 7 * k, 20, 153 + 7 * k, 3);
            }

            display::graphics.setForegroundColor(1);

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Sex == 1) {
                display::graphics.setForegroundColor(5);    // Show female 'nauts in blue
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].RetirementDelay > 0) {
                display::graphics.setForegroundColor(0);    // But show anyone who's announced retirement in black
            }

            if (Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Sex == 1 && Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].RetirementDelay > 0) {
                display::graphics.setForegroundColor(7);
            }

            // Show name in purple if 'naut is female AND has announced retirement
            draw_string(25, 153 + 7 * k, &Data->P[plr].Pool[Data->P[plr].Crew[i][l][k] - 1].Name[0]);
        }

        if (j == -1) {
            draw_string(25, 136, "UNAVAILABLE");
        }
    }

    if (Data->P[plr].Mission[pad].Prog > 0)
        PatchMe(plr, 126, 40, Data->P[plr].Mission[pad].Prog - 1,
                Data->P[plr].Mission[pad].Patch, 32);

    FadeIn(2, 10, 0, 0);

    return;
}
예제 #7
0
void ShowAstrosHist(char plr)
{
    char pos = 0, pos2 = 0, glorf = 0;
    vhptr2 = new display::Surface(112, 55);
    abuf = (struct Astros *) buffer;

    if (Data->P[plr].AstroCount == 0) {
        return;
    }

    memcpy(abuf, Data->P[plr].Pool, sizeof(Data->P[plr].Pool));
    qsort((void *)abuf, Data->P[plr].AstroCount, sizeof(struct Astros), astcomp);

    FadeOut(2, display::graphics.palette(), 5, 0, 0);
    fill_rectangle(1, 39, 157, 184, 3);
    draw_heading(68, 71, "NO", 0, -1);
    draw_heading(46, 90, "MISSION", 0, -1);
    draw_heading(27, 109, "EXPERIENCE", 0, -1);
    vhptr2->copyFrom(display::graphics.screen(), 22, 69, 133, 123);
    PatchMe(0, 0, 0, 0, 0, 32);
    display::graphics.screen()->clear(0);

    ORBox(0, 0, 319, 22, 3); // Draw Inbox around top

    if (plr == 0) {
        draw_heading(45, 4, "ASTRONAUT HISTORY", 0, -1);
    } else {
        draw_heading(45, 4, "COSMONAUT HISTORY", 0, -1);
    }

    IRBox(243, 3, 316, 19, 0); // Inbox around cont box
    ORBox(245, 5, 314, 17, 3); // box for cont box
    InBox(3, 3, 31, 19); // USA inbox

    if (plr == 0) {
        draw_small_flag(0, 4, 4);
    } else {
        draw_small_flag(1, 4, 4);
    }

    display::graphics.setForegroundColor(1);
    draw_string(257, 13, "CONTINUE");
    ShBox(0, 24, 158, 199);
    ShBox(161, 24, 319, 199);
    InBox(233, 29, 314, 80);
    InBox(287, 104, 309, 134);
    IRBox(165, 175, 315, 196, 0);
    IRBox(6, 185, 153, 197, 0);
    ORBox(8, 187, 151, 195, 3);
    IRBox(6, 26, 153, 38, 0);
    ORBox(8, 28, 151, 36, 3);
    display::graphics.setForegroundColor(11);
    draw_string(165, 32, "NAME:");
    draw_string(165, 60, "TENURE:");
    draw_string(165, 78, "MISSIONS: ");
    draw_string(165, 89, "PRESTIGE: ");
    draw_string(165, 99, "SKILLS:");
    draw_string(165, 149, "SPACE DURATION:");
    draw_string(165, 159, "LOCATION: ");
    display::graphics.setForegroundColor(6);
    draw_string(174, 107, "CAPSULE PILOT: ");
    draw_string(174, 115, "L.M. PILOT: ");
    draw_string(174, 123, "E.V.A.: ");
    draw_string(174, 131, "DOCKING: ");
    draw_string(174, 139, "ENDURANCE: ");
    ORBox(167, 177, 202, 194, 3);
    ORBox(204, 177, 239, 194, 3);
    ORBox(241, 177, 276, 194, 3);
    ORBox(278, 177, 313, 194, 3);

    Display_ARROW(0, 179, 179); //left
    Display_ARROW(1, 213, 179); //left arrow
    Display_ARROW(2, 250, 179); //right
    Display_ARROW(3, 290, 179); //right arrow
    display::graphics.setForegroundColor(11);
    draw_string(37, 34, "PREVIOUS MISSION");
    draw_string(47, 193, "NEXT MISSION");
    DisplAst(plr, &pos, &pos2);
    DisplAstData(plr, &pos, &pos2);
    FadeIn(2, display::graphics.palette(), 5, 0, 0);

    WaitForMouseUp();

    while (1) {
        GetMouse();

        // Parse Button actions, note that continue button is not a macro
        if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) {
            InBox(245, 5, 314, 17);

            if (key > 0) {
                delay(300);
                key = 0;
            };

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            delete vhptr2;

            vhptr2 = NULL;

            key = 0;

            return;
        }

        pButton(8, 187, 151, 195, UpAstroData(plr, &pos, &pos2), key >> 8, 80);
        pButton(8, 28, 151, 36, DownAstroData(plr, &pos, &pos2), key >> 8, 72);
        pButton(167, 177, 202, 194, ShowAstroBack(plr, &pos, &pos2), key >> 8, 71); //Down to prev Astro
        pButton(204, 177, 239, 194, ShowAstroDown(plr, &pos, &pos2), key >> 8, 75);
        pButton(241, 177, 276, 194, ShowAstroUp(plr, &pos, &pos2), key >> 8, 77);
        pButton(278, 177, 313, 194, ShowAstroFor(plr, &pos, &pos2), key >> 8, 79);

        if (key >= 'A' && key <= 'Z') {
            glorf = 0;

            while (abuf[glorf].Name[0] < key && glorf < Data->P[plr].AstroCount - 1) {
                glorf++;
            }

            pos = glorf;
            DisplAst(plr, &pos, &pos2);
            key = 0;
        }

        key = 0;
    };
}
예제 #8
0
void DrawMisHist(char plr, int *where)
{
    char cYr[5], mtext[51];
    char yr, season, i, j, index = 0, prog, planet, pmis, temp = 0, temp2 = 11;


    //ai klugge

    for (i = 0; i < Data->P[plr].PastMissionCount; i++) {
        if (Data->P[plr].History[i].MissionCode == Mission_Jt_LunarLanding_EOR || Data->P[plr].History[i].MissionCode == Mission_Jt_LunarLanding_LOR) {
            for (j = 0; j < 4; j++)
                if (Data->P[plr].History[i].Man[PAD_A][j] != -1) {
                    Data->P[plr].History[i].Man[PAD_B][j] = Data->P[plr].History[i].Man[PAD_A][j];
                    Data->P[plr].History[i].Man[PAD_A][j] = -1;
                }
        }
    }

    yr = (*where - (*where % 2)) / 2 + 57;
    season = *where % 2;
    ORBox(95, 176, 224, 193, 3); //draw the boxes under date
    sprintf(cYr, "%d", 1900 + yr);
    draw_heading(103 + (yr - 57) * 4, 178, cYr, 0, -1);

    fill_rectangle(5, 29, 314, 169, 0);
    display::graphics.setForegroundColor(7 + 3 * plr);

    for (i = 0; i < 7; i++) {
        pline(13 + 49 * i, 29, 13 + 49 * i, 169);
    }

    display::graphics.setForegroundColor(12);

    if (*where % 2 == 0) for (i = 0; i < 6; i++) {
            strncpy(cYr, Month[i], 3);
            cYr[3] = 0;
            draw_string(29 + 49 * i, 36, cYr);
        }
    else for (i = 0; i < 6; i++) {
            strncpy(cYr, Month[i + 6], 3);
            cYr[3] = 0;
            draw_string(29 + 49 * i, 36, cYr);
        }


    // What the hell does this do

    while (yr > Data->P[plr].History[index].MissionYear) {
        index++;
    }

    if (Data->P[plr].History[index].MissionYear > yr) {

        return;
    }

    if (season == 1) {
        while (Data->P[plr].History[index].Month < 6 && yr == Data->P[plr].History[index].MissionYear) {
            index++;
        }

        if (Data->P[plr].History[index].MissionYear > yr) {

            return;
        }
    }

    do {
        if (Data->P[plr].History[index].Month >= 6 && season == 0) {
            break;
        }

        j = (Data->P[plr].History[index].Month < 6) ? Data->P[plr].History[index].Month
            : Data->P[plr].History[index].Month - 6;



        // first check for joint missions
        if (Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] > 0) {
            sprintf(mtext, "%s", Data->P[plr].History[index].MissionName[1]);
            display::graphics.setForegroundColor(11);
            draw_string(35 + 49 * j - strlen(mtext) / 2 * 5, 45 + 40 * temp, mtext);

            if (Data->P[plr].History[index].Man[PAD_A][0] != -1 && Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] != -1) {
                PatchMe(plr, 10 + 49 * j, 50 + 40 * temp, Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule],
                        Data->P[plr].History[index].Patch[0], 32);
            }

            if (Data->P[plr].History[index].Man[PAD_B][0] != -1 && Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] != -1) {
                PatchMe(plr, 42 + 49 * j, 50 + 40 * temp, Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule],
                        Data->P[plr].History[index].Patch[1], 32);
            }

            // FIXME: Same test on either side of this.  Need to research what was intended.
            if (Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] != -1 && Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] != -1) {
                if (Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule] != -1 && Data->P[plr].History[index].Man[PAD_A][Mission_Capsule] != -1) {
                    planet = 0;
                    prog = Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule];
                    SmHardMe(plr, 44 + 38 * j, 50 + 40 * temp, prog, planet, 64);
                }

                pmis = Data->P[plr].History[index].MissionCode;

                if (pmis == 55 || pmis == 56) {
                    temp2 = 0;
                } else {
                    temp2 = 11;
                }

                planet = 0;
                prog = Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule];
                SmHardMe(plr, 44 + (38 + temp2)*j, 50 + 40 * temp, prog, planet, 64);
            }

            //else
            // {
            //  prog = (Data->P[plr].History[index].Hard[PAD_A][0] != -1) ?
            //  Data->P[plr].History[index].Hard[PAD_A][0] :
            //  Data->P[plr].History[index].Hard[PAD_A][3]+5;
            //  planet=0;
            //  SmHardMe(plr,44+49*j,50+40*temp,prog,planet,64);
            // }
        } else {
            //fix-Handle Joint Missions
            if (Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule] != -1 && Data->P[plr].History[index].Man[PAD_A][0] != -1) {
                PatchMe(plr, 10 + 49 * j, 50 + 40 * temp, Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule],
                        Data->P[plr].History[index].Patch[0], 32);
            }

            if (Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule] != -1 && Data->P[plr].History[index].Man[PAD_B][0] != -1) {
                prog = Data->P[plr].History[index].Hard[PAD_B][Mission_Capsule];
            } else {
                prog = (Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule] != -1) ?
                       Data->P[plr].History[index].Hard[PAD_A][Mission_Capsule] :
                       Data->P[plr].History[index].Hard[PAD_A][Mission_Probe_DM] + 5;
            }

            pmis = Data->P[plr].History[index].MissionCode;

            if (prog == 6 && pmis == 9) {
                planet = 2;
            } else if (prog == 6 && pmis == 10) {
                planet = 3;
            } else if (prog == 6 && pmis == 11) {
                planet = 1;
            } else if (prog == 6 && pmis == 12) {
                planet = 4;
            } else if (prog == 6 && pmis == 13) {
                planet = 5;
            } else if (pmis == 0) {
                planet = 7;
            } else if (pmis == 1) {
                planet = 7;
            } else if (pmis == 7) {
                planet = 6;
            } else if (pmis == 8) {
                planet = 6;
            } else {
                planet = 0;
            }

            sprintf(mtext, "%s", Data->P[plr].History[index].MissionName[0]);
            display::graphics.setForegroundColor(11);
            draw_string(35 + 49 * j - strlen(mtext) / 2 * 5, 45 + 40 * temp, mtext);
            SmHardMe(plr, 44 + 49 * j, 50 + 40 * temp, prog, planet, 64);
        }

        temp++;
        index++;
    } while (Data->P[plr].History[index].MissionYear == yr);

    return;
}
예제 #9
0
void ShowSpHist(char plr)
{
    int pos;

    FadeOut(2, display::graphics.palette(), 5, 0, 0);
    PatchMe(0, 0, 0, 0, 0, 32);
    display::graphics.screen()->clear(0);

    if ((Data->Year == 57 && Data->Season == 0) || Data->P[plr].PastMissionCount == 0) {
        pos = (Data->Year - 57) * 2 + Data->Season;
    } else pos = (Data->P[plr].History[Data->P[plr].PastMissionCount - 1].MissionYear - 57) * 2 +
                     ((Data->P[plr].History[Data->P[plr].PastMissionCount - 1].Month <= 5) ? 0 : 1);

    ORBox(0, 0, 319, 22, 3); // Draw Inbox around top
    draw_heading(48, 5, "MISSION HISTORY", 0, -1);
    IOBox(243, 3, 316, 19);
    InBox(3, 3, 31, 19); // USA inbox
    draw_small_flag(plr, 4, 4);
    display::graphics.setForegroundColor(1);
    draw_string(257, 13, "CONTINUE");

    ORBox(0, 24, 319, 199, 3);
    IRBox(4, 28, 315, 170, 0);
    IRBox(4, 174, 315, 195, 0);
    ORBox(7, 176, 49, 193, 3);
    ORBox(51, 176, 93, 193, 3);
    ORBox(95, 176, 224, 193, 3); //draw the boxes under date
    ORBox(226, 176, 268, 193, 3);
    ORBox(270, 176, 312, 193, 3);
    Display_ARROW(0, 23, 178); //left
    Display_ARROW(1, 63, 178); //left arrow
    Display_ARROW(2, 239, 178); //right
    Display_ARROW(3, 285, 178); //right arrow
    DrawMisHist(plr, &pos);
    FadeIn(2, display::graphics.palette(), 5, 0, 0);

    WaitForMouseUp();

    while (1) {
        GetMouse();
        Mission_Data_Buttons(plr, &pos);

        // Parse Button actions, note that return is embedded in first pButton
        if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) {
            InBox(245, 5, 314, 17);

            if (key > 0) {
                delay(300);
                key = 0;
            };

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            return;
        }

        pButton(7, 176, 49, 193, FullRewind(plr, &pos), key >> 8, 71); //FullRewind Button etc..
        pButton(51, 176, 93, 193, RewindOne(plr, &pos), key >> 8, 75);
        pButton(226, 176, 268, 193, FastOne(plr, &pos), key >> 8, 77);
        pButton(270, 176, 312, 193, FullFast(plr, &pos), key >> 8, 79);
        key = 0;
    };
}
예제 #10
0
void DamProb(char plr, char prog, int chk)
{
    int D_Cost, Saf_Loss, ESafety;
    char Digit[4], Name[30];

    Saf_Loss = D_Cost = ESafety = 0; /* XXX check uninitialized */

    FadeOut(2, 10, 0, 0);

    display::graphics.screen()->clear();

    switch (prog) {
    case 0:
        D_Cost = Data->P[plr].Probe[chk].DCost;
        Saf_Loss = Data->P[plr].Probe[chk].Damage;
        ESafety = Data->P[plr].Probe[chk].Safety;
        strcpy(Name, Data->P[plr].Probe[chk].Name);
        break;

    case 1:
        D_Cost = Data->P[plr].Rocket[chk].DCost;
        Saf_Loss = Data->P[plr].Rocket[chk].Damage;
        ESafety = Data->P[plr].Rocket[chk].Safety;
        strcpy(Name, Data->P[plr].Rocket[chk].Name);
        break;

    case 2:
        D_Cost = Data->P[plr].Manned[chk].DCost;
        Saf_Loss = Data->P[plr].Manned[chk].Damage;
        ESafety = Data->P[plr].Manned[chk].Safety;
        strcpy(Name, Data->P[plr].Manned[chk].Name);
        break;

    case 3:
        D_Cost = Data->P[plr].Misc[chk].DCost;
        Saf_Loss = Data->P[plr].Misc[chk].Damage;
        ESafety = Data->P[plr].Misc[chk].Safety;
        strcpy(Name, Data->P[plr].Misc[chk].Name);
        break;

    default:
        break;
    }

    ShBox(35, 81, 288, 159);
    InBox(40, 86, 111, 126);
    InBox(116, 86, 283, 126);
    IOBox(116, 130, 189, 155);
    IOBox(201, 130, 274, 155);
    draw_flag(41, 87, plr);
    draw_heading(135, 136, "YES", 1, 0);
    draw_heading(225, 136, "NO", 1, 0);
    draw_heading(44, 135, "REPAIR", 1, -1);
    display::graphics.setForegroundColor(6);
    draw_string(121, 95, "DIRECTOR: ");
    display::graphics.setForegroundColor(8);

    if (plr == 0) {
        draw_string(0, 0, &Data->P[Data->plr[0]].Name[0]);
    } else {
        draw_string(0, 0, &Data->P[Data->plr[1]].Name[0]);
    }

    display::graphics.setForegroundColor(6);
    draw_string(121, 104, "DAMAGE: ");
    display::graphics.setForegroundColor(11);
    strcat(Name, " PROGRAM");
    draw_string(0, 0, &Name[0]);
    display::graphics.setForegroundColor(6);
    draw_string(121, 113, "DAMAGE COST: ");
    display::graphics.setForegroundColor(1);
    sprintf(&Digit[0], "%d", D_Cost);
    draw_string(0, 0, &Digit[0]);
    draw_string(0, 0, " M.B.  (OF ");
    draw_megabucks(0, 0, Data->P[plr].Cash);
    draw_string(0, 0, ")");
    display::graphics.setForegroundColor(6);
    draw_string(121, 122, "SAFETY LOSS: ");
    display::graphics.setForegroundColor(1);
    sprintf(&Digit[0], "%d", Saf_Loss);
    draw_string(0, 0, &Digit[0]);
    draw_string(0, 0, "%  (FROM ");
    sprintf(&Digit[0], "%d", ESafety);
    draw_string(0, 0, &Digit[0]);
    draw_string(0, 0, "%)");
    FadeIn(2, 10, 0, 0);

    WaitForMouseUp();

    while (1) {
        key = 0;
        GetMouse();

        if (mousebuttons > 0 || key > 0) {
            if ((x >= 118 && y >= 132 && x <= 187 && y <= 153 && mousebuttons > 0) || key == 'Y') {
                InBox(118, 132, 187, 153);
                WaitForMouseUp();

                if (key > 0) {
                    delay(150);
                }

                Data->P[plr].Cash -= D_Cost;

                switch (prog) {
                case 0:
                    Data->P[plr].Probe[chk].DCost = 0;
                    Data->P[plr].Probe[chk].Damage = 0;
                    break;

                case 1:
                    Data->P[plr].Rocket[chk].DCost = 0;
                    Data->P[plr].Rocket[chk].Damage = 0;
                    break;

                case 2:
                    Data->P[plr].Manned[chk].DCost = 0;
                    Data->P[plr].Manned[chk].Damage = 0;
                    break;

                case 3:
                    Data->P[plr].Misc[chk].DCost = 0;
                    Data->P[plr].Misc[chk].Damage = 0;
                    break;

                default:
                    break;
                }

                return;
            } else if ((x >= 203 && y >= 132 && x <= 272 && y <= 153 && mousebuttons > 0) || key == 'N') {
                InBox(203, 132, 272, 153);
                WaitForMouseUp();

                if (key > 0) {
                    delay(150);
                }

                return;
            }
        }
    }
}
예제 #11
0
void DrawPrefs(int where, char a1, char a2)
{
    int mode = 0;

    FadeOut(2, 10, 0, 0);
    helpText = "i013";
    keyHelpText = "K013";

    boost::shared_ptr<display::PalettizedSurface> prefs_image(Filesystem::readImage("images/preferences.png"));
    // fixme: don't use vhptr to draw this screen
    vhptr->palette().copy_from(prefs_image->palette());
    vhptr->draw(prefs_image, 0, 0);

    display::graphics.screen()->clear();
    prefs_image->exportPalette();
    ShBox(0, 0, 319, 22);
    ShBox(0, 24, 89, 199);
    ShBox(91, 24, 228, 107);
    IOBox(98, 28, 137, 63);
    IOBox(98, 68, 137, 103);
    IOBox(144, 28, 221, 63);
    /* This draws disabled button around camera */
    /* IOBox(144,68,221,103); */
    InBox(144, 68, 221, 103);

    ShBox(91, 109, 228, 199);
    InBox(95, 113, 224, 195);
    fill_rectangle(96, 114, 223, 194, 0);
    ShBox(230, 24, 319, 199);

    if (where == 2) {
        where = mode = 1;    //modem klugge
    } else if (where == 3) {
        where = mode = 2;    //play-by-mail
    }

    if (where == 0 || where == 2) {
        music_start(M_SOVTYP);
        IOBox(6, 105, 83, 140);
        IOBox(6, 158, 83, 193);
        IOBox(236, 105, 313, 140);
        IOBox(236, 158, 313, 193);
        InBox(6, 52, 83, 87);
        InBox(236, 52, 313, 87);
        fill_rectangle(7, 53, 82, 86, 0);
        fill_rectangle(237, 53, 312, 86, 0);
        OutBox(8, 77, 18, 85);
        OutBox(238, 77, 248, 85);
        //BinT(8,54,0);BinT(238,54,0);  // Old way with buttons
        BinT(8, 54, 1);
        BinT(238, 54, 1);  // No select Buttons
        fill_rectangle(237, 35, 312, 41, 0);
        fill_rectangle(7, 35, 82, 41, 0);
    } else {
        music_start(M_DRUMSM);
        InBox(8, 107, 81, 138);
        InBox(8, 160, 81, 191);
        InBox(238, 107, 311, 138);
        InBox(238, 160, 311, 191);
        InBox(8, 77, 18, 85);
        InBox(238, 77, 248, 85);
        BinT(8, 54, 1);
        BinT(238, 54, 1);
        fill_rectangle(237, 35, 312, 41, 0);
        fill_rectangle(7, 35, 82, 41, 0);
    };

    if (mode == 0) {
        draw_heading(6, 5, "PREFERENCES SELECTIONS", 0, -1);
    } else if (mode == 2) {
        draw_heading(3, 5, "PLAY BY MAIL SELECTIONS", 0, -1);
    } else {
        draw_heading(6, 5, "MODEM GAME SELECTIONS", 0, -1);
    }

    IOBox(243, 3, 316, 19);
    InBox(236, 34, 313, 42);
    InBox(6, 34, 83, 42);
    PLevels(0, Data->Def.Plr1);
    CLevels(0, a1);
    PLevels(1, Data->Def.Plr2);
    CLevels(1, a2);
    Levels(0, Data->Def.Lev1, 1);
    Levels(0, Data->Def.Ast1, 0);
    Levels(1, Data->Def.Lev2, 1);
    Levels(1, Data->Def.Ast2, 0);

    if (where == 0 || where == 2) {
        display::graphics.setForegroundColor(9);
    } else {
        display::graphics.setForegroundColor(34);
    }

    draw_string(23, 30, "PLAYER 1");
    display::graphics.setForegroundColor(34);
    draw_string(253, 30, "PLAYER 2");
    display::graphics.setForegroundColor(5);
    draw_string(23, 49, "COUNTRY");
    draw_string(254, 49, "COUNTRY");
    draw_string(17, 101, "GAME LEVEL");
    draw_string(247, 101, "GAME LEVEL");
    draw_string(249, 148, "COSMONAUT");
    draw_string(250, 155, "SELECTION");
    draw_string(19, 148, "ASTRONAUT");
    draw_string(20, 155, "SELECTION");
    display::graphics.setForegroundColor(1);
    draw_string(258, 13, "CONTINUE");
    draw_string(8, 40, &Data->P[ Data->Def.Plr1 ].Name[0]);
    draw_string(238, 40, &Data->P[ Data->Def.Plr2 ].Name[0]);

    // todo: convert to draw commands
    vhptr->copyTo(display::graphics.legacyScreen(), 153 + 34 * (Data->Def.Music), 0, 101, 31, 134, 60);
    vhptr->copyTo(display::graphics.legacyScreen(), 221 + 34 * (Data->Def.Sound), 0, 101, 71, 134, 100);

    vhptr->copyTo(display::graphics.legacyScreen(), 216, 30, 147, 31, 218, 60);
    vhptr->copyTo(display::graphics.legacyScreen(), 72 * (Data->Def.Anim), 90, 147, 71, 218, 100);
    HModel(Data->Def.Input, 1);

    // if (where==0 || where==2)
    FadeIn(2, 10, 0, 0);
    return;
}
예제 #12
0
파일: hncui.c 프로젝트: PFigs/portfolio
void *th_jogadas(void *arg)
{
   _Bool side = *(_Bool *)arg;
   int codigo=DRAW;
   char **resposta;
   char temp1[SMALL_BUFF];
   char temp2[SMALL_BUFF];


   lock(&actualiza);

   espera=TRUE;

   debug=FALSE;

   /**Comunica STR ao servidor assim que confirmado pelo jogador*/
   boas_vindas(side,TRUE);

   draw_heading(nome_jogo, cowboys[LEFT].name, cowboys[LEFT].bulletsleft, cowboys[LEFT].games, cowboys[RIGHT].name, cowboys[RIGHT].bulletsleft, cowboys[RIGHT].games, codigo);

   draw_cowboy(LEFT);
   draw_cowboy(RIGHT);

   unlock(&actualiza);


   codigo=NODRAW;

   for(;;)
   {

      /**Espera por comunicacoes*/
      resposta=espera_resposta(&cowboys[side].sfd,resposta,&codigo);

      lock(&actualiza);
      lock(&ecra);

      if(modifica_janela(resposta, side, codigo)) break;

      draw_heading(nome_jogo, cowboys[LEFT].name, cowboys[LEFT].bulletsleft, cowboys[LEFT].games, cowboys[RIGHT].name, cowboys[RIGHT].bulletsleft, cowboys[RIGHT].games, codigo);

      unlock(&actualiza);
      unlock(&ecra);
   }

   quit=TRUE;

   clear();

   refresh();

   wtimeout(wnd,-1);

   mvwprintw(wnd, 1, 0, "Estatísticas finais");

   mvwprintw(wnd, 0, 0, "High Noon - Projecto de Programacao de Sistemas");

   memset((void*)&temp1,(int)'\0',sizeof(temp1));

   mvwprintw(wnd, NROWS/2-1, NCOLS/2-(strlen(cowboys[LEFT].name)+strlen(" Vs ")+strlen(cowboys[RIGHT].name))/2, "%s Vs %s",cowboys[LEFT].name, cowboys[RIGHT].name);

   memset((void*)&temp1,(int)'\0',sizeof(temp1));
   memset((void*)&temp2,(int)'\0',sizeof(temp2));

   sprintf(temp1,"%d",cowboys[LEFT].games);
   sprintf(temp2,"%d",cowboys[RIGHT].games);
   mvwprintw(wnd, NROWS/2, NCOLS/2-(strlen(temp1)+strlen(" Vs ")+strlen(temp2))/2, "%s Vs %s", temp1, temp2);

   mvwprintw(wnd, NROWS-2, 0, "Obrigado por jogar\n");
   mvwprintw(wnd, NROWS-1, 0, "Pressione uma tecla para terminar\n");

   refresh();

   getch();

   close_HN_window();

   delwin(wnd);

   unlock(&actualiza);
   unlock(&ecra);

   pthread_exit(0);
}
예제 #13
0
/* Draws the entire Future Missions display, including the mission-
 * specific information. Used to initialize the mission selector
 * interface.
 *
 * This relies on the global buffer vh, which must have been created
 * prior. The future missions button art is loaded into vh by this
 * function.
 *
 * \param plr  The player scheduling the mission's design scheme.
 * \param mis  The mission type.
 * \param pad  0, 1, or 2 depending on which pad is being used.
 */
void DrawFuture(char plr, int mis, char pad)
{
    FadeOut(2, 10, 0, 0);
    Load_FUT_BUT();

    boost::shared_ptr<display::PalettizedSurface> planets(Filesystem::readImage("images/fmin.img.0.png"));
    planets->exportPalette();

    display::graphics.screen()->clear();

    gr_sync();

    fill_rectangle(1, 1, 318, 21, 3);
    fill_rectangle(317, 22, 318, 198, 3);
    fill_rectangle(1, 197, 316, 198, 3);
    fill_rectangle(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);   // Duration lock
    ShBox(80, 74, 90, 82);   // Docking lock
    ShBox(117, 74, 127, 82); // EVA lock
    ShBox(154, 74, 164, 82); // LM lock
    ShBox(191, 74, 201, 82); // Joint mission lock
    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

    // Mission penalty numerical display
    fill_rectangle(206, 36, 235, 44, 7);
    ShBox(203, 33, 238, 47);
    InBox(205, 35, 236, 45);

    // Mission scroll arrows
    draw_up_arrow(8, 95);
    draw_down_arrow(8, 157);

    // Display mission steps toggle
    vh->copyTo(display::graphics.legacyScreen(), 140, 5, 5, 132, 15, 146);

    // Draw the mission specification toggle buttons
    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);
    Toggle(4, 1);

    if (JointFlag == false) {
        InBox(191, 74, 201, 82);
        TogBox(166, 49, 1);
    } else {
        OutBox(191, 74, 201, 82);
        TogBox(166, 49, 0);
    }

    gr_sync();

    Missions(plr, 8, 37, mis, 1);

    GetMinus(plr);

    display::graphics.setForegroundColor(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:
        draw_string(8, 30, "PAD A:");
        break;

    case 1:
        draw_string(8, 30, "PAD B:");
        break;

    case 2:
        draw_string(8, 30, "PAD C:");
        break;
    }

    display::graphics.setForegroundColor(1);

    draw_string(9, 80, "RESET");
    draw_string(258, 13, "CONTINUE");

    display::graphics.setForegroundColor(11);

    if (Data->Season == 0) {
        draw_string(200, 9, "SPRING");
    } else {
        draw_string(205, 9, "FALL");
    }

    draw_string(206, 16, "19");
    draw_number(0, 0, Data->Year);
    display::graphics.setForegroundColor(1);
    draw_small_flag(plr, 4, 4);
    draw_heading(40, 5, "FUTURE MISSIONS", 0, -1);
    FadeIn(2, 10, 0, 0);

    return;
}
예제 #14
0
/**
 * The main capsule building interface.
 *
 * Programs refers to the Manned capsule programs, specifically the
 * ones where astronauts may be assigned. This has the main control
 * loop for the capsule building user interface.
 *
 * \param plr  the country running the program
 * \param prog  the capsule style
 */
void Programs(char plr, char prog)
{
    int i, max, chk, tst;
    int now2 = 0, count = 0, grp = 0, BarA = 0;
    int M[100], CrewCount[8];
    char ksel = 0;

    helpText = "i036";
    keyHelpText = "k036";

    for (i = 0; i < 100; i++) {
        M[i] = -1;
    }

    if (prog > 4) {
        max = 4;
    } else if (prog == 4) {
        max = 3;
    } else {
        max = prog;
    }

    music_start(M_PRGMTRG);
    DrawProgs(plr, prog);
    Flts(0, 0);

    for (i = 0; i < ASTRONAUT_CREW_MAX; i++) {
        CrewCount[i] = Data->P[plr].CrewCount[prog][i];

        if (CrewCount[i] == 0) {
            FltsTxt(i, 8);
        }

        if (CrewCount[i] < max && CrewCount[i] != 0) {
            FltsTxt(i, 9);
        }

        if (CrewCount[i] == max) {
            FltsTxt(i, 1);
        }
    }

    for (i = 0; i < Data->P[plr].AstroCount; i++) {
        if (Data->P[plr].Pool[i].Assign == prog
            && Data->P[plr].Pool[i].Crew == 0) {
            M[count++] = i;
        }
    }

    ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
    DispLeft(plr, BarA, count, now2, &M[0]);
    NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
               Data->P[plr].Crew[prog][grp][1],
               Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]);
    FadeIn(2, 10, 0, 0);

    chk = CheckProgram(plr, prog);

    if (chk == 0) {
        if (plr == 0) {
            Help("i113");
        } else {
            Help("i114");
        }

        music_stop();
        return;
    }

    WaitForMouseUp();

    while (1) {
        key = 0;
        GetMouse();

        for (i = 0; i < 8; i++) {
            // Right Select Box
            if (x >= 27 && y >= (131 + i * 8) && x <= 151
                && y <= (137 + i * 8) && mousebuttons > 0
                && (now2 - BarA + i) <= (count - 1)) {
                // Left
                now2 -= BarA;
                now2 += i;
                BarA = i;
                fill_rectangle(26, 129, 153, 195, 0);
                DispLeft(plr, BarA, count, now2, &M[0]);
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                BarSkill(plr, BarA, now2, &M[0]);
                WaitForMouseUp();
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                DispLeft(plr, BarA, count, now2, &M[0]);
            }
        }

        if (mousebuttons > 0 || key > 0) {  /* Gameplay */
            if (((x >= 6 && y >= 130 && x <= 18 && y <= 161
                  && mousebuttons > 0) || key == UP_ARROW)
                && count > 0) {
                /* Lft Up */
                InBox(6, 130, 18, 161);

                for (i = 0; i < 50; i++) {
                    key = 0;
                    GetMouse();
                    delay(10);

                    if (mousebuttons == 0) {

                        if (BarA == 0)
                            if (now2 > 0) {
                                now2--;
                                fill_rectangle(26, 129, 153, 195, 0);
                                ShBox(26, 130 + BarA * 8, 152,
                                      138 + BarA * 8);
                                DispLeft(plr, BarA, count, now2, &M[0]);
                            }

                        if (BarA > 0) {
                            fill_rectangle(26, 129, 153, 195, 0);
                            BarA--;
                            now2--;
                            ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                            DispLeft(plr, BarA, count, now2, &M[0]);
                        }

                        i = 51;
                    }
                }

                while (mousebuttons == 1 || key == UP_ARROW) {
                    delay(100);

                    if (BarA == 0)
                        if (now2 > 0) {
                            now2--;
                            fill_rectangle(26, 129, 153, 195, 0);
                            ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                            DispLeft(plr, BarA, count, now2, &M[0]);
                        }

                    if (BarA > 0) {
                        fill_rectangle(26, 129, 153, 195, 0);
                        BarA--;
                        now2--;
                        ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                        DispLeft(plr, BarA, count, now2, &M[0]);
                    }

                    key = 0;

                    GetMouse();
                }

                OutBox(6, 130, 18, 161);
                delay(10);
            } else if (((x >= 6 && y >= 163 && x <= 18 && y <= 194
                         && mousebuttons > 0) || key == DN_ARROW)
                       && count > 0) {
                /* Lft Dwn */
                InBox(6, 163, 18, 194);

                for (i = 0; i < 50; i++) {
                    key = 0;
                    GetMouse();
                    delay(10);

                    if (mousebuttons == 0) {

                        if (BarA == 7)
                            if (now2 < count - 1) {
                                now2++;
                                fill_rectangle(26, 129, 153, 195, 0);
                                ShBox(26, 130 + BarA * 8, 152,
                                      138 + BarA * 8);
                                DispLeft(plr, BarA, count, now2, &M[0]);
                            }

                        if (BarA < 7)
                            if (now2 < count - 1) {
                                fill_rectangle(26, 129, 153, 195, 0);
                                BarA++;
                                now2++;
                                ShBox(26, 130 + BarA * 8, 152,
                                      138 + BarA * 8);
                                DispLeft(plr, BarA, count, now2, &M[0]);
                            }

                        i = 51;
                    }
                }

                while (mousebuttons == 1 || key == DN_ARROW) {
                    delay(100);

                    if (BarA == 7)
                        if (now2 < count - 1) {
                            now2++;
                            fill_rectangle(26, 129, 153, 195, 0);
                            ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                            DispLeft(plr, BarA, count, now2, &M[0]);
                        }

                    if (BarA < 7)
                        if (now2 < count - 1) {
                            fill_rectangle(26, 129, 153, 195, 0);
                            BarA++;
                            now2++;
                            ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                            DispLeft(plr, BarA, count, now2, &M[0]);
                        }

                    key = 0;

                    GetMouse();
                }

                //WaitForMouseUp();
                OutBox(6, 163, 18, 194);
            } else if (key == K_HOME) {
                fill_rectangle(26, 129, 153, 195, 0);
                BarA = 0;
                now2 = 0;
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                DispLeft(plr, BarA, count, now2, &M[0]);
            } else if (key == K_END) {
                fill_rectangle(26, 129, 153, 195, 0);
                BarA = MIN(count - 1, 7);
                now2 = count - 1;
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                DispLeft(plr, BarA, count, now2, &M[0]);
            } else if (key == 'S') {
                // Show Skill
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                BarSkill(plr, BarA, now2, &M[0]);
            } else if (((x >= 4 && y >= 86 && x <= 12 && y <= 92
                         && mousebuttons > 0) || key == '1')
                       && CrewCount[grp] >= 1) {
                /* Display Man 1 */
                InBox(4, 86, 12, 92);
                AstLevel(plr, prog, grp, 0);
                OutBox(4, 86, 12, 92);
            } else if (((x >= 4 && y >= 95 && x <= 12 && y <= 101
                         && mousebuttons > 0) || key == '2') && prog >= 2
                       && CrewCount[grp] >= 2) {
                /* Display Man 2 */
                InBox(4, 95, 12, 101);
                AstLevel(plr, prog, grp, 1);
                OutBox(4, 95, 12, 101);
            } else if (((x >= 4 && y >= 104 && x <= 12 && y <= 110
                         && mousebuttons > 0) || key == '3') && prog >= 3
                       && CrewCount[grp] >= 3) {
                /* Display Man 3 */
                InBox(4, 104, 12, 110);
                AstLevel(plr, prog, grp, 2);
                OutBox(4, 104, 12, 110);
            } else if (((x >= 4 && y >= 113 && x <= 12 && y <= 119
                         && mousebuttons > 0) || key == '4') && prog >= 5
                       && CrewCount[grp] >= 4) {
                /* Display Man 4 */
                InBox(4, 113, 12, 119);
                AstLevel(plr, prog, grp, 3);
                OutBox(4, 113, 12, 119);
            } else if (key == 'C') {
                ClearIt();
                ksel = grp;        //save old flt crew

                if (grp == 7) {
                    grp = 0;
                } else {
                    ++grp;
                }

                Flts(ksel, grp);
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);

                if (key > 0) {
                    delay(150);
                }
            } else if (x >= 164 && y >= 139 && x <= 238 && y <= 151
                       && mousebuttons > 0) {
                /* Flt Crew I */
                ClearIt();
                Flts(grp, 0);
                grp = 0;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 164 && y >= 154 && x <= 238 && y <= 166
                       && mousebuttons > 0) {
                /* Flt Crew II */
                ClearIt();
                Flts(grp, 1);
                grp = 1;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 164 && y >= 169 && x <= 238 && y <= 181
                       && mousebuttons > 0) {
                /* Flt Crew III */
                ClearIt();
                Flts(grp, 2);
                grp = 2;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 164 && y >= 184 && x <= 238 && y <= 196
                       && mousebuttons > 0) {
                /* Flt Crew IV */
                ClearIt();
                Flts(grp, 3);
                grp = 3;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 241 && y >= 139 && x <= 315 && y <= 151
                       && mousebuttons > 0) {
                /* Flt Crew V */
                ClearIt();
                Flts(grp, 4);
                grp = 4;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 241 && y >= 154 && x <= 315 && y <= 166
                       && mousebuttons > 0) {
                /* Flt Crew VI */
                ClearIt();
                Flts(grp, 5);
                grp = 5;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 241 && y >= 169 && x <= 315 && y <= 181
                       && mousebuttons > 0) {
                /* Flt Crew VII */
                ClearIt();
                Flts(grp, 6);
                grp = 6;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (x >= 241 && y >= 184 && x <= 315 && y <= 196
                       && mousebuttons > 0) {
                /* Flt Crew VIII */
                ClearIt();
                Flts(grp, 7);
                grp = 7;
                NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                           Data->P[plr].Crew[prog][grp][1],
                           Data->P[plr].Crew[prog][grp][2],
                           Data->P[plr].Crew[prog][grp][3]);
                WaitForMouseUp();
            } else if (((x >= 245 && y >= 88 && x <= 314 && y <= 100
                         && mousebuttons > 0) || key == 'A')
                       && CrewCount[grp] < max) {
                /* Assign 'Naut */
                if (Data->P[plr].Crew[prog][grp][CrewCount[grp]] == 0
                    && count > 0) {
                    InBox(245, 88, 314, 100);
                    Data->P[plr].Crew[prog][grp][CrewCount[grp]] = M[now2] + 1;

                    AstNames(CrewCount[grp], &Data->P[plr].Pool[M[now2]].Name[0],
                             Data->P[plr].Pool[M[now2]].Mood);
                    Data->P[plr].Pool[M[now2]].Crew = grp + 1;
                    Data->P[plr].Pool[M[now2]].Task = CrewCount[grp];
                    Data->P[plr].Pool[M[now2]].Unassigned = 1;

                    for (i = now2; i < count; i++) {
                        M[i] = M[i + 1];
                    }

                    M[i] = -1;
                    count--;

                    if (now2 == count) {
                        if (now2 > 0) {
                            now2--;
                        }

                        if (BarA > 0) {
                            BarA--;
                        }
                    }

                    fill_rectangle(26, 129, 153, 195, 0);

                    ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);

                    DispLeft(plr, BarA, count, now2, &M[0]);

                    CrewCount[grp]++;

                    Data->P[plr].CrewCount[prog][grp] = CrewCount[grp];

                    if (CrewCount[grp] == max) {
                        FltsTxt(grp, 1);
                    } else {
                        FltsTxt(grp, 9);
                    }

                    NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0],
                               Data->P[plr].Crew[prog][grp][1],
                               Data->P[plr].Crew[prog][grp][2],
                               Data->P[plr].Crew[prog][grp][3]);
                    WaitForMouseUp();

                    if (key > 0) {
                        delay(150);
                    }

                    OutBox(245, 88, 314, 100);
                }                 /* End outer if */
            } else if ((x >= 245 && y >= 106 && x <= 314 && y <= 118
                        && mousebuttons > 0) || key == 'B') {
                /* Break Group */
                tst = Data->P[plr].Crew[prog][grp][0] - 1;

                /* If the crew is assigned to a mission, create an alert
                 * that it cannot be broken while the mission is planned. */
                if (Data->P[plr].Pool[tst].Prime > 0) {
                    OutBox(245, 106, 314, 118);
                    /* Copy the screen area into a buffer before drawing
                     * the dialog so it can be repainted after the dialog
                     * is dismissed */
                    display::LegacySurface buffer(170, 131);
                    buffer.copyFrom(display::graphics.legacyScreen(), 75, 43, 244, 173);
                    /* Draw the alert message */
                    ShBox(75, 43, 244, 173);
                    IOBox(81, 152, 238, 167);
                    InBox(81, 70, 238, 113);
                    fill_rectangle(82, 71, 237, 112, 7 + 3 * plr);
                    display::graphics.setForegroundColor(1);
                    draw_heading(118, 50, "PROBLEM", 0, -1);
                    draw_string(136, 162, "CONTINUE");
                    display::graphics.setForegroundColor(11);
                    draw_string(88, 80, "FLIGHT CREW ");
                    draw_number(0, 0, grp + 1);
                    draw_string(0, 0, " IS ALREADY");
                    draw_string(88, 88, "ASSIGNED TO THE ");

                    if (Data->P[plr].Pool[tst].Prime == 4
                        || Data->P[plr].Pool[tst].Prime == 3) {
                        draw_string(0, 0, "PRIMARY");
                    } else {
                        draw_string(0, 0, "BACKUP");
                    }

                    draw_string(88, 96, "CREW OF A CURRENT MISSION:");
                    draw_string(88, 104, "CANNOT BREAK THIS CREW.");

                    WaitForMouseUp();
                    i = 1;

                    while (i == 1) {
                        key = 0;
                        GetMouse();

                        if (mousebuttons > 0 || key > 0) {
                            if ((x >= 83 && y >= 154 && x <= 236 && y <= 165
                                 && mousebuttons != 0) || key == K_ENTER) {
                                InBox(83, 154, 236, 165);
                                WaitForMouseUp();
                                OutBox(83, 154, 236, 165);
                                /* Closing the alert message.
                                 * Redraw the screen behind it from buffer */
                                buffer.copyTo(display::graphics.legacyScreen(),
                                              75, 43);
                                i = 2;
                            }
                        }
                    }
                } else if (Data->P[plr].Crew[prog][grp][0] != 0) {
                    InBox(245, 106, 314, 118);

                    while (CrewCount[grp] > 0) {
                        M[count] =
                            Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] - 1;
                        Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] = 0;
                        Data->P[plr].Pool[M[count]].Crew = 0;
                        Data->P[plr].Pool[M[count]].Moved = 0;
                        Data->P[plr].Pool[M[now2]].Unassigned = 0;
                        CrewCount[grp]--;
                        count++;
                    }

                    ClearIt();

                    fill_rectangle(26, 129, 153, 195, 0);

                    FltsTxt(grp, 8);

                    ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);

                    DispLeft(plr, BarA, count, now2, &M[0]);

                    for (i = 1; i < 5; i++) {
                        DrawPosition(prog, i);
                    }

                    WaitForMouseUp();
                    OutBox(245, 106, 314, 118);
                }
            } else if ((x >= 245 && y >= 5 && x <= 314 && y <= 17
                        && mousebuttons > 0) || key == K_ENTER) {
                /* Exit */
                InBox(245, 5, 314, 17);
                WaitForMouseUp();

                if (key > 0) {
                    delay(150);
                }

                OutBox(245, 5, 314, 17);
                delay(10);

                for (i = 0; i < 8; i++) {
                    if (CrewCount[i] < max)
                        while (CrewCount[i] > 0) {
                            M[count] =
                                Data->P[plr].Crew[prog][i][CrewCount[i] - 1] - 1;
                            Data->P[plr].Crew[prog][i][CrewCount[i] - 1] = 0;
                            Data->P[plr].Pool[M[count]].Crew = 0;
                            Data->P[plr].CrewCount[prog][i] = 0;
                            CrewCount[i]--;
                            count++;
                        }

                    Data->P[plr].CrewCount[prog][i] = CrewCount[i];
                }

                for (i = 0; i < count; i++) {
                    Data->P[plr].Pool[M[i]].Assign = 0;
                }

                music_stop();

                return;            /* Done */
            }
        }
    }
}
예제 #15
0
void ShowPrest(char plr)
{
    char pos = -1, pos2 = -1;
    int i, j;

    for (j = 0; j < 2; j++)
        for (i = 0; i < 28; i++) {
            TPoints[j] += (int) Data->Prestige[i].Points[j];
        }


    FadeOut(2, display::graphics.palette(), 5, 0, 0);
    PortPal(plr);
    display::graphics.screen()->clear(0);
    ShBox(0, 0, 319, 22);
    ShBox(0, 24, 319, 199);
    InBox(4, 27, 315, 196);
    fill_rectangle(5, 28, 314, 195, 0);

    //ShBox(6,29,125,101);
    ShBox(6, 29, 56, 101);
    InBox(17, 46, 44, 62);

    InBox(70, 42, 174, 92);

    ShBox(179, 29, 313, 101);
    ShBox(58, 29, 313, 101);

    InBox(70, 42, 174, 92);
    InBox(185, 42, 304, 92);

    //ShBox(136,74,163,90);
    IOBox(243, 3, 316, 19);
    ShBox(6, 104, 313, 194);
    InBox(10, 127, 309, 191);
    fill_rectangle(11, 128, 308, 190, 0);

    ShBox(297, 129, 307, 158);
    ShBox(297, 160, 307, 189); // Arrows

    draw_heading(8, 5, "PRESTIGE SUMMARY", 0, -1);
    draw_heading(14, 109, "EVENTS", 0, -1);
    display::graphics.setForegroundColor(11);
    draw_string(140, 120, "1ST:");
    draw_string(175, 120, "2ND:");
    draw_string(212, 120, "SUBS:");
    draw_string(254, 120, "FAIL:");
    display::graphics.setForegroundColor(1);
    draw_string(257, 13, "CONTINUE");
    draw_string(17, 39, "FIRST:");
    draw_string(19, 81, "DATE:");
    display::graphics.setForegroundColor(11);
    draw_string(71, 37, "# SPACE FIRSTS:");
    draw_string(187, 37, "TOTAL POINTS:");
    display::graphics.setForegroundColor(1);
    display::graphics.setForegroundColor(6);
    draw_string(210, 99, "USA");
    draw_string(90, 99, "USA");
    display::graphics.setForegroundColor(9);
    draw_string(261, 99, "USSR");
    draw_string(135, 99, "USSR");
    draw_up_arrow(299, 131);
    draw_down_arrow(299, 162);
    DPrest(plr, &pos, &pos2);
    FadeIn(2, display::graphics.palette(), 5, 0, 0);

    WaitForMouseUp();

    while (1) {
        GetMouse();

        // Parse Button actions, note that return is embedded in first pButton
        if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) {
            InBox(245, 5, 314, 17);

            if (key > 0) {
                delay(300);
                key = 0;
            };

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            key = 0;

            helpText = "i000";

            keyHelpText = "k000";

            return;
        }

        pButton(297, 129, 307, 158, BackOne(plr, &pos, &pos2), key >> 8, 72);
        pButton(297, 160, 307, 189, ForOne(plr, &pos, &pos2), key >> 8, 80);
        Button2(15, 129, 160, 133, Move2(plr, &pos, &pos2, 0), key, 49);
        Button2(15, 136, 160, 140, Move2(plr, &pos, &pos2, 1), key, 50);
        Button2(15, 143, 160, 147, Move2(plr, &pos, &pos2, 2), key, 51);
        Button2(15, 150, 160, 154, Move2(plr, &pos, &pos2, 3), key, 52);
        Button2(15, 157, 160, 161, Move2(plr, &pos, &pos2, 4), key, 53);
        Button2(15, 164, 160, 168, Move2(plr, &pos, &pos2, 5), key, 54);
        Button2(15, 171, 160, 175, Move2(plr, &pos, &pos2, 6), key, 55);
        Button2(15, 178, 160, 182, Move2(plr, &pos, &pos2, 7), key, 56);
        Button2(15, 185, 160, 189, Move2(plr, &pos, &pos2, 8), key, 57);
        key = 0;
    };
}
예제 #16
0
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, display::graphics.palette(), 10, 0, 0);
    }

    PortPal(plr);
    display::graphics.screen()->clear(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);
    draw_small_flag(plr, 4, 4);
    fill_rectangle(5, 28, 314, 195, 0);
    fill_rectangle(5, 122, 314, 195, 0);
    ShBox(6, 123, 313, 194);
    fill_rectangle(7, 124, 312, 193, 9);
    InBox(11, 128, 307, 189);
    fill_rectangle(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) {
        draw_heading(40, 5, "PRESIDENTIAL REVIEW", 0, -1);
    } else {
        draw_heading(40, 5, "POLITBURO REVIEW", 0, -1);
    }

    display::graphics.setForegroundColor(1);
    draw_string(257, 13, "CONTINUE");
    display::graphics.setForegroundColor(1);
    draw_string(59, 36, "JOB PERFORMANCE");
    display::graphics.setForegroundColor(6);
    draw_string(8, 46, "GOOD");
    display::graphics.setForegroundColor(1);
    draw_string(8, 77, "FAIR");
    display::graphics.setForegroundColor(9);
    draw_string(8, 109, "POOR");
    display::graphics.setForegroundColor(1);
    draw_number(154, 117, Data->Year - 1);
    draw_number(126, 117, Data->Year - 2);
    draw_number(97, 117, Data->Year - 3);
    draw_number(70, 117, Data->Year - 4);
    draw_number(42, 117, Data->Year - 5);
    fill_rectangle(32, 39, 172, 111, 0);
    GradRect(33, 39, 171, 74, 0);
    GradRect(33, 75, 171, 110, 0);
    display::graphics.setForegroundColor(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;
        }

        fill_rectangle(166 - i * 28, 75, 151 - i * 28, cte, 5 + ((Data->P[plr].PresRev[i] <= 8) ? 0 : 3));
        display::graphics.setForegroundColor(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, display::graphics.palette(), 10, 0, 0);

    return;
}
예제 #17
0
void DrawProgs(char plr, char prog)
{
    int i, j, Name[30];
    strcpy((char *)Name, Data->P[plr].Manned[prog - 1].Name);
    strcat((char *)Name, " PROGRAM");
    FadeOut(2, 10, 0, 0);
    display::graphics.screen()->clear();
    display::graphics.setForegroundColor(1);
    ShBox(0, 0, 319, 22);
    ShBox(0, 24, 319, 81);
    ShBox(0, 83, 319, 123);
    ShBox(0, 125, 158, 199);
    ShBox(161, 125, 319, 199);
    fill_rectangle(25, 129, 153, 195, 0);
    fill_rectangle(5, 129, 19, 195, 0);
    ShBox(6, 130, 18, 161);
    ShBox(6, 163, 18, 194);
    IOBox(243, 86, 316, 102);
    IOBox(243, 104, 316, 120);
    IOBox(243, 3, 316, 19);
    InBox(4, 128, 20, 196);
    InBox(24, 128, 154, 196);
    InBox(60, 27, 141, 78);
    InBox(3, 3, 30, 19);
    draw_up_arrow(9, 133);
    draw_down_arrow(9, 166);

    {
        char filename[128];
        snprintf(filename, sizeof(filename), "images/aprog.%d.%d.png", plr, prog);
        boost::shared_ptr<display::PalettizedSurface> image(Filesystem::readImage(filename));

        image->exportPalette();
        display::graphics.screen()->draw(image, 61, 28);

    }

    for (j = 0; j < 2; j++) {
        for (i = 0; i < 4; i++) {
            ShBox(164 + 77 * j, 139 + i * 15, 238 + 77 * j, 151 + i * 15);
        }
    }

    ShBox(4, 86, 12, 92);

    if (prog >= 2) {
        ShBox(4, 95, 12, 101);
    }

    if (prog >= 3) {
        ShBox(4, 104, 12, 110);
    }

    if (prog == 5) {
        ShBox(4, 113, 12, 119);
    }

    draw_small_flag(plr, 4, 4);
    display::graphics.setForegroundColor(9);
    draw_string(250, 96, "A");
    display::graphics.setForegroundColor(1);
    draw_string(0, 0, "SSIGN CREW");
    display::graphics.setForegroundColor(9);
    draw_string(252, 114, "B");
    display::graphics.setForegroundColor(1);
    draw_string(0, 0, "REAK CREW");
    draw_string(258, 13, "CONTINUE");
    display::graphics.setForegroundColor(5);
    draw_string(183, 133, "FLIGHT ");
    display::graphics.setForegroundColor(9);
    draw_string(0, 0, "C");
    display::graphics.setForegroundColor(5);
    draw_string(0, 0, "REW SELECTION");
    display::graphics.setForegroundColor(7);
    draw_string(152, 35, &Data->P[plr].Manned[prog - 1].Name[0]);
    display::graphics.setForegroundColor(9);

    if (prog == 1) {
        draw_string(152, 43, "ONE");
    }

    if (prog == 2) {
        draw_string(152, 43, "TWO");
    }

    if (prog == 3 || prog == 4) {
        draw_string(152, 43, "THREE");
    }

    if (prog == 5) {
        draw_string(152, 43, "FOUR");
    }

    draw_string(0, 0, "-PERSON CAPACITY");
    display::graphics.setForegroundColor(7);
    draw_string(152, 51, "SAFETY FACTOR: ");
    display::graphics.setForegroundColor(11);
    draw_number(0, 0, Data->P[plr].Manned[prog - 1].Safety);
    draw_string(0, 0, " %");
    display::graphics.setForegroundColor(7);
    draw_string(152, 59, "UNIT WEIGHT: ");
    display::graphics.setForegroundColor(11);
    draw_number(0, 0, Data->P[plr].Manned[prog - 1].UnitWeight);
    display::graphics.setForegroundColor(7);
    draw_string(152, 67, "MAX DURATION: ");
    display::graphics.setForegroundColor(11);
    draw_number(0, 0, Data->P[plr].Manned[prog - 1].Duration);
    draw_string(0, 0, " DAYS (LVL ");

    if (prog == 1) {
        draw_string(0, 0, "B)");
    }

    if (prog == 2) {
        draw_string(0, 0, "E)");
    }

    if (prog == 3 || prog == 5) {
        draw_string(0, 0, "F)");
    }

    if (prog == 4) {
        draw_string(0, 0, "D)");
    }

    display::graphics.setForegroundColor(7);
    draw_string(152, 75, "AVOID FAILURE: ");
    display::graphics.setForegroundColor(11);

    if (Data->P[plr].Manned[prog - 1].SaveCard > 0) {
        draw_string(0, 0, "YES");
    } else {
        draw_string(0, 0, "NO");
    }

    display::graphics.setForegroundColor(1);
    draw_heading(40, 5, (char *)Name, 0, -1);
    return;
}