pushing changes before i do a major refactor

This commit is contained in:
cellos51
2025-06-25 00:07:00 -04:00
parent 167e0c6c1a
commit 126d5a5bab
3 changed files with 42 additions and 22 deletions
-1
View File
@@ -110,7 +110,6 @@ int hand_get_max_size(); // This gets the maximum size of the hand (this doesn't
enum HandType hand_get_type(); // This gets the type of the hand
enum HandState hand_get_state(); // This gets the current state of the hand
bool hand_discard(); // This discards the selected cards
bool hand_discard_all(); // This discards all cards in the hand (used at the end of the round)
bool hand_play(); // This plays the selected cards
// Play functions
+11 -16
View File
@@ -372,6 +372,7 @@ void card_update() // This whole function is currently pretty unoptimized due to
if (discard_top == -1 && discarded_card_object == NULL) // If there are no more discarded cards, stop shuffling
{
shuffling = false; // Stop shuffling if there are no cards to shuffle
hand_state = HAND_SELECT; // This is stupid and I should've built all of this into the 'game.c' file but I didn't so i have to set the hand state back so i can check it from an if statement later to properly end the round
}
}
@@ -970,21 +971,6 @@ bool hand_discard()
return true;
}
bool hand_discard_all()
{
hand_state = HAND_DISCARD;
card_focused = 0;
for (int i = 0; i <= hand_top; i++)
{
if (hand[i] != NULL)
{
hand[i]->selected = true; // Select all cards to discard them
}
}
return true;
}
bool hand_play()
{
@@ -1024,5 +1010,14 @@ void deck_shuffle()
if (shuffling) return; // Prevent multiple shuffles at the same time
shuffling = true;
hand_discard_all(); // Discard all cards in the hand
hand_state = HAND_DISCARD; // Discard all cards in the hand
card_focused = 0;
for (int i = 0; i <= hand_top; i++)
{
if (hand[i] != NULL)
{
hand[i]->selected = true; // Select all cards to discard them
}
}
}
+31 -5
View File
@@ -189,6 +189,18 @@ void game_playing()
change_background(2);
}
if (score >= blind_requirement) // This is for wrapping everything up at the end of the round
{
if (hand_get_state() == HAND_DRAW)
{
deck_shuffle();
}
else if (hand_get_state() == HAND_SELECT)
{
game_state = GAME_ROUND_END;
}
}
if (hand_get_state() == HAND_SELECT)
{
if (key_hit(KEY_LEFT))
@@ -224,10 +236,6 @@ void game_playing()
tte_printf("#{P:16,104; cx:0x2000}%d", hand);
}
}
else if (hand_get_state() == HAND_DRAW && score >= blind_requirement)
{
deck_shuffle();
}
else if (play_get_state() == PLAY_SCORING)
{
Card *scored_card = play_get_scored_card();
@@ -306,10 +314,28 @@ void game_playing()
}
}
void game_round_end()
{
// Handle round end logic here
// This could include resetting the game state, updating scores, etc.
}
void game_update()
{
if (game_state == GAME_PLAYING)
{
game_playing();
}
}
else if (game_state == GAME_ROUND_END)
{
// Handle round end logic here
}
else if (game_state == GAME_SHOP)
{
// Handle shop logic here
}
else if (game_state == GAME_BLIND_SELECT)
{
// Handle blind select logic here
}
}