Refactor hand_discard function to return a boolean and update game logic for discarding cards; add background_play_gfx and improve text engine initialization.

This commit is contained in:
cellos51
2025-02-16 22:07:44 -05:00
parent edfa358e35
commit 7ce6082edd
7 changed files with 60 additions and 22 deletions
+34 -4
View File
@@ -8,9 +8,26 @@
#include "sprite.h"
#include "card.h"
static int hand = 4;
static int discard = 4;
void game_init()
{
tte_printf("#{P:128,128; cx:0}%d/%d", hand_get_size(), hand_get_max_size()); // Hand size/max size
tte_printf("#{P:200,152}%d/%d", deck_get_size(), deck_get_max_size()); // Deck size/max size
tte_printf("#{P:32,48;}*%d", 0); // Score
tte_printf("#{P:24,80;}%d", 0); // Chips
tte_printf("#{P:40,80;}%d", 0); // Mult
tte_printf("#{P:16,104; cx:0x2000}%d", hand); // Hand
tte_printf("#{P:48,104; cx:0x3000}%d", discard); // Discard
tte_printf("#{P:24,120; cx:0x1000}$%d", 4); // Money
tte_printf("#{P:48,144}%d", 1); // Round
tte_printf("#{P:8,144}%d#{cx:0}/%d", 1, 8); // Ante
}
void game_update()
@@ -36,9 +53,22 @@ void game_update()
if (key_hit(KEY_SELECT))
{
hand_discard();
if (discard > 0 && hand_discard())
{
discard--;
tte_printf("#{P:48,104; cx:0x3000}%d", discard);
}
}
tte_printf("#{es; P:128,130}%d/%d", hand_get_size(), hand_get_max_size());
tte_printf("#{P:200,155}%d/%d", deck_get_size(), deck_get_max_size());
static int last_hand_size = 0;
static int last_deck_size = 0;
if (last_hand_size != hand_get_size() || last_deck_size != deck_get_size())
{
tte_printf("#{P:128,128; cx:0}%d/%d", hand_get_size(), hand_get_max_size()); // Hand size/max size
tte_printf("#{P:200,152}%d/%d", deck_get_size(), deck_get_max_size()); // Deck size/max size
last_hand_size = hand_get_size();
last_deck_size = deck_get_size();
}
}