Implement Seltzer and Joker Expiration effect (#252)
* Add Seltzer art * Implement Joker expiration * Add exception to copying Jokers + Seltzer message fix * Move all scoring logic to joker_object_score away from check_and_score_joker_for_event --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
+25
-7
@@ -265,7 +265,7 @@ void set_and_shift_text(char* str, int* cursor_pos_x, int* cursor_pos_y, int col
|
||||
*cursor_pos_x += joker_score_display_offset_px;
|
||||
}
|
||||
|
||||
bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum JokerEvent joker_event, u32 *chips, u32 *mult, int *money, bool *retrigger)
|
||||
bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum JokerEvent joker_event)
|
||||
{
|
||||
if (joker_object == NULL)
|
||||
{
|
||||
@@ -280,11 +280,17 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 chips = get_chips();
|
||||
u32 mult = get_mult();
|
||||
int money = get_money();
|
||||
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_RETRIGGER)
|
||||
{
|
||||
*retrigger = joker_effect->retrigger;
|
||||
set_retrigger(joker_effect->retrigger);
|
||||
}
|
||||
|
||||
// joker_effect.message will have been set if the Joker had anything custom to say
|
||||
|
||||
int cursorPosX = TILE_SIZE; // Offset of one tile to better center the text on the card
|
||||
int cursorPosY = 0;
|
||||
if (joker_event == JOKER_EVENT_ON_CARD_HELD)
|
||||
@@ -303,7 +309,7 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
mm_word sfx_id;
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_CHIPS)
|
||||
{
|
||||
*chips = u32_protected_add(*chips, joker_effect->chips);
|
||||
chips = u32_protected_add(chips, joker_effect->chips);
|
||||
char score_buffer[INT_MAX_DIGITS + 2]; // For '+' and null terminator
|
||||
snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->chips);
|
||||
set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_BLUE_PB);
|
||||
@@ -311,7 +317,7 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
}
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_MULT)
|
||||
{
|
||||
*mult = u32_protected_add(*mult, joker_effect->mult);
|
||||
mult = u32_protected_add(mult, joker_effect->mult);
|
||||
char score_buffer[INT_MAX_DIGITS + 2];
|
||||
snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->mult);
|
||||
set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
|
||||
@@ -320,7 +326,7 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
// if xmult is zero, DO NOT multiply by it
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_XMULT && joker_effect->xmult > 0)
|
||||
{
|
||||
*mult = u32_protected_mult(*mult, joker_effect->xmult);
|
||||
mult = u32_protected_mult(mult, joker_effect->xmult);
|
||||
char score_buffer[INT_MAX_DIGITS + 2];
|
||||
snprintf(score_buffer, sizeof(score_buffer), "X%lu", joker_effect->xmult);
|
||||
set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
|
||||
@@ -328,7 +334,7 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
}
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_MONEY)
|
||||
{
|
||||
*money += joker_effect->money;
|
||||
money += joker_effect->money;
|
||||
char score_buffer[INT_MAX_DIGITS + 2];
|
||||
snprintf(score_buffer, sizeof(score_buffer), "%d$", joker_effect->money);
|
||||
set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_YELLOW_PB);
|
||||
@@ -340,11 +346,23 @@ bool joker_object_score(JokerObject *joker_object, CardObject* card_object, enum
|
||||
{
|
||||
set_and_shift_text(joker_effect->message, &cursorPosX, &cursorPosY, TTE_WHITE_PB);
|
||||
}
|
||||
// this will start the Joker expire animation
|
||||
if (effect_flags_ret & JOKER_EFFECT_FLAG_EXPIRE && joker_effect->expire)
|
||||
{
|
||||
// TODO make Jokers expire
|
||||
joker_object_shake(joker_object, UNDEFINED);
|
||||
list_push_back(get_expired_jokers_list(), joker_object);
|
||||
}
|
||||
|
||||
// Update values
|
||||
set_chips(chips);
|
||||
set_mult(mult);
|
||||
set_money(money);
|
||||
|
||||
// Update displays
|
||||
display_chips();
|
||||
display_mult();
|
||||
display_money();
|
||||
|
||||
joker_object_shake(joker_object, sfx_id);
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user