From d2aee1979b0a66b0da416a9e2c914c41bb992930 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 11:59:35 -0400 Subject: [PATCH] Reverted game over logic --- source/game.c | 113 ++++++++------------------------------------------ 1 file changed, 17 insertions(+), 96 deletions(-) diff --git a/source/game.c b/source/game.c index c6508e8..c9cda73 100644 --- a/source/game.c +++ b/source/game.c @@ -53,31 +53,31 @@ static int current_blind = SMALL_BLIND; static enum BlindState blinds[MAX_BLINDS] = {BLIND_CURRENT, BLIND_UPCOMING, BLIND_UPCOMING}; // The current state of the blinds, this is used to determine what the game is doing at any given time // Red deck default (can later be moved to a deck.h file or something) -static int max_hands; -static int max_discards; +static int max_hands = 4; +static int max_discards = 4; // Set in game_init and game_round_init -static int hands; -static int discards; +static int hands = 0; +static int discards = 0; -static int round; -static int ante; -static int money; -static int score; +static int round = 0; +static int ante = 1; +static int money = 4; +static int score = 0; static int temp_score = 0; // This is the score that shows in the same spot as the hand type. static FIXED lerped_score = 0; static FIXED lerped_temp_score = 0; -static int chips; -static int mult; +static int chips = 0; +static int mult = 0; -static int hand_size; // Default hand size is 8 -static int cards_drawn; -static int hand_selections; +static int hand_size = 8; // Default hand size is 8 +static int cards_drawn = 0; +static int hand_selections = 0; -static int selection_x; -static int selection_y; +static int selection_x = 0; +static int selection_y = 0; -static bool sort_by_suit; +static bool sort_by_suit = false; // Stacks static JokerObject *jokers[MAX_JOKERS_HELD_SIZE] = {NULL}; @@ -121,19 +121,6 @@ static inline CardObject *played_pop() return played[played_top--]; } -// Hand stack -static inline void hand_push(CardObject *card_object) -{ - if (hand_top >= MAX_HAND_SIZE - 1) return; - hand[++hand_top] = card_object; -} - -static inline CardObject *hand_pop() -{ - if (hand_top < 0) return NULL; - return hand[hand_top--]; -} - // Deck stack static inline void deck_push(Card *card) { @@ -1088,42 +1075,9 @@ void game_start() jokers_avialable_to_shop_init(); - current_blind = SMALL_BLIND; - blinds[0] = BLIND_CURRENT; - blinds[1] = BLIND_UPCOMING; - blinds[2] = BLIND_UPCOMING; - - hand_state = HAND_DRAW; - play_state = PLAY_PLAYING; - - hand_type = NONE; - - max_hands = 4; - max_discards = 4; - hands = max_hands; discards = max_discards; - round = 0; - ante = 1; - money = 4; - score = 0; - temp_score = 0; // This is the score that shows in the same spot as the hand type. - lerped_score = 0; - lerped_temp_score = 0; - - chips = 0; - mult = 0; - - hand_size = 8; // Default hand size is 8 - cards_drawn = 0; - hand_selections = 0; - - selection_x = 0; - selection_y = 0; - - sort_by_suit = false; - // Fill the deck with all the cards. Later on this can be replaced with a more dynamic system that allows for different decks and card types. for (int suit = 0; suit < NUM_SUITS; suit++) { @@ -2779,39 +2733,6 @@ void game_main_menu() } } -void game_lose() -{ - game_round_end_cleanup(); - - // Cleanup the stacks - while(hand_top >= 0) - { - CardObject *card_object = hand_pop(); - card_destroy(&card_object->card); - card_object_destroy(&card_object); - } - - while (deck_top >= 0) - { - Card *card = deck_pop(); - card_destroy(&card); - } - - while (discard_top >= 0) - { - Card *card = discard_pop(); - card_destroy(&card); - } - - while (jokers_top >= 0) - { - JokerObject *joker_object = joker_pop(); - joker_object_destroy(&joker_object); - } - - game_set_state(GAME_MAIN_MENU); -} - void game_update() { timer++; @@ -2845,7 +2766,7 @@ void game_update() game_blind_select(); break; case GAME_LOSE: - game_lose(); + // Handle lose logic here break; } } \ No newline at end of file