Changed the way the selecting/played background works and added logic for changing the background depending on blind type

This commit is contained in:
cellos51
2025-07-12 23:39:13 -04:00
parent 191c1a7264
commit 847f602c9e
6 changed files with 64 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1 +0,0 @@
-g! -gB8 -m -mR8 -mLs -mRtf -p!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -22,6 +22,11 @@ static const int ante_lut[MAX_ANTE + 1] = {100, 300, 800, 2000, 5000, 11000, 200
#define BIG_BLIND_TID (SMALL_BLIND_TID + 16)
#define BOSS_BLIND_TID (BIG_BLIND_TID + 16)
#define BLIND_TEXT_COLOR_INDEX 1
#define BLIND_SHADOW_COLOR_INDEX 2
#define BLIND_HIGHLIGHT_COLOR_INDEX 3
#define BLIND_MAIN_COLOR_INDEX 4
enum BlindState
{
BLIND_CURRENT,
@@ -34,6 +39,7 @@ void blinds_init();
int blind_get_requirement(int type, int ante);
int blind_get_reward(int type);
u16 blind_get_color(int type, int index);
Sprite *blind_token_new(int type, int x, int y, int sprite_index);

View File

@@ -4,6 +4,10 @@
#include "blinds_gfx.h"
static const u16 small_blind_token_palette[5] = {0x0000, 0x7FFF, 0x34A1, 0x5DCB, 0x5104};
static const u16 big_blind_token_palette[5] = {0x0000, 0x2527, 0x15F5, 0x36FC, 0x1E9C};
static const u16 boss_blind_token_palette[5] = {0x0000, 0x2CC9, 0x3D0D, 0x5E14, 0x5171}; // This variable is temporary, each boss blind will have its own unique palette
void blinds_init()
{
// Blind graphics (fighting grit every step of the way as usual)
@@ -11,15 +15,12 @@ void blinds_init()
// Palettes for the blinds (Transparency, Text Color, Shadow, Highlight, Main Color) Use this: http://www.budmelvin.com/dev/15bitconverter.html
// Small Blind
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);
}
@@ -58,6 +59,21 @@ int blind_get_reward(int type)
}
}
u16 blind_get_color(int type, int index)
{
switch (type)
{
case SMALL_BLIND:
return small_blind_token_palette[index];
case BIG_BLIND:
return big_blind_token_palette[index];
case BOSS_BLIND:
return boss_blind_token_palette[index];
default:
return 0; // Invalid type
}
}
Sprite *blind_token_new(int type, int x, int y, int sprite_index)
{
Sprite *sprite = NULL;

View File

@@ -12,7 +12,6 @@
#include "graphic_utils.h"
#include "background_gfx.h"
#include "background_play_gfx.h"
#include "background_round_end_gfx.h"
#include "background_shop_gfx.h"
#include "background_blind_select_gfx.h"
@@ -370,13 +369,47 @@ void change_background(int id)
GRIT_CPY(&se_mem[MAIN_BG_SBB], background_gfxMap);
tte_erase_rect_wrapper(HAND_SIZE_RECT_PLAYING);
for (int y = 0; y < 6; y++) // Copies the blind panel from the bottom of the screen to the top. This code is identical to the one used in game_shop()
{
int y_from = 20 + y;
int y_to = 0 + y;
memcpy16(&se_mem[MAIN_BG_SBB][32 * y_to], &se_mem[MAIN_BG_SBB][32 * y_from], 9);
}
if (current_blind == BIG_BLIND) // Change text and palette depending on blind type
{
int y_from = 26;
int y_to = 1;
memcpy16(&se_mem[MAIN_BG_SBB][32 * y_to], &se_mem[MAIN_BG_SBB][32 * y_from], 9);
}
else if (current_blind == BOSS_BLIND)
{
}
// This would change the palette of the background to match the blind, but the backgroun doesn't use the blind token's exact colors so a different approach is required
// memset16(&pal_bg_mem[17], blind_get_color(current_blind, BLIND_HIGHLIGHT_COLOR_INDEX), 1);
// memset16(&pal_bg_mem[5], blind_get_color(current_blind, BLIND_MAIN_COLOR_INDEX), 1);
// memset16(&pal_bg_mem[13], blind_get_color(current_blind, BLIND_SHADOW_COLOR_INDEX), 1);
}
else if (id == BG_ID_CARD_PLAYING)
{
REG_DISPCNT |= DCNT_WIN0;
memcpy(pal_bg_mem, background_gfxPal, 64);
GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles);
memcpy(&se_mem[MAIN_BG_SBB], background_play_gfxMap, background_play_gfxMapLen);
// REG_DISPCNT |= DCNT_WIN0;
// memcpy(pal_bg_mem, background_gfxPal, 64);
// GRIT_CPY(&tile8_mem[MAIN_BG_CBB], background_gfxTiles);
// GRIT_CPY(&se_mem[MAIN_BG_SBB], background_gfxMap);
if (background != BG_ID_CARD_SELECTING)
{
change_background(BG_ID_CARD_SELECTING);
background = BG_ID_CARD_PLAYING;
}
for (int i = 0; i <= 2; i++)
{
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_DOWN);
}
tte_erase_rect_wrapper(HAND_SIZE_RECT_SELECT);
}