From 164f58aa1ef52b72a56dc561534241f6d5b9d1ee Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sat, 9 Aug 2025 21:49:37 -0400 Subject: [PATCH 01/21] Main menu prototype --- graphics/affine_main_menu_background_gfx.grit | 1 + graphics/affine_main_menu_background_gfx.png | Bin 0 -> 5222 bytes graphics/background_main_menu_gfx.grit | 1 + graphics/background_main_menu_gfx.png | Bin 0 -> 8404 bytes include/affine_background.h | 11 +- include/game.h | 2 + include/graphic_utils.h | 6 + source/affine_background.c | 69 ++++++++--- source/game.c | 108 +++++++++++++++--- source/graphic_utils.c | 30 +++++ source/main.c | 2 +- 11 files changed, 200 insertions(+), 30 deletions(-) create mode 100644 graphics/affine_main_menu_background_gfx.grit create mode 100644 graphics/affine_main_menu_background_gfx.png create mode 100644 graphics/background_main_menu_gfx.grit create mode 100644 graphics/background_main_menu_gfx.png diff --git a/graphics/affine_main_menu_background_gfx.grit b/graphics/affine_main_menu_background_gfx.grit new file mode 100644 index 0000000..3205289 --- /dev/null +++ b/graphics/affine_main_menu_background_gfx.grit @@ -0,0 +1 @@ +-gt -gB8 -mLa -mRa \ No newline at end of file diff --git a/graphics/affine_main_menu_background_gfx.png b/graphics/affine_main_menu_background_gfx.png new file mode 100644 index 0000000000000000000000000000000000000000..74b938aa355d628b5e2e33f682ebf1c7545076fc GIT binary patch literal 5222 zcmV-s6q)OZP)C00001b5ch_0olnc ze*gdg1ZP1_K>z@;j|==^1poj5AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUyFi=cXMI9w64>d_YDk@noEd@z&cQi4VIyC}rxw=3()I>byP)G4_ zX*Hwr`L;#2d9Y_EG010qNS#tmY4s-wj4s-!)B(v54 z000McNliru=?Dq{Bq@*^-9K1>K= zG1f zm=WYkC6cd1=0>+7xGH&Y9@kYW-v9v7fq>|Ouv=i@;j*t(AkgC?64l5At%%eKH=gSU z6H>{Q3VbD%ZltiFvu_c?7PIg`o-P6s08tUhj+{^`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=S`v1@3@{$Jc`u6jPTsQ)lrF(flK8VfXEBVzTIx|JaI^@oQuAyW7)Nw+T7K zq+4!-(Bc*-|HpRzD;h}E!$L!X__RPr_Ii%}2)j^?@M=x6+8NhFZC_h|0UdaL^~WY# ziQ4_Oq4?V2`#5D9nq%!uGGCvA{>?8+PVfrl?-MW(E-h`>ZwiMqMUD49PBWQ*D)s~% zxi#Db${~Pr8KfPvz(D$GM86WdILfaK`HwV2=YPl5xHyGXYG;$`7fHg|3n(xC;Com7 zs97K3cij9al~1zB-wEqKE?5&6Cq)()!vtjTh|_Ev8sCgSeZ{1Y1l1z&GicF@4xnM{XYOun#OEj!4=OYI{5AzfVlLqFZSS z|0c*eM9_*p{@d|JWai-j-l0yo(HXMRo)g-F^PVFJ)ChJ2$i4oj2YYBYj9(b#CywM! zKi*vk4Wj_G&%CgtZ&wL0H%0O3p21!(e_nUv_!w*dd1 cIl{b`CZ057SV&yz2jzf@qNV~|&NAYE0M&96MF0Q* literal 0 HcmV?d00001 diff --git a/include/affine_background.h b/include/affine_background.h index 8e5f78f..31a5b65 100644 --- a/include/affine_background.h +++ b/include/affine_background.h @@ -5,13 +5,20 @@ #include "graphic_utils.h" -#define AFFINE_BG_PAL_LEN 5 -#define AFFINE_BG_PB (PAL_ROW_LEN * 15) // This isn't really a palette bank, just the starting index of the palette +#define AFFINE_BG_PAL_LEN 16 +#define AFFINE_BG_PB (PAL_ROW_LEN * 10) // This isn't really a palette bank, just the starting index of the palette + +enum AffineBackgroundID +{ + AFFINE_BG_MAIN_MENU, + AFFINE_BG_GAME, +}; void affine_background_init(); void affine_background_update(); void affine_background_set_color(COLOR color); // Must be called with an array of size at least AFFINE_BG_PAL_LEN void affine_background_load_palette(const u16 *src); +void affine_background_change_background(enum AffineBackgroundID new_bg); #endif // AFFINE_BACKGROUND_H diff --git a/include/game.h b/include/game.h index 55e8730..b6063ff 100644 --- a/include/game.h +++ b/include/game.h @@ -16,6 +16,7 @@ #define BG_ID_ROUND_END 3 #define BG_ID_SHOP 4 #define BG_ID_BLIND_SELECT 5 +#define BG_ID_MAIN_MENU 6 // Input bindings #define SELECT_CARD KEY_A @@ -26,6 +27,7 @@ enum GameState { + GAME_MAIN_MENU, GAME_PLAYING, GAME_ROUND_END, GAME_SHOP, diff --git a/include/graphic_utils.h b/include/graphic_utils.h index 2e80828..dd90ace 100644 --- a/include/graphic_utils.h +++ b/include/graphic_utils.h @@ -138,4 +138,10 @@ void memcpy16_tile8_with_palette_offset(u16* dst, const u16* src, uint hwcount, */ void memcpy32_tile8_with_palette_offset(u32* dst, const u32* src, uint wcount, u8 palette_offset); +/* Toggles the visibility of the window layers. + * win0 and win1 are the visibility states for the two windows. + * These windows are primarily used for the shadows on held jokers, consumables and cards. + */ +void toggle_windows(bool win0, bool win1); + #endif //GRAPHIC_UTILS_H diff --git a/source/affine_background.c b/source/affine_background.c index f9e15e7..b61be78 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -1,16 +1,17 @@ #include "affine_background.h" #include "affine_background_gfx.h" +#include "affine_main_menu_background_gfx.h" #include "graphic_utils.h" BG_AFFINE bgaff; -AFF_SRC_EX asx = {32<<8, 64<<8, 120, 80, 0x0100, 0x0100, 0}; +AFF_SRC_EX asx = {0}; + +enum AffineBackgroundID background = AFFINE_BG_MAIN_MENU; void affine_background_init() -{ - memcpy32_tile8_with_palette_offset((u32*)&tile8_mem[AFFINE_BG_CBB], (const u32*)affine_background_gfxTiles, affine_background_gfxTilesLen/4, AFFINE_BG_PB); - GRIT_CPY(&se_mem[AFFINE_BG_SBB], affine_background_gfxMap); - affine_background_load_palette(affine_background_gfxPal); +{ + affine_background_change_background(background); bgaff = bg_aff_default; } @@ -20,20 +21,37 @@ void affine_background_update() static uint timer = 0; timer++; - // These values are not permament, just the current configuration for the affine background - asx.tex_x += 5; - asx.tex_y += 12; - asx.sx = (lu_sin(timer * 100)) >> 8; // Scale the sine value to fit in a s16 - asx.sx += 256; // Add 256 to the sine value to make it positive - asx.sy = (lu_sin(timer * 100 + 0x4000)) >> 8; // Scale the sine value to fit in a s16 - asx.sy += 256; // Add 256 to the sine value to make it positive + switch (background) + { + case AFFINE_BG_MAIN_MENU: + asx.scr_x = SCREEN_WIDTH / 2; + asx.scr_y = SCREEN_HEIGHT / 2; + asx.tex_x = 16560; + asx.tex_y = 14400; + asx.sx = 128; + asx.sy = 128; + asx.alpha = 1000; // This slightly rotates it which increases the percieved resolution of the background + break; + case AFFINE_BG_GAME: + asx.scr_x = 0; + asx.scr_y = 0; + asx.tex_x += 5; + asx.tex_y += 12; + asx.sx = (lu_sin(timer * 100)) >> 8; // Scale the sine value to fit in a s16 + asx.sx += 256; // Add 256 to the sine value to make it positive + asx.sy = (lu_sin(timer * 100 + 0x4000)) >> 8; // Scale the sine value to fit in a s16 + asx.sy += 256; // Add 256 to the sine value to make it positive + asx.alpha = 0; + break; + } + bg_rotscale_ex(&bgaff, &asx); REG_BG_AFFINE[2] = bgaff; } void affine_background_set_color(COLOR color) { - memcpy16(&pal_bg_mem[AFFINE_BG_PB], affine_background_gfxPal, AFFINE_BG_PAL_LEN); + memcpy16(&pal_bg_mem[AFFINE_BG_PB], affine_main_menu_background_gfxPal, AFFINE_BG_PAL_LEN); for (int i = 0; i < AFFINE_BG_PAL_LEN; i++) { clr_rgbscale(&pal_bg_mem[AFFINE_BG_PB] + i, &pal_bg_mem[AFFINE_BG_PB] + i, 1, color); @@ -43,4 +61,29 @@ void affine_background_set_color(COLOR color) void affine_background_load_palette(const u16 *src) { memcpy16(&pal_bg_mem[AFFINE_BG_PB], src, AFFINE_BG_PAL_LEN); +} + +void affine_background_change_background(enum AffineBackgroundID new_bg) +{ + background = new_bg; + + switch (background) + { + case AFFINE_BG_MAIN_MENU: + REG_BG2CNT &= ~BG_AFF_32x32; + REG_BG2CNT |= BG_AFF_16x16; + + memcpy32_tile8_with_palette_offset((u32*)&tile8_mem[AFFINE_BG_CBB], (const u32*)affine_main_menu_background_gfxTiles, affine_main_menu_background_gfxTilesLen/4, AFFINE_BG_PB); + GRIT_CPY(&se_mem[AFFINE_BG_SBB], affine_main_menu_background_gfxMap); + affine_background_load_palette(affine_main_menu_background_gfxPal); + break; + case AFFINE_BG_GAME: + REG_BG2CNT &= ~BG_AFF_16x16; + REG_BG2CNT |= BG_AFF_32x32; + + memcpy32_tile8_with_palette_offset((u32*)&tile8_mem[AFFINE_BG_CBB], (const u32*)affine_background_gfxTiles, affine_background_gfxTilesLen/4, AFFINE_BG_PB); + GRIT_CPY(&se_mem[AFFINE_BG_SBB], affine_background_gfxMap); + affine_background_load_palette(affine_background_gfxPal); + break; + } } \ No newline at end of file diff --git a/source/game.c b/source/game.c index f58d644..9d3d73a 100644 --- a/source/game.c +++ b/source/game.c @@ -20,6 +20,8 @@ #include "background_shop_gfx.h" #include "background_blind_select_gfx.h" #include "affine_background_gfx.h" +#include "background_main_menu_gfx.h" +#include "affine_main_menu_background_gfx.h" #include "soundbank.h" @@ -33,7 +35,7 @@ static uint timer = 0; // This might already exist in libtonc but idk so i'm jus static int game_speed = 1; static int background = 0; -static enum GameState game_state = GAME_BLIND_SELECT; // The current game state, this is used to determine what the game is doing at any given time +static enum GameState game_state = GAME_MAIN_MENU; // The current game state, this is used to determine what the game is doing at any given time static enum HandState hand_state = HAND_DRAW; static enum PlayState play_state = PLAY_PLAYING; static int state = 0; // General state variable, used for switch statements in each game state related function @@ -241,6 +243,8 @@ static const Rect CASHOUT_RECT = {88, 72, UNDEFINED, UNDEF static const Rect SHOP_REROLL_RECT = {88, 96, UNDEFINED, UNDEFINED }; //TODO: Properly define and use +#define MAIN_MENU_BUTTONS 4 + #define MENU_POP_OUT_ANIM_FRAMES 20 #define SCORED_CARD_TEXT_Y 48 @@ -429,7 +433,8 @@ void change_background(int id) } else { - REG_DISPCNT |= DCNT_WIN0; // Enable window 0 to make hand background transparent + toggle_windows(true, true); // Enable window 0 for the hand shadow + // Load the tiles and palette // Background memcpy(pal_bg_mem, background_gfxPal, 64); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden @@ -484,16 +489,16 @@ void change_background(int id) background = BG_ID_ROUND_END; } - REG_DISPCNT &= ~DCNT_WIN0; // Disable window 0 so it doesn't make the cashout menu transparent + toggle_windows(false, true); // Disable window 0 so it doesn't make the cashout menu transparent main_bg_se_clear_rect(ROUND_END_MENU_RECT); tte_erase_rect_wrapper(HAND_SIZE_RECT); } else if (id == BG_ID_SHOP) { - REG_DISPCNT &= ~DCNT_WIN0; + toggle_windows(false, true); - memcpy(pal_bg_mem, background_shop_gfxPal, 64); + memcpy16(pal_bg_mem, background_shop_gfxPal, 64); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_shop_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_shop_gfxMap); @@ -520,7 +525,7 @@ void change_background(int id) sprite_position(blind_select_tokens[BIG_BLIND], 120, default_y); sprite_position(blind_select_tokens[BOSS_BLIND], 160, default_y); - REG_DISPCNT &= ~DCNT_WIN0; + toggle_windows(false, true); memcpy16(pal_bg_mem, background_blind_select_gfxPal, 64); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_blind_select_gfxTiles); @@ -619,6 +624,21 @@ void change_background(int id) } } } + else if (id == BG_ID_MAIN_MENU) + { + toggle_windows(false, false); + + tte_erase_screen(); + memcpy16(pal_bg_mem, background_main_menu_gfxPal, PAL_ROW_LEN * 9); + GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_main_menu_gfxTiles); + GRIT_CPY(&se_mem[MAIN_BG_SBB], background_main_menu_gfxMap); + + // Disable the button highlight colors + // Select button PID is 5 and the outline is 3 + memcpy16(&pal_bg_mem[3], &pal_bg_mem[5], 1); + + affine_background_change_background(AFFINE_BG_MAIN_MENU); + } else { return; // Invalid background ID @@ -1015,10 +1035,7 @@ void jokers_avialable_to_shop_init() void game_init() { - jokers_avialable_to_shop_init(); - - hands = max_hands; - discards = max_discards; + change_background(BG_ID_MAIN_MENU); blind_select_tokens[SMALL_BLIND] = blind_token_new(SMALL_BLIND, 8, 18, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 3); blind_select_tokens[BIG_BLIND] = blind_token_new(BIG_BLIND, 8, 18, MAX_SELECTION_SIZE + MAX_HAND_SIZE + 4); @@ -1037,8 +1054,26 @@ void game_init() deck_push(card); } } +} - change_background(BG_ID_BLIND_SELECT); +void game_start() +{ + affine_background_change_background(AFFINE_BG_GAME); + + jokers_avialable_to_shop_init(); + + hands = max_hands; + discards = max_discards; + + // 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 rank = 0; rank < NUM_RANKS; rank++) + { + Card *card = card_new(suit, rank); + deck_push(card); + } + } tte_printf("#{P:%d,%d; cx:0xF000}%d/%d", DECK_SIZE_RECT.left, DECK_SIZE_RECT.top, deck_get_size(), deck_get_max_size()); // Deck size/max size @@ -1055,6 +1090,9 @@ void game_init() display_money(money); // Set the money display tte_printf("#{P:%d,%d; cx:0xC000}%d#{cx:0xF000}/%d", ANTE_TEXT_RECT.left, ANTE_TEXT_RECT.top, ante, MAX_ANTE); // Ante + + change_background(BG_ID_BLIND_SELECT); + game_set_state(GAME_BLIND_SELECT); } static void game_playing_process_hand_select_input() @@ -2375,7 +2413,6 @@ static void game_shop_lights_anim_frame() memcpy16(&pal_bg_mem[8], &shifted_palette[3], 1); } - void game_shop() { change_background(BG_ID_SHOP); @@ -2473,8 +2510,6 @@ void game_shop() } } - - void game_blind_select() { switch (state) // I'm only using magic numbers here for the sake of simplicity since it's just sequential, but you can replace them with named constants or enums if it makes it clearer @@ -2639,6 +2674,48 @@ void game_blind_select() } } +void game_main_menu() +{ + change_background(BG_ID_MAIN_MENU); + + if (key_hit(KEY_LEFT)) + { + if (selection_x > 0) + { + selection_x--; + } + } + else if (key_hit(KEY_RIGHT)) + { + // TODO: Don't allow cursor on sold items + if (selection_x < MAIN_MENU_BUTTONS) + { + selection_x++; + } + else if (selection_x < MAIN_MENU_BUTTONS) + { + selection_x++; + } + } + + if (selection_x == 0) // Play button + { + // Select button PID is 5 and the outline is 3 + memset16(&pal_bg_mem[3], CLR_WHITE, 1); + + if (key_hit(KEY_A)) + { + // Start the game + game_start(); + } + } + else + { + // Select button PID is 5 and the outline is 3 + memcpy16(&pal_bg_mem[3], &pal_bg_mem[5], 1); + } +} + void game_update() { timer++; @@ -2656,6 +2733,9 @@ void game_update() switch (game_state) { + case GAME_MAIN_MENU: + game_main_menu(); + break; case GAME_PLAYING: game_playing(); break; diff --git a/source/graphic_utils.c b/source/graphic_utils.c index b568442..2c64e88 100644 --- a/source/graphic_utils.c +++ b/source/graphic_utils.c @@ -186,4 +186,34 @@ void memcpy32_tile8_with_palette_offset(u32* dst, const u32* src, uint wcount, u // Copying u8 data 4 times across u32 data dst[i] = src[i] + offset; } +} + +void toggle_windows(bool win0, bool win1) +{ + if (win0) + { + REG_DISPCNT |= DCNT_WIN0; + } + else + { + REG_DISPCNT &= ~DCNT_WIN0; + } + + if (win1) + { + REG_DISPCNT |= DCNT_WIN1; + } + else + { + REG_DISPCNT &= ~DCNT_WIN1; + } + + if (win0 || win1) + { + REG_BLDCNT = BLD_BUILD(BLD_BG1, BLD_BG2, 1); + } + else + { + REG_BLDCNT = 0; + } } \ No newline at end of file diff --git a/source/main.c b/source/main.c index 76abc07..bbee8aa 100644 --- a/source/main.c +++ b/source/main.c @@ -44,7 +44,7 @@ void init() // BG1 is the main background layer REG_BG1CNT = BG_PRIO(1) | BG_CBB(MAIN_BG_CBB) | BG_SBB(MAIN_BG_SBB) | BG_8BPP; // BG2 is the affine background layer - REG_BG2CNT = BG_PRIO(2) | BG_CBB(AFFINE_BG_CBB) | BG_SBB(AFFINE_BG_CBB) | BG_8BPP | BG_WRAP | BG_AFF_32x32; + REG_BG2CNT = BG_PRIO(2) | BG_CBB(AFFINE_BG_CBB) | BG_SBB(AFFINE_BG_CBB) | BG_8BPP | BG_WRAP | BG_AFF_16x16; int win1_left = 72; int win1_top = 44; From d20b5c5ce4f515b1ef8036aba184f5f381ee5828 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sat, 9 Aug 2025 23:18:52 -0400 Subject: [PATCH 02/21] Buggy restarting --- source/game.c | 152 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 124 insertions(+), 28 deletions(-) diff --git a/source/game.c b/source/game.c index 9d3d73a..c6508e8 100644 --- a/source/game.c +++ b/source/game.c @@ -42,6 +42,8 @@ static int state = 0; // General state variable, used for switch statements in e static enum HandType hand_type = NONE; +static CardObject *main_menu_ace = NULL; + 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 @@ -51,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 = 4; -static int max_discards = 4; +static int max_hands; +static int max_discards; // Set in game_init and game_round_init -static int hands = 0; -static int discards = 0; +static int hands; +static int discards; -static int round = 0; -static int ante = 1; -static int money = 4; -static int score = 0; +static int round; +static int ante; +static int money; +static int score; 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 = 0; -static int mult = 0; +static int chips; +static int mult; -static int hand_size = 8; // Default hand size is 8 -static int cards_drawn = 0; -static int hand_selections = 0; +static int hand_size; // Default hand size is 8 +static int cards_drawn; +static int hand_selections; -static int selection_x = 0; -static int selection_y = 0; +static int selection_x; +static int selection_y; -static bool sort_by_suit = false; +static bool sort_by_suit; // Stacks static JokerObject *jokers[MAX_JOKERS_HELD_SIZE] = {NULL}; @@ -119,6 +121,19 @@ 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) { @@ -473,6 +488,7 @@ void change_background(int id) } REG_WIN0V = (REG_WIN0V << 8) | 0xA0; // Set window 0 bottom to 160 + toggle_windows(true, true); for (int i = 0; i <= 2; i++) { @@ -636,8 +652,6 @@ void change_background(int id) // Disable the button highlight colors // Select button PID is 5 and the outline is 3 memcpy16(&pal_bg_mem[3], &pal_bg_mem[5], 1); - - affine_background_change_background(AFFINE_BG_MAIN_MENU); } else { @@ -993,11 +1007,27 @@ void game_round_init() deck_shuffle(); // Shuffle the deck at the start of the round } +void game_main_menu_init() +{ + affine_background_change_background(AFFINE_BG_MAIN_MENU); + main_menu_ace = card_object_new(card_new(SPADES, ACE)); + card_object_set_sprite(main_menu_ace, 0); // Set the sprite for the ace of spades + main_menu_ace->sprite_object->sprite->obj->attr0 |= ATTR0_AFF_DBL; // Make the sprite double sized + main_menu_ace->sprite_object->tx = int2fx(88); + main_menu_ace->sprite_object->x = main_menu_ace->sprite_object->tx; + main_menu_ace->sprite_object->ty = int2fx(26); + main_menu_ace->sprite_object->y = main_menu_ace->sprite_object->ty; + main_menu_ace->sprite_object->tscale = float2fx(0.8f); +} + void init_game_state(enum GameState game_state_to_init) { // Switch written out, add init for states as needed switch (game_state_to_init) { + case GAME_MAIN_MENU: + game_main_menu_init(); + break; case GAME_PLAYING: game_round_init(); break; @@ -1045,26 +1075,55 @@ void game_init() 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. - for (int suit = 0; suit < NUM_SUITS; suit++) - { - for (int rank = 0; rank < NUM_RANKS; rank++) - { - Card *card = card_new(suit, rank); - deck_push(card); - } - } + game_set_state(game_state); } void game_start() { affine_background_change_background(AFFINE_BG_GAME); + // Normally I would just cache these and hide/unhide but I didn't feel like dealing with defining a layer for it + card_destroy(&main_menu_ace->card); + card_object_destroy(&main_menu_ace); + 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++) { @@ -2678,6 +2737,10 @@ void game_main_menu() { change_background(BG_ID_MAIN_MENU); + card_object_update(main_menu_ace); + main_menu_ace->sprite_object->trotation = lu_sin((timer << 8) / 2) / 3; + main_menu_ace->sprite_object->rotation = main_menu_ace->sprite_object->trotation; + if (key_hit(KEY_LEFT)) { if (selection_x > 0) @@ -2716,6 +2779,39 @@ 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++; @@ -2749,7 +2845,7 @@ void game_update() game_blind_select(); break; case GAME_LOSE: - // Handle lose logic here + game_lose(); break; } } \ No newline at end of file From d2aee1979b0a66b0da416a9e2c914c41bb992930 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 11:59:35 -0400 Subject: [PATCH 03/21] 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 From dcf892a393c8fa22c0e8a57565604f91845aedd9 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 12:04:06 -0400 Subject: [PATCH 04/21] Moved seed calculation into main_menu state --- source/game.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/source/game.c b/source/game.c index c9cda73..642ecd4 100644 --- a/source/game.c +++ b/source/game.c @@ -27,9 +27,7 @@ #include "list.h" -// This seed system is temporary. -static uint rng_seed = 2048; -static bool seeded = false; +static uint rng_seed = 0; static uint timer = 0; // This might already exist in libtonc but idk so i'm just making my own static int game_speed = 1; @@ -263,12 +261,8 @@ int get_num_discards_remaining(void) { // General functions void set_seed(int seed) { - if (!seeded) - { - seeded = true; - rng_seed = seed; - srand(rng_seed); - } + rng_seed = seed; + srand(rng_seed); } void sort_hand_by_suit() @@ -1067,6 +1061,8 @@ void game_init() void game_start() { + set_seed(rng_seed); + affine_background_change_background(AFFINE_BG_GAME); // Normally I would just cache these and hide/unhide but I didn't feel like dealing with defining a layer for it @@ -2695,6 +2691,13 @@ void game_main_menu() main_menu_ace->sprite_object->trotation = lu_sin((timer << 8) / 2) / 3; main_menu_ace->sprite_object->rotation = main_menu_ace->sprite_object->trotation; + // Seed randomization + rng_seed++; + if (key_curr_state() != key_prev_state()) // If the keys have changed, make it more pseudo-random + { + rng_seed *= 2; + } + if (key_hit(KEY_LEFT)) { if (selection_x > 0) @@ -2737,15 +2740,6 @@ void game_update() { timer++; - if (seeded == false) - { - rng_seed++; - if (key_curr_state() != key_prev_state()) // If the keys have changed, make it more pseudo-random - { - rng_seed *= 2; - } - } - held_jokers_update_loop(); switch (game_state) From c5ff984e84a157a10837a30ba95ee82124ab82a3 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 12:09:59 -0400 Subject: [PATCH 05/21] Added copliot's changes --- source/affine_background.c | 4 ++-- source/game.c | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/source/affine_background.c b/source/affine_background.c index b61be78..084c3a2 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -30,7 +30,7 @@ void affine_background_update() asx.tex_y = 14400; asx.sx = 128; asx.sy = 128; - asx.alpha = 1000; // This slightly rotates it which increases the percieved resolution of the background + asx.alpha = 1000; // This slightly rotates it which increases the perceived resolution of the background break; case AFFINE_BG_GAME: asx.scr_x = 0; @@ -66,7 +66,7 @@ void affine_background_load_palette(const u16 *src) void affine_background_change_background(enum AffineBackgroundID new_bg) { background = new_bg; - + switch (background) { case AFFINE_BG_MAIN_MENU: diff --git a/source/game.c b/source/game.c index 642ecd4..097f7bf 100644 --- a/source/game.c +++ b/source/game.c @@ -2707,15 +2707,10 @@ void game_main_menu() } else if (key_hit(KEY_RIGHT)) { - // TODO: Don't allow cursor on sold items if (selection_x < MAIN_MENU_BUTTONS) { selection_x++; } - else if (selection_x < MAIN_MENU_BUTTONS) - { - selection_x++; - } } if (selection_x == 0) // Play button From 7d2be834a3076461d6210f3e3c0935876efc42a4 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 13:00:38 -0400 Subject: [PATCH 06/21] Splash screen with disclaimer added --- source/affine_background.c | 1 + source/main.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/source/affine_background.c b/source/affine_background.c index 084c3a2..5bfefe3 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -12,6 +12,7 @@ enum AffineBackgroundID background = AFFINE_BG_MAIN_MENU; void affine_background_init() { affine_background_change_background(background); + affine_background_update(); bgaff = bg_aff_default; } diff --git a/source/main.c b/source/main.c index bbee8aa..0c2e703 100644 --- a/source/main.c +++ b/source/main.c @@ -18,6 +18,8 @@ #include "soundbank.h" #include "soundbank_bin.h" +#define SPLASH_DURATION (60 * 10) // FPS * SECONDS + void init() { irq_init(NULL); @@ -71,6 +73,21 @@ void init() REG_DISPCNT = DCNT_MODE1 | DCNT_OBJ_1D | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_OBJ | DCNT_WIN0 | DCNT_WIN1; + // Splash screen + tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); + tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); + tte_printf("#{P:24,144; cx:0xF000}(Press any key to skip)"); + for (int i = 0; i < SPLASH_DURATION; i++) + { + VBlankIntrWait(); + key_poll(); + if (key_hit(KEY_A | KEY_B | KEY_START | KEY_SELECT)) // Skip intro + { + break; + } + } + tte_erase_screen(); + // Initialize subsystems affine_background_init(); sprite_init(); From 7505d89194dec8adbd004b9a4581dbe641a1a827 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 13:11:05 -0400 Subject: [PATCH 07/21] Addec count down timer to splash screen and stopped music playing until at menu --- source/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/main.c b/source/main.c index 0c2e703..cab6740 100644 --- a/source/main.c +++ b/source/main.c @@ -18,17 +18,14 @@ #include "soundbank.h" #include "soundbank_bin.h" -#define SPLASH_DURATION (60 * 10) // FPS * SECONDS +#define FPS (60) +#define SPLASH_DURATION (FPS * 10) // FPS * SECONDS void init() { irq_init(NULL); irq_add(II_VBLANK, mmVBlank); - // Initialize maxmod - mmInitDefault((mm_addr)soundbank_bin, 12); - mmStart(MOD_MAIN_THEME, MM_PLAY_LOOP); - // Initialize text engine tte_init_se(0, BG_CBB(TTE_CBB) | BG_SBB(TTE_SBB), 0, CLR_WHITE, 14, NULL, NULL); tte_erase_screen(); @@ -76,7 +73,7 @@ void init() // Splash screen tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); - tte_printf("#{P:24,144; cx:0xF000}(Press any key to skip)"); + tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)"); for (int i = 0; i < SPLASH_DURATION; i++) { VBlankIntrWait(); @@ -85,10 +82,14 @@ void init() { break; } + tte_erase_rect_wrapper((Rect){208, 144, 240, 152}); + tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION - i) / FPS); } tte_erase_screen(); // Initialize subsystems + mmInitDefault((mm_addr)soundbank_bin, 12); + mmStart(MOD_MAIN_THEME, MM_PLAY_LOOP); affine_background_init(); sprite_init(); card_init(); From f2497a12844b0594ce50b7829ab8b224e8421b63 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 10 Aug 2025 16:34:47 -0400 Subject: [PATCH 08/21] fixed boss blind background being too dark --- source/affine_background.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/affine_background.c b/source/affine_background.c index 5bfefe3..a1bcf93 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -52,7 +52,7 @@ void affine_background_update() void affine_background_set_color(COLOR color) { - memcpy16(&pal_bg_mem[AFFINE_BG_PB], affine_main_menu_background_gfxPal, AFFINE_BG_PAL_LEN); + affine_background_change_background(background); // Reload the palette to reset any previous color scaling for (int i = 0; i < AFFINE_BG_PAL_LEN; i++) { clr_rgbscale(&pal_bg_mem[AFFINE_BG_PB] + i, &pal_bg_mem[AFFINE_BG_PB] + i, 1, color); From 4c5c0f4d404b50efb596e31f3bed835daa4b2724 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Tue, 12 Aug 2025 20:55:03 -0400 Subject: [PATCH 09/21] Removed rng set in game_round_init() and updated defines for splash screen --- source/game.c | 5 +---- source/main.c | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/game.c b/source/game.c index 9ecf87d..e772c3d 100644 --- a/source/game.c +++ b/source/game.c @@ -242,9 +242,9 @@ static const Rect HAND_REWARD_RECT = {168, UNDEFINED, UNDEFINED, UN static const Rect CASHOUT_RECT = {88, 72, UNDEFINED, UNDEFINED }; static const Rect SHOP_REROLL_RECT = {88, 96, UNDEFINED, UNDEFINED }; -//TODO: Properly define and use #define MAIN_MENU_BUTTONS 4 +//TODO: Properly define and use #define MENU_POP_OUT_ANIM_FRAMES 20 #define SCORED_CARD_TEXT_Y 48 @@ -938,9 +938,6 @@ void increment_blind(enum BlindState increment_reason) void game_round_init() { - // once we have a main menu, move the seed set there. this is only here now because there isn't a way to set the seed to a psudorandom value unless there is something to wait on - set_seed(rng_seed); - hand_state = HAND_DRAW; cards_drawn = 0; hand_selections = 0; diff --git a/source/main.c b/source/main.c index daa32a7..e1b1643 100644 --- a/source/main.c +++ b/source/main.c @@ -18,8 +18,9 @@ #include "soundbank.h" #include "soundbank_bin.h" -#define FPS (60) -#define SPLASH_DURATION (FPS * 10) // FPS * SECONDS +#define SPLASH_FPS 60 +#define SPLASH_DURATION_SECONDS 10 +#define SPLASH_DURATION_FRAMES (SPLASH_FPS * SPLASH_DURATION_SECONDS) void init() { @@ -74,7 +75,7 @@ void init() tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)"); - for (int i = 0; i < SPLASH_DURATION; i++) + for (int i = 0; i < SPLASH_DURATION_FRAMES; i++) { VBlankIntrWait(); key_poll(); @@ -83,7 +84,7 @@ void init() break; } tte_erase_rect_wrapper((Rect){208, 144, 240, 152}); - tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION - i) / FPS); + tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION_FRAMES - i) / SPLASH_FPS); } tte_erase_screen(); From 5d0ea3a101c7e3ecfc6e44b0b17c1ba868fbbe40 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Tue, 12 Aug 2025 21:42:44 -0400 Subject: [PATCH 10/21] Changed formatting on github link --- source/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index e1b1643..f7c07c2 100644 --- a/source/main.c +++ b/source/main.c @@ -73,7 +73,7 @@ void init() // Splash screen tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); - tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); + tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)"); for (int i = 0; i < SPLASH_DURATION_FRAMES; i++) { From da6248036cd5c42cc04eed9ad6f1b56dda4edc0b Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 24 Aug 2025 13:47:59 -0400 Subject: [PATCH 11/21] Remove unnecessary joker initialization in game_start and set game state to GAME_BLIND_SELECT --- source/game.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/game.c b/source/game.c index e3c90a1..932dd66 100644 --- a/source/game.c +++ b/source/game.c @@ -1111,8 +1111,6 @@ void game_start() card_destroy(&main_menu_ace->card); card_object_destroy(&main_menu_ace); - jokers_avialable_to_shop_init(); - hands = max_hands; discards = max_discards; @@ -1142,6 +1140,8 @@ void game_start() display_money(money); // Set the money display tte_printf("#{P:%d,%d; cx:0x%X000}%d#{cx:0x%X000}/%d", ANTE_TEXT_RECT.left, ANTE_TEXT_RECT.top, TTE_YELLOW_PB, ante, TTE_WHITE_PB, MAX_ANTE); // Ante + + game_set_state(GAME_BLIND_SELECT); } static void game_playing_process_hand_select_input() From 4f1f7cb3476af6ebe1209f1aaf5b3efd897de84e Mon Sep 17 00:00:00 2001 From: cellos51 Date: Sun, 24 Aug 2025 15:44:45 -0400 Subject: [PATCH 12/21] Add splash screen functionality and update game state management - Introduced GAME_SPLASH_SCREEN state in game.h - Implemented splash_screen_init and splash_screen_update functions in splash_screen.c - Updated game.c to initialize with GAME_SPLASH_SCREEN and handle splash screen updates - Removed old splash screen code from main.c --- include/game.h | 2 ++ include/splash_screen.h | 13 +++++++++++++ source/affine_background.c | 1 - source/game.c | 21 ++++++++++++++------- source/main.c | 21 --------------------- source/splash_screen.c | 30 ++++++++++++++++++++++++++++++ 6 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 include/splash_screen.h create mode 100644 source/splash_screen.c diff --git a/include/game.h b/include/game.h index a610ebc..f995216 100644 --- a/include/game.h +++ b/include/game.h @@ -28,6 +28,7 @@ enum GameState { + GAME_SPLASH_SCREEN, GAME_MAIN_MENU, GAME_PLAYING, GAME_ROUND_END, @@ -77,6 +78,7 @@ enum HandType // Game functions void game_init(); void game_update(); +void game_set_state(enum GameState new_game_state); // Forward declaration struct List; diff --git a/include/splash_screen.h b/include/splash_screen.h new file mode 100644 index 0000000..3b23d1d --- /dev/null +++ b/include/splash_screen.h @@ -0,0 +1,13 @@ +#ifndef SPLASH_SCREEN_H +#define SPLASH_SCREEN_H + +#include + +#define SPLASH_FPS 60 +#define SPLASH_DURATION_SECONDS 10 +#define SPLASH_DURATION_FRAMES (SPLASH_FPS * SPLASH_DURATION_SECONDS) + +void splash_screen_init(); +void splash_screen_update(uint timer); + +#endif // SPLASH_SCREEN_H \ No newline at end of file diff --git a/source/affine_background.c b/source/affine_background.c index a1bcf93..c9e6991 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -11,7 +11,6 @@ enum AffineBackgroundID background = AFFINE_BG_MAIN_MENU; void affine_background_init() { - affine_background_change_background(background); affine_background_update(); bgaff = bg_aff_default; diff --git a/source/game.c b/source/game.c index 932dd66..6c5ef0c 100644 --- a/source/game.c +++ b/source/game.c @@ -16,6 +16,7 @@ #include "tonc_video.h" #include "audio_utils.h" #include "selection_grid.h" +#include "splash_screen.h" #include "background_gfx.h" #include "background_shop_gfx.h" @@ -34,7 +35,7 @@ static uint timer = 0; // This might already exist in libtonc but idk so i'm jus static int game_speed = 1; static int background = 0; -static enum GameState game_state = GAME_MAIN_MENU; // The current game state, this is used to determine what the game is doing at any given time +static enum GameState game_state = GAME_SPLASH_SCREEN; // The current game state, this is used to determine what the game is doing at any given time static enum HandState hand_state = HAND_DRAW; static enum PlayState play_state = PLAY_PLAYING; static int state = 0; // General state variable, used for switch statements in each game state related function @@ -252,6 +253,7 @@ static const BG_POINT JOKER_DISCARD_TARGET = {240, 30}; #define ITEM_SHOP_Y 71 // TODO: Needs to be a rect? #define MAIN_MENU_BUTTONS 4 +#define MAIN_MENU_IMPLEMENTED_BUTTONS 1 // Remove this once all buttons are implemented //TODO: Properly define and use #define MENU_POP_OUT_ANIM_FRAMES 20 @@ -993,9 +995,10 @@ static void game_round_init() deck_shuffle(); // Shuffle the deck at the start of the round } -void game_main_menu_init() +static void game_main_menu_init() { affine_background_change_background(AFFINE_BG_MAIN_MENU); + change_background(BG_ID_MAIN_MENU); main_menu_ace = card_object_new(card_new(SPADES, ACE)); card_object_set_sprite(main_menu_ace, 0); // Set the sprite for the ace of spades main_menu_ace->sprite_object->sprite->obj->attr0 |= ATTR0_AFF_DBL; // Make the sprite double sized @@ -1033,6 +1036,9 @@ static void init_game_state(enum GameState game_state_to_init) // Switch written out, add init for states as needed switch (game_state_to_init) { + case GAME_SPLASH_SCREEN: + splash_screen_init(); + break; case GAME_MAIN_MENU: game_main_menu_init(); break; @@ -1057,7 +1063,7 @@ static void init_game_state(enum GameState game_state_to_init) } // Game functions -static void game_set_state(enum GameState new_game_state) +void game_set_state(enum GameState new_game_state) { timer = 0; // Reset the timer init_game_state(new_game_state); @@ -1077,7 +1083,7 @@ void jokers_available_to_shop_init() void game_init() { - change_background(BG_ID_MAIN_MENU); + //change_background(BG_ID_MAIN_MENU); jokers_available_to_shop_init(); // Initialize jokers list @@ -2660,7 +2666,6 @@ void game_shop() } } } - if (timer % 20 == 0) { @@ -2895,7 +2900,7 @@ void game_main_menu() } else if (key_hit(KEY_RIGHT)) { - if (selection_x < MAIN_MENU_BUTTONS) + if (selection_x < MAIN_MENU_IMPLEMENTED_BUTTONS) { selection_x++; } @@ -2936,7 +2941,6 @@ static void discarded_jokers_update_loop() joker_object_destroy(&joker_object); } } - } static void held_jokers_update_loop() @@ -3005,6 +3009,9 @@ void game_update() switch (game_state) { + case GAME_SPLASH_SCREEN: + splash_screen_update(timer); + break; case GAME_MAIN_MENU: game_main_menu(); break; diff --git a/source/main.c b/source/main.c index bd95a7c..950a60d 100644 --- a/source/main.c +++ b/source/main.c @@ -18,10 +18,6 @@ #include "soundbank.h" #include "soundbank_bin.h" -#define SPLASH_FPS 60 -#define SPLASH_DURATION_SECONDS 10 -#define SPLASH_DURATION_FRAMES (SPLASH_FPS * SPLASH_DURATION_SECONDS) - void init() { irq_init(NULL); @@ -71,23 +67,6 @@ void init() REG_DISPCNT = DCNT_MODE1 | DCNT_OBJ_1D | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_OBJ | DCNT_WIN0 | DCNT_WIN1; - // Splash screen - tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); - tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); - tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)"); - for (int i = 0; i < SPLASH_DURATION_FRAMES; i++) - { - VBlankIntrWait(); - key_poll(); - if (key_hit(KEY_A | KEY_B | KEY_START | KEY_SELECT)) // Skip intro - { - break; - } - tte_erase_rect_wrapper((Rect){208, 144, 240, 152}); - tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION_FRAMES - i) / SPLASH_FPS); - } - tte_erase_screen(); - // Initialize subsystems mmInitDefault((mm_addr)soundbank_bin, 12); mmStart(MOD_MAIN_THEME, MM_PLAY_LOOP); diff --git a/source/splash_screen.c b/source/splash_screen.c new file mode 100644 index 0000000..dcf2897 --- /dev/null +++ b/source/splash_screen.c @@ -0,0 +1,30 @@ +#include "splash_screen.h" + +#include + +#include "graphic_utils.h" +#include "game.h" + +void splash_screen_init() +{ + tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); + tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'"); + tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)"); +} + +void splash_screen_update(uint timer) +{ + if (timer < SPLASH_DURATION_FRAMES) + { + tte_erase_rect_wrapper((Rect){208, 144, 240, 152}); + tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS); + + if (!key_hit(KEY_ANY)) + { + return; + } + } + + game_set_state(GAME_MAIN_MENU); + tte_erase_screen(); +} \ No newline at end of file From 21d85f49ab2edb39f3115f5772a87e4b4fc3ea0e Mon Sep 17 00:00:00 2001 From: Elliptical <70788102+cellos51@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:14:51 -0400 Subject: [PATCH 13/21] Update source/main.c Co-authored-by: MeirGavish --- source/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 950a60d..9463584 100644 --- a/source/main.c +++ b/source/main.c @@ -40,7 +40,7 @@ void init() // BG1 is the main background layer REG_BG1CNT = BG_PRIO(1) | BG_CBB(MAIN_BG_CBB) | BG_SBB(MAIN_BG_SBB) | BG_8BPP; // BG2 is the affine background layer - REG_BG2CNT = BG_PRIO(2) | BG_CBB(AFFINE_BG_CBB) | BG_SBB(AFFINE_BG_CBB) | BG_8BPP | BG_WRAP; + REG_BG2CNT = BG_PRIO(2) | BG_CBB(AFFINE_BG_CBB) | BG_SBB(AFFINE_BG_SBB) | BG_8BPP | BG_WRAP; int win1_left = 72; int win1_top = 44; From 94821ffa2700ebc70f59d66f6fa9aad6da341e5f Mon Sep 17 00:00:00 2001 From: Elliptical <70788102+cellos51@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:15:07 -0400 Subject: [PATCH 14/21] Update source/game.c Co-authored-by: MeirGavish --- source/game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/game.c b/source/game.c index 6c5ef0c..45e51c3 100644 --- a/source/game.c +++ b/source/game.c @@ -2900,7 +2900,7 @@ void game_main_menu() } else if (key_hit(KEY_RIGHT)) { - if (selection_x < MAIN_MENU_IMPLEMENTED_BUTTONS) + if (selection_x < MAIN_MENU_IMPLEMENTED_BUTTONS - 1) { selection_x++; } From 7b2fc1ac7525adde63b7ea015dd5f0acc351400e Mon Sep 17 00:00:00 2001 From: cellos51 Date: Mon, 25 Aug 2025 16:59:10 -0400 Subject: [PATCH 15/21] Refactor main menu button color definitions for clarity and consistency --- source/game.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/game.c b/source/game.c index 45e51c3..db55498 100644 --- a/source/game.c +++ b/source/game.c @@ -254,6 +254,8 @@ static const BG_POINT JOKER_DISCARD_TARGET = {240, 30}; #define MAIN_MENU_BUTTONS 4 #define MAIN_MENU_IMPLEMENTED_BUTTONS 1 // Remove this once all buttons are implemented +#define MAIN_MENU_PLAY_BUTTON_MAIN_COLOR_PID 5 +#define MAIN_MENU_PLAY_BUTTON_OUTLINE_COLOR_PID 3 //TODO: Properly define and use #define MENU_POP_OUT_ANIM_FRAMES 20 @@ -641,8 +643,7 @@ void change_background(int id) GRIT_CPY(&se_mem[MAIN_BG_SBB], background_main_menu_gfxMap); // Disable the button highlight colors - // Select button PID is 5 and the outline is 3 - memcpy16(&pal_bg_mem[3], &pal_bg_mem[5], 1); + memcpy16(&pal_bg_mem[MAIN_MENU_PLAY_BUTTON_OUTLINE_COLOR_PID], &pal_bg_mem[MAIN_MENU_PLAY_BUTTON_MAIN_COLOR_PID], 1); } else { @@ -2909,7 +2910,7 @@ void game_main_menu() if (selection_x == 0) // Play button { // Select button PID is 5 and the outline is 3 - memset16(&pal_bg_mem[3], CLR_WHITE, 1); + memset16(&pal_bg_mem[MAIN_MENU_PLAY_BUTTON_OUTLINE_COLOR_PID], HIGHLIGHT_COLOR, 1); if (key_hit(KEY_A)) { @@ -2920,7 +2921,7 @@ void game_main_menu() else { // Select button PID is 5 and the outline is 3 - memcpy16(&pal_bg_mem[3], &pal_bg_mem[5], 1); + memcpy16(&pal_bg_mem[MAIN_MENU_PLAY_BUTTON_OUTLINE_COLOR_PID], &pal_bg_mem[MAIN_MENU_PLAY_BUTTON_MAIN_COLOR_PID], 1); } } From b9b87a7b3085525ec86f6047c8630f46dc195687 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Mon, 25 Aug 2025 17:50:16 -0400 Subject: [PATCH 16/21] Refactor countdown timer rectangle usage in splash screen for improved readability --- source/splash_screen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/splash_screen.c b/source/splash_screen.c index dcf2897..0c3c535 100644 --- a/source/splash_screen.c +++ b/source/splash_screen.c @@ -5,6 +5,8 @@ #include "graphic_utils.h" #include "game.h" +static const Rect COUNTDOWN_TIMER_RECT = {208, 144, 240, 152}; + void splash_screen_init() { tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER"); @@ -16,8 +18,8 @@ void splash_screen_update(uint timer) { if (timer < SPLASH_DURATION_FRAMES) { - tte_erase_rect_wrapper((Rect){208, 144, 240, 152}); - tte_printf("#{P:208,144; cx:0xF000}%d", 1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS); + tte_erase_rect_wrapper(COUNTDOWN_TIMER_RECT); + tte_printf("#{P:%d,%d; cx:0xF000}%d", COUNTDOWN_TIMER_RECT.left, COUNTDOWN_TIMER_RECT.top, 1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS); if (!key_hit(KEY_ANY)) { From 8fafcd1cdf513ea7682cc669c69b887564178516 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Mon, 25 Aug 2025 17:52:27 -0400 Subject: [PATCH 17/21] Reduced amount of menu buttons --- graphics/background_main_menu_gfx.png | Bin 8404 -> 8375 bytes source/game.c | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/background_main_menu_gfx.png b/graphics/background_main_menu_gfx.png index 04646505955294281a4ef82b22dccee65604d97f..9ea9aff99d84873fc2245acf1f2ca894c9d22ba0 100644 GIT binary patch delta 8265 zcmZ`;byQSev>qBHq!~iG8{tPcNDE5$44`x)GUP={Iz$FU8WE(Mp^+AmE`gy-Vkqf) z<67^(x8AHff1JD4-TRz<_Sxs#-#4Yyq?GJKzzuo<%JI3<(@Y6s256~7S(M3&e}X_v zH=3$ShOqgA>_C{|X7)hm;RdcIv#^c^^B{*M5zEKE38Vm`uaP-+KCfZOyT+=p4_WMf zgV1+VY94HynBQ+{w0MEZPKqBZz@Chc%|VsytYu7#sr*zCs=-Ns^=?sU8>ukT#nS{3w zT0bf{F(@!NmIw(YzPpPSwyRNZ7nz_`v{jybn9zQ44GtX;Px0iz<;0vmX*7aFP22Xz z^GRiRap0k6V$T@+eZ}d*=H%lx4e7xjsP%+faXjv#Ioh0XidC9pdX_@yej>#JhK2BP7t&| zje(zz&x6KI?7Mqi{>Fxv7BnT40I-0_DUXr86p4kMCBrnkR71^{9SaFSW5&o&zMLB9 zaY|-mSQ(&hPN1bni4n?)nzpbH!`8tL-FzNsgLR_i^70x?xo6>hA{i&1DZH*lGG8k5 zEXZb+)6x{7c}lB<$$6`zcI{j*HnrN_{ah>k#h(~fRr=={#<$Yubi2Z*FNo$#g$gUK zpMIt4Omr;NteL_l$k=g+P!ydo!2*p0>F3pqaBu-hq791L)KfO*$9r_g`j{>&ia4|p z!&$*X68(KFA^POK`23)Z4?-8mYV^-_bK^oFQdmnaN z0G%*{thjmjW<-Vc3zciF59whaaC~7W#X>33|F%0E~9rf2>)N*Rb zNR#v*{YS0KAg1HHv4fOR3(w$IyjvI`5)Ral-1aw6Th1 zp$;ZzK&+|Zh)HF68L9xi9rS>Aq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file changed, 1 deletion(-) diff --git a/source/game.c b/source/game.c index 381a4ab..52765e5 100644 --- a/source/game.c +++ b/source/game.c @@ -1084,7 +1084,6 @@ void jokers_available_to_shop_init() void game_init() { - //change_background(BG_ID_MAIN_MENU); jokers_available_to_shop_init(); // Initialize jokers list From bc3270712608c0f7b2f27978c901c16d5fd5df8c Mon Sep 17 00:00:00 2001 From: cellos51 Date: Thu, 28 Aug 2025 16:09:46 -0400 Subject: [PATCH 19/21] replaced magic numbers for background palette size --- include/graphic_utils.h | 1 + source/game.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/graphic_utils.h b/include/graphic_utils.h index 7fb6607..523f95c 100644 --- a/include/graphic_utils.h +++ b/include/graphic_utils.h @@ -24,6 +24,7 @@ #define AFFINE_BG_SBB 2 #define AFFINE_BG_CBB 2 #define PAL_ROW_LEN 16 +#define PAL_BG_MAX_SIZE (PAL_ROW_LEN * 9) #define NUM_PALETTES 16 #define TTE_BIT_UNPACK_OFFSET 14 diff --git a/source/game.c b/source/game.c index 52765e5..d0c938c 100644 --- a/source/game.c +++ b/source/game.c @@ -445,7 +445,7 @@ void change_background(int id) // Load the tiles and palette // Background - memcpy(pal_bg_mem, background_gfxPal, 64); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden + memcpy16(pal_bg_mem, background_gfxPal, PAL_BG_MAX_SIZE); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles); // Deadass i have no clue how any of these memory things work but I just messed with them until stuff worked GRIT_CPY(&se_mem[MAIN_BG_SBB], background_gfxMap); @@ -507,7 +507,7 @@ void change_background(int id) { toggle_windows(false, true); - memcpy16(pal_bg_mem, background_shop_gfxPal, 64); + memcpy16(pal_bg_mem, background_shop_gfxPal, PAL_BG_MAX_SIZE); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_shop_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_shop_gfxMap); @@ -536,7 +536,7 @@ void change_background(int id) toggle_windows(false, true); - memcpy16(pal_bg_mem, background_blind_select_gfxPal, 64); + memcpy16(pal_bg_mem, background_blind_select_gfxPal, PAL_BG_MAX_SIZE); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_blind_select_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_blind_select_gfxMap); @@ -638,7 +638,7 @@ void change_background(int id) toggle_windows(false, false); tte_erase_screen(); - memcpy16(pal_bg_mem, background_main_menu_gfxPal, PAL_ROW_LEN * 9); + memcpy16(pal_bg_mem, background_main_menu_gfxPal, PAL_BG_MAX_SIZE); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_main_menu_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_main_menu_gfxMap); From 4b7a22bafff6d7718c63e9648ceab880e27cabd5 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Thu, 28 Aug 2025 19:03:48 -0400 Subject: [PATCH 20/21] made all palettes have their length set in grit --- graphics/affine_background_gfx.grit | 2 +- graphics/affine_main_menu_background_gfx.grit | 2 +- graphics/background_blind_select_gfx.grit | 2 +- graphics/background_gfx.grit | 2 +- graphics/background_main_menu_gfx.grit | 2 +- graphics/background_shop_gfx.grit | 2 +- source/game.c | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/graphics/affine_background_gfx.grit b/graphics/affine_background_gfx.grit index 3205289..1bc6094 100644 --- a/graphics/affine_background_gfx.grit +++ b/graphics/affine_background_gfx.grit @@ -1 +1 @@ --gt -gB8 -mLa -mRa \ No newline at end of file +-gt -gB8 -mLa -mRa -pe 16 \ No newline at end of file diff --git a/graphics/affine_main_menu_background_gfx.grit b/graphics/affine_main_menu_background_gfx.grit index 3205289..1bc6094 100644 --- a/graphics/affine_main_menu_background_gfx.grit +++ b/graphics/affine_main_menu_background_gfx.grit @@ -1 +1 @@ --gt -gB8 -mLa -mRa \ No newline at end of file +-gt -gB8 -mLa -mRa -pe 16 \ No newline at end of file diff --git a/graphics/background_blind_select_gfx.grit b/graphics/background_blind_select_gfx.grit index f57bef6..2d86f5c 100644 --- a/graphics/background_blind_select_gfx.grit +++ b/graphics/background_blind_select_gfx.grit @@ -1 +1 @@ --gB8 -mR8 -mLs -mRtf \ No newline at end of file +-gB8 -mR8 -mLs -mRtf -pe 160 \ No newline at end of file diff --git a/graphics/background_gfx.grit b/graphics/background_gfx.grit index f57bef6..2d86f5c 100644 --- a/graphics/background_gfx.grit +++ b/graphics/background_gfx.grit @@ -1 +1 @@ --gB8 -mR8 -mLs -mRtf \ No newline at end of file +-gB8 -mR8 -mLs -mRtf -pe 160 \ No newline at end of file diff --git a/graphics/background_main_menu_gfx.grit b/graphics/background_main_menu_gfx.grit index f57bef6..2d86f5c 100644 --- a/graphics/background_main_menu_gfx.grit +++ b/graphics/background_main_menu_gfx.grit @@ -1 +1 @@ --gB8 -mR8 -mLs -mRtf \ No newline at end of file +-gB8 -mR8 -mLs -mRtf -pe 160 \ No newline at end of file diff --git a/graphics/background_shop_gfx.grit b/graphics/background_shop_gfx.grit index f57bef6..2d86f5c 100644 --- a/graphics/background_shop_gfx.grit +++ b/graphics/background_shop_gfx.grit @@ -1 +1 @@ --gB8 -mR8 -mLs -mRtf \ No newline at end of file +-gB8 -mR8 -mLs -mRtf -pe 160 \ No newline at end of file diff --git a/source/game.c b/source/game.c index d0c938c..62f6bd5 100644 --- a/source/game.c +++ b/source/game.c @@ -445,8 +445,8 @@ void change_background(int id) // Load the tiles and palette // Background - memcpy16(pal_bg_mem, background_gfxPal, PAL_BG_MAX_SIZE); // This '64" isn't a specific number, I'm just using it to prevent the text colors from being overridden - GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles); // Deadass i have no clue how any of these memory things work but I just messed with them until stuff worked + GRIT_CPY(pal_bg_mem, background_gfxPal); + GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_gfxMap); if (current_blind == BIG_BLIND) // Change text and palette depending on blind type @@ -507,7 +507,7 @@ void change_background(int id) { toggle_windows(false, true); - memcpy16(pal_bg_mem, background_shop_gfxPal, PAL_BG_MAX_SIZE); + GRIT_CPY(pal_bg_mem, background_shop_gfxPal); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_shop_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_shop_gfxMap); @@ -536,7 +536,7 @@ void change_background(int id) toggle_windows(false, true); - memcpy16(pal_bg_mem, background_blind_select_gfxPal, PAL_BG_MAX_SIZE); + GRIT_CPY(pal_bg_mem, background_blind_select_gfxPal); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_blind_select_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_blind_select_gfxMap); @@ -548,7 +548,7 @@ void change_background(int id) // Select button PID is 15 and the outline is 18 memcpy16(&pal_bg_mem[18], &pal_bg_mem[15], 1); // Skip button PID is 10 and the outline is 5 - memcpy16(&pal_bg_mem[10 ], &pal_bg_mem[5], 1); + memcpy16(&pal_bg_mem[10], &pal_bg_mem[5], 1); for (int i = 0; i < MAX_BLINDS; i++) { @@ -638,7 +638,7 @@ void change_background(int id) toggle_windows(false, false); tte_erase_screen(); - memcpy16(pal_bg_mem, background_main_menu_gfxPal, PAL_BG_MAX_SIZE); + GRIT_CPY(pal_bg_mem, background_main_menu_gfxPal); GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_main_menu_gfxTiles); GRIT_CPY(&se_mem[MAIN_BG_SBB], background_main_menu_gfxMap); From c41fcd1a2444b1e87dc1d84dbd7927806ed23dfc Mon Sep 17 00:00:00 2001 From: cellos51 Date: Thu, 28 Aug 2025 19:04:51 -0400 Subject: [PATCH 21/21] Remove unused definition for maximum background palette size --- include/graphic_utils.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/graphic_utils.h b/include/graphic_utils.h index 523f95c..7fb6607 100644 --- a/include/graphic_utils.h +++ b/include/graphic_utils.h @@ -24,7 +24,6 @@ #define AFFINE_BG_SBB 2 #define AFFINE_BG_CBB 2 #define PAL_ROW_LEN 16 -#define PAL_BG_MAX_SIZE (PAL_ROW_LEN * 9) #define NUM_PALETTES 16 #define TTE_BIT_UNPACK_OFFSET 14