diff --git a/game.c b/game.c index 969e2c9..e479b0c 100644 --- a/game.c +++ b/game.c @@ -78,6 +78,9 @@ void initialize_game(Game *g) { g->player.points_string[0] = '\0'; g->right.points_string[0] = '\0'; g->left.points_string[0] = '\0'; + g->player.teyaku_string[0] = '\0'; + g->right.teyaku_string[0] = '\0'; + g->left.teyaku_string[0] = '\0'; g->player.name = "Player"; g->right.name = "Right"; g->left.name = "Left"; @@ -369,8 +372,11 @@ void run_frame_calculating_field_multiplier(Game *g) { void run_frame_calculating_teyaku(Game *g) { calculate_teyaku(g->player.hand, &g->player.teyaku); + teyaku_to_string(&g->player.teyaku, g->player.teyaku_string); calculate_teyaku(g->right.hand, &g->right.teyaku); + teyaku_to_string(&g->right.teyaku, g->right.teyaku_string); calculate_teyaku(g->left.hand, &g->left.teyaku); + teyaku_to_string(&g->left.teyaku, g->left.teyaku_string); g->state = GAME_STATE_START_OF_TURN; } @@ -827,9 +833,12 @@ void draw_frame(Game *g) { DrawText(g->field_multiplier->explanation, 60, 445, 20, BLACK); } - DrawText(g->player.points_string, 40, 700, 20, BLACK); - DrawText(g->right.points_string, 40, 750, 20, BLACK); + DrawText(g->player.points_string, 40, 650, 20, BLACK); + DrawText(g->player.teyaku_string, 40, 680, 20, BLACK); + DrawText(g->right.points_string, 40, 725, 20, BLACK); + DrawText(g->right.teyaku_string, 40, 755, 20, BLACK); DrawText(g->left.points_string, 40, 800, 20, BLACK); + DrawText(g->left.teyaku_string, 40, 830, 20, BLACK); char round_text[20]; if (g->current_round < g->number_of_rounds) diff --git a/player.h b/player.h index d7f6465..a3212c3 100644 --- a/player.h +++ b/player.h @@ -20,6 +20,7 @@ struct Player { int dekiyaku_score; int points; char points_string[20]; + char teyaku_string[50]; bool ai; bool dealer; }; diff --git a/teyaku.c b/teyaku.c index 6a3373a..b4cc0b2 100644 --- a/teyaku.c +++ b/teyaku.c @@ -92,5 +92,7 @@ void calculate_teyaku(const Hand h, Teyaku *t) { void teyaku_to_string(Teyaku *t, char *str) { int set_points = set_teyaku_points(t->set); int chaff_points = chaff_teyaku_points(t->chaff); - sprintf(str, "Set: %s(%d) / Chaff: %s(%d) / Total: %d", set_teyaku_english(t->set), set_points, chaff_teyaku_english(t->chaff), chaff_points, set_points + chaff_points); + // sprintf(str, "Set: %s(%d) / Chaff: %s(%d) / Total: %d", set_teyaku_english(t->set), set_points, chaff_teyaku_english(t->chaff), chaff_points, set_points + chaff_points); + if (set_points + chaff_points > 0) sprintf(str, "Teyaku: %d", set_points + chaff_points); + else sprintf(str, ""); }