Refactor/shop (#475)

* initial commit, DOES NOT COMPILE

* Rename joker interactions file to `joker_row`

* IT'S WORKIIING (now to make it pretty lol)

* fixed rebase issues

* fix rebase + undo state machine changes

* Document shop state functions

* clang format

* fix reroll cost not appearing on shop init

* Move generic SpriteObject text/price printing functions to sprite.c + some minor fixes

* Resolve weird defines/include order issue

* clang format

* Implement suggestions from @ricfehr3

* clang format

* clang format

* fix rebase

* Implement sugegstions from @ricfehr3

* Refactored shop to use the Button struct

* missed some memsets

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
This commit is contained in:
Geralt
2026-05-15 18:36:19 -07:00
committed by GitHub
co-authored by MathisMartin31
parent b1c2b7f35e
commit d5d5a6fd6b
15 changed files with 1090 additions and 847 deletions
+11 -12
View File
@@ -1,7 +1,9 @@
#ifndef GAME_H
#define GAME_H
#include "bitset.h"
#include "game/common_ui.h"
#include "game_variables.h"
#include "graphic_utils.h"
#include <tonc.h>
@@ -39,6 +41,9 @@ typedef struct CardObject CardObject;
typedef struct Card Card;
typedef struct JokerObject JokerObject;
typedef void (*GameStateCallback)(void);
typedef void (*SubStateActionFn)(void);
// Enum value names in ../include/def_state_info_table.h
enum GameState
{
@@ -121,17 +126,6 @@ typedef struct ContainedHandTypes
} ContainedHandTypes;
// clang-format on
typedef void (*GameStateCallback)(void);
typedef void (*SubStateActionFn)(void);
typedef struct
{
int substate;
GameStateCallback on_init;
GameStateCallback on_update;
GameStateCallback on_exit;
} StateInfo;
// Game functions
void game_init();
@@ -156,8 +150,14 @@ int get_played_top(void);
int get_scored_card_index(void);
bool is_joker_owned(int joker_id);
bool card_is_face(Card* card);
void add_joker(JokerObject* joker_object);
void remove_owned_joker(int owned_joker_idx);
List* get_jokers_list(void);
List* get_expired_jokers_list(void);
List* get_discarded_jokers_list(void);
List* get_shop_jokers_list(void);
Bitset* get_avail_jokers_bitset(void);
void set_shop_joker_avail(int joker_id, bool avail);
ContainedHandTypes* get_contained_hands(void);
enum HandType* get_hand_type(void);
@@ -189,7 +189,6 @@ void game_start(void);
void change_background_legacy(enum BackgroundId id);
void display_round(void);
void reset_top_left_panel_bottom_row(void);
void reset_background(void);
void display_hands(void);