예제 #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
파일: intro.c 프로젝트: callaa/luola
/* Draw input icons */
int draw_input_icon (int x, int y, MenuAlign align, struct MenuItem * item)
{
    SDL_Rect rect;
    rect.x = x;
    rect.y = y;
    if (item->ID > 4) {
        fprintf (stderr,"Bug: no input icon %d\n",item->ID);
        return 0;
    }
    if (game_settings.controller[item->ID-1].number != 0) {
        if (pad_icon == NULL) return 0;
        rect.w = pad_icon->w;
        if (align == MNU_ALIGN_LEFT)
            rect.x -= rect.w + 7;
        SDL_BlitSurface (pad_icon, NULL, screen, &rect);
        draw_number(screen, rect.x+rect.w - 2,rect.y + rect.h - NUMBER_H - 2,
                game_settings.controller[item->ID-1].number,col_red);
    } else {
        if (keyb_icon == NULL) return 0;
        rect.w = keyb_icon->w;
        if (align == MNU_ALIGN_LEFT)
            rect.x -= rect.w + 7;
        SDL_BlitSurface (keyb_icon, NULL, screen, &rect);
    }
    return rect.w + 7;
}
예제 #3
0
int GetMinus(char plr)
{
    char i;
    int u;

    i = PrestMin(plr);
    fill_rectangle(206, 36, 235, 44, 7);

    if (i < 3) {
        u = 1;    //ok
    } else if (i < 9) {
        u = 10;    //caution
    } else {
        u = 19;    //danger
    }

    vh->copyTo(display::graphics.legacyScreen(), 203, u, 203, 24, 238, 31);
    display::graphics.setForegroundColor(11);

    if (i > 0) {
        draw_string(210, 42, "-");
    } else {
        grMoveTo(210, 42);
    }

    draw_number(0, 0, i);
    display::graphics.setForegroundColor(1);
    return 0;
}
예제 #4
0
파일: tile.cpp 프로젝트: ShotaroTsuji/mona
/*!
	@brief 描画プロシージャ
*/
void mine_tile::paint(Graphics* g){
	switch(state){
	case init:
	case init_lock:
		draw_frame(g);
		break;
	case opened:
		draw_grid(g);
		draw_number(g);
		break;
	case marked:
	case mark_lock:
		draw_frame(g);
		draw_flag(g);
		break;
	case bomb:
		draw_grid(g);
		draw_bomb(g);
		break;
	case exploded:
		draw_grid(g);
		draw_bomb(g);
		draw_cross(g);
		break;
	case missmark:
		draw_frame(g);
		draw_flag(g);
		draw_cross(g);
		break;
	default:
		break;
	}
}
예제 #5
0
void AI_Begin(char plr)
{
    boost::shared_ptr<display::PalettizedSurface> countrySeals(Filesystem::readImage("images/turn.but.0.png"));
    countrySeals->exportPalette();

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

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

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

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

    draw_number(0, 0, Data->Year);
    display::graphics.screen()->draw(countrySeals, 110 * plr, 0, 107, 93, 30, 85);
    display::graphics.setForegroundColor(11);
    draw_string(60, 58, "COMPUTER TURN:  THINKING...");
    music_start(M_SOVTYP);
    FadeIn(2, display::graphics.palette(), 10, 0, 0);
    colss = 0;
}
예제 #6
0
void SetRush(int mode, int val)
{

    InBox(280, 32 + 17 * mode + val * 58, 312, 40 + 17 * mode + val * 58);
    fill_rectangle(177, 63 + 58 * val, 192, 70 + 58 * val, 3);
    fill_rectangle(225, 62 + 58 * val, 270, 70 + 58 * val, 3);
    display::graphics.setForegroundColor(11);
    draw_number(179, 69 + 58 * val, mode * 3);
    draw_character('%');
    display::graphics.setForegroundColor(9);
    draw_number(230, 69 + 58 * val, mode * 3);
    display::graphics.setForegroundColor(1);
    draw_string(237, 69 + 58 * val, "MB");
    fCsh -= mode * 3;

    return;
}
예제 #7
0
파일: nclock.c 프로젝트: FliPPeh/NClock
int draw_time_kiloseconds(int x, int y)
{
    char strks[7];
    float ks = get_kiloseconds();

    snprintf(strks, 7, "%06.3f", ks);

    return draw_number(strks, x, y);
}
예제 #8
0
/** Draws Astronaut attributes
 *
 */
void AstStats(char plr, char man, char num)
{
    int y;
    display::graphics.setForegroundColor(1);
    y = 91 + man * 9;

    if (man == 0) {
        display::graphics.setForegroundColor(11);   /* Highlight CA for command pilot */
    }

    draw_string(119, y, "CA:");
    draw_number(0, 0, Data->P[plr].Pool[num].Cap);
    display::graphics.setForegroundColor(1);

    if (man == 1 && program > 1) {
        display::graphics.setForegroundColor(11);   /* Highlight LM for LM pilot */
    }

    draw_string(143, y, "LM:");
    draw_number(0, 0, Data->P[plr].Pool[num].LM);
    display::graphics.setForegroundColor(1);

    if (program == 1 || ((program == 2 || program == 3 || program == 4) && man == 1) || (program == 5 && man > 1)) {
        display::graphics.setForegroundColor(11);   /* Highlight EV for EVA specialist */
    }

    draw_string(167, y, "EV:");
    draw_number(0, 0, Data->P[plr].Pool[num].EVA);
    display::graphics.setForegroundColor(1);

    if ((program == 2 && man == 0) || ((program == 3 || program == 4) && man == 2)) {
        display::graphics.setForegroundColor(11);   /* Highlight DO for docking specialist */
    }

    draw_string(192, y, "DO:");
    draw_number(0, 0, Data->P[plr].Pool[num].Docking);
    display::graphics.setForegroundColor(1);  /* Never highlight EN skill */
    draw_string(217, y, "EN:");
    draw_number(0, 0, Data->P[plr].Pool[num].Endurance);
    return;
}
예제 #9
0
void
draw_clock(void)
{
     /* Draw hour numbers */
     draw_number(ttyclock->date.hour[0], 1, 1);
     draw_number(ttyclock->date.hour[1], 1, 8);

     if (ttyclock->option.blink){
       time_t seconds;
       seconds = time(NULL);

       if (seconds % 2 != 0){
           /* 2 dot for number separation */
           wbkgdset(ttyclock->framewin, COLOR_PAIR(1));
           mvwaddstr(ttyclock->framewin, 2, 16, "  ");
           mvwaddstr(ttyclock->framewin, 4, 16, "  ");
       }
       else if (seconds % 2 == 0){
           /*2 dot black for blinking */
           wbkgdset(ttyclock->framewin, COLOR_PAIR(2));
           mvwaddstr(ttyclock->framewin, 2, 16, "  ");
           mvwaddstr(ttyclock->framewin, 4, 16, "  ");
       }
     }
     else{
       /* 2 dot for number separation */
       wbkgdset(ttyclock->framewin, COLOR_PAIR(1));
       mvwaddstr(ttyclock->framewin, 2, 16, "  ");
       mvwaddstr(ttyclock->framewin, 4, 16, "  ");
     }

     /* Draw minute numbers */
     draw_number(ttyclock->date.minute[0], 1, 20);
     draw_number(ttyclock->date.minute[1], 1, 27);

     /* Draw the date */
     if (ttyclock->option.date)
     {
          wbkgdset(ttyclock->datewin, (COLOR_PAIR(2)));
          mvwprintw(ttyclock->datewin, (DATEWINH / 2), 1, ttyclock->date.datestr);
          wrefresh(ttyclock->datewin);
     }

     /* Draw second if the option is enable */
     if(ttyclock->option.second)
     {
          /* Again 2 dot for number separation */
          wbkgdset(ttyclock->framewin, COLOR_PAIR(1));
          mvwaddstr(ttyclock->framewin, 2, NORMFRAMEW, "  ");
          mvwaddstr(ttyclock->framewin, 4, NORMFRAMEW, "  ");

          /* Draw second numbers */
          draw_number(ttyclock->date.second[0], 1, 39);
          draw_number(ttyclock->date.second[1], 1, 46);
     }

     return;
}
예제 #10
0
파일: Goban2D.cpp 프로젝트: asuz/Gobaum
void Goban2D::draw_text()
{
    glColor3ub(0, 0, 0);

    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();

    glRasterPos3f(10, 10, -19);

    font->FaceSize(12);
    font->Render("Hello world!");

    glPopMatrix();

    glColor3ub(133, 173, 0);
    for (int x = 0; x < 19; x++)
        for (int y = 0; y < 19; y++)
            draw_number(x, y, abstract_board.groups[y][x]);
}
예제 #11
0
파일: nclock.c 프로젝트: FliPPeh/NClock
int draw_strftime(int x, int y, const char *format, int *h, int *w)
{
    char strtm[512];
    time_t time_epoch = time(NULL);
    struct tm *local = localtime(&time_epoch);
    int i;
    int lines = 1;

    char *tok;

    strftime(strtm, sizeof(strtm), format, local);

    /* Count newlines */
    for (i = 0; i < strlen(strtm); ++i)
        if (strtm[i] == '\n')
            lines++;

    /* If the output is to be centered, we have to calculate the
       new actual center here as draw_number() only assumes one
       line if -1 is given. */
    if (y < 0)
        y = (LINES - (HEIGHT * lines) - lines + 1) / 2;

    tok = strtok(strtm, "\n");
    while (tok != NULL)
    {
        int t = draw_number(tok, x, y);

        if (t > *w)
            *w = t;

        y += HEIGHT + 1;

        tok = strtok(NULL, "\n");
    }

    *h = lines * HEIGHT + lines + 1;

    return 0;
}
예제 #12
0
void DisplAst(char plr, char *where, char *where2)
{
    char temp[11] = "GROUP \0";
    char Ast_Name[11];

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

    fill_rectangle(165, 39, 230, 35, 3);
    fill_rectangle(165, 49, 230, 45, 3);
    fill_rectangle(172, 68, 230, 63, 3);
    fill_rectangle(211, 78, 229, 73, 3);
    fill_rectangle(214, 89, 231, 84, 3);
    fill_rectangle(250, 107, 263, 102, 3);
    fill_rectangle(223, 115, 241, 110, 3);
    fill_rectangle(202, 123, 218, 118, 3);
    fill_rectangle(216, 131, 240, 126, 3);
    fill_rectangle(230, 139, 254, 134, 3);
    fill_rectangle(248, 149, 272, 144, 3);
    fill_rectangle(216, 159, 318, 154, 3);
    fill_rectangle(220, 169, 280, 164, 3);
    fill_rectangle(288, 105, 308, 133, 3);
    fill_rectangle(239, 83, 306, 97, 3);
    display::graphics.setForegroundColor(1);

    if ((plr == 0 && abuf[*where].Missions >= 4) || abuf[*where].Hero == 1) {
        Display_ARROW(4, 289, 105);
    } else if ((plr == 1 && abuf[*where].Missions >= 4) || abuf[*where].Hero == 1) {
        Display_ARROW(5, 290, 105);
    }

    if (abuf[*where].Missions > 0) {
        Display_ARROW(6, 245, 83);
    }

    draw_number(214, 78, abuf[*where].Missions);
    draw_number(217, 89, abuf[*where].Prestige);
    draw_number(258, 149, abuf[*where].Days);
    draw_number(253, 107, abuf[*where].Cap);
    draw_number(227, 115, abuf[*where].LM);
    draw_number(204, 123, abuf[*where].EVA);
    draw_number(220, 131, abuf[*where].Docking);
    draw_number(234, 139, abuf[*where].Endurance);
    draw_number(173, 68, abuf[*where].Active / 2);
    draw_string(0, 0, " YEAR");

    if (abuf[*where].Active / 2 != 1) {
        draw_string(0, 0, "S");
    }

    memset(Ast_Name, 0x00, sizeof Ast_Name);
    strncpy(Ast_Name, abuf[*where].Name, 10);

    if (abuf[*where].Sex == 1) {
        display::graphics.setForegroundColor(5); // Show females in blue
    }

    draw_string(165, 39, Ast_Name); // Displays name of astronaut/cosmonaut
    display::graphics.setForegroundColor(11);
    strcat(temp, Nums[abuf[*where].Group]);
    draw_string(165, 49, temp);
    display::graphics.setForegroundColor(12);
    draw_number(225, 169, *where + 1);
    draw_string(0, 0, " OF ");
    draw_number(0, 0, Data->P[plr].AstroCount);
    DispLoc(plr, where);
    DisplAstData(plr, where, where2);
    GradRect(234, 30, 313, 79, plr);
    AstFaces(plr, 234, 30, abuf[*where].Face); //30

}
예제 #13
0
void LimboText(char plr, int astro)
{
    fill_rectangle(44, 31, 145, 40, 3);
    display::graphics.setForegroundColor(11);
    int col;

    if (Data->P[plr].Pool[astro].Mood >= 65) {
        col = 16;
    }

    if (Data->P[plr].Pool[astro].Mood < 65 && Data->P[plr].Pool[astro].Mood >= 40) {
        col = 11;
    }

    if (Data->P[plr].Pool[astro].Mood < 40 && Data->P[plr].Pool[astro].Mood >= 20) {
        col = 8;
    }

    if (Data->P[plr].Pool[astro].Mood < 20) {
        col = 0;
    }

    if (Data->P[plr].Pool[astro].Mood == 0) {
        col = 3;
    }

    display::graphics.setForegroundColor(col);  // Print 'naut name in green/yellow/red/black depending on mood -Leon

    if (Data->P[plr].Pool[astro].RetirementDelay > 0) {
        display::graphics.setForegroundColor(0);    // Print name in black if 'naut has announced retirement (override mood) -Leon
    }

    draw_string(46, 37, Data->P[plr].Pool[astro].Name);
    display::graphics.setForegroundColor(11);
    fill_rectangle(49, 112, 80, 119, 3);
    display::graphics.setForegroundColor(11);

    switch (Data->P[plr].Pool[astro].Group) {
    case 0:
        draw_string(53, 118, "I");
        break;

    case 1:
        draw_string(53, 118, "II");
        break;

    case 2:
        draw_string(53, 118, "III");
        break;

    case 3:
        draw_string(53, 118, "IV");
        break;

    case 4:
        draw_string(53, 118, "V");
        break;
    }

    fill_rectangle(123, 62, 145, 77, 3);
    fill_rectangle(125, 79, 145, 85, 3);
    fill_rectangle(131, 86, 145, 92, 3);
    fill_rectangle(123, 95, 145, 101, 3);
    fill_rectangle(130, 54, 155, 61, 3);
    display::graphics.setForegroundColor(col); // Print 'naut mood in green/yellow/red/black depending on mood -Leon
    draw_number(132, 60, Data->P[plr].Pool[astro].Mood);
    display::graphics.setForegroundColor(11);
    draw_number(125, 68, Data->P[plr].Pool[astro].Cap);
    draw_number(123, 76, Data->P[plr].Pool[astro].LM);
    draw_number(125, 84, Data->P[plr].Pool[astro].EVA);
    draw_number(131, 92, Data->P[plr].Pool[astro].Docking);
    draw_number(125, 100, Data->P[plr].Pool[astro].Endurance);
    fill_rectangle(127, 113, 141, 120, 3);
    display::graphics.setForegroundColor(11);
    draw_number(130, 118, Data->P[plr].Pool[astro].Active);
    AstFaces(plr, 10, 52, Data->P[plr].Pool[astro].Face);
    return;
}
예제 #14
0
파일: pushpin.c 프로젝트: bwhitman/pushpin
void set_program2() {
	set_bkg_tiles(16,14+2,1,1,hardoffmap);
	draw_number(program, 17, 14+2);
	//if(program<32) set_bkg_tiles(16,14+2,1,1,hardmap);
}
예제 #15
0
파일: pushpin.c 프로젝트: bwhitman/pushpin
main()
{
	UBYTE key;
//	selchannel=0;
	programs[0]=0;programs[1]=0;programs[2]=0;programs[3]=0;

	offset=0;

	// load palette sets
	set_bkg_palette( 0, 7, &dsppalette[0] );

	// load in tiles
	set_bkg_data(0,214,tileData);
	SHOW_BKG;
	DISPLAY_ON;

	VBK_REG = 1;

	// set palettes per tile
	set_bkg_tiles( 0,0,   20,18, mapAttr);
	VBK_REG = 0;

	// set actual tiles
	set_bkg_tiles( 0,0, 20,18, mapData);


	key = 0;
      while(key != J_START) {
      	key = getkey();
	      if ( (key & J_DOWN)&&(offset >  0) ) offset --;
      	if ( (key & J_UP)&&(offset < 12) ) offset ++;
		draw_number(offset+1,17,14);
		draw_number(offset+2,17,15);
		draw_number(offset+3,17,16);
		draw_number(offset+4,17,17);
      }

	VBK_REG = 1;



	VBK_REG=1;
	set_bkg_tiles(0,14,17,1,clear_pal);
	set_bkg_tiles(0,15,17,1,clear_pal);
	set_bkg_tiles(0,16,17,1,clear_pal);
	set_bkg_tiles(0,17,17,1,clear_pal);
	VBK_REG=0;
	set_bkg_tiles(0,14,17,1,msg_clear);
	set_bkg_tiles(0,15,17,1,msg_clear);
	set_bkg_tiles(0,16,17,1,msg_clear);
	set_bkg_tiles(0,17,17,1,msg_clear);

	draw_number(0,17,14);
	draw_number(0,17,15);
	draw_number(0,17,16);
	draw_number(0,17,17);

	set_bkg_tiles(16,14,1,1,hardmap);
	set_bkg_tiles(16,15,1,1,hardmap);
	set_bkg_tiles(16,16,1,1,hardmap);
	set_bkg_tiles(16,17,1,1,hardmap);

	// Go onto pushpin proper
	midi_server();

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

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

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

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

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

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

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

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

        default:
            draw_string(0, 0, "NONE");
            break;
        }
    } else {
        if (Data->P[plr].Mission[pad].PCrew - 1 >= 0 || Data->P[plr].Mission[pad].BCrew - 1 >= 0) {
            draw_string(0, 0, "A");
        } else {
            draw_string(0, 0, "NONE");
        }
    }

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

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

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

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

    display::graphics.setForegroundColor(1);

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

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

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

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

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

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

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

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

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

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

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

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

    // Hardware to Use

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            display::graphics.setForegroundColor(1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            display::graphics.setForegroundColor(1);

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

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

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

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

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

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

    FadeIn(2, 10, 0, 0);

    return;
}
예제 #17
0
void DPrest(char plr, char *pos, char *pos2)
{
    int i, j = 0, tmp, tt;


    fill_rectangle(12, 129, 295, 190, 0);
    fill_rectangle(70, 31, 175, 40, 3);
    fill_rectangle(183, 31, 300, 40, 3);

    if (*pos2 == -1) {
        display::graphics.setForegroundColor(11);
        draw_string(71, 37, "SPACE FIRSTS:");
        draw_string(187, 37, "TOTAL POINTS:");
    } else {
        display::graphics.setForegroundColor(1);
        draw_string(71, 37, "ATTEMPTS:");
        draw_string(187, 37, "POINTS:");
    }

    display::graphics.setForegroundColor(2);
    tt = 0;

    for (i = *pos; i < *pos + 9 + tt; i++, j++) { // *pos+9+tt
        if (i == 21) {
            i++;
            tt = 1;
        }

        if (i == *pos2) {
            display::graphics.setForegroundColor(11);
        }

        if (i == -1) {
            draw_string(15, 133 + 7 * j, "SUMMARY");
        } else {
            draw_string(15, 133 + 7 * j, &tame[i][0]);

            if (i == *pos2) {
                display::graphics.setForegroundColor(11);
            } else {
                display::graphics.setForegroundColor(12);
            }

            draw_number(150, 133 + 7 * j, Data->Prestige[i].Add[0]);
            draw_number(185, 133 + 7 * j, Data->Prestige[i].Add[1]);
            draw_number(228, 133 + 7 * j, Data->Prestige[i].Add[2]);
            draw_number(265, 133 + 7 * j, Data->Prestige[i].Add[3]);
        }

        display::graphics.setForegroundColor(2);
    }

    fill_rectangle(71, 43, 173, 91, 6 + 3 * plr);
    fill_rectangle(186, 43, 303, 91, 6 + 3 * plr);
    fill_rectangle(10, 86, 55, 92, 3);
    display::graphics.setForegroundColor(3);

    for (i = 1; i < 3; i++) {
        pline(71, 91 - 16 * i, 173, 91 - 16 * i);
    }

    if (*pos2 != -1) {
        if (Data->Prestige[*pos2].Place == -1 && Data->Prestige[*pos2].Year == 0) {
            fill_rectangle(18, 47, 43, 61, 3);
        } else {
            draw_small_flag(Data->Prestige[*pos2].Place, 18, 47);
        }

        i = MAX(Data->Prestige[*pos2].Goal[0], Data->Prestige[*pos2].Goal[1]);

        if (i != 0) {
            j = Data->Prestige[*pos2].Goal[0];
            tmp = Data->Prestige[*pos2].Goal[1];

            fill_rectangle(85, (int) 91 - 48 * ((float)j / i), 111, 91, 5);
            fill_rectangle(133, (int) 91 - 48 * ((float)tmp / i), 159, 91, 8);
            display::graphics.setForegroundColor(11);

            if (j != 0) {
                draw_number(94, 88, j);
            }

            if (tmp != 0) {
                draw_number(142, 88, tmp);
            }

            if (Data->Prestige[*pos2].Year != 0) {
                draw_string(10, 91, Mon[Data->Prestige[*pos2].Month]);
                draw_string(0, 0, " 19");
                draw_number(0, 0, Data->Prestige[*pos2].Year);
            }

        }

        display::graphics.setForegroundColor(3);

        for (i = 0; i < 3; i++) {
            pline(186, 79 - 12 * i, 303, 79 - 12 * i);
        }

        i = MAX(abs(Data->Prestige[*pos2].Points[0]), abs(Data->Prestige[*pos2].Points[1]));
        display::graphics.setForegroundColor(5);
        pline(205, 67, 231, 67);
        display::graphics.setForegroundColor(8);
        pline(258, 67, 284, 67);

        if (i != 0) {
            j = Data->Prestige[*pos2].Points[0];
            tmp = Data->Prestige[*pos2].Points[1];
            fill_rectangle(205, 67, 231, 67 - (float)j * 24 / i, 5);
            fill_rectangle(258, 67, 284, 67 - (float)tmp * 24 / i, 8);
            display::graphics.setForegroundColor(11);

            if (j != 0) {
                draw_number(212, (j > 0) ? 65 : 73, j);
            }

            if (tmp != 0) {
                draw_number(267, (tmp > 0) ? 65 : 73, tmp);
            }
        }
    } else {
        j = 0;
        tmp = 0;

        for (i = 0; i < 28; i++) {
            j += (Data->Prestige[i].Place == 0) ? 1 :  0;
            tmp += (Data->Prestige[i].Place == 1) ? 1 : 0;
        }

        i = MAX(j, tmp);

        if (i != 0) {
            if (j == tmp) {
                fill_rectangle(18, 47, 43, 61, 3);
            } else if (j > tmp) {
                draw_small_flag(0, 18, 47);
            } else {
                draw_small_flag(1, 18, 47);
            }

            fill_rectangle(85, (int) 91 - 48 * ((float)j / i), 111, 91, 5);
            fill_rectangle(133, (int) 91 - 48 * ((float)tmp / i), 159, 91, 8);
            display::graphics.setForegroundColor(11);

            if (j != 0) {
                draw_number(94, 88, j);
            }

            if (tmp != 0) {
                draw_number(142, 88, tmp);
            }
        }  else {
            fill_rectangle(18, 47, 43, 61, 3);
        }

        j = 0;
        tmp = 0;

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

        display::graphics.setForegroundColor(3);

        for (i = 0; i < 3; i++) {
            pline(186, 79 - 12 * i, 303, 79 - 12 * i);
        }

        i = MAX(abs(j), abs(tmp));
        pline(205, 67, 231, 67);
        pline(258, 67, 284, 67);

        if (i != 0) {
            fill_rectangle(205, 67, 231, 67 - (float)j * 24 / i, 5);
            fill_rectangle(258, 67, 284, 67 - (float)tmp * 24 / i, 8);
            display::graphics.setForegroundColor(11);

            if (j != 0) {
                draw_number(212, (j > 0) ? 65 : 73, j);
            }

            if (tmp != 0) {
                draw_number(267, (tmp > 0) ? 65 : 73, tmp);
            }
        }
    }

    return;
}
예제 #18
0
파일: deark-font.c 프로젝트: jsummers/deark
void de_font_bitmap_font_to_image(deark *c, struct de_bitmap_font *font1, de_finfo *fi,
	unsigned int createflags)
{
	struct font_render_ctx *fctx = NULL;
	i64 i, j, k;
	de_bitmap *img = NULL;
	i64 xpos, ypos;
	i64 img_leftmargin, img_topmargin;
	i64 img_rightmargin, img_bottommargin;
	i64 img_vpixelsperchar;
	i64 img_width, img_height;
	i64 num_table_rows_to_display;
	i64 num_table_rows_total;
	i64 last_valid_row;
	struct de_bitmap_font *dfont = NULL;
	i64 chars_per_row = 32;
	const char *s;
	struct row_info_struct *row_info = NULL;
	struct col_info_struct *col_info = NULL;
	int unicode_req = 0;
	i64 label_stride;
	i64 rownum, colnum;
	i64 curpos;
	unsigned int dnflags;

	fctx = de_malloc(c, sizeof(struct font_render_ctx));
	fctx->font = font1;

	if(fctx->font->num_chars<1) goto done;
	if(fctx->font->num_chars>17*65536) goto done;
	if(fctx->font->nominal_width>512 || fctx->font->nominal_height>512) {
		de_err(c, "Font size too big (%d"DE_CHAR_TIMES"%d). Not supported.",
			(int)fctx->font->nominal_width, (int)fctx->font->nominal_height);
		goto done;
	}

	// -1 = "no preference"
	unicode_req = de_get_ext_option_bool(c, "font:tounicode", -1);

	if(unicode_req==0 &&
		(fctx->font->has_nonunicode_codepoints || !fctx->font->has_unicode_codepoints))
	{
		; // Render as nonunicode.
	}
	else if(fctx->font->has_unicode_codepoints &&
		(unicode_req>0 || fctx->font->prefer_unicode || !fctx->font->has_nonunicode_codepoints))
	{
		fctx->render_as_unicode = 1;
	}

	s = de_get_ext_option(c, "font:charsperrow");
	if(s) {
		chars_per_row = de_atoi64(s);
		if(chars_per_row<1) chars_per_row=1;
	}

	dfont = make_digit_font(c);

	fctx->codepoint_tmp = de_mallocarray(c, fctx->font->num_chars, sizeof(i32));
	fixup_codepoints(c, fctx);

	get_min_max_codepoint(fctx);
	if(fctx->num_valid_chars<1) goto done;
	num_table_rows_total = fctx->max_codepoint/chars_per_row+1;

	// TODO: Clean up these margin calculations, and make it more general.
	if(fctx->render_as_unicode) {
		img_leftmargin = dfont->nominal_width * 5 + 6;
	}
	else {
		if(fctx->max_codepoint >= 1000)
			img_leftmargin = dfont->nominal_width * 5 + 6;
		else
			img_leftmargin = dfont->nominal_width * 3 + 6;
	}
	img_topmargin = dfont->nominal_height + 6;
	img_rightmargin = 1;
	img_bottommargin = 1;

	// Scan the characters, and record relevant information.
	row_info = de_mallocarray(c, num_table_rows_total, sizeof(struct row_info_struct));
	col_info = de_mallocarray(c, chars_per_row, sizeof(struct col_info_struct));
	for(i=0; i<chars_per_row; i++) {
#define MIN_CHAR_CELL_WIDTH 5
		col_info[i].display_width = MIN_CHAR_CELL_WIDTH;
	}

	for(k=0; k<fctx->font->num_chars; k++) {
		i64 char_display_width;

		if(fctx->codepoint_tmp[k] == DE_CODEPOINT_INVALID) continue;
		if(!is_valid_char(&fctx->font->char_array[k])) continue;
		rownum = fctx->codepoint_tmp[k] / chars_per_row;
		colnum = fctx->codepoint_tmp[k] % chars_per_row;
		if(rownum<0 || rownum>=num_table_rows_total) {
			de_err(c, "internal: bad rownum");
			de_fatalerror(c);
		}

		// Remember that there is at least one valid character in this character's row.
		row_info[rownum].is_visible = 1;

		// Track the maximum width of any character in this character's column.
		char_display_width = (i64)(fctx->font->char_array[k].width +
				(int)fctx->font->char_array[k].extraspace_l +
				(int)fctx->font->char_array[k].extraspace_r);
		if(char_display_width > col_info[colnum].display_width) {
			col_info[colnum].display_width = char_display_width;
		}
	}

	img_vpixelsperchar = fctx->font->nominal_height + 1;

	// Figure out how many rows are used, and where to draw them.
	num_table_rows_to_display = 0;
	last_valid_row = -1;
	curpos = img_topmargin;
	for(j=0; j<num_table_rows_total; j++) {
		if(!row_info[j].is_visible) continue;

		// If we skipped one or more rows, leave some extra vertical space.
		if(num_table_rows_to_display>0 && !row_info[j-1].is_visible) curpos+=3;

		last_valid_row = j;
		row_info[j].display_pos = curpos;
		curpos += img_vpixelsperchar;
		num_table_rows_to_display++;
	}
	if(num_table_rows_to_display<1) goto done;

	// Figure out the positions of the columns.
	curpos = img_leftmargin;
	for(i=0; i<chars_per_row; i++) {
		col_info[i].display_pos = curpos;
		curpos += col_info[i].display_width + 1;
	}

	img_width = col_info[chars_per_row-1].display_pos +
		col_info[chars_per_row-1].display_width + img_rightmargin;
	img_height = row_info[last_valid_row].display_pos +
		img_vpixelsperchar -1 + img_bottommargin;

	img = de_bitmap_create(c, img_width, img_height, 1);

	// Clear the image
	for(j=0; j<img->height; j++) {
		for(i=0; i<img->width; i++) {
			de_bitmap_setpixel_gray(img, i, j, 128);
		}
	}

	// Draw/clear the cell backgrounds
	for(j=0; j<num_table_rows_total; j++) {
		if(!row_info[j].is_visible) continue;
		ypos = row_info[j].display_pos;

		for(i=0; i<chars_per_row; i++) {
			i64 ii, jj;

			xpos = col_info[i].display_pos;
			for(jj=0; jj<img_vpixelsperchar-1; jj++) {
				for(ii=0; ii<col_info[i].display_width; ii++) {
					de_bitmap_setpixel_gray(img, xpos+ii, ypos+jj, (ii/2+jj/2)%2 ? 176 : 192);
				}
			}
		}
	}

	// Draw the labels in the top margin.

	// TODO: Better label spacing logic.
	if(fctx->font->nominal_width <= 12)
		label_stride = 2;
	else
		label_stride = 1;

	for(i=0; i<chars_per_row; i++) {
		if(i%label_stride != 0) continue;
		xpos = col_info[i].display_pos + col_info[i].display_width/2;
		ypos = img_topmargin - 3;

		dnflags = DNFLAG_HCENTER;
		if(fctx->render_as_unicode) dnflags |= DNFLAG_HEX;

		draw_number(c, img, dfont, i, xpos, ypos, dnflags);
	}

	// Draw the labels in the left margin.
	for(j=0; j<num_table_rows_total; j++) {
		if(!row_info[j].is_visible) continue;
		xpos = img_leftmargin - 3;
		ypos = row_info[j].display_pos + (img_vpixelsperchar + dfont->nominal_height + 1)/2;

		dnflags = 0;
		if(fctx->render_as_unicode) dnflags |= DNFLAG_HEX | DNFLAG_LEADING_ZEROES;

		draw_number(c, img, dfont, j*chars_per_row, xpos, ypos, dnflags);
	}

	// Render the glyphs.
	for(k=0; k<fctx->font->num_chars; k++) {
		if(fctx->codepoint_tmp[k] == DE_CODEPOINT_INVALID) continue;
		if(!is_valid_char(&fctx->font->char_array[k])) continue;

		rownum = fctx->codepoint_tmp[k] / chars_per_row;
		colnum = fctx->codepoint_tmp[k] % chars_per_row;
		if(rownum<0 || rownum>=num_table_rows_total) {
			de_err(c, "internal: bad rownum");
			de_fatalerror(c);
		}

		xpos = col_info[colnum].display_pos;
		ypos = row_info[rownum].display_pos;

		de_font_paint_character_idx(c, img, fctx->font, k, xpos, ypos,
			DE_STOCKCOLOR_BLACK, DE_STOCKCOLOR_WHITE, 0);
	}

	de_bitmap_write_to_file_finfo(img, fi, createflags);

done:
	if(dfont) {
		de_free(c, dfont->char_array);
		de_destroy_bitmap_font(c, dfont);
	}
	de_bitmap_destroy(img);
	de_free(c, row_info);
	de_free(c, col_info);
	if(fctx) {
		de_free(c, fctx->codepoint_tmp);
		de_free(c, fctx);
	}
}
예제 #19
0
/** Missions() will draw the future missions among other things
 *
 * \param plr Player
 * \param X screen coord for mission name string
 * \param Y screen coord for mission name string
 * \param val mission number
 * \param bub if set to 0 or 3 the function will not draw stuff
 */
void Missions(char plr, int X, int Y, int val, char bub)
{
    TRACE5("->Missions(plr, X %d, Y %d, val %d, bub %c)", X, Y, val, bub);

    memset(Mev, 0x00, sizeof Mev);

    if (bub == 1 || bub == 3) {
        PianoKey(val);
        Bub_Count = 0; // set the initial bub_count
        ClearDisplay();
        fill_rectangle(6, 31, 182, 46, 3);
        fill_rectangle(80, 25, 175, 30, 3);
        display::graphics.setForegroundColor(5);
        draw_string(55, 30, "TYPE: ");
        draw_number(0, 0, val);
        display::graphics.setForegroundColor(5);

        if (V[val].E > 0) {
            if (F5 > V[val].E && V[val].Z == 1) {
                DurPri(F5);
            } else {
                DurPri(V[val].E);
            }
        } else {
            DurPri(F5);
        }
    } else {
        display::graphics.setForegroundColor(1);
    }

    MissionName(val, X, Y, 24);

    if (bub == 3) {
        GetMinus(plr);
    }

    if (bub == 0 || bub == 3) {
        return;
    }


    MSteps = sOpen("missSteps.dat", "r", FT_DATA);

    if (fgets(missStep, 1024, MSteps) == NULL) {
        memset(missStep, 0, sizeof missStep);
    }

    while (!feof(MSteps) && ((missStep[0] - 0x30) * 10 + (missStep[1] - 0x30)) != val) {
        if (fgets(missStep, 1024, MSteps) == NULL) {
            break;
        }
    }

    fclose(MSteps);

    int n;

    for (n = 2; missStep[n] != 'Z'; n++) {
        switch (missStep[n]) {
        case 'A':
            Draw_IJ(B_Mis(++n));
            break;

        case 'B':
            Draw_IJV(B_Mis(++n));
            break;

        case 'C':
            OrbOut(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3));
            n += 3;
            break;

        case 'D':
            LefEarth(B_Mis(n + 1), B_Mis(n + 2));
            n += 2;
            break;

        case 'E':
            OrbIn(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3));
            n += 3;
            break;

        case 'F':
            OrbMid(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4));
            n += 4;
            break;

        case 'G':
            LefOrb(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4));
            n += 4;
            break;

        case 'H':
            Draw_LowS(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4), B_Mis(n + 5), B_Mis(n + 6));
            n += 6;
            break;

        case 'I':
            Fly_By();
            break;

        case 'J':
            VenMarMerc(B_Mis(++n));
            break;

        case 'K':
            Draw_PQR();
            break;

        case 'L':
            Draw_PST();
            break;

        case 'M':
            Draw_GH(B_Mis(n + 1), B_Mis(n + 2));
            n += 2;
            break;

        case 'N':
            Q_Patch();
            break;

        case 'O':
            RghtMoon(B_Mis(n + 1), B_Mis(n + 2));
            n += 2;
            break;

        case 'P':
            DrawLunPas(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4));
            n += 4;
            break;

        case 'Q':
            DrawLefMoon(B_Mis(n + 1), B_Mis(n + 2));
            n += 2;
            break;

        case 'R':
            DrawSTUV(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4));
            n += 4;
            break;

        case 'S':
            Draw_HighS(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3));
            n += 3;
            break;

        case 'T':
            DrawMoon(B_Mis(n + 1), B_Mis(n + 2), B_Mis(n + 3), B_Mis(n + 4), B_Mis(n + 5), B_Mis(n + 6), B_Mis(n + 7));
            n += 7;
            break;

        case 'U':
            LefGap(B_Mis(++n));
            break;

        case 'V':
            S_Patch(B_Mis(++n));
            break;

        case 'W':
            DrawZ();
            break;

        default :
            break;
        }
    }

    gr_sync();
    MissionCodes(plr, MisType, Pad);
    TRACE1("<-Missions()");
}  // end function missions
예제 #20
0
void do_menu(void){
	if(show_menu){ //regular xmc mode
		//xmc
		#define pos_x 0.25
		#define start_y 0.14
		INIT_FRONTEND_HELPER_TEXT();
		DRAW_FRONTEND_HELPER_TEXT("LEAVE", "INPUT_F_CANCEL", 0);
		DRAW_FRONTEND_HELPER_TEXT("CONFIRM", "INPUT_F_ACCEPT", 0);
		DRAW_FRONTEND_HELPER_TEXT("SCROLL", "PAD_DPAD_UPDOWN", 0);
	
		if(!xmc_compact){
			HIDE_HELP_TEXT_THIS_FRAME();
			pos_y = start_y;
			
			if(xmc_dim) DRAW_RECT(0.5000, 0.5000, 1.0000, 1.0000, 0, 0, 0, 110);
			
			//draw_title(0.5,0.05,0.6,0.98,s_r,s_g,s_b,255,MENU_TITLE);
			draw_title(0.5,0.05,0.6,0.98,s_r,s_g,s_b,255,footer);
			draw_title(0.5,0.109,0.4,0.50,s_r,s_g,s_b,255,MENU_AUTHOR);
			
			set_up_draw(3,0.35,0.35,255,255,255,255);
			//draw_text("STRING",0.05,0.975,footer);
			
			uint i = 1;
			for(i;i <= item_count;i++){
				r = 255;
				g = 255;
				b = 255;
				a = 255;
				pos_y = pos_y + 0.0375;
				if(item_select == i){
					r = s_r;
					g = s_g;
					b = s_b;
				}
				if(menu[i].type == 1){
					if(menu[i].value){
						set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
						draw_text("STRING",(pos_x + 0.3),pos_y,"On");
					}
					else{
						set_up_draw(3,0.35,0.35,255,255,255,a);
						draw_text("STRING",(pos_x + 0.3),pos_y,"Off");
					}
				}
				if(menu[i].type == 2){
					set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
					draw_text("STRING",(pos_x + 0.3),pos_y,"(");
					
					set_up_draw(3,0.35,0.35,255,255,255,a);				
					draw_number("NUMBR",(pos_x + 0.305),pos_y,menu[i].value);
					
					set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
					if(menu[i].value > 99)
						draw_text("STRING",(pos_x + 0.345),pos_y,")");
					else if(menu[i].value > 9)
						draw_text("STRING",(pos_x + 0.33),pos_y,")");
					else
						draw_text("STRING",(pos_x + 0.315),pos_y,")");
				}
				if(menu[i].type == 3){
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING",pos_x,pos_y,GET_STRING_FROM_TEXT_FILE(GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(menu[i].value)));
				}
				if(menu[i].type == 4){
					if(item_select == i){
						r = s_r;
						g = s_g;
						b = s_b;
					}
					else GET_PLAYER_RGB_COLOUR(menu[i].value,&r,&g,&b);
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING", pos_x, pos_y, menu[i].item_name);
				}
				if(menu[i].type == 5){
					if(!COMPARE_STRING(menu[i].item_name, "")){
						set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
						draw_text("STRING", pos_x - 0.08, pos_y, "Admin");
					}
					if(item_select == i){
						r = s_r;
						g = s_g;
						b = s_b;
					}
					else if(xmc_online_col) GET_PLAYER_RGB_COLOUR(menu[i].value,&r,&g,&b);					
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING", pos_x, pos_y, menu[i].item_name);
				}
				else{
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING",pos_x,pos_y,menu[i].item_name);
				}
			}
			
			
			
			///Buttons
			if(IS_BUTTON_JUST_PRESSED(0,DPAD_UP)){
				if(item_select == 1){
					item_select = item_count;
				}
				else item_select--;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_DOWN)){
				if(item_select == item_count){
					item_select = 1;
				}
				else item_select++;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_RIGHT) && menu[item_select].type == 2){
				if(menu[item_select].value == menu[item_select].maxval)
					menu[item_select].value = 1;
				else
					menu[item_select].value += 1;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_LEFT) && menu[item_select].type == 2){
				if(menu[item_select].value == 1)
					menu[item_select].value = menu[item_select].maxval;
				else
					menu[item_select].value -= 1;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,BUTTON_A)){
				if(menu[item_select].action){
					menu_functions();
				}
				else{
					uint i = 1;
					for(i;i <= item_count;i++){
						menu[i].action = false;
						menu[i].type = 0;
					}
					last_selected[menu_level] = item_select;
					menu_level++;
					menu_setup();
					item_select = 1;
				}
			}
			else if(IS_BUTTON_JUST_PRESSED(0,BUTTON_B)){
				if(menu_level > 0){
					uint i = 1;
					for(i;i <= item_count;i++){
						menu[i].action = false;
						menu[i].type = 0;
					}
					menu_level--;
					item_select = last_selected[menu_level];
					menu_setup();
				}
				else menu_shutdown();
			}
		}
		else{ 
			#define pos_x 0.60
			#define start_y 0.25 				
			#define spacing 0.025
			pos_y = start_y;
			drawWindow();
			s_a = 255;
			set_up_draw(4,0.35,0.35,s_r,s_g,s_b,255);
			draw_text("STRING",pos_x,start_y-.02,footer);
			uint i = 1;
			for(i;i <= item_count;i++){
				r = 255;g = 255;b = 255;a = 255;
				pos_y = pos_y + spacing;
				if(item_select == i){
					r = s_r;
					g = s_g;
					b = s_b;
				}
				if(menu[i].type == 1){
					if(menu[i].value){
						set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
						draw_text("STRING",(pos_x + 0.265),pos_y,"On");
					}
				}
				if(menu[i].type == 2){
					set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
					draw_text("STRING",(pos_x + 0.19),pos_y,"(");
					set_up_draw(3,0.35,0.35,255,255,255,a);				
					draw_number("NUMBR",(pos_x + 0.205),pos_y,menu[i].value);
					set_up_draw(3,0.35,0.35,s_r,s_g,s_b,a);
					if(menu[i].value > 99) draw_text("STRING",(pos_x + 0.245),pos_y,")");
					else if(menu[i].value > 9) draw_text("STRING",(pos_x + 0.23),pos_y,")");
					else draw_text("STRING",(pos_x + 0.215),pos_y,")");
				}
				if(menu[i].type == 3){
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING",pos_x,pos_y,GET_STRING_FROM_TEXT_FILE(GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(menu[i].value)));
				}
				if(menu[i].type == 4){
					if(item_select == i){
						r = s_r;
						g = s_g;
						b = s_b;
					}
					else GET_PLAYER_RGB_COLOUR(menu[i].value,&r,&g,&b);
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING", pos_x, pos_y, menu[i].item_name);
				}
				else{
					set_up_draw(3,0.35,0.35,r,g,b,a);
					draw_text("STRING",pos_x,pos_y,menu[i].item_name);
				}
			}
			
			///Buttons
			if(IS_BUTTON_JUST_PRESSED(0,DPAD_UP)){
				if(item_select == 1){
					item_select = item_count;
				}
				else item_select--;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_DOWN)){
				if(item_select == item_count){
					item_select = 1;
				}
				else item_select++;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_RIGHT) && menu[item_select].type == 2){
				if(menu[item_select].value == menu[item_select].maxval)
					menu[item_select].value = 1;
				else
					menu[item_select].value += 1;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,DPAD_LEFT) && menu[item_select].type == 2){
				if(menu[item_select].value == 1)
					menu[item_select].value = menu[item_select].maxval;
				else
					menu[item_select].value -= 1;
			}
			else if(IS_BUTTON_JUST_PRESSED(0,BUTTON_A)){
				if(menu[item_select].action){
					menu_functions();
				}
				else{
					uint i = 1;
					for(i;i <= item_count;i++){
						menu[i].action = false;
						menu[i].type = 0;
					}
					last_selected[menu_level] = item_select;
					menu_level++;
					menu_setup();
					item_select = 1;
				}
			}
			else if(IS_BUTTON_JUST_PRESSED(0,BUTTON_B)){
				if(menu_level > 0){
					uint i = 1;
					for(i;i <= item_count;i++){
						menu[i].action = false;
						menu[i].type = 0;
					}
					menu_level--;
					item_select = last_selected[menu_level];
					menu_setup();
				}
				else menu_shutdown();
			}
		}
	}
	else if(!xmc_switch && IS_BUTTON_PRESSED(0,BUTTON_LB) && IS_BUTTON_JUST_PRESSED(0,BUTTON_RB)) menu_startup();
	else if(xmc_switch && IS_BUTTON_PRESSED(0,BUTTON_RB) && IS_BUTTON_JUST_PRESSED(0,BUTTON_LB)) menu_startup();
}
예제 #21
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 */
            }
        }
    }
}
예제 #22
0
/* Draws the entire Future Missions display, including the mission-
 * specific information. Used to initialize the mission selector
 * interface.
 *
 * This relies on the global buffer vh, which must have been created
 * prior. The future missions button art is loaded into vh by this
 * function.
 *
 * \param plr  The player scheduling the mission's design scheme.
 * \param mis  The mission type.
 * \param pad  0, 1, or 2 depending on which pad is being used.
 */
void DrawFuture(char plr, int mis, char pad)
{
    FadeOut(2, 10, 0, 0);
    Load_FUT_BUT();

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

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

    gr_sync();

    fill_rectangle(1, 1, 318, 21, 3);
    fill_rectangle(317, 22, 318, 198, 3);
    fill_rectangle(1, 197, 316, 198, 3);
    fill_rectangle(1, 22, 2, 196, 3);
    OutBox(0, 0, 319, 199);
    InBox(3, 3, 30, 19);
    InBox(3, 22, 316, 196);
    IOBox(242, 3, 315, 19);
    ShBox(5, 24, 183, 47);
    ShBox(5, 24, 201, 47); //name box
    ShBox(5, 74, 41, 82); // RESET
    ShBox(5, 49, 53, 72); //dur/man
    ShBox(43, 74, 53, 82);   // Duration lock
    ShBox(80, 74, 90, 82);   // Docking lock
    ShBox(117, 74, 127, 82); // EVA lock
    ShBox(154, 74, 164, 82); // LM lock
    ShBox(191, 74, 201, 82); // Joint mission lock
    ShBox(5, 84, 16, 130); //arrows up
    ShBox(5, 132, 16, 146); //middle box
    ShBox(5, 148, 16, 194); //    down
    ShBox(203, 24, 238, 31); // new right boxes

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

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

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

    // Draw the mission specification toggle buttons
    Toggle(5, 1);
    draw_Pie(0);
    OutBox(5, 49, 53, 72);
    Toggle(1, 1);
    TogBox(55, 49, 0);
    Toggle(2, 1);
    TogBox(92, 49, 0);
    Toggle(3, 1);
    TogBox(129, 49, 0);
    Toggle(4, 1);

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

    gr_sync();

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

    GetMinus(plr);

    display::graphics.setForegroundColor(5);

    /* lines of text are 1:8,30  2:8,37   3:8,44    */
    switch (pad) { // These used to say Pad 1, 2, 3  -Leon
    case 0:
        draw_string(8, 30, "PAD A:");
        break;

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

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

    display::graphics.setForegroundColor(1);

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

    display::graphics.setForegroundColor(11);

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

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

    return;
}
예제 #23
0
파일: film.c 프로젝트: LebedevRI/gimp
/* Compose a roll film image from several images */
static gint32
film (void)
{
  gint          width, height;
  guchar       *hole;
  gint          film_height, film_width;
  gint          picture_width, picture_height;
  gint          picture_space, picture_x0, picture_y0;
  gint          hole_offset, hole_width, hole_height, hole_space, hole_x;
  gint          number_height, num_images, num_pictures;
  gint          j, k, picture_count;
  gdouble       f;
  gint          num_layers;
  gint32       *image_ID_src, image_ID_dst, layer_ID_src, layer_ID_dst;
  gint          image_ID_tmp;
  gint32       *layers;
  GimpDrawable *drawable_dst;
  GimpPixelRgn  pixel_rgn_dst;
  gint          new_layer;
  gint          floating_sel;

  /* initialize */

  layers = NULL;

  num_images = filmvals.num_images;
  image_ID_src = filmvals.image;

  if (num_images <= 0)
    return (-1);

  gimp_context_push ();
  gimp_context_set_foreground (&filmvals.number_color);
  gimp_context_set_background (&filmvals.film_color);

  if (filmvals.keep_height) /* Search maximum picture height */
    {
      picture_height = 0;
      for (j = 0; j < num_images; j++)
        {
          height = gimp_image_height (image_ID_src[j]);
          if (height > picture_height) picture_height = height;
        }
      film_height = (int)(picture_height / filmvals.picture_height + 0.5);
      filmvals.film_height = film_height;
    }
  else
    {
      film_height = filmvals.film_height;
      picture_height = (int)(film_height * filmvals.picture_height + 0.5);
    }

  picture_space = (int)(film_height * filmvals.picture_space + 0.5);
  picture_y0 = (film_height - picture_height)/2;

  number_height = film_height * filmvals.number_height;

  /* Calculate total film width */
  film_width = 0;
  num_pictures = 0;
  for (j = 0; j < num_images; j++)
    {
      layers = gimp_image_get_layers (image_ID_src[j], &num_layers);
      /* Get scaled image size */
      width = gimp_image_width (image_ID_src[j]);
      height = gimp_image_height (image_ID_src[j]);
      f = ((double)picture_height) / (double)height;
      picture_width = width * f;

      for (k = 0; k < num_layers; k++)
        {
          if (gimp_layer_is_floating_sel (layers[k]))
            continue;

          film_width += (picture_space/2);  /* Leading space */
          film_width += picture_width;      /* Scaled image width */
          film_width += (picture_space/2);  /* Trailing space */
          num_pictures++;
        }

      g_free (layers);
    }

#ifdef FILM_DEBUG
  g_printerr ("film_height = %d, film_width = %d\n", film_height, film_width);
  g_printerr ("picture_height = %d, picture_space = %d, picture_y0 = %d\n",
              picture_height, picture_space, picture_y0);
  g_printerr ("Number of pictures = %d\n", num_pictures);
#endif

  image_ID_dst = create_new_image (_("Untitled"),
                                   (guint) film_width, (guint) film_height,
                                   GIMP_RGB_IMAGE, &layer_ID_dst,
                                   &drawable_dst, &pixel_rgn_dst);

  /* Fill film background */
  gimp_drawable_fill (layer_ID_dst, GIMP_FILL_BACKGROUND);

  /* Draw all the holes */
  hole_offset = film_height * filmvals.hole_offset;
  hole_width = film_height * filmvals.hole_width;
  hole_height = film_height * filmvals.hole_height;
  hole_space = film_height * filmvals.hole_space;
  hole_x = hole_space / 2;

#ifdef FILM_DEBUG
  g_printerr ("hole_x %d hole_offset %d hole_width %d hole_height %d hole_space %d\n",
              hole_x, hole_offset, hole_width, hole_height, hole_space );
#endif

  hole = create_hole_rgb (hole_width, hole_height);
  if (hole)
    {
      while (hole_x < film_width)
        {
          draw_hole_rgb (drawable_dst, hole_x,
                         hole_offset,
                         hole_width, hole_height, hole);
          draw_hole_rgb (drawable_dst, hole_x,
                         film_height-hole_offset-hole_height,
                         hole_width, hole_height, hole);

          hole_x += hole_width + hole_space;
        }
      g_free (hole);
    }
  gimp_drawable_detach (drawable_dst);


  /* Compose all images and layers */
  picture_x0 = 0;
  picture_count = 0;
  for (j = 0; j < num_images; j++)
    {
      image_ID_tmp = gimp_image_duplicate (image_ID_src[j]);
      width = gimp_image_width (image_ID_tmp);
      height = gimp_image_height (image_ID_tmp);
      f = ((gdouble) picture_height) / (gdouble) height;
      picture_width = width * f;
      if (gimp_image_base_type (image_ID_tmp) != GIMP_RGB)
        gimp_image_convert_rgb (image_ID_tmp);
      gimp_image_scale (image_ID_tmp, picture_width, picture_height);

      layers = gimp_image_get_layers (image_ID_tmp, &num_layers);
      for (k = 0; k < num_layers; k++)
        {
          if (gimp_layer_is_floating_sel (layers[k]))
            continue;

          picture_x0 += picture_space / 2;

          layer_ID_src = layers[k];
          gimp_layer_resize_to_image_size (layer_ID_src);
          new_layer = gimp_layer_new_from_drawable (layer_ID_src,
                                                    image_ID_dst);
          gimp_image_insert_layer (image_ID_dst, new_layer, -1, -1);
          gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);

          /* Draw picture numbers */
          if ((number_height > 0) &&
              (filmvals.number_pos[0] || filmvals.number_pos[1]))
            {
              if (filmvals.number_pos[0])
                draw_number (layer_ID_dst,
                             filmvals.number_start + picture_count,
                             picture_x0 + picture_width/2,
                             (hole_offset-number_height)/2, number_height);
              if (filmvals.number_pos[1])
                draw_number (layer_ID_dst,
                             filmvals.number_start + picture_count,
                             picture_x0 + picture_width/2,
                             film_height - (hole_offset + number_height)/2,
                             number_height);
            }

          picture_x0 += picture_width + (picture_space/2);

          gimp_progress_update (((gdouble) (picture_count + 1)) /
                                (gdouble) num_pictures);

          picture_count++;
        }

      g_free (layers);
      gimp_image_delete (image_ID_tmp);
    }
  gimp_progress_update (1.0);

  gimp_image_flatten (image_ID_dst);

  /* Drawing text/numbers leaves us with a floating selection. Stop it */
  floating_sel = gimp_image_get_floating_sel (image_ID_dst);
  if (floating_sel != -1)
    gimp_floating_sel_anchor (floating_sel);

  gimp_context_pop ();

  return image_ID_dst;
}
예제 #24
0
파일: gong.c 프로젝트: DSkywalk/RetroArch
static void game_update_and_render(Game_Input *input, Game_Offscreen_Buffer *draw_buffer)
{
   const float initial_ball_speed = 80.f;
   float playing_field_x = 85.f;
   float playing_field_y = 48.f;
   float player_size_x = 2.5f;
   float player_size_y = 10.f;
   int i;

   if (!g_state->is_initialized)
   {
      g_state->is_initialized = 1;
      g_state->ball_px.f = 0;
      g_state->ball_py.f = 0;
      g_state->ball_dpx.f = initial_ball_speed;
      g_state->ball_dpy.f = 0;
      g_state->current_play_points.f = 10.f;
      g_state->player2_speed.f = 80.f;
   }

   for (i = 0; i < MAX_PLAYERS; i++)
   {
      float speed = 80.f;

      if (i == 1 && !g_state->player2_human)
        break;

      g_state->player[i].dpy.f = 0.f;

      if (is_down(input[i].buttons[B_SPEED_UP]))
         speed = 150.f;

      if (is_down(input[i].buttons[B_MOVE_UP]))
      {
         if (g_state->player[i].py.f < playing_field_y - player_size_y)
         {
            g_state->player[i].dpy.f = speed;
         }

         if (g_state->player[i].py.f < -playing_field_y + player_size_y)
         {
            g_state->player[i].py.f = -playing_field_y + player_size_y;
            g_state->player[i].dpy.f = 0.f;
         }
      }
      if (is_down(input[i].buttons[B_MOVE_DOWN]))
      {
         if (g_state->player[i].py.f > -playing_field_y + player_size_y)
         {
            g_state->player[i].dpy.f = -speed;
         }

         if (g_state->player[i].py.f < -playing_field_y + player_size_y)
         {
            g_state->player[i].py.f = -playing_field_y + player_size_y;
            g_state->player[i].dpy.f = 0.f;
         }
      }

      g_state->player[i].py.f += g_state->player[i].dpy.f * input->last_dt;
   }

   if (!g_state->player2_human)
   {
      g_state->player[1].dpy.f = (g_state->ball_py.f - g_state->player[1].py.f) * 100.f;
      g_state->player[1].dpy.f = MIN(g_state->player[1].dpy.f, g_state->player2_speed.f);
      g_state->player[1].dpy.f = MAX(g_state->player[1].dpy.f, -g_state->player2_speed.f);
      g_state->player[1].py.f += g_state->player[1].dpy.f * input->last_dt;

      if (g_state->player[1].py.f < -playing_field_y + player_size_y)
      {
         g_state->player[1].py.f = -playing_field_y + player_size_y;
         g_state->player[1].dpy.f = 0.f;
      }

      if (g_state->player[1].py.f > playing_field_y - player_size_y)
      {
         g_state->player[1].py.f = playing_field_y - player_size_y;
         g_state->player[1].dpy.f = 0.f;
      }
   }

   g_state->ball_px.f += g_state->ball_dpx.f * input->last_dt;

   if (g_state->ball_dpx.f > 0)
   {
      g_state->ball_dpx.f += 10.f * input->last_dt;
   }
   else
   {
      g_state->ball_dpx.f -= 10.f * input->last_dt;
   }

   g_state->ball_py.f += g_state->ball_dpy.f * input->last_dt;

   if (g_state->ball_py.f > playing_field_y - 1.f)
   {
      g_state->ball_py.f = playing_field_y - 1.f;
      g_state->ball_dpy.f *= -1.f;
   }
   else if (g_state->ball_py.f < -playing_field_y + 1)
   {
      g_state->ball_py.f = -playing_field_y + 1.f;
      g_state->ball_dpy.f *= -1;
   }

   if (g_state->ball_px.f > 80.f - 2.5f - 1.f) /* @Hardcoded */
   {
      if ((g_state->ball_py.f >= (g_state->player[1].py.f - 10.f)) && (g_state->ball_py.f <= (g_state->player[1].py.f + 10.f)))
      {
         g_state->ball_dpx.f *= -1.f;
         g_state->ball_px.f = 80.f - 2.5f - 1.f; /* @Hardcoded */
         g_state->ball_dpy.f = (g_state->ball_py.f - g_state->player[1].py.f) + g_state->player[1].dpy.f;
         ++g_state->current_play_points.f;
      }
      else if (g_state->ball_px.f >= playing_field_x - 1)
      {
         g_state->ball_px.f = 0;
         g_state->ball_py.f = 0;
         g_state->ball_dpy.f = 0;
         g_state->ball_dpx.f = -initial_ball_speed;
         g_state->player2_score += (unsigned)g_state->current_play_points.f;
         g_state->current_play_points.f = 10.f;
      }
   }
   else if (g_state->ball_px.f < -80 + 2.5f + 1.f) /* @Hardcoded */
   {
      if ((g_state->ball_py.f >= (g_state->player[0].py.f - 10.f)) && (g_state->ball_py.f <= (g_state->player[0].py.f + 10.f)))
      {
         g_state->ball_dpx.f *= -1.f;
         g_state->ball_px.f = -80 + 2.5f + 1.f; /* @Hardcoded */
         g_state->ball_dpy.f = (g_state->ball_py.f - g_state->player[0].py.f) + g_state->player[0].dpy.f;
         ++g_state->current_play_points.f;
      }
      else if (g_state->ball_px.f <= -playing_field_x + 1)
      {
         g_state->ball_px.f = 0;
         g_state->ball_py.f = 0;
         g_state->ball_dpy.f = 0;
         g_state->ball_dpx.f = initial_ball_speed;
         g_state->player1_score += (unsigned)g_state->current_play_points.f;
         g_state->current_play_points.f = 10.f;

         if (!g_state->player2_human)
            g_state->player2_speed.f += g_state->current_play_points.f * 0.01f;
      }
   }

   clear(draw_buffer, 0x021077);
   draw_rect(draw_buffer, 0x000530, 0.f, 0.f, playing_field_x, playing_field_y);

   draw_rect(draw_buffer, 0x00ffff, -80.f, g_state->player[0].py.f, player_size_x, player_size_y);
   draw_rect(draw_buffer, 0x00ffff, 80.f, g_state->player[1].py.f, player_size_x, player_size_y);

   draw_rect(draw_buffer, 0xffff00, g_state->ball_px.f, g_state->ball_py.f, 1.f, 1.f);

   draw_number(draw_buffer, (unsigned)g_state->current_play_points.f, 0xaaaaaa, 0.f, 38.f);
   draw_number(draw_buffer, g_state->player1_score, 0xff6611, 20.f, 38.f);
   draw_number(draw_buffer, g_state->player2_score, 0xff6611, -20.f, 38.f);
}
예제 #25
0
void MisAnn(char plr, char pad)
{
    int i, j, bud;
    struct mStr Mis2;
    char k, hold, Digit[4], HelpFlag = 0;
    char pad_str[2] = {'A' + pad, '\0'};

    for (i = 0; i < 768; i++) {
        display::graphics.palette()[i] = 0;
    }

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        draw_string(213, 101, "PAD ");

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

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

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

    }

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

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

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

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

                break;

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

                break;

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

                break;

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

                break;

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

                break;

            default:
                break;
            }
        }
    }

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


    WaitForMouseUp();

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

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

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

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

            if (Data->P[plr].Mission[pad].MissionCode == Mission_None) {
                FadeOut(2, display::graphics.palette(), 10, 0, 0);
                return;
            }
        }
    };
}
예제 #26
0
//screen number: 13
void highscore(){
	#ifdef EXCESSIVE
	printf("gamecreditsscreen\n");
	#endif
	if (currscreen!=prevscreen){
		dmpos=0;
		g1pos=0;
		g2pos=0;
		dmhs=false;
		g1hs=false;
		g2hs=false;
		loadscores();
		dmrank=11;
		g1rank=11;
		g2rank=11;
		for (int a=9;a>-1;a--){
			if (gptscore>dmscores[a]){
				dmrank=a;
				dmhs=true;
			}
			if (gpg1tscore>gscores[a]){
				g1rank=a;
				g1hs=true;
			}
			if (gpg2tscore>gscores[a]){
				g2rank=a;
				g2hs=true;
			}
		}
		sprintf(dminitials, "   ");
		sprintf(g1initials, "   ");
		sprintf(g2initials, "   ");
		dmoptionselected='A';
		g1optionselected='A';
		g2optionselected='A';
	}
	static long totalframes;
	totalframes+=int(steptime);
	static char dmsccap[60];
	if (dmrank==0)
	sprintf(dmsccap, "1st place");
	if (dmrank==1)
	sprintf(dmsccap, "2nd place");
	if (dmrank==2)
	sprintf(dmsccap, "3rd place");
	if (dmrank>2)
	sprintf(dmsccap, "%ith place", dmrank+1);
	static char g1sccap[60];
	if (g1rank==0)
	sprintf(g1sccap, "1st place");
	if (g1rank==1)
	sprintf(g1sccap, "2nd place");
	if (g1rank==2)
	sprintf(g1sccap, "3rd place");
	if (g1rank>2)
	sprintf(g1sccap, "%ith place", g1rank+1);
	static char g2sccap[60];
	if (g2rank==0)
	sprintf(g2sccap, "1st place");
	if (g2rank==1)
	sprintf(g2sccap, "2nd place");
	if (g2rank==2)
	sprintf(g2sccap, "3rd place");
	if (g2rank>2)
	sprintf(g2sccap, "%ith place", g2rank+1);
	
	static drawtext dmrankt;
	static drawtext g1rankt;
	static drawtext g2rankt;
	dmrankt.load(dmsccap,"grade.ttf",255,255,255,20);
	g1rankt.load(g1sccap,"grade.ttf",255,255,255,20);
	g2rankt.load(g2sccap,"grade.ttf",255,255,255,20);
	if (dmrank<10)dmrankt.draw(733,552,100,255,255,255,255,true,true);//52px apart.
	if (g1rank<10)g1rankt.draw(733,352,100,255,255,255,255,true,true);
	if (g2rank<10)g2rankt.draw(733,152,100,255,255,255,255,true,true);
	if (dmoptionselected<'A')
		dmoptionselected='Z'+2;
	if (dmoptionselected>'Z'+2)
		dmoptionselected='A';
	if (dmpos>2){
		if (dmoptionselected<'Z'+1)
			dmoptionselected='Z'+2;						
		if (dmoptionselected>'Z'+2)
			dmoptionselected='Z'+1;								
	}
	if (g1optionselected<'A')
		g1optionselected='Z'+2;
	if (g1optionselected>'Z'+2)
		g1optionselected='A';
	if (g1pos>2){
		if (g1optionselected<'Z'+1)
			g1optionselected='Z'+2;						
		if (g1optionselected>'Z'+2)
			g1optionselected='Z'+1;								
	}
	if (g2optionselected<'A')
		g2optionselected='Z'+2;
	if (g2optionselected>'Z'+2)
		g2optionselected='A';
	if (g2pos>2){
		if (g2optionselected<'Z'+1)
			g2optionselected='Z'+2;						
		if (g2optionselected>'Z'+2)
			g2optionselected='Z'+1;								
	}
	if (dmhs)dminitials[dmpos]=dmoptionselected;
	if (g1hs)g1initials[g1pos]=g1optionselected;
	if (g2hs)g2initials[g2pos]=g2optionselected;
	if (dmrank<10)draw_number(dminitials,753,492,8000,50);
	if (g1rank<10)draw_number(g1initials,753,292,8000,50);
	if (g2rank<10)draw_number(g2initials,753,92,8000,50);
}
예제 #27
0
/*     DigiBand (c)2005 Seijinohki PC Services and Software, This code written by Joe Wall with assitance from Velex
*      Loutzenhiser, and respected other parties.  This code is protected under the GPL License.  For any questions
*      regarding this code, please contact Joe @ www.seijinohki.net.
*
*      This software is free software; you can redistribute it and/or
*      modify it under the terms of the GNU Lesser General Public
*      License as published by the Free Software Foundation; either
*      version 2 of the License, or (at your option) any later version.
*
*      This software is distributed in the hope that it will be useful,
*      but WITHOUT ANY WARRANTY; without even the implied warranty of
*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
*      Lesser General Public License for more details.
*
*      You should have received a copy of the GNU Lesser General Public
*      License along with this software;  if not, write to the:
*      Free Software Foundation, Inc.
*      59 Temple Place - Suite 330
*      Boston, MA 02111-1307, USA
*/
void autoplayscreen(){
	#ifdef EXCESSIVE
	printf("autoplayscreen\n");
	#endif
	static int screenstart;
	if (!screenfaddingout){
		if (currscreen!=prevscreen){
			screenstart=SDL_GetTicks();
			srand(time(0));
			thesong=int((double(rand())/double(RAND_MAX))*double(gbsongcount));
			while(thesong==presong){
				thesong=int((double(rand())/double(RAND_MAX))*double(gbsongcount));
			}
			#ifdef DEBUG
			printf("I have determined song:%i will be played.\n",thesong);
			#endif
			playpreview(true);
			char playstring[512];
			jukeboxmode=true;
			guit1diff=2;
			guit2diff=2;
			drumdiff=2;
			if (drumdiff==2&&songs[thesong].drumextdiff<1)drumdiff=1;
			if (guit1diff==2&&songs[thesong].guitextdiff<1)guit1diff=1;
			if (guit2diff==2&&songs[thesong].guitextdiff<1)guit2diff=1;
			if (drumdiff==1&&songs[thesong].drumadvdiff<1)drumdiff=0;
			if (guit1diff==1&&songs[thesong].guitadvdiff<1)guit1diff=0;
			if (guit2diff==1&&songs[thesong].guitadvdiff<1)guit2diff=0;
			newsong=true;
			songs[0].reloadsong();
			songs[thesong].resetplayed();
			currbpm=songs[thesong].basebpm;
			loadscores();
		}
	}
	if (thesong<0||thesong>gbsongcount){
		printf("something changed the song var.");
		appisrunning=false;
		return;	
	}
	if (screenfaddingin||screenfaddingout){
		songposition=-240000;	
	}
	if (currbpm==0)
		currbpm=150;
	playrender();
	if (!screenfaddingin&&!screenfaddingout){
		#ifndef EXCESSIVE
		if ( songposition > ((songs[thesong].highestmeasure+3)*240000) || SDL_GetTicks()>screenstart+60000){
		#else
        if ( songposition > ((songs[thesong].highestmeasure+3)*240000) || SDL_GetTicks()>screenstart+10000){
		#endif
			//songs[thesong].resetplayed();
			nextscreen=21;
			screenfaddingout=true;
			screenchangenow=false;
			screenfaddingin=false;
		}
	}else{
		sprintf(curravi, "NULL");
	}
	draw_quadt2(0,801,601,0,223,167,255,255,255,255,0,0,backgroundtexture);
    if (songposition>0){
		if(!screenfaddingin&&!screenfaddingout){
			if (gpavi.isloaded()){
				gpavi.drawavi(289,384,8000,289,384);
			}else{
				draw_quadt2(0,289,384,0,289,384,255,255,255,255,0,0,previewtexture);
			}
		}
	}else{
		draw_quadt2(0,289,384,0,289,384,255,255,255,255,0,0,previewtexture);
	}
	draw_quad(0,512,384,1000,640,400,255,255,255,255,0,0,67);
	static char option1[256];
	sprintf(option1, "Coins %i/%i Credits (%i)", coinsinserted,coinsperplay,credits);
	static drawtext option1s;
	option1s.load(option1,"font.ttf",255,255,255,20);
	option1s.draw(400,2,5000,255,255,255,255,false,true);
	const int O1C=16;
	char osd1text[O1C][256];
	int osd1colors[O1C][3];
	static drawtext osd1[O1C];
	sprintf(osd1text[0], "Title:             %s", songs[thesong].name);
	osd1colors[0][0]=255;osd1colors[0][1]=255;osd1colors[0][2]=255;
	sprintf(osd1text[1], "Artist:            %s", songs[thesong].artist);
	osd1colors[1][0]=255;osd1colors[1][1]=255;osd1colors[1][2]=255;
	sprintf(osd1text[2], "Genre:             %s", songs[thesong].genre);
	osd1colors[2][0]=255;osd1colors[2][1]=255;osd1colors[2][2]=255;
	sprintf(osd1text[3], "From:              %s", songs[thesong].cat);
	osd1colors[3][0]=255;osd1colors[3][1]=255;osd1colors[3][2]=255;
	sprintf(osd1text[4], "Standard Stats:    (D-%i, G-%i,A-%i)",songs[thesong].drumbasdiff,songs[thesong].guitbasdiff,songs[thesong].guitbbasdiff);
	osd1colors[4][0]=0;osd1colors[4][1]=255;osd1colors[4][2]=0;
	sprintf(osd1text[5], "Drum Hi-Score:     %i (combo:%i)", songs[thesong].basdrumhs,songs[thesong].basdrummc);
	osd1colors[5][0]=192;osd1colors[5][1]=255;osd1colors[5][2]=192;
	sprintf(osd1text[6], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].basguitar1hs,songs[thesong].basguitar1mc);
	osd1colors[6][0]=192;osd1colors[6][1]=255;osd1colors[6][2]=192;
	sprintf(osd1text[7], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].basguitar2hs,songs[thesong].basguitar2mc);
	osd1colors[7][0]=192;osd1colors[7][1]=255;osd1colors[7][2]=192;
	sprintf(osd1text[8], "Advanced Stats:    (D-%i, G-%i,A-%i)",songs[thesong].drumadvdiff,songs[thesong].guitadvdiff,songs[thesong].guitbadvdiff);
	osd1colors[8][0]=255;osd1colors[8][1]=255;osd1colors[8][2]=0;
	sprintf(osd1text[9], "Drum Hi-Score:     %i (combo:%i)", songs[thesong].advdrumhs,songs[thesong].advdrummc);
	osd1colors[9][0]=255;osd1colors[9][1]=255;osd1colors[9][2]=192;
	sprintf(osd1text[10], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].advguitar1hs,songs[thesong].advguitar1mc);
	osd1colors[10][0]=255;osd1colors[10][1]=255;osd1colors[10][2]=192;
	sprintf(osd1text[11], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].advguitar2hs,songs[thesong].advguitar2mc);
	osd1colors[11][0]=255;osd1colors[11][1]=255;osd1colors[11][2]=192;
	sprintf(osd1text[12], "Extreme Stats:     (D-%i, G-%i,A-%i)",songs[thesong].drumextdiff,songs[thesong].guitextdiff,songs[thesong].guitbextdiff);
	osd1colors[12][0]=255;osd1colors[12][1]=0;osd1colors[12][2]=0;
	sprintf(osd1text[13], "Drum Hi-Score:     %i (combo:%i)", songs[thesong].extdrumhs,songs[thesong].extdrummc);
	osd1colors[13][0]=255;osd1colors[13][1]=192;osd1colors[13][2]=192;
	sprintf(osd1text[14], "Guitar 1 Hi-Score: %i (combo:%i)", songs[thesong].extguitar1hs,songs[thesong].extguitar1mc);
	osd1colors[14][0]=255;osd1colors[14][1]=192;osd1colors[14][2]=192;
	sprintf(osd1text[15], "Guitar 2 Hi-Score: %i (combo:%i)", songs[thesong].extguitar2hs,songs[thesong].extguitar2mc);
	osd1colors[15][0]=255;osd1colors[15][1]=192;osd1colors[15][2]=192;
	
	for (int a=0;a<O1C;a++){
		osd1[a].load(osd1text[a],"unicode.ttf",osd1colors[a][0],osd1colors[a][1],osd1colors[a][2],24);
		osd1[a].draw(593,735-a*19,8000,255,255,255,255,false,true);
	}	
	static double atimer=0;
	atimer+=double(steptime)/5000.0;
	int alpha=int(sin(atimer)*2048.0);
	if (alpha<0)alpha=0;
	if (alpha>255)alpha=255;
	const int O2C=11;
	static char osd2[O2C][256];
	sprintf(osd2[0], "Best Drum Players");
	for (int a=0;a<O2C-1;a++){
		sprintf(osd2[a+1], "  %s %i", dmscorenames[a],dmscores[a]);
	}
	for (int a=0;a<O2C;a++){
		int s=18;
		if (a==0)
			draw_number(osd2[a],643+s,394-(a*(s*2)),8000,s,0,255,0,alpha);
		else
			draw_number(osd2[a],643+s,394-(a*(s*2)),8000,s,255,255,255,alpha);
	}
	alpha=-int(sin(atimer)*2048.0);
	if (alpha<0)alpha=0;
	if (alpha>255)alpha=255;
	const int O3C=11;
	static char osd3[O3C][256];
	sprintf(osd3[0], "Best Guitar Players");
	for (int a=0;a<O3C-1;a++){
		sprintf(osd3[a+1], "   %s %i", gscorenames[a],gscores[a]);
	}
	for (int a=0;a<O3C;a++){
		int s=18;
		if (a==0)
			draw_number(osd3[a],625+s,394-(a*(s*2)),8000,s,255,0,0,alpha);
		else
			draw_number(osd3[a],625+s,394-(a*(s*2)),8000,s,255,255,255,alpha);
	}
}
예제 #28
0
void DisplAstData(char plr, char *where, char *where2)
{
    int num = abuf[*where].MissionNum[*where2], num2;

    fill_rectangle(1, 40, 157, 182, 3);

    if (abuf[*where].Missions == 0) {
        vhptr2->copyTo(display::graphics.screen(), 22, 69);
        return;
    }

    display::graphics.setForegroundColor(2);
    pline(20, 111, 138, 111);
    display::graphics.setForegroundColor(4);
    pline(20, 113, 138, 113);


    if (Data->P[plr].History[num].Hard[PAD_A][Mission_Capsule] != -1) {
        PatchMe(plr, 7, 41, Data->P[plr].History[num].Hard[PAD_A][Mission_Capsule], Data->P[plr].History[num].Patch[0], 32);
    } else {
        PatchMe(plr, 7, 41, Data->P[plr].History[num].Hard[PAD_B][Mission_Capsule], Data->P[plr].History[num].Patch[1], 32);
    }

    display::graphics.setForegroundColor(1);
    draw_string(43, 53, "PRESTIGE: ");
    draw_number(93, 53, Data->P[plr].History[num].Prestige);
    draw_string(43, 63, "DURATION: ");

    switch (Data->P[plr].History[num].Duration) {
    case 1:
        draw_string(93, 63, "A");
        break;

    case 2:
        draw_string(93, 63, "B");
        break;

    case 3:
        draw_string(93, 63, "C");
        break;

    case 4:
        draw_string(93, 63, "D");
        break;

    case 5:
        draw_string(93, 63, "E");
        break;

    case 6:
        draw_string(93, 63, "F");
        break;

    default:
        break;
    }

    draw_string(10, 83, "DESCRIPTION: ");

    display::graphics.setForegroundColor(9);
    draw_string(43, 45, &Data->P[plr].History[num].MissionName[0][0]);

    GetMisType(Data->P[plr].History[num].MissionCode);
    draw_string(10, 93, Mis.Abbr);

    if (*where2 == abuf[*where].Missions - 1) {
        fill_rectangle(1, 114, 157, 184, 3);

        return;
    }

    num2 = abuf[*where].MissionNum[*where2 + 1];

    if (num2 < 1 || num2 > 56) {
        return;
    }

    //astro history patch fix
    if (Data->P[plr].History[num2].Hard[PAD_A][Mission_Capsule] != -1) {
        PatchMe(plr, 7, 116, Data->P[plr].History[num2].Hard[PAD_A][Mission_Capsule], Data->P[plr].History[num2].Patch[0], 32);
    } else {
        PatchMe(plr, 7, 116, Data->P[plr].History[num2].Hard[PAD_B][Mission_Capsule], Data->P[plr].History[num2].Patch[1], 32);
    }

    display::graphics.setForegroundColor(9);
    draw_string(43, 120, &Data->P[plr].History[num2].MissionName[0][0]);

    GetMisType(Data->P[plr].History[num2].MissionCode);
    draw_string(10, 168, Mis.Abbr);

    display::graphics.setForegroundColor(1);
    draw_string(43, 128, "PRESTIGE: ");
    draw_number(93, 128, Data->P[plr].History[num2].Prestige);
    draw_string(43, 138, "DURATION: ");

    switch (Data->P[plr].History[num2].Duration) {
    case 1:
        draw_string(93, 138, "A");
        break;

    case 2:
        draw_string(93, 138, "B");
        break;

    case 3:
        draw_string(93, 138, "C");
        break;

    case 4:
        draw_string(93, 138, "D");
        break;

    case 5:
        draw_string(93, 138, "E");
        break;

    case 6:
        draw_string(93, 138, "F");
        break;

    default:
        break;
    }

    draw_string(10, 158, "DESCRIPTION: ");

    return;
}
예제 #29
0
void DrawReview(char plr)
{
    int clr, i, cte, P_value;
    char Fired_Flag = 0, Reset_Flag = 0;

    if (Data->P[plr].PresRev[0] != 0x7F) {
        FadeOut(2, display::graphics.palette(), 10, 0, 0);
    }

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

    if (Data->P[plr].PresRev[0] == 0x7F) {
        Fired_Flag = 1;
        Data->P[plr].PresRev[0] = 16;
    } else if (Data->P[plr].PresRev[0] >= 16) {
        Reset_Flag = 1;
        Data->P[plr].PresRev[0] = 15;
    }

    ShBox(0, 0, 319, 22);
    ShBox(0, 24, 319, 199);
    draw_small_flag(plr, 4, 4);
    fill_rectangle(5, 28, 314, 195, 0);
    fill_rectangle(5, 122, 314, 195, 0);
    ShBox(6, 123, 313, 194);
    fill_rectangle(7, 124, 312, 193, 9);
    InBox(11, 128, 307, 189);
    fill_rectangle(12, 129, 306, 188, 7);
    ShBox(6, 29, 177, 121);
    ShBox(179, 29, 313, 121);
    InBox(182, 32, 309, 117);
    InBox(3, 3, 30, 19);
    IOBox(243, 3, 316, 19);

    if (plr == 0) {
        draw_heading(40, 5, "PRESIDENTIAL REVIEW", 0, -1);
    } else {
        draw_heading(40, 5, "POLITBURO REVIEW", 0, -1);
    }

    display::graphics.setForegroundColor(1);
    draw_string(257, 13, "CONTINUE");
    display::graphics.setForegroundColor(1);
    draw_string(59, 36, "JOB PERFORMANCE");
    display::graphics.setForegroundColor(6);
    draw_string(8, 46, "GOOD");
    display::graphics.setForegroundColor(1);
    draw_string(8, 77, "FAIR");
    display::graphics.setForegroundColor(9);
    draw_string(8, 109, "POOR");
    display::graphics.setForegroundColor(1);
    draw_number(154, 117, Data->Year - 1);
    draw_number(126, 117, Data->Year - 2);
    draw_number(97, 117, Data->Year - 3);
    draw_number(70, 117, Data->Year - 4);
    draw_number(42, 117, Data->Year - 5);
    fill_rectangle(32, 39, 172, 111, 0);
    GradRect(33, 39, 171, 74, 0);
    GradRect(33, 75, 171, 110, 0);
    display::graphics.setForegroundColor(3);
    pline(60, 40, 60, 110);
    pline(88, 40, 88, 110);
    pline(116, 40, 116, 110);
    pline(144, 40, 144, 110);
    pline(33, 48, 171, 48);
    pline(33, 57, 171, 57);
    pline(33, 66, 171, 66);
    pline(33, 75, 171, 75);
    pline(33, 84, 171, 84);
    pline(33, 93, 171, 93);
    pline(33, 102, 171, 102);
    InBox(32, 39, 172, 111);

    for (i = 0; i < 5; i++) if (Data->P[plr].PresRev[i] > 16) {
            Data->P[plr].PresRev[i] = 16;
        }

    for (i = 0; i < 5; i++) {
        cte = 0;

        if (Data->P[plr].PresRev[i] < 8) {
            if (Data->P[plr].PresRev[i] == 7) {
                cte = 73;
            } else {
                cte = 40 + Data->P[plr].PresRev[i] * 5;
            }
        } else if (Data->P[plr].PresRev[i] > 8) {
            if (Data->P[plr].PresRev[i] == 9) {
                cte = 77;
            } else {
                cte = 80 + (Data->P[plr].PresRev[i] - 10) * 5;
            }
        };

        if (Data->P[plr].PresRev[i] == 8) {
            cte = 73;
        }

        fill_rectangle(166 - i * 28, 75, 151 - i * 28, cte, 5 + ((Data->P[plr].PresRev[i] <= 8) ? 0 : 3));
        display::graphics.setForegroundColor(6 + ((Data->P[plr].PresRev[i] <= 8) ? 0 : 3));
        pline(167 - i * 28, 75, 167 - i * 28, cte);
    }

    if (Fired_Flag == 1) {
        clr = 0;

        for (i = 0; i < Data->P[plr].AstroCount; i++)
            if (Data->P[plr].Pool[i].Status == AST_ST_DEAD) {
                clr++;
            }

        Data->P[plr].PresRev[0] = (clr >= 2) ? 17 : 16;
    }

    DrawRevText(plr, Data->P[plr].PresRev[0]);

    if (Data->P[plr].PresRev[0] == 17) {
        Data->P[plr].PresRev[0] = 16;
    }

    P_value = 0;

    // 0 pres. 1 v.p.
    if (plr == 0) {
        if (Data->P[plr].PresRev[0] <= 4 || Data->P[plr].PresRev[0] >= 11) {
            P_value = 0;
        } else {
            P_value = 1;
        }
    };

    if (plr == 1) {
        if (Data->P[plr].PresRev[0] <= 4 || Data->P[plr].PresRev[0] >= 12) {
            P_value = 0;
        } else {
            P_value = 1;
        }
    }

    if (plr == 0) {
        if (Data->Year <= 60) {
            if (P_value == 0) {
                PresPict(0);
            } else {
                PresPict(1);
            }
        } else if (Data->Year >= 61 && Data->Year <= 63) {
            if (P_value == 0) {
                PresPict(2);
            } else {
                PresPict(3);
            }
        } else if (Data->Year >= 64 && Data->Year <= 68) {
            if (P_value == 0) {
                PresPict(4);
            } else {
                PresPict(5);
            }
        } else if (Data->Year >= 69 && Data->Year <= 73) {
            if (P_value == 0) {
                PresPict(6);
            } else {
                PresPict(7);
            }
        } else if (Data->Year >= 74 && Data->Year <= 76) {
            if (P_value == 0) {
                PresPict(8);
            } else {
                PresPict(9);
            }
        } else if (Data->Year >= 77) {
            if (P_value == 0) {
                PresPict(10);
            } else {
                PresPict(11);
            }
        }
    }

    if (plr == 1) {
        if (Data->Year < 61) {
            if (P_value == 0) {
                PresPict(14);
            } else {
                PresPict(15);
            }
        } else if (Data->Year <= 64) {
            if (P_value == 0) {
                PresPict(12);
            } else {
                PresPict(13);
            }
        } else if (Data->Year >= 65) {
            if (P_value == 0) {
                PresPict(16);
            } else {
                PresPict(17);
            }
        }
    }

    if (Reset_Flag == 1) {
        Data->P[plr].PresRev[0] = 16;
    }

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

    return;
}
예제 #30
0
void Museum(char plr)
{
    int i, tots = 7, beg;
    char AName[7][22] = {"DIRECTOR RANKING", "SPACE HISTORY", "MISSION RECORDS", "PRESTIGE SUMMARY",
                         "HARDWARE EFFICIENCY", "ASTRONAUT HISTORY", "EXIT THE MUSEUM"
                        };
    char AImg[7] = {8, 9, 10, 11, 13, 14, 0};

    if (Data->P[plr].AstroCount == 0) {
        memcpy(&AName[5][0], &AName[6][0], 22); // move up Exit
        AImg[5] = AImg[6];
        tots = 6;
    } else if (plr == 1) {
        strncpy(&AName[5][0], "COSMO", 5);
    }

    AImg[3] += plr;
    // FadeOut(2,pal,10,0,0);
    music_start(M_THEME);
    beg = 0;

    do {
        if (beg == 0) {
            beg = (Data->P[plr].AstroCount > 0) ? 7 : 6;    // mods for astros
        } else {
            FadeOut(2, display::graphics.palette(), 10, 0, 0);

            DrawSpaceport(plr);
            PortPal(plr);
            fill_rectangle(166, 191, 318, 198, 3);
            display::graphics.setForegroundColor(0);
            draw_string(257, 197, "CASH:");
            draw_megabucks(285, 197, Data->P[plr].Cash);
            display::graphics.setForegroundColor(11);
            draw_string(256, 196, "CASH:");
            draw_megabucks(284, 196, Data->P[plr].Cash);
            display::graphics.setForegroundColor(0);

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

            draw_number(0, 0, Data->Year);
            display::graphics.setForegroundColor(11);

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

            draw_number(0, 0, Data->Year);

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

        helpText = (plr == 0) ? "i700" : "i701";
        keyHelpText = (plr == 0) ? "k603" : "k604";
        i = BChoice(plr, tots, &AName[0][0], &AImg[0]);

        switch (i) {
        case 1:
            RankMe(plr);
            break;

        case 2:
            helpText = "i130";
            keyHelpText = "k031";
            ShowSpHist(plr);
            break;

        case 3:
            helpText = "i131";
            keyHelpText = "k321";
            Records(plr);
            break;

        case 4:
            helpText = "i132";
            keyHelpText = "k033";
            ShowPrest(plr);
            break;

        case 5:
            helpText = "i034";
            ShowHard(plr);
            break;

        case 6:
            helpText = (plr == 0) ? "i133" : "i134";
            keyHelpText = (plr == 0) ? "k035" : "k441";

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

            break;

        case 7:
        default:
            break;
        }

        helpText = "i000";
        keyHelpText = "k000";
    } while (i != beg);

    music_stop();
    return;
}