Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
void AstLevel(char plr, char prog, char crew, char ast)
{
    int i, k, man, over = 0, temp, val;
    char Compat[5], cnt;
    i = man = Guy(plr, prog, crew, ast);

    cnt = 0;

    for (k = 0; k < 5; k++) {
        Compat[k] = 0;
    }

    switch (Data->P[plr].Pool[i].Compat) {
    case 1:
        if (Data->P[plr].Pool[i].CL == 2) {
            Compat[cnt++] = 9;
        }

        Compat[cnt++] = 10;
        Compat[cnt++] = 1;
        Compat[cnt++] = 2;

        if (Data->P[plr].Pool[i].CR == 2) {
            Compat[cnt++] = 3;
        }

        break;

    case 2:
        if (Data->P[plr].Pool[i].CL == 2) {
            Compat[cnt++] = 10;
        }

        Compat[cnt++] = 1;
        Compat[cnt++] = 2;
        Compat[cnt++] = 3;

        if (Data->P[plr].Pool[i].CR == 2) {
            Compat[cnt++] = 4;
        }

        break;

    case 3:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
        if (Data->P[plr].Pool[i].CL == 2) {
            Compat[cnt++] = Data->P[plr].Pool[i].Compat - 2;
        }

        Compat[cnt++] = Data->P[plr].Pool[i].Compat - 1;
        Compat[cnt++] = Data->P[plr].Pool[i].Compat;
        Compat[cnt++] = Data->P[plr].Pool[i].Compat + 1;

        if (Data->P[plr].Pool[i].CR == 2) {
            Compat[cnt++] = Data->P[plr].Pool[i].Compat + 2;
        }

        break;

    case 9:
        if (Data->P[plr].Pool[i].CL == 2) {
            Compat[cnt++] = 7;
        }

        Compat[cnt++] = 8;
        Compat[cnt++] = 9;
        Compat[cnt++] = 10;

        if (Data->P[plr].Pool[i].CR == 2) {
            Compat[cnt++] = 1;
        }

        break;

    case 10:
        if (Data->P[plr].Pool[i].CL == 2) {
            Compat[cnt++] = 8;
        }

        Compat[cnt++] = 9;
        Compat[cnt++] = 10;
        Compat[cnt++] = 1;

        if (Data->P[plr].Pool[i].CR == 2) {
            Compat[cnt++] = 2;
        }

        break;
    }

    display::LegacySurface local(143, 74);
    local.copyFrom(display::graphics.legacyScreen(), 94, 38, 236, 111);
    ShBox(94, 38, 236, 95);
    InBox(98, 41, 232, 61);
    fill_rectangle(99, 42, 231, 60, 7 + plr * 3);
    display::graphics.setForegroundColor(12);
    draw_string(115, 48, "COMPATIBILITY");
    over = 0;
    val = 0;

    for (i = 0; i < Data->P[plr].CrewCount[prog][crew]; i++) {
        if (man != Guy(plr, prog, crew, i)) {
            temp = 0;

            for (k = 0; k < cnt; k++) {
                if (Compat[k] == Data->P[plr].Pool[Guy(plr, prog, crew, i)].Compat) {
                    temp++;
                }
            }

            if ((plr == 1 && Data->Def.Ast2 == 0) || (plr == 0 && Data->Def.Ast1 == 0)) {
                InBox(111, 66 + 9 * val, 119, 72 + 9 * val);

                if (temp == 0) {
                    fill_rectangle(112, 67 + 9 * val, 118, 71 + 9 * val, 9);
                    over++;
                } else {
                    fill_rectangle(112, 67 + 9 * val, 118, 71 + 9 * val, 16);
                }

                display::graphics.setForegroundColor(1);
                draw_string(122, 71 + 9 * val, Data->P[plr].Pool[Guy(plr, prog, crew, i)].Name);
            } else if (temp == 0) {
                over++;
            }

            val++;
        }
    }

    switch (prog) {
    case 1:
        i = 16;
        break;

    case 2:
        i = (over == 1) ? 9 : 16;
        break;

    case 3:
        i = (over == 1) ? 11 : ((over == 2) ? 9 : 16) ;
        break;

    case 4:
        i = (over == 1) ? 11 : ((over == 2) ? 9 : 16) ;
        break;

    case 5:
        i = (over == 1) ? 11 : ((over >= 2) ? 9 : 16) ;
        break;

    default:
        i = 16;
        break;
    }

    // Level 2 Only
    if ((plr == 1 && Data->Def.Ast2 == 1) || (plr == 0 && Data->Def.Ast1 == 1)) {
        InBox(111, 66, 119, 72);
        fill_rectangle(112, 67, 118, 71, i);
        display::graphics.setForegroundColor(1);
        draw_string(122, 71, "CREW RELATIONSHIP");
    }

    if ((plr == 1 && Data->Def.Ast2 == 2) || (plr == 0 && Data->Def.Ast1 == 2)) {
        display::graphics.setForegroundColor(1);
        draw_string(111, 71, "NO INFO AT THIS LEVEL");
    }



    //fill_rectangle(113,53,119,57,i);  // shouldn't be mood
    display::graphics.setForegroundColor(11);
    draw_string(115, 57, Data->P[plr].Pool[man].Name);
    // don't do this for level three
    draw_string(0, 0, "  M: ");
    draw_number(0, 0, Data->P[plr].Pool[man].Mood);

    key = 0;

    if (mousebuttons) {
        WaitForMouseUp();
    } else while (key == 0) {
            GetMouse();
        }

    local.copyTo(display::graphics.legacyScreen(), 94, 38);
}
Ejemplo n.º 3
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 */
            }
        }
    }
}
Ejemplo n.º 4
0
void ShowPad(char plr, char pad)
{
    char temp;
    music_start((plr == 1) ? M_USMIL : M_USSRMIL);
    PadDraw(plr, pad);
    temp = CheckCrewOK(plr, pad);

    if (temp == 1) { //found mission no crews

        ClrMiss(plr, pad + 3);
        return;
    }

    helpText = "i028";
    keyHelpText = "k028";
    WaitForMouseUp();

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

        if ((Data->P[plr].LaunchFacility[pad] == 1 && x >= 169 && y >= 181 && x <= 314 && y <= 193 && mousebuttons > 0 && Data->P[plr].Mission[pad].MissionCode)
            || (Data->P[plr].LaunchFacility[pad] == 1 && Data->P[plr].Mission[pad].MissionCode && key == 'S')) {
            // Scrub Mission
            InBox(169, 181, 314, 193);
            key = 0;
            WaitForMouseUp();
            ClrMiss(plr, pad);
            OutBox(169, 181, 314, 193);
            key = 0;

            if (Data->P[plr].Mission[pad].MissionCode == Mission_None) {
                return;
            }
        } else if ((Data->P[plr].LaunchFacility[pad] <= Data->P[plr].Cash && Data->P[plr].LaunchFacility[pad] > 1 && x >= 169 && y >= 181 && x <= 314 && y <= 193 && mousebuttons > 0)
                   || (key == 'F' && Data->P[plr].LaunchFacility[pad] > 1 && Data->P[plr].LaunchFacility[pad] <= Data->P[plr].Cash)) {
            // Scrub Mission
            InBox(169, 181, 314, 193);
            key = 0;
            WaitForMouseUp();

            if (Data->P[plr].Cash >= Data->P[plr].LaunchFacility[pad]) {
                temp = Help("i115");

                if (temp == 1) {
                    Data->P[plr].Cash -= Data->P[plr].LaunchFacility[pad];
                    Data->P[plr].LaunchFacility[pad] = 1;
                }
            } else {
                Help("i116");
            }

            OutBox(169, 181, 314, 193);
            key = 0;

            if (temp == 1) {
                return;
            }
        } else if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) {
            InBox(245, 5, 314, 17);
            key = 0;
            WaitForMouseUp();
            OutBox(245, 5, 314, 17);

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

            key = 0;
            return;  /* Done */
        }
    }
}
Ejemplo n.º 5
0
void Stat(char Win)
{
    int j, i, starty;
    DrawStatistics(Win);
    WaitForMouseUp();
    i = 0;
    key = 0;
    starty = 118;

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

        if ((x >= 193 && y >= 42 && x <= 278 && y <= 60 && mousebuttons > 0) || key == K_ENTER) {
            InBox(193, 42, 278, 60);
            WaitForMouseUp();

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

            i = 1;
            key = 0;
            OutBox(193, 42, 278, 60);
        } else if ((x >= 152 && y >= 41 && x <= 183 && y <= 61 && mousebuttons > 0) || key == 'D') {
            InBox(152, 41, 183, 61);
            WaitForMouseUp();

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

            RankMe(Win);
            DrawStatistics(Win);
            key = 0;
            i = 0;
            OutBox(152, 41, 183, 61);
        };

        for (j = 0; j < 5; j++) {
            if (AI[Win] == 0) {
                if ((x >= starty + (j * 33) && y >= 87 && x <= 31 + starty + (j * 33) && y <= 107 && mousebuttons > 0) || ((key >= '1' && key <= '4') || key == '0')) {
                    if (key > 0) {
                        switch (key) {
                        case '0':
                            j = 0;
                            break;

                        case '1':
                            j = 1;
                            break;

                        case '2':
                            j = 2;
                            break;

                        case '3':
                            j = 3;
                            break;

                        case '4':
                            j = 4;
                            break;

                        default:
                            break;
                        }
                    }

                    InBox(starty + (j * 33), 87, 31 + starty + (j * 33), 107);
                    WaitForMouseUp();
                    key = 0;
                    strncpy(keyhelpIndex, "k999", 4);

                    switch (j) {
                    case 0:
                        strncpy(helptextIndex, "i130", 4);
                        strncpy(keyhelpIndex, "k031", 4);

                        if (Option == -1 || (Option == Win)) {
                            ShowSpHist(Win);
                        }

                        //ShowSpHist(Win);
                        break;

                    case 1:
                        strncpy(helptextIndex, "i131", 4);
                        strncpy(keyhelpIndex, "k321", 4);
                        Records(Win);
                        break;

                    case 2:
                        strncpy(helptextIndex, "i132", 4);
                        strncpy(keyhelpIndex, "k033", 4);
                        ShowPrest(Win);
                        break;

                    case 3:
                        strncpy(helptextIndex, "i034", 4);
                        ShowHard(Win);
                        break;

                    case 4:
                        strncpy(helptextIndex, (Win == 0) ? "i133" : "i134", 4);
                        strncpy(keyhelpIndex, (Win == 0) ? "k035" : "k441", 4);

                        if (Data->P[Win].AstroCount > 0)
                            if (Option == -1 || Option == Win) {
                                ShowAstrosHist(Win);
                            }

                    default:
                        break;
                    }

                    strncpy(helptextIndex, "i000", 4);
                    strncpy(keyhelpIndex, "k000", 4);
                    DrawStatistics(Win);
                    key = 0;
                    i = 0;
                    OutBox(starty + (j * 33), 87, 31 + starty + (j * 33), 107);
                }
            } // matches AI[Win]==0
        }

        for (j = 0; j < 5; j++) {
            if (AI[other(Win)] == 0) {
                if ((x >= starty + (j * 33) && y >= 132 && x <= 31 + starty + (j * 33) && y <= 152 && mousebuttons > 0) || (key >= '5' && key <= '9')) {
                    if (key > 0) {
                        switch (key) {
                        case '5':
                            j = 0;
                            break;

                        case '6':
                            j = 1;
                            break;

                        case '7':
                            j = 2;
                            break;

                        case '8':
                            j = 3;
                            break;

                        case '9':
                            j = 4;
                            break;

                        default:
                            break;
                        }
                    }

                    InBox(starty + (j * 33), 132, 31 + starty + (j * 33), 152);
                    WaitForMouseUp();
                    key = 0;

                    switch (j) {
                    case 0:
                        strncpy(helptextIndex, "i130", 4);
                        strncpy(keyhelpIndex, "k031", 4);

                        if (Option == -1 || Option == other(Win)) {
                            ShowSpHist(other(Win));
                        }

                        //ShowSpHist(other(Win));
                        break;

                    case 1:
                        strncpy(helptextIndex, "i131", 4);
                        strncpy(keyhelpIndex, "k321", 4);
                        Records(other(Win));
                        break;

                    case 2:
                        strncpy(helptextIndex, "i132", 4);
                        strncpy(keyhelpIndex, "k033", 4);
                        ShowPrest(other(Win));
                        break;

                    case 3:
                        strncpy(helptextIndex, "i034", 4);
                        strncpy(keyhelpIndex, "k999", 4);
                        ShowHard(other(Win));
                        break;

                    case 4:
                        strncpy(helptextIndex, (Win == 0) ? "i133" : "i134", 4);
                        strncpy(keyhelpIndex, (Win == 0) ? "k035" : "k441", 4);

                        if (Data->P[other(Win)].AstroCount > 0)
                            if (Option == -1 || Option == other(Win)) {
                                ShowAstrosHist(other(Win));
                            }

                        break;

                    default:
                        break;
                    }

                    strncpy(helptextIndex, "i000", 4);
                    strncpy(keyhelpIndex, "k000", 4);
                    DrawStatistics(Win);
                    key = 0;
                    i = 0;
                    OutBox(starty + (j * 33), 132, 31 + starty + (j * 33), 152);
                }
            }
        }
    }

    return;
}
Ejemplo n.º 6
0
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++) {
        display::graphics.palette()[i] = 0;
    }

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

    PortPal(plr);
    ShBox(41, 20, 281, 184);
    InBox(46, 25, 276, 179);
    InBox(46, 25, 117, 65);
    draw_flag(47, 26, plr);
    InBox(122, 25, 276, 65);
    display::graphics.setForegroundColor(9);
    draw_string(127, 33, "SCHEDULED LAUNCH"); //was 154,33
    display::graphics.setForegroundColor(34);
    draw_string(127, 40, "LAUNCH FACILITY: ");
    display::graphics.setForegroundColor(1);
    draw_string(0, 0, "PAD ");
    draw_string(0, 0, pad_str);
    display::graphics.setForegroundColor(34);
    draw_string(127, 47, "DATE: ");
    display::graphics.setForegroundColor(1);

    draw_string(0, 0, Month[Data->P[plr].Mission[pad].Month]);

    draw_string(0, 0, "19");
    draw_number(0, 0, Data->Year);
    display::graphics.setForegroundColor(1);

    GetMisType(Data->P[plr].Mission[pad].MissionCode);
    memcpy(&Mis2, &Mis, sizeof Mis);


    if ((Mis.mVab[0] & 0x10) == 0x10 && Data->P[plr].DockingModuleInOrbit <= 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;
    }

    draw_string(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:
            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;
        }
    }

    IOBox(57, 68, 118, 84);
    IOBox(131, 68, 197, 84);
    IOBox(205, 68, 266, 84);
    display::graphics.setForegroundColor(1);
    draw_string(65, 78, "CONTINUE");
    draw_string(139, 78, "PLAY FULL");
    draw_string(221, 78, "SCRUB");
    display::graphics.setForegroundColor(9);
    draw_string(65, 78, "C");
    draw_string(139, 78, "P");
    draw_string(221, 78, "S");

    //IOBox(85,68,158,84);IOBox(172,68,245,84);
    //display::graphics.setForegroundColor(1);draw_string(102,78,"CONTINUE");draw_string(189,78,"SCRUB");
    //display::graphics.setForegroundColor(9);
    //draw_string(102,78,"C");draw_string(189,78,"S");

    if (Data->P[plr].Mission[pad].Joint == 0) {
        draw_string(128, 91, "SINGLE LAUNCH");
    } else {
        draw_string(131, 91, "JOINT LAUNCH");
        draw_string(49, 101, "PART ONE");
        draw_string(102, 101, "PAD ");

        //draw_number(0,0,pad);
        switch (pad) {
        case 0:
            draw_string(0, 0, "A");
            break;

        case 1:
            draw_string(0, 0, "B");
            break;

        case 2:
            draw_string(0, 0, "C");
            break;
        }

        draw_string(160, 101, "PART TWO");

        draw_string(213, 101, "PAD ");

        //draw_number(0,0,pad+1);
        switch (pad + 1) {
        case 0:
            draw_string(0, 0, "A");
            break;

        case 1:
            draw_string(0, 0, "B");
            break;

        case 2:
            draw_string(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) {
                    display::graphics.setForegroundColor(7);
                    draw_string(bud, 109 + 14 * k, "CAPSULE: ");
                    display::graphics.setForegroundColor(1);
                    draw_string(0, 0, &Data->P[plr].Manned[hold].Name[0]);
                    display::graphics.setForegroundColor(11);
                    draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                    Data->P[plr].Manned[hold].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(1); //Damaged Equipment, Nikakd, 10/8/10
                    sprintf(&Digit[0], "%d", Data->P[plr].Manned[hold].Safety + Data->P[plr].Manned[hold].Damage);
                    draw_string(0, 0, &Digit[0]);
                    draw_string(0, 0, "%");
                    // draw_string(144+i*111,116+14*k,"%");
                    ++k;
                };

                break;

            case 1:
                if (hold > -1) {
                    display::graphics.setForegroundColor(7);
                    draw_string(bud, 109 + 14 * k, "KICKER: ");
                    display::graphics.setForegroundColor(1);
                    draw_string(0, 0, &Data->P[plr].Misc[hold].Name[0]);
                    display::graphics.setForegroundColor(11);
                    draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                    Data->P[plr].Misc[hold].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(1); //Damaged Equipment, Nikakd, 10/8/10
                    sprintf(&Digit[0], "%d", Data->P[plr].Misc[hold].Safety + Data->P[plr].Misc[hold].Damage);
                    draw_string(0, 0, &Digit[0]);
                    draw_string(0, 0, "%");
                    // draw_number(0,0,Data->P[plr].Misc[hold].Safety);
                    //    draw_string(144+i*111,116+14*k,"%");
                    ++k;
                };

                break;

            case 2:
                if (hold > -1) {
                    display::graphics.setForegroundColor(7);
                    draw_string(bud, 109 + 14 * k, "LM: ");
                    display::graphics.setForegroundColor(1);
                    draw_string(0, 0, &Data->P[plr].Manned[hold].Name[0]);
                    display::graphics.setForegroundColor(11);
                    draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                    Data->P[plr].Manned[hold].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(1); //Damaged Equipment, Nikakd, 10/8/10
                    sprintf(&Digit[0], "%d", Data->P[plr].Manned[hold].Safety + Data->P[plr].Manned[hold].Damage);
                    draw_string(0, 0, &Digit[0]);
                    draw_string(0, 0, "%");
                    //draw_number(0,0,Data->P[plr].Manned[hold].Safety);
                    //draw_string(144+i*111,116+14*k,"%");
                    ++k;
                };

                break;

            case 3:
                if (hold > -1) {
                    if (hold < 3) {
                        display::graphics.setForegroundColor(7);
                        draw_string(bud, 109 + 14 * k, "PROBE: ");
                        display::graphics.setForegroundColor(1);
                        draw_string(0, 0, &Data->P[plr].Probe[hold].Name[0]);
                        display::graphics.setForegroundColor(11);
                        draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        Data->P[plr].Probe[hold].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(1); //Damaged Equipment, Nikakd, 10/8/10
                        sprintf(&Digit[0], "%d", Data->P[plr].Probe[hold].Safety + Data->P[plr].Probe[hold].Damage);
                        draw_string(0, 0, &Digit[0]);
                        draw_string(0, 0, "%");
                        //draw_number(0,0,Data->P[plr].Probe[hold].Safety);
                        //draw_string(144+i*111,116+14*k,"%");
                        ++k;
                    } else if (hold == 4) {
                        display::graphics.setForegroundColor(7);
                        draw_string(bud, 109 + 14 * k, "DOCKING: ");
                        display::graphics.setForegroundColor(1);
                        draw_string(0, 0, &Data->P[plr].Misc[hold].Name[0]);
                        display::graphics.setForegroundColor(11);
                        draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        Data->P[plr].Misc[hold].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(1); //Damaged Equipment, Nikakd, 10/8/10
                        sprintf(&Digit[0], "%d", Data->P[plr].Misc[hold].Safety + Data->P[plr].Misc[hold].Damage);
                        draw_string(0, 0, &Digit[0]);
                        draw_string(0, 0, "%");
                        //draw_number(0,0,Data->P[plr].Misc[hold].Safety);
                        //draw_string(144+i*111,116+14*k,"%");
                        ++k;
                    }
                };

                break;

            case 4:
                if (hold > -1) {
                    if (hold < 5) {
                        display::graphics.setForegroundColor(7);
                        draw_string(bud, 109 + 14 * k, "ROCKET: ");
                        display::graphics.setForegroundColor(1);
                        draw_string(0, 0, &Data->P[plr].Rocket[hold - 1].Name[0]);
                        display::graphics.setForegroundColor(11);
                        draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        Data->P[plr].Rocket[hold - 1].Damage != 0 ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(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);
                        draw_string(0, 0, &Digit[0]);
                        draw_string(0, 0, "%");
                        //draw_number(0,0,Data->P[plr].Rocket[hold-1].Safety);
                        //draw_string(144+i*111,116+14*k,"%");
                        ++k;
                    } else {
                        display::graphics.setForegroundColor(7);
                        draw_string(bud, 109 + 14 * k, "ROCKET: ");
                        display::graphics.setForegroundColor(1);
                        draw_string(0, 0, &Data->P[plr].Rocket[hold - 5].Name[0]);
                        draw_string(0, 0, " W/B");
                        display::graphics.setForegroundColor(11);
                        draw_string(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        (Data->P[plr].Rocket[hold - 5].Damage != 0 || Data->P[plr].Rocket[ROCKET_HW_BOOSTERS].Damage != 0) ? display::graphics.setForegroundColor(9) : display::graphics.setForegroundColor(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[ROCKET_HW_BOOSTERS].Safety + Data->P[plr].Rocket[ROCKET_HW_BOOSTERS].Damage));
                        draw_string(0, 0, &Digit[0]);
                        draw_string(0, 0, "%");
                        // draw_number(0,0,(Data->P[plr].Rocket[hold-5].Safety+Data->P[plr].Rocket[ROCKET_HW_BOOSTERS].Safety)/2);
                        // draw_string(144+i*111,116+14*k,"%");
                        ++k;
                    }
                }

                break;

            default:
                break;
            }
        }
    }

    FadeIn(2, display::graphics.palette(), 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, display::graphics.palette(), 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, display::graphics.palette(), 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 == Mission_None) {
                FadeOut(2, display::graphics.palette(), 10, 0, 0);
                return;
            }
        }
    };
}
Ejemplo n.º 7
0
void CShareBox::Draw(void)
{
	const float alpha = std::max(guiAlpha,0.4f);

	float mx=MouseX(mouse->lastx);
	float my=MouseY(mouse->lasty);

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	// Large Box
	glColor4f(0.2f,0.2f,0.2f,alpha);
	DrawBox(box);

	// ok Box on mouse over
	if(InBox(mx,my,box+okBox)){
		glColor4f(0.7f,0.2f,0.2f,alpha);
		DrawBox(box+okBox);
	}

	// apply Box on mouse over
	if(InBox(mx,my,box+applyBox)){
		glColor4f(0.7f,0.2f,0.2f,alpha);
		DrawBox(box+applyBox);
	}

	// cancel Box on mouse over
	if(InBox(mx,my,box+cancelBox)){
		glColor4f(0.7f,0.2f,0.2f,alpha);
		DrawBox(box+cancelBox);
	}

	glColor4f(0.2f,0.2f,0.2f,alpha);
	DrawBox(box+teamBox);

	if(InBox(mx,my,box+unitBox))
		glColor4f(0.7f,0.2f,0.2f,alpha);
	else
		glColor4f(0.2f,0.2f,0.2f,alpha);
	DrawBox(box+unitBox);

	glColor4f(0.8f,0.8f,0.9f,0.7f);
	DrawBox(box+metalBox);

	glColor4f(0.9f,0.9f,0.2f,0.7f);
	DrawBox(box+energyBox);

	//draw share indicators in metal/energy bars
	glColor4f(0.9f,0.2f,0.2f,0.7f);
	ContainerBox metalShareBox;
	metalShareBox.x1=metalBox.x1+metalShare*(metalBox.x2-metalBox.x1)-0.005f;
	metalShareBox.x2=metalShareBox.x1+0.01f;
	metalShareBox.y1=metalBox.y1-0.005f;
	metalShareBox.y2=metalBox.y2+0.005f;
	DrawBox(box+metalShareBox);
	ContainerBox energyShareBox;
	energyShareBox.x1=energyBox.x1+energyShare*(energyBox.x2-energyBox.x1)-0.005f;
	energyShareBox.x2=energyShareBox.x1+0.01f;
	energyShareBox.y1=energyBox.y1-0.005f;
	energyShareBox.y2=energyBox.y2+0.005f;
	DrawBox(box+energyShareBox);

	//show that share units is selected
	if(shareUnits){
//		DrawBox(box+unitBox);
		glLineWidth(3);
		glBegin(GL_LINE_STRIP);
			glVertex2f(box.x1+unitBox.x1+0.01f,box.y1+unitBox.y1+0.025f);
			glVertex2f(box.x1+unitBox.x1+0.02f,box.y1+unitBox.y1+0.01f);
			glVertex2f(box.x1+unitBox.x1+0.03f,box.y1+unitBox.y1+0.04f);
		glEnd();
		glLineWidth(1);
	}

	font->Begin();

	font->glPrint(box.x1+(okBox.x1+okBox.x2)*0.5f,box.y1+(okBox.y1+okBox.y2)*0.5f,1,FONT_CENTER | FONT_VCENTER | FONT_SCALE | FONT_NORM,"Ok");
	font->glPrint(box.x1+(applyBox.x1+applyBox.x2)*0.5f,box.y1+(applyBox.y1+applyBox.y2)*0.5f,1,FONT_CENTER | FONT_VCENTER | FONT_SCALE | FONT_NORM,"Apply");
	font->glPrint(box.x1+(cancelBox.x1+cancelBox.x2)*0.5f,box.y1+(cancelBox.y1+cancelBox.y2)*0.5f,1,FONT_CENTER | FONT_VCENTER | FONT_SCALE | FONT_NORM,"Cancel");

	font->glPrint(box.x1+0.06f,box.y1+0.085f,0.7f,FONT_SCALE | FONT_NORM,"Share selected units");

	font->SetTextColor(1,1,0.4f,0.8f);
	font->glPrint(box.x1+0.01f,box.y1+0.16f,0.7f,FONT_SCALE | FONT_NORM,"Share Energy");

	font->SetTextColor(1,1,1,0.8f);
	font->glFormat(box.x1+0.25f,box.y1+0.12f,0.7f,FONT_SCALE | FONT_NORM,"%.0f",float(teamHandler->Team(gu->myTeam)->energy));
	font->glFormat(box.x1+0.14f,box.y1+0.12f,0.7f,FONT_SCALE | FONT_NORM,"%.0f",teamHandler->Team(gu->myTeam)->energy*energyShare);

	font->SetTextColor(0.8f,0.8f,0.9f,0.8f);
	font->glPrint(box.x1+0.01f,box.y1+0.22f,0.7f,FONT_SCALE | FONT_NORM,"Share Metal");

	font->SetTextColor(1,1,1,0.8f);
	font->glFormat(box.x1+0.25f,box.y1+0.18f,0.7f,FONT_SCALE | FONT_NORM,"%.0f",float(teamHandler->Team(gu->myTeam)->metal));
	font->glFormat(box.x1+0.14f,box.y1+0.18f,0.7f,FONT_SCALE | FONT_NORM,"%.0f",teamHandler->Team(gu->myTeam)->metal*metalShare);

	for(int team=0;team<teamHandler->ActiveTeams()-1;++team){
		int actualTeam=team;
		if (team >= gu->myTeam) {
			actualTeam++;
		}

		const float alpha = (shareTeam == actualTeam) ? 0.8f : 0.4f;
		std::string teamName;

		if (teamHandler->Team(actualTeam)->leader >= 0) {
			teamName = playerHandler->Player(teamHandler->Team(actualTeam)->leader)->name;
		} else {
			teamName = "Uncontrolled";
		}

		std::string ally, dead;
		if (teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(actualTeam))) {
			font->SetTextColor(0.5f, 1.0f, 0.5f, alpha);
			ally = " <Ally>";
		} else {
			font->SetTextColor(1.0f, 0.5f, 0.5f, alpha);
			ally = " <Enemy>";
		}
		if (teamHandler->Team(actualTeam)->isDead) {
			font->SetTextColor(0.5f, 0.5f, 1.0f, alpha);
			dead = " <Dead>";
		}
		if (actualTeam == teamHandler->GaiaTeamID()) {
			font->SetTextColor(0.8f, 0.8f, 0.8f, alpha);
			teamName = "Gaia";
			ally   = " <Gaia>";
		}
		font->glFormat(box.x1 + teamBox.x1 + 0.002f,
		                box.y1 + teamBox.y2 - 0.025f - team * 0.025f,
		                0.7f, FONT_SCALE | FONT_NORM, "Team%i (%s)%s%s", actualTeam,
		                teamName.c_str(), ally.c_str(), dead.c_str());
	}

	font->End();

	glEnable(GL_TEXTURE_2D);
}
Ejemplo n.º 8
0
void CQuitBox::Draw()
{
	const float mx = MouseX(mouse->lastx);
	const float my = MouseY(mouse->lasty);

	const ContainerBox boxes[] = {resignBox, saveBox, giveAwayBox, cancelBox, menuBox, quitBox};

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	// draw the background box
	glColor4f(0.2f, 0.2f, 0.2f, guiAlpha);
	DrawBox(box);

	// draw the sub-box we are in
	for (unsigned int n = 0; n < (sizeof(boxes) / sizeof(boxes[0])); n++) {
		if (InBox(mx, my, box + boxes[n])) {
			glColor4f(0.7f, 0.2f, 0.2f, guiAlpha);
			DrawBox(box + boxes[n]);
			break;
		}
	}

	glColor4f(0.2f, 0.2f, 0.2f, guiAlpha);
	DrawBox(box + teamBox);

	if (hasScroll) {
		glColor4f(0.1f, 0.1f, 0.1f, guiAlpha);
		DrawBox(box + scrollbarBox);

		float sz = scrollbarBox.y2 - scrollbarBox.y1;
		float tsz = sz / (float)(MAX_QUIT_TEAMS);
		float psz = tsz * (float)numTeamsDisp;

		scrollBox.y2 = scrollbarBox.y2 - startTeam * tsz;
		scrollBox.y1 = scrollBox.y2 - psz;

		glColor4f(0.8f, 0.8f, 0.8f, guiAlpha);
		DrawBox(box + scrollBox);
	}

	glEnable(GL_TEXTURE_2D);
	glColor4f(1.0f, 1.0f, 0.4f, 0.8f);
	font->glPrint(box.x1 + 0.045f, box.y1 + 0.58f, 0.7f, FONT_VCENTER | FONT_SCALE | FONT_NORM,"Do you want to ...");
	glColor4f(1.0f, 1.0f, 1.0f, 0.8f);

	font->glPrint(box.x1 +   resignBox.x1 + 0.025f, box.y1 + (  resignBox.y1 +   resignBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Resign");
	font->glPrint(box.x1 +     saveBox.x1 + 0.025f, box.y1 + (    saveBox.y1 +     saveBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Save");
	font->glPrint(box.x1 + giveAwayBox.x1 + 0.025f, box.y1 + (giveAwayBox.y1 + giveAwayBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Give everything to ...");
	font->glPrint(box.x1 +   cancelBox.x1 + 0.025f, box.y1 + (  cancelBox.y1 +   cancelBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Cancel");
	font->glPrint(box.x1 +     menuBox.x1 + 0.025f, box.y1 + (    menuBox.y1 +     menuBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Quit To Menu");
	font->glPrint(box.x1 +     quitBox.x1 + 0.025f, box.y1 + (    quitBox.y1 +     quitBox.y2) / 2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Quit To System");

	int teamPos = 0;
	for (int team = startTeam; team < MAX_QUIT_TEAMS && teamPos < numTeamsDisp; ++team, ++teamPos) {
		int actualTeam = team;

		if (team >= gu->myTeam)
			actualTeam++;

		if (teamHandler->Team(actualTeam)->gaia)
			continue;

		if (shareTeam == actualTeam) {
			glColor4f(1.0f, 1.0f, 1.0f, 0.8f);
		} else {
			glColor4f(1.0f, 1.0f, 1.0f, 0.4f);
		}

		std::string teamName = teamHandler->Team(actualTeam)->GetControllerName();
		std::string ally, dead;

		if (teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(actualTeam))) {
			ally = " <Ally>)";
		} else {
			ally = " <Enemy>";
		}
		if (teamHandler->Team(actualTeam)->isDead) {
			dead = " <Dead>";
		}
		if (actualTeam == teamHandler->GaiaTeamID()) {
			teamName = "Gaia";
			ally   = " <Gaia>";
		}
		font->glFormat(box.x1 + teamBox.x1 + 0.002f,
		                box.y1 + teamBox.y2 - 0.025f - teamPos * 0.025f, 0.7f,  FONT_SCALE | FONT_NORM,
		                "Team %02i (%s)%s%s", actualTeam,
		                teamName.c_str(), ally.c_str(), dead.c_str());
	}
}
Ejemplo n.º 9
0
bool CQuitBox::IsAbove(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);
	return (InBox(mx, my, box));
}
Ejemplo n.º 10
0
void CEndGameBox::Draw()
{
	if (disabled) {
		return;
	}

	float mx=MouseX(mouse->lastx);
	float my=MouseY(mouse->lasty);

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	// Large Box
	glColor4f(0.2f,0.2f,0.2f,guiAlpha);
	DrawBox(box);

	glColor4f(0.2f,0.2f,0.7f,guiAlpha);
	if(dispMode==0){
		DrawBox(box+playerBox);
	} else if(dispMode==1){
		DrawBox(box+sumBox);
	} else {
		DrawBox(box+difBox);
	}

	if(InBox(mx,my,box+exitBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+exitBox);
	}
	if(InBox(mx,my,box+playerBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+playerBox);
	}
	if(InBox(mx,my,box+sumBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+sumBox);
	}
	if(InBox(mx,my,box+difBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+difBox);
	}

	glEnable(GL_TEXTURE_2D);
	glColor4f(1,1,1,0.8f);
	font->glPrintAt(box.x1+exitBox.x1+0.025f,box.y1+exitBox.y1+0.005f,1,"Exit");
	font->glPrintAt(box.x1+playerBox.x1+0.015f,box.y1+playerBox.y1+0.005f,0.7f,"Player stats");
	font->glPrintAt(box.x1+sumBox.x1+0.015f,box.y1+sumBox.y1+0.005f,0.7f,"Team stats");
	font->glPrintAt(box.x1+difBox.x1+0.015f,box.y1+difBox.y1+0.005f,0.7f,"Team delta stats");

	if(gs->Team(gu->myTeam)->isDead){
		font->glPrintAt(box.x1+0.25f,box.y1+0.65f,1,"You lost the game");
	} else {
		font->glPrintAt(box.x1+0.25f,box.y1+0.65f,1,"You won the game");
	}

	if(dispMode==0){
		float xpos=0.01f;

		string headers[]={"Name","MC/m","MP/m","KP/m","Cmds/m","ACS"};

		for(int a=0;a<6;++a){
			font->glPrintAt(box.x1+xpos,box.y1+0.55f,0.8f,headers[a].c_str());
			xpos+=0.1f;
		}

		float ypos=0.5f;
		for(int a=0;a<gs->activePlayers;++a){
			if(gs->players[a]->currentStats->mousePixels==0)
				continue;
			char values[6][100];

			sprintf(values[0],"%s",	gs->players[a]->playerName.c_str());
			sprintf(values[1],"%i",(int)(gs->players[a]->currentStats->mouseClicks*60/game->totalGameTime));
			sprintf(values[2],"%i",(int)(gs->players[a]->currentStats->mousePixels*60/game->totalGameTime));
			sprintf(values[3],"%i",(int)(gs->players[a]->currentStats->keyPresses*60/game->totalGameTime));
			sprintf(values[4],"%i",(int)(gs->players[a]->currentStats->numCommands*60/game->totalGameTime));
			sprintf(values[5],"%i",(int)
				( gs->players[a]->currentStats->numCommands != 0 ) ?
				( gs->players[a]->currentStats->unitCommands/gs->players[a]->currentStats->numCommands) :
				( 0 ));

			float xpos=0.01f;
			for(int a=0;a<6;++a){
				font->glPrintAt(box.x1+xpos,box.y1+ypos,0.8f,values[a]);
				xpos+=0.1f;
			}

			ypos-=0.02f;
		}
	} else {
		if(stats.empty())
			FillTeamStats();

		glBindTexture(GL_TEXTURE_2D, graphTex);
		CVertexArray* va=GetVertexArray();
		va->Initialize();

		va->AddVertexT(float3(box.x1+0.15f, box.y1+0.08f, 0),0,0);
		va->AddVertexT(float3(box.x1+0.69f, box.y1+0.08f, 0),4,0);
		va->AddVertexT(float3(box.x1+0.69f, box.y1+0.62f, 0),4,4);
		va->AddVertexT(float3(box.x1+0.15f, box.y1+0.62f, 0),0,4);

		va->DrawArrayT(GL_QUADS);

		if(mx>box.x1+0.01f && mx<box.x1+0.12f && my<box.y1+0.57f && my>box.y1+0.571f-stats.size()*0.02f){

			int sel=(int)floor(-(my-box.y1-0.57f)*50);

			glColor4f(0.7f,0.2f,0.2f,guiAlpha);
			glDisable(GL_TEXTURE_2D);
			CVertexArray* va=GetVertexArray();
			va->Initialize();

			va->AddVertex0(float3(box.x1+0.01f, box.y1+0.55f-sel*0.02f , 0));
			va->AddVertex0(float3(box.x1+0.01f, box.y1+0.55f-sel*0.02f+0.02f , 0));
			va->AddVertex0(float3(box.x1+0.12f, box.y1+0.55f-sel*0.02f+0.02f , 0));
			va->AddVertex0(float3(box.x1+0.12f, box.y1+0.55f-sel*0.02f , 0));

			va->DrawArray0(GL_QUADS);
			glEnable(GL_TEXTURE_2D);
			glColor4f(1,1,1,0.8f);
		}
		float ypos=0.55f;
		for(int a=0;a<stats.size();++a){
			font->glPrintAt(box.x1+0.01f,box.y1+ypos,0.8f,stats[a].name.c_str());
			ypos-=0.02f;
		}
		float maxy=1;

		if(dispMode==1)
			maxy=std::max(stats[stat1].max,stat2!=-1?stats[stat2].max:0);
		else
			maxy=std::max(stats[stat1].maxdif,stat2!=-1?stats[stat2].maxdif:0)/CTeam::statsPeriod;

		int numPoints=stats[0].values[0].size();
		float scalex=0.54f/max(1.0f,numPoints-1.0f);
		float scaley=0.54f/maxy;

		for (int a = 0; a < 5; ++a) {
			font->glPrintAt(box.x1 + 0.12f, box.y1 + 0.07f + (a * 0.135f), 0.8f, "%s",
			                FloatToSmallString(maxy * 0.25f * a).c_str());
			font->glPrintAt(box.x1 + 0.135f + (a * 0.135f), box.y1 + 0.057f, 0.8f, "%i:%2i",
			                int(a * 0.25f * numPoints * CTeam::statsPeriod / 60),
			                int(a * 0.25f * (numPoints - 1) * CTeam::statsPeriod) % 60);
		}

		font->glPrintAt(box.x1+0.55f,box.y1+0.65f,0.8f,"%s",stats[stat1].name.c_str());
		font->glPrintAt(box.x1+0.55f,box.y1+0.63f,0.8f,"%s",stat2!=-1?stats[stat2].name.c_str():"");

		glDisable(GL_TEXTURE_2D);
		glBegin(GL_LINES);
				glVertex3f(box.x1+0.50f,box.y1+0.66f,0);
				glVertex3f(box.x1+0.55f,box.y1+0.66f,0);
		glEnd();

		glLineStipple(3,0x5555);
		glEnable(GL_LINE_STIPPLE);
		glBegin(GL_LINES);
				glVertex3f(box.x1+0.50f,box.y1+0.64f,0);
				glVertex3f(box.x1+0.55f,box.y1+0.64f,0);
		glEnd();
		glDisable(GL_LINE_STIPPLE);

		for(int team=0; team<gs->activeTeams; team++){
			if (gs->Team(team)->gaia) continue;
			glColor4ubv(gs->Team(team)->color);

			glBegin(GL_LINE_STRIP);
			for(int a=0;a<numPoints;++a){
				float value=0;
				if(dispMode==1)
					value=stats[stat1].values[team][a];
				else if(a>0)
					value=(stats[stat1].values[team][a]-stats[stat1].values[team][a-1])/CTeam::statsPeriod;

				glVertex3f(box.x1+0.15f+a*scalex,box.y1+0.08f+value*scaley,0);
			}
			glEnd();

			if (stat2!=-1) {
				glLineStipple(3,0x5555);
				glEnable(GL_LINE_STIPPLE);

				glBegin(GL_LINE_STRIP);
				for(int a=0;a<numPoints;++a){
					float value=0;
					if(dispMode==1)
						value=stats[stat2].values[team][a];
					else if(a>0)
						value=(stats[stat2].values[team][a]-stats[stat2].values[team][a-1])/CTeam::statsPeriod;

					glVertex3f(box.x1+0.15f+a*scalex,box.y1+0.08f+value*scaley,0);
				}
				glEnd();

				glDisable(GL_LINE_STIPPLE);
			}
		}
	}
}
void CStartPosSelecter::Draw()
{
	if(gu->spectating){
		delete this;
		return;
	}

	glPushMatrix();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glMatrixMode(GL_MODELVIEW);

	glColor4f(0.2f,0.8f,0.2f,0.5f);
	glDisable(GL_TEXTURE_2D);
	glEnable(GL_DEPTH_TEST);
	glBegin(GL_QUADS);
	float by=gameSetup->startRectTop[gu->myAllyTeam]*gs->mapy*8;
	float bx=gameSetup->startRectLeft[gu->myAllyTeam]*gs->mapx*8;

	float dy=(gameSetup->startRectBottom[gu->myAllyTeam]-gameSetup->startRectTop[gu->myAllyTeam])*gs->mapy*8/10;
	float dx=(gameSetup->startRectRight[gu->myAllyTeam]-gameSetup->startRectLeft[gu->myAllyTeam])*gs->mapx*8/10;

	for(int a=0;a<10;++a){	//draw start rect restrictions
		float3 pos1(bx+a*dx,0,by);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		float3 pos2(bx+(a+1)*dx,0,by);
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx+a*dx,0,by+dy*10);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx+(a+1)*dx,0,by+dy*10);
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx,0,by+dy*a);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx,0,by+dy*(a+1));
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx+dx*10,0,by+dy*a);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx+dx*10,0,by+dy*(a+1));
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);
	}
	glEnd();

	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
	glDisable(GL_DEPTH_TEST);

	float mx=float(mouse->lastx)/gu->viewSizeX;
	float my=(gu->viewSizeY-float(mouse->lasty))/gu->viewSizeY;

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	if (!showReady) {
		return;
	}

	if (InBox(mx, my, readyBox)) {
		glColor4f(0.7f, 0.2f, 0.2f, guiAlpha);
	} else {
		glColor4f(0.7f, 0.7f, 0.2f, guiAlpha);
	}
	DrawBox(readyBox);

	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	if (InBox(mx, my, readyBox)) {
		glColor4f(0.7f, 0.2f, 0.2f, guiAlpha);
	} else {
		glColor4f(0.7f, 0.7f, 0.2f, guiAlpha);
	}
	DrawBox(readyBox);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	const float width = font->CalcTextWidth("Ready");
	const float yDiff = (readyBox.y2 - readyBox.y1);
	const float xDiff = (readyBox.x2 - readyBox.x1);
	const float yScale = 0.8f * yDiff;
	const float xScale = 0.8f * (xDiff / width);
	const float xPixel  = 1.0f / (xScale * (float)gu->viewSizeX);
	const float yPixel  = 1.0f / (yScale * (float)gu->viewSizeY);
	const float yPos = readyBox.y1 + (0.1f * yDiff);
	const float xPos = readyBox.x1 + (0.1f * xDiff);

	glPushMatrix();
	glTranslatef(xPos, yPos, 0.0f);
	glScalef(xScale, yScale, 1.0f);
	const float dark[4]   = { 0.2f, 0.2f, 0.2f, 0.8f };
	const float white[4]  = { 1.0f, 1.0f, 1.0f, 1.0f };
	font->glPrintOutlined("Ready", xPixel, yPixel, white, dark);
	glPopMatrix();
}
Ejemplo n.º 12
0
bool CShareBox::MousePress(int x, int y, int button)
{
    const float mx = MouseX(x);
    const float my = MouseY(y);

    if (InBox(mx, my, box)) {
        moveBox = true;
        if (InBox(mx, my, box + okBox) ||
                InBox(mx, my, box + applyBox) ||
                InBox(mx, my, box + cancelBox) ||
                InBox(mx, my, box + unitBox) ||
                InBox(mx, my, box + metalBox) ||
                InBox(mx, my, box + energyBox) ||
                InBox(mx, my, box + teamBox) ||
                InBox(mx, my, box + scrollbarBox) ||
                InBox(mx, my, box + scrollBox)) {
            moveBox = false;
        }
        if (InBox(mx, my, box + metalBox)) {
            metalMove = true;
            metalShare = std::max(0.f, std::min(1.f, (mx-box.x1-metalBox.x1)/(metalBox.x2-metalBox.x1)));
        }
        if (InBox(mx, my, box + energyBox)) {
            energyMove = true;
            energyShare = std::max(0.f, std::min(1.f, (mx-box.x1-energyBox.x1)/(energyBox.x2-energyBox.x1)));
        }
        if (hasScroll && InBox(mx, my, box + scrollBox)) {
            scrolling = true;
            scrollGrab = (box + scrollBox).y2 - my;
        }
        else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
            if(my < (box + scrollBox).y1)
                *(volatile int *)&startTeam = startTeam + std::min(MAX_SHARE_TEAMS - numTeamsDisp - startTeam, numTeamsDisp);
            if(my > (box + scrollBox).y2)
                *(volatile int *)&startTeam = startTeam - std::min(startTeam, numTeamsDisp);
        }
        else if (InBox(mx, my, box + teamBox)) {
            int team = startTeam + (int)((box.y1 + teamBox.y2-my)/0.025f);
            if (team >= gu->myTeam) {
                team++;
            }
            if (team < teamHandler->ActiveTeams() && !teamHandler->Team(team)->isDead) {
                shareTeam = team;
            }
        }
        return true;
    }
    return false;
}
Ejemplo n.º 13
0
void CShareBox::Draw(void)
{
	float mx=float(mouse->lastx)/gu->screenx;
	float my=(gu->screeny-float(mouse->lasty))/gu->screeny;

	GLfloat x1,y1,x2,y2,x;
	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	// Large Box
	glColor4f(0.2f,0.2f,0.2f,0.4f);
	DrawBox(box);

	// ok Box on mouse over
	if(InBox(mx,my,box+okBox)){
		glColor4f(0.7f,0.2f,0.2f,0.4f);
		DrawBox(box+okBox);
	}

	// apply Box on mouse over
	if(InBox(mx,my,box+applyBox)){
		glColor4f(0.7f,0.2f,0.2f,0.4f);
		DrawBox(box+applyBox);
	}

	// cancel Box on mouse over
	if(InBox(mx,my,box+cancelBox)){
		glColor4f(0.7f,0.2f,0.2f,0.4f);
		DrawBox(box+cancelBox);
	}

	glColor4f(0.2f,0.2f,0.2f,0.4f);
	DrawBox(box+teamBox);

	if(InBox(mx,my,box+unitBox))
		glColor4f(0.7f,0.2f,0.2f,0.4f);
	else
		glColor4f(0.2f,0.2f,0.2f,0.4f);
	DrawBox(box+unitBox);

	glColor4f(0.8f,0.8f,0.9f,0.7f);
	DrawBox(box+metalBox);

	glColor4f(0.9f,0.9f,0.2f,0.7f);
	DrawBox(box+energyBox);

	//draw share indicators in metal/energy bars
	glColor4f(0.9f,0.2f,0.2f,0.7f);
	ContainerBox metalShareBox;
	metalShareBox.x1=metalBox.x1+metalShare*(metalBox.x2-metalBox.x1)-0.005;
	metalShareBox.x2=metalShareBox.x1+0.01;
	metalShareBox.y1=metalBox.y1-0.005;
	metalShareBox.y2=metalBox.y2+0.005;
	DrawBox(box+metalShareBox);
	ContainerBox energyShareBox;
	energyShareBox.x1=energyBox.x1+energyShare*(energyBox.x2-energyBox.x1)-0.005;
	energyShareBox.x2=energyShareBox.x1+0.01;
	energyShareBox.y1=energyBox.y1-0.005;
	energyShareBox.y2=energyBox.y2+0.005;
	DrawBox(box+energyShareBox);

	//show that share units is selected
	if(shareUnits){
//		DrawBox(box+unitBox);
		glLineWidth(3);
		glBegin(GL_LINE_STRIP);
		glVertex2f(box.x1+unitBox.x1+0.01,box.y1+unitBox.y1+0.025);
		glVertex2f(box.x1+unitBox.x1+0.02,box.y1+unitBox.y1+0.01);
		glVertex2f(box.x1+unitBox.x1+0.03,box.y1+unitBox.y1+0.04);
		glEnd();
		glLineWidth(1);
	}

	glEnable(GL_TEXTURE_2D);
	glColor4f(1,1,1,0.8);
	font->glPrintAt(box.x1+okBox.x1+0.025,box.y1+okBox.y1+0.005,1,"Ok");
	font->glPrintAt(box.x1+applyBox.x1+0.025,box.y1+applyBox.y1+0.005,1,"Apply");
	font->glPrintAt(box.x1+cancelBox.x1+0.005,box.y1+cancelBox.y1+0.005,1,"Cancel");

	font->glPrintAt(box.x1+0.06,box.y1+0.085,0.7,"Share selected units");

	glColor4f(1,1,0.4,0.8f);
	font->glPrintAt(box.x1+0.01,box.y1+0.16,0.7f,"Share Energy");

	glColor4f(1,1,1,0.8f);
	font->glPrintAt(box.x1+0.25f,box.y1+0.12,0.7f,"%.0f",gs->Team(gu->myTeam)->energy);
	font->glPrintAt(box.x1+0.14f,box.y1+0.12,0.7f,"%.0f",gs->Team(gu->myTeam)->energy*energyShare);

	glColor4f(0.8,0.8,0.9,0.8f);
	font->glPrintAt(box.x1+0.01,box.y1+0.22,0.7f,"Share Metal");

	glColor4f(1,1,1,0.8f);
	font->glPrintAt(box.x1+0.25f,box.y1+0.18,0.7f,"%.0f",gs->Team(gu->myTeam)->metal);
	font->glPrintAt(box.x1+0.14f,box.y1+0.18,0.7f,"%.0f",gs->Team(gu->myTeam)->metal*metalShare);

	for(int team=0;team<gs->activeTeams-1;++team){
		int actualTeam=team;
		if(team>=gu->myTeam)
			actualTeam++;

		if(shareTeam==actualTeam)
			glColor4f(1,1,1,0.8f);
		else
			glColor4f(1,1,1,0.4f);
		string ally,dead;
		if(gs->Ally(gu->myAllyTeam, gs->AllyTeam(actualTeam)))
			ally="(Ally)";
		if(gs->Team(actualTeam)->isDead)
			dead="(Dead)";
		font->glPrintAt(box.x1+teamBox.x1+0.002f,box.y1+teamBox.y2-0.025-team*0.025,0.7f,"Team%i (%s)%s%s",actualTeam,gs->players[gs->Team(actualTeam)->leader]->playerName.c_str(),ally.c_str(),dead.c_str());
	}
}
Ejemplo n.º 14
0
void DrawStatistics(char Win)
{
    GXHEADER local;
    char AImg[7] = {8, 9, 10, 11, 13, 14, 0};
    char Digit[2];
    int starty, qty, i;
    FILE *fin;
    strncpy(helptextIndex, "i145", 4);
    strncpy(keyhelpIndex, "k045", 4);
    FadeOut(2, pal, 10, 0, 0);
    PortPal(0);

    gxClearDisplay(0, 0);
    ShBox(35, 33, 288, 159);
    InBox(40, 69, 111, 109);
    InBox(116, 69, 283, 109);
    InBox(40, 114, 111, 154);
    InBox(116, 114, 283, 154);
    IOBox(191, 40, 280, 62);
    Flag(41, 70, Win);
    Flag(41, 115, other(Win));
    DispBig(48, 44, "STATISTICS", 1, -1);
    DispBig(215, 45, "EXIT", 1, -1);
    grSetColor(6);
    PrintAt(122, 78, "WINNING DIRECTOR: ");
    grSetColor(8);

    if (AI[Win]) {
        PrintAt(0, 0, "COMPUTER");
        sprintf(&Digit[0], "%d", Data->P[Win].Track[3]);
        PrintAt(0, 0, &Digit[0]);
    } else if (Win == 0) {
        PrintAt(0, 0, &Data->P[Data->Def.Plr1].Name[0]);
    } else {
        PrintAt(0, 0, &Data->P[ Data->Def.Plr2 ].Name[0]);
    }

    grSetColor(6);
    PrintAt(122, 125, "LOSING DIRECTOR: ");
    grSetColor(8);

    if (AI[other(Win)]) {
        PrintAt(0, 0, "COMPUTER");
        sprintf(&Digit[0], "%d", Data->P[other(Win)].Track[3]);
        PrintAt(0, 0, &Digit[0]);
    } else if (Win == 0) {
        PrintAt(0, 0, &Data->P[Data->Def.Plr2].Name[0]);
    } else {
        PrintAt(0, 0, &Data->P[ Data->Def.Plr1 ].Name[0]);
    }

    qty = 6;
    starty = 118;
    GV(&local, 30, 19);
    fin = sOpen("PORTBUT.BUT", "rb", 0);
    OutBox(152, 41, 183, 61); //directors ranking

    for (i = 0; i < qty; i++) {
        if (i <= 4 && AI[Win] == 0) {
            OutBox(starty + (i * 33), 87, 31 + starty + (i * 33), 107);
        }

        if (i <= 4 && AI[other(Win)] == 0) {
            OutBox(starty + (i * 33), 132, 31 + starty + (i * 33), 152);
        }

        fseek(fin, AImg[i] * 570, SEEK_SET);
        fread((char *)local.vptr, 570, 1, fin);

        if (i == 0) {
            gxPutImage(&local, gxSET, 153, 42, 0);
        } else {
            if (AI[Win] == 0) {
                gxPutImage(&local, gxSET, starty + ((i - 1) * 33) + 1, 88, 0);
            }

            if (AI[other(Win)] == 0) {
                gxPutImage(&local, gxSET, starty + ((i - 1) * 33) + 1, 133, 0);
            }
        }
    }

    fclose(fin);
    DV(&local);
    FadeIn(2, pal, 10, 0, 0);

    return;
}
Ejemplo n.º 15
0
/* The main control loop for the Future Missions feature.
 */
void Future(char plr)
{
    /** \todo the whole Future()-function is 500 >lines and unreadable */
    TRACE1("->Future(plr)");
    int MisNum = 0, DuraType = 0, MaxDur = 6;
    int setting = -1, prev_setting = -1;

    display::LegacySurface local(166, 9);
    display::LegacySurface local2(177, 197);
    vh = new display::LegacySurface(240, 90);

    unsigned int year = Data->Year;
    unsigned int season = Data->Season;
    TRACE3("--- Setting year=Year (%d), season=Season (%d)", year, season);

    SetParameters();
    MarsFlag = MarsInRange(year, season);
    JupiterFlag = JupiterInRange(year, season);
    SaturnFlag = SaturnInRange(year, season);

    while ((MisNum = FutureCheck(plr, 0)) != 5) {
        F1 = F2 = F3 = F4 = F5 = 0;

        for (int i = 0; i < 5; i++) {
            lock[i] = false;
            status[i] = 0;
        }

        keyHelpText = "k011";
        helpText = "i011";
        Pad = MisNum;
        DuraType = 0;
        MisType = 0;
        ClrFut(plr, MisNum);

        JointFlag = JointMissionOK(plr, MisNum); // initialize joint flag

        if (JointFlag == false) {
            F4 = 2;
            lock[4] = true;
            status[4] = 0;
        }

        DrawFuture(plr, MisType, MisNum);

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

            prev_setting = setting;
            setting = -1;

            // SEG determines the number of control points used in creating
            // the B-splines for drawing the mission flight path.
            // The more control points, the smoother the path should
            // appear.
            if (key == '-' && SEG > 1) {
                SEG--;
            } else if (key == '+' && SEG < 500) {
                SEG++;
            } else if (key >= 65 && key < Bub_Count + 65) {
                setting = key - 65;
            }

            // If the mouse is over one of the Mission Step bubbles,
            // display the step information.
            for (int i = 0; i < Bub_Count; i++) {
                if (x >= StepBub[i].x_cor && x <= StepBub[i].x_cor + 7 &&
                    y >= StepBub[i].y_cor && y <= StepBub[i].y_cor + 7) {
                    setting = i;
                    break;
                }
            }

            if (setting >= 0) {
                if (prev_setting < 0) {
                    local.copyFrom(display::graphics.legacyScreen(), 18, 186, 183, 194);
                }

                if (prev_setting != setting) {
                    ShBox(18, 186, 183, 194);
                    display::graphics.setForegroundColor(1);
                    MisStep(21, 192, Mev[setting].loc);
                }
            } else if (setting < 0 && prev_setting >= 0) {
                local.copyTo(display::graphics.legacyScreen(), 18, 186);
            }

            if (Mis.Dur <= V[MisType].E &&
                ((x >= 244 && y >= 5 && x <= 313 && y <= 17 && mousebuttons > 0) ||
                 key == K_ENTER)) {
                InBox(244, 5, 313, 17);
                WaitForMouseUp();

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

                key = 0;
                OutBox(244, 5, 313, 17);

                // Copy the screen contents to a buffer. If the mission
                // requires a capsule to be assigned, a pop-up will be
                // created listing the options. Once the pop-up is
                // dismissed the screen may be redrawn from the buffer.
                local2.copyFrom(display::graphics.legacyScreen(), 74, 3, 250, 199);
                int NewType = V[MisType].X;
                Data->P[plr].Future[MisNum].Duration = DuraType;

                int Ok = HardCrewAssign(plr, MisNum, MisType, NewType);

                local2.copyTo(display::graphics.legacyScreen(), 74, 3);

                if (Ok == 1) {
                    Data->P[plr].Future[MisNum].Duration = DuraType;
                    break;        // return to launchpad loop
                } else {
                    ClrFut(plr, MisNum);
                    continue;
                }
            } else if ((x >= 43 && y >= 74 && x <= 53 && y <= 82 && mousebuttons > 0) ||
                       key == '!') { // Duration restriction lock
                lock[0] = (! lock[0]);

                if (lock[0] == true) {
                    InBox(43, 74, 53, 82);
                    PlaceRX(1);
                    F5 = (status[0] == 0) ? -1 : status[0];
                } else {
                    OutBox(43, 74, 53, 82);
                    ClearRX(1);
                    F5 = status[0] = 0;
                }

                WaitForMouseUp();

            } else if (lock[0] != true &&
                       ((x >= 5 && y >= 49 && x <= 53 && y <= 72 && mousebuttons > 0) ||
                        key == '1')) { // Duration toggle
                InBox(5, 49, 53, 72);

                if (DuraType == MaxDur) {
                    DuraType = 0;
                } else {
                    DuraType++;
                }

                Data->P[plr].Future[MisNum].Duration = DuraType;

                if (DuraType == 0) {
                    Toggle(5, 0);
                } else if (DuraType == 1) {
                    Toggle(5, 1);
                }

                if (DuraType != 0) {
                    draw_Pie(DuraType);
                }

                status[0] = DuraType;

                WaitForMouseUp();

                display::graphics.setForegroundColor(34);
                OutBox(5, 49, 53, 72);
            } else if ((x >= 5 && y >= 74 && x <= 41 && y <= 82 && mousebuttons > 0) ||
                       (key == K_ESCAPE)) { // Reset mission selection
                InBox(5, 74, 41, 82);

                WaitForMouseUp();

                MisType = 0;

                DuraType = F1 = F2 = F3 = F4 = F5 = 0;

                for (int i = 0; i < 5; i++) {
                    lock[i] = false;
                    status[i] = 0;
                }

                if (JointFlag == false) {
                    F4 = 2;
                    lock[4] = true;
                    InBox(191, 74, 201, 82);
                    TogBox(166, 49, 1);
                } else {
                    OutBox(191, 74, 201, 82);
                }

                OutBox(5, 49, 53, 72);
                OutBox(43, 74, 53, 82);
                OutBox(80, 74, 90, 82);
                OutBox(117, 74, 127, 82);
                OutBox(154, 74, 164, 82);

                ClrFut(plr, MisNum);
                Missions(plr, 8, 37, MisType, 1);
                GetMinus(plr);
                OutBox(5, 74, 41, 82);

            } else if ((x >= 80 && y >= 74 && x <= 90 && y <= 82 && mousebuttons > 0) ||
                       key == '@') { // Docking restriction lock
                lock[1] = (! lock[1]);

                if (lock[1] == true) {
                    InBox(80, 74, 90, 82);
                    PlaceRX(2);
                } else {
                    OutBox(80, 74, 90, 82);
                    ClearRX(2);
                }

                if ((status[1] == 0) && (lock[1] == true)) {
                    F1 = 2;
                } else if ((status[1] == 1) && (lock[1] == true)) {
                    F1 = 1;
                } else {
                    F1 = 0;
                }

                WaitForMouseUp();

            } else if (lock[1] == false &&
                       (((x >= 55 && y >= 49 && x <= 90 && y <= 82) && mousebuttons > 0) ||
                        key == '2')) { // Docking toggle
                TogBox(55, 49, 1);

                if (status[1] == 0) {
                    Toggle(1, 1);
                } else {
                    Toggle(1, 0);
                }

                status[1] = abs(status[1] - 1);
                WaitForMouseUp();
                TogBox(55, 49, 0);

            } else if ((x >= 117 && y >= 74 && x <= 127 && y <= 82 && mousebuttons > 0) ||
                       key == '#') { // EVA Restriction button
                lock[2] = (! lock[2]);

                if (lock[2] == true) {
                    InBox(117, 74, 127, 82);
                    PlaceRX(3);
                } else {
                    OutBox(117, 74, 127, 82);
                    ClearRX(3);
                }

                if ((status[2] == 0) && (lock[2] == true)) {
                    F2 = 2;
                } else if ((status[2] == 1) && (lock[2] == true)) {
                    F2 = 1;
                } else {
                    F2 = 0;
                }

                WaitForMouseUp();

            } else if (lock[2] == false &&
                       ((x >= 92 && y >= 49 && x <= 127 && y <= 82 && mousebuttons > 0) ||
                        key == '3')) { // EVA toggle
                TogBox(92, 49, 1);

                if (status[2] == 0) {
                    Toggle(2, 1);
                } else {
                    Toggle(2, 0);
                }

                status[2] = abs(status[2] - 1);
                WaitForMouseUp();
                TogBox(92, 49, 0);

            } else if ((x >= 154 && y >= 74 && x <= 164 && y <= 82 && mousebuttons > 0) ||
                       key == '$') { // Lunar Module Restriction button
                lock[3] = (! lock[3]);

                if (lock[3] == true) {
                    InBox(154, 74, 164, 82);
                    PlaceRX(4);
                } else {
                    OutBox(154, 74, 164, 82);
                    ClearRX(4);
                }

                if ((status[3] == 0) && (lock[3] == true)) {
                    F3 = 2;
                } else if ((status[3] == 1) && (lock[3] == true)) {
                    F3 = 1;
                } else {
                    F3 = 0;
                }

                WaitForMouseUp();

            } else if (lock[3] == false &&
                       ((x >= 129 && y >= 49 && x <= 164 && y <= 82 && mousebuttons > 0) ||
                        key == '4')) { // LEM toggle
                TogBox(129, 49, 1);

                if (status[3] == 0) {
                    Toggle(3, 1);
                } else {
                    Toggle(3, 0);
                }

                status[3] = abs(status[3] - 1);
                WaitForMouseUp();
                TogBox(129, 49, 0);

            } else if (JointFlag == true &&
                       ((x > 191 && y >= 74 && x <= 201 && y <= 82 && mousebuttons > 0) ||
                        key == '%')) { // Joint Mission Restriction button
                lock[4] = (! lock[4]);

                if (lock[4] == true) {
                    InBox(191, 74, 201, 82);
                    PlaceRX(5);
                } else {
                    OutBox(191, 74, 201, 82);
                    ClearRX(5);
                }

                if ((status[4] == 0) && (lock[4] == true)) {
                    F4 = 2;
                } else if ((status[4] == 1) && (lock[4] == true)) {
                    F4 = 1;
                } else {
                    F4 = 0;
                }

                WaitForMouseUp();

            } else if (lock[4] == false && JointFlag == true &&
                       ((x >= 166 && y >= 49 && x <= 201 && y <= 82 && mousebuttons > 0) ||
                        key == '5')) { // Joint Mission
                TogBox(166, 49, 1);
                status[4] = abs(status[4] - 1);

                if (status[4] == 0) {
                    Toggle(4, 1);
                } else {
                    Toggle(4, 0);
                }

                WaitForMouseUp();
                TogBox(166, 49, 0);

            } else if ((x >= 5 && y >= 84 && x <= 16 && y <= 130 && mousebuttons > 0) ||
                       (key == UP_ARROW)) {
                // Scroll up among Mission Types
                InBox(5, 84, 16, 130);

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

                    if (mousebuttons == 0) {
                        MisType = UpSearchRout(MisType, plr);
                        Data->P[plr].Future[MisNum].MissionCode = MisType;
                        i = 51;
                    }
                }

                // Keep scrolling while mouse/key is held down.
                while (mousebuttons == 1 || key == UP_ARROW) {
                    MisType = UpSearchRout(MisType, plr);
                    Data->P[plr].Future[MisNum].MissionCode = MisType;
                    Missions(plr, 8, 37, MisType, 3);
                    delay(100);
                    key = 0;
                    GetMouse();
                }

                Missions(plr, 8, 37, MisType, 3);
                DuraType = status[0];
                OutBox(5, 84, 16, 130);
            } else if ((x >= 5 && y >= 132 && x < 16 && y <= 146 && mousebuttons > 0) ||
                       (key == K_SPACE)) {
                // Turn on Mission Steps display
                InBox(5, 132, 16, 146);
                WaitForMouseUp();
                delay(50);
                MisType = Data->P[plr].Future[MisNum].MissionCode;
                assert(0 <= MisType);

                if (MisType != 0) {
                    Missions(plr, 8, 37, MisType, 1);
                } else {
                    Missions(plr, 8, 37, MisType, 3);
                }

                OutBox(5, 132, 16, 146);
            } else if ((x >= 5 && y >= 148 && x <= 16 && y <= 194 && mousebuttons > 0) ||
                       (key == DN_ARROW)) {
                // Scroll down among Mission Types
                InBox(5, 148, 16, 194);

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

                    if (mousebuttons == 0) {
                        MisType = DownSearchRout(MisType, plr);
                        Data->P[plr].Future[MisNum].MissionCode = MisType;
                        i = 51;
                    }

                }

                // Keep scrolling while mouse/key is held down.
                while (mousebuttons == 1 || key == DN_ARROW) {
                    MisType = DownSearchRout(MisType, plr);
                    Data->P[plr].Future[MisNum].MissionCode = MisType;
                    Missions(plr, 8, 37, MisType, 3);
                    delay(100);
                    key = 0;
                    GetMouse();
                }

                Missions(plr, 8, 37, MisType, 3);
                DuraType = status[0];
                OutBox(5, 148, 16, 194);
            }
        }                              // Input while loop
    }                              // Launch pad selection loop

    delete vh;
    vh = NULL;
    TRACE1("<-Future()");
}
Ejemplo n.º 16
0
void CQuitBox::MouseRelease(int x,int y,int button)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	scrolling = false;
	scrollGrab = 0.0f;

	if (InBox(mx, my, box + resignBox)
	   || (InBox(mx, my, box + saveBox) && !teamHandler->Team(gu->myTeam)->isDead)
	   || (InBox(mx, my, box + giveAwayBox) && !teamHandler->Team(shareTeam)->isDead && !teamHandler->Team(gu->myTeam)->isDead)) {

		// give away all units (and resources)
		if (InBox(mx, my, box + giveAwayBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
			clientNet->Send(CBaseNetProtocol::Get().SendGiveAwayEverything(gu->myPlayerNum, shareTeam, playerHandler->Player(gu->myPlayerNum)->team));
		}
		// resign, so self-d all units
		if (InBox(mx, my, box + resignBox) && !playerHandler->Player(gu->myPlayerNum)->spectator) {
			clientNet->Send(CBaseNetProtocol::Get().SendResign(gu->myPlayerNum));
		}
		// save current game state
		if (InBox(mx, my, box + saveBox)) {
			if (FileSystem::CreateDirectory("Saves")) {
				std::string timeStr = CTimeUtil::GetCurrentTimeStr();
				std::string saveFileName(timeStr + "_" + modInfo.filename + "_" + gameSetup->mapName);
				saveFileName = "Saves/" + saveFileName + ".ssf";

				if (!FileSystem::FileExists(saveFileName)) {
					LOG("Saving game to %s", saveFileName.c_str());
					ILoadSaveHandler* ls = ILoadSaveHandler::Create(true);
					ls->mapName = gameSetup->mapName;
					ls->modName = modInfo.filename;
					ls->SaveGame(saveFileName);
					delete ls;
				} else {
					LOG_L(L_ERROR, "File %s already exists, game NOT saved!", saveFileName.c_str());
				}
			}
		}
	}
	else if (InBox(mx, my, box + menuBox)) {
		LOG("[QuitBox] user exited to menu");

		// signal SpringApp
		gu->reloadScript = "";
		gu->globalReload = true;
	}
	else if (InBox(mx, my, box + quitBox)) {
		LOG("[QuitBox] user exited to system");
		gu->globalQuit = true;
	}

	// if we're still in the game, remove the QuitBox
	const ContainerBox boxes[] = {resignBox, saveBox, giveAwayBox, cancelBox, menuBox, quitBox};

	for (unsigned int n = 0; n < (sizeof(boxes) / sizeof(boxes[0])); n++) {
		if (!InBox(mx, my, box + boxes[n]))
			continue;

		delete this;
		return;
	}

	moveBox = false;
}
Ejemplo n.º 17
0
void CQuitBox::Draw(void)
{
	float mx=MouseX(mouse->lastx);
	float my=MouseY(mouse->lasty);

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	// Large Box
	glColor4f(0.2f,0.2f,0.2f,guiAlpha);
	DrawBox(box);

	// resign Box on mouse over
	if(InBox(mx,my,box+resignBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+resignBox);
	}
	// save Box on mouse over
	if(InBox(mx,my,box+saveBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+saveBox);
	}
	// give away Box on mouse over
	if(InBox(mx,my,box+giveAwayBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+giveAwayBox);
	}
	// cancel Box on mouse over
	if(InBox(mx,my,box+cancelBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+cancelBox);
	}
	// quit Box on mouse over
	if(InBox(mx,my,box+quitBox)){
		glColor4f(0.7f,0.2f,0.2f,guiAlpha);
		DrawBox(box+quitBox);
	}


	glColor4f(0.2f,0.2f,0.2f,guiAlpha);
	DrawBox(box+teamBox);


	glEnable(GL_TEXTURE_2D);
	glColor4f(1,1,0.4f,0.8f);
	font->glPrint(box.x1+0.045f,box.y1+0.58f,0.7f, FONT_VCENTER | FONT_SCALE | FONT_NORM,"Do you want to ...");
	glColor4f(1,1,1,0.8f);
	font->glPrint(box.x1 + resignBox.x1     + 0.025f,
	                box.y1 + (resignBox.y1 + resignBox.y2)/2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Resign");
	font->glPrint(box.x1 + saveBox.x1   + 0.025f,
	                box.y1 + (saveBox.y1 + saveBox.y2)/2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Save");
	font->glPrint(box.x1 + giveAwayBox.x1   + 0.025f,
	                box.y1 + (giveAwayBox.y1 + giveAwayBox.y2)/2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Give everything to ...");
	font->glPrint(box.x1 + cancelBox.x1     + 0.025f,
	                box.y1 + (cancelBox.y1 + cancelBox.y2)/2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Cancel");
	font->glPrint(box.x1 + quitBox.x1       + 0.025f,
	                box.y1 + (quitBox.y1 + quitBox.y2)/2, 1, FONT_VCENTER | FONT_SCALE | FONT_NORM, "Quit");

	for(int team=0;team<teamHandler->ActiveTeams()-1;++team){
		int actualTeam=team;
		if (team >= gu->myTeam) {
			actualTeam++;
		}
		if (teamHandler->Team(actualTeam)->gaia) continue;

		if (shareTeam == actualTeam) {
			glColor4f(1,1,1,0.8f);
		} else {
			glColor4f(1,1,1,0.4f);
		}

		std::string teamName;
		if (teamHandler->Team(actualTeam)->leader >= 0)
			teamName = playerHandler->Player(teamHandler->Team(actualTeam)->leader)->name;
		else
			teamName = "uncontrolled";

		std::string ally, dead;
		if (teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(actualTeam))) {
			ally = " <Ally>)";
		} else {
			ally = " <Enemy>";
		}
		if(teamHandler->Team(actualTeam)->isDead) {
			dead = " <Dead>";
		}
		if (actualTeam == teamHandler->GaiaTeamID()) {
			teamName = "Gaia";
			ally   = " <Gaia>";
		}
		font->glFormat(box.x1 + teamBox.x1 + 0.002f,
		                box.y1 + teamBox.y2 - 0.025f - team * 0.025f, 0.7f,  FONT_SCALE | FONT_NORM,
		                "Team%i (%s)%s%s", actualTeam,
		                teamName.c_str(), ally.c_str(), dead.c_str());
	}
}
Ejemplo n.º 18
0
void Flts(char old, char nw)
{

    switch (old) {
    case 0:
        OutBox(164, 139, 238, 151);
        break;

    case 1:
        OutBox(164, 154, 238, 166);
        break;

    case 2:
        OutBox(164, 169, 238, 181);
        break;

    case 3:
        OutBox(164, 184, 238, 196);
        break;

    case 4:
        OutBox(241, 139, 315, 151);
        break;

    case 5:
        OutBox(241, 154, 315, 166);
        break;

    case 6:
        OutBox(241, 169, 315, 181);
        break;

    case 7:
        OutBox(241, 184, 315, 196);
        break;
    }

    switch (nw) {
    case 0:
        InBox(164, 139, 238, 151);
        break;

    case 1:
        InBox(164, 154, 238, 166);
        break;

    case 2:
        InBox(164, 169, 238, 181);
        break;

    case 3:
        InBox(164, 184, 238, 196);
        break;

    case 4:
        InBox(241, 139, 315, 151);
        break;

    case 5:
        InBox(241, 154, 315, 166);
        break;

    case 6:
        InBox(241, 169, 315, 181);
        break;

    case 7:
        InBox(241, 184, 315, 196);
        break;
    }
} /* End of Flts */
Ejemplo n.º 19
0
void CStartPosSelecter::Draw()
{
	if(gu->spectating){
		delete this;
		return;
	}

	glPushMatrix();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glMatrixMode(GL_MODELVIEW);

	glColor4f(0.2f,0.8f,0.2f,0.5f);
	glDisable(GL_TEXTURE_2D);
	glEnable(GL_DEPTH_TEST);
	glBegin(GL_QUADS);
	float by= gameSetup->allyStartingData[gu->myAllyTeam].startRectTop *gs->mapy*8;
	float bx= gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft *gs->mapx*8;

	float dy = (gameSetup->allyStartingData[gu->myAllyTeam].startRectBottom - gameSetup->allyStartingData[gu->myAllyTeam].startRectTop) *gs->mapy*8/10;
	float dx = (gameSetup->allyStartingData[gu->myAllyTeam].startRectRight - gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft) *gs->mapx*8/10;

	for(int a=0;a<10;++a){	//draw start rect restrictions
		float3 pos1(bx+a*dx,0,by);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		float3 pos2(bx+(a+1)*dx,0,by);
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx+a*dx,0,by+dy*10);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx+(a+1)*dx,0,by+dy*10);
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx,0,by+dy*a);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx,0,by+dy*(a+1));
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);

		pos1=float3(bx+dx*10,0,by+dy*a);
		pos1.y=ground->GetHeight(pos1.x,pos1.z);
		pos2=float3(bx+dx*10,0,by+dy*(a+1));
		pos2.y=ground->GetHeight(pos2.x,pos2.z);

		glVertexf3(pos1);
		glVertexf3(pos2);
		glVertexf3(pos2+UpVector*100);
		glVertexf3(pos1+UpVector*100);
	}
	glEnd();

	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
	glDisable(GL_DEPTH_TEST);

	float mx=float(mouse->lastx)/globalRendering->viewSizeX;
	float my=(globalRendering->viewSizeY-float(mouse->lasty))/globalRendering->viewSizeY;

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_ALPHA_TEST);

	if (!showReady) {
		return;
	}

	if (InBox(mx, my, readyBox)) {
		glColor4f(0.7f, 0.2f, 0.2f, guiAlpha);
	} else {
		glColor4f(0.7f, 0.7f, 0.2f, guiAlpha);
	}
	DrawBox(readyBox);

	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	if (InBox(mx, my, readyBox)) {
		glColor4f(0.7f, 0.2f, 0.2f, guiAlpha);
	} else {
		glColor4f(0.7f, 0.7f, 0.2f, guiAlpha);
	}
	DrawBox(readyBox);
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	// fit text into box
	const float unitWidth  = font->GetSize() * font->GetTextWidth("Ready") * globalRendering->pixelX;
	const float unitHeight = font->GetSize() * font->GetLineHeight() * globalRendering->pixelY;

	const float ySize = (readyBox.y2 - readyBox.y1);
	const float xSize = (readyBox.x2 - readyBox.x1);

	const float fontScale = 0.9f * std::min(xSize/unitWidth, ySize/unitHeight);
	const float yPos = 0.5f * (readyBox.y1 + readyBox.y2);
	const float xPos = 0.5f * (readyBox.x1 + readyBox.x2);

	font->Begin(); 
	font->SetColors(); // default
	font->glPrint(xPos, yPos, fontScale, FONT_OUTLINE | FONT_CENTER | FONT_VCENTER | FONT_SCALE | FONT_NORM, "Ready");
	font->End(); 
}
Ejemplo n.º 20
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;
}
Ejemplo n.º 21
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;
}
Ejemplo n.º 22
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;
            }
        }
    }
}
Ejemplo n.º 23
0
void mui::HScrollBar::DoScrollBar() {

    int bx1=mui::HScrollBar::x;
    int by1=mui::HScrollBar::y;
    int bx2=mui::HScrollBar::x+mui::HScrollBar::w;
    int by2=mui::HScrollBar::y+mui::HScrollBar::h;

    int lArrowX = bx1+3;
    int lArrowY = y+((mui::HScrollBar::h)/2);
    int rArrowX = bx2-3;
    int rArrowY = y+((mui::HScrollBar::h)/2);

    status = 0;
    if ((mouseClickPtr != NULL) && (mouseOldClickPtr != NULL) && (mouseXposPtr != NULL) && (mouseYposPtr != NULL)) {

        if (*mouseClickPtr) {
            if (InBox(*mouseXposPtr, *mouseYposPtr, bx1, by1, bx2, by2)) {

                if (*mouseOldClickPtr == false)
                    clickedOn = true;

                if (clickedOn) {
                    if (InBox(*mouseXposPtr, *mouseYposPtr, bx1, by1, bx1+10, by2)) {
                        if (barClicked == false) {
                            if (value > minVal) value -= 1;
                            status = 3;
                        }
                    } else if (InBox(*mouseXposPtr, *mouseYposPtr, bx2-10, by1, bx2, by2)) {
                        if (barClicked == false) {
                            if (value < maxVal) value += 1;
                            status = 4;
                        }
                    } else {
                        status = 1;
                    }
                }

            }
        } else {
            if (*mouseOldClickPtr == true) clickedOn = false;
            barClicked = false;
        }

    } else {
        clickedOn = false;
        barClicked = false;
    }


    // Calculate scrollbar size and position
    int sliderRange = (maxVal-minVal);
    int sliderXsize = ((mui::HScrollBar::w-1)-20)-sliderRange;
    int sliderXpos;


    if (sliderXsize < 16) {
        sliderXsize = 16;
        sliderXpos = (bx1+10)+((sliderRange*(((float)mui::HScrollBar::w-36)/sliderRange))*(((float)value-minVal)/sliderRange));
    } else {
        sliderXpos = (bx1+10)+((mui::HScrollBar::w-20)-sliderXsize)*(((float)value-minVal)/sliderRange);
    }


    if (barClicked) {
        sliderXpos = (bx1+10)+(*mouseXposPtr-clickPos);
        if (sliderXpos < (bx1+10)) sliderXpos = bx1+10;
        if (sliderXpos > ((bx2-10)-sliderXsize)) sliderXpos = (bx2-10)-sliderXsize;
        value = minVal + (sliderRange* ( ((float)sliderXpos-(bx1+10))/ sliderRange ) );
        if (value < minVal) value = minVal;
        if (value > maxVal) value = maxVal;
    }


    if ((status == 1) && (clickedOn == true)) {
        if (InBox(*mouseXposPtr, *mouseYposPtr, sliderXpos, by1, sliderXpos+sliderXsize, by2)) {
            clickPos = (bx1+10)+(*mouseXposPtr-sliderXpos);
            barClicked = true;
        }
    }


    if (status == 3) {
        DrawPanel(bx1, by1, bx1+9, by2, mui::HScrollBar::col, mui::PanelStyle::InButton);
    } else {
        DrawPanel(bx1, by1, bx1+9, by2, mui::HScrollBar::col, mui::PanelStyle::OutButton);
    }

    if (status == 4) {
        DrawPanel(bx2-9, by1, bx2, by2, mui::HScrollBar::col, mui::PanelStyle::InButton);
    } else {
        DrawPanel(bx2-9, by1, bx2, by2, mui::HScrollBar::col, mui::PanelStyle::OutButton);
    }


    struct vert {
        int x,y;
        u_int col;
    } verts[8];

    verts[0] = (vert){ lArrowX+2    , lArrowY-2 , 0xffffffff };
    verts[1] = (vert){ lArrowX      , lArrowY   , 0xffffffff };
    verts[2] = (vert){ lArrowX      , lArrowY   , 0xffffffff };
    verts[3] = (vert){ lArrowX+3    , lArrowY+3 , 0xffffffff };

    verts[4] = (vert){ rArrowX-2    , rArrowY-2 , 0xffffffff };
    verts[5] = (vert){ rArrowX      , rArrowY   , 0xffffffff };
    verts[6] = (vert){ rArrowX      , rArrowY   , 0xffffffff };
    verts[7] = (vert){ rArrowX-3    , rArrowY+3 , 0xffffffff };

    if (status == 3) {
        verts[0].x++; verts[0].y++;
        verts[1].x++; verts[1].y++;
        verts[2].x++; verts[2].y++;
        verts[3].x++; verts[3].y++;
    } else if (status == 4) {
        verts[4].x++; verts[4].y++;
        verts[5].x++; verts[5].y++;
        verts[6].x++; verts[6].y++;
        verts[7].x++; verts[7].y++;
    }

    glDisable(GL_TEXTURE_2D);
    glDisable(GL_LIGHTING);

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);

    glVertexPointer(2, GL_INT, sizeof(vert), &verts[0].x);
    glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(vert), &verts[0].col);

    glDrawArrays(GL_LINES, 0, 8);


    DrawPanel(bx1+10, by1, bx2-10, by2, mui::HScrollBar::col, mui::PanelStyle::TextBox);

    if (barClicked) {
        DrawPanel(sliderXpos, by1, sliderXpos+sliderXsize, by2, mui::HScrollBar::col, mui::PanelStyle::InButton);
    } else {
        DrawPanel(sliderXpos, by1, sliderXpos+sliderXsize, by2, mui::HScrollBar::col, mui::PanelStyle::OutButton);
    }

}
Ejemplo n.º 24
0
void CglList::Draw()
{
	// dont call Mouse[XY] if we're being used in CPreGame (when gu or mouse is still NULL)
	float mx = (gu && mouse) ? MouseX(mouse->lastx) : 0;
	float my = (gu && mouse) ? MouseY(mouse->lasty) : 0;

	glDisable(GL_TEXTURE_2D);
	glDisable(GL_ALPHA_TEST);
	glEnable(GL_BLEND);
	glLoadIdentity();
	glColor4f(0.2f,0.2f,0.2f,guiAlpha);
	DrawBox(box);

	glColor4f(1,1,0.4f,0.8f);
	font->glPrintAt(box.x1 + 0.01f, box.y2 - 0.05f, itemFontScale*0.7f, name.c_str());

	/****************************************
	* Insert Robert Diamond's section here *
	* <*****@*****.**> *
	****************************************/

	/****************************************
	* TODO: *
	* *
	* This part of the code will need some *
	* math, and it's been a while since I *
	* did any 3D coding... the idea is to *
	* keep the selected item in the middle *
	* 60% of the screen, but don't scroll *
	* till we reach one end, or the other *
	* of that boundary. We'd also need the *
	* "oldPlace" variable to do this *
	* properly. *
	* *
	****************************************
	// Get screen res, so that the selected item is always within the middle 60% of screen
	int iResX = configHandler.GetInt("XResolution", 1024);
	int iResY = configHandler.GetInt("YResolution", 768);

	// Keep tabs on the last place. change this ONLY AFTER a scroll
	static int siOldPlace = place;

	if (we're scrolling up) siOldPlace = place;
	if (we're scrolling down) siOldPlace = place;
	if (we're not scrolling) siOldPlace = siOldPlace;

	**************************************
	* Hey remove me when TODO is done XD *
	**************************************/

	int nCurIndex = 0; // The item we're on
	int nDrawOffset = 0; // The offset to the first draw item
	ContainerBox b = box;

	b.x1 += 0.01f;
	b.x2 -= 0.01f;

	// Get list started up here
	std::vector<std::string>::iterator ii = filteredItems->begin();
	// Skip to current selection - 3; ie: scroll
	while ((nCurIndex + 7) <= place && nCurIndex+13 <= filteredItems->size()) { ii++; nCurIndex++; }

	for (/*ii = items.begin()*/; ii != filteredItems->end() && nDrawOffset < 12; ii++)
	{
		glLoadIdentity();

		b.y2 = box.y2 - 0.06f - (nDrawOffset * 0.06f);
		b.y1 = b.y2 - 0.05f;

		// TODO lots of this should really be merged with GuiHandler.cpp
		// (as in, factor out the common code...)

		glColor4f(1,1,1,0.1f);
		DrawBox(b, GL_LINE_LOOP);

		if (nCurIndex == place) {
			glBlendFunc(GL_ONE, GL_ONE); // additive blending
			glColor4f(0.2f,0,0,1);
			DrawBox(b);
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			glColor4f(1,0,0,0.5f);
			glLineWidth(1.49f);
			DrawBox(b, GL_LINE_LOOP);
			glLineWidth(1.0f);
		} else if (InBox(mx, my, b)) {
			glBlendFunc(GL_ONE, GL_ONE); // additive blending
			glColor4f(0,0,0.2f,1);
			DrawBox(b);
			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
			glColor4f(1,1,1,0.5f);
			glLineWidth(1.49f);
			DrawBox(b, GL_LINE_LOOP);
			glLineWidth(1.0f);
		}

		const float dShadow = 0.002f;
		const float xStart = box.x1 + itemXMargin;
		const float yStart = b.y1 + 0.002f;

		glColor4f(0.0f, 0.0f, 0.0f, 0.8f);
		font->glPrintAt(xStart + dShadow, yStart - dShadow, itemFontScale, ii->c_str());

		glColor4f(1,1,1,0.8f);
		font->glPrintAt(xStart, yStart, itemFontScale, ii->c_str());

		// Up our index's
		nCurIndex++; nDrawOffset++;
	}
	/**************
	* End insert *
	**************/
	glLoadIdentity();
}