GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
skip_tag.h File Reference

Data structures and functions related to the handling of Skip Tags. More...

#include "game/common_ui.h"
#include "graphic_utils.h"
#include "joker.h"
#include "sprite.h"
#include <tonc.h>

Go to the source code of this file.

Data Structures

struct  SkipTag
 
struct  SkipTagInfo
 Data structure containing the info about a Skip Tag, namely: More...
 

Macros

#define SKIP_TAG_TID   (SKIP_TAG_STARTING_LAYER * SKIP_TAG_SPRITE_SIZE)
 
#define INVESTMENT_TAG_REWARD   25
 

Typedefs

typedef struct SkipTag SkipTag
 
typedef bool(* SkipTagCondition) (void)
 
typedef void(* SkipTagCallback) (void)
 

Enumerations

enum  SkipTagLayers { SMALL_BLIND_SKIP_TAG_LAYER , BIG_BLIND_SKIP_TAG_LAYER , OWNED_SKIP_TAG_STARTING_LAYER }
 Sprite IDs of the Skip Tags, as an offset relative to SKIP_TAG_STARTING_LAYER. More...
 
enum  SkipTagTypes {
  SKIP_TAG_TYPE_UNCOMMON , SKIP_TAG_TYPE_RARE , SKIP_TAG_TYPE_INVESTMENT , SKIP_TAG_TYPE_VOUCHER ,
  SKIP_TAG_TYPE_BOSS , SKIP_TAG_TYPE_STANDARD , SKIP_TAG_TYPE_CHARM , SKIP_TAG_TYPE_METEOR ,
  SKIP_TAG_TYPE_BUFFOON , SKIP_TAG_TYPE_HANDY , SKIP_TAG_TYPE_GARBAGE , SKIP_TAG_TYPE_ETHEREAL ,
  SKIP_TAG_TYPE_COUPON , SKIP_TAG_TYPE_DOUBLE , SKIP_TAG_TYPE_JUGGLE , SKIP_TAG_TYPE_D6 ,
  SKIP_TAG_TYPE_TOP_UP , SKIP_TAG_TYPE_SPEED , SKIP_TAG_TYPE_ORBITAL , SKIP_TAG_TYPE_ECONOMY ,
  MAX_SKIP_TAG_TYPES
}
 List of all Skip Tags, in the order they are in on their spritesheet. Not all of them are implemented (or will be) but at least they are in order. More...
 
enum  SkipTagEvent {
  SKIP_TAG_EVENT_NONE , SKIP_TAG_EVENT_IMMEDIATE , SKIP_TAG_EVENT_ON_ROUND_START , SKIP_TAG_EVENT_ON_ROUND_END ,
  SKIP_TAG_EVENT_ON_SHOP_INIT
}
 
enum  SkipTagProcStage { SKIP_TAG_PROCESS_STAGE_NONE , SKIP_TAG_PROCESS_STAGE_TRIGGER , SKIP_TAG_PROCESS_STAGE_END }
 

Functions

const SkipTagInfo * get_skip_tag_registry_entry (enum SkipTagTypes tag_type)
 Get the registry entry info for the given Skip Tag type.
 
List * get_owned_skip_tags (void)
 Get the owned skip tags list.
 
SkipTag * skip_tag_new (enum SkipTagTypes tag_type)
 Create a new Skip Tag object for the given Tag ID and allocates space for it in the corresponding memory pool.
 
void skip_tag_set_sprite (SkipTag *tag, s16 layer)
 Set the sprite for the given SkipTag, according to its internal ID.
 
void skip_tag_destroy (SkipTag **tag)
 Destroy the given SkipTag, invalidate it in the corresponding memory pool and set the pointer provided to NULL.
 
void set_owned_skip_tags_moved_offscreen (bool move_offscreen)
 Show or hide the owned SkipTag sprites by moving them offscreen to the right.
 
SkipTag * roll_skip_tag (void)
 Create a new SkipTag with a random ID, picked by taking the Ante into account, as some Tags only appear from Ante 2 onwards.
 
bool skip_tag_is_owned (enum SkipTagTypes tag_type)
 Checks if the given tag type is present in owned Tags list.
 
int skip_tag_count (enum SkipTagTypes tag_type)
 Counts how many tags of a certain type we own.
 
void add_skip_tag (SkipTag **blind_tag)
 Adds the SkipTag to the owned list, snaps it into position and sets the original pointer to NULL.
 
void remove_skip_tag (int tag_idx)
 Pops the Tag at index in owned list, destroys it and rearranges the remaining Tags' sprites.
 
void remove_all_skip_tags (void)
 Delete all owned Skip Tags.
 
enum SkipTagProcStage skip_tag_process_get_proc_stage (void)
 Recover the current stage of the Tag processing.
 
void skip_tag_process_start (enum SkipTagEvent checked_tag_event)
 Start Skip Tag processing for the specified event.
 
void skip_tag_process_pause (void)
 Suspend the processing of Skip Tags.
 
void skip_tag_process_resume (void)
 Resume the processing of Skip Tags.
 

Detailed Description

Data structures and functions related to the handling of Skip Tags.

Definition in file skip_tag.h.

Macro Definition Documentation

◆ INVESTMENT_TAG_REWARD

#define INVESTMENT_TAG_REWARD   25

Definition at line 30 of file skip_tag.h.

◆ SKIP_TAG_TID

#define SKIP_TAG_TID   (SKIP_TAG_STARTING_LAYER * SKIP_TAG_SPRITE_SIZE)

Definition at line 28 of file skip_tag.h.

Typedef Documentation

◆ SkipTagCallback

typedef void(* SkipTagCallback) (void)

Definition at line 96 of file skip_tag.h.

◆ SkipTagCondition

typedef bool(* SkipTagCondition) (void)

Definition at line 95 of file skip_tag.h.

Enumeration Type Documentation

◆ SkipTagEvent

enum SkipTagEvent

Definition at line 77 of file skip_tag.h.

◆ SkipTagLayers

Sprite IDs of the Skip Tags, as an offset relative to SKIP_TAG_STARTING_LAYER.

See also
SpriteStartingLayers

Definition at line 20 of file skip_tag.h.

◆ SkipTagProcStage

enum SkipTagProcStage

Definition at line 87 of file skip_tag.h.

◆ SkipTagTypes

List of all Skip Tags, in the order they are in on their spritesheet. Not all of them are implemented (or will be) but at least they are in order.

The Negative, Foil, Holographic and Polychrome Tags are not planned and thus absent from both this enum, and the Tags spritesheet, but the sprites for them are available in the relevant description should we ever need them: https://github.com/GBALATRO/balatro-gba/discussions/131

See also
NB_SKIP_TAG_TYPES, ante1_skip_tags_roll_table, all_skip_tags_roll_table

Definition at line 44 of file skip_tag.h.

Function Documentation

◆ add_skip_tag()

void add_skip_tag ( SkipTag **  blind_tag)

Adds the SkipTag to the owned list, snaps it into position and sets the original pointer to NULL.

Parameters
blind_tag

Definition at line 230 of file skip_tag.c.

◆ get_owned_skip_tags()

List * get_owned_skip_tags ( void  )

Get the owned skip tags list.

Returns
List*

Definition at line 76 of file skip_tag.c.

◆ get_skip_tag_registry_entry()

const SkipTagInfo * get_skip_tag_registry_entry ( enum SkipTagTypes  tag_type)

Get the registry entry info for the given Skip Tag type.

Parameters
tag_typetype of the Skip Tag we need the info of
Returns
a pointer to the info structure for the given Skip Tag
See also
SkipTagInfo

Definition at line 56 of file skip_tag_effects.c.

◆ remove_all_skip_tags()

void remove_all_skip_tags ( void  )

Delete all owned Skip Tags.

Definition at line 289 of file skip_tag.c.

◆ remove_skip_tag()

void remove_skip_tag ( int  tag_idx)

Pops the Tag at index in owned list, destroys it and rearranges the remaining Tags' sprites.

Parameters
tag_idxindex of the Tag to remove in owned list

Definition at line 279 of file skip_tag.c.

◆ roll_skip_tag()

SkipTag * roll_skip_tag ( void  )

Create a new SkipTag with a random ID, picked by taking the Ante into account, as some Tags only appear from Ante 2 onwards.

Returns
SkipTag pointer to the new SkipTag object
See also
skip_tag_new

Definition at line 154 of file skip_tag.c.

◆ set_owned_skip_tags_moved_offscreen()

void set_owned_skip_tags_moved_offscreen ( bool  move_offscreen)

Show or hide the owned SkipTag sprites by moving them offscreen to the right.

Parameters
move_offscreentrue to move the sprites offscreen, false to return them onscreen

Definition at line 141 of file skip_tag.c.

◆ skip_tag_count()

int skip_tag_count ( enum SkipTagTypes  tag_type)

Counts how many tags of a certain type we own.

Parameters
tag_typeSkipTagType to count
Returns
int

Definition at line 213 of file skip_tag.c.

◆ skip_tag_destroy()

void skip_tag_destroy ( SkipTag **  tag)

Destroy the given SkipTag, invalidate it in the corresponding memory pool and set the pointer provided to NULL.

Parameters
tagpointer of pointer to the SkipTag we want to destroy

Definition at line 128 of file skip_tag.c.

◆ skip_tag_is_owned()

bool skip_tag_is_owned ( enum SkipTagTypes  tag_type)

Checks if the given tag type is present in owned Tags list.

Parameters
tag_typeSkipTagType to check
Returns
true if tag type is present, false otherwise

Definition at line 197 of file skip_tag.c.

◆ skip_tag_new()

SkipTag * skip_tag_new ( enum SkipTagTypes  tag_type)

Create a new Skip Tag object for the given Tag ID and allocates space for it in the corresponding memory pool.

Parameters
tag_typethe ID of the Tag we want
Returns
a pointer to a new SkipTag object
See also
SkipTagTypes, SkipTag

Definition at line 83 of file skip_tag.c.

◆ skip_tag_process_get_proc_stage()

enum SkipTagProcStage skip_tag_process_get_proc_stage ( void  )

Recover the current stage of the Tag processing.

Returns
enum SkipTagProcStage

Definition at line 339 of file skip_tag.c.

◆ skip_tag_process_pause()

void skip_tag_process_pause ( void  )

Suspend the processing of Skip Tags.

This is called automatically when Tags have finished processing for the current SkipTagEvent, but it can be invoked by a game state to temporarily pause the processing while doing some other thing, like showing an animation. Call skip_tag_process_resume to pick up processing where it was left.

See also
skip_tag_process_resume

Definition at line 357 of file skip_tag.c.

◆ skip_tag_process_resume()

void skip_tag_process_resume ( void  )

Resume the processing of Skip Tags.

After skip_tag_process_pause was called, use this function to resume Tag processing.

See also
skip_tag_process_pause

Definition at line 366 of file skip_tag.c.

◆ skip_tag_process_start()

void skip_tag_process_start ( enum SkipTagEvent  checked_tag_event)

Start Skip Tag processing for the specified event.

The "processing" of a Tag refers to the selection of the triggered Tag, the triggering of the associated effect itself, the little bounce animation that comes with it and finally the removal of the Tag.

Processing will occur in its own state machine and will run independently until it either completes, or is paused/resumed with the associated functions.

During this time, skip_tag_process_get_proc_stage may be called on every frame so that the calling state machine can stay up to date with the Tags processing stage and wait for it to finish or perform relevant actions.

Parameters
checked_tag_eventthe event for which the owned Tags will be evaluated
See also
skip_tag_process_pause, skip_tag_process_resume, skip_tag_process_get_proc_stage

Definition at line 344 of file skip_tag.c.

◆ skip_tag_set_sprite()

void skip_tag_set_sprite ( SkipTag *  tag,
s16  layer 
)

Set the sprite for the given SkipTag, according to its internal ID.

Parameters
tagpointer to the SkipTag object
layersprite layer for the new Sprite, as an offset to the starting layer for the SKIP_TAG sprite type

Definition at line 94 of file skip_tag.c.