GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
skip_tag.h
Go to the documentation of this file.
1
5#ifndef SKIP_TAGS_H
6#define SKIP_TAGS_H
7
8#include "game/common_ui.h"
9#include "graphic_utils.h"
10#include "joker.h"
11#include "sprite.h"
12
13#include <tonc.h>
14
21{
22 SMALL_BLIND_SKIP_TAG_LAYER,
23 BIG_BLIND_SKIP_TAG_LAYER,
24 OWNED_SKIP_TAG_STARTING_LAYER
25};
26
27// Tile ID for the starting index in the tile memory
28#define SKIP_TAG_TID (SKIP_TAG_STARTING_LAYER * SKIP_TAG_SPRITE_SIZE)
29
30#define INVESTMENT_TAG_REWARD 25
31
32// clang-format off
45{
46 SKIP_TAG_TYPE_UNCOMMON, // TODO
47 SKIP_TAG_TYPE_RARE, // TODO
48 SKIP_TAG_TYPE_INVESTMENT,
49 SKIP_TAG_TYPE_VOUCHER, // NEEDS VOUCHERS
50 SKIP_TAG_TYPE_BOSS,
51 SKIP_TAG_TYPE_STANDARD, // NEEDS PACKS
52 SKIP_TAG_TYPE_CHARM, // NEEDS PACKS
53 SKIP_TAG_TYPE_METEOR, // NEEDS PACKS
54 SKIP_TAG_TYPE_BUFFOON, // NEEDS PACKS
55 SKIP_TAG_TYPE_HANDY,
56 SKIP_TAG_TYPE_GARBAGE,
57 SKIP_TAG_TYPE_ETHEREAL, // NEEDS PACKS
58 SKIP_TAG_TYPE_COUPON, // TODO
59 SKIP_TAG_TYPE_DOUBLE,
60 SKIP_TAG_TYPE_JUGGLE,
61 SKIP_TAG_TYPE_D6,
62 SKIP_TAG_TYPE_TOP_UP,
63 SKIP_TAG_TYPE_SPEED,
64 SKIP_TAG_TYPE_ORBITAL, // NEEDS HANDS MENU
65 SKIP_TAG_TYPE_ECONOMY,
66 MAX_SKIP_TAG_TYPES
67};
68// clang-format on
69
70typedef struct SkipTag
71{
73 enum SkipTagTypes type;
74
75} SkipTag;
76
77enum SkipTagEvent
78{
79 SKIP_TAG_EVENT_NONE, // For tags not yet impelemented, does nothing
80 SKIP_TAG_EVENT_IMMEDIATE, // Triggers immediately after being bought.
81 // (e.g. Boss, Charm, Double,...)
82 SKIP_TAG_EVENT_ON_ROUND_START, // Triggers when starting a new round (Juggler)
83 SKIP_TAG_EVENT_ON_ROUND_END, // Triggers when beating a round (Investment)
84 SKIP_TAG_EVENT_ON_SHOP_INIT // Triggers when entering the Shop (e.g. Coupon, D6,...)
85};
86
87enum SkipTagProcStage
88{
89 SKIP_TAG_PROCESS_STAGE_NONE,
90 SKIP_TAG_PROCESS_STAGE_TRIGGER,
91 SKIP_TAG_PROCESS_STAGE_END
92};
93
94// SkipTagCallbacks will attempt to either return whether the SkipTag can be activated or trigger it
95typedef bool (*SkipTagCondition)(void);
96typedef void (*SkipTagCallback)(void);
97
107typedef struct
108{
109 enum SkipTagEvent event_type;
110 SkipTagCondition tag_condition_func;
111 SkipTagCallback tag_effect_func;
113
123
130
140SkipTag* skip_tag_new(enum SkipTagTypes tag_type);
141
149void skip_tag_set_sprite(SkipTag* tag, s16 layer);
150
157void skip_tag_destroy(SkipTag** tag);
158
164void set_owned_skip_tags_moved_offscreen(bool move_offscreen);
165
174
181bool skip_tag_is_owned(enum SkipTagTypes tag_type);
182
189int skip_tag_count(enum SkipTagTypes tag_type);
190
197void add_skip_tag(SkipTag** blind_tag);
198
205void remove_skip_tag(int tag_idx);
206
210void remove_all_skip_tags(void);
211
217enum SkipTagProcStage skip_tag_process_get_proc_stage(void);
218
237void skip_tag_process_start(enum SkipTagEvent checked_tag_event);
238
249void skip_tag_process_pause(void);
250
258void skip_tag_process_resume(void);
259
260#endif // SKIP_TAGS_H
Common functions to render UI elements.
Graphic utility functions.
Functions relative to the handling of Jokers.
void remove_skip_tag(int tag_idx)
Pops the Tag at index in owned list, destroys it and rearranges the remaining Tags' sprites.
Definition skip_tag.c:279
bool skip_tag_is_owned(enum SkipTagTypes tag_type)
Checks if the given tag type is present in owned Tags list.
Definition skip_tag.c:197
SkipTagLayers
Sprite IDs of the Skip Tags, as an offset relative to SKIP_TAG_STARTING_LAYER.
Definition skip_tag.h:21
void set_owned_skip_tags_moved_offscreen(bool move_offscreen)
Show or hide the owned SkipTag sprites by moving them offscreen to the right.
Definition skip_tag.c:141
void skip_tag_process_pause(void)
Suspend the processing of Skip Tags.
Definition skip_tag.c:357
void skip_tag_set_sprite(SkipTag *tag, s16 layer)
Set the sprite for the given SkipTag, according to its internal ID.
Definition skip_tag.c:94
SkipTagTypes
List of all Skip Tags, in the order they are in on their spritesheet. Not all of them are implemented...
Definition skip_tag.h:45
void skip_tag_destroy(SkipTag **tag)
Destroy the given SkipTag, invalidate it in the corresponding memory pool and set the pointer provide...
Definition skip_tag.c:128
SkipTag * roll_skip_tag(void)
Create a new SkipTag with a random ID, picked by taking the Ante into account, as some Tags only appe...
Definition skip_tag.c:154
void skip_tag_process_start(enum SkipTagEvent checked_tag_event)
Start Skip Tag processing for the specified event.
Definition skip_tag.c:344
enum SkipTagProcStage skip_tag_process_get_proc_stage(void)
Recover the current stage of the Tag processing.
Definition skip_tag.c:339
void skip_tag_process_resume(void)
Resume the processing of Skip Tags.
Definition skip_tag.c:366
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.
Definition skip_tag.c:230
void remove_all_skip_tags(void)
Delete all owned Skip Tags.
Definition skip_tag.c:289
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 mem...
Definition skip_tag.c:83
int skip_tag_count(enum SkipTagTypes tag_type)
Counts how many tags of a certain type we own.
Definition skip_tag.c:213
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.
Definition skip_tag.c:76
Sprite system for Gbalatro.
A doubly-linked list.
Definition list.h:61
Data structure containing the info about a Skip Tag, namely:
Definition skip_tag.h:108
A sprite object is a sprite that is focusable and movable in animation.
Definition sprite.h:86