Implementation of functions related to the handling of Skip Tags. More...
#include "skip_tag.h"#include "audio_utils.h"#include "game/blind_select.h"#include "game_variables.h"#include "joker.h"#include "mgba_logger.h"#include "pool.h"#include "skip_tags_gfx.h"#include "soundbank.h"#include "state_machine.h"#include "timer.h"#include "util.h"#include <stdlib.h>#include <tonc.h>Go to the source code of this file.
Data Structures | |
| struct | TagProcessInfo |
Macros | |
| #define | MAX_NON_OVERLAPING_TAG_SPRITES 5 |
| #define | SKIP_TAG_HIDE_X_OFFSET 20 |
| #define | SKIP_TAG_GET_BOUNCE_STRENGTH (float2fx(-0.3f)) |
| #define | SKIP_TAG_TRIGGER_BOUNCE_STRENGTH (float2fx(-0.4f)) |
| #define | NB_ANTE1_SKIP_TAGS 7 |
| Number of implemented Skip Tags available from Ante 1. | |
| #define | NB_SKIP_TAG_TYPES 10 |
| Number of implemented Skip Tags. | |
Enumerations | |
| enum | SkipTagProcessState { SKIP_TAG_PROCESS_STATE_SEARCH , SKIP_TAG_PROCESS_STATE_TRIGGER , SKIP_TAG_PROCESS_STATE_REMOVE , SKIP_TAG_PROCESS_STATE_MAX } |
Functions | |
| 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. | |
| static int | get_skip_tag_sprites_spacing (void) |
| static void | rearrange_skip_tag_sprites (int nb_owned_tags, int tag_spacing) |
| GBAL_UNUSED 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. | |
| static void | skip_tag_search_for_event (void) |
| static void | skip_tag_trigger_for_event (void) |
| static void | skip_tag_remove_for_event (void) |
| 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. | |
Variables | |
| static const BG_POINT | OWNED_SKIP_TAGS_BASE_POS = {219, 97} |
| static const int | OWNED_SKIP_TAGS_STACK_HEIGHT = 64 |
| static const int | OWNED_SKIP_TAGS_SPACING = 12 |
| static const u8 | ante1_skip_tags_roll_table [NB_ANTE1_SKIP_TAGS] |
| static const u8 | all_skip_tags_roll_table [NB_SKIP_TAG_TYPES] |
| static List | s_owned_skip_tags |
| static StateInfo | tag_process_state_fn [SKIP_TAG_PROCESS_STATE_MAX] |
| static StateMachine | tag_process_sm |
| static TagProcessInfo | s_tag_process_info |
| static SkipTag * | s_consumed_tag = NULL |
| static int | s_consumed_tag_idx = 0 |
| static SkipTagCallback | s_consumed_tag_effect_func = NULL |
Implementation of functions related to the handling of Skip Tags.
Definition in file skip_tag.c.
| #define MAX_NON_OVERLAPING_TAG_SPRITES 5 |
Definition at line 22 of file skip_tag.c.
| #define NB_ANTE1_SKIP_TAGS 7 |
Number of implemented Skip Tags available from Ante 1.
Definition at line 40 of file skip_tag.c.
| #define NB_SKIP_TAG_TYPES 10 |
Number of implemented Skip Tags.
Definition at line 46 of file skip_tag.c.
| #define SKIP_TAG_GET_BOUNCE_STRENGTH (float2fx(-0.3f)) |
Definition at line 25 of file skip_tag.c.
| #define SKIP_TAG_HIDE_X_OFFSET 20 |
Definition at line 23 of file skip_tag.c.
| #define SKIP_TAG_TRIGGER_BOUNCE_STRENGTH (float2fx(-0.4f)) |
Definition at line 26 of file skip_tag.c.
| enum SkipTagProcessState |
Definition at line 302 of file skip_tag.c.
| 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.
| blind_tag |
Definition at line 230 of file skip_tag.c.
| List * get_owned_skip_tags | ( | void | ) |
|
inlinestatic |
Definition at line 169 of file skip_tag.c.
|
static |
Definition at line 177 of file skip_tag.c.
| void remove_all_skip_tags | ( | void | ) |
Delete all owned Skip Tags.
Definition at line 289 of file skip_tag.c.
| void remove_skip_tag | ( | int | tag_idx | ) |
Pops the Tag at index in owned list, destroys it and rearranges the remaining Tags' sprites.
| tag_idx | index of the Tag to remove in owned list |
Definition at line 279 of file skip_tag.c.
| 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.
Definition at line 154 of file skip_tag.c.
| void set_owned_skip_tags_moved_offscreen | ( | bool | move_offscreen | ) |
Show or hide the owned SkipTag sprites by moving them offscreen to the right.
| move_offscreen | true to move the sprites offscreen, false to return them onscreen |
Definition at line 141 of file skip_tag.c.
| int skip_tag_count | ( | enum SkipTagTypes | tag_type | ) |
Counts how many tags of a certain type we own.
| tag_type | SkipTagType to count |
Definition at line 213 of file skip_tag.c.
| void skip_tag_destroy | ( | SkipTag ** | tag | ) |
Destroy the given SkipTag, invalidate it in the corresponding memory pool and set the pointer provided to NULL.
| tag | pointer of pointer to the SkipTag we want to destroy |
Definition at line 128 of file skip_tag.c.
| GBAL_UNUSED bool skip_tag_is_owned | ( | enum SkipTagTypes | tag_type | ) |
Checks if the given tag type is present in owned Tags list.
| tag_type | SkipTagType to check |
Definition at line 197 of file skip_tag.c.
| 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.
| tag_type | the ID of the Tag we want |
Definition at line 83 of file skip_tag.c.
| enum SkipTagProcStage skip_tag_process_get_proc_stage | ( | void | ) |
Recover the current stage of the Tag processing.
Definition at line 339 of file skip_tag.c.
| 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.
Definition at line 357 of file skip_tag.c.
| 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.
Definition at line 366 of file skip_tag.c.
| 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.
| checked_tag_event | the event for which the owned Tags will be evaluated |
Definition at line 344 of file skip_tag.c.
|
static |
Definition at line 452 of file skip_tag.c.
|
static |
Definition at line 386 of file skip_tag.c.
| void skip_tag_set_sprite | ( | SkipTag * | tag, |
| s16 | layer | ||
| ) |
Set the sprite for the given SkipTag, according to its internal ID.
| tag | pointer to the SkipTag object |
| layer | sprite 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.
|
static |
Definition at line 421 of file skip_tag.c.
|
static |
Definition at line 61 of file skip_tag.c.
|
static |
Definition at line 50 of file skip_tag.c.
|
static |
Definition at line 30 of file skip_tag.c.
|
static |
Definition at line 33 of file skip_tag.c.
|
static |
Definition at line 32 of file skip_tag.c.
|
static |
Definition at line 382 of file skip_tag.c.
|
static |
Definition at line 384 of file skip_tag.c.
|
static |
Definition at line 383 of file skip_tag.c.
|
static |
Definition at line 74 of file skip_tag.c.
|
static |
Definition at line 332 of file skip_tag.c.
|
static |
Definition at line 320 of file skip_tag.c.
|
static |
Definition at line 314 of file skip_tag.c.