// ------------------------------------------------------------------------ // class to move army on adventure map // ------------------------------------------------------------------------ void t_army_mover::end_move() { if (m_halted) return; declare_timer( timer_1, "end_move" ); //////////////////////////////////////////////////////////// // functionality m_army->get_map()->record_mover_event( m_army, m_path, m_limit_move, m_original_position); //////////////////////////////////////////////////////////// m_halted = true; suspend_idle_processing(); m_window->get_frame()->reset_pathfinder(); m_army->set_action( k_adv_actor_action_wait ); m_army->set_frame_offset( t_screen_point(0,0) ); redraw_windows(); m_window->clear_enemy_attack(); m_window->halt_movement(); if (m_movement_sound != 0) { m_movement_sound->get_sound_ptr()->stop(); m_movement_sound = 0; } report_stealth(); }
void process_message() { bool got_message; t_uint32 delay; // Check the windows message queue got_message = process_one_windows_message(); redraw_windows(); delay = g_game->idle(); // If the message queue was empty and the idle loop has nothing to do for a while, we can sleep if (!got_message) { DWORD result = MsgWaitForMultipleObjects( 0, NULL, false, delay, QS_ALLEVENTS ); } }
// ------------------------------------------------------------------------ // move the final step in the path // ------------------------------------------------------------------------ void t_army_mover::finish_path() { declare_timer( timer_1, "finish_path" ); end_move(); if (m_has_trigger || m_landing) { //////////////////////////////////////////////////////////// // replay functionality m_army->get_map()->record_look_trigger_event( m_army, m_trigger_point.direction ); //////////////////////////////////////////////////////////// m_army->turn_to( m_trigger_point.direction ); if (m_army->get_position() != m_trigger_point) { assert( m_army->get_position() == m_trigger_point.last_point ); expend_movement( m_trigger_point.move_cost ); } redraw_windows(); if (m_has_trigger) { assert( !m_landing ); declare_timer( timer_4, "Activate trigger" ); trigger_event(); activate_trigger(); } else { assert( m_army->is_boat() ); assert( m_landing ); m_army->leave_boat( m_trigger_point ); trigger_event(); } } else trigger_event(); on_end(); }
void Mixer::cb_menu(Fl_Widget* o) { Fl_Menu_Bar *menu = (Fl_Menu_Bar*)o; /* const Fl_Menu_Item *mi = &menu->menu()[menu->value()]; */ char picked[256]; // const char *picked = menu->text(); menu->item_pathname( picked, sizeof( picked ) ); if (! strcmp( picked, "&Project/&New") ) { DMESSAGE( "New project" ); const char *templates[] = { "Default", NULL }; char *default_path; char *selected_template; read_line( user_config_dir, "default_path", &default_path ); char *path = new_project_chooser( templates, &default_path, &selected_template ); if ( path ) { if ( ! Project::create( path, selected_template ) ) fl_alert( "Error creating project!" ); free( path ); free( selected_template ); } update_menu(); if ( default_path ) { write_line( user_config_dir, "default_path", default_path ); free( default_path ); } } else if (! strcmp( picked, "&Project/&Open" ) ) { char *path = NULL; // read_line( user_config_dir, "default_path", &path ); const char *name = fl_dir_chooser( "Open Project", path ); free( path ); mixer->hide(); if ( int err = Project::open( name ) ) { fl_alert( "Error opening project: %s", Project::errstr( err ) ); } update_menu(); mixer->show(); } else if (! strcmp( picked, "&Project/&Save" ) ) { command_save(); } else if (! strcmp( picked, "&Project/&Quit") ) { command_quit(); } else if ( !strcmp( picked, "&Mixer/&Add Strip" ) ) { command_add_strip(); } else if ( !strcmp( picked, "&Mixer/Add &N Strips" ) ) { const char *s = fl_input( "Enter number of strips to add" ); if ( s ) { for ( int i = atoi( s ); i > 0; i-- ) command_add_strip(); } } else if ( !strcmp( picked, "&Mixer/&Import Strip" ) ) { const char *s = fl_file_chooser( "Export strip to filename:", "*.strip", NULL, 0 ); if ( s ) { if (! Mixer_Strip::import_strip( s ) ) fl_alert( "%s", "Failed to import strip!" ); } } else if (! strcmp( picked, "&Mixer/&Rows/One") ) { rows( 1 ); } else if (! strcmp( picked, "&Mixer/&Rows/Two") ) { rows( 2 ); } else if (! strcmp( picked, "&Mixer/&Rows/Three") ) { rows( 3 ); } else if (! strcmp( picked, "&View/&Theme") ) { fl_theme_chooser(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Burnished") ) { Fl_Dial::default_style( Fl_Dial::BURNISHED_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Arc") ) { Fl_Dial::default_style( Fl_Dial::ARC_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Knobs/&Plastic") ) { Fl_Dial::default_style( Fl_Dial::PLASTIC_DIAL ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Sliders/&Nice") ) { Fl_Value_SliderX::default_style( Fl_Value_SliderX::NICE_SLIDER ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Sliders/&Fill") ) { Fl_Value_SliderX::default_style( Fl_Value_SliderX::FILL_SLIDER ); redraw_windows(); } else if (! strcmp( picked, "&Options/&Display/&Sliders/&Simple") ) { Fl_Value_SliderX::default_style( Fl_Value_SliderX::SIMPLE_SLIDER ); redraw_windows(); } else if ( ! strcmp( picked, "&Help/&About" ) ) { About_Dialog ab( PIXMAP_PATH "/non-mixer/icon-256x256.png" ); ab.logo_box->label( VERSION ); ab.title->label( "The Non Mixer" ); ab.copyright->label( "Copyright (C) 2008-2010 Jonathan Moore Liles" ); ab.credits->label( "Non-Mixer was written from scratch by\n" "Jonathan Moore Liles for his own use\n" "(see the manual).\n" "\n" "Nobody planned. Nobody helped.\n" "You can help now by donating time, money,\n" "and/or replacing the rest of Linux Audio\n" "with fast, light, reliable alternatives.\n" ); ab.website_url->label( "http://non-mixer.tuxfamily.org" ); ab.run(); } else if ( !strcmp( picked, "&Help/&Manual" )) { char *pat; asprintf( &pat, "file://%s.html", DOCUMENT_PATH "/non-mixer/MANUAL" ); open_url( pat ); free( pat ); } }
static void download_dialog_layouter(struct dialog_data *dlg_data) { struct file_download *file_download = dlg_data->dlg->udata; struct terminal *term = dlg_data->win->term; int w = dialog_max_width(term); int rw = w; int x, y = 0; int url_len; unsigned char *url; struct download *download = &file_download->download; struct color_pair *dialog_text_color = get_bfu_color(term, "dialog.text"); unsigned char *msg = get_download_msg(download, term, 1, 1, "\n"); int show_meter = (download_is_progressing(download) && download->progress->size >= 0); #if CONFIG_BITTORRENT int bittorrent = (file_download->uri->protocol == PROTOCOL_BITTORRENT && (show_meter || is_in_state(download->state, S_RESUME))); #endif redraw_windows(REDRAW_BEHIND_WINDOW, dlg_data->win); file_download->dlg_data = dlg_data; if (!msg) return; url = get_uri_string(file_download->uri, URI_PUBLIC); if (!url) { mem_free(msg); return; } #ifdef CONFIG_UTF8 if (term->utf8_cp) decode_uri(url); else #endif /* CONFIG_UTF8 */ decode_uri_for_display(url); url_len = strlen(url); if (show_meter) { int_lower_bound(&w, DOWN_DLG_MIN); } dlg_format_text_do(dlg_data, url, 0, &y, w, &rw, dialog_text_color, ALIGN_LEFT, 1); y++; if (show_meter) y += 2; #if CONFIG_BITTORRENT if (bittorrent) y += 2; #endif dlg_format_text_do(dlg_data, msg, 0, &y, w, &rw, dialog_text_color, ALIGN_LEFT, 1); y++; dlg_format_buttons(dlg_data, dlg_data->widgets_data, dlg_data->number_of_widgets, 0, &y, w, &rw, ALIGN_CENTER, 1); draw_dialog(dlg_data, w, y); w = rw; if (url_len > w) { /* Truncate too long urls */ url_len = w; url[url_len] = '\0'; if (url_len > 4) { url[--url_len] = '.'; url[--url_len] = '.'; url[--url_len] = '.'; } } y = dlg_data->box.y + DIALOG_TB + 1; x = dlg_data->box.x + DIALOG_LB; dlg_format_text_do(dlg_data, url, x, &y, w, NULL, dialog_text_color, ALIGN_LEFT, 0); if (show_meter) { y++; draw_progress_bar(download->progress, term, x, y, w, NULL, NULL); y++; } #if CONFIG_BITTORRENT if (bittorrent) { y++; draw_bittorrent_piece_progress(download, term, x, y, w, NULL, NULL); y++; } #endif y++; dlg_format_text_do(dlg_data, msg, x, &y, w, NULL, dialog_text_color, ALIGN_LEFT, 0); y++; dlg_format_buttons(dlg_data, dlg_data->widgets_data, dlg_data->number_of_widgets, x, &y, w, NULL, ALIGN_CENTER, 0); mem_free(url); mem_free(msg); }