Alchemy
Loading...
Searching...
No Matches

tret_tree_branch.c File Reference

A branch of Tret, the great tree, where Breeze, a Jupiter Djinni, waits; touch triggers move the leader and the camera along the branch. More...

Go to the source code of this file.

Enumerations

enum  { ACTOR_BREEZE = ACTOR_FIRST_PLACED , SPRITE_JUPITER_DJINNI = 0x5d }
 Breeze, the Jupiter Djinni on the branch: Djinni 61 is the name message "Breeze", and its placement is gone once its flag (FLAG_DJINNI_0 + 61) is set. More...

Functions

static void TretTreeBranch_StartBg3Split (void)
 Starts the scanline-dependent BG3 scroll callbacks.
static void Event_TalkToBreeze (void)
 Talking to Breeze: the Djinni hops and its battle starts.
const struct SceneEntrance * TretTreeBranch_GetEntrances (void)
const struct SceneRegion * TretTreeBranch_GetRegions (void)
const u32 * TretTreeBranch_GetExits (void)
const struct ScenePlacement * TretTreeBranch_GetPlacements (void)
static void TretTreeBranch_ShiftLeaderAndCameraByCells (s32 cellOffsetX, s32 cellOffsetZ)
 Moves the leader and camera by signed 16-pixel cell offsets, placing each at the terrain height of its destination.
static void Event_ShiftSouthFiveCells (void)
 Touch trigger 10: the leader and camera move 80 pixels south at once.
static void Event_ShiftNorthFiveCells (void)
 Touch trigger 11: the leader and camera move 80 pixels north at once.
static void Event_ShiftSouthFiveCellsSecond (void)
 Touch trigger 12: the same 80-pixel move south as trigger 10.
static void Event_ShiftNorthFiveCellsSecond (void)
 Touch trigger 13: the same 80-pixel move north as trigger 11.
static void Event_ShiftSouthSixCells (void)
 Touch trigger 14: the leader and camera move 96 pixels south at once.
static void Event_ShiftNorthSixCells (void)
 Touch trigger 15: the leader and camera move 96 pixels north at once.
static void Event_TakeTouchedExit (void)
 Walking into one of exits 1 to 8: the exit sound plays and the party leaves by the exit touched.
static void TretTreeBranch_SetRevealWindow (struct DisplayTransitionState *state)
 Selects the same mask and window parameters for Reveal and scene entry.
static void Event_CastReveal (void)
 Casting Reveal on the branch (its phase 2): the window transition and BG1's blend over the rest of the screen are set again, as when the scene opened.
const struct SceneEvent * TretTreeBranch_GetEvents (void)
 Returns the touch, talk, exit and Reveal events for this branch.
static void UNUSED TretTreeBranch_RunEmptyEvent (void)
 Unused event hook: begins and immediately ends an event.
static void UNUSED TretTreeBranch_UnusedHookFirst (void)
static void UNUSED TretTreeBranch_UnusedHookSecond (void)
static void UNUSED TretTreeBranch_ExchangeInputPacket (void)
 Unused exchange callback: puts held/repeated keys in the transfer header.
s32 TretTreeBranch_Initialize (void)
 Initializes the backdrop transition and installs BG3's scanline scroll split.
static void TretTreeBranch_ApplyBg3ScrollAtScanline (void)
 HBlank selects BG3's horizontal offset for the next scanline.
static void TretTreeBranch_UpdateBg3ScrollSplit (void)
 Updates the split from the first map layer's pixel position.

Variables

static u16 sTransferHeader [16]
static u8 sTransferData [96]
static s32 sSplitLine
static u16 sHofsAtOrAfterSplit
static u16 sHofsBeforeSplit
struct SceneEntrance gTretTreeBranch_Entrances []
u32 gTretTreeBranch_Exits []
struct ScenePlacement gTretTreeBranch_Placements []
struct SceneEvent gTretTreeBranch_Events []
u16 gTretTreeBranch_CellSteps []

Detailed Description

A branch of Tret, the great tree, where Breeze, a Jupiter Djinni, waits; touch triggers move the leader and the camera along the branch.

Definition in file tret_tree_branch.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Breeze, the Jupiter Djinni on the branch: Djinni 61 is the name message "Breeze", and its placement is gone once its flag (FLAG_DJINNI_0 + 61) is set.

Enumerator
ACTOR_BREEZE 
SPRITE_JUPITER_DJINNI 

Definition at line 42 of file tret_tree_branch.c.

Function Documentation

◆ TretTreeBranch_StartBg3Split()

void TretTreeBranch_StartBg3Split ( void )
static

Starts the scanline-dependent BG3 scroll callbacks.

Runs the BG3 scroll selection at every HBlank, updating the split each frame.

Definition at line 250 of file tret_tree_branch.c.

Referenced by TretTreeBranch_Initialize(), and TretTreeBranch_StartBg3Split().

◆ Event_TalkToBreeze()

void Event_TalkToBreeze ( void )
static

Talking to Breeze: the Djinni hops and its battle starts.

Definition at line 54 of file tret_tree_branch.c.

Referenced by Event_TalkToBreeze().

◆ TretTreeBranch_GetEntrances()

const struct SceneEntrance * TretTreeBranch_GetEntrances ( void )

Definition at line 58 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetEntrances().

◆ TretTreeBranch_GetRegions()

const struct SceneRegion * TretTreeBranch_GetRegions ( void )

Definition at line 62 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetRegions().

◆ TretTreeBranch_GetExits()

const u32 * TretTreeBranch_GetExits ( void )

Definition at line 64 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetExits().

◆ TretTreeBranch_GetPlacements()

const struct ScenePlacement * TretTreeBranch_GetPlacements ( void )

Definition at line 66 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetPlacements().

◆ TretTreeBranch_ShiftLeaderAndCameraByCells()

void TretTreeBranch_ShiftLeaderAndCameraByCells ( s32 cellOffsetX,
s32 cellOffsetZ )
static

Moves the leader and camera by signed 16-pixel cell offsets, placing each at the terrain height of its destination.

Definition at line 72 of file tret_tree_branch.c.

Referenced by Event_ShiftNorthFiveCells(), Event_ShiftNorthFiveCellsSecond(), Event_ShiftNorthSixCells(), Event_ShiftSouthFiveCells(), Event_ShiftSouthFiveCellsSecond(), Event_ShiftSouthSixCells(), and TretTreeBranch_ShiftLeaderAndCameraByCells().

◆ Event_ShiftSouthFiveCells()

void Event_ShiftSouthFiveCells ( void )
static

Touch trigger 10: the leader and camera move 80 pixels south at once.

Definition at line 108 of file tret_tree_branch.c.

Referenced by Event_ShiftSouthFiveCells().

◆ Event_ShiftNorthFiveCells()

void Event_ShiftNorthFiveCells ( void )
static

Touch trigger 11: the leader and camera move 80 pixels north at once.

Definition at line 113 of file tret_tree_branch.c.

Referenced by Event_ShiftNorthFiveCells().

◆ Event_ShiftSouthFiveCellsSecond()

void Event_ShiftSouthFiveCellsSecond ( void )
static

Touch trigger 12: the same 80-pixel move south as trigger 10.

Definition at line 118 of file tret_tree_branch.c.

Referenced by Event_ShiftSouthFiveCellsSecond().

◆ Event_ShiftNorthFiveCellsSecond()

void Event_ShiftNorthFiveCellsSecond ( void )
static

Touch trigger 13: the same 80-pixel move north as trigger 11.

Definition at line 123 of file tret_tree_branch.c.

Referenced by Event_ShiftNorthFiveCellsSecond().

◆ Event_ShiftSouthSixCells()

void Event_ShiftSouthSixCells ( void )
static

Touch trigger 14: the leader and camera move 96 pixels south at once.

Definition at line 128 of file tret_tree_branch.c.

Referenced by Event_ShiftSouthSixCells().

◆ Event_ShiftNorthSixCells()

void Event_ShiftNorthSixCells ( void )
static

Touch trigger 15: the leader and camera move 96 pixels north at once.

Definition at line 133 of file tret_tree_branch.c.

Referenced by Event_ShiftNorthSixCells().

◆ Event_TakeTouchedExit()

void Event_TakeTouchedExit ( void )
static

Walking into one of exits 1 to 8: the exit sound plays and the party leaves by the exit touched.

Definition at line 139 of file tret_tree_branch.c.

Referenced by Event_TakeTouchedExit().

◆ TretTreeBranch_SetRevealWindow()

void TretTreeBranch_SetRevealWindow ( struct DisplayTransitionState * state)
inlinestatic

Selects the same mask and window parameters for Reveal and scene entry.

Definition at line 150 of file tret_tree_branch.c.

Referenced by Event_CastReveal(), TretTreeBranch_Initialize(), and TretTreeBranch_SetRevealWindow().

◆ Event_CastReveal()

void Event_CastReveal ( void )
static

Casting Reveal on the branch (its phase 2): the window transition and BG1's blend over the rest of the screen are set again, as when the scene opened.

Definition at line 158 of file tret_tree_branch.c.

Referenced by Event_CastReveal(), and Event_CastReveal().

◆ TretTreeBranch_GetEvents()

const struct SceneEvent * TretTreeBranch_GetEvents ( void )

Returns the touch, talk, exit and Reveal events for this branch.

Definition at line 171 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetEvents().

◆ TretTreeBranch_RunEmptyEvent()

void UNUSED TretTreeBranch_RunEmptyEvent ( void )
static

Unused event hook: begins and immediately ends an event.

Definition at line 176 of file tret_tree_branch.c.

Referenced by TretTreeBranch_RunEmptyEvent().

◆ TretTreeBranch_UnusedHookFirst()

void UNUSED TretTreeBranch_UnusedHookFirst ( void )
static

Definition at line 181 of file tret_tree_branch.c.

Referenced by TretTreeBranch_UnusedHookFirst().

◆ TretTreeBranch_UnusedHookSecond()

void UNUSED TretTreeBranch_UnusedHookSecond ( void )
static

Definition at line 183 of file tret_tree_branch.c.

Referenced by TretTreeBranch_UnusedHookSecond().

◆ TretTreeBranch_ExchangeInputPacket()

void UNUSED TretTreeBranch_ExchangeInputPacket ( void )
static

Unused exchange callback: puts held/repeated keys in the transfer header.

Definition at line 186 of file tret_tree_branch.c.

Referenced by TretTreeBranch_ExchangeInputPacket().

◆ TretTreeBranch_Initialize()

s32 TretTreeBranch_Initialize ( void )

Initializes the backdrop transition and installs BG3's scanline scroll split.

Returns 0 for the overlay initialization entry point.

Definition at line 196 of file tret_tree_branch.c.

Referenced by TretTreeBranch_Initialize().

◆ TretTreeBranch_ApplyBg3ScrollAtScanline()

void TretTreeBranch_ApplyBg3ScrollAtScanline ( void )
static

HBlank selects BG3's horizontal offset for the next scanline.

Definition at line 223 of file tret_tree_branch.c.

Referenced by TretTreeBranch_ApplyBg3ScrollAtScanline(), and TretTreeBranch_StartBg3Split().

◆ TretTreeBranch_UpdateBg3ScrollSplit()

void TretTreeBranch_UpdateBg3ScrollSplit ( void )
static

Updates the split from the first map layer's pixel position.

Before the split, scroll subtracts one pixel for every four elapsed frames.

Definition at line 238 of file tret_tree_branch.c.

Referenced by TretTreeBranch_StartBg3Split(), and TretTreeBranch_UpdateBg3ScrollSplit().

Variable Documentation

◆ sTransferHeader

u16 sTransferHeader[16]
static

Definition at line 47 of file tret_tree_branch.c.

Referenced by TretTreeBranch_ExchangeInputPacket().

◆ sTransferData

u8 sTransferData[96]
static

Definition at line 48 of file tret_tree_branch.c.

Referenced by TretTreeBranch_ExchangeInputPacket().

◆ sSplitLine

s32 sSplitLine
static

◆ sHofsAtOrAfterSplit

u16 sHofsAtOrAfterSplit
static

◆ sHofsBeforeSplit

u16 sHofsBeforeSplit
static

◆ gTretTreeBranch_Entrances

struct SceneEntrance gTretTreeBranch_Entrances[]
Initial value:
= {
{0, CONDITION_ALWAYS, 100, 0, 100, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{1, CONDITION_ALWAYS, 328, 0, 424, FACING_WEST, 0, -1, -1, -1, -1, 0},
{2, CONDITION_ALWAYS, 424, 0, 440, FACING_EAST, 0, -1, -1, -1, -1, 0},
{3, CONDITION_ALWAYS, 376, 0, 360, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{4, CONDITION_ALWAYS, 424, 0, 328, FACING_EAST, 0, -1, -1, -1, -1, 0},
{5, CONDITION_ALWAYS, 376, 0, 264, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{6, CONDITION_ALWAYS, 328, 0, 248, FACING_WEST, 0, -1, -1, -1, -1, 0},
{7, CONDITION_ALWAYS, 328, 0, 152, FACING_WEST, 0, -1, -1, -1, -1, 0},
{8, CONDITION_ALWAYS, 424, 0, 136, FACING_EAST, 0, -1, -1, -1, -1, 0},
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_EAST
Definition field_scene.h:26
@ FACING_SOUTH
Definition field_scene.h:28
@ FACING_WEST
Definition field_scene.h:30

Definition at line 256 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetEntrances().

◆ gTretTreeBranch_Exits

u32 gTretTreeBranch_Exits[]
Initial value:
= {
SCENE_EXITS(46), SCENE_EXIT(1, 45, 2), SCENE_EXIT(2, 45, 3),
SCENE_EXIT(3, 45, 4), SCENE_EXIT(4, 45, 5), SCENE_EXIT(5, 45, 7),
SCENE_EXIT(6, 45, 6), SCENE_EXIT(7, 45, 8), SCENE_EXIT(8, 45, 9),
}
#define SCENE_EXITS(scene)
Definition field_scene.h:72
#define SCENE_EXIT(exit, scene, entrance)
Definition field_scene.h:73
#define SCENE_EXITS_END
Definition field_scene.h:77

Definition at line 269 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetExits().

◆ gTretTreeBranch_Placements

struct ScenePlacement gTretTreeBranch_Placements[]
Initial value:
= {
}
@ DJINNI_BREEZE
Definition djinn_ids.h:33
@ TALK_FACE_PARTY
@ ACTOR_STAND
#define PIXELS(value)
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
Definition flags.h:15
@ SPRITE_JUPITER_DJINNI

Definition at line 277 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetPlacements().

◆ gTretTreeBranch_Events

struct SceneEvent gTretTreeBranch_Events[]
Initial value:
= {
}
@ ABILITY_REVEAL
Definition ability_ids.h:19
#define SCENE_EVENTS_END
@ EVENT_TOUCH
@ EVENT_TALK
#define PSYNERGY_IN_AREA(ability, phase)
#define EVENT_SCRIPT(script)
static void Event_ShiftNorthSixCells(void)
Touch trigger 15: the leader and camera move 96 pixels north at once.
static void Event_ShiftSouthFiveCellsSecond(void)
Touch trigger 12: the same 80-pixel move south as trigger 10.
static void Event_ShiftNorthFiveCells(void)
Touch trigger 11: the leader and camera move 80 pixels north at once.
static void Event_CastReveal(void)
Casting Reveal on the branch (its phase 2): the window transition and BG1's blend over the rest of th...
static void Event_TalkToBreeze(void)
Talking to Breeze: the Djinni hops and its battle starts.
@ ACTOR_BREEZE
static void Event_ShiftSouthSixCells(void)
Touch trigger 14: the leader and camera move 96 pixels south at once.
static void Event_TakeTouchedExit(void)
Walking into one of exits 1 to 8: the exit sound plays and the party leaves by the exit touched.
static void Event_ShiftSouthFiveCells(void)
Touch trigger 10: the leader and camera move 80 pixels south at once.
static void Event_ShiftNorthFiveCellsSecond(void)
Touch trigger 13: the same 80-pixel move north as trigger 11.

Definition at line 284 of file tret_tree_branch.c.

Referenced by TretTreeBranch_GetEvents().

◆ gTretTreeBranch_CellSteps

u16 gTretTreeBranch_CellSteps[]
Initial value:
= {
MAP_CELL_STEP(0, 96, 2, 2, 2),
MAP_CELL_STEP(2, 96, 2, 2, 2),
}
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
#define MAP_CELL_STEPS_END
Definition field_event.h:61

Definition at line 310 of file tret_tree_branch.c.