Reverted game over logic

This commit is contained in:
cellos51
2025-08-10 11:59:35 -04:00
parent d20b5c5ce4
commit d2aee1979b
+17 -96
View File
@@ -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 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) // Red deck default (can later be moved to a deck.h file or something)
static int max_hands; static int max_hands = 4;
static int max_discards; static int max_discards = 4;
// Set in game_init and game_round_init // Set in game_init and game_round_init
static int hands; static int hands = 0;
static int discards; static int discards = 0;
static int round; static int round = 0;
static int ante; static int ante = 1;
static int money; static int money = 4;
static int score; static int score = 0;
static int temp_score = 0; // This is the score that shows in the same spot as the hand type. 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_score = 0;
static FIXED lerped_temp_score = 0; static FIXED lerped_temp_score = 0;
static int chips; static int chips = 0;
static int mult; static int mult = 0;
static int hand_size; // Default hand size is 8 static int hand_size = 8; // Default hand size is 8
static int cards_drawn; static int cards_drawn = 0;
static int hand_selections; static int hand_selections = 0;
static int selection_x; static int selection_x = 0;
static int selection_y; static int selection_y = 0;
static bool sort_by_suit; static bool sort_by_suit = false;
// Stacks // Stacks
static JokerObject *jokers[MAX_JOKERS_HELD_SIZE] = {NULL}; static JokerObject *jokers[MAX_JOKERS_HELD_SIZE] = {NULL};
@@ -121,19 +121,6 @@ static inline CardObject *played_pop()
return played[played_top--]; 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 // Deck stack
static inline void deck_push(Card *card) static inline void deck_push(Card *card)
{ {
@@ -1088,42 +1075,9 @@ void game_start()
jokers_avialable_to_shop_init(); 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; hands = max_hands;
discards = max_discards; 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. // 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++) 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() void game_update()
{ {
timer++; timer++;
@@ -2845,7 +2766,7 @@ void game_update()
game_blind_select(); game_blind_select();
break; break;
case GAME_LOSE: case GAME_LOSE:
game_lose(); // Handle lose logic here
break; break;
} }
} }