From 7a864501142c0e8a6835384dd604577aec1e4d9c Mon Sep 17 00:00:00 2001 From: TheBreadPerson Date: Tue, 22 Jul 2025 15:34:03 -0400 Subject: [PATCH 1/2] Starting to truncate numbers, half-baked --- source/game.c | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/source/game.c b/source/game.c index c247a47..082676a 100644 --- a/source/game.c +++ b/source/game.c @@ -638,15 +638,31 @@ void set_temp_score(int value) void set_score(int value) { - if (value == 0) // Clear if 0 + // Clear the existing text before redrawing + tte_erase_rect_wrapper(SCORE_RECT); + + char score_suffix = ' '; + int display_value = value; + + if(value > 9999) { - Rect rect = SCORE_RECT; - rect.left += 1; - tte_erase_rect_wrapper(rect); + score_suffix = 'k'; + display_value = value / 1000; // 12,986 = 12k } - - int x_offset = 32; - tte_printf("#{P:%d,48; cx:0xF000}%d", x_offset, value); + + // Calculate text width: digits + suffix character (if 'k') + int num_digits = get_digits(display_value); + int text_width = num_digits * TILE_SIZE; + if(score_suffix == 'k') + { + text_width += TILE_SIZE; // Add width for 'k' suffix + } + + // Calculate center position within SCORE_RECT + int rect_width = SCORE_RECT.right - SCORE_RECT.left; + int x_offset = SCORE_RECT.left + (rect_width - text_width) / 2; + + tte_printf("#{P:%d,48; cx:0xF000}%d%c", x_offset, display_value, score_suffix); } void set_money(int value) @@ -924,9 +940,27 @@ void game_round_init() Rect blind_req_text_rect = BLIND_REQ_TEXT_RECT; int blind_requirement = blind_get_requirement(current_blind, ante); + + char score_suffix = ' '; + if(blind_requirement > 9999) + { + // clear existing text + tte_erase_rect_wrapper(blind_req_text_rect); + + score_suffix = 'k'; + blind_requirement /= 1000; // 11,000 = 11k + } + + // Update text rect for right alignment AFTER shortening the number update_text_rect_to_right_align_num(&blind_req_text_rect, blind_requirement, OVERFLOW_RIGHT); - tte_printf("#{P:%d,%d; cx:0xE000}%d", blind_req_text_rect.left, blind_req_text_rect.top, blind_requirement); // Blind requirement + // If we added a suffix, adjust position to account for the extra character + if(score_suffix == 'k') + { + blind_req_text_rect.left -= TILE_SIZE; // Move left by one character width to make room for 'k' + } + + tte_printf("#{P:%d,%d; cx:0xE000}%d%c", blind_req_text_rect.left, blind_req_text_rect.top, blind_requirement, score_suffix); // Blind requirement tte_printf("#{P:%d,%d; cx:0xC000}$%d", BLIND_REWARD_RECT.left, BLIND_REWARD_RECT.top, blind_get_reward(current_blind)); // Blind reward deck_shuffle(); // Shuffle the deck at the start of the round From b994358ac6444d67ffdc31d3973a69609a5ccce3 Mon Sep 17 00:00:00 2001 From: TheBreadPerson Date: Wed, 23 Jul 2025 01:45:00 -0400 Subject: [PATCH 2/2] Minor number change --- source/game.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/game.c b/source/game.c index 082676a..8ef8f9d 100644 --- a/source/game.c +++ b/source/game.c @@ -644,7 +644,7 @@ void set_score(int value) char score_suffix = ' '; int display_value = value; - if(value > 9999) + if(value >= 10000) { score_suffix = 'k'; display_value = value / 1000; // 12,986 = 12k @@ -942,7 +942,7 @@ void game_round_init() int blind_requirement = blind_get_requirement(current_blind, ante); char score_suffix = ' '; - if(blind_requirement > 9999) + if(blind_requirement >= 10000) { // clear existing text tte_erase_rect_wrapper(blind_req_text_rect);