Implement boss blind graphics (#352)

* Created sprite bank for all blinds

* progress city, it's a beatiful city that progress city!

* Sprite appears in blind selection screen

* Added all blind colors

* fix magic numbers + disable boss reroll

* Fix boss blind token not moving after a reroll

* fix always rolling the Needle due to choosing too early for the rng seed to be set

* No need for affine sprite for blind tokens, regular is enough

* address Copilot's review 1/2

* address Copilot's review 2/2

* correct Blind Tokens/Types

* Index palette colors into the files instead of code

* Fix blind sprites (flip bug not solved)

* Fix magic number, tile index and Mark colors

* load boss blind palette only when changing spritesheet

* Adressing clang format and ease of modification of the blinds' list

* Removed some magic numbers


---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
Geralt
2026-04-16 11:52:39 +03:00
committed by GitHub
co-authored by MathisMartin31
parent a31eccba20
commit db27962623
49 changed files with 483 additions and 184 deletions
+70 -33
View File
@@ -1,45 +1,86 @@
#ifndef BLIND_H
#define BLIND_H
#include "game.h"
#include "sprite.h"
// The GBA's max uint value is around 4 billion, so we're going to not add endless mode for
// simplicity's sake
#define MAX_ANTE 8
#define SMALL_BLIND_PB 1
#define BIG_BLIND_PB 2
#define BOSS_BLIND_PB 3
#define NORMAL_BLIND_PB 1
#define BOSS_BLIND_PB 2
#define BLIND_BASE_LAYER (MAX_HAND_SIZE + MAX_SELECTION_SIZE)
#define PLAYING_BLIND_TOKEN_LAYER 0
#define ROUND_END_BLIND_TOKEN_LAYER 1
#define SMALL_BLIND_TOKEN_LAYER 2
#define BIG_BLIND_TOKEN_LAYER 3
#define BOSS_BLIND_TOKEN_LAYER 4
#define BLIND_SPRITE_OFFSET 16
#define BLIND_SPRITE_COPY_SIZE BLIND_SPRITE_OFFSET * 8 // 8 ints per tile
#define SMALL_BLIND_TID 960
#define BIG_BLIND_TID (BLIND_SPRITE_OFFSET + SMALL_BLIND_TID)
#define BOSS_BLIND_TID (BLIND_SPRITE_OFFSET + BIG_BLIND_TID)
#define BLIND_SPRITE_COPY_SIZE (BLIND_SPRITE_OFFSET * TILE_SIZE)
#define BLIND_TOKENS_PER_SPRITESHEET 2
#define BLIND_TOKEN_PALETTE_SIZE 8
// Order of the Blind sprites' colors as encoded in the files' palettes with Aseprite
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,
BLIND_SHADOW_COLOR_INDEX,
BLIND_HIGHLIGHT_COLOR_INDEX,
BLIND_MAIN_COLOR_INDEX,
BLIND_BACKGROUND_MAIN_COLOR_INDEX,
BLIND_BACKGROUND_SECONDARY_COLOR_INDEX,
BLIND_BACKGROUND_SHADOW_COLOR_INDEX,
};
#define BLIND_TYPE_INFO_TABLE \
BLIND_INFO(SMALL, small, FIX_ONE, 3) \
BLIND_INFO(BIG, big, (FIX_ONE * 3) / 2, 4) \
BLIND_INFO(BOSS, boss, FIX_ONE * 2, 5)
// clang-format off
enum BlindType
{
#define BLIND_INFO(NAME, name, multi, reward) \
BLIND_TYPE_##NAME,
BLIND_TYPE_INFO_TABLE
#undef BLIND_INFO
BLIND_TYPE_MAX,
// Normal Blinds
BLIND_TYPE_SMALL,
BLIND_TYPE_BIG,
// Boss Blinds
BLIND_TYPE_BOSS,
BLIND_TYPE_HOOK = BLIND_TYPE_BOSS,
BLIND_TYPE_OX,
BLIND_TYPE_HOUSE,
BLIND_TYPE_WALL,
BLIND_TYPE_WHEEL,
BLIND_TYPE_ARM,
BLIND_TYPE_CLUB,
BLIND_TYPE_FISH,
BLIND_TYPE_PSYCHIC,
BLIND_TYPE_GOAD,
BLIND_TYPE_WATER,
BLIND_TYPE_WINDOW,
BLIND_TYPE_MANACLE,
BLIND_TYPE_EYE,
BLIND_TYPE_MOUTH,
BLIND_TYPE_PLANT,
BLIND_TYPE_SERPENT,
BLIND_TYPE_PILLAR,
BLIND_TYPE_NEEDLE,
BLIND_TYPE_HEAD,
BLIND_TYPE_TOOTH,
BLIND_TYPE_FLINT,
BLIND_TYPE_MARK,
// Showdown Blinds
BLIND_TYPE_SHOWDOWN,
BLIND_TYPE_ACORN = BLIND_TYPE_SHOWDOWN,
BLIND_TYPE_LEAF,
BLIND_TYPE_VESSEL,
BLIND_TYPE_HEART,
BLIND_TYPE_BELL,
// End of Blinds' list
BLIND_TYPE_MAX
};
// clang-format on
@@ -52,19 +93,9 @@ enum BlindState
BLIND_STATE_MAX,
};
// TODO: Move this to a common interface for other palettes
typedef struct
{
const unsigned int* tiles;
const u16* palette;
u32 tid;
u32 pb;
} BlindGfxInfo;
typedef struct
{
enum BlindType type;
BlindGfxInfo gfx_info;
FIXED score_req_multipler;
s32 reward;
} Blind;
@@ -77,6 +108,12 @@ u32 blind_get_requirement(enum BlindType type, int ante);
int blind_get_reward(enum BlindType type);
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index);
void init_unbeaten_blinds_list(bool showdown);
enum BlindType roll_blind_type(bool showdown);
void set_blind_beaten(enum BlindType type);
void apply_blind_colors(enum BlindType type);
void apply_blind_tiles(enum BlindType type, int layer);
Sprite* blind_token_new(enum BlindType type, int x, int y, int sprite_index);
#endif // BLIND_H