예제 #1
0
void MisOrd(char num)
{
    int i, j = 0;

    ShBox(63, 19, 257, 173);
    InBox(74, 36, 246, 163);
    display::graphics.setForegroundColor(36);
    draw_string(77, 30, "       LAUNCH ORDER");

    for (i = 0; i < num; i++) {
        InBox(78, 39 + 21 * j, 105, 55 + 21 * j);
        draw_small_flag(Order[i].plr, 79, 40 + 21 * j);
        display::graphics.setForegroundColor(34);
        draw_string(110, 45 + 21 * j, "SCHEDULED LAUNCH");
        draw_string(110, 52 + 21 * j, "DATE: ");
        display::graphics.setForegroundColor(1);

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

        draw_string(0, 0, " 19");
        draw_number(0, 0, Data->Year);
        j++;
    };

    FadeIn(2, display::graphics.palette(), 10, 0, 0);

    WaitForMouseUp();

    WaitForKeyOrMouseDown();

    WaitForMouseUp();

    FadeOut(2, display::graphics.palette(), 10, 0, 0);
}
예제 #2
0
void MisOrd(char num)
{
    int i, j = 0;

    ShBox(63, 19, 257, 173);
    InBox(74, 36, 246, 163);
    grSetColor(36);
    PrintAt(77, 30, "       LAUNCH ORDER");

    for (i = 0; i < num; i++) {
        InBox(78, 39 + 21 * j, 105, 55 + 21 * j);
        FlagSm(Order[i].plr, 79, 40 + 21 * j);
        grSetColor(34);
        PrintAt(110, 45 + 21 * j, "SCHEDULED LAUNCH");
        PrintAt(110, 52 + 21 * j, "DATE: ");
        grSetColor(1);

        PrintAt(0, 0,
                Month[Data->P[Order[i].plr].Mission[Order[i].loc].Month]);

        PrintAt(0, 0, " 19");
        DispNum(0, 0, Data->Year);
        j++;
    };

    FadeIn(2, pal, 10, 0, 0);

    WaitForMouseUp();

    WaitForKeyOrMouseDown();

    WaitForMouseUp();

    FadeOut(2, pal, 10, 0, 0);
}
예제 #3
0
/*
 * Function: GetTrianglePoints
 * Usage: GetTrianglePoints(tri)
 * -----------------------------------
 * This function watches the user click three points on the Graphics Console.
 * The function notes the location of those points by loading the 'tri' array
 * with three pointT structs.
 * The function connects the dots to create a triangle on the screen.
 * Graphics should already be initialized.  We assume working with triangles,
 * but the constant nPOINTS will let us see if this works for four points.
 */
void GetTrianglePoints(pointT tri[]) {
    int pt_ct = 0;
    while ( pt_ct < nPOINTS ) {
        //cout << "got to this point" << endl;
        WaitForMouseDown();
        WaitForMouseUp();
        tri[pt_ct].xp = GetMouseX();
        tri[pt_ct].yp = GetMouseY();
        if ( pt_ct == 0 )
        {
            MovePen(tri[0].xp, tri[0].yp);
        }
        else
        {
            DrawLine(
                (tri[pt_ct].xp - tri[pt_ct - 1].xp ),
                (tri[pt_ct].yp - tri[pt_ct - 1].yp )
                    );
        }
        UpdateDisplay();
        pt_ct ++;
    }

    // Connect the third and first points of the triangle with lines
    DrawLine(
        (tri[0].xp - tri[nPOINTS - 1].xp ),
        (tri[0].yp - tri[nPOINTS - 1].yp )
            );
    UpdateDisplay();
}
/** Draws stuff about choosing a program and having < 2 groups available
 * 
 * \deprecated This function appears to be deprecated. 
 */
char FutBad(void)
{
  char i;
  
  grSetColor(0);
  ShBox(84,41,232,128);
  InBox(91,47,225,103);
  IOBox(91,107,225,123);
  grSetColor(1);
  PrintAt(150,117,"EXIT");
  grSetColor(11);
  PrintAt(96,60,"YOU HAVE SELECTED A");
  PrintAt(96,70,"PROGRAM WITH LESS THAN");
  PrintAt(96,80,"TWO GROUPS AVAILABLE.");
  
  WaitForMouseUp();
  i=0;
  while(i==0) {
  GetMouse();
   if (mousebuttons!=0) {
     if (x>=93 && y>=109 && x<=223 && y<=121) {
       InBox(93,109,223,123);i=3;
       delay(50);
     };
   };
  }; /* End while */
  return (i);
}
예제 #5
0
파일: graphics.cpp 프로젝트: ej2xu/cs106b
void createTriangle(Point &v1, Point &v2, Point &v3) {
    int count = 0;
    while(count < 3) {
        WaitForMouseDown();
        WaitForMouseUp();
        double X = GetMouseX();
        double Y = GetMouseY();
        /* log points */
        if (count == 0) {
            MovePen(X, Y);
            v1.X = X;
            v1.Y = Y;
        } else if (count == 1) {
            v2.X = X;
            v2.Y = Y;
            DrawLine(v2.X - v1.X, v2.Y - v1.Y);
        } else {
            v3.X = X;
            v3.Y = Y;
            DrawLine(v3.X - v2.X, v3.Y - v2.Y);
            // close triangle
            DrawLine(v1.X - v3.X, v1.Y - v3.Y);
        }
        count++;
    }
}
예제 #6
0
pointT GetMouseClick() {
	WaitForMouseDown();
	WaitForMouseUp();
	pointT pt;
	pt.x = int(GetMouseX());
	pt.y = int(GetMouseY());
	return pt;
}
예제 #7
0
/* Function: GetMouseClick
 * Usage:  loc = GetMouseClick();
 * ------------------------------
 * Waits for the user to click somewhere on the graphics window
 * and returns the coordinate of where the click took place.
 */
coordT GetMouseClick()
{
	coordT where;
	WaitForMouseDown();
	WaitForMouseUp();
	where.x = GetMouseX();
	where.y = GetMouseY();
	return where;
}
예제 #8
0
void Review(char plr)
{
    DrawReview(plr);
    music_start((plr == 0) ? M_PRES : M_RD);
    WaitForMouseUp();

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

        if (mousebuttons > 0 || key > 0) { /* Game Play */
            if ((x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) {
                InBox(245, 5, 314, 17);
                WaitForMouseUp();
                music_stop();
                return;  /* Done */
            }
        }
    }
}
예제 #9
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;
}
예제 #10
0
void Limbo(char plr)
{
    int i, AstroList[100], BarA, count, now2, tag = 0;
    memset(AstroList, -1, sizeof AstroList);
    DrawLimbo(plr);
    music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY);

    now2 = BarA = count = 0;
    ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);

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

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

    if (count > 0) {
        LimboText(plr, AstroList[now2]);
    }

    FadeIn(2, 10, 0, 0);

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

        //Mouse ManSelect from being Clicked on
        for (i = 0; i < 8; i++) {
            if (x >= 27 && y >= (131 + i * 8) && x <= 151 && y <= (137 + i * 8) && mousebuttons > 0 && (now2 - BarA + i) <= (count - 1)) {
                now2 -= BarA;
                now2 += i;
                BarA = i;
                fill_rectangle(26, 129, 153, 195, 0);
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);
                DispLeft(plr, BarA, count, now2, &AstroList[0]);
                LimboText(plr, AstroList[now2]);
                WaitForMouseUp();

            }
        }

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

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

                if (mousebuttons == 0) {

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

                    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, &AstroList[0]);
                        LimboText(plr, AstroList[now2]);
                    };

                    i = 51;
                }
            }

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

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

                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, &AstroList[0]);
                    LimboText(plr, AstroList[now2]);
                };

                key = 0;

                GetMouse();
            }

            //WaitForMouseUp();key=0;
            OutBox(6, 130, 18, 161);
            delay(10);
        };

        // Left Arrow Down
        if ((mousebuttons > 0 && x >= 6 && y >= 163 && x <= 18 && y <= 194 && count > 0) || key == DN_ARROW) {
            InBox(6, 163, 18, 194);

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

                if (mousebuttons == 0) {

                    if (BarA == 7 && (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, &AstroList[0]);
                        LimboText(plr, AstroList[now2]);
                    };

                    if (BarA < 7 && 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, &AstroList[0]);
                        LimboText(plr, AstroList[now2]);
                    };

                    i = 51;
                }
            }

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

                if (BarA == 7 && (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, &AstroList[0]);
                    LimboText(plr, AstroList[now2]);
                };

                if (BarA < 7 && 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, &AstroList[0]);
                    LimboText(plr, AstroList[now2]);
                };

                key = 0;

                GetMouse();
            }

            //key=0;WaitForMouseUp();key=0;
            OutBox(6, 163, 18, 194);
            delay(10);
        };

        // Continue
        if ((mousebuttons > 0 && x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) {
            InBox(245, 5, 314, 17);
            WaitForMouseUp();

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

            OutBox(245, 5, 314, 17);
            music_stop();
            return;
        }

        // Select Transfer Button
        if ((mousebuttons > 0 && x >= 167 && y >= 48 && x <= 239 && y <= 65) || key == LT_ARROW) {
            tag = 0;
            InBox(167, 48, 239, 65);
            OutBox(241, 48, 313, 65);
            fill_rectangle(166, 78, 314, 88, 10);
            display::graphics.setForegroundColor(11);
            draw_string(185, 85, "TRANSFER TO LOCATION");

        }

        // Select Visit To Button
        if ((mousebuttons > 0 && x >= 241 && y >= 48 && x <= 313 && y <= 65) || key == RT_ARROW) {
            tag = 1;
            InBox(241, 48, 313, 65);
            OutBox(167, 48, 239, 65);
            fill_rectangle(166, 78, 314, 88, 10);
            display::graphics.setForegroundColor(11);
            draw_string(203, 85, "VISIT LOCATION");

        }

        // Selection Loops
        for (i = 0; i < 5; i++) {
            // Program Transfer
            if ((tag == 0 && Data->P[plr].Manned[i].Num >= 0) &&
                ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i))
                 || key == 0x0030 + i)) {
                InBox(167, 95 + 21 * i, 236, 109 + 21 * i);

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

                WaitForMouseUp();
                key = 0;
                OutBox(167, 95 + 21 * i, 236, 109 + 21 * i);
                Data->P[plr].Pool[AstroList[now2]].Assign = i + 1;
                Data->P[plr].Pool[AstroList[now2]].Unassigned = 0;
                Data->P[plr].Pool[AstroList[now2]].Moved = 0;

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

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

                if (count == 0) {
                    fill_rectangle(10, 52, 89, 101, 7 + plr * 3);
                    Clear();
                }

                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, &AstroList[0]);

                if (count > 0) {
                    LimboText(plr, AstroList[now2]);
                }

            }

            // Program Visit
            if ((tag == 1 && Data->P[plr].Manned[i].Num >= 0) &&
                ((mousebuttons > 0 && x >= 167 && y >= (95 + 21 * i) && x <= 236 && y <= (109 + 21 * i))
                 || key == 0x0030 + i)) {
                InBox(167, 95 + 21 * i, 236, 109 + 21 * i);

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

                WaitForMouseUp();
                key = 0;
                OutBox(167, 95 + 21 * i, 236, 109 + 21 * i);
                music_stop();
                Programs(plr, i + 1);
                DrawLimbo(plr);
                music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY);

                InBox(241, 48, 313, 65);
                OutBox(167, 48, 239, 65);
                fill_rectangle(166, 78, 314, 88, 10);
                display::graphics.setForegroundColor(11);
                draw_string(203, 85, "VISIT LOCATION");
                fill_rectangle(26, 129, 153, 195, 0);
                now2 = BarA = count = 0;
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);

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

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

                if (count > 0) {
                    LimboText(plr, AstroList[now2]);
                }

                //   ShBox(26,130+BarA*8,152,138+BarA*8);
                //   DispLeft(plr,BarA,count,now2,&AstroList[0]);
                //   LimboText(plr,AstroList[now2]);
                FadeIn(2, 10, 0, 0);

            }


            // Training Transfer
            if ((tag == 0 && count > 0) && ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) {
                InBox(244, 95 + 21 * i, 313, 109 + 21 * i);

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

                WaitForMouseUp();
                key = 0;
                OutBox(244, 95 + 21 * i, 313, 109 + 21 * i);

                skilLev = 0; // Figure out relevant skill level bfr sending to Adv Training -Leon

                if (i == 0) {
                    skilLev = Data->P[plr].Pool[AstroList[now2]].Cap;
                }

                if (i == 1) {
                    skilLev = Data->P[plr].Pool[AstroList[now2]].LM;
                }

                if (i == 2) {
                    skilLev = Data->P[plr].Pool[AstroList[now2]].EVA;
                }

                if (i == 3) {
                    skilLev = Data->P[plr].Pool[AstroList[now2]].Docking;
                }

                if (i == 4) {
                    skilLev = Data->P[plr].Pool[AstroList[now2]].Endurance;
                }

                display::graphics.setForegroundColor(2);

                if (Data->P[plr].Pool[AstroList[now2]].TrainingLevel > 6) {
                    Help("i120");
                } else if (skilLev > 3) {
                    OutBox(244, 95 + 21 * i, 313, 109 + 21 * i); // If they have a 4 in that skill, don't send to Adv Training for it
                } else if (Data->P[plr].Cash < 3) {
                    Help("i121");
                } else {
                    if (skilLev > 2) { // If they have a 3 in that skill, send them directly to Adv III and charge just 2MB
                        Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_3;
                        Data->P[plr].Cash -= 2;
                    } else {
                        Data->P[plr].Pool[AstroList[now2]].Status = AST_ST_TRAIN_ADV_1;
                        Data->P[plr].Cash -= 3;
                    }

                    Data->P[plr].Pool[AstroList[now2]].Focus = i + 1;
                    Data->P[plr].Pool[AstroList[now2]].Assign = 0;
                    Data->P[plr].Pool[AstroList[now2]].Unassigned = 0;
                    Data->P[plr].Pool[AstroList[now2]].Moved = 0;

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

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

                    if (count == 0) {
                        fill_rectangle(10, 52, 89, 101, 7 + plr * 3);
                        Clear();
                    }

                    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, &AstroList[0]);

                    if (count > 0) {
                        LimboText(plr, AstroList[now2]);
                    }
                } // else
            }  // if adv training

            // Training Visit
            if (tag == 1 &&
                ((mousebuttons > 0 && x >= 244 && y >= (95 + 21 * i) && x <= 313 && y <= (109 + 21 * i)) || key == 0x0035 + i)) {
                InBox(244, 95 + 21 * i, 313, 109 + 21 * i);

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

                WaitForMouseUp();
                key = 0;
                OutBox(244, 95 + 21 * i, 313, 109 + 21 * i);
                music_stop();
                Train(plr, i + 1);
                DrawLimbo(plr);
                music_start((plr == 0) ? M_ASTTRNG : M_ASSEMBLY);

                fill_rectangle(166, 78, 314, 88, 10);
                display::graphics.setForegroundColor(11);
                draw_string(203, 85, "VISIT LOCATION");
                InBox(241, 48, 313, 65);
                OutBox(167, 48, 239, 65);
                fill_rectangle(26, 129, 153, 195, 0);
                now2 = BarA = count = 0;
                ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8);

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

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

                if (count > 0) {
                    LimboText(plr, AstroList[now2]);
                }

                FadeIn(2, 10, 0, 0);

            }
        }

    };  /* end while */
} /* end Limbo */
예제 #11
0
void Rush(char plr)
{
    int i, R1, R2, R3, oR1, oR2, oR3, dgflag[3] = {0, 0, 0};
    char pRush = 0;

    R1 = R2 = R3 = oR1 = oR2 = oR3 = 0;
    fCsh = 0;
    DrawRush(plr);
    pRush = (Data->P[plr].Cash >= 3) ? 1 : 0;
    fCsh = Data->P[plr].Cash;
    display::graphics.setForegroundColor(1);
    music_start((plr == 1) ? M_USMIL : M_USSRMIL);
    FadeIn(2, display::graphics.palette(), 10, 0, 0);
    WaitForMouseUp();

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

        if (mousebuttons > 0 || key > 0) {
            if (((y >= 32 && y <= 74 && x >= 280 && x <= 312 && mousebuttons > 0) || (key >= '1' && key <= '3'))
                && pRush && Data->P[plr].Mission[0].MissionCode && Data->P[plr].Mission[0].part != 1) { /* L1: Row One */
                // R1=oR1;
                if (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && oR1 != 1 && fCsh < 3) {
                    Help("i117");
                }

                R1 = (((y >= 49 && y <= 57 && mousebuttons > 0) || key == '2') && fCsh >= 3) ? 1 : R1;

                if (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && oR1 != 2 && fCsh < 6) {
                    Help("i117");
                }

                R1 = (((y >= 66 && y <= 74 && mousebuttons > 0) || key == '3') && fCsh >= 6) ? 2 : R1;
                R1 = ((y >= 32 && y <= 40 && mousebuttons > 0) || key == '1') ? 0 : R1;

                if (oR1 != R1) {
                    ResetRush(oR1, 0);
                    SetRush(R1, 0);
                    oR1 = R1;
                }
            } else if (((x >= 280 && x <= 312 && y >= 90 && y <= 132 && mousebuttons > 0) || (key >= '4' && key <= '6'))
                       && pRush && Data->P[plr].Mission[1].MissionCode && Data->P[plr].Mission[1].part != 1) { /* L2: Row One */
                // R2=oR2;
                if (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && oR2 != 1 && fCsh < 3) {
                    Help("i117");
                }

                R2 = (((y >= 107 && y <= 115 && mousebuttons > 0) || key == '5') && fCsh >= 3) ? 1 : R2;

                if (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && oR2 != 2 && fCsh < 6) {
                    Help("i117");
                }

                R2 = (((y >= 124 && y <= 132 && mousebuttons > 0) || key == '6') && fCsh >= 6) ? 2 : R2;
                R2 = ((y >= 90 && y <= 98 && mousebuttons > 0) || key == '4') ? 0 : R2;

                if (oR2 != R2) {
                    ResetRush(oR2, 1);
                    SetRush(R2, 1);
                    oR2 = R2;
                }
            } else if (((x >= 280 && x <= 312 && y >= 148 && y <= 190 && mousebuttons > 0) || (key >= '7' && key <= '9'))
                       && pRush && Data->P[plr].Mission[2].MissionCode && Data->P[plr].Mission[2].part != 1) { /* L3: Row One */
                // R3=oR3;
                if (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && oR3 != 1 && fCsh < 3) {
                    Help("i117");
                }

                R3 = (((y >= 165 && y <= 173 && mousebuttons > 0) || key == '8') && fCsh >= 3) ? 1 : R3;

                if (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && oR3 != 2 && fCsh < 6) {
                    Help("i117");
                }

                R3 = (((y >= 182 && y <= 190 && mousebuttons > 0) || key == '9') && fCsh >= 6) ? 2 : R3;
                R3 = ((y >= 148 && y <= 156 && mousebuttons > 0) || key == '7') ? 0 : R3;

                if (oR3 != R3) {
                    ResetRush(oR3, 2);
                    SetRush(R3, 2);
                    oR3 = R3;
                }
            };

            // DOWNGRADE MISSION KEYBOARD
            if (key == 'Q' || key == 'R' || key == 'U') {
                if (key == 'Q') {
                    i = 0;
                } else if (key == 'R') {
                    i = 1;
                } else if (key == 'U') {
                    i = 2;
                } else {
                    i = 0;
                }

                if (Data->P[plr].Mission[i].MissionCode && Data->P[plr].Mission[i].part != 1) {

                    InBox(91, 41 + i * 58, 264, 59 + i * 58);
                    fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3);

                    if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) {
                        fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3);

                        display::graphics.setForegroundColor(5);
                        GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]);

                        draw_string(96, 48 + 58 * i, Mis.Abbr);

                        if (Mis.Dur >= 1) {
                            switch (Data->P[plr].Mission[i].Duration) {
                            case 1:
                                draw_string(0, 0, "");
                                break;

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

                            case 3:
                                draw_string(0, 0, " (C)");
                                break;

                            case 4:
                                draw_string(0, 0, " (D)");
                                break;

                            case 5:
                                draw_string(0, 0, " (E)");
                                break;

                            case 6:
                                draw_string(0, 0, " (F)");
                                break;

                            default:
                                draw_string(0, 0, "");
                                break;
                            }
                        }

                        //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0);

                        dgflag[i]++;
                        fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3);
                        display::graphics.setForegroundColor(9);
                        draw_string(145, 33 + i * 58, "DOWNGRADED MISSION");
                        draw_string(193, 77 + i * 58, "-3 PRESTIGE");
                    } else {
                        dgflag[i] = 0;
                        fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3);
                        display::graphics.setForegroundColor(5);
                        GetMisType(Data->P[plr].Mission[i].MissionCode);

                        draw_string(96, 48 + 58 * i, Mis.Abbr);

                        if (Mis.Dur >= 1) {
                            switch (Data->P[plr].Mission[i].Duration) {
                            case 1:
                                draw_string(0, 0, "");
                                break;

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

                            case 3:
                                draw_string(0, 0, " (C)");
                                break;

                            case 4:
                                draw_string(0, 0, " (D)");
                                break;

                            case 5:
                                draw_string(0, 0, " (E)");
                                break;

                            case 6:
                                draw_string(0, 0, " (F)");
                                break;

                            default:
                                draw_string(0, 0, "");
                                break;
                            }
                        }

                        //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0);
                        fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3);

                        if (Data->P[plr].Mission[i].Name[24] == 1) {
                            display::graphics.setForegroundColor(9);
                            draw_string(145, 33 + i * 58, "DOWNGRADED MISSION");
                            draw_string(193, 77 + i * 58, "-3 PRESTIGE");
                        } else {
                            display::graphics.setForegroundColor(7);
                            draw_string(145, 33 + i * 58, "ORIGINAL MISSION");
                            draw_string(193, 77 + i * 58, "NO PENALTY");
                        }

                        //display::graphics.setForegroundColor(7);
                        //draw_string(145,33+i*58,"ORIGINAL MISSION");
                        //draw_string(193,77+i*58,"NO PENALTY");
                    }

                    WaitForMouseUp();
                    OutBox(91, 41 + i * 58, 264, 59 + i * 58);

                }
            };

            for (i = 0; i < 3; i++) {
                if (x >= 91 && x <= 264 && y >= 41 + i * 59 && y <= 59 + i * 59 && mousebuttons > 0
                    && Data->P[plr].Mission[i].MissionCode
                    && Data->P[plr].Mission[i].part != 1) { // Downgrade

                    InBox(91, 41 + i * 58, 264, 59 + i * 58);
                    fill_rectangle(144, 29 + i * 58, 270, 37 + i * 58, 3);

                    if (dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]] != 0) {
                        fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3);
                        display::graphics.setForegroundColor(5);
                        GetMisType(dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]]);
                        draw_string(96, 48 + 58 * i, Mis.Abbr);

                        if (Mis.Dur >= 1) {
                            switch (Data->P[plr].Mission[i].Duration) {
                            case 1:
                                draw_string(0, 0, "");
                                break;

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

                            case 3:
                                draw_string(0, 0, " (C)");
                                break;

                            case 4:
                                draw_string(0, 0, " (D)");
                                break;

                            case 5:
                                draw_string(0, 0, " (E)");
                                break;

                            case 6:
                                draw_string(0, 0, " (F)");
                                break;

                            default:
                                draw_string(0, 0, "");
                                break;
                            }
                        }

                        //Missions(plr,96,48+58*i,dg[Data->P[plr].Mission[i].MissionCode][dgflag[i]],0);
                        dgflag[i]++;
                        fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3);
                        display::graphics.setForegroundColor(9);
                        draw_string(145, 33 + i * 58, "DOWNGRADED MISSION");
                        draw_string(193, 77 + i * 58, "-3 PRESTIGE");
                    } else {
                        dgflag[i] = 0;
                        fill_rectangle(93, 43 + i * 58, 262, 57 + i * 58, 3);
                        display::graphics.setForegroundColor(5);
                        GetMisType(Data->P[plr].Mission[i].MissionCode);

                        draw_string(96, 48 + 58 * i, Mis.Abbr);

                        if (Mis.Dur >= 1) {
                            switch (Data->P[plr].Mission[i].Duration) {
                            case 1:
                                draw_string(0, 0, "");
                                break;

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

                            case 3:
                                draw_string(0, 0, " (C)");
                                break;

                            case 4:
                                draw_string(0, 0, " (D)");
                                break;

                            case 5:
                                draw_string(0, 0, " (E)");
                                break;

                            case 6:
                                draw_string(0, 0, " (F)");
                                break;

                            default:
                                draw_string(0, 0, "");
                                break;
                            }
                        }

                        //Missions(plr,96,48+58*i,Data->P[plr].Mission[i].MissionCode,0);
                        fill_rectangle(191, 71 + i * 58, 270, 78 + i * 58, 3);

                        if (Data->P[plr].Mission[i].Name[24] == 1) {
                            display::graphics.setForegroundColor(9);
                            draw_string(145, 33 + i * 58, "DOWNGRADED MISSION");
                            draw_string(193, 77 + i * 58, "-3 PRESTIGE");
                        } else {
                            display::graphics.setForegroundColor(7);
                            draw_string(145, 33 + i * 58, "ORIGINAL MISSION");
                            draw_string(193, 77 + i * 58, "NO PENALTY");
                        }

                        //display::graphics.setForegroundColor(7);
                        //draw_string(145,33+i*58,"ORIGINAL MISSION");
                        //draw_string(193,77+i*58,"NO PENALTY");
                    }

                    WaitForMouseUp();
                    OutBox(91, 41 + i * 58, 264, 59 + i * 58);

                }
            };

            if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { //  CONTINUE
                InBox(245, 5, 314, 17);
                WaitForMouseUp();

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

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

                for (i = 0; i < 3; i++) {
                    if (Data->P[plr].Mission[i].MissionCode) {
                        if (dgflag[i] != 0) {
                            Data->P[plr].Mission[i].MissionCode = dg[Data->P[plr].Mission[i].MissionCode][dgflag[i] - 1];
                            pNeg[plr][i] = 1;
                        }
                    }
                }

                if (Data->P[plr].Mission[1].part == 1) {
                    R2 = R1;
                }

                if (Data->P[plr].Mission[2].part == 1) {
                    R3 = R2;
                }

                if (Data->P[plr].Mission[0].MissionCode && Data->P[plr].Cash >= 3 * R1) {
                    Data->P[plr].Cash -= 3 * R1;
                    Data->P[plr].Mission[0].Month -= R1;
                    Data->P[plr].Mission[0].Rushing = R1;
                };

                if (Data->P[plr].Mission[1].MissionCode && Data->P[plr].Cash >= 3 * R2) {
                    Data->P[plr].Cash -= 3 * R2;
                    Data->P[plr].Mission[1].Month -= R2;
                    Data->P[plr].Mission[1].Rushing = R2;
                };

                if (Data->P[plr].Mission[2].MissionCode && Data->P[plr].Cash >= 3 * R3) {
                    Data->P[plr].Cash -= 3 * R3;
                    Data->P[plr].Mission[2].Month -= R3;
                    Data->P[plr].Mission[2].Rushing = R3;
                }

                music_stop();
                return;  // Done
            }
        }
    }
}
예제 #12
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);
}
void
Future(char plr)
{
    /** \todo the whole Future()-function is 500 >lines and unreadable */
    TRACE1("->Future(plr)");
	int MisNum = 0, DuraType = 0, MaxDur = 6, i, ii;
	int setting = -1, prev_setting = -1;
	int Ok, NewType;
	GXHEADER local, local2;

	GV(&local, 166, 9);
	GV(&local2, 177, 197);
    GV(&vh,240,90);                  /* global variable */
  begfut:
	MisNum = FutureCheck(plr, 0);
	if (MisNum == 5)
	{
		DV(&local);
		DV(&local2);
        DV(&vh);
		return;
	}

	F1 = F2 = F3 = F4 = FMen = F5 = 0;
	// memset(buffer, 0x00, 20000);
	for (i = 0; i < 5; i++)
		lck[i] = status[i] = 0;
	SetParameters();
	strcpy(IDT, "i011");
	Pad = MisNum;
	DuraType = FMen = MisType = 0;
	ClrFut(plr, MisNum);
	DrawFuture(plr, MisType, MisNum);
begfut_noredraw:
  
//  for (i=0;i<5;i++) ClearRX(i+1);
	while (1)
	{
		GetMouse();
		if (mousebuttons == 0)
			break;
	}
	while (1)
	{
		GetMouse();

		prev_setting = setting;
		setting = -1;

		if (key == '-' && SEG > 1)
			SEG--;

		if (key == '+' && SEG < 500)
			SEG++;

		if (key >= 65 && key < Bub_Count + 65)
			setting = key - 65;

		for (ii = 0; ii < Bub_Count; ii++)
		{
			if (x >= StepBub[ii].x_cor && x <= StepBub[ii].x_cor + 7
				&& y >= StepBub[ii].y_cor && y <= StepBub[ii].y_cor + 7)
				setting = ii;
		}

		if (setting >= 0)
		{
			if (prev_setting < 0)
				gxGetImage(&local, 18, 186, 183, 194, 0);

			if (prev_setting != setting)
			{
				ShBox(18, 186, 183, 194);
				grSetColor(1);
				MisStep(21, 192, Mev[setting].loc);
			}
		}
		else if (setting < 0 && prev_setting >= 0)
		{
			gxPutImage(&local, gxSET, 18, 186, 0);
		}

		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);
			gxGetImage(&local2, 74, 3, 250, 199, 0);
			NewType = V[MisType].X;
			Data->P[plr].Future[MisNum].Duration = DuraType;

			Ok = HardCrewAssign(plr, Pad, MisType, NewType);

			gxPutImage(&local2, gxSET, 74, 3, 0);
			// DV(&local2);
			if (Ok == 1)
			{
				Data->P[plr].Future[MisNum].Duration = DuraType;
				goto begfut;	   // return to loop
			}
			else
			{
				ClrFut(plr, MisNum);
				// DuraType = FMen = MisType = 0;
				key = 0;
                goto begfut_noredraw;
				// DrawFuture(plr, MisType, MisNum);
			}
			key = 0;
		};
		// continue

		if ((((x >= 5 && y >= 49 && x <= 53 && y <= 72) || (x >= 43
						&& y >= 74 && x <= 53 && y <= 82))
				&& mousebuttons > 0) || (key == '!' || key == '1'))
		{
			if ((x >= 43 && y >= 74 && x <= 53 && y <= 82) || key == '!')
			{

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

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
			}
			else if (lck[0] != 1)
			{
				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;

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
				grSetColor(34);
				OutBox(5, 49, 53, 72);
			};
			key = 0;
			/* Duration */
		};
		if ((x >= 5 && y >= 74 && x <= 41 && y <= 82 && mousebuttons > 0)
			|| (key == K_ESCAPE))
		{
			InBox(5, 74, 41, 82);
			while (1)
			{
				GetMouse();
				if (mousebuttons == 0)
					break;
			}
			MisType = 0;
			if (DuraType != 0)
				Toggle(5, 0);
			FMen = DuraType = F1 = F2 = F3 = F4 = F5 = 0;
			for (i = 1; i < 4; i++)
				if (status[i] != 0)
					Toggle(i, 1);
			if (JointFlag == 0)
			{
				F4 = 2;
				lck[4] = 1;
				Toggle(4, 1);
				InBox(191, 74, 201, 82);
				PlaceRX(5);
				TogBox(166, 49, 1);
			}
			else
			{
				F4 = 0;
				lck[4] = 0;
				status[4] = 0;
				Toggle(4, 1);
				OutBox(191, 74, 201, 82);
				ClearRX(5);
				TogBox(166, 49, 0);
			};
			for (i = 0; i < 4; i++)
			{
				lck[i] = status[i] = 0;
			}
			OutBox(5, 49, 53, 72);
			OutBox(43, 74, 53, 82);
			TogBox(55, 49, 0);
			OutBox(80, 74, 90, 82);
			TogBox(92, 49, 0);
			OutBox(117, 74, 127, 82);
			TogBox(129, 49, 0);
			OutBox(154, 74, 164, 82);

			ClrFut(plr, MisNum);
			Data->P[plr].Future[MisNum].Duration = 0;
			Missions(plr, 8, 37, MisType, 1);
			GetMinus(plr);
			OutBox(5, 74, 41, 82);
			key = 0;
			/* Reset */
		};
		if ((x >= 55 && y >= 49 && x <= 90 && y <= 82 && mousebuttons > 0)
			|| (key == '2' || key == '@'))
		{
			if ((x >= 80 && y >= 74 && x <= 90 && y <= 82) || (key == '@'))
			{

				if (lck[1] == 0)
					InBox(80, 74, 90, 82);
				else
					OutBox(80, 74, 90, 82);
				lck[1] = abs(lck[1] - 1);
				if (lck[1] == 1)
					PlaceRX(2);
				else
					ClearRX(2);
				if ((status[1] == 0) && (lck[1] == 1))
					F1 = 2;
				else if ((status[1] == 1) && (lck[1] == 1))
					F1 = 1;
				else
					F1 = 0;

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
			}
			else if (lck[1] != 1)
			{

				TogBox(55, 49, 1);
				if (status[1] == 0)
					Toggle(1, 1);
				else
					Toggle(1, 0);
				status[1] = abs(status[1] - 1);

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
				TogBox(55, 49, 0);
			};					   /* Docking */
			key = 0;
		};

		if ((x >= 92 && y >= 49 && x <= 127 && y <= 82 && mousebuttons > 0)
			|| (key == '3' || key == '#'))
		{
			if ((x >= 117 && y >= 74 && x <= 127 && y <= 82) || (key == '#'))
			{

				if (lck[2] == 0)
					InBox(117, 74, 127, 82);
				else
					OutBox(117, 74, 127, 82);
				lck[2] = abs(lck[2] - 1);
				if (lck[2] == 1)
					PlaceRX(3);
				else
					ClearRX(3);
				if ((status[2] == 0) && (lck[2] == 1))
					F2 = 2;
				else if ((status[2] == 1) && (lck[2] == 1))
					F2 = 1;
				else
					F2 = 0;

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
			}
			else if (lck[2] != 1)
			{

				TogBox(92, 49, 1);
				if (status[2] == 0)
					Toggle(2, 1);
				else
				{
					Toggle(2, 0);
				};
				status[2] = abs(status[2] - 1);

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
				TogBox(92, 49, 0);
			};					   /* EVA */
			key = 0;
		};

		if ((x >= 129 && y >= 49 && x <= 164 && y <= 82 && mousebuttons > 0)
			|| (key == '4' || key == '$'))
		{
			if ((x >= 154 && y >= 74 && x <= 164 && y <= 82) || (key == '$'))
			{

				if (lck[3] == 0)
					InBox(154, 74, 164, 82);
				else
					OutBox(154, 74, 164, 82);
				lck[3] = abs(lck[3] - 1);	// F3=lck[3];
				if (lck[3] == 1)
					PlaceRX(4);
				else
					ClearRX(4);
				if ((status[3] == 0) && (lck[3] == 1))
					F3 = 2;
				else if ((status[3] == 1) && (lck[3] == 1))
					F3 = 1;
				else
					F3 = 0;

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
			}
			else if (lck[3] != 1)
			{

				TogBox(129, 49, 1);
				if (status[3] == 0)
					Toggle(3, 1);
				else
				{
					Toggle(3, 0);
				};
				status[3] = abs(status[3] - 1);

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
				TogBox(129, 49, 0);
			};					   /* LEM */
			key = 0;
		};
		if (((x >= 166 && y >= 49 && x <= 201 && y <= 82 && mousebuttons > 0)
				|| (key == '5' || key == '%')) && (JointFlag == 1))
		{
			if ((x > 191 && y >= 74 && x <= 201 && y <= 82) || (key == '%'))
			{

				if (lck[4] == 0)
					InBox(191, 74, 201, 82);
				else
					OutBox(191, 74, 201, 82);
				lck[4] = abs(lck[4] - 1);
				if (lck[4] == 1)
					PlaceRX(5);
				else
					ClearRX(5);

				if ((status[4] == 0) && (lck[4] == 1))
					F4 = 2;
				else if ((status[4] == 1) && (lck[4] == 1))
					F4 = 1;
				else
					F4 = 0;

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
			}
			else if (lck[4] != 1)
			{

				TogBox(166, 49, 1);

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

				while (1)
				{
					GetMouse();
					if (mousebuttons == 0)
						break;
				}
				TogBox(166, 49, 0);
			};					   /* Joint Launch */
			key = 0;
		};
		if ((x >= 5 && y >= 84 && x <= 16 && y <= 130 && mousebuttons > 0)
			|| (key == UP_ARROW))
		{
			InBox(5, 84, 16, 130);
			for (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;
				}
			}
			while (mousebuttons == 1 || key == UP_ARROW)
			{
				MisType = UpSearchRout(MisType, plr);
				Data->P[plr].Future[MisNum].MissionCode = MisType;
				Missions(plr, 8, 37, MisType, 3);
				DuraType = status[0];
				delay(100);
				key = 0;
				GetMouse();
			}
            Missions(plr, 8, 37, MisType, 3);
			DuraType = status[0];
			OutBox(5, 84, 16, 130);
			key = 0;
			/* Mission Type plus */
		};
		if ((x >= 5 && y >= 132 && x < 16 && y <= 146 && mousebuttons > 0)
			|| (key == K_SPACE))
		{
			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);
			key = 0;
		}
		if ((x >= 5 && y >= 148 && x <= 16 && y <= 194 && mousebuttons > 0)
			|| (key == DN_ARROW))
		{
			InBox(5, 148, 16, 194);
			for (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;
				}
				key = 0;
			}
			while (mousebuttons == 1 || key == DN_ARROW)
			{
				MisType = DownSearchRout(MisType, plr);
				Data->P[plr].Future[MisNum].MissionCode = MisType;
                Missions(plr, 8, 37, MisType, 3);
				DuraType = status[0];
				delay(100);
				key = 0;
				GetMouse();
			}
            Missions(plr, 8, 37, MisType, 3);
			DuraType = status[0];
			OutBox(5, 148, 16, 194);
			key = 0;
			/* Mission Type minus */

		};
	}							   // while
  TRACE1("<-Future()");
}
예제 #14
0
void ShowAstrosHist(char plr)
{
    char pos = 0, pos2 = 0, glorf = 0;
    vhptr2 = new display::Surface(112, 55);
    abuf = (struct Astros *) buffer;

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

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

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

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

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

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

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

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

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

    WaitForMouseUp();

    while (1) {
        GetMouse();

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

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

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            delete vhptr2;

            vhptr2 = NULL;

            key = 0;

            return;
        }

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

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

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

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

        key = 0;
    };
}
예제 #15
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 */
        };
    }
}
예제 #16
0
void ShowPrest(char plr)
{
    char pos = -1, pos2 = -1;
    int i, j;

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


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

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

    InBox(70, 42, 174, 92);

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

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

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

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

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

    WaitForMouseUp();

    while (1) {
        GetMouse();

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

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

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            key = 0;

            helpText = "i000";

            keyHelpText = "k000";

            return;
        }

        pButton(297, 129, 307, 158, BackOne(plr, &pos, &pos2), key >> 8, 72);
        pButton(297, 160, 307, 189, ForOne(plr, &pos, &pos2), key >> 8, 80);
        Button2(15, 129, 160, 133, Move2(plr, &pos, &pos2, 0), key, 49);
        Button2(15, 136, 160, 140, Move2(plr, &pos, &pos2, 1), key, 50);
        Button2(15, 143, 160, 147, Move2(plr, &pos, &pos2, 2), key, 51);
        Button2(15, 150, 160, 154, Move2(plr, &pos, &pos2, 3), key, 52);
        Button2(15, 157, 160, 161, Move2(plr, &pos, &pos2, 4), key, 53);
        Button2(15, 164, 160, 168, Move2(plr, &pos, &pos2, 5), key, 54);
        Button2(15, 171, 160, 175, Move2(plr, &pos, &pos2, 6), key, 55);
        Button2(15, 178, 160, 182, Move2(plr, &pos, &pos2, 7), key, 56);
        Button2(15, 185, 160, 189, Move2(plr, &pos, &pos2, 8), key, 57);
        key = 0;
    };
}
예제 #17
0
void ShowSpHist(char plr)
{
    int pos;

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

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

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

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

    WaitForMouseUp();

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

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

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

            WaitForMouseUp();

            OutBox(245, 5, 314, 17);

            return;
        }

        pButton(7, 176, 49, 193, FullRewind(plr, &pos), key >> 8, 71); //FullRewind Button etc..
        pButton(51, 176, 93, 193, RewindOne(plr, &pos), key >> 8, 75);
        pButton(226, 176, 268, 193, FastOne(plr, &pos), key >> 8, 77);
        pButton(270, 176, 312, 193, FullFast(plr, &pos), key >> 8, 79);
        key = 0;
    };
}
예제 #18
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 */
            }
        }
    }
}
예제 #19
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;
            }
        }
    }
}
예제 #20
0
void Prefs(int where)
{
    int num, hum1 = 0, hum2 = 0;
    FILE *fin;
    char ch, Name[20], ksel = 0;
    int32_t size;

    if (where != 3) {
        if (where == 0) {
            plr[0] = 0;
            plr[1] = 1;
            Data->Def.Plr2 = 1;
            Data->Def.Plr1 = 0;
            hum1 = 0, hum2 = 1;
            Data->Def.Lev1 = Data->Def.Ast1 = Data->Def.Ast2 = 0;
            Data->Def.Lev2 = 2; //start computer level 3
            Data->Def.Input = 0;
            Data->Def.Sound = Data->Def.Music = 1;
            MuteChannel(AV_ALL_CHANNELS, 0);
        }

        if (Data->Def.Plr1 > 1) {
            Data->Def.Plr1 -= 2;
            hum1 = 1;
        }

        if (Data->Def.Plr2 > 1) {
            Data->Def.Plr2 -= 2;
            hum2 = 1;
        }
    }

    /* Data->Def.Sound=Data->Def.Music=1; */
    DrawPrefs(where, hum1, hum2);
    WaitForMouseUp();

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

        if (mousebuttons > 0 || key > 0) { /* Game Play */
            if (((x >= 245 && y >= 5 && x <= 314 && y <= 17) || key == K_ENTER) && !(hum1 == 1 && hum2 == 1)) {
                InBox(245, 5, 314, 17);
                WaitForMouseUp();

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

                OutBox(245, 5, 314, 17);

                if (!(Data->Def.Input == 2 || Data->Def.Input == 3)) {
                    if (options.feat_eq_new_name && hum1 != 1) {
                        SetEquipName(0);
                    }

                    if (options.feat_eq_new_name && hum2 != 1) {
                        SetEquipName(1);
                    }
                } //Change Name, if basic mode and for human players

                if (Data->Def.Plr1 != Data->Def.Plr2) {
                    if (Data->Def.Plr1 == 1) {
                        int tmp;

                        strcpy(&Name[0], &Data->P[0].Name[0]);
                        strcpy(&Data->P[0].Name[0], &Data->P[1].Name[0]);
                        strcpy(&Data->P[1].Name[0], &Name[0]);
                        tmp = Data->Def.Lev1;
                        Data->Def.Lev1 = Data->Def.Lev2;
                        Data->Def.Lev2 = tmp;
                        tmp = Data->Def.Ast1;
                        Data->Def.Ast1 = Data->Def.Ast2;
                        Data->Def.Ast2 = tmp;
                    }

                    Data->Def.Plr1 += hum1 * 2;
                    Data->Def.Plr2 += hum2 * 2;

                    if (where == 0 || where == 3) {
                        FadeOut(2, 10, 0, 0);
                    }

                    key = 0;

                    if ((where == 0 || where == 3) && (Data->Def.Input == 2 || Data->Def.Input == 3)) {
                        fin = sOpen("HIST.DAT", "rb", 0);
                        fread(&Data->P[0].Probe[PROBE_HW_ORBITAL], 28 * (sizeof(Equipment)), 1, fin);
                        fread(&Data->P[1].Probe[PROBE_HW_ORBITAL], 28 * (sizeof(Equipment)), 1, fin);
                        fclose(fin);
                    }

                    ///Random Equipment
                    if ((where == 0 || where == 3) && (Data->Def.Input == 4 || Data->Def.Input == 5)) {
                        RandomizeEq();
                    }

                    int i, k;

                    for (i = 0; i < NUM_PLAYERS; i++)
                        for (k = 0; k < 7; k++) {
                            Data->P[i].Probe[k].MSF = Data->P[i].Probe[k].MaxRD;
                            Data->P[i].Rocket[k].MSF = Data->P[i].Rocket[k].MaxRD;
                            Data->P[i].Manned[k].MSF = Data->P[i].Manned[k].MaxRD;
                            Data->P[i].Misc[k].MSF = Data->P[i].Misc[k].MaxRD;
                        }

                    if (Data->Def.Input == 0 || Data->Def.Input == 2 || Data->Def.Input == 4) {
                        // Hist Crews
                        fin = sOpen("CREW.DAT", "rb", 0);
                        size = fread(buffer, 1, BUFFER_SIZE, fin);
                        fclose(fin);
                        fin = sOpen("MEN.DAT", "wb", 1);
                        fwrite(buffer, size, 1, fin);
                        fclose(fin);
                    } else if (Data->Def.Input == 1 || Data->Def.Input == 3 || Data->Def.Input == 5) {
                        // User Crews
                        fin = sOpen("USER.DAT", "rb", FT_SAVE);

                        if (!fin) {
                            fin = sOpen("USER.DAT", "rb", FT_DATA);
                        }

                        size = fread(buffer, 1, BUFFER_SIZE, fin);
                        fclose(fin);
                        fin = sOpen("MEN.DAT", "wb", 1);
                        fwrite(buffer, size, 1, fin);
                        fclose(fin);
                    }

                    music_stop();
                    return;
                }
            } else if (key == 'P' && (where == 0 || where == 3)) {
                fill_rectangle(59, 26, 68, 31, 3);
                fill_rectangle(290, 26, 298, 31, 3);

                if (ksel == 0) {
                    ksel = 1;
                    display::graphics.setForegroundColor(9);
                    draw_string(253, 30, "PLAYER 2");
                    display::graphics.setForegroundColor(34);
                    draw_string(23, 30, "PLAYER 1");
                } else {
                    ksel = 0;
                    display::graphics.setForegroundColor(34);
                    draw_string(253, 30, "PLAYER 2");
                    display::graphics.setForegroundColor(9);
                    draw_string(23, 30, "PLAYER 1");
                }
            } else if ((x >= 146 && y >= 30 && x <= 219 && y <= 61 && mousebuttons > 0) || key == 'E') {
                // Edit astronauts has been ripped out

            } else if (((x >= 96 && y >= 114 && x <= 223 && y <= 194 && mousebuttons > 0) || key == K_SPACE) && (where == 3 || where == 0)) { // Hist
                char maxHModels;
                maxHModels = options.feat_random_eq > 0 ? 5 : 3;
                WaitForMouseUp();
                Data->Def.Input++;

                if (Data->Def.Input > maxHModels) {
                    Data->Def.Input = 0;
                }

                HModel(Data->Def.Input, 0);
            } else if ((x >= 146 && y >= 70 && x <= 219 && y <= 101 && mousebuttons > 0) || key == 'A') {
                /* disable this option right now */
            } else if ((x >= 100 && y >= 30 && x <= 135 && y <= 61 && mousebuttons > 0) || key == 'M') {
                InBox(100, 30, 135, 61);
                WaitForMouseUp();
                Data->Def.Music = !Data->Def.Music;
                // SetMusicVolume((Data->Def.Music==1)?100:0);
                music_set_mute(!Data->Def.Music);
                vhptr->copyTo(display::graphics.legacyScreen(), 153 + 34 * (Data->Def.Music), 0, 101, 31, 134, 60);
                OutBox(100, 30, 135, 61);
                /* Music Level */
            } else if ((x >= 100 && y >= 70 && x <= 135 && y <= 101 && mousebuttons > 0) || key == 'S') {
                InBox(100, 70, 135, 101);
                WaitForMouseUp();
                Data->Def.Sound = !Data->Def.Sound;
                MuteChannel(AV_SOUND_CHANNEL, !Data->Def.Sound);
                vhptr->copyTo(display::graphics.legacyScreen(), 221 + 34 * (Data->Def.Sound), 0, 101, 71, 134, 100);
                OutBox(100, 70, 135, 101);
                /* Sound Level */
            }

            else if ((x >= 8 && y >= 77 && x <= 18 && y <= 85 && where == 0 && mousebuttons > 0) ||
                     (where == 0 && ksel == 0 && key == 'H')) {
                InBox(8, 77, 18, 85);
                WaitForMouseUp();
                hum1++;

                if (hum1 > 1) {
                    hum1 = 0;
                }

                CLevels(0, hum1);
                OutBox(8, 77, 18, 85);

                /* P1: Human/Computer */
                //change human to dif 1 and comp to 3
                if (hum1 == 1) {
                    Data->Def.Lev1 = 2;
                } else {
                    Data->Def.Lev1 = 0;
                }

                Levels(0, Data->Def.Lev1, 1);
            } else if ((x >= 8 && y >= 107 && x <= 81 && y <= 138 && (where == 0 || where == 3) && mousebuttons > 0) ||
                       ((where == 3 || where == 0) && ksel == 0 && key == 'G')) {
                InBox(8, 107, 81, 138);
                WaitForMouseUp();
                OutBox(8, 107, 81, 138);
                Data->Def.Lev1++;

                if (Data->Def.Lev1 > 2) {
                    Data->Def.Lev1 = 0;
                }

                Levels(0, Data->Def.Lev1, 1);
                /* P1: Game Level */
            } else if ((x >= 8 && y >= 160 && x <= 81 && y <= 191 && ((where == 0 || where == 3) && mousebuttons > 0)) ||
                       ((where == 3 || where == 0) && ksel == 0 && key == 'L')) {
                InBox(8, 160, 81, 191);
                WaitForMouseUp();
                OutBox(8, 160, 81, 191);
                Data->Def.Ast1++;

                if (Data->Def.Ast1 > 2) {
                    Data->Def.Ast1 = 0;
                }

                Levels(0, Data->Def.Ast1, 0);
                /* P1: Astro Level */
            }

            else if ((x >= 238 && y >= 77 && x <= 248 && y <= 85 && where == 0 && mousebuttons > 0) ||
                     (where == 0 && ksel == 1 && key == 'H')) {
                InBox(238, 77, 248, 85);
                WaitForMouseUp();
                hum2++;

                if (hum2 > 1) {
                    hum2 = 0;
                }

                CLevels(1, hum2);
                OutBox(238, 77, 248, 85);

                /* P2:Human/Computer */
                //change human to dif 1 and comp to 3
                if (hum2 == 1) {
                    Data->Def.Lev2 = 2;
                } else {
                    Data->Def.Lev2 = 0;
                }

                Levels(1, Data->Def.Lev2, 1);
            } else if ((x >= 238 && y >= 107 && x <= 311 && y <= 138 && (where == 0 || where == 3) && mousebuttons > 0) ||
                       ((where == 0 || where == 3) && ksel == 1 && key == 'G')) {
                InBox(238, 107, 311, 138);
                WaitForMouseUp();
                OutBox(238, 107, 311, 138);
                Data->Def.Lev2++;

                if (Data->Def.Lev2 > 2) {
                    Data->Def.Lev2 = 0;
                }

                Levels(1, Data->Def.Lev2, 1);
                /* P2: Game Level */
            } else if ((x >= 238 && y >= 160 && x <= 311 && y <= 191 && (where == 0 || where == 3) && mousebuttons > 0) ||
                       ((where == 0 || where == 3) && ksel == 1 && key == 'L')) {
                InBox(238, 160, 311, 191);
                WaitForMouseUp();
                OutBox(238, 160, 311, 191);
                Data->Def.Ast2++;

                if (Data->Def.Ast2 > 2) {
                    Data->Def.Ast2 = 0;
                }

                Levels(1, Data->Def.Ast2, 0);
                /* P2: Astro Level */
            } else if ((x >= 6 && y >= 34 && x <= 83 && y <= 42 && (where == 3 || where == 0) && mousebuttons > 0) ||
                       ((where == 3 || where == 0) && ksel == 0 && key == 'N')) {
                fill_rectangle(7, 35, 82, 41, 0);

                for (int i = 0; i < 20; i++) {
                    Data->P[0].Name[i] = 0x00;
                }

                num = 0;
                ch = 0;
                display::graphics.setForegroundColor(1);
                grMoveTo(8, 40);
                draw_character(0x14);
                av_sync();

                while (ch != K_ENTER) {
                    ch = getch();

                    if (ch != (ch & 0xff)) {
                        ch = 0x00;
                    }

                    if (ch >= 'a' && ch <= 'z') {
                        ch -= 0x20;
                    }

                    if (ch == 0x08 && num > 0) {
                        Data->P[0].Name[--num] = 0x00;
                    } else if (num < 12 && (isupper(ch) || isdigit(ch) || ch == 0x20)) {
                        Data->P[0].Name[num++] = ch;
                    }

                    fill_rectangle(7, 35, 82, 41, 0);
                    display::graphics.setForegroundColor(1);
                    draw_string(8, 40, &Data->P[0].Name[0]);
                    draw_character(0x14);
                    av_sync();
                }

                Data->P[0].Name[num] = 0x00;
                fill_rectangle(7, 35, 82, 41, 0);
                display::graphics.setForegroundColor(1);
                draw_string(8, 40, &Data->P[0].Name[0]);
                av_sync();
                /* P1: Director Name */
            } else if ((x >= 236 && y >= 34 && x <= 313 && y <= 42 && (where == 3 || where == 0) && mousebuttons > 0) ||
                       ((where == 3 || where == 0) && ksel == 1 && key == 'N')) {
                fill_rectangle(237, 35, 312, 41, 0);

                for (int i = 0; i < 20; i++) {
                    Data->P[1].Name[i] = 0x00;
                }

                num = 0;
                ch = 0;
                display::graphics.setForegroundColor(1);
                grMoveTo(238, 40);
                draw_character(0x14);
                av_sync();

                while (ch != K_ENTER) {
                    ch = getch();

                    if (ch != (ch & 0xff)) {
                        ch = 0x00;
                    }

                    if (ch >= 'a' && ch <= 'z') {
                        ch -= 0x20;
                    }

                    if (ch == 0x08 && num > 0) {
                        Data->P[1].Name[--num] = 0x00;
                    } else if (num < 12 && (isupper(ch) || isdigit(ch) || ch == 0x20)) {
                        Data->P[1].Name[num++] = ch;
                    }

                    fill_rectangle(237, 35, 312, 41, 0);
                    display::graphics.setForegroundColor(1);
                    draw_string(238, 40, &Data->P[1].Name[0]);
                    draw_character(0x14);
                    av_sync();
                }

                Data->P[1].Name[num] = 0x00;
                fill_rectangle(237, 35, 312, 41, 0);
                display::graphics.setForegroundColor(1);
                draw_string(238, 40, &Data->P[1].Name[0]);
                av_sync();
                /* P2: Director Name */
            };
        }
    };
}
예제 #21
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()");
}
예제 #22
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++) {
        pal[i] = 0;
    }

    gxClearDisplay(0, 0);

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

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

    PrintAt(0, 0, "19");
    DispNum(0, 0, Data->Year);
    grSetColor(1);

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


    if ((Mis.mVab[0] & 0x10) == 0x10 && Data->P[plr].DMod <= 0) {
        i = 0;

        while (dg[Mis2.Index][i] != 0 && Mis.Doc == 1) {
            GetMisType(dg[Mis2.Index][i]);
            i++;
        }

        if (dg[Mis2.Index][i] == 0) {
            Data->P[plr].Mission[pad].MissionCode = 4;    // new mission
        } else {
            Data->P[plr].Mission[pad].MissionCode = Mis.Index;    // new mission
        }

        GetMisType(Data->P[plr].Mission[pad].MissionCode);
        HelpFlag = 1;
    }

    PrintAt(127, 54, Mis.Abbr);
    int MisCod;
    MisCod = Data->P[plr].Mission[pad].MissionCode;

    if ((MisCod > 24 && MisCod < 32) || MisCod == 33 || MisCod == 34 || MisCod == 35 || MisCod == 37 || MisCod == 40 || MisCod == 41)
        // Show duration level only on missions with a Duration step - Leon
    {
        switch (Data->P[plr].Mission[pad].Duration) {
        case 1:
            PrintAt(0, 0, "");
            break;

        case 2:
            PrintAt(0, 0, " (B)");
            break;

        case 3:
            PrintAt(0, 0, " (C)");
            break;

        case 4:
            PrintAt(0, 0, " (D)");
            break;

        case 5:
            PrintAt(0, 0, " (E)");
            break;

        case 6:
            PrintAt(0, 0, " (F)");
            break;

        default:
            PrintAt(0, 0, "");
            break;
        }
    }

    IOBox(57, 68, 118, 84);
    IOBox(131, 68, 197, 84);
    IOBox(205, 68, 266, 84);
    grSetColor(1);
    PrintAt(65, 78, "CONTINUE");
    PrintAt(139, 78, "PLAY FULL");
    PrintAt(221, 78, "SCRUB");
    grSetColor(9);
    MisCod = Data->P[plr].Mission[i].MissionCode;
    PrintAt(65, 78, "C");
    PrintAt(139, 78, "P");
    PrintAt(221, 78, "S");

    //IOBox(85,68,158,84);IOBox(172,68,245,84);
    //grSetColor(1);PrintAt(102,78,"CONTINUE");PrintAt(189,78,"SCRUB");
    //grSetColor(9);
    //PrintAt(102,78,"C");PrintAt(189,78,"S");

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

        //DispNum(0,0,pad);
        switch (pad) {
        case 0:
            PrintAt(0, 0, "A");
            break;

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

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

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

        PrintAt(213, 101, "PAD ");

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

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

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

    }

    for (i = 0; i < Data->P[plr].Mission[pad].Joint + 1; i++) {
        k = 0;

        if (i == 0) {
            bud = 49;
        } else {
            bud = 160;
        }

        for (j = Mission_Capsule; j <= Mission_PrimaryBooster; j++) {
            hold = Data->P[plr].Mission[pad + i].Hard[j];

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

                break;

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

                break;

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

                break;

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

                break;

            case 4:
                if (hold > -1) {
                    if (hold < 5) {
                        grSetColor(7);
                        PrintAt(bud, 109 + 14 * k, "ROCKET: ");
                        grSetColor(1);
                        PrintAt(0, 0, &Data->P[plr].Rocket[hold - 1].Name[0]);
                        grSetColor(11);
                        PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        Data->P[plr].Rocket[hold - 1].Damage != 0 ? grSetColor(9) : grSetColor(1); //Damaged Equipment, Nikakd, 10/8/10
                        sprintf(&Digit[0], "%d", Data->P[plr].Rocket[hold - 1].Safety + Data->P[plr].Rocket[hold - 1].Damage);
                        PrintAt(0, 0, &Digit[0]);
                        PrintAt(0, 0, "%");
                        //DispNum(0,0,Data->P[plr].Rocket[hold-1].Safety);
                        //PrintAt(144+i*111,116+14*k,"%");
                        ++k;
                    } else {
                        grSetColor(7);
                        PrintAt(bud, 109 + 14 * k, "ROCKET: ");
                        grSetColor(1);
                        PrintAt(0, 0, &Data->P[plr].Rocket[hold - 5].Name[0]);
                        PrintAt(0, 0, " W/B");
                        grSetColor(11);
                        PrintAt(bud, 116 + 14 * k, "SAFETY FACTOR: ");
                        (Data->P[plr].Rocket[hold - 5].Damage != 0 || Data->P[plr].Rocket[4].Damage != 0) ? grSetColor(9) : grSetColor(1); //Damaged Equipment && Booster's Safety Mod, Nikakd, 10/8/10
                        sprintf(&Digit[0], "%d", RocketBoosterSafety(Data->P[plr].Rocket[hold - 5].Safety + Data->P[plr].Rocket[hold - 5].Damage, Data->P[plr].Rocket[4].Safety + Data->P[plr].Rocket[4].Damage));
                        PrintAt(0, 0, &Digit[0]);
                        PrintAt(0, 0, "%");
                        // DispNum(0,0,(Data->P[plr].Rocket[hold-5].Safety+Data->P[plr].Rocket[4].Safety)/2);
                        // PrintAt(144+i*111,116+14*k,"%");
                        ++k;
                    }
                }

                break;

            default:
                break;
            }
        }
    }

    FadeIn(2, pal, 10, 0, 0);


    WaitForMouseUp();

    if (HelpFlag) {
        Help("i156");    // Notification of being an Help
    }

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

        if ((x >= 59 && y >= 70 && x <= 116 && y <= 82 && mousebuttons > 0) || key == K_ENTER || key == 'C') {
            InBox(59, 70, 116, 82);
            WaitForMouseUp();
            OutBox(59, 70, 116, 82);
            FadeOut(2, pal, 10, 0, 0);
            BIG = 0;
            return;
        } else if ((x >= 133 && y >= 70 && x <= 195 && y <= 82 && mousebuttons > 0) || key == K_ENTER || key == 'P') {
            InBox(133, 70, 195, 82);
            WaitForMouseUp();
            OutBox(133, 70, 195, 82);
            FadeOut(2, pal, 10, 0, 0);
            BIG = 1;
            return;
        }

        else if ((x >= 207 && y >= 70 && x <= 264 && y <= 82 && mousebuttons > 0) || key == 'S') {
            InBox(207, 70, 264, 82);
            WaitForMouseUp();
            OutBox(207, 70, 264, 82);
            {
                ClrMiss(plr, pad);
            }

            if (Data->P[plr].Mission[pad].MissionCode == 0) {
                FadeOut(2, pal, 10, 0, 0);
                return;
            }
        }
    };
}