Refactor of scoring flow, Joker Callbacks and Card Retriggers (#160)
* Remove Baseball Card for now, will have to wait a future PR * Removed cards held in hand joker scoring stage - should be in another PR --------- Co-authored-by: MonteCrysto <mathis.martin31@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: MeirGavish <meir.gavish@gmail.com>
This commit is contained in:
co-authored by
MonteCrysto
Copilot
MeirGavish
parent
2c532b5bd8
commit
eb815b7820
@@ -19,4 +19,6 @@ DEF_JOKER_GFX(17)
|
||||
DEF_JOKER_GFX(18)
|
||||
DEF_JOKER_GFX(19)
|
||||
DEF_JOKER_GFX(20)
|
||||
DEF_JOKER_GFX(21)
|
||||
DEF_JOKER_GFX(21)
|
||||
DEF_JOKER_GFX(22)
|
||||
DEF_JOKER_GFX(23)
|
||||
+3
-1
@@ -53,7 +53,8 @@ enum HandState
|
||||
enum PlayState
|
||||
{
|
||||
PLAY_PLAYING,
|
||||
PLAY_SCORING,
|
||||
PLAY_SCORING_CARDS,
|
||||
PLAY_SCORING_JOKERS,
|
||||
PLAY_ENDING,
|
||||
PLAY_ENDED
|
||||
};
|
||||
@@ -104,6 +105,7 @@ int get_hand_top(void);
|
||||
int hand_get_size(void);
|
||||
CardObject** get_played_array(void);
|
||||
int get_played_top(void);
|
||||
int get_scored_card_index(void);
|
||||
List* get_jokers(void);
|
||||
bool is_joker_owned(int joker_id);
|
||||
bool card_is_face(Card *card);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define TTE_BLUE_PB 13 // 0xD
|
||||
#define TTE_RED_PB 14 // 0xE
|
||||
#define TTE_WHITE_PB 15 // 0xF
|
||||
#define TTE_SPECIAL_PB_MULT_OFFSET 0x1000 //TODO: Change to a better name?
|
||||
|
||||
#define TEXT_CLR_YELLOW RGB15(31, 20, 0) // 0x029F
|
||||
#define TEXT_CLR_BLUE RGB15(0, 18, 31) // 0x7E40
|
||||
|
||||
+34
-6
@@ -43,21 +43,45 @@
|
||||
#define RARE_JOKER_CHANCE 5
|
||||
#define LEGENDARY_JOKER_CHANCE 0
|
||||
|
||||
// These are the common Joker Events. Special Joker behaviour will be checked on a
|
||||
// Joker per Joker basis (see if it's there, then do something, e.g. Pareidolia, Baseball Card)
|
||||
enum JokerEvent
|
||||
{
|
||||
JOKER_EVENT_ON_HAND_PLAYED, // Triggers only once when the hand is played
|
||||
JOKER_EVENT_ON_CARD_SCORED, // Triggers when a played card scores (e.g. Walkie Talkie, Fibonnacci...)
|
||||
JOKER_EVENT_ON_CARD_SCORED_END, // Triggers after the card has finishd scoring (e.g. retrigger Jokers)
|
||||
JOKER_EVENT_INDEPENDENT, // Joker will trigger normally, when Jokers are scored (e.g. base Joker)
|
||||
JOKER_EVENT_ON_HAND_SCORED_END, // Triggers when entire hand has finished scoring (e.g. food Jokers)
|
||||
JOKER_EVENT_ON_HAND_DISCARDED, // Triggers when discarding a hand
|
||||
JOKER_EVENT_ON_ROUND_END, // Triggers at the end of the round (e.g. Rocket)
|
||||
JOKER_EVENT_ON_BLIND_SELECTED, // Triggers when selecting a blind (e.g. Dagger, Riff Raff, Madness..)
|
||||
};
|
||||
|
||||
#define MAX_JOKER_OBJECTS 32 // The maximum number of joker objects that can be created at once
|
||||
|
||||
// Jokers in the game
|
||||
#define DEFAULT_JOKER_ID 0
|
||||
#define GREEDY_JOKER_ID 1 // This is just an example to show the patern of making joker IDs
|
||||
#define GREEDY_JOKER_ID 1
|
||||
#define JOKER_STENCIL_ID 16
|
||||
#define PAREIDOLIA_JOKER_ID 30
|
||||
#define JOKER_BRAINSTORM_ID 40
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 id; // Unique ID for the joker, used to identify different jokers
|
||||
u8 modifier; // base, foil, holo, poly, negative
|
||||
u8 value;
|
||||
u8 rarity;
|
||||
bool processed;
|
||||
// General purpose values that are interpreted differently for each Joker (scaling, last retriggered card, etc...)
|
||||
union
|
||||
{
|
||||
s32 data;
|
||||
struct {
|
||||
s16 data0;
|
||||
s16 data1;
|
||||
} halves;
|
||||
};
|
||||
} Joker;
|
||||
|
||||
typedef struct JokerObject
|
||||
@@ -73,13 +97,17 @@ typedef struct // These jokers are triggered after the played hand has finished
|
||||
int xmult;
|
||||
int money;
|
||||
bool retrigger; // Retrigger played hand (e.g. "Dusk" joker, even though on the wiki it says "On Scored" it makes more sense to have it here)
|
||||
bool expire; // Joker is destroyed (food jokers)
|
||||
char* message; // Used to send custom messages e.g. "Extinct" or "-1" (Bananas and food Jokers)
|
||||
} JokerEffect;
|
||||
|
||||
typedef JokerEffect (*JokerEffectFunc)(Joker *joker, Card *scored_card);
|
||||
typedef JokerEffect (*JokerEffectFunc)(Joker *joker, Card *scored_card, enum JokerEvent joker_event);
|
||||
typedef void (*JokerCallbackOnCreated)(Joker *joker);
|
||||
typedef struct {
|
||||
u8 rarity;
|
||||
u8 base_value;
|
||||
JokerEffectFunc effect;
|
||||
JokerEffectFunc joker_effect;
|
||||
JokerCallbackOnCreated on_joker_created;
|
||||
} JokerInfo;
|
||||
const JokerInfo* get_joker_registry_entry(int joker_id);
|
||||
size_t get_joker_registry_size(void);
|
||||
@@ -91,14 +119,14 @@ void joker_destroy(Joker **joker);
|
||||
|
||||
// Unique effects like "Four Fingers" or "Credit Card" will be hard coded into game.c with a conditional check for the joker ID from the players owned jokers
|
||||
// game.c should probably be restructured so most of the variables in it are moved to some sort of global variable header file so they can be easily accessed and modified for the jokers
|
||||
JokerEffect joker_get_score_effect(Joker *joker, Card *scored_card);
|
||||
JokerEffect joker_get_score_effect(Joker *joker, Card *scored_card, enum JokerEvent joker_event);
|
||||
int joker_get_sell_value(const Joker* joker);
|
||||
|
||||
JokerObject *joker_object_new(Joker *joker);
|
||||
void joker_object_destroy(JokerObject **joker_object);
|
||||
void joker_object_update(JokerObject *joker_object);
|
||||
void joker_object_shake(JokerObject *joker_object, mm_word sound_id); // This doesn't actually score anything, it just performs an animation and plays a sound effect
|
||||
bool joker_object_score(JokerObject *joker_object, Card* scored_card, int *chips, int *mult, int *xmult, int *money, bool *retrigger); // This scores the joker and returns true if it was scored successfully (Card = NULL means the joker is independent and not scored by a card)
|
||||
bool joker_object_score(JokerObject *joker_object, Card* scored_card, enum JokerEvent joker_event, int *chips, int *mult, int *money, bool *retrigger); // This scores the joker and returns true if it was scored successfully (Card = NULL means the joker is independent and not scored by a card)
|
||||
|
||||
void joker_object_set_selected(JokerObject* joker_object, bool selected);
|
||||
bool joker_object_is_selected(JokerObject* joker_object);
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
#include "joker_gfx19.h"
|
||||
#include "joker_gfx20.h"
|
||||
#include "joker_gfx21.h"
|
||||
#include "joker_gfx22.h"
|
||||
#include "joker_gfx23.h"
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -37,7 +37,7 @@ static inline int get_digits_even(int n)
|
||||
|
||||
#define NUM_ELEM_IN_ARR(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
#define INT_MAX_DIGITS 10 // strlen(str(INT_MAX)) = strlen("2147483647")
|
||||
#define INT_MAX_DIGITS 11 // strlen(str(INT_MAX)) = strlen("-2147483647")
|
||||
|
||||
int int_arr_max(int int_arr[], int size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user