Update for PR

This commit is contained in:
Rickey Fehr
2025-09-25 20:53:00 -07:00
parent 3c2dd0edba
commit 54d955d1e7
3 changed files with 103 additions and 105 deletions
+21 -12
View File
@@ -14,20 +14,29 @@
#define BIG_BLIND_TID (BLIND_SPRITE_OFFSET + SMALL_BLIND_TID)
#define BOSS_BLIND_TID (BLIND_SPRITE_OFFSET + BIG_BLIND_TID)
#define BLIND_TEXT_COLOR_INDEX 1
#define BLIND_SHADOW_COLOR_INDEX 2
#define BLIND_HIGHLIGHT_COLOR_INDEX 3
#define BLIND_MAIN_COLOR_INDEX 4
#define BLIND_BACKGROUND_MAIN_COLOR_INDEX 5
#define BLIND_BACKGROUND_SECONDARY_COLOR_INDEX 6
#define BLIND_BACKGROUND_SHADOW_COLOR_INDEX 7
enum BlindColorIndex
{
BLIND_TEXT_COLOR_INDEX = 1,
BLIND_SHADOW_COLOR_INDEX = 2,
BLIND_HIGHLIGHT_COLOR_INDEX = 3,
BLIND_MAIN_COLOR_INDEX = 4,
BLIND_BACKGROUND_MAIN_COLOR_INDEX = 5,
BLIND_BACKGROUND_SECONDARY_COLOR_INDEX = 6,
BLIND_BACKGROUND_SHADOW_COLOR_INDEX = 7,
};
#define BLIND_INFO_TABLE \
BLIND_INFO(SMALL, small, FIX_ONE) \
BLIND_INFO(BIG, big, FIX_ONE) \
BLIND_INFO(BOSS, boss, FIX_ONE)
enum BlindType
{
BLIND_TYPE_SMALL,
BLIND_TYPE_BIG,
BLIND_TYPE_BOSS,
#define BLIND_INFO(NAME, name, multi) \
BLIND_TYPE_##NAME ,
BLIND_INFO_TABLE
BLIND_TYPE_MAX,
#undef BLIND_INFO
};
enum BlindState
@@ -51,7 +60,7 @@ typedef struct
{
enum BlindType type;
PaletteInfo pal_info;
FIXED multiplier;
FIXED score_req_multipler;
s32 reward;
} Blind;
@@ -59,7 +68,7 @@ void blind_init();
int blind_get_requirement(enum BlindType type, int ante);
int blind_get_reward(enum BlindType type);
u16 blind_get_color(enum BlindType type, int index);
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index);
Sprite *blind_token_new(enum BlindType type, int x, int y, int sprite_index);
+18 -35
View File
@@ -16,41 +16,23 @@ static const u16 small_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x7FFF, 0x34A
static const u16 big_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x2527, 0x15F5, 0x36FC, 0x1E9C, 0x01B4, 0x0D0A, 0x010E};
static const u16 boss_blind_token_palette[PAL_ROW_LEN] = {0x0000, 0x2CC9, 0x3D0D, 0x5E14, 0x5171, 0x4D0F, 0x2CC8, 0x3089}; // This variable is temporary, each boss blind will have its own unique palette
static const Blind blindMap[BLIND_TYPE_MAX] =
{
{
.type = BLIND_TYPE_SMALL,
.pal_info =
{
.palette = small_blind_token_palette,
.tid = SMALL_BLIND_TID,
.pb = SMALL_BLIND_PB,
},
.multiplier = FIX_ONE,
.reward = SMALL_BLIND_REWARD,
},
{
.type = BLIND_TYPE_BIG,
.pal_info =
{
.palette = big_blind_token_palette,
.tid = BIG_BLIND_TID,
.pb = BIG_BLIND_PB,
},
.multiplier = (FIX_ONE * 3) / 2,
.reward = BIG_BLIND_REWARD,
},
{
.type = BLIND_TYPE_BOSS,
.pal_info =
{
.palette = boss_blind_token_palette,
.tid = BOSS_BLIND_TID,
.pb = BOSS_BLIND_PB,
},
.multiplier = FIX_ONE * 2,
.reward = BOSS_BLIND_REWARD,
#define BLIND_INFO(NAME, name, multi) \
{ \
.type = BLIND_TYPE_##NAME , \
.pal_info = \
{ \
.palette = name##_blind_token_palette, \
.tid = NAME##_BLIND_TID, \
.pb = NAME##_BLIND_PB, \
}, \
.score_req_multipler = multi , \
.reward = NAME##_BLIND_REWARD, \
},
BLIND_INFO_TABLE
#undef BLIND_INFO
};
void blind_init()
@@ -59,7 +41,8 @@ void blind_init()
GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles);
for(int i = 0; i < BLIND_TYPE_MAX; i++)
{const u16* pal = blindMap[i].pal_info.palette;
{
const u16* pal = blindMap[i].pal_info.palette;
u32 pb = blindMap[i].pal_info.pb;
u32 pal_offset = PAL_ROW_LEN * pb;
@@ -72,7 +55,7 @@ int blind_get_requirement(enum BlindType type, int ante)
{
if (ante < 0 || ante > MAX_ANTE) ante = 0; // Ensure ante is within valid range
return fx2int(blindMap[type].multiplier * ante_lut[ante]);
return fx2int(blindMap[type].score_req_multipler * ante_lut[ante]);
}
int blind_get_reward(enum BlindType type)
@@ -80,7 +63,7 @@ int blind_get_reward(enum BlindType type)
return blindMap[type].reward;
}
u16 blind_get_color(enum BlindType type, int index)
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index)
{
return blindMap[type].pal_info.palette[index];
}
+64 -58
View File
@@ -674,8 +674,8 @@ void change_background(int id)
const int default_y = 89 + (TILE_SIZE * 12); // Default y position for the blind select tokens. 12 is the amound of tiles the background is shifted down by
// TODO refactor magic numbers '80/120/160' into a map to loop with
sprite_position(blind_select_tokens[BLIND_TYPE_SMALL], 80, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BOSS], 120, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BIG], 160, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BIG], 120, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BOSS], 160, default_y);
toggle_windows(false, true);
@@ -696,15 +696,13 @@ void change_background(int id)
// effect.
memcpy16(&pal_bg_mem[BLIND_SKIP_BTN_SELECTED_BORDER_PID], &pal_bg_mem[BLIND_SKIP_BTN_PID], 1);
// TODO: This should have it's data mapped with all these x,y constants
// and it should operate in a loop without the if/else blocks on those
// constants associated with each blind type
for (int i = 0; i < BLIND_TYPE_MAX; i++)
{
if (blinds[i] != BLIND_STATE_CURRENT &&
(i == BLIND_TYPE_SMALL || i == BLIND_TYPE_BIG)) // Make the skip button gray
{
// TODO: Switch all the copies here to use main_bg_se_copy_rect()
// Note, this is difficult as the tiles to copy are not aligned.
int x_from = 0;
int y_from = 24 + (i * 4);
@@ -719,67 +717,75 @@ void change_background(int id)
}
}
if (blinds[i] == BLIND_STATE_CURRENT) // Raise the blind panel up a bit
{
int x_from = 0;
int y_from = 27;
Rect blind_rect = SINGLE_BLIND_SELECT_RECT;
// There's no gap between them
blind_rect.left += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
blind_rect.right += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
main_bg_se_copy_rect_1_tile_vert(blind_rect, SE_UP);
int x_to = blind_rect.left;
int y_to = 31;
if (i == BLIND_TYPE_BIG)
switch(blinds[i]) {
case BLIND_STATE_CURRENT: // Raise the blind panel up a bit
{
y_from = 31;
int x_from = 0;
int y_from = 27;
Rect blind_rect = SINGLE_BLIND_SELECT_RECT;
// There's no gap between them
blind_rect.left += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
blind_rect.right += i * rect_width(&SINGLE_BLIND_SELECT_RECT);
main_bg_se_copy_rect_1_tile_vert(blind_rect, SE_UP);
int x_to = blind_rect.left;
int y_to = 31;
if (i == BLIND_TYPE_BIG)
{
y_from = 31;
}
else if (i == BLIND_TYPE_BOSS)
{
x_from = x_to;
y_from = 30;
}
// Copy plain tiles onto the bottom of the raised blind panel to fill the gap created by the raise
Rect gap_fill_rect = {x_from, y_from, x_from + rect_width(&SINGLE_BLIND_SELECT_RECT) - 1, y_from}; // - 1 to stay within rect boundaries
BG_POINT gap_fill_point = {x_to, y_to};
main_bg_se_copy_rect(gap_fill_rect, gap_fill_point);
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - TILE_SIZE); // Move token up by a tile
break;
}
else if (i == BLIND_TYPE_BOSS)
case BLIND_STATE_UPCOMING: // Change the select icon to "NEXT"
{
x_from = x_to;
y_from = 30;
int x_from = 0;
int y_from = 20;
int x_to = 10 + (i * 5);
int y_to = 20;
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
break;
}
case BLIND_STATE_SKIPPED: // Change the select icon to "SKIP"
{
int x_from = 3;
int y_from = 20;
// Copy plain tiles onto the bottom of the raised blind panel to fill the gap created by the raise
Rect gap_fill_rect = {x_from, y_from, x_from + rect_width(&SINGLE_BLIND_SELECT_RECT) - 1, y_from}; // - 1 to stay within rect boundaries
BG_POINT gap_fill_point = {x_to, y_to};
main_bg_se_copy_rect(gap_fill_rect, gap_fill_point);
int x_to = 10 + (i * 5);
int y_to = 20;
sprite_position(blind_select_tokens[i], blind_select_tokens[i]->pos.x, blind_select_tokens[i]->pos.y - TILE_SIZE); // Move token up by a tile
}
else if (blinds[i] == BLIND_STATE_UPCOMING) // Change the select icon to "NEXT"
{
int x_from = 0;
int y_from = 20;
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
break;
}
case BLIND_STATE_DEFEATED: // Change the select icon to "DEFEATED"
{
int x_from = 6;
int y_from = 20;
int x_to = 10 + (i * 5);
int y_to = 20;
int x_to = 10 + (i * 5);
int y_to = 20;
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
}
else if (blinds[i] == BLIND_STATE_SKIPPED) // Change the select icon to "SKIP"
{
int x_from = 3;
int y_from = 20;
int x_to = 10 + (i * 5);
int y_to = 20;
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
}
else if (blinds[i] == BLIND_STATE_DEFEATED) // Change the select icon to "DEFEATED"
{
int x_from = 6;
int y_from = 20;
int x_to = 10 + (i * 5);
int y_to = 20;
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
memcpy16(&se_mem[MAIN_BG_SBB][x_to + 32 * y_to], &se_mem[MAIN_BG_SBB][x_from + 32 * y_from], 3);
break;
}
default:
break;
}
}
}