Update for PR

This commit is contained in:
Rickey Fehr
2025-10-13 23:36:27 -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 BIG_BLIND_TID (BLIND_SPRITE_OFFSET + SMALL_BLIND_TID)
#define BOSS_BLIND_TID (BLIND_SPRITE_OFFSET + BIG_BLIND_TID) #define BOSS_BLIND_TID (BLIND_SPRITE_OFFSET + BIG_BLIND_TID)
#define BLIND_TEXT_COLOR_INDEX 1 enum BlindColorIndex
#define BLIND_SHADOW_COLOR_INDEX 2 {
#define BLIND_HIGHLIGHT_COLOR_INDEX 3 BLIND_TEXT_COLOR_INDEX = 1,
#define BLIND_MAIN_COLOR_INDEX 4 BLIND_SHADOW_COLOR_INDEX = 2,
#define BLIND_BACKGROUND_MAIN_COLOR_INDEX 5 BLIND_HIGHLIGHT_COLOR_INDEX = 3,
#define BLIND_BACKGROUND_SECONDARY_COLOR_INDEX 6 BLIND_MAIN_COLOR_INDEX = 4,
#define BLIND_BACKGROUND_SHADOW_COLOR_INDEX 7 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 enum BlindType
{ {
BLIND_TYPE_SMALL, #define BLIND_INFO(NAME, name, multi) \
BLIND_TYPE_BIG, BLIND_TYPE_##NAME ,
BLIND_TYPE_BOSS, BLIND_INFO_TABLE
BLIND_TYPE_MAX, BLIND_TYPE_MAX,
#undef BLIND_INFO
}; };
enum BlindState enum BlindState
@@ -51,7 +60,7 @@ typedef struct
{ {
enum BlindType type; enum BlindType type;
PaletteInfo pal_info; PaletteInfo pal_info;
FIXED multiplier; FIXED score_req_multipler;
s32 reward; s32 reward;
} Blind; } Blind;
@@ -59,7 +68,7 @@ void blind_init();
int blind_get_requirement(enum BlindType type, int ante); int blind_get_requirement(enum BlindType type, int ante);
int blind_get_reward(enum BlindType type); 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); 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 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 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] = static const Blind blindMap[BLIND_TYPE_MAX] =
{ {
{ #define BLIND_INFO(NAME, name, multi) \
.type = BLIND_TYPE_SMALL, { \
.pal_info = .type = BLIND_TYPE_##NAME , \
{ .pal_info = \
.palette = small_blind_token_palette, { \
.tid = SMALL_BLIND_TID, .palette = name##_blind_token_palette, \
.pb = SMALL_BLIND_PB, .tid = NAME##_BLIND_TID, \
}, .pb = NAME##_BLIND_PB, \
.multiplier = FIX_ONE, }, \
.reward = SMALL_BLIND_REWARD, .score_req_multipler = multi , \
}, .reward = NAME##_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,
}, },
BLIND_INFO_TABLE
#undef BLIND_INFO
}; };
void blind_init() void blind_init()
@@ -59,7 +41,8 @@ void blind_init()
GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles); GRIT_CPY(&tile_mem[4][SMALL_BLIND_TID], blinds_gfxTiles);
for(int i = 0; i < BLIND_TYPE_MAX; i++) 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 pb = blindMap[i].pal_info.pb;
u32 pal_offset = PAL_ROW_LEN * 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 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) int blind_get_reward(enum BlindType type)
@@ -80,7 +63,7 @@ int blind_get_reward(enum BlindType type)
return blindMap[type].reward; 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]; return blindMap[type].pal_info.palette[index];
} }
+15 -9
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 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 // 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_SMALL], 80, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BOSS], 120, default_y); sprite_position(blind_select_tokens[BLIND_TYPE_BIG], 120, default_y);
sprite_position(blind_select_tokens[BLIND_TYPE_BIG], 160, default_y); sprite_position(blind_select_tokens[BLIND_TYPE_BOSS], 160, default_y);
toggle_windows(false, true); toggle_windows(false, true);
@@ -696,15 +696,13 @@ void change_background(int id)
// effect. // effect.
memcpy16(&pal_bg_mem[BLIND_SKIP_BTN_SELECTED_BORDER_PID], &pal_bg_mem[BLIND_SKIP_BTN_PID], 1); 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++) for (int i = 0; i < BLIND_TYPE_MAX; i++)
{ {
if (blinds[i] != BLIND_STATE_CURRENT && if (blinds[i] != BLIND_STATE_CURRENT &&
(i == BLIND_TYPE_SMALL || i == BLIND_TYPE_BIG)) // Make the skip button gray (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() // 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 x_from = 0;
int y_from = 24 + (i * 4); int y_from = 24 + (i * 4);
@@ -719,7 +717,8 @@ void change_background(int id)
} }
} }
if (blinds[i] == BLIND_STATE_CURRENT) // Raise the blind panel up a bit switch(blinds[i]) {
case BLIND_STATE_CURRENT: // Raise the blind panel up a bit
{ {
int x_from = 0; int x_from = 0;
int y_from = 27; int y_from = 27;
@@ -750,8 +749,9 @@ void change_background(int id)
main_bg_se_copy_rect(gap_fill_rect, gap_fill_point); 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 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 (blinds[i] == BLIND_STATE_UPCOMING) // Change the select icon to "NEXT" case BLIND_STATE_UPCOMING: // Change the select icon to "NEXT"
{ {
int x_from = 0; int x_from = 0;
int y_from = 20; int y_from = 20;
@@ -760,8 +760,9 @@ void change_background(int id)
int y_to = 20; 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;
} }
else if (blinds[i] == BLIND_STATE_SKIPPED) // Change the select icon to "SKIP" case BLIND_STATE_SKIPPED: // Change the select icon to "SKIP"
{ {
int x_from = 3; int x_from = 3;
int y_from = 20; int y_from = 20;
@@ -770,8 +771,9 @@ void change_background(int id)
int y_to = 20; 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;
} }
else if (blinds[i] == BLIND_STATE_DEFEATED) // Change the select icon to "DEFEATED" case BLIND_STATE_DEFEATED: // Change the select icon to "DEFEATED"
{ {
int x_from = 6; int x_from = 6;
int y_from = 20; int y_from = 20;
@@ -780,6 +782,10 @@ void change_background(int id)
int y_to = 20; 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;
} }
} }
} }