Merge branch 'main' into implement_joker_testing
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 877 B After Width: | Height: | Size: 916 B |
|
Before Width: | Height: | Size: 955 B After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
-gB4 -Mw4 -Mh4 -m! -pn 16
|
||||
|
After Width: | Height: | Size: 936 B |
@@ -38,7 +38,7 @@
|
||||
#define IMPOSSIBLY_HIGH_CARD_VALUE 100
|
||||
|
||||
// Card types
|
||||
typedef struct
|
||||
typedef struct Card
|
||||
{
|
||||
u8 suit;
|
||||
u8 rank;
|
||||
|
||||
@@ -18,4 +18,5 @@ DEF_JOKER_GFX(16)
|
||||
DEF_JOKER_GFX(17)
|
||||
DEF_JOKER_GFX(18)
|
||||
DEF_JOKER_GFX(19)
|
||||
DEF_JOKER_GFX(20)
|
||||
DEF_JOKER_GFX(20)
|
||||
DEF_JOKER_GFX(21)
|
||||
@@ -86,6 +86,7 @@ typedef struct List List;
|
||||
|
||||
// Utility functions for other files
|
||||
typedef struct CardObject CardObject; // forward declaration, actually declared in card.h
|
||||
typedef struct Card Card;
|
||||
typedef struct JokerObject JokerObject;
|
||||
CardObject** get_hand_array(void);
|
||||
int get_hand_top(void);
|
||||
@@ -93,9 +94,12 @@ int hand_get_size(void);
|
||||
CardObject** get_played_array(void);
|
||||
int get_played_top(void);
|
||||
List* get_jokers(void);
|
||||
bool is_joker_owned(int joker_id);
|
||||
bool card_is_face(Card *card);
|
||||
|
||||
int get_deck_top(void);
|
||||
int get_num_discards_remaining(void);
|
||||
int get_num_hands_remaining(void);
|
||||
int get_money(void);
|
||||
|
||||
#endif // GAME_H
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#define DEFAULT_JOKER_ID 0
|
||||
#define GREEDY_JOKER_ID 1 // This is just an example to show the patern of making joker IDs
|
||||
#define JOKER_STENCIL_ID 16
|
||||
#define PAREIDOLIA_JOKER_ID 30
|
||||
#define JOKER_BRAINSTORM_ID 40
|
||||
|
||||
typedef struct
|
||||
@@ -92,4 +93,4 @@ bool joker_object_is_selected(JokerObject* joker_object);
|
||||
|
||||
Sprite* joker_object_get_sprite(JokerObject* joker_object);
|
||||
|
||||
#endif // JOKER_H
|
||||
#endif // JOKER_H
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
#include "joker_gfx18.h"
|
||||
#include "joker_gfx19.h"
|
||||
#include "joker_gfx20.h"
|
||||
#include "joker_gfx21.h"
|
||||
|
||||
#endif
|
||||
@@ -157,7 +157,7 @@ void joker_destroy(Joker **joker)
|
||||
JokerEffect joker_get_score_effect(Joker *joker, Card *scored_card)
|
||||
{
|
||||
const JokerInfo *jinfo = get_joker_registry_entry(joker->id);
|
||||
if (!jinfo) return (JokerEffect){0};
|
||||
if (!jinfo || jinfo->effect == NULL) return (JokerEffect){0};
|
||||
|
||||
return jinfo->effect(joker, scored_card);
|
||||
}
|
||||
|
||||
@@ -337,12 +337,8 @@ static JokerEffect reserved_parking_joker_effect(Joker *joker, Card *scored_card
|
||||
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:
|
||||
if (random() % 2 == 0)
|
||||
effect.money += 1;
|
||||
default:
|
||||
break;
|
||||
if ((random() % 2 == 0) && card_is_face(hand[i]->card)) {
|
||||
effect.money += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,12 +350,8 @@ static JokerEffect business_card_joker_effect(Joker *joker, Card *scored_card) {
|
||||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
if (random() % 2 == 0)
|
||||
effect.money = 2;
|
||||
default:
|
||||
break;
|
||||
if ((random() % 2 == 0) && card_is_face(scored_card)) {
|
||||
effect.money = 2;
|
||||
}
|
||||
|
||||
return effect;
|
||||
@@ -383,11 +375,8 @@ static JokerEffect scary_face_joker_effect(Joker *joker, Card *scored_card) {
|
||||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
effect.chips = 30;
|
||||
default:
|
||||
break;
|
||||
if (card_is_face(scored_card)) {
|
||||
effect.chips = 30;
|
||||
}
|
||||
|
||||
return effect;
|
||||
@@ -420,11 +409,8 @@ static JokerEffect smiley_face_joker_effect(Joker *joker, Card *scored_card) {
|
||||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
switch (scored_card->rank) {
|
||||
case KING: case QUEEN: case JACK:
|
||||
effect.mult = 5;
|
||||
default:
|
||||
break;
|
||||
if (card_is_face(scored_card)) {
|
||||
effect.mult = 5;
|
||||
}
|
||||
|
||||
return effect;
|
||||
@@ -458,7 +444,21 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_duo_joker_effect(Joker *joker, Card *scored_card) {
|
||||
__attribute__((unused))
|
||||
static JokerEffect acrobat_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card == NULL)
|
||||
return effect;
|
||||
|
||||
// 0 remaining hands mean we're scoring the last hand
|
||||
if (get_num_hands_remaining() == 0) {
|
||||
effect.xmult = 3;
|
||||
}
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -473,7 +473,7 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_trio_joker_effect(Joker *joker, Card *scored_card) {
|
||||
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
|
||||
@@ -488,7 +488,7 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_family_joker_effect(Joker *joker, Card *scored_card) {
|
||||
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
|
||||
@@ -503,7 +503,7 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_order_joker_effect(Joker *joker, Card *scored_card) {
|
||||
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
|
||||
@@ -517,7 +517,7 @@ static JokerEffect odd_todd_joker_effect(Joker *joker, Card *scored_card) {
|
||||
return effect;
|
||||
}
|
||||
|
||||
static JokerEffect the_tribe_joker_effect(Joker *joker, Card *scored_card) {
|
||||
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
|
||||
@@ -531,10 +531,6 @@ static JokerEffect odd_todd_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
|
||||
// graphics available from @MathisMartin31
|
||||
__attribute__((unused))
|
||||
static JokerEffect bootstraps_joker_effect(Joker *joker, Card *scored_card) {
|
||||
JokerEffect effect = {0};
|
||||
if (scored_card != NULL)
|
||||
@@ -545,6 +541,8 @@ static JokerEffect bootstraps_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
|
||||
// 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) {
|
||||
@@ -658,8 +656,8 @@ const JokerInfo joker_registry[] = {
|
||||
{ COMMON_JOKER, 4, business_card_joker_effect }, // 27
|
||||
// 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
|
||||
{ UNCOMMON_JOKER, 7, bootstraps_joker_effect}, // 29
|
||||
{ UNCOMMON_JOKER, 5, NULL /* Pareidolia */ }, // 30
|
||||
{ COMMON_JOKER, 6, reserved_parking_joker_effect }, // 31
|
||||
{ COMMON_JOKER, 4, abstract_joker_effect }, // 32
|
||||
{ UNCOMMON_JOKER, 6, bull_joker_effect}, // 33
|
||||
@@ -670,11 +668,14 @@ const JokerInfo joker_registry[] = {
|
||||
{ RARE_JOKER, 8, the_tribe_joker_effect}, // 38
|
||||
{ RARE_JOKER, 10, blueprint_joker_effect }, // 39
|
||||
{ RARE_JOKER, 10, brainstorm_joker_effect }, // 40
|
||||
{ COMMON_JOKER, 5, raised_fist_joker_effect }, // 41
|
||||
{ COMMON_JOKER, 4, smiley_face_joker_effect }, // 42
|
||||
|
||||
// The following jokers don't have sprites yet,
|
||||
// uncomment them when their sprites are added.
|
||||
#if 0
|
||||
{ UNCOMMON_JOKER, 7, bootstraps_joker_effect},
|
||||
|
||||
{ UNCOMMON_JOKER, 6, acrobat_joker_effect },
|
||||
{ COMMON_JOKER, 5, shoot_the_moon_joker_effect},
|
||||
#endif
|
||||
};
|
||||
@@ -690,4 +691,4 @@ const JokerInfo* get_joker_registry_entry(int joker_id) {
|
||||
|
||||
size_t get_joker_registry_size(void) {
|
||||
return joker_registry_size;
|
||||
}
|
||||
}
|
||||
|
||||