From 92f8870fa7a75be8458e35fb8de51965c5c33d91 Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Tue, 25 Jan 2011 22:41:59 +0100 Subject: Slowed down the 'play cards' state by inserting a delay. The player who is currently placing its card/picking its stack is highlighted. --- src/client_game_states.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/client_game_states.c') diff --git a/src/client_game_states.c b/src/client_game_states.c index 76be70b..49870ed 100644 --- a/src/client_game_states.c +++ b/src/client_game_states.c @@ -49,14 +49,14 @@ game_state_t state_client_wait_for_open_cards(const int sock) { data_store_t *d = data_store(); - ui_display_wnd_messages("Waiting for the other players to pick their cards"); + ui_display_wnd_messages("Waiting for the other players to pick their cards"); // The two spaces between 'pick' and 'their' are intentionally and used for poor man's word wrap net_recv(sock, msg_type_selected_card_all); player_list_sort_by_open_card(&d->player_list, d->player_list.count); // sort in ascending order player_list_entry_t *ple = get_player_list_entry_by_player_id(&d->player_list, d->own_player_id); assert(ple != NULL); - ui_display_wnd_current_state(&d->player_list, d->player_list.count, true, 0, ple->score); // TODO fix parameters + ui_display_wnd_current_state(&d->player_list, d->player_list.count, false, 0, ple->score); return STATE_CLIENT_PLAY_CARDS; } @@ -64,15 +64,20 @@ game_state_t state_client_wait_for_open_cards(const int sock) game_state_t state_client_play_cards(const int sock) { data_store_t *ds = data_store(); + player_list_entry_t *ple = get_player_list_entry_by_player_id(&ds->player_list, ds->own_player_id); + assert(ple != NULL); for(int i=0; iplayer_list.count; i++) { card c = ds->player_list.players[i].open_card; uint8_t stack_idx = get_stack_idx_for_card(&ds->table_stacks, c); + bool our_turn = (ds->player_list.players[i].player_id == ds->own_player_id); + + ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, i, ple->score); if(stack_idx >= NUM_TABLE_STACKS) // card does not fit on any stack { - if(ds->player_list.players[i].player_id == ds->own_player_id) // our turn to select stack + if(our_turn) // our turn to select stack { ui_display_wnd_messages("Please choose a stack"); ds->stack_index = ui_choose_stack(&ds->table_stacks); @@ -88,9 +93,9 @@ game_state_t state_client_play_cards(const int sock) ui_display_wnd_stack_points(&ds->table_stacks, false, 0); // If it was our turn, display the score - if(ds->player_list.players[i].player_id == ds->own_player_id) + if(our_turn) { - ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, 0, ds->player_list.players[i].score); // TODO fix parameters + ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, i, ple->score); } } else // card fits on a stack -> place it @@ -102,9 +107,9 @@ game_state_t state_client_play_cards(const int sock) card_stack_replace(cs, c); // If it was our turn, display the score - if(ds->player_list.players[i].player_id == ds->own_player_id) + if(our_turn) { - ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, 0, ds->player_list.players[i].score); // TODO fix parameters + ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, i, ple->score); } } else @@ -113,6 +118,10 @@ game_state_t state_client_play_cards(const int sock) ui_display_wnd_table_cards(&ds->table_stacks, false, 0); ui_display_wnd_stack_points(&ds->table_stacks, false, 0); } + + // Wait between player turns, but not after the last one + if (i != ds->player_list.count - 1) + sleep(3); } if(hand_count_cards(&ds->hand) > 0) // still cards in hand? -- cgit v1.2.3