This reverts commit d3c0357856.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -1 +0,0 @@
|
|||||||
-gB4 -Mw4 -Mh4 -m! -pn 16
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
+3
-9
@@ -40,10 +40,6 @@
|
|||||||
|
|
||||||
#define IMPOSSIBLY_HIGH_CARD_VALUE 100
|
#define IMPOSSIBLY_HIGH_CARD_VALUE 100
|
||||||
|
|
||||||
// Card sprites
|
|
||||||
#define DEFAULT_HIGH_CONTRAST false
|
|
||||||
#define DEFAULT_MORE_READABLE false
|
|
||||||
|
|
||||||
// Card types
|
// Card types
|
||||||
typedef struct Card
|
typedef struct Card
|
||||||
{
|
{
|
||||||
@@ -58,11 +54,9 @@ typedef struct CardObject
|
|||||||
bool selected;
|
bool selected;
|
||||||
} CardObject;
|
} CardObject;
|
||||||
|
|
||||||
// Card sprites accessibility functions
|
// Card functions
|
||||||
void set_cards_high_contrast(bool enable);
|
void card_init();
|
||||||
void set_cards_more_readable(bool enable);
|
void toggle_high_contrast_cards(bool enable);
|
||||||
bool get_cards_high_contrast(void);
|
|
||||||
bool get_cards_more_readable(void);
|
|
||||||
|
|
||||||
// Card methods
|
// Card methods
|
||||||
Card* card_new(u8 suit, u8 rank);
|
Card* card_new(u8 suit, u8 rank);
|
||||||
|
|||||||
@@ -19,9 +19,10 @@
|
|||||||
#define VOLUME_OPTION_MAX 5
|
#define VOLUME_OPTION_MAX 5
|
||||||
#define VOLUME_OPTION_INCREMENT 20
|
#define VOLUME_OPTION_INCREMENT 20
|
||||||
|
|
||||||
#define DEFAULT_GAME_SPEED 1
|
#define DEFAULT_GAME_SPEED 1
|
||||||
#define DEFAULT_MUSIC_VOLUME VOLUME_OPTION_MAX
|
#define DEFAULT_HIGH_CONTRAST false
|
||||||
#define DEFAULT_SOUND_VOLUME VOLUME_OPTION_MAX
|
#define DEFAULT_MUSIC_VOLUME VOLUME_OPTION_MAX
|
||||||
|
#define DEFAULT_SOUND_VOLUME VOLUME_OPTION_MAX
|
||||||
|
|
||||||
#define MAX_HANDS 4
|
#define MAX_HANDS 4
|
||||||
#define MAX_DISCARDS 4
|
#define MAX_DISCARDS 4
|
||||||
@@ -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
|
// 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.
|
// game aspects that should be sped up by speed, as in the original game.
|
||||||
u8 game_speed;
|
u8 game_speed;
|
||||||
|
bool high_contrast;
|
||||||
u8 music_volume;
|
u8 music_volume;
|
||||||
u8 sound_volume;
|
u8 sound_volume;
|
||||||
} GameVariables;
|
} GameVariables;
|
||||||
|
|||||||
+11
-28
@@ -1,6 +1,8 @@
|
|||||||
#include "card.h"
|
#include "card.h"
|
||||||
|
|
||||||
|
#include "deck_gfx.h"
|
||||||
#include "graphic_utils.h"
|
#include "graphic_utils.h"
|
||||||
|
#include "high_contrast_deck_pal_gfx.h"
|
||||||
|
|
||||||
#include <maxmod.h>
|
#include <maxmod.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -9,11 +11,6 @@
|
|||||||
#include "pool.h"
|
#include "pool.h"
|
||||||
#include "soundbank.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
|
// Card sprites lookup table. First index is the suit, second index is the rank. The value is the
|
||||||
// tile index.
|
// tile index.
|
||||||
const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
|
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}
|
{624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool high_contrast = DEFAULT_HIGH_CONTRAST;
|
void card_init()
|
||||||
bool more_readable = DEFAULT_MORE_READABLE;
|
|
||||||
|
|
||||||
void set_cards_high_contrast(bool enable)
|
|
||||||
{
|
{
|
||||||
high_contrast = enable;
|
toggle_high_contrast_cards(false);
|
||||||
if (high_contrast)
|
}
|
||||||
|
|
||||||
|
void toggle_high_contrast_cards(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
{
|
{
|
||||||
GRIT_CPY(&pal_obj_mem[CARD_PB], high_contrast_deck_pal_gfxPal);
|
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 methods
|
||||||
Card* card_new(u8 suit, u8 rank)
|
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)
|
void card_object_set_sprite(CardObject* card_object, int layer)
|
||||||
{
|
{
|
||||||
int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
|
int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
|
||||||
const unsigned int* card_tiles = more_readable ? deck_big_gfxTiles : deck_gfxTiles;
|
|
||||||
memcpy32(
|
memcpy32(
|
||||||
&tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
|
&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
|
TILE_SIZE * CARD_SPRITE_OFFSET
|
||||||
);
|
);
|
||||||
Sprite* sprite = sprite_new(
|
Sprite* sprite = sprite_new(
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ GameVariables g_game_vars = {
|
|||||||
.round_end_blind_token = NULL,
|
.round_end_blind_token = NULL,
|
||||||
|
|
||||||
.game_speed = DEFAULT_GAME_SPEED,
|
.game_speed = DEFAULT_GAME_SPEED,
|
||||||
|
.high_contrast = DEFAULT_HIGH_CONTRAST,
|
||||||
.music_volume = DEFAULT_MUSIC_VOLUME,
|
.music_volume = DEFAULT_MUSIC_VOLUME,
|
||||||
.sound_volume = DEFAULT_SOUND_VOLUME,
|
.sound_volume = DEFAULT_SOUND_VOLUME,
|
||||||
};
|
};
|
||||||
@@ -2598,6 +2599,9 @@ void game_start(void)
|
|||||||
g_game_vars.hands = MAX_HANDS;
|
g_game_vars.hands = MAX_HANDS;
|
||||||
g_game_vars.discards = MAX_DISCARDS;
|
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
|
// 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.
|
// that allows for different decks and card types.
|
||||||
for (int suit = 0; suit < NUM_SUITS; suit++)
|
for (int suit = 0; suit < NUM_SUITS; suit++)
|
||||||
|
|||||||
+58
-90
@@ -4,7 +4,6 @@
|
|||||||
#include "audio_utils.h"
|
#include "audio_utils.h"
|
||||||
#include "background_options_menu_gfx.h"
|
#include "background_options_menu_gfx.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "card.h"
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "game/common_ui.h"
|
#include "game/common_ui.h"
|
||||||
#include "game_variables.h"
|
#include "game_variables.h"
|
||||||
@@ -40,26 +39,23 @@ enum OptionSpeedButtons
|
|||||||
#define MENU_BUTTON_MAIN_COLOR_PAL_IDX 1
|
#define MENU_BUTTON_MAIN_COLOR_PAL_IDX 1
|
||||||
#define SAVE_BUTTON_MAIN_COLOR_PAL_IDX 3
|
#define SAVE_BUTTON_MAIN_COLOR_PAL_IDX 3
|
||||||
#define BACK_BUTTON_MAIN_COLOR_PAL_IDX 4
|
#define BACK_BUTTON_MAIN_COLOR_PAL_IDX 4
|
||||||
#define SPEED_DOWN_BUTTON_OUTLINE_COLOR_PAL_IDX 16
|
#define SPEED_DOWN_BUTTON_OUTLINE_COLOR_PAL_IDX 5
|
||||||
#define SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX 17
|
#define SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX 6
|
||||||
#define SPEED_UP_BUTTON_OUTLINE_COLOR_PAL_IDX 18
|
#define SPEED_UP_BUTTON_OUTLINE_COLOR_PAL_IDX 7
|
||||||
#define CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX 19
|
#define CONTRAST_BUTTON_OUTLINE_COLOR_PAL_IDX 8
|
||||||
#define READABLE_BUTTON_OUTLINE_COLOR_PAL_IDX 20
|
#define MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX 9
|
||||||
#define MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX 21
|
#define SOUND_BUTTON_OUTLINE_COLOR_PAL_IDX 10
|
||||||
#define SOUND_BUTTON_OUTLINE_COLOR_PAL_IDX 22
|
#define SAVE_BUTTON_OUTLINE_COLOR_PAL_IDX 11
|
||||||
#define SAVE_BUTTON_OUTLINE_COLOR_PAL_IDX 23
|
#define BACK_BUTTON_OUTLINE_COLOR_PAL_IDX 12
|
||||||
#define BACK_BUTTON_OUTLINE_COLOR_PAL_IDX 24
|
|
||||||
|
|
||||||
// Define selection grid for the menu buttons
|
// Define selection grid for the menu buttons
|
||||||
|
|
||||||
static void game_speed_down_on_pressed(void);
|
static void game_speed_down_on_pressed(void);
|
||||||
static void game_speed_up_on_pressed(void);
|
static void game_speed_up_on_pressed(void);
|
||||||
static void high_contrast_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 save_on_pressed(void);
|
||||||
static void back_on_pressed(void);
|
static void back_on_pressed(void);
|
||||||
static int options_menu_return_upper_rows_size(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 int options_menu_return_bottom_row_size(void);
|
||||||
static void options_menu_row_on_key_transit(SelectionGrid* selection_grid, Selection* selection);
|
static void options_menu_row_on_key_transit(SelectionGrid* selection_grid, Selection* selection);
|
||||||
static bool game_speed_row_on_selection_changed(
|
static bool game_speed_row_on_selection_changed(
|
||||||
@@ -99,7 +95,7 @@ static SelectionGridRow options_menu_selection_rows[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
HIGH_CONTRAST_ROW_IDX,
|
HIGH_CONTRAST_ROW_IDX,
|
||||||
options_menu_return_card_sprites_row_size,
|
options_menu_return_upper_rows_size,
|
||||||
regular_button_row_on_selection_changed,
|
regular_button_row_on_selection_changed,
|
||||||
options_menu_row_on_key_transit,
|
options_menu_row_on_key_transit,
|
||||||
{.wrap = false}
|
{.wrap = false}
|
||||||
@@ -129,10 +125,7 @@ static SelectionGridRow options_menu_selection_rows[] = {
|
|||||||
|
|
||||||
static Button options_menu_buttons[NB_OPTIONS_ROWS][2] = {
|
static Button options_menu_buttons[NB_OPTIONS_ROWS][2] = {
|
||||||
{{SPEED_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, NULL, NULL}},
|
{{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}},
|
||||||
{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}
|
|
||||||
},
|
|
||||||
{{MUSIC_BUTTON_OUTLINE_COLOR_PAL_IDX, MENU_BUTTON_MAIN_COLOR_PAL_IDX, NULL, 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}},
|
{{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} };
|
{ 4, 22, 5, 23} };
|
||||||
static const BG_POINT OPTIONS_SPEED_VALUE_DEST_POS = {14, 3};
|
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_VALUE_YES_SRC_RECT = { 1, 24, 4, 25};
|
||||||
static const Rect OPTIONS_CONTRAST_CHECK_YES_SRC_RECT = { 2, 24, 3, 25};
|
static const Rect OPTIONS_CONTRAST_VALUE_NO_SRC_RECT = { 6, 24, 9, 25};
|
||||||
static const BG_POINT OPTIONS_CONTRAST_CHECK_DEST_POS = {14, 7};
|
static const BG_POINT OPTIONS_CONTRAST_VALUE_DEST_POS = {13, 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_MUSIC_SLIDER_FULL_SRC = { 9, 20, 9, 20};
|
static const Rect OPTIONS_MUSIC_SLIDER_FULL_SRC = { 9, 20, 9, 20};
|
||||||
static const Rect OPTIONS_MUSIC_SLIDER_MID_SRC = {10, 20, 10, 20};
|
static const Rect OPTIONS_MUSIC_SLIDER_MID_SRC = {10, 20, 10, 20};
|
||||||
@@ -194,13 +184,13 @@ static const u8 OPTIONS_SOUND_SLIDER_SEGMENT_LENGTH = (OPTIONS_SOUND_
|
|||||||
/ VOLUME_OPTION_MAX;
|
/ VOLUME_OPTION_MAX;
|
||||||
|
|
||||||
// Values in pixels
|
// Values in pixels
|
||||||
static const BG_POINT OPTIONS_GAME_SPEED_TEXT_POS = { 82, 16};
|
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_VOLUME_TEXT_POS = { 56, 80};
|
||||||
static const BG_POINT OPTIONS_MUSIC_VALUE_TEXT_POS = {160, 80};
|
static const BG_POINT OPTIONS_MUSIC_VALUE_TEXT_POS = {160, 80};
|
||||||
static const BG_POINT OPTIONS_SOUND_VOLUME_TEXT_POS = { 56, 104};
|
static const BG_POINT OPTIONS_SOUND_VOLUME_TEXT_POS = { 56, 104};
|
||||||
static const BG_POINT OPTIONS_SOUND_VALUE_TEXT_POS = {160, 104};
|
static const BG_POINT OPTIONS_SOUND_VALUE_TEXT_POS = {160, 104};
|
||||||
static const BG_POINT OPTIONS_BACK_SAVE_TEXT_POS = { 64, 136};
|
static const BG_POINT OPTIONS_BACK_SAVE_TEXT_POS = { 64, 136};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define GAME_SPEED_ARROW_HIGHLIGHT_DURATION 10
|
#define GAME_SPEED_ARROW_HIGHLIGHT_DURATION 10
|
||||||
@@ -222,21 +212,8 @@ static void disable_all_outlines_except_self(Selection sel_btn)
|
|||||||
|
|
||||||
for (int j = 0; j < NB_OPTIONS_ROWS; j++)
|
for (int j = 0; j < NB_OPTIONS_ROWS; j++)
|
||||||
{
|
{
|
||||||
int nb_buttons_in_row;
|
int nb_buttons_in_row = (j == SAVE_BACK_ROW_IDX) ? options_menu_return_bottom_row_size()
|
||||||
|
: options_menu_return_upper_rows_size();
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < nb_buttons_in_row; i++)
|
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);
|
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()
|
static void update_game_speed_button_graphics()
|
||||||
{
|
{
|
||||||
// check if need to disable game speed arrows
|
// 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)
|
if (g_game_vars.game_speed == GAME_SPEED_MAX)
|
||||||
? OPTIONS_SPEED_DOWN_DISABLED_BTN_SRC_RECT
|
{
|
||||||
: OPTIONS_SPEED_DOWN_ACTIVE_BTN_SRC_RECT;
|
main_bg_se_copy_rect(OPTIONS_SPEED_UP_DISABLED_BTN_SRC_RECT, OPTIONS_SPEED_UP_BTN_DEST_POS);
|
||||||
main_bg_se_copy_rect(speed_down_btn_tiles, OPTIONS_SPEED_DOWN_BTN_DEST_POS);
|
}
|
||||||
|
else
|
||||||
Rect speed_up_btn_tiles = (g_game_vars.game_speed == GAME_SPEED_MAX)
|
{
|
||||||
? OPTIONS_SPEED_UP_DISABLED_BTN_SRC_RECT
|
main_bg_se_copy_rect(OPTIONS_SPEED_UP_ACTIVE_BTN_SRC_RECT, OPTIONS_SPEED_UP_BTN_DEST_POS);
|
||||||
: OPTIONS_SPEED_UP_ACTIVE_BTN_SRC_RECT;
|
}
|
||||||
main_bg_se_copy_rect(speed_up_btn_tiles, OPTIONS_SPEED_UP_BTN_DEST_POS);
|
|
||||||
|
|
||||||
main_bg_se_copy_rect(
|
main_bg_se_copy_rect(
|
||||||
OPTIONS_SPEED_VALUES[g_game_vars.game_speed - 1],
|
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
|
if (g_game_vars.high_contrast)
|
||||||
: OPTIONS_CONTRAST_CHECK_NO_SRC_RECT;
|
{
|
||||||
main_bg_se_copy_rect(contrast_btn_tiles, OPTIONS_CONTRAST_CHECK_DEST_POS);
|
main_bg_se_copy_rect(OPTIONS_CONTRAST_VALUE_YES_SRC_RECT, OPTIONS_CONTRAST_VALUE_DEST_POS);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
static void update_more_readable_button_graphics(void)
|
{
|
||||||
{
|
main_bg_se_copy_rect(OPTIONS_CONTRAST_VALUE_NO_SRC_RECT, OPTIONS_CONTRAST_VALUE_DEST_POS);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_volume_slider_graphics(enum OptionButtonRows sel_row)
|
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_WHITE_PB
|
||||||
);
|
);
|
||||||
tte_printf(
|
tte_printf(
|
||||||
"#{P:%d,%d; cx:0x%X000}Card Sprites",
|
"#{P:%d,%d; cx:0x%X000}High Contrast Cards",
|
||||||
OPTIONS_CARD_SPRITES_TEXT_POS.x,
|
OPTIONS_HIGH_CONTRAST_TEXT_POS.x,
|
||||||
OPTIONS_CARD_SPRITES_TEXT_POS.y,
|
OPTIONS_HIGH_CONTRAST_TEXT_POS.y,
|
||||||
TTE_WHITE_PB
|
TTE_WHITE_PB
|
||||||
);
|
);
|
||||||
tte_printf(
|
tte_printf(
|
||||||
@@ -408,7 +396,6 @@ void game_options_menu_on_init(void)
|
|||||||
// Do an update on the first frame
|
// Do an update on the first frame
|
||||||
update_game_speed_button_graphics();
|
update_game_speed_button_graphics();
|
||||||
update_high_contrast_button_graphics();
|
update_high_contrast_button_graphics();
|
||||||
update_more_readable_button_graphics();
|
|
||||||
update_volume_slider_graphics(MUSIC_VOLUME_ROW_IDX);
|
update_volume_slider_graphics(MUSIC_VOLUME_ROW_IDX);
|
||||||
update_volume_slider_graphics(SOUND_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)
|
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();
|
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.
|
* @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
|
* @returns 1
|
||||||
*/
|
*/
|
||||||
@@ -496,16 +474,6 @@ static int options_menu_return_upper_rows_size(void)
|
|||||||
return 1;
|
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.
|
* @brief Gives the width of the Save and Back buttons' row.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ void init()
|
|||||||
load_options();
|
load_options();
|
||||||
affine_background_init();
|
affine_background_init();
|
||||||
sprite_init();
|
sprite_init();
|
||||||
|
card_init();
|
||||||
blind_init();
|
blind_init();
|
||||||
joker_init();
|
joker_init();
|
||||||
game_init();
|
game_init();
|
||||||
|
|||||||
+29
-42
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "audio_utils.h"
|
#include "audio_utils.h"
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
#include "card.h"
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "joker.h"
|
#include "joker.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
@@ -56,16 +55,6 @@ typedef struct SaveHeader
|
|||||||
u32 valid_sections;
|
u32 valid_sections;
|
||||||
} SaveHeader;
|
} 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
|
// clang-format off
|
||||||
/**
|
/**
|
||||||
* @brief SaveOptions will only contain options data set in the Options Menu
|
* @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 -"
|
* 1 | 'T' | 'I' | 'O' | 'N' | - | Spells "- OPTIONS DATA -"
|
||||||
* 2 | 'S' | ' ' | 'D' | 'A' | - | -
|
* 2 | 'S' | ' ' | 'D' | 'A' | - | -
|
||||||
* 3 | 'T' | 'A' | ' ' | '-' | - | -
|
* 3 | 'T' | 'A' | ' ' | '-' | - | -
|
||||||
* 4 | SPEED | CNTRST | READBL | MUSIC | OPTN_VALUES | All 5 option values, followed by some padding,
|
* 4 | SPEED | CNTRST | MUSIC | SOUND | OPTN_VALUES | All 4 option values, packed in a single word.
|
||||||
* 5 | SOUND | UNDEF | UNDEF | UNDEF | - | so that the next section starts at the beginning of the
|
* 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
|
* 6 | UNDEF | UNDEF | UNDEF | UNDEF | - | next 4-word row in a hex viewer
|
||||||
* 7 | UNDEF | UNDEF | UNDEF | UNDEF | - | -
|
* 7 | UNDEF | UNDEF | UNDEF | UNDEF | - | -
|
||||||
*/
|
*/
|
||||||
@@ -86,33 +75,12 @@ typedef struct SaveOptions
|
|||||||
{
|
{
|
||||||
char tag_options[SAVE_LABEL_SIZE];
|
char tag_options[SAVE_LABEL_SIZE];
|
||||||
u8 game_speed;
|
u8 game_speed;
|
||||||
bool cards_high_contrast;
|
bool high_contrast;
|
||||||
bool cards_more_readable;
|
|
||||||
u8 music_volume;
|
u8 music_volume;
|
||||||
u8 sound_volume;
|
u8 sound_volume;
|
||||||
s8 padding[11];
|
u32 padding[3];
|
||||||
} SaveOptions;
|
} 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.
|
* @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
|
* 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 round;
|
||||||
int ante;
|
int ante;
|
||||||
int money;
|
int money;
|
||||||
s32 padding[2];
|
u32 padding[2];
|
||||||
|
|
||||||
char tag_jokers[SAVE_LABEL_SIZE];
|
char tag_jokers[SAVE_LABEL_SIZE];
|
||||||
JokerObjectSaveData jokers_data[MAX_JOKERS_HELD_SIZE];
|
JokerObjectSaveData jokers_data[MAX_JOKERS_HELD_SIZE];
|
||||||
@@ -171,6 +139,28 @@ typedef struct SaveGame
|
|||||||
char tag_end[4];
|
char tag_end[4];
|
||||||
} SaveGame;
|
} 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.
|
* @brief Default value for the SaveGame struct, with tags already set.
|
||||||
*/
|
*/
|
||||||
@@ -303,8 +293,7 @@ void save_options(void)
|
|||||||
SaveOptions options = SaveOptions_default;
|
SaveOptions options = SaveOptions_default;
|
||||||
|
|
||||||
options.game_speed = g_game_vars.game_speed;
|
options.game_speed = g_game_vars.game_speed;
|
||||||
options.cards_high_contrast = get_cards_high_contrast();
|
options.high_contrast = g_game_vars.high_contrast;
|
||||||
options.cards_more_readable = get_cards_more_readable();
|
|
||||||
options.music_volume = g_game_vars.music_volume;
|
options.music_volume = g_game_vars.music_volume;
|
||||||
options.sound_volume = g_game_vars.sound_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));
|
read_sram(OPTIONS_ADDRESS, (u8*)&options, sizeof(options));
|
||||||
|
|
||||||
g_game_vars.game_speed = options.game_speed;
|
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.music_volume = options.music_volume;
|
||||||
g_game_vars.sound_volume = options.sound_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);
|
mmSetModuleVolume(MM_MODULE_FULL_VOLUME * g_game_vars.music_volume / VOLUME_OPTION_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user