From dcaf025e63d00c349a07f8df84629360d4077097 Mon Sep 17 00:00:00 2001 From: theturtlemafia Date: Sat, 2 Aug 2025 00:27:35 -0400 Subject: [PATCH 1/7] allows multiple joker-effect popup texts --- source/joker.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/source/joker.c b/source/joker.c index c302faf..8dc6573 100644 --- a/source/joker.c +++ b/source/joker.c @@ -235,33 +235,44 @@ bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips *money += joker_effect.money; // TODO: Retrigger - tte_set_pos(fx2int(joker_object->sprite_object->x) + 8, JOKER_SCORE_TEXT_Y); // Offset of 16 pixels to center the text on the card - - char score_buffer[12]; - + int cursorPosX = fx2int(joker_object->sprite_object->x) + 8; // Offset of 16 pixels to center the text on the card if (joker_effect.chips > 0) { + char score_buffer[12]; + tte_set_pos(cursorPosX, JOKER_SCORE_TEXT_Y); tte_set_special(0xD000); // Blue snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.chips); + tte_write(score_buffer); + cursorPosX += 30; } - else if (joker_effect.mult > 0) + if (joker_effect.mult > 0) { + char score_buffer[12]; + tte_set_pos(cursorPosX, JOKER_SCORE_TEXT_Y); tte_set_special(0xE000); // Red snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.mult); + tte_write(score_buffer); + cursorPosX += 30; } - else if (joker_effect.xmult > 0) + if (joker_effect.xmult > 0) { + char score_buffer[12]; + tte_set_pos(cursorPosX, JOKER_SCORE_TEXT_Y); tte_set_special(0xE000); // Red snprintf(score_buffer, sizeof(score_buffer), "X%d", joker_effect.xmult); + tte_write(score_buffer); + cursorPosX += 30; } - else if (joker_effect.money > 0) + if (joker_effect.money > 0) { + char score_buffer[12]; + tte_set_pos(cursorPosX, JOKER_SCORE_TEXT_Y); tte_set_special(0xC000); // Yellow snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.money); + tte_write(score_buffer); + cursorPosX += 30; } - tte_write(score_buffer); - joker_object->joker->processed = true; // Mark the joker as processed joker_object_shake(joker_object, SFX_CARD_SELECT); // TODO: Add a sound effect for scoring the joker From ee0591562f6a73e717d6c4473a04c2369b8d54a0 Mon Sep 17 00:00:00 2001 From: theturtlemafia Date: Sat, 2 Aug 2025 01:14:41 -0400 Subject: [PATCH 2/7] add blue joker --- include/game.h | 2 ++ source/game.c | 4 ++++ source/joker_effects.c | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/include/game.h b/include/game.h index 02c3b01..b0ae27a 100644 --- a/include/game.h +++ b/include/game.h @@ -82,6 +82,8 @@ int get_played_top(void); JokerObject** get_jokers(void); int get_jokers_top(void); +int get_deck_top(void); + int get_num_discards_remaining(void); #endif // GAME_H \ No newline at end of file diff --git a/source/game.c b/source/game.c index 5e4ffe1..c69ce9c 100644 --- a/source/game.c +++ b/source/game.c @@ -264,6 +264,10 @@ int get_jokers_top(void) { return jokers_top; } +int get_deck_top(void) { + return deck_top; +} + int get_num_discards_remaining(void) { return discards; } diff --git a/source/joker_effects.c b/source/joker_effects.c index 7a2eaf3..d070bd7 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -287,6 +287,15 @@ static JokerEffect blackboard_joker_effect(Joker *joker, Card *scored_card) { return effect; } +static JokerEffect blue_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.chips = (get_deck_top() + 1) * 2; + + return effect; +} + const JokerInfo joker_registry[] = { { COMMON_JOKER, 2, default_joker_effect }, // DEFAULT_JOKER_ID = 0 { COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1 @@ -311,6 +320,7 @@ const JokerInfo joker_registry[] = { { COMMON_JOKER, 5, banner_joker_effect }, { COMMON_JOKER, 5, mystic_summit_joker_effect }, { UNCOMMON_JOKER, 6, blackboard_joker_effect }, + { COMMON_JOKER, 5, blue_joker_effect }, }; static const size_t joker_registry_size = NUM_ELEM_IN_ARR(joker_registry); From 174050d81347ab6e68ce44f060b452038f36cd40 Mon Sep 17 00:00:00 2001 From: theturtlemafia Date: Sat, 2 Aug 2025 12:18:55 -0400 Subject: [PATCH 3/7] add fist, parking, business card, scholar, scary face, abstact, bull, smiley, even, odd jokers --- include/game.h | 2 +- source/game.c | 4 + source/joker_effects.c | 166 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-) diff --git a/include/game.h b/include/game.h index b0ae27a..681780e 100644 --- a/include/game.h +++ b/include/game.h @@ -83,7 +83,7 @@ JokerObject** get_jokers(void); int get_jokers_top(void); int get_deck_top(void); - int get_num_discards_remaining(void); +int get_money(void); #endif // GAME_H \ No newline at end of file diff --git a/source/game.c b/source/game.c index c69ce9c..5691f75 100644 --- a/source/game.c +++ b/source/game.c @@ -272,6 +272,10 @@ int get_num_discards_remaining(void) { return discards; } +int get_money(void) { + return money; +} + // General functions void set_seed(int seed) { diff --git a/source/joker_effects.c b/source/joker_effects.c index d070bd7..c9aa15b 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -291,11 +291,167 @@ static JokerEffect blue_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.chips = (get_deck_top() + 1) * 2; return effect; } +static JokerEffect raised_fist_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 + + // Find the lowest rank card in hand + // Aces are always considered high value, even in an ace-low straight + u8 lowest_value = 99; + CardObject** hand = get_hand_array(); + int hand_top = get_hand_top(); + for (int i = 0; i < hand_top; i++ ) + { + u8 value = card_get_value(hand[i]->card); + if (lowest_value > value) + lowest_value = value; + } + + if (lowest_value != 99) + effect.mult = lowest_value * 2; + + return effect; +} + +static JokerEffect reserved_parking_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_top = get_hand_top(); + for (int i = 0; i < hand_top; i++ ) + { + switch (hand[i]->card->rank) { + case KING: case QUEEN: case JACK: + if (random() % 2 == 0) + effect.money += 1; + default: + break; + } + } + + return effect; +} + +static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + switch (scored_card->rank) { + case KING: case QUEEN: case JACK: + if (random() % 2 == 0) + effect.money = 1; + default: + break; + } + + effect.chips = 1; + + return effect; +} + +static JokerEffect scholar_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + if (scored_card->rank == ACE) { + effect.chips = 20; + effect.mult = 4; + } + + return effect; +} + +static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + switch (scored_card->rank) { + case KING: case QUEEN: case JACK: + effect.chips = 30; + default: + break; + } + + return effect; +} + +static JokerEffect abstract_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 + + // +1 xmult per occupied joker slot + int jokers_top = get_jokers_top(); + effect.mult = (jokers_top + 1) * 3; + + return effect; +} + +static JokerEffect bull_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.chips = get_money() * 2; + + return effect; +} + +static JokerEffect smiley_face_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + switch (scored_card->rank) { + case KING: case QUEEN: case JACK: + effect.mult = 5; + default: + break; + } + + return effect; +} + +static JokerEffect even_steven_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + if (card_get_value(scored_card) % 2 == 0) { + switch (scored_card->rank) { + case KING: case QUEEN: case JACK: + break; + default: + effect.mult = 4; + } + } + + return effect; +} + +static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) { + JokerEffect effect = {0}; + if (scored_card == NULL) + return effect; + + if (card_get_value(scored_card) % 2 == 1) // todo test ace + effect.chips = 31; + + return effect; +} + const JokerInfo joker_registry[] = { { COMMON_JOKER, 2, default_joker_effect }, // DEFAULT_JOKER_ID = 0 { COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1 @@ -321,6 +477,16 @@ const JokerInfo joker_registry[] = { { COMMON_JOKER, 5, mystic_summit_joker_effect }, { UNCOMMON_JOKER, 6, blackboard_joker_effect }, { COMMON_JOKER, 5, blue_joker_effect }, + { COMMON_JOKER, 5, raised_fist_joker_effect }, + { COMMON_JOKER, 6, reserved_parking_joker_effect }, + { COMMON_JOKER, 4, business_card_joker_effect }, + { COMMON_JOKER, 4, scholar_joker_effect }, + { COMMON_JOKER, 4, scary_face_joker_effect }, + { COMMON_JOKER, 4, abstract_joker_effect }, + { UNCOMMON_JOKER, 6, bull_joker_effect}, + { COMMON_JOKER, 4, smiley_face_joker_effect }, + { COMMON_JOKER, 4, even_steven_joker_effect }, + { COMMON_JOKER, 4, odd_todd_joker_effect }, }; static const size_t joker_registry_size = NUM_ELEM_IN_ARR(joker_registry); From 445ea788a435482f5cd2df2620378608c5417945 Mon Sep 17 00:00:00 2001 From: theturtlemafia Date: Sat, 2 Aug 2025 13:28:28 -0400 Subject: [PATCH 4/7] fix error from rebase --- source/game.c | 49 ++++++++++++------------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/source/game.c b/source/game.c index 5691f75..a4cdce2 100644 --- a/source/game.c +++ b/source/game.c @@ -164,6 +164,18 @@ int get_jokers_top(void) { return jokers_top; } +int get_deck_top(void) { + return deck_top; +} + +int get_num_discards_remaining(void) { + return discards; +} + +int get_money(void) { + return money; +} + // Consts // Rects left top right bottom @@ -239,43 +251,6 @@ static const Rect SHOP_REROLL_RECT = {88, 96, UNDEFINED, UNDEFI #define PITCH_STEP_UNDISCARD_SFX 2*PITCH_STEP_DRAW_SFX // Naming the stage where cards return from the discard pile to the deck "undiscard" -// get-functions, for other files to view game state (mainly for jokers) -CardObject **get_hand_array(void) { - return hand; -} - -int get_hand_top(void) { - return hand_top; -} - -CardObject **get_played_array(void) { - return played; -} - -int get_played_top(void) { - return played_top; -} - -JokerObject **get_jokers(void) { - return jokers; -} - -int get_jokers_top(void) { - return jokers_top; -} - -int get_deck_top(void) { - return deck_top; -} - -int get_num_discards_remaining(void) { - return discards; -} - -int get_money(void) { - return money; -} - // General functions void set_seed(int seed) { From 254efd7841bc8f127694642c49b204fdb5add9a5 Mon Sep 17 00:00:00 2001 From: theturtlemafia Date: Sat, 9 Aug 2025 19:23:47 -0400 Subject: [PATCH 5/7] implement feedback --- include/card.h | 2 ++ include/graphic_utils.h | 1 + source/joker.c | 8 ++++---- source/joker_effects.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/card.h b/include/card.h index 2b003b6..9831013 100644 --- a/include/card.h +++ b/include/card.h @@ -35,6 +35,8 @@ #define NUM_RANKS 13 #define RANK_OFFSET 2 // Because the first rank is 2 and ranks start at 0 +#define IMPOSSIBLY_HIGH_CARD_VALUE 99 + // Card types typedef struct { diff --git a/include/graphic_utils.h b/include/graphic_utils.h index 6c169c7..be20b1a 100644 --- a/include/graphic_utils.h +++ b/include/graphic_utils.h @@ -42,6 +42,7 @@ // Tile size in pixels, both height and width as tiles are square #define TILE_SIZE 8 +#define EFFECT_TEXT_SEPARATION_AMOUNT 32; // If we need to show multiple effects at once typedef struct { diff --git a/source/joker.c b/source/joker.c index 8dc6573..3ae8a7a 100644 --- a/source/joker.c +++ b/source/joker.c @@ -243,7 +243,7 @@ bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips tte_set_special(0xD000); // Blue snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.chips); tte_write(score_buffer); - cursorPosX += 30; + cursorPosX += EFFECT_TEXT_SEPARATION_AMOUNT; } if (joker_effect.mult > 0) { @@ -252,7 +252,7 @@ bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips tte_set_special(0xE000); // Red snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.mult); tte_write(score_buffer); - cursorPosX += 30; + cursorPosX += EFFECT_TEXT_SEPARATION_AMOUNT; } if (joker_effect.xmult > 0) { @@ -261,7 +261,7 @@ bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips tte_set_special(0xE000); // Red snprintf(score_buffer, sizeof(score_buffer), "X%d", joker_effect.xmult); tte_write(score_buffer); - cursorPosX += 30; + cursorPosX += EFFECT_TEXT_SEPARATION_AMOUNT; } if (joker_effect.money > 0) { @@ -270,7 +270,7 @@ bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips tte_set_special(0xC000); // Yellow snprintf(score_buffer, sizeof(score_buffer), "+%d", joker_effect.money); tte_write(score_buffer); - cursorPosX += 30; + cursorPosX += EFFECT_TEXT_SEPARATION_AMOUNT; } joker_object->joker->processed = true; // Mark the joker as processed diff --git a/source/joker_effects.c b/source/joker_effects.c index c9aa15b..df434f4 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -304,7 +304,7 @@ static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card) { // Find the lowest rank card in hand // Aces are always considered high value, even in an ace-low straight - u8 lowest_value = 99; + u8 lowest_value = IMPOSSIBLY_HIGH_CARD_VALUE; CardObject** hand = get_hand_array(); int hand_top = get_hand_top(); for (int i = 0; i < hand_top; i++ ) From 2539954deacc57242d2a37adbf6b5d5c6a404c5e Mon Sep 17 00:00:00 2001 From: MeirGavish Date: Sun, 17 Aug 2025 11:10:00 +0300 Subject: [PATCH 6/7] Fixed build error from previous merge and applied review comments --- include/card.h | 2 +- source/joker_effects.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/card.h b/include/card.h index 9831013..e403b33 100644 --- a/include/card.h +++ b/include/card.h @@ -35,7 +35,7 @@ #define NUM_RANKS 13 #define RANK_OFFSET 2 // Because the first rank is 2 and ranks start at 0 -#define IMPOSSIBLY_HIGH_CARD_VALUE 99 +#define IMPOSSIBLY_HIGH_CARD_VALUE 100 // Card types typedef struct diff --git a/source/joker_effects.c b/source/joker_effects.c index 36b6197..7cbb0d3 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -313,15 +313,15 @@ static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card) { // Aces are always considered high value, even in an ace-low straight u8 lowest_value = IMPOSSIBLY_HIGH_CARD_VALUE; CardObject** hand = get_hand_array(); - int hand_top = get_hand_top(); - for (int i = 0; i < hand_top; i++ ) + int hand_size = hand_get_size(); + for (int i = 0; i < hand_size; i++ ) { u8 value = card_get_value(hand[i]->card); if (lowest_value > value) lowest_value = value; } - if (lowest_value != 99) + if (lowest_value != IMPOSSIBLY_HIGH_CARD_VALUE) effect.mult = lowest_value * 2; return effect; @@ -333,8 +333,8 @@ static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card return effect; // if card != null, we are not at the end-phase of scoring yet CardObject** hand = get_hand_array(); - int hand_top = get_hand_top(); - for (int i = 0; i < hand_top; i++ ) + int hand_size = hand_get_size(); + for (int i = 0; i < hand_size; i++ ) { switch (hand[i]->card->rank) { case KING: case QUEEN: case JACK: @@ -356,13 +356,11 @@ static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) { switch (scored_card->rank) { case KING: case QUEEN: case JACK: if (random() % 2 == 0) - effect.money = 1; + effect.money = 2; default: break; } - effect.chips = 1; - return effect; } @@ -400,8 +398,8 @@ static JokerEffect abstract_joker_effect(Joker *joker, Card *scored_card) { return effect; // if card != null, we are not at the end-phase of scoring yet // +1 xmult per occupied joker slot - int jokers_top = get_jokers_top(); - effect.mult = (jokers_top + 1) * 3; + int num_jokers = list_get_size(get_jokers()); + effect.mult = num_jokers * 3; return effect; } From 46141090a05c6a395a98fe5f2e3b79d58ba5112e Mon Sep 17 00:00:00 2001 From: MeirGavish Date: Sun, 17 Aug 2025 12:36:20 +0300 Subject: [PATCH 7/7] Added joker sprites by @GreenNinja2525 for Blue Joker, Even Steven, Odd Todd, Scholar and Business Card. Disabled jokers with no sprites. --- graphics/joker_gfx11.png | Bin 855 -> 1199 bytes graphics/joker_gfx12.grit | 1 + graphics/joker_gfx12.png | Bin 0 -> 1200 bytes graphics/joker_gfx13.grit | 1 + graphics/joker_gfx13.png | Bin 0 -> 1135 bytes include/joker_gfx.h | 2 + source/joker.c | 4 ++ source/joker_effects.c | 86 ++++++++++++++++++++++++-------------- 8 files changed, 62 insertions(+), 32 deletions(-) create mode 100644 graphics/joker_gfx12.grit create mode 100644 graphics/joker_gfx12.png create mode 100644 graphics/joker_gfx13.grit create mode 100644 graphics/joker_gfx13.png diff --git a/graphics/joker_gfx11.png b/graphics/joker_gfx11.png index 07b537c4b3f16e80ba8decafaea4179ef21a4375..2bc36d4ff9d82089853fd3120ba47efec6723bbe 100644 GIT binary patch delta 1180 zcmV;N1Y`Tx2CoT_BYy;TNklDgpT-OzIPK=?}#OdY)Y`|$4Xi#=Jc))Ur5EAP+U5hV+3 zcqrH?EhDoBbPf+tuGY~xJU|$Ra9kG-fN>CD&huh#Uan{H029xwU^GDR+2@nmb!6gu zl3QDTTe{oJZ~jHb#ijAc?Ycb6ftl+JkWsGIalG>8T7Ph|sxC%q>*L$$cr@d3#Vf&; zBKK3}PE~tWOL*F(H-L-oB9Wk^@P~n@|a^ z5)V=tMg#B|PI-Xn)7w@jZMNYy+ZM~r20fCv%{CtWe5A-)-mOe?CK@0uobc1x?`>Zz zKY7El;(yZ`LGTb^RGynMLd&})B1tB62SXMFfhgUMk1j2n~gkea!YVdSb$mDvG3sU@fd3c*XCXL@J40?Zlh{+r&Gvo(N z?{oyW*+#gzhH!IjCXpa3Pq|uG#+c{VKwXFc5cdH(%GEl4`||ti@rA#X_G16G(q_64 z>3c``cB7~Y?wFO>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^XvW2%z`lM6}hyK=kK#7t0`P#!dZf-^pD9vJqtEISwCgigNGANg^%)aJCF&n3R)a zfD;ek1JUCW>OWrrh+IFs^t62sA8sPN^f0@)in}my;{IHQEXW3N9s@Y|x(_csZGfY@ z+o;8caj86zo^eyO=lzO$K?12v>=VRQsW+qSE-rIa>dmOn&Q@lYHc2K}1eJPI@ayC# zoCyK|dBzfVUha3=@caQhe}I0cooIIr(`-+Y`Khp40qBobAbNqtS?sMk7O>Xvc4rigHq!%;uod zRVr*UG&hK9m?Hcs0jNO;N-3k%)XKCcxUM`P3zd2^b#k4>Z;=QY>T^XTn6g!D%t+9~~K{%}`dfx8?m~29Vv+g%M=P-+Pmr zn|`9G(8d7IA58soQkMqX!Uex>OdYh5?0@<_{u@o1Cuj3mVU7R*002ovPDHLkV1mX@ B9rgeK literal 0 HcmV?d00001 diff --git a/include/joker_gfx.h b/include/joker_gfx.h index 75cfbbc..ce1c916 100644 --- a/include/joker_gfx.h +++ b/include/joker_gfx.h @@ -13,5 +13,7 @@ #include "joker_gfx9.h" #include "joker_gfx10.h" #include "joker_gfx11.h" +#include "joker_gfx12.h" +#include "joker_gfx13.h" #endif \ No newline at end of file diff --git a/source/joker.c b/source/joker.c index 867d608..6ec320b 100644 --- a/source/joker.c +++ b/source/joker.c @@ -130,6 +130,8 @@ void joker_init() 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_gfxPal[0] = joker_gfx0Pal; joker_gfxPal[1] = joker_gfx1Pal; @@ -143,6 +145,8 @@ void joker_init() 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; for (int i = 0; i < num_spritesheets; i++) { diff --git a/source/joker_effects.c b/source/joker_effects.c index 7cbb0d3..155c850 100644 --- a/source/joker_effects.c +++ b/source/joker_effects.c @@ -304,7 +304,11 @@ static JokerEffect blue_joker_effect(Joker *joker, Card *scored_card) { return effect; } -static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card) { +// 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}; if (scored_card != NULL) return effect; // if card != null, we are not at the end-phase of scoring yet @@ -325,8 +329,9 @@ static JokerEffect raised_fist_joker_effect(Joker *joker, Card *scored_card) { effect.mult = lowest_value * 2; return effect; -} +} +__attribute__((unused)) static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card) { JokerEffect effect = {0}; if (scored_card != NULL) @@ -346,7 +351,7 @@ static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card } return effect; -} +}; static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) { JokerEffect effect = {0}; @@ -377,6 +382,7 @@ static JokerEffect scholar_joker_effect(Joker *joker, Card *scored_card) { return effect; } +__attribute__((unused)) static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) { JokerEffect effect = {0}; if (scored_card == NULL) @@ -392,6 +398,7 @@ 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) @@ -404,6 +411,7 @@ 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) @@ -414,6 +422,7 @@ static JokerEffect bull_joker_effect(Joker *joker, Card *scored_card) { return effect; } +__attribute__((unused)) static JokerEffect smiley_face_joker_effect(Joker *joker, Card *scored_card) { JokerEffect effect = {0}; if (scored_card == NULL) @@ -457,43 +466,56 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) { 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. + * Each consecutive NUM_JOKERS_PER_SPRITESHEET (defined in joker.c) jokers + * share a spritesheet and thus a color palette. + * To make better use of color palettes jokers may be rearranged here + * (and put together in the matching spritesheet) to share a color palette. + * Otherwise the order is similar to the wiki. + */ const JokerInfo joker_registry[] = { { COMMON_JOKER, 2, default_joker_effect }, // DEFAULT_JOKER_ID = 0 - { COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1 - { COMMON_JOKER, 5, lusty_joker_effect }, // etc... - { COMMON_JOKER, 5, wrathful_joker_effect }, - { COMMON_JOKER, 5, gluttonous_joker_effect }, - { COMMON_JOKER, 3, jolly_joker_effect }, - { COMMON_JOKER, 4, zany_joker_effect }, - { COMMON_JOKER, 4, mad_joker_effect }, - { COMMON_JOKER, 4, crazy_joker_effect }, - { COMMON_JOKER, 4, droll_joker_effect }, - { COMMON_JOKER, 3, sly_joker_effect }, - { COMMON_JOKER, 4, wily_joker_effect }, - { COMMON_JOKER, 4, clever_joker_effect }, - { COMMON_JOKER, 4, devious_joker_effect }, - { COMMON_JOKER, 4, crafty_joker_effect }, - { COMMON_JOKER, 5, half_joker_effect }, - { UNCOMMON_JOKER, 8, joker_stencil_effect }, - { COMMON_JOKER, 5, banner_joker_effect }, - { COMMON_JOKER, 4, walkie_talkie_joker_effect }, - { UNCOMMON_JOKER, 8, fibonnaci_joker_effect }, - { UNCOMMON_JOKER, 6, blackboard_joker_effect }, - { COMMON_JOKER, 5, mystic_summit_joker_effect }, - { COMMON_JOKER, 4, misprint_joker_effect }, - { UNCOMMON_JOKER, 6, blackboard_joker_effect }, - { COMMON_JOKER, 5, blue_joker_effect }, + { COMMON_JOKER, 5, greedy_joker_effect }, // GREEDY_JOKER_ID = 1 + { COMMON_JOKER, 5, lusty_joker_effect }, // etc... 2 + { COMMON_JOKER, 5, wrathful_joker_effect }, // 3 + { COMMON_JOKER, 5, gluttonous_joker_effect }, // 4 + { COMMON_JOKER, 3, jolly_joker_effect }, // 5 + { COMMON_JOKER, 4, zany_joker_effect }, // 6 + { COMMON_JOKER, 4, mad_joker_effect }, // 7 + { COMMON_JOKER, 4, crazy_joker_effect }, // 8 + { COMMON_JOKER, 4, droll_joker_effect }, // 9 + { COMMON_JOKER, 3, sly_joker_effect }, // 10 + { COMMON_JOKER, 4, wily_joker_effect }, // 11 + { COMMON_JOKER, 4, clever_joker_effect }, // 12 + { COMMON_JOKER, 4, devious_joker_effect }, // 13 + { COMMON_JOKER, 4, crafty_joker_effect }, // 14 + { COMMON_JOKER, 5, half_joker_effect }, // 15 + { UNCOMMON_JOKER, 8, joker_stencil_effect }, // 16 + { COMMON_JOKER, 5, banner_joker_effect }, // 17 + { COMMON_JOKER, 4, walkie_talkie_joker_effect }, // 18 + { UNCOMMON_JOKER, 8, fibonnaci_joker_effect }, // 19 + { UNCOMMON_JOKER, 6, blackboard_joker_effect }, // 20 + { COMMON_JOKER, 5, mystic_summit_joker_effect }, // 21 + { COMMON_JOKER, 4, misprint_joker_effect }, // 22 + { COMMON_JOKER, 4, even_steven_joker_effect }, // 23 + { COMMON_JOKER, 5, blue_joker_effect }, // 24 + { COMMON_JOKER, 4, odd_todd_joker_effect }, // 25 + { COMMON_JOKER, 4, scholar_joker_effect }, // 26 + { COMMON_JOKER, 4, business_card_joker_effect }, // 27 + // Business card should be paired with Shortcut for palette optimization when it's added + + // The following jokers don't have sprites yet, + // uncomment them when their sprites are added. +#if 0 { COMMON_JOKER, 5, raised_fist_joker_effect }, { COMMON_JOKER, 6, reserved_parking_joker_effect }, - { COMMON_JOKER, 4, business_card_joker_effect }, - { COMMON_JOKER, 4, scholar_joker_effect }, { COMMON_JOKER, 4, scary_face_joker_effect }, { COMMON_JOKER, 4, abstract_joker_effect }, { UNCOMMON_JOKER, 6, bull_joker_effect}, { COMMON_JOKER, 4, smiley_face_joker_effect }, - { COMMON_JOKER, 4, even_steven_joker_effect }, - { COMMON_JOKER, 4, odd_todd_joker_effect }, - +#endif }; static const size_t joker_registry_size = NUM_ELEM_IN_ARR(joker_registry);