Refactor hand_discard function to return a boolean and update game logic for discarding cards; add background_play_gfx and improve text engine initialization.
This commit is contained in:
+12
-11
@@ -273,6 +273,14 @@ void card_update() // This whole function is currently pretty unoptimized due to
|
||||
hand_x = int2fx(240);
|
||||
hand_y = int2fx(70);
|
||||
|
||||
if (!sound_played)
|
||||
{
|
||||
const int pitch_lut[MAX_SELECTION_SIZE] = {1024, 960, 896, 832, 768};
|
||||
mm_sound_effect sfx_draw = {{SFX_CARD_DRAW}, pitch_lut[cards_drawn], 0, 255, 128,};
|
||||
mmEffectEx(&sfx_draw);
|
||||
sound_played = true;
|
||||
}
|
||||
|
||||
if (hand[i]->x >= hand_x)
|
||||
{
|
||||
card_object_destroy(&hand[i]);
|
||||
@@ -283,14 +291,6 @@ void card_update() // This whole function is currently pretty unoptimized due to
|
||||
sound_played = false;
|
||||
}
|
||||
|
||||
if (!sound_played)
|
||||
{
|
||||
const int pitch_lut[MAX_SELECTION_SIZE] = {1024, 960, 896, 832, 768};
|
||||
mm_sound_effect sfx_draw = {{SFX_CARD_DRAW}, pitch_lut[cards_drawn], 0, 255, 128,};
|
||||
mmEffectEx(&sfx_draw);
|
||||
sound_played = true;
|
||||
}
|
||||
|
||||
discarded_card = true;
|
||||
}
|
||||
else
|
||||
@@ -351,7 +351,7 @@ void card_update() // This whole function is currently pretty unoptimized due to
|
||||
// Hand functions
|
||||
void hand_set_focus(int index)
|
||||
{
|
||||
if (index < 0 || index > hand_top) return;
|
||||
if (index < 0 || index > hand_top || hand_state != HAND_SELECT) return;
|
||||
card_focused = index;
|
||||
|
||||
mm_sound_effect sfx_focus = {{SFX_CARD_FOCUS}, 1024 + rand() % 512, 0, 255, 128,};
|
||||
@@ -391,11 +391,12 @@ void hand_change_sort()
|
||||
sort_cards();
|
||||
}
|
||||
|
||||
void hand_discard()
|
||||
bool hand_discard()
|
||||
{
|
||||
if (hand_state != HAND_SELECT) return;
|
||||
if (hand_state != HAND_SELECT || hand_selections == 0) return false;
|
||||
hand_state = HAND_DISCARD;
|
||||
card_focused = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int hand_get_size()
|
||||
|
||||
Reference in New Issue
Block a user