cloak.c
Cloak.
games/tbs/src/object/psynergy_effects/cloak.c on GitHub
Cloak. Part of psynergy_effects.c, compiled only through it.
Functions
FieldFx_CheckCloakTile
void FieldFx_CheckCloakTile(void)
Scheduler callback of Cloak: when the tile under the leader is not CLOAK_TILE, requests CLOAK_END. On the world map (event mode 3) it reads the 32-pixel gMapBlocks, elsewhere the 16-pixel terrain map. Runs once a frame from FieldFx_StartCloak, and again from FieldFx_ResumeCloakCheck when a scene loads with the leader still cloaked.
Used by FieldFx_EndCloak, FieldFx_ResumeCloakCheck, FieldFx_StartCloak.
FieldFx_EndCloak
void FieldFx_EndCloak(void)
Ends Cloak: stops the tile check and makes the leader blink back into sight, clearing cloaked. The leader is white (SPRITE_COLOR_WHITE) for the first five blinks, its outline (sprite flag bit 1) on and off; the last five alternate white and its own colours (param 0). Each half is 2 frames. The leader ends with its shadow back (flags 1). FieldEvent_RunTypeHandler runs it when the CLOAK_END request is handled.
Used by FieldEvent_RunTypeHandler, FieldFx_StartCloak.
FieldFx_ResumeCloakCheck
void FieldFx_ResumeCloakCheck(void)
Starts the Cloak tile check if the leader is hidden. Field_RunScene calls it as a scene loads, since gGameState.cloaked outlives the scene.
Used by Field_RunScene.
FieldFx_StartCloak
void FieldFx_StartCloak(void)
The leader blinks 10 times and hides (cloaked set), and the tile check starts; where the leader cannot hide it shows again at once.
Abilities: Cloak (field kind 10).
Hidden, the leader is drawn as an outline only (sprite flags 2: outlined, no shadow), and while gGameState.cloaked is set no random battles come (Encounter_SelectEnemyGroup). Called by BattleFx_Run and BattleFx_DispatchRequestKind.
Used by BattleFx_DispatchRequestKind, BattleFx_Run.
Macros
CLOAK_TILE
#define CLOAK_TILE 0xfb
The step code of the cells Cloak can stay hidden on: byte 2 of a cell (MapCell.collisionCode), or of a 4-byte gMapBlocks entry on the world map.
Used by FieldFx_CheckCloakTile.
CLOAK_END
#define CLOAK_END 0x2092
The Psynergy request that ends Cloak: ACT_PACKED (0x2000, no PP) | ABILITY_CLOAK (0x92).
Used by FieldFx_CheckCloakTile, FieldFx_StartCloak.