Revert "Add option to enable a more readable deck, suggestion by @Turro75 (#495)" (#510)

This reverts commit d3c0357856.
This commit is contained in:
Rickey
2026-05-25 11:01:13 -07:00
committed by GitHub
parent d3c0357856
commit cebdebbfd0
10 changed files with 111 additions and 173 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

-1
View File
@@ -1 +0,0 @@
-gB4 -Mw4 -Mh4 -m! -pn 16
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

+3 -9
View File
@@ -40,10 +40,6 @@
#define IMPOSSIBLY_HIGH_CARD_VALUE 100
// Card sprites
#define DEFAULT_HIGH_CONTRAST false
#define DEFAULT_MORE_READABLE false
// Card types
typedef struct Card
{
@@ -58,11 +54,9 @@ typedef struct CardObject
bool selected;
} CardObject;
// Card sprites accessibility functions
void set_cards_high_contrast(bool enable);
void set_cards_more_readable(bool enable);
bool get_cards_high_contrast(void);
bool get_cards_more_readable(void);
// Card functions
void card_init();
void toggle_high_contrast_cards(bool enable);
// Card methods
Card* card_new(u8 suit, u8 rank);
+2
View File
@@ -20,6 +20,7 @@
#define VOLUME_OPTION_INCREMENT 20
#define DEFAULT_GAME_SPEED 1
#define DEFAULT_HIGH_CONTRAST false
#define DEFAULT_MUSIC_VOLUME VOLUME_OPTION_MAX
#define DEFAULT_SOUND_VOLUME VOLUME_OPTION_MAX
@@ -65,6 +66,7 @@ typedef struct
// BY DEFAULT IS SET TO 1, but if changed to 2 or more, should speed up all (or most) of the
// game aspects that should be sped up by speed, as in the original game.
u8 game_speed;
bool high_contrast;
u8 music_volume;
u8 sound_volume;
} GameVariables;
+11 -28
View File
@@ -1,6 +1,8 @@
#include "card.h"
#include "deck_gfx.h"
#include "graphic_utils.h"
#include "high_contrast_deck_pal_gfx.h"
#include <maxmod.h>
#include <stdlib.h>
@@ -9,11 +11,6 @@
#include "pool.h"
#include "soundbank.h"
// Card Sprites and Palettes
#include "deck_big_gfx.h"
#include "deck_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
// tile index.
const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
@@ -23,13 +20,14 @@ const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
{624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816}
};
bool high_contrast = DEFAULT_HIGH_CONTRAST;
bool more_readable = DEFAULT_MORE_READABLE;
void set_cards_high_contrast(bool enable)
void card_init()
{
high_contrast = enable;
if (high_contrast)
toggle_high_contrast_cards(false);
}
void toggle_high_contrast_cards(bool enable)
{
if (enable)
{
GRIT_CPY(&pal_obj_mem[CARD_PB], high_contrast_deck_pal_gfxPal);
}
@@ -39,21 +37,6 @@ void set_cards_high_contrast(bool enable)
}
}
void set_cards_more_readable(bool enable)
{
more_readable = enable;
}
bool get_cards_high_contrast(void)
{
return high_contrast;
}
bool get_cards_more_readable(void)
{
return more_readable;
}
// Card methods
Card* card_new(u8 suit, u8 rank)
{
@@ -120,10 +103,10 @@ void card_object_update(CardObject* card_object)
void card_object_set_sprite(CardObject* card_object, int layer)
{
int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
const unsigned int* card_tiles = more_readable ? deck_big_gfxTiles : deck_gfxTiles;
memcpy32(
&tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
&card_tiles[_card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
&deck_gfxTiles
[_card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
TILE_SIZE * CARD_SPRITE_OFFSET
);
Sprite* sprite = sprite_new(
+4
View File
@@ -289,6 +289,7 @@ GameVariables g_game_vars = {
.round_end_blind_token = NULL,
.game_speed = DEFAULT_GAME_SPEED,
.high_contrast = DEFAULT_HIGH_CONTRAST,
.music_volume = DEFAULT_MUSIC_VOLUME,
.sound_volume = DEFAULT_SOUND_VOLUME,
};
@@ -2598,6 +2599,9 @@ void game_start(void)
g_game_vars.hands = MAX_HANDS;
g_game_vars.discards = MAX_DISCARDS;
// Activate high contrast palette for cards if loaded settings tell us to
toggle_high_contrast_cards(g_game_vars.high_contrast);
// Fill the deck with all the cards. Later on this can be replaced with a more dynamic system
// that allows for different decks and card types.
for (int suit = 0; suit < NUM_SUITS; suit++)
+50 -82
View File
@@ -4,7 +4,6 @@
#include "audio_utils.h"
#include "background_options_menu_gfx.h"
#include "button.h"
#include "card.h"
#include "game.h"
#include "game/common_ui.h"
#include "game_variables.h"
@@ -40,26 +39,23 @@ enum OptionSpeedButtons
#define MENU_BUTTON_MAIN_COLOR_PAL_IDX 1
#define SAVE_BUTTON_MAIN_COLOR_PAL_IDX 3
#define BACK_BUTTON_MAIN_COLOR_PAL_IDX 4
#define SPEED_DOWN_BUTTON_OUTLINE_COLOR_PAL_IDX 16
#define SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX 17
#define SPEED_UP_BUTTON_OUTLINE_COLOR_PAL_IDX 18
#define CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX 19
#define READABLE_BUTTON_OUTLINE_COLOR_PAL_IDX 20
#define MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX 21
#define SOUND_BUTTON_OUTLINE_COLOR_PAL_IDX 22
#define SAVE_BUTTON_OUTLINE_COLOR_PAL_IDX 23
#define BACK_BUTTON_OUTLINE_COLOR_PAL_IDX 24
#define SPEED_DOWN_BUTTON_OUTLINE_COLOR_PAL_IDX 5
#define SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX 6
#define SPEED_UP_BUTTON_OUTLINE_COLOR_PAL_IDX 7
#define CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX 8
#define MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX 9
#define SOUND_BUTTON_OUTLINE_COLOR_PAL_IDX 10
#define SAVE_BUTTON_OUTLINE_COLOR_PAL_IDX 11
#define BACK_BUTTON_OUTLINE_COLOR_PAL_IDX 12
// Define selection grid for the menu buttons
static void game_speed_down_on_pressed(void);
static void game_speed_up_on_pressed(void);
static void high_contrast_on_pressed(void);
static void more_readable_on_pressed(void);
static void save_on_pressed(void);
static void back_on_pressed(void);
static int options_menu_return_upper_rows_size(void);
static int options_menu_return_card_sprites_row_size(void);
static int options_menu_return_bottom_row_size(void);
static void options_menu_row_on_key_transit(SelectionGrid* selection_grid, Selection* selection);
static bool game_speed_row_on_selection_changed(
@@ -99,7 +95,7 @@ static SelectionGridRow options_menu_selection_rows[] = {
},
{
HIGH_CONTRAST_ROW_IDX,
options_menu_return_card_sprites_row_size,
options_menu_return_upper_rows_size,
regular_button_row_on_selection_changed,
options_menu_row_on_key_transit,
{.wrap = false}
@@ -129,10 +125,7 @@ static SelectionGridRow options_menu_selection_rows[] = {
static Button options_menu_buttons[NB_OPTIONS_ROWS][2] = {
{{SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, NULL, NULL}},
{
{CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, high_contrast_on_pressed, NULL},
{READABLE_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, more_readable_on_pressed, NULL}
},
{{CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, high_contrast_on_pressed, NULL}},
{{MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, NULL, NULL}},
{{SOUND_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, NULL, NULL}},
{
@@ -171,12 +164,9 @@ static const Rect OPTIONS_SPEED_VALUES[GAME_SPEED_MAX] = { { 3, 20, 4, 21
{ 4, 22, 5, 23} };
static const BG_POINT OPTIONS_SPEED_VALUE_DEST_POS = {14, 3};
static const Rect OPTIONS_CONTRAST_CHECK_NO_SRC_RECT = { 0, 24, 1, 25};
static const Rect OPTIONS_CONTRAST_CHECK_YES_SRC_RECT = { 2, 24, 3, 25};
static const BG_POINT OPTIONS_CONTRAST_CHECK_DEST_POS = {14, 7};
static const Rect OPTIONS_READABLE_CHECK_NO_SRC_RECT = { 4, 24, 5, 25};
static const Rect OPTIONS_READABLE_CHECK_YES_SRC_RECT = { 6, 24, 7, 25};
static const BG_POINT OPTIONS_READABLE_CHECK_DEST_POS = {21, 7};
static const Rect OPTIONS_CONTRAST_VALUE_YES_SRC_RECT = { 1, 24, 4, 25};
static const Rect OPTIONS_CONTRAST_VALUE_NO_SRC_RECT = { 6, 24, 9, 25};
static const BG_POINT OPTIONS_CONTRAST_VALUE_DEST_POS = {13, 7};
static const Rect OPTIONS_MUSIC_SLIDER_FULL_SRC = { 9, 20, 9, 20};
static const Rect OPTIONS_MUSIC_SLIDER_MID_SRC = {10, 20, 10, 20};
@@ -195,7 +185,7 @@ static const u8 OPTIONS_SOUND_SLIDER_SEGMENT_LENGTH = (OPTIONS_SOUND_
// Values in pixels
static const BG_POINT OPTIONS_GAME_SPEED_TEXT_POS = { 82, 16};
static const BG_POINT OPTIONS_CARD_SPRITES_TEXT_POS = { 72, 48};
static const BG_POINT OPTIONS_HIGH_CONTRAST_TEXT_POS = { 40, 48};
static const BG_POINT OPTIONS_MUSIC_VOLUME_TEXT_POS = { 56, 80};
static const BG_POINT OPTIONS_MUSIC_VALUE_TEXT_POS = {160, 80};
static const BG_POINT OPTIONS_SOUND_VOLUME_TEXT_POS = { 56, 104};
@@ -222,21 +212,8 @@ static void disable_all_outlines_except_self(Selection sel_btn)
for (int j = 0; j < NB_OPTIONS_ROWS; j++)
{
int nb_buttons_in_row;
switch (j)
{
case HIGH_CONTRAST_ROW_IDX:
nb_buttons_in_row = options_menu_return_card_sprites_row_size();
break;
case SAVE_BACK_ROW_IDX:
nb_buttons_in_row = options_menu_return_bottom_row_size();
break;
default:
nb_buttons_in_row = options_menu_return_upper_rows_size();
break;
}
int nb_buttons_in_row = (j == SAVE_BACK_ROW_IDX) ? options_menu_return_bottom_row_size()
: options_menu_return_upper_rows_size();
for (int i = 0; i < nb_buttons_in_row; i++)
{
button_set_highlight(&options_menu_buttons[j][i], i == sel_btn.x && j == sel_btn.y);
@@ -247,16 +224,29 @@ static void disable_all_outlines_except_self(Selection sel_btn)
static void update_game_speed_button_graphics()
{
// check if need to disable game speed arrows
if (g_game_vars.game_speed == GAME_SPEED_MIN)
{
main_bg_se_copy_rect(
OPTIONS_SPEED_DOWN_DISABLED_BTN_SRC_RECT,
OPTIONS_SPEED_DOWN_BTN_DEST_POS
);
}
else
{
main_bg_se_copy_rect(
OPTIONS_SPEED_DOWN_ACTIVE_BTN_SRC_RECT,
OPTIONS_SPEED_DOWN_BTN_DEST_POS
);
}
Rect speed_down_btn_tiles = (g_game_vars.game_speed == GAME_SPEED_MIN)
? OPTIONS_SPEED_DOWN_DISABLED_BTN_SRC_RECT
: OPTIONS_SPEED_DOWN_ACTIVE_BTN_SRC_RECT;
main_bg_se_copy_rect(speed_down_btn_tiles, OPTIONS_SPEED_DOWN_BTN_DEST_POS);
Rect speed_up_btn_tiles = (g_game_vars.game_speed == GAME_SPEED_MAX)
? OPTIONS_SPEED_UP_DISABLED_BTN_SRC_RECT
: OPTIONS_SPEED_UP_ACTIVE_BTN_SRC_RECT;
main_bg_se_copy_rect(speed_up_btn_tiles, OPTIONS_SPEED_UP_BTN_DEST_POS);
if (g_game_vars.game_speed == GAME_SPEED_MAX)
{
main_bg_se_copy_rect(OPTIONS_SPEED_UP_DISABLED_BTN_SRC_RECT, OPTIONS_SPEED_UP_BTN_DEST_POS);
}
else
{
main_bg_se_copy_rect(OPTIONS_SPEED_UP_ACTIVE_BTN_SRC_RECT, OPTIONS_SPEED_UP_BTN_DEST_POS);
}
main_bg_se_copy_rect(
OPTIONS_SPEED_VALUES[g_game_vars.game_speed - 1],
@@ -264,18 +254,16 @@ static void update_game_speed_button_graphics()
);
}
static void update_high_contrast_button_graphics(void)
static void update_high_contrast_button_graphics()
{
Rect contrast_btn_tiles = (get_cards_high_contrast()) ? OPTIONS_CONTRAST_CHECK_YES_SRC_RECT
: OPTIONS_CONTRAST_CHECK_NO_SRC_RECT;
main_bg_se_copy_rect(contrast_btn_tiles, OPTIONS_CONTRAST_CHECK_DEST_POS);
if (g_game_vars.high_contrast)
{
main_bg_se_copy_rect(OPTIONS_CONTRAST_VALUE_YES_SRC_RECT, OPTIONS_CONTRAST_VALUE_DEST_POS);
}
static void update_more_readable_button_graphics(void)
else
{
Rect readable_btn_tiles = (get_cards_more_readable()) ? OPTIONS_READABLE_CHECK_YES_SRC_RECT
: OPTIONS_READABLE_CHECK_NO_SRC_RECT;
main_bg_se_copy_rect(readable_btn_tiles, OPTIONS_READABLE_CHECK_DEST_POS);
main_bg_se_copy_rect(OPTIONS_CONTRAST_VALUE_NO_SRC_RECT, OPTIONS_CONTRAST_VALUE_DEST_POS);
}
}
static void update_volume_slider_graphics(enum OptionButtonRows sel_row)
@@ -372,9 +360,9 @@ void game_options_menu_change_background(void)
TTE_WHITE_PB
);
tte_printf(
"#{P:%d,%d; cx:0x%X000}Card Sprites",
OPTIONS_CARD_SPRITES_TEXT_POS.x,
OPTIONS_CARD_SPRITES_TEXT_POS.y,
"#{P:%d,%d; cx:0x%X000}High Contrast Cards",
OPTIONS_HIGH_CONTRAST_TEXT_POS.x,
OPTIONS_HIGH_CONTRAST_TEXT_POS.y,
TTE_WHITE_PB
);
tte_printf(
@@ -408,7 +396,6 @@ void game_options_menu_on_init(void)
// Do an update on the first frame
update_game_speed_button_graphics();
update_high_contrast_button_graphics();
update_more_readable_button_graphics();
update_volume_slider_graphics(MUSIC_VOLUME_ROW_IDX);
update_volume_slider_graphics(SOUND_VOLUME_ROW_IDX);
}
@@ -455,19 +442,10 @@ static void game_speed_up_on_pressed(void)
*/
static void high_contrast_on_pressed(void)
{
set_cards_high_contrast(!get_cards_high_contrast());
g_game_vars.high_contrast = (g_game_vars.high_contrast == 1) ? false : true;
update_high_contrast_button_graphics();
}
/**
* @brief Handles input for the more readable card toggle button and nothing more.
*/
static void more_readable_on_pressed(void)
{
set_cards_more_readable(!get_cards_more_readable());
update_more_readable_button_graphics();
}
/**
* @brief Handles input for the Save button.
*/
@@ -487,7 +465,7 @@ static void back_on_pressed(void)
}
/**
* @brief Gives the width of normal options rows in selection grid.
* @brief Gives the width of upper options menu rows in selection grid.
*
* @returns 1
*/
@@ -496,16 +474,6 @@ static int options_menu_return_upper_rows_size(void)
return 1;
}
/**
* @brief Gives the width of Card Sprites options row in selection grid.
*
* @returns 2
*/
static int options_menu_return_card_sprites_row_size(void)
{
return 2;
}
/**
* @brief Gives the width of the Save and Back buttons' row.
*
+1
View File
@@ -96,6 +96,7 @@ void init()
load_options();
affine_background_init();
sprite_init();
card_init();
blind_init();
joker_init();
game_init();
+29 -42
View File
@@ -5,7 +5,6 @@
#include "audio_utils.h"
#include "bitset.h"
#include "card.h"
#include "game.h"
#include "joker.h"
#include "list.h"
@@ -56,16 +55,6 @@ typedef struct SaveHeader
u32 valid_sections;
} SaveHeader;
/**
* @brief Default value for the SaveHeader struct.
*/
static const SaveHeader SaveHeader_default = {
.magic = CHECK_MAGIC,
.dirty = false,
.githash = "fffffff",
.valid_sections = SAVE_SECTION_FLAG_NONE
};
// clang-format off
/**
* @brief SaveOptions will only contain options data set in the Options Menu
@@ -76,8 +65,8 @@ static const SaveHeader SaveHeader_default = {
* 1 | 'T' | 'I' | 'O' | 'N' | - | Spells "- OPTIONS DATA -"
* 2 | 'S' | ' ' | 'D' | 'A' | - | -
* 3 | 'T' | 'A' | ' ' | '-' | - | -
* 4 | SPEED | CNTRST | READBL | MUSIC | OPTN_VALUES | All 5 option values, followed by some padding,
* 5 | SOUND | UNDEF | UNDEF | UNDEF | - | so that the next section starts at the beginning of the
* 4 | SPEED | CNTRST | MUSIC | SOUND | OPTN_VALUES | All 4 option values, packed in a single word.
* 5 | UNDEF | UNDEF | UNDEF | UNDEF | PADDING | Padding, so that the next section starts at the beginning of the
* 6 | UNDEF | UNDEF | UNDEF | UNDEF | - | next 4-word row in a hex viewer
* 7 | UNDEF | UNDEF | UNDEF | UNDEF | - | -
*/
@@ -86,33 +75,12 @@ typedef struct SaveOptions
{
char tag_options[SAVE_LABEL_SIZE];
u8 game_speed;
bool cards_high_contrast;
bool cards_more_readable;
bool high_contrast;
u8 music_volume;
u8 sound_volume;
s8 padding[11];
u32 padding[3];
} SaveOptions;
/**
* @brief Default value for the SaveOptions struct, with tags already set.
*/
// clang-format off
static const SaveOptions SaveOptions_default = {
.tag_options = "- OPTIONS DATA -",
.game_speed = GAME_SPEED_MIN,
.cards_high_contrast = DEFAULT_HIGH_CONTRAST,
.cards_more_readable = DEFAULT_MORE_READABLE,
.music_volume = VOLUME_OPTION_MAX,
.sound_volume = VOLUME_OPTION_MAX,
.padding = {
UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED, UNDEFINED,
UNDEFINED, UNDEFINED
}
};
// clang-format on
/**
* @brief JokerObjectSaveData will hold the minimal amount of data necessary to reconstruct a Joker.
* The `id` is a u8 in the base Joker struct, but I made it a u32 here to keep
@@ -163,7 +131,7 @@ typedef struct SaveGame
int round;
int ante;
int money;
s32 padding[2];
u32 padding[2];
char tag_jokers[SAVE_LABEL_SIZE];
JokerObjectSaveData jokers_data[MAX_JOKERS_HELD_SIZE];
@@ -171,6 +139,28 @@ typedef struct SaveGame
char tag_end[4];
} SaveGame;
/**
* @brief Default value for the SaveHeader struct.
*/
static const SaveHeader SaveHeader_default = {
.magic = CHECK_MAGIC,
.dirty = false,
.githash = "fffffff",
.valid_sections = SAVE_SECTION_FLAG_NONE
};
/**
* @brief Default value for the SaveOptions struct, with tags already set.
*/
static const SaveOptions SaveOptions_default = {
.tag_options = "- OPTIONS DATA -",
.game_speed = GAME_SPEED_MIN,
.high_contrast = DEFAULT_HIGH_CONTRAST,
.music_volume = VOLUME_OPTION_MAX,
.sound_volume = VOLUME_OPTION_MAX,
.padding = {UNDEFINED, UNDEFINED, UNDEFINED},
};
/**
* @brief Default value for the SaveGame struct, with tags already set.
*/
@@ -303,8 +293,7 @@ void save_options(void)
SaveOptions options = SaveOptions_default;
options.game_speed = g_game_vars.game_speed;
options.cards_high_contrast = get_cards_high_contrast();
options.cards_more_readable = get_cards_more_readable();
options.high_contrast = g_game_vars.high_contrast;
options.music_volume = g_game_vars.music_volume;
options.sound_volume = g_game_vars.sound_volume;
@@ -323,12 +312,10 @@ void load_options(void)
read_sram(OPTIONS_ADDRESS, (u8*)&options, sizeof(options));
g_game_vars.game_speed = options.game_speed;
g_game_vars.high_contrast = options.high_contrast;
g_game_vars.music_volume = options.music_volume;
g_game_vars.sound_volume = options.sound_volume;
set_cards_high_contrast(options.cards_high_contrast);
set_cards_more_readable(options.cards_more_readable);
mmSetModuleVolume(MM_MODULE_FULL_VOLUME * g_game_vars.music_volume / VOLUME_OPTION_MAX);
}