[Feature] Implement seeded runs by adding a Seed selection menu (#482)
* initial commit * wip * WIP * WIP * clang format * Choose Seed navigation mostly done * seed input navigation done * seed input done * cleanup and clang format * Implement base 10 to 36 conversions * Enable seeded runs * clang format * show default deck sprite, name and description * Rename Deck enum to DeckType * Implement arbitrary 9-patch expand system * Make 9-patch example smaller in the docs * Improve NinePatchRect docs * fix Deck back side sprite palette * clang format * Add last deck description * clang format * Fix 'Z' in seed input keyboard * Fix rebase issue * fix deck sprite not updating * Documents static funcs in run_setup.c * more documentation * clang format * Move Play button to the left in its row * Tests WIP * removing tests for random.h * use the new StateMachine struct * First wave of fixes * Fix the 9-patch again * Changed the base 36 logic so it's in big endian * properly set end of base 36 string to '\0' * typos * fix cursor position after rolling a seed + fix random seed generation * Make keyboard more intuitive to use * static const var * Address more comment from @ricfehr3 * clang format * clang format * clang format * clang format * clang format * clang format * clang format * fix deck palette * create the `DEF_SEED_KEYBOARD_BUTTON_OBJECT` macro * Replace `expand_3x3` by a call to `expand_9-patch` * clang format * clang format * clang format * fix rebase iussue in state_machine.h --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
+29
-3
@@ -12,6 +12,7 @@
|
||||
// Card Sprites and Palettes
|
||||
#include "deck_big_gfx.h"
|
||||
#include "deck_gfx.h"
|
||||
#include "decks_face_down_gfx.h"
|
||||
#include "high_contrast_deck_pal_gfx.h"
|
||||
|
||||
// Card sprites lookup table. First index is the suit, second index is the rank. The value is the
|
||||
@@ -22,20 +23,27 @@ const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
|
||||
{416, 432, 448, 464, 480, 496, 512, 528, 544, 560, 576, 592, 608},
|
||||
{624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816}
|
||||
};
|
||||
// Deck sprites lookup table. Index is the deck Id. The value is the tile index.
|
||||
const static u16 _deck_sprite_lut[DECK_TYPE_MAX] = {0, 16, 32, 48, 64, 80};
|
||||
|
||||
bool high_contrast = DEFAULT_HIGH_CONTRAST;
|
||||
bool more_readable = DEFAULT_MORE_READABLE;
|
||||
|
||||
void card_init()
|
||||
{
|
||||
GRIT_CPY(&pal_obj_mem[DECK_SPRITES_PB * PAL_ROW_LEN], decks_face_down_gfxPal);
|
||||
}
|
||||
|
||||
void set_cards_high_contrast(bool enable)
|
||||
{
|
||||
high_contrast = enable;
|
||||
if (high_contrast)
|
||||
{
|
||||
GRIT_CPY(&pal_obj_mem[CARD_PB], high_contrast_deck_pal_gfxPal);
|
||||
GRIT_CPY(&pal_obj_mem[CARD_PB * PAL_ROW_LEN], high_contrast_deck_pal_gfxPal);
|
||||
}
|
||||
else
|
||||
{
|
||||
GRIT_CPY(&pal_obj_mem[CARD_PB], deck_gfxPal);
|
||||
GRIT_CPY(&pal_obj_mem[CARD_PB * PAL_ROW_LEN], deck_gfxPal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +138,25 @@ void card_object_set_sprite(CardObject* card_object, int layer)
|
||||
ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF,
|
||||
ATTR1_SIZE_32,
|
||||
tile_index,
|
||||
0,
|
||||
CARD_PB,
|
||||
layer + CARD_STARTING_LAYER
|
||||
);
|
||||
sprite_object_set_sprite(card_object->sprite_object, sprite);
|
||||
}
|
||||
|
||||
void card_object_set_sprite_face_down(CardObject* card_object, enum DeckType deck, int layer)
|
||||
{
|
||||
int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
|
||||
memcpy32(
|
||||
&tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
|
||||
&decks_face_down_gfxTiles[_deck_sprite_lut[deck] * TILE_SIZE],
|
||||
TILE_SIZE * CARD_SPRITE_OFFSET
|
||||
);
|
||||
Sprite* sprite = sprite_new(
|
||||
ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF,
|
||||
ATTR1_SIZE_32,
|
||||
tile_index,
|
||||
DECK_SPRITES_PB,
|
||||
layer + CARD_STARTING_LAYER
|
||||
);
|
||||
sprite_object_set_sprite(card_object->sprite_object, sprite);
|
||||
|
||||
Reference in New Issue
Block a user