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
+25
View File
@@ -0,0 +1,25 @@
// clang-format off
#ifndef BLIND_GFX_H
#define BLIND_GFX_H
#include "blind_gfx0.h"
#include "blind_gfx1.h"
#include "blind_gfx2.h"
#include "blind_gfx3.h"
#include "blind_gfx4.h"
#include "blind_gfx5.h"
#include "blind_gfx6.h"
#include "blind_gfx7.h"
#include "blind_gfx8.h"
#include "blind_gfx9.h"
#include "blind_gfx10.h"
#include "blind_gfx11.h"
#include "blind_gfx12.h"
#include "blind_gfx13.h"
#include "blind_gfx14.h"
#include "blind_gfx15.h"
#include "blind_gfx16.h"
#include "blind_gfx17.h"
#endif
// clang-format on
+18
View File
@@ -0,0 +1,18 @@
DEF_BLIND_GFX(0)
DEF_BLIND_GFX(1)
DEF_BLIND_GFX(2)
DEF_BLIND_GFX(3)
DEF_BLIND_GFX(4)
DEF_BLIND_GFX(5)
DEF_BLIND_GFX(6)
DEF_BLIND_GFX(7)
DEF_BLIND_GFX(8)
DEF_BLIND_GFX(9)
DEF_BLIND_GFX(10)
DEF_BLIND_GFX(11)
DEF_BLIND_GFX(12)
DEF_BLIND_GFX(13)
DEF_BLIND_GFX(14)
DEF_BLIND_GFX(15)
DEF_BLIND_GFX(16)
DEF_BLIND_GFX(17)
+5 -6
View File
@@ -14,17 +14,16 @@
#define MAX_DEFINABLE_JOKERS 150
#define JOKER_SPRITE_OFFSET 16 // Offset for the joker sprites
#define JOKER_STARTING_LAYER 26
// Tile ID for the starting index in the tile memory
#define JOKER_TID (MAX_HAND_SIZE + MAX_SELECTION_SIZE) * JOKER_SPRITE_OFFSET
#define JOKER_SPRITE_OFFSET 16 // Offset for the joker sprites
#define JOKER_BASE_PB 4 // The starting palette index for the jokers
#define JOKER_LAST_PB (NUM_PALETTES - 1)
#define JOKER_TID (JOKER_STARTING_LAYER * JOKER_SPRITE_OFFSET)
#define JOKER_BASE_PB 3 // The starting palette index for the jokers
#define JOKER_LAST_PB (NUM_PALETTES - 1)
// Currently allocating the rest of the palettes for the jokers.
// This number needs to be decreased once we need to allocated palettes for other sprites
// such as planet cards etc.
#define JOKER_STARTING_LAYER 27
#define BASE_EDITION 0
#define FOIL_EDITION 1
#define HOLO_EDITION 2