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

Data structures and functions relative to the behaviour and graphics of Blinds. More...

#include "sprite.h"

Go to the source code of this file.

Data Structures

struct  Blind
 Data structure containing data about a BlindType. More...
 

Macros

#define MAX_ANTE   8
 

Enumerations

enum  BlindTokens { SMALL_BLIND , BIG_BLIND , BOSS_BLIND , NUM_BLINDS_PER_ANTE }
 The sprites that display the blinds when in "GAME_BLIND_SELECT" state. There are only 3 blinds per Ante, so we don't need more sprites than that. More...
 
enum  BlindTokenLayers {
  PLAYING_BLIND_TOKEN_LAYER , ROUND_END_BLIND_TOKEN_LAYER , SMALL_BLIND_TOKEN_LAYER , BIG_BLIND_TOKEN_LAYER ,
  BOSS_BLIND_TOKEN_LAYER
}
 Sprite IDs of the various Blind Tokens used in the game, expressed as an offset relative to BLIND_BASE_LAYER More...
 
enum  BlindColorIndex {
  BLIND_TEXT_COLOR_INDEX = 1 , BLIND_SHADOW_COLOR_INDEX , BLIND_HIGHLIGHT_COLOR_INDEX , BLIND_MAIN_COLOR_INDEX ,
  BLIND_BACKGROUND_MAIN_COLOR_INDEX , BLIND_BACKGROUND_SECONDARY_COLOR_INDEX , BLIND_BACKGROUND_SHADOW_COLOR_INDEX
}
 Indices of the Blind sprites' colors as encoded in the files' palettes with Aseprite. More...
 
enum  BlindType {
  BLIND_TYPE_SMALL , BLIND_TYPE_BIG , BLIND_TYPE_BOSS , BLIND_TYPE_HOOK = BLIND_TYPE_BOSS ,
  BLIND_TYPE_OX , BLIND_TYPE_HOUSE , BLIND_TYPE_WALL , BLIND_TYPE_WHEEL ,
  BLIND_TYPE_ARM , BLIND_TYPE_CLUB , BLIND_TYPE_FISH , BLIND_TYPE_PSYCHIC ,
  BLIND_TYPE_GOAD , BLIND_TYPE_WATER , BLIND_TYPE_WINDOW , BLIND_TYPE_MANACLE ,
  BLIND_TYPE_EYE , BLIND_TYPE_MOUTH , BLIND_TYPE_PLANT , BLIND_TYPE_SERPENT ,
  BLIND_TYPE_PILLAR , BLIND_TYPE_NEEDLE , BLIND_TYPE_HEAD , BLIND_TYPE_TOOTH ,
  BLIND_TYPE_FLINT , BLIND_TYPE_MARK , BLIND_TYPE_SHOWDOWN , BLIND_TYPE_ACORN = BLIND_TYPE_SHOWDOWN ,
  BLIND_TYPE_LEAF , BLIND_TYPE_VESSEL , BLIND_TYPE_HEART , BLIND_TYPE_BELL ,
  BLIND_TYPE_MAX
}
 All Blind types in the game are listed here. More...
 
enum  BlindState {
  BLIND_STATE_CURRENT , BLIND_STATE_UPCOMING , BLIND_STATE_DEFEATED , BLIND_STATE_SKIPPED ,
  BLIND_STATE_MAX
}
 All the possible states an Ante's Blinds can be in when viewed in the "Blind Select" screen. More...
 

Functions

void blind_init ()
 
u32 blind_get_requirement (enum BlindType type, int ante)
 Get the score required to beat a certain blind (either the Small, Big, or any Boss/Showdown blind) at a certain Ante.
 
int blind_get_reward (enum BlindType type)
 Get the amount of money gained from beating a certain Blind.
 
u16 blind_get_color (enum BlindType type, enum BlindColorIndex index)
 Get the color associated with a given Blind.
 
enum BlindType roll_blind_type (bool showdown)
 Choose a random Blind among the ones that haven't been beaten yet.
 
void init_unbeaten_blinds_lists (void)
 Initialize Boss and Showdown Blinds lists to roll from.
 
void set_blind_beaten (enum BlindType type)
 Remove the given Blind from the corresponding List so that we don't roll it again in the future.
 
void apply_blind_colors (enum BlindType type)
 Copy the palette associated with the given Blind and copy it in the right spot in the palette memory.
 
void apply_blind_tiles (enum BlindType type, enum BlindTokenLayers layer)
 Change the tiles of the BlindToken Sprite at a given layer to that of the given BlindType.
 
Spriteblind_token_new (enum BlindType type, int x, int y, enum BlindTokenLayers sprite_index)
 Create a new BlindToken sprite.
 

Detailed Description

Data structures and functions relative to the behaviour and graphics of Blinds.

Definition in file blind.h.

Macro Definition Documentation

◆ MAX_ANTE

#define MAX_ANTE   8

Definition at line 13 of file blind.h.

Enumeration Type Documentation

◆ BlindColorIndex

Indices of the Blind sprites' colors as encoded in the files' palettes with Aseprite.

Definition at line 48 of file blind.h.

◆ BlindState

enum BlindState

All the possible states an Ante's Blinds can be in when viewed in the "Blind Select" screen.

Definition at line 120 of file blind.h.

◆ BlindTokenLayers

Sprite IDs of the various Blind Tokens used in the game, expressed as an offset relative to BLIND_BASE_LAYER

See also
BLIND_BASE_LAYER

Definition at line 35 of file blind.h.

◆ BlindTokens

The sprites that display the blinds when in "GAME_BLIND_SELECT" state. There are only 3 blinds per Ante, so we don't need more sprites than that.

Definition at line 20 of file blind.h.

◆ BlindType

enum BlindType

All Blind types in the game are listed here.

Boss Blinds range from BLIND_TYPE_BOSS to BLIND_TYPE_SHOWDOWN - 1.

Showdown Blinds range from BLIND_TYPE_SHOWDOWN to BLIND_TYPE_MAX - 1

Definition at line 68 of file blind.h.

Function Documentation

◆ apply_blind_colors()

void apply_blind_colors ( enum BlindType  type)

Copy the palette associated with the given Blind and copy it in the right spot in the palette memory.

Parameters
typeof the Blind whose palette we need

Definition at line 232 of file blind.c.

◆ apply_blind_tiles()

void apply_blind_tiles ( enum BlindType  type,
enum BlindTokenLayers  layer 
)

Change the tiles of the BlindToken Sprite at a given layer to that of the given BlindType.

Parameters
typeof the Blind we want to apply the tiles of.
layerthe Sprite will be located at.
See also
BlindTokenLayers

Definition at line 268 of file blind.c.

◆ blind_get_color()

u16 blind_get_color ( enum BlindType  type,
enum BlindColorIndex  index 
)

Get the color associated with a given Blind.

Parameters
typethe BlindType whose palette will be used
indexof the color within the Blind's palette
Returns
the BGR555 value of the requested color

Definition at line 218 of file blind.c.

◆ blind_get_requirement()

u32 blind_get_requirement ( enum BlindType  type,
int  ante 
)

Get the score required to beat a certain blind (either the Small, Big, or any Boss/Showdown blind) at a certain Ante.

Parameters
typethe BlindType value of the blind we need the score requirement of
antethe Ante at which the blind type is encountered
Returns
the required score to beat the requested blind

Definition at line 106 of file blind.c.

◆ blind_get_reward()

int blind_get_reward ( enum BlindType  type)

Get the amount of money gained from beating a certain Blind.

Parameters
typethe BlindType of the beaten Blind
Returns
3 for the Small Blind, 4 for the Big one, 5 for Bosses and 8 for Showdowns

Definition at line 115 of file blind.c.

◆ blind_init()

void blind_init ( )

Definition at line 97 of file blind.c.

◆ blind_token_new()

Sprite * blind_token_new ( enum BlindType  type,
int  x,
int  y,
enum BlindTokenLayers  sprite_index 
)

Create a new BlindToken sprite.

Parameters
typeof the Blind the token needs to represent
xinitial position of the new Sprite on the horizontal axis
yinitial position of the new Sprite on the vertical axis
sprite_indexlayer of the new Sprite
See also
BlindTokenLayers

Definition at line 281 of file blind.c.

◆ init_unbeaten_blinds_lists()

void init_unbeaten_blinds_lists ( void  )

Initialize Boss and Showdown Blinds lists to roll from.

Definition at line 156 of file blind.c.

◆ roll_blind_type()

enum BlindType roll_blind_type ( bool  showdown)

Choose a random Blind among the ones that haven't been beaten yet.

Parameters
showdownwhether we want to roll a Showdown or a regular Boss Blind.
Returns
a BlindType value chosen at random

Definition at line 162 of file blind.c.

◆ set_blind_beaten()

void set_blind_beaten ( enum BlindType  type)

Remove the given Blind from the corresponding List so that we don't roll it again in the future.

Parameters
typethe BlindType of the Boss/Showdown Blind we've just beaten.

Definition at line 180 of file blind.c.