1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-02-16 03:21:05 +01:00

"Boost and style change on the fly."

This commit is contained in:
gyboth 2005-09-28 16:41:32 +00:00
parent 163a127776
commit 283ab3433e
13 changed files with 140 additions and 68 deletions

View File

@ -1,13 +1,14 @@
10/10/2005: v1.9.2
- fixed some minor bugs
- updated translations
- added Spanish translation
- added Spanish and Chinese translations
- switched from 'arj' to Gnu 'zip' in the Windows port
- added player streaks (hot/cold)
- added definition for the Netherlands (thanks to Zwakstroom)
- added definition for the World Cup 2006 Germany
- minor definition system improvements
- window geometry can be saved
- boost and style change 'on the fly' during live games
09/10/2005: v1.9.1

View File

@ -1371,13 +1371,13 @@
<child>
<widget class="GtkEventBox" id="eventbox_lg_boost">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Left- and right click to change boost</property>
<property name="tooltip" translatable="yes">Right click and left click to change boost state</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_eventbox_lg_boost_button_press_event" last_modification_time="Tue, 27 Sep 2005 17:51:44 GMT"/>
<child>
<widget class="GtkImage" id="image65">
<widget class="GtkImage" id="image_lg_boost">
<property name="visible">True</property>
<property name="pixbuf">boost_off.png</property>
<property name="xalign">0.5</property>
@ -1398,13 +1398,13 @@
<child>
<widget class="GtkEventBox" id="eventbox_lg_style">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Left- and right click to change style</property>
<property name="tooltip" translatable="yes">Right click and left click to change your playing style</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_eventbox_lg_style_button_press_event" last_modification_time="Tue, 27 Sep 2005 16:43:34 GMT"/>
<child>
<widget class="GtkImage" id="image64">
<widget class="GtkImage" id="image_lg_style">
<property name="visible">True</property>
<property name="pixbuf">style_bal.png</property>
<property name="xalign">0.5</property>

View File

@ -744,7 +744,9 @@ on_eventbox_style_button_press_event (GtkWidget *widget,
team_change_attribute_with_message(current_user.tm, TEAM_ATTRIBUTE_STYLE, new_style);
game_gui_write_meters();
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
game_gui_write_radio_items();
if(stat0 == STATUS_MAIN)
@ -776,14 +778,13 @@ on_eventbox_boost_button_press_event (GtkWidget *widget,
return FALSE;
if(new_boost == 1 && sett_int("int_opt_disable_boost_on"))
{
new_boost = 0;
game_gui_print_message(_("Boost ON is disabled in this country definition."));
}
else
team_change_attribute_with_message(current_user.tm, TEAM_ATTRIBUTE_BOOST, new_boost);
game_gui_write_meters();
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
game_gui_write_radio_items();
if(stat0 == STATUS_MAIN)

View File

@ -64,6 +64,7 @@ enum Status0Value
STATUS_MAIN,
STATUS_SHOW_LIVE_GAME,
STATUS_LIVE_GAME_PAUSE,
STATUS_LIVE_GAME_CHANGE,
STATUS_SHOW_TEAM_LIST,
STATUS_SHOW_PLAYER_INFO,
STATUS_BROWSE_TEAMS,

View File

@ -244,7 +244,9 @@ game_gui_set_main_window_header(void)
game_gui_write_radio_items();
game_gui_write_meters();
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
game_gui_write_check_items();
}
@ -263,13 +265,12 @@ game_gui_write_av_skills(void)
gtk_label_set_text(label_av_skills, buf);
}
/** Set the appropriate images for the style and boost meters. */
/** Set the images for the style and boost meters to the appropriate values
from the team settings. */
void
game_gui_write_meters(void)
game_gui_write_meters(GtkImage *image_style, GtkImage *image_boost, const Team *tm)
{
gint i;
GtkImage *image_style = GTK_IMAGE(lookup_widget(window.main, "image_style")),
*image_boost = GTK_IMAGE(lookup_widget(window.main, "image_boost"));
gchar *image_style_files[5] =
{file_find_support_file(const_app("string_game_gui_style_all_out_defend_icon"), TRUE),
file_find_support_file(const_app("string_game_gui_style_defend_icon"), TRUE),
@ -281,8 +282,8 @@ game_gui_write_meters(void)
file_find_support_file(const_app("string_game_gui_boost_off_icon"), TRUE),
file_find_support_file(const_app("string_game_gui_boost_on_icon"), TRUE)};
gtk_image_set_from_file(image_style, image_style_files[current_user.tm->style + 2]);
gtk_image_set_from_file(image_boost, image_boost_files[current_user.tm->boost + 1]);
gtk_image_set_from_file(image_style, image_style_files[tm->style + 2]);
gtk_image_set_from_file(image_boost, image_boost_files[tm->boost + 1]);
for(i=0;i<5;i++)
g_free(image_style_files[i]);
@ -387,7 +388,9 @@ game_gui_read_radio_items(GtkWidget *widget)
old_yc != current_user.youth_academy.coach)
game_gui_print_message(_("Next week you'll fire him and hire a new one."));
game_gui_write_meters();
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
game_gui_write_radio_items();
treeview_show_next_opponent();

View File

@ -57,7 +57,7 @@ void
game_gui_write_av_skills(void);
void
game_gui_write_meters(void);
game_gui_write_meters(GtkImage *image_style, GtkImage *image_boost, const Team *tm);
void
game_gui_show_job_offer(Team *team, gint type);

View File

@ -41,7 +41,8 @@ gboolean show;
void
live_game_calculate_fixture(Fixture *fix)
{
if(stat0 != STATUS_LIVE_GAME_PAUSE)
if(stat0 != STATUS_LIVE_GAME_PAUSE &&
stat0 != STATUS_LIVE_GAME_CHANGE)
live_game_initialize(fix);
else
stat0 = STATUS_SHOW_LIVE_GAME;
@ -60,7 +61,8 @@ live_game_calculate_fixture(Fixture *fix)
live_game_evaluate_unit(&last_unit);
}
while(last_unit.event.type != LIVE_GAME_EVENT_END_MATCH &&
stat0 != STATUS_LIVE_GAME_PAUSE);
stat0 != STATUS_LIVE_GAME_PAUSE &&
stat0 != STATUS_LIVE_GAME_CHANGE);
if(last_unit.event.type == LIVE_GAME_EVENT_END_MATCH)
{
@ -68,6 +70,8 @@ live_game_calculate_fixture(Fixture *fix)
lg_commentary_post_match();
game_post_match(fix);
}
else if(stat0 == STATUS_LIVE_GAME_CHANGE)
live_game_resume();
}
/** Initialize a few things at the beginning of a live game. */
@ -94,7 +98,7 @@ live_game_initialize(Fixture *fix)
else
gtk_window_set_title(GTK_WINDOW(window.live),
league_cup_get_name_string(((LiveGame*)statp)->fix->clid));
window_live_set_spinbuttons();
window_live_set_up();
}
game_initialize(fix);

View File

@ -370,23 +370,78 @@ on_button_sponsors_wait_clicked (GtkButton *button,
}
gboolean
on_eventbox_lg_style_button_press_event
(GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
on_eventbox_lg_style_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
gint new_style = -1;
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 3)
new_style = (usr(stat2).tm->style != 2) ?
usr(stat2).tm->style + 1 : -2;
else if(event->button == 1)
new_style = (usr(stat2).tm->style != -2) ?
usr(stat2).tm->style - 1 : 2;
else
return FALSE;
game_save_team_states();
usr(stat2).tm->style = new_style;
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.live, "image_lg_style")),
GTK_IMAGE(lookup_widget(window.live, "image_lg_boost")),
usr(stat2).tm);
if(&current_user == &usr(stat2))
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
stat0 = STATUS_LIVE_GAME_CHANGE;
return FALSE;
}
gboolean
on_eventbox_lg_boost_button_press_event
(GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
on_eventbox_lg_boost_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
gint new_boost = -1;
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 3)
new_boost = (usr(stat2).tm->boost != 1) ?
usr(stat2).tm->boost + 1 : -1;
else if(event->button == 1)
new_boost = (usr(stat2).tm->boost != -1) ?
usr(stat2).tm->boost - 1 : 1;
else
return FALSE;
if(new_boost == 1 && sett_int("int_opt_disable_boost_on"))
{
game_gui_show_warning(_("Boost ON is disabled in this country definition."));
return FALSE;
}
game_save_team_states();
usr(stat2).tm->boost = new_boost;
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.live, "image_lg_style")),
GTK_IMAGE(lookup_widget(window.live, "image_lg_boost")),
usr(stat2).tm);
if(&current_user == &usr(stat2))
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.main, "image_style")),
GTK_IMAGE(lookup_widget(window.main, "image_boost")),
current_user.tm);
stat0 = STATUS_LIVE_GAME_CHANGE;
return FALSE;
}

View File

@ -495,9 +495,9 @@ create_window_live (void)
GtkWidget *spinbutton_verbosity;
GtkWidget *vseparator1;
GtkWidget *eventbox_lg_boost;
GtkWidget *image65;
GtkWidget *image_lg_boost;
GtkWidget *eventbox_lg_style;
GtkWidget *image64;
GtkWidget *image_lg_style;
GtkAccelGroup *accel_group;
GtkTooltips *tooltips;
@ -697,20 +697,20 @@ create_window_live (void)
eventbox_lg_boost = gtk_event_box_new ();
gtk_widget_show (eventbox_lg_boost);
gtk_box_pack_end (GTK_BOX (hbox48), eventbox_lg_boost, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, eventbox_lg_boost, _("Left- and right click to change boost"), NULL);
gtk_tooltips_set_tip (tooltips, eventbox_lg_boost, _("Right click and left click to change boost state"), NULL);
image65 = create_pixmap (window_live, "boost_off.png");
gtk_widget_show (image65);
gtk_container_add (GTK_CONTAINER (eventbox_lg_boost), image65);
image_lg_boost = create_pixmap (window_live, "boost_off.png");
gtk_widget_show (image_lg_boost);
gtk_container_add (GTK_CONTAINER (eventbox_lg_boost), image_lg_boost);
eventbox_lg_style = gtk_event_box_new ();
gtk_widget_show (eventbox_lg_style);
gtk_box_pack_end (GTK_BOX (hbox48), eventbox_lg_style, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, eventbox_lg_style, _("Left- and right click to change style"), NULL);
gtk_tooltips_set_tip (tooltips, eventbox_lg_style, _("Right click and left click to change your playing style"), NULL);
image64 = create_pixmap (window_live, "style_bal.png");
gtk_widget_show (image64);
gtk_container_add (GTK_CONTAINER (eventbox_lg_style), image64);
image_lg_style = create_pixmap (window_live, "style_bal.png");
gtk_widget_show (image_lg_style);
gtk_container_add (GTK_CONTAINER (eventbox_lg_style), image_lg_style);
g_signal_connect ((gpointer) window_live, "delete_event",
G_CALLBACK (on_live_window_delete_event),
@ -780,9 +780,9 @@ create_window_live (void)
GLADE_HOOKUP_OBJECT (window_live, spinbutton_verbosity, "spinbutton_verbosity");
GLADE_HOOKUP_OBJECT (window_live, vseparator1, "vseparator1");
GLADE_HOOKUP_OBJECT (window_live, eventbox_lg_boost, "eventbox_lg_boost");
GLADE_HOOKUP_OBJECT (window_live, image65, "image65");
GLADE_HOOKUP_OBJECT (window_live, image_lg_boost, "image_lg_boost");
GLADE_HOOKUP_OBJECT (window_live, eventbox_lg_style, "eventbox_lg_style");
GLADE_HOOKUP_OBJECT (window_live, image64, "image64");
GLADE_HOOKUP_OBJECT (window_live, image_lg_style, "image_lg_style");
GLADE_HOOKUP_OBJECT_NO_REF (window_live, tooltips, "tooltips");
gtk_window_add_accel_group (GTK_WINDOW (window_live), accel_group);

View File

@ -408,10 +408,10 @@ window_show_transfer_dialog(const gchar *text)
gtk_label_set_text(GTK_LABEL(lookup_widget(window.transfer_dialog, "label_transfer_dialog")), text);
}
/** Set the spinbuttons in the live window
to the correct values. */
/** Set up the spinbuttons and boost/style images in the
live window. */
void
window_live_set_spinbuttons(void)
window_live_set_up(void)
{
GtkSpinButton *sb_speed =
GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_speed"));
@ -427,6 +427,10 @@ window_live_set_spinbuttons(void)
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_verbosity")),
(gfloat)option_int("int_opt_user_live_game_verbosity", &usr(stat2).options));
game_gui_write_meters(GTK_IMAGE(lookup_widget(window.live, "image_lg_style")),
GTK_IMAGE(lookup_widget(window.live, "image_lg_boost")),
usr(stat2).tm);
}
/** Save main window size and position into a file.*/
@ -559,7 +563,7 @@ window_create(gint window_type)
}
strcpy(buf, league_cup_get_name_string(((LiveGame*)statp)->fix->clid));
wind = window.live;
window_live_set_spinbuttons();
window_live_set_up();
break;
case WINDOW_WARNING:
if(window.warning != NULL)

View File

@ -64,7 +64,7 @@ void
window_show_menu_youth(GdkEvent *event);
void
window_live_set_spinbuttons(void);
window_live_set_up(void);
void
window_show_transfer_dialog(const gchar *text);

View File

@ -29,9 +29,9 @@
#define TAG_CUP_ROUND_REPLAY "replay"
#define TAG_CUP_ROUND_NEUTRAL "neutral"
#define TAG_CUP_ROUND_RANDOMISE_TEAMS "randomise_teams"
#define TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS "number_of_groups"
#define TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE "number_of_advance"
#define TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE "number_of_best_advance"
#define TAG_CUP_ROUND_NUMBER_OF_GROUPS "number_of_groups"
#define TAG_CUP_ROUND_NUMBER_OF_ADVANCE "number_of_advance"
#define TAG_CUP_ROUND_NUMBER_OF_BEST_ADVANCE "number_of_best_advance"
#define TAG_CHOOSE_TEAMS "choose_teams"
#define TAG_CHOOSE_TEAM "choose_team"
#define TAG_CHOOSE_TEAM_SID "choose_team_sid"
@ -66,9 +66,9 @@ enum XmlCupStates
STATE_CUP_ROUND_REPLAY,
STATE_CUP_ROUND_NEUTRAL,
STATE_CUP_ROUND_RANDOMISE_TEAMS,
STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS,
STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE,
STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE,
STATE_CUP_ROUND_NUMBER_OF_GROUPS,
STATE_CUP_ROUND_NUMBER_OF_ADVANCE,
STATE_CUP_ROUND_NUMBER_OF_BEST_ADVANCE,
STATE_CHOOSE_TEAMS,
STATE_CHOOSE_TEAM,
STATE_CHOOSE_TEAM_SID,
@ -150,12 +150,12 @@ xml_cup_read_start_element (GMarkupParseContext *context,
state = STATE_CUP_ROUND_NEUTRAL;
else if(strcmp(element_name, TAG_CUP_ROUND_RANDOMISE_TEAMS) == 0)
state = STATE_CUP_ROUND_RANDOMISE_TEAMS;
else if(strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS) == 0)
state = STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS;
else if(strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE) == 0)
state = STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE;
else if(strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE) == 0)
state = STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE;
else if(strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_GROUPS) == 0)
state = STATE_CUP_ROUND_NUMBER_OF_GROUPS;
else if(strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_ADVANCE) == 0)
state = STATE_CUP_ROUND_NUMBER_OF_ADVANCE;
else if(strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_BEST_ADVANCE) == 0)
state = STATE_CUP_ROUND_NUMBER_OF_BEST_ADVANCE;
else if(strcmp(element_name, TAG_CHOOSE_TEAMS) == 0)
state = STATE_CHOOSE_TEAMS;
else if(strcmp(element_name, TAG_CHOOSE_TEAM) == 0)
@ -213,9 +213,9 @@ xml_cup_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_CUP_ROUND_REPLAY) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_NEUTRAL) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_RANDOMISE_TEAMS) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_GROUPS) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_ADVANCE) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_NUMBER_OF_BEST_ADVANCE) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_NEW_TEAMS) == 0 ||
strcmp(element_name, TAG_CUP_ROUND_BYES) == 0 ||
strcmp(element_name, TAG_CHOOSE_TEAMS) == 0)
@ -299,11 +299,11 @@ xml_cup_read_text (GMarkupParseContext *context,
new_round.neutral = int_value;
else if(state == STATE_CUP_ROUND_RANDOMISE_TEAMS)
new_round.randomise_teams = int_value;
else if(state == STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_GROUPS)
else if(state == STATE_CUP_ROUND_NUMBER_OF_GROUPS)
new_round.round_robin_number_of_groups = int_value;
else if(state == STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE)
else if(state == STATE_CUP_ROUND_NUMBER_OF_ADVANCE)
new_round.round_robin_number_of_advance = int_value;
else if(state == STATE_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE)
else if(state == STATE_CUP_ROUND_NUMBER_OF_BEST_ADVANCE)
new_round.round_robin_number_of_best_advance = int_value;
else if(state == STATE_CHOOSE_TEAM_SID)
g_string_printf(new_choose_team.sid, "%s", buf);

View File

@ -14,7 +14,7 @@ string_contrib_title Patches and ideas
string_contrib_entry Mark Calderbank, Michal Rudolf
string_contrib_title Country definitions
string_contrib_entry Győző Both (Australia, Germany, Italy, Scotland, USA)
string_contrib_entry Győző Both (Australia, Germany, Italy, Scotland, USA, WC2006)
string_contrib_entry Mark Calderbank (Bulgaria, England, Ireland, Spain, Victoria, Wales)
string_contrib_entry Tobe &amp; Arne Deprez (Belgium)
string_contrib_entry Celso Goya (Brazil)
@ -27,8 +27,11 @@ string_contrib_title Translations
string_contrib_entry Alexandre Beraud (French)
string_contrib_entry Győző Both (German)
string_contrib_entry Tobe &amp; Arne Deprez (Dutch)
string_contrib_entry Marcelo Garrone (Spanish)
string_contrib_entry Benyuan Liu (Chinese)
string_contrib_entry Rostislav "zbrox" Raykov (Bulgarian)
string_contrib_entry Michal Rudolf (Polish)
string_contrib_entry Cristian Spoiala (Romanian)
string_contrib_entry Rostislav "zbrox" Raykov (Bulgarian)
string_contrib_title Forgotten anyone? Write me! (gyboth@bygfoot.com)