Clang format and refactor game.h/c + update Bracket Alignment to BlockIndent (#259)
* Refactor and clang-format game.h/c * Updated clang-format AlignAfterOpenBracket: BlockIndent and ColumnLimit: 100 and refactored all files accordingly --------- Co-authored-by: MeirGavish <meir.gavish@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+3
-2
@@ -13,7 +13,7 @@ AllowShortLoopsOnASingleLine: false
|
|||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
|
|
||||||
# Column limit
|
# Column limit
|
||||||
ColumnLimit: 120
|
ColumnLimit: 100
|
||||||
|
|
||||||
# Case labels
|
# Case labels
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
@@ -42,7 +42,8 @@ BinPackParameters: false
|
|||||||
|
|
||||||
AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: BlockIndent
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 0
|
||||||
|
|
||||||
ReflowComments: true
|
ReflowComments: true
|
||||||
SpacesInLineCommentPrefix:
|
SpacesInLineCommentPrefix:
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ jobs:
|
|||||||
include/bitset.h source/bitset.c
|
include/bitset.h source/bitset.c
|
||||||
include/pool.h source/pool.c
|
include/pool.h source/pool.c
|
||||||
include/card.h source/card.c
|
include/card.h source/card.c
|
||||||
|
include/game.h source/game.c
|
||||||
include/hand_analysis.h source/hand_analysis.c
|
include/hand_analysis.h source/hand_analysis.c
|
||||||
include/list.h source/list.c
|
include/list.h source/list.c
|
||||||
include/sprite.h source/sprite.c
|
include/sprite.h source/sprite.c
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,8 @@
|
|||||||
#define BLIND_H
|
#define BLIND_H
|
||||||
|
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
// The GBA's max uint value is around 4 billion, so we're going to not add endless mode for simplicity's sake
|
// The GBA's max uint value is around 4 billion, so we're going to not add endless mode for
|
||||||
|
// simplicity's sake
|
||||||
#define MAX_ANTE 8
|
#define MAX_ANTE 8
|
||||||
|
|
||||||
#define SMALL_BLIND_PB 1
|
#define SMALL_BLIND_PB 1
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// (stateEnum, on_init, on_update, on_exit)
|
// (stateEnum, on_init, on_update, on_exit)
|
||||||
DEF_STATE_INFO(GAME_STATE_SPLASH_SCREEN, splash_screen_on_init, splash_screen_on_update, splash_screen_on_exit)
|
DEF_STATE_INFO(GAME_STATE_SPLASH_SCREEN, splash_screen_on_init, splash_screen_on_update, splash_screen_on_exit)
|
||||||
DEF_STATE_INFO(GAME_STATE_MAIN_MENU, game_main_menu_on_init, game_main_menu_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_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_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_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_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_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)
|
DEF_STATE_INFO(GAME_STATE_WIN, game_win_on_init, game_win_on_update, game_over_on_exit)
|
||||||
|
|||||||
+47
-46
@@ -3,17 +3,33 @@
|
|||||||
|
|
||||||
#include <tonc.h>
|
#include <tonc.h>
|
||||||
|
|
||||||
#define MAX_HAND_SIZE 16
|
#define MAX_HAND_SIZE 16
|
||||||
#define MAX_DECK_SIZE 52
|
#define MAX_DECK_SIZE 52
|
||||||
#define MAX_JOKERS_HELD_SIZE 5 // This doesn't account for negatives right now.
|
#define MAX_JOKERS_HELD_SIZE 5 // This doesn't account for negatives right now.
|
||||||
#define MAX_SHOP_JOKERS 2 // TODO: Make this dynamic and allow for other items besides jokers
|
#define MAX_SHOP_JOKERS 2 // TODO: Make this dynamic and allow for other items besides jokers
|
||||||
#define MAX_SELECTION_SIZE 5
|
#define MAX_SELECTION_SIZE 5
|
||||||
#define FRAMES(x) (((x) + game_speed - 1) / game_speed)
|
#define FRAMES(x) (((x) + game_speed - 1) / game_speed)
|
||||||
|
|
||||||
// TODO: Can make these dynamic to support interest-related jokers and vouchers
|
// TODO: Can make these dynamic to support interest-related jokers and vouchers
|
||||||
#define MAX_INTEREST 5
|
#define MAX_INTEREST 5
|
||||||
#define INTEREST_PER_5 1
|
#define INTEREST_PER_5 1
|
||||||
|
|
||||||
|
// Input bindings
|
||||||
|
#define SELECT_CARD KEY_A
|
||||||
|
#define DESELECT_CARDS KEY_B
|
||||||
|
#define PEEK_DECK KEY_L // Not implemented
|
||||||
|
#define SORT_HAND KEY_R
|
||||||
|
#define PAUSE_GAME KEY_START // Not implemented
|
||||||
|
#define SELL_KEY KEY_L
|
||||||
|
|
||||||
|
struct List;
|
||||||
|
typedef struct List List;
|
||||||
|
|
||||||
|
// Utility functions for other files
|
||||||
|
typedef struct CardObject CardObject;
|
||||||
|
typedef struct Card Card;
|
||||||
|
typedef struct JokerObject JokerObject;
|
||||||
|
|
||||||
enum BackgroundId
|
enum BackgroundId
|
||||||
{
|
{
|
||||||
BG_NONE,
|
BG_NONE,
|
||||||
@@ -25,14 +41,6 @@ enum BackgroundId
|
|||||||
BG_MAIN_MENU
|
BG_MAIN_MENU
|
||||||
};
|
};
|
||||||
|
|
||||||
// Input bindings
|
|
||||||
#define SELECT_CARD KEY_A
|
|
||||||
#define DESELECT_CARDS KEY_B
|
|
||||||
#define PEEK_DECK KEY_L // Not implemented
|
|
||||||
#define SORT_HAND KEY_R
|
|
||||||
#define PAUSE_GAME KEY_START // Not implemented
|
|
||||||
#define SELL_KEY KEY_L
|
|
||||||
|
|
||||||
// Enum value names in ../include/def_state_info_table.h
|
// Enum value names in ../include/def_state_info_table.h
|
||||||
enum GameState
|
enum GameState
|
||||||
{
|
{
|
||||||
@@ -47,7 +55,9 @@ enum HandState
|
|||||||
{
|
{
|
||||||
HAND_DRAW,
|
HAND_DRAW,
|
||||||
HAND_SELECT,
|
HAND_SELECT,
|
||||||
HAND_SHUFFLING, // This is actually a misnomer because it's used for the deck, but it mechanically makes sense to be a state of the hand
|
// This is actually a misnomer because it's used for the deck
|
||||||
|
// but it mechanically makes sense to be a state of the hand
|
||||||
|
HAND_SHUFFLING,
|
||||||
HAND_DISCARD,
|
HAND_DISCARD,
|
||||||
HAND_PLAY,
|
HAND_PLAY,
|
||||||
HAND_PLAYING
|
HAND_PLAYING
|
||||||
@@ -85,7 +95,7 @@ enum HandType
|
|||||||
FLUSH_FIVE
|
FLUSH_FIVE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int substate;
|
int substate;
|
||||||
void (*on_init)();
|
void (*on_init)();
|
||||||
@@ -98,40 +108,31 @@ void game_init();
|
|||||||
void game_update();
|
void game_update();
|
||||||
void game_change_state(enum GameState new_game_state);
|
void game_change_state(enum GameState new_game_state);
|
||||||
|
|
||||||
struct List;
|
CardObject** get_hand_array(void);
|
||||||
typedef struct List List;
|
int get_hand_top(void);
|
||||||
|
int hand_get_size(void);
|
||||||
// Utility functions for other files
|
CardObject** get_played_array(void);
|
||||||
typedef struct CardObject CardObject; // forward declaration, actually declared in card.h
|
int get_played_top(void);
|
||||||
typedef struct Card Card;
|
int get_scored_card_index(void);
|
||||||
typedef struct JokerObject JokerObject;
|
bool is_joker_owned(int joker_id);
|
||||||
|
bool card_is_face(Card* card);
|
||||||
CardObject** get_hand_array(void);
|
List* get_jokers_list(void);
|
||||||
int get_hand_top(void);
|
List* get_expired_jokers_list(void);
|
||||||
int hand_get_size(void);
|
|
||||||
CardObject** get_played_array(void);
|
|
||||||
int get_played_top(void);
|
|
||||||
int get_scored_card_index(void);
|
|
||||||
bool is_joker_owned(int joker_id);
|
|
||||||
bool card_is_face(Card *card);
|
|
||||||
List* get_jokers_list(void);
|
|
||||||
List* get_expired_jokers_list(void);
|
|
||||||
|
|
||||||
int get_deck_top(void);
|
int get_deck_top(void);
|
||||||
int get_num_discards_remaining(void);
|
int get_num_discards_remaining(void);
|
||||||
int get_num_hands_remaining(void);
|
int get_num_hands_remaining(void);
|
||||||
|
|
||||||
u32 get_chips(void);
|
u32 get_chips(void);
|
||||||
void set_chips(u32 new_chips);
|
void set_chips(u32 new_chips);
|
||||||
void display_chips();
|
void display_chips();
|
||||||
u32 get_mult(void);
|
u32 get_mult(void);
|
||||||
void set_mult(u32 new_mult);
|
void set_mult(u32 new_mult);
|
||||||
void display_mult();
|
void display_mult();
|
||||||
int get_money(void);
|
int get_money(void);
|
||||||
void set_money(int new_money);
|
void set_money(int new_money);
|
||||||
void display_money();
|
void display_money();
|
||||||
void set_retrigger(bool new_retrigger);
|
void set_retrigger(bool new_retrigger);
|
||||||
|
|
||||||
|
|
||||||
int get_game_speed(void);
|
int get_game_speed(void);
|
||||||
void set_game_speed(int new_game_speed);
|
void set_game_speed(int new_game_speed);
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ bool hand_contains_straight(u8* ranks);
|
|||||||
bool hand_contains_flush(u8* suits);
|
bool hand_contains_flush(u8* suits);
|
||||||
|
|
||||||
int find_flush_in_played_cards(CardObject** played, int top, int min_len, bool* out_selection);
|
int find_flush_in_played_cards(CardObject** played, int top, int min_len, bool* out_selection);
|
||||||
int find_straight_in_played_cards(CardObject** played, int top, bool shortcut_active, int min_len, bool* out_selection);
|
int find_straight_in_played_cards(
|
||||||
|
CardObject** played,
|
||||||
|
int top,
|
||||||
|
bool shortcut_active,
|
||||||
|
int min_len,
|
||||||
|
bool* out_selection
|
||||||
|
);
|
||||||
void select_paired_cards_in_hand(CardObject** played, int top, bool* selection);
|
void select_paired_cards_in_hand(CardObject** played, int top, bool* selection);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+7
-5
@@ -5,8 +5,8 @@
|
|||||||
* List Implementation
|
* List Implementation
|
||||||
* ===================
|
* ===================
|
||||||
*
|
*
|
||||||
* - This @ref List operates as a linked list @ref ListNodes. It operates as a regular doubly-linked list
|
* - This @ref List operates as a linked list @ref ListNodes. It operates as a regular
|
||||||
* but doesn't allocate memory and rather gets @ref ListNodes from a pool.
|
* doubly-linked list but doesn't allocate memory and rather gets @ref ListNodes from a pool.
|
||||||
*/
|
*/
|
||||||
#ifndef LIST_H
|
#ifndef LIST_H
|
||||||
#define LIST_H
|
#define LIST_H
|
||||||
@@ -23,7 +23,8 @@ typedef struct ListNode ListNode;
|
|||||||
struct ListNode
|
struct ListNode
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief The previous @ref ListNode in the associated @ref List, NULL if at the `head` of the list
|
* @brief The previous @ref ListNode in the associated @ref List, NULL if at the `head` of the
|
||||||
|
* list
|
||||||
*/
|
*/
|
||||||
ListNode* prev;
|
ListNode* prev;
|
||||||
|
|
||||||
@@ -99,8 +100,9 @@ typedef struct
|
|||||||
/**
|
/**
|
||||||
* Create a list.
|
* Create a list.
|
||||||
*
|
*
|
||||||
* While this function does not allocate memory for the list itself, the list does allocate memory for each element.
|
* While this function does not allocate memory for the list itself, the list does allocate memory
|
||||||
* So every created list must be freed with @ref list_clear to ensure the list's nodes are deleted properly.
|
* for each element. So every created list must be freed with @ref list_clear to ensure the list's
|
||||||
|
* nodes are deleted properly.
|
||||||
*
|
*
|
||||||
* @return A @ref List with head and tail reset.
|
* @return A @ref List with head and tail reset.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ struct SelectionGridRow
|
|||||||
|
|
||||||
struct SelectionGrid
|
struct SelectionGrid
|
||||||
{
|
{
|
||||||
SelectionGridRow* rows;
|
const SelectionGridRow* rows;
|
||||||
const int num_rows;
|
const int num_rows;
|
||||||
Selection selection;
|
Selection selection;
|
||||||
};
|
};
|
||||||
@@ -38,4 +38,4 @@ void selection_grid_process_input(SelectionGrid* selection_grid);
|
|||||||
void selection_grid_move_selection_horz(SelectionGrid* selection_grid, int direction_tribool);
|
void selection_grid_move_selection_horz(SelectionGrid* selection_grid, int direction_tribool);
|
||||||
void selection_grid_move_selection_vert(SelectionGrid* selection_grid, int direction_tribool);
|
void selection_grid_move_selection_vert(SelectionGrid* selection_grid, int direction_tribool);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+7
-5
@@ -34,10 +34,11 @@ int bitset_set_next_free_idx(Bitset* bitset)
|
|||||||
// https://gcc.gnu.org/onlinedocs/gcc/Bit-Operation-Builtins.html#index-_005f_005fbuiltin_005fctz
|
// https://gcc.gnu.org/onlinedocs/gcc/Bit-Operation-Builtins.html#index-_005f_005fbuiltin_005fctz
|
||||||
//
|
//
|
||||||
// By using the bitwise inverse of the word, you can skip words that are full
|
// By using the bitwise inverse of the word, you can skip words that are full
|
||||||
// quickly (where the value is 0 or 'false' since all bits are '1', or 'in use'). Any value greater
|
// quickly (where the value is 0 or 'false' since all bits are '1', or 'in use'). Any value
|
||||||
// than 0 indicates there is a free slot. Then, when counting the trailing 0's, you can test very quickly
|
// greater than 0 indicates there is a free slot. Then, when counting the trailing 0's, you
|
||||||
// where the first free slot is. This operation prevents looping through every bit of filled flags, and
|
// can test very quickly where the first free slot is. This operation prevents looping
|
||||||
// will instead operate only on the first word with free slots.
|
// through every bit of filled flags, and will instead operate only on the first word with
|
||||||
|
// free slots.
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
int bit = __builtin_ctz(inv);
|
int bit = __builtin_ctz(inv);
|
||||||
@@ -100,7 +101,8 @@ int bitset_find_idx_of_nth_set(const Bitset* bitset, int n)
|
|||||||
if (tracker > n)
|
if (tracker > n)
|
||||||
{
|
{
|
||||||
// The index is here somewhere
|
// The index is here somewhere
|
||||||
// this one is to count the 1's not the offset, underflow to -1 is good for finding the 0 index
|
// this one is to count the 1's not the offset, underflow to -1 is good for finding the
|
||||||
|
// 0 index
|
||||||
int base = prev_tracker - 1;
|
int base = prev_tracker - 1;
|
||||||
// this one is for the actual offset we want to map the id to
|
// this one is for the actual offset we want to map the id to
|
||||||
int offset = bitset->nbits * i;
|
int offset = bitset->nbits * i;
|
||||||
|
|||||||
+15
-6
@@ -10,7 +10,8 @@
|
|||||||
#include "pool.h"
|
#include "pool.h"
|
||||||
#include "soundbank.h"
|
#include "soundbank.h"
|
||||||
|
|
||||||
// Card sprites lookup table. First index is the suit, second index is the rank. The value is the tile index.
|
// 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] = {
|
const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
|
||||||
{0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192},
|
{0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192},
|
||||||
{208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400},
|
{208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400},
|
||||||
@@ -88,11 +89,19 @@ 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);
|
||||||
memcpy32(&tile_mem[4][tile_index],
|
memcpy32(
|
||||||
&deck_gfxTiles[_card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
|
&tile_mem[4][tile_index],
|
||||||
TILE_SIZE * CARD_SPRITE_OFFSET);
|
&deck_gfxTiles
|
||||||
Sprite* sprite =
|
[_card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
|
||||||
sprite_new(ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF, ATTR1_SIZE_32, tile_index, 0, layer + CARD_STARTING_LAYER);
|
TILE_SIZE * CARD_SPRITE_OFFSET
|
||||||
|
);
|
||||||
|
Sprite* sprite = sprite_new(
|
||||||
|
ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF,
|
||||||
|
ATTR1_SIZE_32,
|
||||||
|
tile_index,
|
||||||
|
0,
|
||||||
|
layer + CARD_STARTING_LAYER
|
||||||
|
);
|
||||||
sprite_object_set_sprite(card_object->sprite_object, sprite);
|
sprite_object_set_sprite(card_object->sprite_object, sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2437
-1892
File diff suppressed because it is too large
Load Diff
+11
-4
@@ -221,7 +221,8 @@ bool hand_contains_flush(u8* suits)
|
|||||||
* @param played Array of pointers to CardObject representing played cards.
|
* @param played Array of pointers to CardObject representing played cards.
|
||||||
* @param top Index of the top of the played stack.
|
* @param top Index of the top of the played stack.
|
||||||
* @param min_len Minimum number of cards required for a flush.
|
* @param min_len Minimum number of cards required for a flush.
|
||||||
* @param out_selection Output array of bools; set to true for cards in the best flush, false otherwise.
|
* @param out_selection Output array of bools; set to true for cards in the best flush, false
|
||||||
|
* otherwise.
|
||||||
* @return The number of cards in the best flush found, or 0 if no flush meets min_len.
|
* @return The number of cards in the best flush found, or 0 if no flush meets min_len.
|
||||||
*/
|
*/
|
||||||
int find_flush_in_played_cards(CardObject** played, int top, int min_len, bool* out_selection)
|
int find_flush_in_played_cards(CardObject** played, int top, int min_len, bool* out_selection)
|
||||||
@@ -265,9 +266,15 @@ int find_flush_in_played_cards(CardObject** played, int top, int min_len, bool*
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of cards in the best straight or 0 if no straight of min_len is found, marks as true them in
|
// Returns the number of cards in the best straight or 0 if no straight of min_len is found, marks
|
||||||
// out_selection[]. This is mostly from Google Gemini
|
// as true them in out_selection[]. This is mostly from Google Gemini
|
||||||
int find_straight_in_played_cards(CardObject** played, int top, bool shortcut_active, int min_len, bool* out_selection)
|
int find_straight_in_played_cards(
|
||||||
|
CardObject** played,
|
||||||
|
int top,
|
||||||
|
bool shortcut_active,
|
||||||
|
int min_len,
|
||||||
|
bool* out_selection
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (top < 0)
|
if (top < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+11
-7
@@ -16,9 +16,11 @@ void splash_screen_on_init()
|
|||||||
|
|
||||||
tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER");
|
tte_printf("#{P:72,8; cx:0xF000}DISCLAIMER");
|
||||||
tte_printf(
|
tte_printf(
|
||||||
"#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or LocalThunk.\n\n If "
|
"#{P:8,24; cx:0xF000}This project is NOT endorsed \n by or affiliated with \n Playstack or "
|
||||||
"you have paid for this, \n you have been scammed \n and should request a refund \n IMMEDIATELY. \n\n The only "
|
"LocalThunk.\n\n If you have paid for this, \n you have been scammed \n and should request "
|
||||||
"official place \n to obtain this is from: \n\n 'github.com/\n cellos51/balatro-gba'");
|
"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)");
|
tte_printf("#{P:8,144; cx:0xF000}(Press any key to skip)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,10 +31,12 @@ void splash_screen_on_update()
|
|||||||
if (timer < SPLASH_DURATION_FRAMES)
|
if (timer < SPLASH_DURATION_FRAMES)
|
||||||
{
|
{
|
||||||
tte_erase_rect_wrapper(COUNTDOWN_TIMER_RECT);
|
tte_erase_rect_wrapper(COUNTDOWN_TIMER_RECT);
|
||||||
tte_printf("#{P:%d,%d; cx:0xF000}%d",
|
tte_printf(
|
||||||
COUNTDOWN_TIMER_RECT.left,
|
"#{P:%d,%d; cx:0xF000}%d",
|
||||||
COUNTDOWN_TIMER_RECT.top,
|
COUNTDOWN_TIMER_RECT.left,
|
||||||
1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS);
|
COUNTDOWN_TIMER_RECT.top,
|
||||||
|
1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS
|
||||||
|
);
|
||||||
|
|
||||||
if (!key_hit(KEY_ANY))
|
if (!key_hit(KEY_ANY))
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-7
@@ -181,8 +181,8 @@ void sprite_object_update(SpriteObject* sprite_object)
|
|||||||
|
|
||||||
// set velocity to 0 if it's close enough to the target
|
// set velocity to 0 if it's close enough to the target
|
||||||
const FIXED epsilon = float2fx(0.01f);
|
const FIXED epsilon = float2fx(0.01f);
|
||||||
if (sprite_object->vx < epsilon && sprite_object->vx > -epsilon && sprite_object->vy < epsilon &&
|
if (sprite_object->vx < epsilon && sprite_object->vx > -epsilon &&
|
||||||
sprite_object->vy > -epsilon)
|
sprite_object->vy < epsilon && sprite_object->vy > -epsilon)
|
||||||
{
|
{
|
||||||
sprite_object->vx = 0;
|
sprite_object->vx = 0;
|
||||||
sprite_object->vy = 0;
|
sprite_object->vy = 0;
|
||||||
@@ -215,7 +215,8 @@ void sprite_object_update(SpriteObject* sprite_object)
|
|||||||
if (sprite_object->vrotation < epsilon && sprite_object->vrotation > -epsilon)
|
if (sprite_object->vrotation < epsilon && sprite_object->vrotation > -epsilon)
|
||||||
{
|
{
|
||||||
sprite_object->vrotation = 0;
|
sprite_object->vrotation = 0;
|
||||||
sprite_object->rotation = sprite_object->trotation; // Set the rotation to the target rotation
|
// Set the rotation to the target rotation
|
||||||
|
sprite_object->rotation = sprite_object->trotation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -223,10 +224,13 @@ void sprite_object_update(SpriteObject* sprite_object)
|
|||||||
sprite_object->rotation += sprite_object->vrotation;
|
sprite_object->rotation += sprite_object->vrotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_aff_rotscale(sprite_object->sprite->aff,
|
// Apply rotation and scale to the sprite
|
||||||
sprite_object->scale,
|
obj_aff_rotscale(
|
||||||
sprite_object->scale,
|
sprite_object->sprite->aff,
|
||||||
-sprite_object->vx + sprite_object->rotation); // Apply rotation and scale to the sprite
|
sprite_object->scale,
|
||||||
|
sprite_object->scale,
|
||||||
|
-sprite_object->vx + sprite_object->rotation
|
||||||
|
);
|
||||||
sprite_position(sprite_object->sprite, fx2int(sprite_object->x), fx2int(sprite_object->y));
|
sprite_position(sprite_object->sprite, fx2int(sprite_object->x), fx2int(sprite_object->y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user