void Dodger::welcome_screen() { static bool first_call = true; if (first_call) { first_call = false; load_screen(screens::welcome_screen); } if (next_screen) { first_call = true; new_game(); game_state = playing; } }
void Dodger::well_done_screen() { static bool first_call = true; if (first_call) { first_call = false; load_screen(screens::well_done_screen); play_sound(sounds.wdone); std::cout << "well done" << std::endl; } if (next_screen) { game_state = welcome; first_call = true; } }
void Dodger::game_over_screen() { static bool first_call = true; if (first_call) { first_call = false; load_screen(screens::game_over_screen); play_sound(sounds.gover); std::cout << "game over" << std::endl; } if (next_screen) { game_state = welcome; first_call = true; } }
void Dodger::new_level() { level = levels[level_number - 1]; score_panel.set_level(level_number); load_screen(level.data); enemies.clear(); for (int i = 0; i < Level::num_enemies; i++) { if (level.enemies[i]) { enemies.push_back(Enemy(i, level.speed)); } } new_life(); }
void touch( void ) { freeze(1); sp_x(1, 283); sp_y(1, 320); sp_seq(1, 452); sp_frame(1, 1); sp_nocontrol(1, 1); //dink can't move until anim is done! sp_touch_damage(¤t_sprite, 0); sp_brain(1, 0); wait(2000); script_attach(1000); fade_down(); &player_map = 198; sp_x(1, 315); sp_y(1, 375); load_screen(198); sp_brain(1, 1); draw_screen(); fade_up(); kill_this_task(); }
int main(int ac, char **av) { t_visu *visu; if (ac == 2 && my_strcmp(av[1], "--help") == 0) return (show_help()); if ((visu = bunny_malloc(sizeof(t_visu))) == NULL) return (-1); visu->start_rendu = 0; if (!(visu->win = bunny_start(WIDTH, HEIGHT, false, "LEMIN DISPLAYER")) || (!(visu->pix = bunny_new_pixelarray(WIDTH, HEIGHT))) || (check_args(visu) == -1) || (load_ant(visu, av[1]) == -1) || (load_screen(visu, av[1]) == -1) || (start_music(visu, av[1]) == -1) || (init_ant_struct(visu) == -1)) return (-1); visu->rooms = reverse_rooms(visu->rooms); bunny_set_key_response(events); bunny_set_loop_main_function(main_loop); bunny_loop(visu->win, 60, visu); close_music(visu); delete_all_clipables(visu); free_all(visu); return (0); }
void root_menu(void) { int previous_browser = GO_TO_FILEBROWSER; int selected = 0; if (global_settings.start_in_screen == 0) next_screen = (int)global_status.last_screen; else next_screen = global_settings.start_in_screen - 2; add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, rootmenu_track_changed_callback); #ifdef HAVE_RTC_ALARM if ( rtc_check_alarm_started(true) ) { rtc_enable_alarm(false); next_screen = GO_TO_WPS; #if CONFIG_TUNER if (global_settings.alarm_wake_up_screen == ALARM_START_FM) next_screen = GO_TO_FM; #endif #ifdef HAVE_RECORDING if (global_settings.alarm_wake_up_screen == ALARM_START_REC) { recording_start_automatic = true; next_screen = GO_TO_RECSCREEN; } #endif } #endif /* HAVE_RTC_ALARM */ #ifdef HAVE_HEADPHONE_DETECTION if (next_screen == GO_TO_WPS && (global_settings.unplug_autoresume && !headphones_inserted() )) next_screen = GO_TO_ROOT; #endif while (true) { switch (next_screen) { case MENU_ATTACHED_USB: case MENU_SELECTED_EXIT: /* fall through */ case GO_TO_ROOT: if (last_screen != GO_TO_ROOT) selected = get_selection(last_screen); #if (CONFIG_PLATFORM&PLATFORM_ANDROID) /* When we are in the main menu we want the hardware BACK * button to be handled by Android instead of rockbox */ android_ignore_back_button(true); #endif next_screen = do_menu(&root_menu_, &selected, NULL, false); #if (CONFIG_PLATFORM&PLATFORM_ANDROID) android_ignore_back_button(false); #endif if (next_screen != GO_TO_PREVIOUS) last_screen = GO_TO_ROOT; break; case GO_TO_PREVIOUS: next_screen = last_screen; break; case GO_TO_PREVIOUS_BROWSER: next_screen = previous_browser; break; case GO_TO_PREVIOUS_MUSIC: next_screen = previous_music; break; case GO_TO_ROOTITEM_CONTEXT: next_screen = load_context_screen(selected); break; #ifdef HAVE_PICTUREFLOW_INTEGRATION case GO_TO_PICTUREFLOW: while ( !tagcache_is_usable() ) { splash(0, str(LANG_TAGCACHE_BUSY)); if ( action_userabort(HZ/5) ) break; } { char pf_path[MAX_PATH]; snprintf(pf_path, sizeof(pf_path), "%s/pictureflow.rock", PLUGIN_DEMOS_DIR); next_screen = load_plugin_screen(pf_path); } previous_browser = GO_TO_PICTUREFLOW; break; #endif default: if (next_screen == GO_TO_FILEBROWSER #ifdef HAVE_TAGCACHE || next_screen == GO_TO_DBBROWSER #endif ) previous_browser = next_screen; if (next_screen == GO_TO_WPS #if CONFIG_TUNER || next_screen == GO_TO_FM #endif ) previous_music = next_screen; next_screen = load_screen(next_screen); break; } /* switch() */ } }
int main(int argc, char *argv[]) { int ch; int which = 0; int last; bool replaying = FALSE; bool done = FALSE; char **files; while ((ch = getopt(argc, argv, "ir")) != -1) { switch (ch) { case 'i': use_init = TRUE; break; case 'r': replaying = TRUE; break; default: usage(); break; } } initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); curs_set(0); if (has_colors()) { start_color(); for (ch = 0; ch < COLOR_PAIRS; ++ch) { short pair = ch % COLOR_PAIRS; init_pair(pair, COLOR_WHITE, ch % COLORS); } } files = argv + optind; last = argc - optind - 1; if (replaying) { /* * Use the last file as the initial/current screen. */ if (last < 0) { endwin(); printf("No screen-dumps given\n"); ExitProgram(EXIT_FAILURE); } which = last; if (load_screen(files[which]) == ERR) { endwin(); printf("Cannot load screen-dump %s\n", files[which]); ExitProgram(EXIT_FAILURE); } after_load(); while (!done && (ch = getch()) != ERR) { switch (ch) { case 'n': /* * If we got a "next" here, skip to the final screen before * moving to the next process. */ setup_next(); which = last; done = TRUE; break; case 'q': endwin(); cleanup(files); done = TRUE; break; case KEY_BACKSPACE: case '\b': if (--which < 0) which = last; break; case ' ': if (++which > last) which = 0; break; default: beep(); continue; } if (ch == 'q') { ; } else if (scr_restore(files[which]) == ERR) { endwin(); printf("Cannot load screen-dump %s\n", files[which]); cleanup(files); ExitProgram(EXIT_FAILURE); } else { wrefresh(curscr); } } } else { int y; int x; move(2, 0); printw("Use h,j,k,l or arrows to move around the screen\n"); printw("Press 'q' to quit, ' ' to dump a screen\n"); printw("When the last screen has been dumped, press 'n' to run the\n"); printw("screen-loader. That allows only 'q', backspace and ' ' for\n"); printw("stepping through the dumped/restored screens.\n"); getyx(stdscr, y, x); while (!done) { switch (ch = get_command(which, last)) { case 'n': setup_next(); done = TRUE; break; case 'q': endwin(); cleanup(files); done = TRUE; break; case ' ': if (files[which] != 0) { show_what(which + 1, last); if (scr_dump(files[which]) == ERR) { endwin(); printf("Cannot write screen-dump %s\n", files[which]); cleanup(files); done = TRUE; break; } ++which; if (has_colors()) { short pair = which % COLOR_PAIRS; bkgd(COLOR_PAIR(pair)); } } else { beep(); } break; case KEY_LEFT: case 'h': if (--x < 0) x = COLS - 1; break; case KEY_DOWN: case 'j': if (++y >= LINES) y = 1; break; case KEY_UP: case 'k': if (--y < 1) y = LINES - 1; break; case KEY_RIGHT: case 'l': if (++x >= COLS) x = 0; break; } if (!done) { time_t now = time((time_t *) 0); move(0, 0); addstr(ctime(&now)); move(y, x); addch('#' | A_REVERSE); move(y, x); } } } ExitProgram(EXIT_SUCCESS); }
void main( void ) { if (&caveguy == 5) { script_attach(1000); //preload_seq(740); <-- for sucking. preload_seq(375); preload_seq(168); int &junk; int &dude; int &evil; int &evil2; int &evil3; freeze(1); &dude = create_sprite(551, 157, 0, 0, 0); sp_brain(&dude, 0); sp_base_walk(&dude, 370); sp_speed(&dude, 2); sp_timing(&dude, 0); //set starting pic sp_pseq(&dude, 371); sp_pframe(&dude, 1); //Now EVIL &evil = create_sprite(-20, 130, 0, 0, 0); sp_brain(&evil, 0); sp_base_walk(&evil, 300); sp_speed(&evil, 1); sp_timing(&evil, 0); //set starting pic sp_pseq(&evil, 303); sp_pframe(&evil, 1); //Now EVIL's friend &evil2 = create_sprite(-20, 210, 0, 0, 0); sp_brain(&evil2, 0); sp_base_walk(&evil2, 300); sp_speed(&evil2, 1); sp_timing(&evil2, 0); //set starting pic sp_pseq(&evil2, 303); sp_pframe(&evil2, 1); //And the third EVIL &evil3 = create_sprite(300, 470, 0, 0, 0); sp_brain(&evil3, 0); sp_base_walk(&evil3, 300); sp_speed(&evil3, 1); sp_timing(&evil3, 0); //set starting pic sp_pseq(&evil3, 307); sp_pframe(&evil3, 1); Playmidi("1004.mid"); say_stop("`5Ok, let's get going before they come.", &dude); wait(500); say_stop("`5This way.", &dude); move(&dude, 4, 500, 1); wait(50); move(1, 4, 550, 1); wait(150); say("`4Not so fast.", &evil); move(&evil, 6, 100, 1); wait(850); move(&evil3, 8, 380, 1); move_stop(&evil2, 6, 67, 1); say_stop("`4We have a small matter to discuss with your friend.", &evil); say("`4Hahahaaahaha", &evil); say("`4Haha ha ha", &evil2); say_stop("`4Ha ha haaa", &evil3); wait(800); sp_dir(&dude, 3); say_stop("`5It's okay Dink, I can take 'em.", &dude); wait(250); say("`5Allright.", &dude); move_stop(&dude, 4, 400, 1); sp_dir(&dude, 1); say_stop("`5Which one of you is first?", &dude); wait(250); say("`4Haha ha ha", &evil2); wait(500); say_stop("`4Ha ha haaa", &evil3); wait(500); say_stop("`4I am!!", &evil); move_stop(&evil, 2, 157, 1); move_stop(&evil, 6, 170, 1); wait(500); //say("`4I'm attacking now...", &evil); &junk = create_sprite(240, 157, 11, 506, 1); sp_seq(&junk, 506); sp_dir(&junk, 6); sp_speed(&junk, 6); sp_flying(&junk, 1); wait(390); sp_active(&junk, 0); &junk = create_sprite(390, 157, 7, 168, 1); sp_seq(&junk, 168); sp_pseq(&dude, 375); sp_pframe(&dude, 1); say_stop("`5Ahhhhhh!", &dude); wait(50); sp_active(&junk, 0); //Kill guy too say("Noooo!!", 1); move(1, 4, 450, 1); wait(500); say("`4Haha ha ha", &evil2); say_stop("`4Ha ha haaa", &evil3); wait(500); say_stop("`4Our work is done here.", &evil); wait(500); say_stop("`4You may live, if you forget all that you've seen here.", &evil); wait(250); say_stop("Forget ...", 1); wait(500); say_stop("I'll forget allright.", 1); wait(250); move(&evil, 4, -20, 1); wait(360); move(&evil2, 4, -20, 1); move_stop(&evil3, 4, 180, 1); move_stop(&evil3, 2, 470, 1); sp_active(&evil, 0); sp_active(&evil2, 0); sp_active(&evil3, 0); wait(250); say_stop("Forget to remove my foot from your ASS!!", 1); wait(500); say_stop("Are you okay?", 1); wait(500); say_stop("`5I just got hit by a fireball", &dude); wait(500); say_stop("`5I'm going to die!", &dude); wait(250); say_stop("I'm sorry I wasn't fast enough.", 1); wait(500); say_stop("`5It's not your fault", &dude); wait(500); say_stop("`5Just .. just be careful... also, take this...", &dude); wait(500); say_stop("Alright.. what is it?", 1); wait(500); say_stop("`5The Mordavia scroll. It contains magic I needed to...", &dude); say_stop("`5Ahhhhhh.", &dude); wait(1000); say_stop("Ah man...", 1); sp_active(&dude, 0); &caveguy = 6; add_magic("item-p1", 438,14); &story = 7; unfreeze(1); //Fade fade_down(); fill_screen(0); //move Dink &player_map = 625; sp_x(1, 268); sp_y(1, 173); sp_dir(1, 8); load_screen(); draw_screen(); draw_status(); fade_up(); kill_this_task(); } }
void talk( void ) { knocked: if (&caveguy == 2) { int &me; &me = ¤t_sprite; script_attach(1000); freeze(1); wait(500); playsound(45, 12000, 0,0,0); wait(500); say_stop("Hello, anyone in there?", 1); wait(500); say_stop("Hello?!?", 1); wait(300); say_stop("`0Who wants to know?", &me); wait(300); say_stop("I .. I'm Dink Smallwood, I'm trying to help...", 1); wait(200); say_stop("a poor guy who is imprisoned in the dungeon south of here.", 1); wait(300); say_stop("`0Young Maulwood, people get trapped in places they shouldn't go all the time.", &me); wait(200); say_stop("`0Why should I care what happens to this man?", &me); wait(500); sp_dir(1, 2); wait(500); sp_dir(1, 4); wait(500); say_stop("It's Smallwood sir, and he says...", 1); wait(200); say_stop("he was imprisoned by agents of the Cast and that the lock can only be broken with magic!", 1); wait(300); say_stop("`0Are you high?", &me); wait(300); say_stop("No.", 1); say_stop("`0Oh.", &me); wait(200); say_stop("`0Well, if those Cast members are involved I'd best help.", &me); wait(200); say_stop("`0Come in.", &me); fade_down(); fill_screen(0); //move Dink &player_map = 38; sp_x(1, 261); sp_y(1, 350); load_screen(); draw_screen(); draw_status(); fade_up(); kill_this_task(); return; } if (&caveguy == 3) { int &me; &me = ¤t_sprite; script_attach(1000); freeze(1); playsound(45, 12000, 0,0,0); wait(700); say_stop("Hey, I'm back!", 1); wait(300); say_stop("`0Ah, yes Smallwand, come in ..", &me); fade_down(); fill_screen(0); //move Dink &player_map = 38; sp_x(1, 261); sp_y(1, 350); load_screen(); draw_screen(); draw_status(); fade_up(); kill_this_task(); return; } freeze(1); wait(500); playsound(45, 12000, 0,0,0); wait(500); say_stop("Hello, anyone home?", 1); unfreeze(1); }
void main () { if (debug) { player_map = 400; sp_x (1, 320); sp_y (1, 200); kill_this_task (); } script_attach (1000); player_map = 1; dink_can_walk_off_screen (1); sp_x (1, 320); sp_y (1, 500); load_screen (); draw_screen (); wait (1); int daniel = sp ("daniel-intro"); int knight = create_sprite (320, 500, "none", "silverknight 7", 1); sp_base_walk (knight, "silverknight"); freeze (1); sp_speed (knight, 3); freeze (knight); move_stop (knight, 8, 270, 1); say_stop ("`7Sire! Listen!", knight); say_stop ("`3What is it, John?", daniel); say_stop ("`7The maid in the bar says Dink has been rude to her!", knight); say_stop ("`3What?! That's outrageous!", daniel); say_stop ("`3Fetch him for me!", daniel); say_stop ("`7At once, sire!", knight); move_stop (knight, 2, 500, 1); sp_active (knight, 0); say_stop ("`3What would be a good punishment...", daniel); sp_x (1, 320); sp_y (1, 500); move_stop (1, 8, 270, 1); say_stop ("`3SMALLWOOD HAS RETURNED!", daniel); say_stop ("And his ears hurt...", 1); say_stop ("`3Dink! Your behaviour is intolerable!", daniel); say_stop ("`3You are banished from the kingdom!", daniel); say_stop ("Whatever you say, Danny. Bye!", 1); move_stop (1, 2, 500, 1); say_stop ("`3I hope that was a good idea...", daniel); fade_down_stop (); player_map = 400; load_screen (); draw_screen (); wait (1); bedink.main (); freeze (1); sp_x (1, 320); sp_y (1, -50); fade_up_stop (); move_stop (1, 2, 200, 1); say_stop ("Hmm, what to do now?", 1); say_stop ("I need money to buy food...", 1); say_stop ("Stealing is too evil for me...", 1); say_stop ("Unless... That's an idea!", 1); fade_down_stop (); say_stop_xy ("Dink decided to steal only from those who could spare it.", 10, 200); say_stop_xy ("When he wasn't 'working', he wore armour to hide himself.", 10, 200); say_stop_xy ("After a few years, he had become a very skilled thief.", 10, 200); say_stop_xy ("Then, one night...", 10, 200); beknight.main (); save_game (-1); kill_this_task (); }