e7f550ce22
* background * Implement Options button * Update main menu artwork * add options menu tiles * prepare options menu handling * incorporate main menu refactor * toto * add all menu interactions * do not reset selection_x in main_menu * options struct * fix rebase from ricfehr3's repo * Implement high contrast cards * Save/Load options values to SRAM * load options on game_init and validate data within the load_options function * Get changes from ricfehr3's PR * recover fix for glitched ace * clang format * clang format * clang format * Save 500B of image data by using only minimal set of tiles instead of keeping final window in source file * clang format * clang format * Implement Options button * Update main menu artwork * progress, leaving it alone for now until discussion * make game_vars an extern * Move options vars into their own struct * rollback previous commit * Implement save validation. Version check to come * implement data validity + version check for game saves * clang format * Save position in rng sequence for consistent run after load * fix rebase issues * fix rebase issue * remove unused/duplicate define * Oops, made a mistake when testing PR #424 * encode high contrast palette into an image, and load it at game_start * document save.c/h and correct typos * correct alignment * game speed and high contrast buttons working * small cleanup * sliders also work again now * clang format * Moved balatro_version extern declaration to version.h file * removed unsused variable * make showing ROM version a toggle * move ante, round and money to the GameVariables struct * Rename SaveCheckInfo struct to SaveHeader for clarity * Add SaveHeader struct explanation * clang format * Revert unnecessary tileset optimization * SFX now follows the sound volume slider * clang format * Music now follows volume slider * Changed volume slider increment from 5 to 20 to avoid having the music sound too rough under 20% volume * refactor main_menu.c to use SelectionGrid and Button structs * clang format * make a "new" save button so we don't save during the state transition * clang format * Reduced state transition flicker by only changing affine background to a different one * Fix loading game too late in game init sequence * First batch of suggestions from @MeirGavish * Remove unnecessary intermediary buffers for high contrast palette swapping * comment row warp hack for button input * Add some of Copilot's suggestions * rename balatro_version into gbalatro_version for rebranding reasons + version display erase screen fix * remove unnecessary NULL check on `on_selection_changed` method * implement small game speed arrow buttons animation * factorize some code * remove unnecessary data validation in load_game(), since we already checked the header * Implement @MeirGavish 's suggestion regarding splitting the huge `on_update` function * clang format * implement @ricfehr3 's suggestion about keeping last selected button instead of using an obscure `on_boot` boolean * Apply @ricfehr3's suggestions * fix clang-format flags --------- Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
78 lines
1.7 KiB
C
78 lines
1.7 KiB
C
#ifndef CARD_H
|
|
#define CARD_H
|
|
|
|
#include "sprite.h"
|
|
|
|
#include <maxmod.h>
|
|
#include <tonc.h>
|
|
|
|
#define MAX_CARDS (NUM_SUITS * NUM_RANKS)
|
|
#define MAX_CARDS_ON_SCREEN 16
|
|
|
|
#define CARD_TID 0
|
|
#define CARD_SPRITE_OFFSET 16
|
|
#define CARD_PB 0
|
|
#define CARD_STARTING_LAYER 0
|
|
|
|
// Card suits
|
|
#define DIAMONDS 0
|
|
#define CLUBS 1
|
|
#define HEARTS 2
|
|
#define SPADES 3
|
|
#define NUM_SUITS 4
|
|
|
|
// Card ranks
|
|
#define TWO 0
|
|
#define THREE 1
|
|
#define FOUR 2
|
|
#define FIVE 3
|
|
#define SIX 4
|
|
#define SEVEN 5
|
|
#define EIGHT 6
|
|
#define NINE 7
|
|
#define TEN 8
|
|
#define JACK 9
|
|
#define QUEEN 10
|
|
#define KING 11
|
|
#define ACE 12
|
|
#define NUM_RANKS 13
|
|
#define RANK_OFFSET 2 // Because the first rank is 2 and ranks start at 0
|
|
|
|
#define IMPOSSIBLY_HIGH_CARD_VALUE 100
|
|
|
|
// Card types
|
|
typedef struct Card
|
|
{
|
|
u8 suit;
|
|
u8 rank;
|
|
} Card;
|
|
|
|
typedef struct CardObject
|
|
{
|
|
Card* card;
|
|
SpriteObject* sprite_object;
|
|
bool selected;
|
|
} CardObject;
|
|
|
|
// Card functions
|
|
void card_init();
|
|
void toggle_high_contrast_cards(bool enable);
|
|
|
|
// Card methods
|
|
Card* card_new(u8 suit, u8 rank);
|
|
void card_destroy(Card** card);
|
|
u8 card_get_value(Card* card);
|
|
|
|
// CardObject methods
|
|
CardObject* card_object_new(Card* card);
|
|
void card_object_destroy(CardObject** card_object);
|
|
void card_object_update(CardObject* card_object); // Update the card object position and scale
|
|
void card_object_set_sprite(CardObject* card_object, int layer);
|
|
void card_object_shake(CardObject* card_object, mm_word sound_id);
|
|
|
|
void card_object_set_selected(CardObject* card_object, bool selected);
|
|
bool card_object_is_selected(CardObject* card_object);
|
|
Sprite* card_object_get_sprite(CardObject* card_object);
|
|
|
|
#endif // CARD_H
|