Made blind tokens visible in GAME_BLIND_SELECT state

This commit is contained in:
cellos51
2025-07-12 19:47:49 -04:00
parent f80bfefad5
commit 191c1a7264
3 changed files with 70 additions and 12 deletions
+8
View File
@@ -14,6 +14,14 @@ static const int ante_lut[MAX_ANTE + 1] = {100, 300, 800, 2000, 5000, 11000, 200
#define BIG_BLIND 1 #define BIG_BLIND 1
#define BOSS_BLIND 2 #define BOSS_BLIND 2
#define SMALL_BLIND_PB 1
#define BIG_BLIND_PB 2
#define BOSS_BLIND_PB 3
#define SMALL_BLIND_TID 832
#define BIG_BLIND_TID (SMALL_BLIND_TID + 16)
#define BOSS_BLIND_TID (BIG_BLIND_TID + 16)
enum BlindState enum BlindState
{ {
BLIND_CURRENT, BLIND_CURRENT,
+18 -9
View File
@@ -6,12 +6,21 @@
void blinds_init() void blinds_init()
{ {
// Blind graphics // Blind graphics (fighting grit every step of the way as usual)
// Small Blind (fighting grit every step of the way as usual) GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles);
//memcpy(&tile_mem[4][832], blinds_gfxTiles, blinds_gfxTilesLen);
GRIT_CPY(&tile_mem[4][832], blinds_gfxTiles); // Palettes for the blinds (Transparency, Text Color, Shadow, Highlight, Main Color) Use this: http://www.budmelvin.com/dev/15bitconverter.html
const u16 small_blind_token_palette[4] = {0x7FFF, 0x34A1, 0x5DCB, 0x5104}; // Small Blind
memcpy16(&pal_obj_mem[17], &small_blind_token_palette, sizeof(small_blind_token_palette) / 2); const u16 small_blind_token_palette[5] = {0x0000, 0x7FFF, 0x34A1, 0x5DCB, 0x5104};
memcpy16(&pal_obj_mem[16 * SMALL_BLIND_PB], &small_blind_token_palette, sizeof(small_blind_token_palette) / 2);
// Big Blind
const u16 big_blind_token_palette[5] = {0x0000, 0x2527, 0x15F5, 0x36FC, 0x1E9C};
memcpy16(&pal_obj_mem[16 * BIG_BLIND_PB], &big_blind_token_palette, sizeof(big_blind_token_palette) / 2);
// Boss Blind (This is temporary. Each boss blind is unique and will have to have its own graphics and palette which will probably be stored in some huge array)
const u16 boss_blind_token_palette[5] = {0x0000, 0x2CC9, 0x3D0D, 0x5E14, 0x5171};
memcpy16(&pal_obj_mem[16 * BOSS_BLIND_PB], &boss_blind_token_palette, sizeof(boss_blind_token_palette) / 2);
} }
int blind_get_requirement(int type, int ante) int blind_get_requirement(int type, int ante)
@@ -56,13 +65,13 @@ Sprite *blind_token_new(int type, int x, int y, int sprite_index)
switch (type) switch (type)
{ {
case SMALL_BLIND: case SMALL_BLIND:
sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, 832, 1, sprite_index); sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, SMALL_BLIND_TID, SMALL_BLIND_PB, sprite_index);
break; break;
case BIG_BLIND: case BIG_BLIND:
// Use the big blind sprite sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, BIG_BLIND_TID, BIG_BLIND_PB, sprite_index);
break; break;
case BOSS_BLIND: case BOSS_BLIND:
// Use the boss blind sprite sprite = sprite_new(ATTR0_SQUARE | ATTR0_4BPP, ATTR1_SIZE_32x32, BOSS_BLIND_TID, BOSS_BLIND_PB, sprite_index);
break; break;
default: default:
return NULL; return NULL;
+43 -2
View File
@@ -32,6 +32,8 @@ static enum HandType hand_type = NONE;
static Sprite *playing_blind_token = NULL; // The sprite that displays the blind when in "GAME_PLAYING/GAME_ROUND_END" state static Sprite *playing_blind_token = NULL; // The sprite that displays the blind when in "GAME_PLAYING/GAME_ROUND_END" state
static Sprite *round_end_blind_token = NULL; // The sprite that displays the blind when in "GAME_ROUND_END" state static Sprite *round_end_blind_token = NULL; // The sprite that displays the blind when in "GAME_ROUND_END" state
static Sprite *blind_select_tokens[MAX_BLINDS] = {NULL}; // The sprites that display the blinds when in "GAME_BLIND_SELECT" state
static int current_blind = SMALL_BLIND; 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
@@ -420,6 +422,15 @@ void change_background(int id)
} }
else if (id == BG_ID_BLIND_SELECT) else if (id == BG_ID_BLIND_SELECT)
{ {
obj_unhide(blind_select_tokens[SMALL_BLIND]->obj, 0);
obj_unhide(blind_select_tokens[BIG_BLIND]->obj, 0);
obj_unhide(blind_select_tokens[BOSS_BLIND]->obj, 0);
const int default_y = 89 + (8 * 12); // Default y position for the blind select tokens. 8 is the size of a tile and 12 is the amound of tiles the background is shifted down by
sprite_position(blind_select_tokens[SMALL_BLIND], 80, default_y);
sprite_position(blind_select_tokens[BIG_BLIND], 120, default_y);
sprite_position(blind_select_tokens[BOSS_BLIND], 160, default_y);
REG_DISPCNT &= ~DCNT_WIN0; REG_DISPCNT &= ~DCNT_WIN0;
memcpy(pal_bg_mem, background_blind_select_gfxPal, 64); memcpy(pal_bg_mem, background_blind_select_gfxPal, 64);
@@ -476,6 +487,8 @@ void change_background(int id)
} }
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 5); memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 5);
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - 8); // Move token up by a tile
} }
else if (blinds[i] == BLIND_UPCOMING) // Change the select icon to "NEXT" else if (blinds[i] == BLIND_UPCOMING) // Change the select icon to "NEXT"
{ {
@@ -813,6 +826,14 @@ void game_set_state(enum GameState new_game_state)
void game_init() void game_init()
{ {
blind_select_tokens[SMALL_BLIND] = blind_token_new(SMALL_BLIND, 8, 18, 35);
blind_select_tokens[BIG_BLIND] = blind_token_new(BIG_BLIND, 8, 18, 36);
blind_select_tokens[BOSS_BLIND] = blind_token_new(BOSS_BLIND, 8, 18, 37);
obj_hide(blind_select_tokens[SMALL_BLIND]->obj);
obj_hide(blind_select_tokens[BIG_BLIND]->obj);
obj_hide(blind_select_tokens[BOSS_BLIND]->obj);
// 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++)
{ {
@@ -2092,6 +2113,11 @@ void game_blind_select()
{ {
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP); main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP);
for (int i = 0; i < MAX_BLINDS; i++)
{
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - 8);
}
if (timer == 12) if (timer == 12)
{ {
state = 1; state = 1;
@@ -2130,6 +2156,11 @@ void game_blind_select()
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP); main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP);
} }
for (int i = 0; i < MAX_BLINDS; i++)
{
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - (8 * 12));
}
timer = 0; timer = 0;
} }
} }
@@ -2149,13 +2180,23 @@ void game_blind_select()
} }
case 2: // Blind selected, perform menu popout animation case 2: // Blind selected, perform menu popout animation
{ {
if (timer < MENU_POP_OUT_ANIM_FRAMES) if (timer < 15)
{ {
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_DOWN, SE_DOWN); main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_DOWN, SE_DOWN);
for (int i = 0; i < MAX_BLINDS; i++)
{
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y + 8);
}
} }
// TODO: Currently selecting other blinds crashes, remove this condition once fixed // TODO: Currently selecting other blinds crashes, remove this condition once fixed
else if (current_blind == SMALL_BLIND) else if (current_blind == SMALL_BLIND && timer >= MENU_POP_OUT_ANIM_FRAMES)
{ {
for (int i = 0; i < MAX_BLINDS; i++)
{
obj_hide(blind_select_tokens[i]->obj);
}
game_set_state(GAME_PLAYING); game_set_state(GAME_PLAYING);
state = 0; // Reset the state state = 0; // Reset the state
} }