@@ -0,0 +1,9 @@
|
||||
// (stateEnum, on_init, on_update, on_exit)
|
||||
DEF_STATE_INFO(GAME_STATE_SPLASH_SCREEN, splash_screen_on_init, splash_screen_on_update, _noop)
|
||||
DEF_STATE_INFO(GAME_STATE_MAIN_MENU, game_main_menu_on_init, game_main_menu_on_update, _noop)
|
||||
DEF_STATE_INFO(GAME_STATE_PLAYING, game_round_on_init, game_playing_on_update, _noop)
|
||||
DEF_STATE_INFO(GAME_STATE_ROUND_END, _noop, game_round_end_on_update, game_round_end_on_exit)
|
||||
DEF_STATE_INFO(GAME_STATE_SHOP, _noop, game_shop_on_update, game_shop_on_exit)
|
||||
DEF_STATE_INFO(GAME_STATE_BLIND_SELECT, _noop, game_blind_select_on_update, game_blind_select_on_exit)
|
||||
DEF_STATE_INFO(GAME_STATE_LOSE, game_lose_on_init, game_lose_on_update, game_over_on_exit)
|
||||
DEF_STATE_INFO(GAME_STATE_WIN, game_win_on_init, game_win_on_update, game_over_on_exit)
|
||||
+15
-9
@@ -26,16 +26,13 @@
|
||||
#define PAUSE_GAME KEY_START // Not implemented
|
||||
#define SELL_KEY KEY_L
|
||||
|
||||
// Enum value names in ../include/def_state_info_table.h
|
||||
enum GameState
|
||||
{
|
||||
GAME_SPLASH_SCREEN,
|
||||
GAME_MAIN_MENU,
|
||||
GAME_PLAYING,
|
||||
GAME_ROUND_END,
|
||||
GAME_SHOP,
|
||||
GAME_BLIND_SELECT,
|
||||
GAME_LOSE,
|
||||
GAME_WIN
|
||||
#define DEF_STATE_INFO(stateEnum, on_init, on_update, on_exit) stateEnum,
|
||||
#include "def_state_info_table.h"
|
||||
#undef DEF_STATE_INFO
|
||||
GAME_STATE_MAX
|
||||
};
|
||||
|
||||
enum HandState
|
||||
@@ -75,10 +72,18 @@ enum HandType
|
||||
FLUSH_FIVE
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int substate;
|
||||
void (*on_init)();
|
||||
void (*on_update)();
|
||||
void (*on_exit)();
|
||||
} StateInfo;
|
||||
|
||||
// Game functions
|
||||
void game_init();
|
||||
void game_update();
|
||||
void game_set_state(enum GameState new_game_state);
|
||||
void game_change_state(enum GameState new_game_state);
|
||||
|
||||
// Forward declaration
|
||||
struct List;
|
||||
@@ -88,6 +93,7 @@ typedef struct List List;
|
||||
typedef struct CardObject CardObject; // forward declaration, actually declared in card.h
|
||||
typedef struct Card Card;
|
||||
typedef struct JokerObject JokerObject;
|
||||
|
||||
CardObject** get_hand_array(void);
|
||||
int get_hand_top(void);
|
||||
int hand_get_size(void);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define SPLASH_DURATION_SECONDS 10
|
||||
#define SPLASH_DURATION_FRAMES (SPLASH_FPS * SPLASH_DURATION_SECONDS)
|
||||
|
||||
void splash_screen_init();
|
||||
void splash_screen_update(uint timer);
|
||||
void splash_screen_on_init();
|
||||
void splash_screen_on_update();
|
||||
|
||||
#endif // SPLASH_SCREEN_H
|
||||
#endif // SPLASH_SCREEN_H
|
||||
|
||||
+616
-596
File diff suppressed because it is too large
Load Diff
@@ -77,6 +77,7 @@ void init()
|
||||
blind_init();
|
||||
joker_init();
|
||||
game_init();
|
||||
game_change_state(GAME_STATE_SPLASH_SCREEN);
|
||||
}
|
||||
|
||||
void update()
|
||||
|
||||
@@ -6,16 +6,21 @@
|
||||
#include "game.h"
|
||||
|
||||
static const Rect COUNTDOWN_TIMER_RECT = {208, 144, 240, 152};
|
||||
static uint timer = 0;
|
||||
|
||||
void splash_screen_init()
|
||||
void splash_screen_on_init()
|
||||
{
|
||||
timer = 0;
|
||||
|
||||
tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER");
|
||||
tte_printf("#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'");
|
||||
tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)");
|
||||
}
|
||||
|
||||
void splash_screen_update(uint timer)
|
||||
void splash_screen_on_update()
|
||||
{
|
||||
timer++;
|
||||
|
||||
if (timer < SPLASH_DURATION_FRAMES)
|
||||
{
|
||||
tte_erase_rect_wrapper(COUNTDOWN_TIMER_RECT);
|
||||
@@ -27,6 +32,6 @@ void splash_screen_update(uint timer)
|
||||
}
|
||||
}
|
||||
|
||||
game_set_state(GAME_MAIN_MENU);
|
||||
game_change_state(GAME_STATE_MAIN_MENU);
|
||||
tte_erase_screen();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user