Example #1
0
/*
 * create the in game menu
 */
void
game_menu_create ()
{
    if (menu != NULL)
        return;

    menu = menu_new ("Gamemenu", 300, 150);

    menu_create_button (menu, "Back to the Game", -1, 50, 200, 1);
    if (GT_SP || GT_MP_PTPM)
        menu_create_button (menu, "End this Round", -1, 80, 200, 2);
    menu_create_button (menu, "Quit the Game", -1, 110, 200, 3);

    menu_focus_id (menu, 1);
    menu->looprunning = 1;
};
Example #2
0
/*
 * show the manual pages
 */
void help (int showpage)
{
    int page = showpage, menuselect = 2, y = 0;
    char title[255];
    _menu *menu;

    menu_displaytext ("Please Wait", "Loading GFX Data");

    if (page < 0 || page >= HP_max)
        page = 0;

    while (menuselect != -1 && menuselect != 1 && bman.state != GS_quit) {
        if (page == HP_howto0) {
            sprintf (title, "How To Play (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);
            menu_create_text (menu, "help", 5, 55, 53, 20, COLOR_brown,
                              "The goal of the game is to be the last one, "
                              "who is alive. You can drop bombs which will explode after "
                              "a certain time and destroy everything in horizontal and vertical "
                              "direction. So you can remove stones or kill other players. But take care. "
                              "Don't kill yourself otherwise the game will be over for you. During the "
                              "game you will find diffrenent powerups to raise your skills. If you are "
                              "running faster than your opponent and you have many bombs, you can catch "
                              "him within lots of bombs and he has no chance to escape.");

            menu_create_image (menu, "img", 450, 255, 0, gfx.players[0].menu_image, NULL);

            menu_create_text (menu, "help", 5, 255, 45, 10, COLOR_brown,
                              "You will get points for every player you have killed. "
                              "If you win the game, you can earn additional points "
                              "depending on how many players played the game. ");
        } else if (page == HP_powerup0) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 50;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "In the game you will find some diffend kind of powerups. "
                              "There are the powerups who give you more power for the whole game "
                              "and the special powerups which will hold only for a certain time.");
            y += 75;

            menu_create_label (menu, "Permanent Powerups", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_image (menu, "bomb", 5, y, 0, gfx.menu_field[FT_bomb], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
            y += 40;

            menu_create_image (menu, "fire", 5, y, 1, gfx.menu_field[FT_fire], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "The range of your bombs will be increased. Maximum range is %d.", MAX_RANGE);
            y += 40;

            menu_create_image (menu, "shoe", 5, y, 1, gfx.menu_field[FT_shoe], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "This will make your player run faster. The maximum speed will be %1.2f.", MAX_SPEED);
            y += 40;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Depends how the game is set up, you'll lose "
                              "these powerups if you die. Other players can collect them. "
                              "In the deathmatch mode you can keep the powerups you collected, "
                              "but this depends on the Game if you drop them or not.");
            y += 40;
        } else if (page == HP_powerup1) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 45;

            menu_create_label (menu, "Special Powerups", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_image (menu, "kick", 5, y, 1, gfx.menu_field[FT_sp_kick], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "Allowes you to kick some bombs around the level. This will hold "
                              "just a short time of %d seconds. The maximum distance you can "
                              "kick the bombs is %d fields.", SPECIAL_KICK_TIME, SPECIAL_KICK_MAXDIST);
            y += 70;

            menu_create_image (menu, "push", 5, y, 1, gfx.menu_field[FT_sp_push], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "Push bombs one field, as long as nothing is behind this bomb.");
            y += 40;

            menu_create_image (menu, "droprow", 5, y, 1, gfx.menu_field[FT_sp_row], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "You can drop a row of that many bombs you have still left to drop.");
            y += 40;

            menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_liquid], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "The bomb you push now won't stop moving untill they explode.");
            y += 40;

            menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_moved], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "The bomb you push will stop moving on the next border or bomb.");
            y += 40;

            menu_create_image (menu, "dropltrigger", 5, y, 1, gfx.menu_field[FT_sp_trigger], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "You will be able to drop triggered bombs. Use "
                              "the special key to let all your bombs explode. "
                              "at the time where you want it.");
            y += 40;
        } else if (page == HP_powerup2) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 45;

            menu_create_label (menu, "Death Item", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "In the game you will find another type of item to collect. "
                              "This item is not a powerup at all. If you collect it you will "
                              "get a random illness. This illness will hold for %dseconds. "
                              "If you have contact to another player the other player will "
                              "get all the illnesses you have too.", ILL_TIMEOUT);
            y += 110;

            menu_create_image (menu, "pwdeath", 12, y+8, 1, gfx.menu_field[FT_death], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "This will make your player ill. We have at the moment %d diffrent "
                              "types of illnesses for you to collect. To make the game more", PI_max);
            y += 3*font[0].size.y;
            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "interesting we won't put here a list of all types there are.");
        } else if (page == HP_keyboard0) {
            sprintf (title, "Keyboard (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 50;

            menu_create_label (menu, "During a Game", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;

            menu_create_image (menu, "img", 450, 100, 0, gfx.players[7].menu_image, NULL);

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Arrow Keys - Moving of the Player\n"
                              "STRG/CTRL  - Dropping bombs\n"
                              "Shift      - Special Use Key\n"
                              "F4         - Start the Game (only Server)\n"
                              "F8         - Fullscreen (not in Windows)\n"
                              "Return     - Send Entered Text Message\n"
                              "ESC        - Exit Game\n");
            y += 7*font[0].size.y;

            menu_create_label (menu, "Player Selection", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Left/Right - Select and Deselect a Player\n"
                              "F1	        - Mini Help Screen\n"
                              "F2         - Player Screen\n"
                              "F3         - Map and Game Settings\n"
                              "F4         - Start the Game if at last 2 Players\n"
                              "             are selected. (only Server)\n"
                              "ESC        - Exit Game\n");
        } else if (page == HP_credit0) {
            sprintf (title, "About BomberClone (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            menu_create_image (menu, "img", 15, 60, 0, gfx.players[4].menu_image, NULL);
            menu_create_text (menu, "help", 75, 50, 45, 10, COLOR_brown,
                              "If you have any problems or questions with the game you can send your questions "
                              "to the mailinglist or directly to me. Bugfixes should be send to the SourceForge "
                              "Projects page about BomberClone.");

            menu_create_label (menu, "WWW",-1, 140, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 165, 53, 10, COLOR_brown, "http://www.bomberclone.de");

            menu_create_label (menu, "EMail",-1, 185, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 210, 53, 10, COLOR_brown, "*****@*****.**");

            menu_create_label (menu, "Project Page",-1, 230, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 255, 53, 10, COLOR_brown, "http://sourceforge.net/projects/bomberclone");
        } else if (page == HP_credit1) {
            sprintf (title, "People (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            menu_create_image (menu, "img", 250, 100, 0, gfx.players[6].menu_image, NULL);

            y = 50;
            menu_create_label (menu, "Coding:", 5, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 50, y, 53, 10, COLOR_brown,
                              "  Steffen Pohle\n"
                              "Patrick Wilczek\n");

            y = 100;
            menu_create_label (menu, "GFX:", 425, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 325, y, 53, 10, COLOR_brown,
                              "TekkRat\n"
                              "Martijn de Boer\n"
                              "Steffen Pohle\n"
                              "Patrick Wilczek\n");

            y = 140;
            menu_create_label (menu, "Sound/Music:", 5, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 50, y, 53, 10, COLOR_brown,
                              "Henrik_Enqvist\n"
                              "Cerror\n"
                              "Martijn de Boer\n");

            y = 240;
            menu_create_label (menu, "Thanks To:", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", -1, y, 53, 10, COLOR_brown,
                              "kitutou(coding/fixing), thaphool(tilesets), ob1kenewb(coding/fixing), "
                              "TeKkraT(website,gfx), caccola(tilesets), Digital_D(music), "
                              "dcdillon(coding), Psycho(music),\nNiklas Sj\xf6sv\xe4rd(music)");

        } else break;

        if (page > 0) menu_create_button (menu, "Previous Page", 20, 370, 150, 0);
        else if (menuselect == 0)
            menuselect = 2;
        menu_create_button (menu, "Main Menu", -1, 370, 150, 1);
        if (page < HP_max-1) menu_create_button (menu, "Next Page", 350, 370, 150, 2);

        menu_focus_id (menu, menuselect);
        menuselect = menu_loop (menu);
        if (menuselect == 0 && page > 0)
            page--;
        if (menuselect == 2 && page < HP_max - 1)
            page++;
        menu_delete (menu);
    }
};
Example #3
0
/* singleplayer menĂ¼ with some options you can make */
void
single_menu ()
{
    int i,
		p,
		eventstate = 0,
        done = 0,
		second_player = 0;
    _charlist nrplayerlist[MAX_PLAYERS + 1];
    _charlist *selnrplayer = &nrplayerlist[bman.ai_players];
	_menu *menu;
	_menuitem *aiplayer = NULL;
	SDL_Event event;

    /* fill in the nrplayerlist */
    for (p = 0, i = 0; p < MAX_PLAYERS + 1; i++) {
        sprintf (nrplayerlist[i].text, "%d", p);
        if (p < MAX_PLAYERS - 1)
            nrplayerlist[i].next = &nrplayerlist[i + 1];
        else
            nrplayerlist[i].next = NULL;
        p++;
    }
	
	game_resetdata ();
	
	menu = menu_new ("Single Game", 380,240);
	
	menu_create_text (menu, "numpl", 20, 50, 12, 2, COLOR_yellow, "Number of\nAI Players");
	aiplayer = menu_create_list (menu, "AI Players", 40, 90, 50, 100, nrplayerlist, &selnrplayer, 3);
	
	menu_create_button (menu,"Change Playernames" ,160, 50, 210, 4);

	menu_create_bool (menu, "Use Second Player", 160, 90, 210, &second_player, 5);

	menu_create_button (menu, "Game Options", 180, 130, 150, 6);
	menu_create_button (menu, "Map Options", 180, 170, 150, 7);
	menu_create_button (menu, "Main Menu", 30, 220, 150, 1);
	menu_create_button (menu, "Start", 220, 220, 150, 2);
	
	menu_focus_id (menu, 2);
	menu->looprunning = 1;
	menu_draw (menu);
	
	do {
		gfx_blitdraw ();
		eventstate = s_fetchevent (&event);

		done = menu_event_loop (menu, &event, eventstate);

		if (done > 0 && menu->focus->id == 6) {
			done = 0;
			mapgamesetting ();
		}
		
		if (done > 0 && menu->focus->id == 7) {
			done = 0;
			mapmenu ();
		}
		
		if (done > 0 && menu->focus->id == 4) {
			done = 0;
			playernamemenu ();
		}
		
		if (done > 0 && menu->focus->id == 3)
			done = 0;
		
		s_calctimesync ();
	} while (!done); 
	
	bman.ai_players = selnrplayer - &nrplayerlist[0];
	
	if (menu->focus->id == 2)
		single_playergame (second_player, bman.ai_players);

	menu_delete (menu);
};