Merge branch 'main' into pr-fix
This commit is contained in:
+15
-2
@@ -851,8 +851,21 @@ void card_draw()
|
||||
|
||||
void hand_set_focus(int index)
|
||||
{
|
||||
if (index < 0 || index > hand_top || hand_state != HAND_SELECT) return;
|
||||
selection_x = index;
|
||||
if (hand_state != HAND_SELECT) return;
|
||||
|
||||
// Wrap around to the other side of the hand when going out of bounds on either side
|
||||
if (index < 0)
|
||||
{
|
||||
selection_x = hand_top;
|
||||
}
|
||||
else if (index > hand_top)
|
||||
{
|
||||
selection_x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_x = index;
|
||||
}
|
||||
|
||||
play_sfx(SFX_CARD_FOCUS, MM_BASE_PITCH_RATE + rand() % 512);
|
||||
}
|
||||
|
||||
+12
-37
@@ -14,8 +14,18 @@
|
||||
#define JOKER_SCORE_TEXT_Y 48
|
||||
#define NUM_JOKERS_PER_SPRITESHEET 2
|
||||
|
||||
const unsigned int **joker_gfxTiles;
|
||||
const unsigned short **joker_gfxPal;
|
||||
static const unsigned int *joker_gfxTiles[] =
|
||||
{
|
||||
#define DEF_JOKER_GFX(idx) joker_gfx##idx##Tiles,
|
||||
#include "../include/def_joker_gfx_table.h"
|
||||
#undef DEF_JOKER_GFX
|
||||
};
|
||||
static const unsigned short *joker_gfxPal[] =
|
||||
{
|
||||
#define DEF_JOKER_GFX(idx) joker_gfx##idx##Pal,
|
||||
#include "../include/def_joker_gfx_table.h"
|
||||
#undef DEF_JOKER_GFX
|
||||
};
|
||||
|
||||
const static u8 edition_price_lut[MAX_EDITIONS] =
|
||||
{
|
||||
@@ -113,42 +123,7 @@ void joker_init()
|
||||
{
|
||||
// This should init once only so no need to free
|
||||
int num_spritesheets = get_num_spritesheets();
|
||||
joker_gfxTiles = (const unsigned int**)malloc((sizeof(unsigned int*) * num_spritesheets));
|
||||
joker_gfxPal = (const unsigned short**)malloc((sizeof(unsigned int*) * num_spritesheets));
|
||||
joker_spritesheet_pb_map = (int*)malloc(sizeof(int) * num_spritesheets);
|
||||
|
||||
// TODO: Automate this with the preprocessor somehow?
|
||||
joker_gfxTiles[0] = joker_gfx0Tiles;
|
||||
joker_gfxTiles[1] = joker_gfx1Tiles;
|
||||
joker_gfxTiles[2] = joker_gfx2Tiles;
|
||||
joker_gfxTiles[3] = joker_gfx3Tiles;
|
||||
joker_gfxTiles[4] = joker_gfx4Tiles;
|
||||
joker_gfxTiles[5] = joker_gfx5Tiles;
|
||||
joker_gfxTiles[6] = joker_gfx6Tiles;
|
||||
joker_gfxTiles[7] = joker_gfx7Tiles;
|
||||
joker_gfxTiles[8] = joker_gfx8Tiles;
|
||||
joker_gfxTiles[9] = joker_gfx9Tiles;
|
||||
joker_gfxTiles[10] = joker_gfx10Tiles;
|
||||
joker_gfxTiles[11] = joker_gfx11Tiles;
|
||||
joker_gfxTiles[12] = joker_gfx12Tiles;
|
||||
joker_gfxTiles[13] = joker_gfx13Tiles;
|
||||
joker_gfxTiles[14] = joker_gfx14Tiles;
|
||||
|
||||
joker_gfxPal[0] = joker_gfx0Pal;
|
||||
joker_gfxPal[1] = joker_gfx1Pal;
|
||||
joker_gfxPal[2] = joker_gfx2Pal;
|
||||
joker_gfxPal[3] = joker_gfx3Pal;
|
||||
joker_gfxPal[4] = joker_gfx4Pal;
|
||||
joker_gfxPal[5] = joker_gfx5Pal;
|
||||
joker_gfxPal[6] = joker_gfx6Pal;
|
||||
joker_gfxPal[7] = joker_gfx7Pal;
|
||||
joker_gfxPal[8] = joker_gfx8Pal;
|
||||
joker_gfxPal[9] = joker_gfx9Pal;
|
||||
joker_gfxPal[10] = joker_gfx10Pal;
|
||||
joker_gfxPal[11] = joker_gfx11Pal;
|
||||
joker_gfxPal[12] = joker_gfx12Pal;
|
||||
joker_gfxPal[13] = joker_gfx13Pal;
|
||||
joker_gfxPal[14] = joker_gfx14Pal;
|
||||
|
||||
for (int i = 0; i < num_spritesheets; i++)
|
||||
{
|
||||
|
||||
+126
-6
@@ -304,9 +304,6 @@ static JokerEffect blue_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
// Using __attribute__((unused)) for jokers with no sprites yet to avoid warning
|
||||
// Remove the attribute once they have sprites
|
||||
__attribute__((unused))
|
||||
static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card)
|
||||
{
|
||||
JokerEffect effect = {0};
|
||||
@@ -331,7 +328,6 @@ static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card)
|
||||
return effect;
|
||||
}
|
||||
|
||||
__attribute__((unused))
|
||||
static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
@@ -397,7 +393,6 @@ static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
__attribute__((unused))
|
||||
static JokerEffect abstract_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
@@ -410,7 +405,6 @@ static JokerEffect abstract_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
__attribute__((unused))
|
||||
static JokerEffect bull_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
@@ -480,6 +474,108 @@ static JokerEffect blueprint_joker_effect(Joker *joker, Card *scored_card) {
|
||||
// JOKER_BLUEPRINT_ID (joker.h) will need to be updated
|
||||
if (curr_joker_object->joke == joker)
|
||||
trigger_next_joker = true;
|
||||
static JokerEffect the_duo_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
// This is really inefficient but the only way at the moment to check for whole-hand conditions
|
||||
u8 suits[NUM_SUITS];
|
||||
u8 ranks[NUM_RANKS];
|
||||
get_played_distribution(ranks, suits);
|
||||
|
||||
if (hand_contains_n_of_a_kind(ranks) >= 2)
|
||||
effect.xmult = 2;
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_trio_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
// This is really inefficient but the only way at the moment to check for whole-hand conditions
|
||||
u8 suits[NUM_SUITS];
|
||||
u8 ranks[NUM_RANKS];
|
||||
get_played_distribution(ranks, suits);
|
||||
|
||||
if (hand_contains_n_of_a_kind(ranks) >= 3)
|
||||
effect.xmult = 3;
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_family_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
// This is really inefficient but the only way at the moment to check for whole-hand conditions
|
||||
u8 suits[NUM_SUITS];
|
||||
u8 ranks[NUM_RANKS];
|
||||
get_played_distribution(ranks, suits);
|
||||
|
||||
if (hand_contains_n_of_a_kind(ranks) >= 4)
|
||||
effect.xmult = 4;
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_order_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
u8 suits[NUM_SUITS];
|
||||
u8 ranks[NUM_RANKS];
|
||||
get_played_distribution(ranks, suits);
|
||||
|
||||
if (hand_contains_straight(ranks))
|
||||
effect.xmult = 3;
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_tribe_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
u8 suits[NUM_SUITS];
|
||||
u8 ranks[NUM_RANKS];
|
||||
get_played_distribution(ranks, suits);
|
||||
|
||||
if (hand_contains_flush(suits))
|
||||
effect.xmult = 2;
|
||||
return effect;
|
||||
}
|
||||
|
||||
// Using __attribute__((unused)) for jokers with no sprites yet to avoid warning
|
||||
// Remove the attribute once they have sprites
|
||||
// graphics available from @MathisMartin31
|
||||
__attribute__((unused))
|
||||
static JokerEffect bootstraps_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
effect.mult = (get_money() / 5) * 2;
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
// no graphics available but ready to be used if wanted when graphics available
|
||||
__attribute__((unused))
|
||||
static JokerEffect shoot_the_moon_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
return effect; // if card != null, we are not at the end-phase of scoring yet
|
||||
|
||||
CardObject** hand = get_hand_array();
|
||||
int hand_size = hand_get_size();
|
||||
for (int i = 0; i < hand_size; i++ )
|
||||
{
|
||||
if (hand[i]->card->rank == QUEEN)
|
||||
{
|
||||
effect.mult += 13;
|
||||
}
|
||||
}
|
||||
|
||||
return effect;
|
||||
@@ -500,11 +596,24 @@ static JokerEffect brainstorm_joker_effect(Joker *joker, Card *scored_card) {
|
||||
joker->processed = true;
|
||||
effect = joker_get_score_effect(first_joker->joker, scored_card);
|
||||
joker->processed = false;
|
||||
// no graphics available but ready to be used if wanted when graphics available
|
||||
__attribute__((unused))
|
||||
static JokerEffect triboulet_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN:
|
||||
effect.xmult = 2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
/* The index of a joker in the registry matches its ID.
|
||||
* The joker sprites are matched by ID so the position in the registry
|
||||
* determines the joker's sprite.
|
||||
@@ -546,6 +655,15 @@ const JokerInfo joker_registry[] = {
|
||||
// Business card should be paired with Shortcut for palette optimization when it's added
|
||||
{ COMMON_JOKER, 4, scary_face_joker_effect }, // 28
|
||||
{ COMMON_JOKER, 4, smiley_face_joker_effect }, // 29
|
||||
{ COMMON_JOKER, 5, raised_fist_joker_effect }, // 30
|
||||
{ COMMON_JOKER, 6, reserved_parking_joker_effect }, // 31
|
||||
{ COMMON_JOKER, 4, abstract_joker_effect }, // 32
|
||||
{ UNCOMMON_JOKER, 6, bull_joker_effect}, // 33
|
||||
{ RARE_JOKER, 8, the_duo_joker_effect}, // 34
|
||||
{ RARE_JOKER, 8, the_trio_joker_effect}, // 35
|
||||
{ RARE_JOKER, 8, the_family_joker_effect}, // 36
|
||||
{ RARE_JOKER, 8, the_order_joker_effect}, // 37
|
||||
{ RARE_JOKER, 8, the_tribe_joker_effect}, // 38
|
||||
|
||||
// The following jokers don't have sprites yet,
|
||||
// uncomment them when their sprites are added.
|
||||
@@ -558,6 +676,8 @@ const JokerInfo joker_registry[] = {
|
||||
|
||||
{ RARE_JOKER, 10, blueprint_joker_effect },
|
||||
{ RARE_JOKER, 10, brainstorm_joker_effect },
|
||||
{ UNCOMMON_JOKER, 7, bootstraps_joker_effect},
|
||||
{ COMMON_JOKER, 5, shoot_the_moon_joker_effect},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ void sprite_init()
|
||||
|
||||
void sprite_draw()
|
||||
{
|
||||
obj_copy(obj_mem, obj_buffer, MAX_SPRITES);
|
||||
obj_aff_copy(obj_aff_mem, obj_aff_buffer, MAX_AFFINES);
|
||||
oam_copy(oam_mem, obj_buffer, MAX_SPRITES);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef GIT_HASH
|
||||
#define GIT_HASH "undef"
|
||||
#endif
|
||||
|
||||
#ifndef GIT_DIRTY
|
||||
#define GIT_DIRTY "-dirty"
|
||||
#endif
|
||||
|
||||
__attribute__((section(".version"), used))
|
||||
const char balatro_version[] = "GBALATRO_VERSION:" GIT_HASH GIT_DIRTY;
|
||||
Reference in New Issue
Block a user