[Feature] Implement Joker descriptions in the Shop when holding B (#530)

* WIP

* WIP

* WIP

* WIP

* Tags are bugged but it's looking good

* Centering is bugged, almost there

* WIP

* Fixed centeriiiing, yaaaay

* good progress

* add proper '\n' support

* WIP descriptions

* All descriptions are there ^^

* missing 9-patch for pretty display

* WIP

* fix rebase issues

* Fix minor Run Setup screen issues

* Almost done, only one fix to go

* Aaaalmooost doooneeeee

* make desc frame size adaptative

* add rarity color and text

* final cleanup

* clang format

* clang format

* clang format

* clang format

* clang format

* Fix Joker update loop index

* Fix const and Bull description

* Fix unwanted button SFX

* fix tte colors

* Add misprint description

* Fix justified line length computation

* Add safeguards to tag parsing loop

* clang format

* Fix Ante bugged display at boss blind end

* Tweak suit colors

* Final fixes

* Simplified the way we print descriptions

* simplify further

* get rid of weird macro

* Fix Onwed joker price when holding A after showing its description

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
Geralt
2026-06-09 03:16:37 +02:00
committed by GitHub
parent 917354f057
commit e26558e1a5
23 changed files with 1295 additions and 135 deletions
+27 -1
View File
@@ -3,12 +3,15 @@
#include "card.h"
#include "game_variables.h"
#include "graphic_utils.h"
#include "joker_gfx.h"
#include "pool.h"
#include "random.h"
#include "soundbank.h"
#include "util.h"
// Tiles and palettes
#include "card_rarity_pal_gfx.h"
#include "joker_gfx.h"
#include <maxmod.h>
#include <stdlib.h>
#include <string.h>
@@ -88,6 +91,11 @@ static int spritesheet_idx_to_starting_joker_id[] = {
0, 18, 20, 22, 27, 32, 36, 40, 42, 44,
45, 46, 47, 48, 49, 50, 51, 52
};
// Lookup table of Joker Rarity strings. Used to display at the bottom of the description screen.
static const char* joker_rarity_strings_lut[MAX_RARITIES] = {
"Common", "Uncommon", "Rare", "Legendary"
};
// clang-format on
static int s_get_num_spritesheets(void);
@@ -152,6 +160,24 @@ u32 joker_get_score_effect(
return jinfo->joker_effect_func(joker, scored_card, joker_event, joker_effect);
}
const char* joker_get_rarity_string(u8 rarity)
{
if (rarity >= MAX_RARITIES)
return NULL;
return joker_rarity_strings_lut[rarity];
}
u16 joker_get_rarity_color(u8 rarity, bool main_color)
{
if (rarity >= MAX_RARITIES)
return 0x0;
// +1 to account for the transparency
// odd indices are the main colors, even ones are the shadows
return card_rarity_pal_gfxPal[1 + 2 * rarity + (main_color ? 0 : 1)];
}
int joker_get_sell_value(const Joker* joker)
{
if (joker == NULL)