// ------------------------------------------------------------- // exit system // ------------------------------------------------------------- void t_game_application::exit( int return_value ) { clear_music_cache(); stop_all_sounds(); // FIXME: if a bink window is currently playing and this call is NOT made, the game will crash // because the bink window destructors are NOT being called. t_window::get_main_window()->close(); if (g_cursor != 0) { g_cursor->close(); g_cursor = 0; } t_window::close_system(); ::exit( return_value ); }
int load_empty_map() { if (!el_load_map("./maps/nomap.elm")) { #ifndef MAP_EDITOR2 locked_to_console = 1; hide_window (game_root_win); show_window (console_root_win); LOG_TO_CONSOLE(c_red4, no_nomap_str); LOG_ERROR(cant_change_map, "./maps/nomap.elm"); SDLNet_TCP_Close(my_socket); disconnected = 1; #ifdef NEW_SOUND stop_all_sounds(); #endif // NEW_SOUND disconnect_time = SDL_GetTicks(); SDLNet_Quit(); LOG_TO_CONSOLE(c_red3, disconnected_from_server); //Fake a map to make sure we don't get any crashes. #endif safe_snprintf(map_file_name, sizeof(map_file_name), "./maps/nomap.elm"); tile_map_size_y = 256; tile_map_size_x = 256; dungeon = 0; ambient_r = 0; ambient_g = 0; ambient_b = 0; tile_map = calloc(tile_map_size_x*tile_map_size_y, sizeof(unsigned char)); height_map = calloc(tile_map_size_x*tile_map_size_y*6*6, sizeof(unsigned char)); #ifndef MAP_EDITOR2 pf_tile_map = calloc(tile_map_size_x*tile_map_size_y*6*6, sizeof(PF_TILE)); #endif return 0; } return 1; }
void show_ending(void) { char *story_text[30] = {"You wake up in an hospital bed.", "A nurse stands beside you.", "She says there was a forest fire.", "She says you where the only one alive.", "", "You know that is not true.", "", "Your master is with you.", "You are one with him now.", "The cermony brought you two together.", "", "Suddenly you feel an urge for human flesh.", "", "Politly you ask the nurse to come closer...", "", "END"}; int end=0; int time=0; int i; float alpha=0; float a_add=1; int row=0; speed_counter = 0; alpha = 0; a_add=2.5; clear(virt); stop_all_sounds(); stop_fiend_music(); play_menu_sound("heartbeat",0); if(fiend_show_intro) { while(strcmp(story_text[row],"END")!=0) { while(speed_counter>0) { time++; if(time%240==0) { play_menu_sound("heartbeat",0); row++; if(strcmp(story_text[row],"")==0)row++; alpha=0; } alpha+=a_add; if(alpha>255)alpha=255; if(alpha<0)alpha=0; speed_counter--; } clear(virt); textout_ex(virt,font_avalon2->dat,story_text[row], 0,row*25,makecol(alpha,alpha,alpha), -1); for(i=0;i<row;i++) { textout_ex(virt,font_avalon2->dat,story_text[i], 0,i*25,makecol(255,255,255), -1); } //textout(virt,font_avalon2->dat,text, x2,y2,makecol(alpha2,alpha2,alpha2)); blit(virt,screen,0,0,80,0,480,480); } while(time<310 && !key[KEY_ESC]) { while(speed_counter>0) { time++; speed_counter--; } } } end =0; alpha = 255; while(!end) { while(speed_counter>0) { time++; if(time>200)alpha-=0.5; if(alpha==0)end=1; if(alpha>255)alpha=255; if(alpha<0)alpha=0; speed_counter--; } clear(virt); textout_centre_ex(virt,font_arial->dat,"T H E E N D",240,220,makecol(alpha,alpha,alpha), -1); blit(virt,screen,0,0,80,0,480,480); } }
void change_map (const char *mapname) { #ifndef MAP_EDITOR remove_all_bags(); remove_all_mines(); #endif //MAP_EDITOR set_all_intersect_update_needed(main_bbox_tree); object_under_mouse=-1;//to prevent a nasty crash, while looking for bags, when we change the map #ifndef MAP_EDITOR2 #ifdef EXTRA_DEBUG ERR(); #endif close_dialogue(); // close the dialogue window if open close_storagewin(); //if storage is open, close it destroy_all_particles(); ec_delete_all_effects(); #ifdef NEW_SOUND stop_all_sounds(); #endif //NEW_SOUND missiles_clear(); if (!el_load_map(mapname)) { char error[255]; safe_snprintf(error, sizeof(error), cant_change_map, mapname); LOG_TO_CONSOLE(c_red4, error); LOG_TO_CONSOLE(c_red4, empty_map_str); LOG_ERROR(cant_change_map, mapname); load_empty_map(); } else { locked_to_console = 0; } load_map_marks(); #ifdef NEW_SOUND get_map_playlist(); setup_map_sounds(get_cur_map(mapname)); #endif // NEW_SOUND have_a_map=1; //also, stop the rain weather_clear(); if ( get_show_window (map_root_win) ) { hide_window(map_root_win); show_window(game_root_win); } #else // !MAP_EDITOR2 destroy_all_particles(); #ifdef NEW_SOUND stop_all_sounds(); #endif //NEW_SOUND if (!load_map(mapname)) { char error[255]; safe_snprintf(error, sizeof(error), cant_change_map, mapname); LOG_TO_CONSOLE(c_red4, error); LOG_TO_CONSOLE(c_red4, empty_map_str); LOG_ERROR(cant_change_map, mapname); load_empty_map(); } #ifdef NEW_SOUND get_map_playlist(); setup_map_sounds(get_cur_map(mapname)); #endif // NEW_SOUND have_a_map=1; #endif //MAP_EDITOR2 change_minimap(); #ifdef PAWN run_pawn_map_function ("change_map", "s", mapname); #endif }