static void dx_uninitialize(void) { if (directX == DXFULLSCREEN) menu_delete(resizeitems, uiw_no_resizeitems_i18n); menu_delete(cutpasteitems, uiw_no_cutpasteitems_i18n); DeInitDD(); }
/* * in game menu_loop, will called every game loop. * As long as this menu is displayed the gamekeys will not work. * * the drawings will be done from the main loop. So we won't * have to draw anything on our own. * * Pressing ESC will bring you back to the game. */ void game_menu_loop (SDL_Event * event, int eventstate) { int done; if (menu == NULL) return; menu_draw (menu); done = menu_event_loop (menu, event, eventstate); /* * check if one of the buttons was pressed */ if (done != 0) { if (menu->focus->id == 2 && (GT_MP_PTPM || GT_SP)) { /* End Round */ bman.timeout = -GAME_OVERTIMEOUT; } else if (menu->focus->id == 3) { /* End Game */ /* send network update */ if (GT_MP) net_game_send_delplayer (bman.p_nr); bman.state = GS_quit; } else { /* Quit Menu */ menu_delete (menu); menu = NULL; gfx_blitdraw (); draw_field (); } } };
/*ARGSUSED*/ int stobjstrm_delete(WINDOW *win, node_t *current, node_t *list) { data_t *d; if(current == NULL || current->data == NULL) { return 0; } d = (data_t *)(current->data); return menu_delete(win, d->parent, list); }
/* * 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); } };
void game_loop () { SDL_Event event; int done = 0, eventstate; if (GT_MP) net_game_fillsockaddr (); if ( SDL_InitSubSystem ( SDL_INIT_JOYSTICK ) < 0 ) { fprintf ( stderr, "Unable to initialize Joystick: %s\n", SDL_GetError() ); } printf ( "%i joysticks found\n", SDL_NumJoysticks () ); menu = NULL; bman.updatestatusbar = 1; // force an update timestamp = SDL_GetTicks (); // needed for time sync. d_gamedetail ("GAME START"); gfx_blitupdaterectclear (); draw_logo (); draw_field (); SDL_Flip (gfx.screen); draw_players (); if (bman.p_nr >= 0 && bman.p_nr < MAX_PLAYERS) { players[bman.p_nr].ready = 1; if (GT_MP_PTPS) send_playerdata (&players[bman.p_servnr].net.addr, bman.p_nr, &players[bman.p_nr]); } if (bman.p2_nr >= 0 && bman.p2_nr < MAX_PLAYERS) { players[bman.p2_nr].ready = 1; if (GT_MP_PTPS) send_playerdata (&players[bman.p_servnr].net.addr, bman.p2_nr, &players[bman.p2_nr]); } fire_init(); while (!done && (bman.state == GS_running || bman.state == GS_ready)) { SDL_JoystickUpdate (); if ((eventstate = SDL_PollEvent (&event)) != 0) switch (event.type) { case (SDL_QUIT): done = 1; bman.state = GS_quit; } /* * input handling */ keyb_loop (&event); game_keys_loop (); if (GT_MP) chat_loop (&event); if ((!IS_LPLAYER2) && (!chat.active)) chat_setactive (1, 1); restore_players_screen (); player_check (bman.p_nr); if (IS_LPLAYER2) player_check (bman.p2_nr); dead_playerani (); special_loop (); player_move (bman.p_nr); if (IS_LPLAYER2) player_move (bman.p2_nr); if (GT_MP) { player_calcpos (); network_loop (); } if (bman.state == GS_running) single_loop (); bomb_loop (); /* wind_loop (); SOON */ fire_loop (); field_loop (); flitems_loop (); draw_players (); game_draw_info (); // will set the var bman.player_nr /* check if there is only one player left and the game is in multiplayer mode and if there the last dieing animation is done */ if (game_check_endgame () && bman.timeout >= 0.0f) bman.timeout = 0.0f; if ((GT_SP || GT_MP_PTPM) && bman.timeout < -GAME_OVERTIMEOUT) { d_printf ("GAME: Game Over\n"); done = 1; } stonelist_draw (); /* if there is any menu displayed do so */ if (menu != NULL) game_menu_loop (&event, eventstate); gfx_blitdraw (); s_calctimesync (); bman.timeout -= timediff; } if (menu != NULL) { menu_delete (menu); menu = NULL; } gfx_blitdraw (); chat_show (-1, -1, -1, -1); draw_logo (); gfx_blitupdaterectclear (); SDL_Flip (gfx.screen); d_gamedetail ("GAME END"); d_printf ("done = %d\n", done); };
static void win32_uninitialize(void) { DeInitWindow(); menu_delete(cutpasteitems, uiw_no_cutpasteitems_i18n); }
void ex_cmd_cleanup() { log_msg("CLEANUP", "ex_cmd_cleanup"); menu_delete(ex.menu); }
/* 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); };