Refactor/blind select screen (#461)
Refactor Blind Select Screen. Based on #363 --------- Co-authored-by: emiyl <me@emiyl.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
emiyl
Copilot Autofix powered by AI
parent
877bd09576
commit
d01b1ba12d
@@ -24,6 +24,16 @@
|
||||
#define BLIND_TOKENS_PER_SPRITESHEET 2
|
||||
#define BLIND_TOKEN_PALETTE_SIZE 8
|
||||
|
||||
// The sprites that display the blinds when in "GAME_BLIND_SELECT" state
|
||||
// There are only 3 blinds per Ante, so we don't need more sprites than that
|
||||
enum BlindTokens
|
||||
{
|
||||
SMALL_BLIND,
|
||||
BIG_BLIND,
|
||||
BOSS_BLIND,
|
||||
NUM_BLINDS_PER_ANTE
|
||||
};
|
||||
|
||||
// Order of the Blind sprites' colors as encoded in the files' palettes with Aseprite
|
||||
enum BlindColorIndex
|
||||
{
|
||||
|
||||
+7
-4
@@ -1,9 +1,8 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include "blind.h"
|
||||
#include "game/common_ui.h"
|
||||
#include "game_variables.h"
|
||||
#include "graphic_utils.h"
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
@@ -123,6 +122,7 @@ typedef struct ContainedHandTypes
|
||||
// clang-format on
|
||||
|
||||
typedef void (*GameStateCallback)(void);
|
||||
typedef void (*SubStateActionFn)(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -163,8 +163,6 @@ void set_mult(u32 new_mult);
|
||||
void display_mult(void);
|
||||
void display_money(void);
|
||||
void set_retrigger(bool new_retrigger);
|
||||
enum BlindType get_current_blind(void);
|
||||
enum BlindType get_next_boss_blind(void);
|
||||
|
||||
u32 get_rand(void);
|
||||
|
||||
@@ -179,4 +177,9 @@ void game_start(void);
|
||||
// old system incrementally and without losing functionality.
|
||||
void change_background_legacy(enum BackgroundId id);
|
||||
|
||||
void display_round(void);
|
||||
void reset_top_left_panel_bottom_row(void);
|
||||
|
||||
void reset_background(void);
|
||||
|
||||
#endif // GAME_H
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @file blind_select.h
|
||||
*
|
||||
* @brief Blind select state functions
|
||||
*/
|
||||
#ifndef GAME_BLIND_SELECT_H
|
||||
#define GAME_BLIND_SELECT_H
|
||||
|
||||
#include "blind.h"
|
||||
|
||||
/**
|
||||
* @brief Change to the blind select background
|
||||
*/
|
||||
void game_blind_select_change_background(void);
|
||||
|
||||
/**
|
||||
* @brief Blind select state initialization
|
||||
*/
|
||||
void game_blind_select_on_init(void);
|
||||
|
||||
/**
|
||||
* @brief Blind select state update
|
||||
*/
|
||||
void game_blind_select_on_update(void);
|
||||
|
||||
/**
|
||||
* @brief Blind select cleanup
|
||||
*/
|
||||
void game_blind_select_on_exit(void);
|
||||
|
||||
void increment_blind(enum BlindState increment_reason);
|
||||
|
||||
#endif // GAME_BLIND_SELECT_H
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef COMMON_UI_H
|
||||
#define COMMON_UI_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief Enum of possible backgrounds to render with @ref change_background
|
||||
*/
|
||||
@@ -26,6 +28,6 @@ enum BackgroundId
|
||||
*
|
||||
* @param id @ref BackgroundId to render to screen
|
||||
*/
|
||||
void change_background(enum BackgroundId id);
|
||||
void change_background(enum BackgroundId id, bool force_redraw);
|
||||
|
||||
#endif // COMMON_UI_H
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef GAME_VARIABLES_H
|
||||
#define GAME_VARIABLES_H
|
||||
|
||||
#include "blind.h"
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
#define GAME_SPEED_MIN 1
|
||||
@@ -41,6 +43,12 @@ typedef struct
|
||||
int ante;
|
||||
int money;
|
||||
|
||||
// Blind variables
|
||||
|
||||
enum BlindType current_blind;
|
||||
enum BlindType next_boss_blind;
|
||||
enum BlindState blinds_states[NUM_BLINDS_PER_ANTE];
|
||||
|
||||
// Options variables
|
||||
|
||||
// BY DEFAULT IS SET TO 1, but if changed to 2 or more, should speed up all (or most) of the
|
||||
|
||||
@@ -357,4 +357,9 @@ void memcpy32_tile8_with_palette_offset(u32* dst, const u32* src, uint wcount, u
|
||||
*/
|
||||
void toggle_windows(bool win0, bool win1);
|
||||
|
||||
/**
|
||||
* @brief Restores the bottom row of the top-left panel from the background map.
|
||||
*/
|
||||
void reset_top_left_panel_bottom_row(void);
|
||||
|
||||
#endif // GRAPHIC_UTILS_H
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @file layout.h
|
||||
*
|
||||
* @brief Header of shared rects and points needed for ui
|
||||
*/
|
||||
#ifndef LAYOUT_H
|
||||
#define LAYOUT_H
|
||||
|
||||
#include "graphic_utils.h"
|
||||
|
||||
// clang-format off
|
||||
// Points x y
|
||||
static const BG_POINT CUR_BLIND_TOKEN_POS = {8, 18};
|
||||
static const BG_POINT TOP_LEFT_PANEL_POINT = {0, 0, };
|
||||
// Rects left top right bottom
|
||||
static const Rect TOP_LEFT_PANEL_ANIM_RECT = {0, 0, 8, 4};
|
||||
static const Rect POP_MENU_ANIM_RECT = {9, 7, 24, 31};
|
||||
static const Rect TOP_LEFT_ITEM_SRC_RECT = {0, 20, 8, 25};
|
||||
// clang-format on
|
||||
|
||||
#endif // LAYOUT_H
|
||||
+3
-1
@@ -9,4 +9,6 @@
|
||||
|
||||
#define TM_ZERO 0
|
||||
|
||||
#endif // TIMER_H
|
||||
#define MENU_POP_OUT_ANIM_FRAMES 20
|
||||
|
||||
#endif // TIMER_H
|
||||
|
||||
Reference in New Issue
Block a user