Skip to Content
The Alchemy Project

src/field/script_commands_djinni.c

A Djinni's battle start and its joining the party, the field effect sprites' slots, and a Jupiter Djinni's light. More…

Included by script_commands.c.

Macros

NameDescription
#defineDJINNI_AFTERIMAGES 8afterimages of the leaping Djinni
#defineDJINNI_LIGHT_RADIUS_TICKS 60The ticks a Jupiter Djinni's light widens, and later closes in over, so that it ends where it began; and the ticks it circles and drifts.
#defineDJINNI_LIGHT_CIRCLING_TICKS 40
#defineDJINNI_LIGHT_DRIFTING_TICKS 40
#defineLEAP_SOUND WHEN(DJINNI_LEAP_HIGH_JUMP_SOUND, SE_HIGH_JUMP, SE_WHOOSH)The sound of the Djinni's leap: SE_WHOOSH in the Japanese edition, SE_HIGH_JUMP from it.

Enumerations

NameDescription
enumDJINNI_LIGHT_STATE { DJINNI_LIGHT_WIDENING, DJINNI_LIGHT_CIRCLING, DJINNI_LIGHT_D … }The states of a Jupiter Djinni's light particle, in order.

Functions

NameDescription
voidfdEffectAdvanceSpinAngle (ACTOR *actor)Per-tick update: spins an actor 1/8 turn a tick.
voidfdActorMoveHalfwayTowardTarget (ACTOR *actor)Per-tick update: halves the actor's distance to its watched actor along x, y and z.
voidfdDjinnRunBattleStartHop (Sint32 djinniId)A Djinni's battle start: the Djinni (actor id) bounces twice, turns to face the leader with an anger vein over it, jumps three times where it stands, spinning and each time higher, then leaps 16 pixels at the leader trailing eight afterimages tinted for its element, and stops once it has come down within 20 pixels of the leader's height.
voidfdDjinnJoinParty (Sint32 actor, Sint32 element, Sint32 djinni)A Djinni joins.
voidfdDjinnRestoreActorAfterBattle (void)Puts a Djinni's actor back where its battle started from: for a pending Djinni battle (pendingDjinni from DJINNI_BATTLE_SCRIPT_FIRST, one for each Djinni, FLAG_KEEP_PARTY_POSITION set, the battle over) the scene's actor placed for that Djinni (condition = its flag) goes back to its placement's position, or 32 pixels north of the leader when the script has DJINN_NO_HOP set, and stands.
voidfdDjinnResolvePending (Sint32 shown)Settles a pending Djinni battle as a scene loads, from the battle's result in engineResult (the enemies defeated, BATTLE_OUTCOME_FLED when the party fled, -1 when it lost), as The Broken Seal's; a mimic chest's script (CONDITION_FLAG_SET) falls through to the clear.
voidfdEffectUpdateAllSlots (void)Event: updates the field effect sprites.
voidfdEffectInitSlots (void)Allocates and clears the field effect sprites (HEAP_SLOT_FIELD_EFFECT) and starts their update event.
voidfdEffectReleaseSlots (void)Stops the field effect sprites: removes their event, frees every slot still in use and releases their heap block, the field Psynergy's state with it.
voidfdDjinnAdvanceSpinAngle (ACTOR *djinni)Per-tick update of a joining Venus or Jupiter Djinni: spins it an eighth of a turn, as fdEffectAdvanceSpinAngle does.
voidfdEffectRunAngledApproachPhases (FIELD_PARTICLE *particle)Field effect sprite callback of a Jupiter Djinni's light particles: each circles its centre while it widens, circles, drifts toward a point 20 pixels over the leader and closes in, and is freed.

Description

A Djinni's battle start and its joining the party, the field effect sprites' slots, and a Jupiter Djinni's light. Part of script_commands.c.

Macros in detail

DJINNI_AFTERIMAGES

#define DJINNI_AFTERIMAGES 8

afterimages of the leaping Djinni

Referenced by fdDjinnRunBattleStartHop().

Definition at line 6 of file script_commands_djinni.c.

DJINNI_LIGHT_RADIUS_TICKS

#define DJINNI_LIGHT_RADIUS_TICKS 60

The ticks a Jupiter Djinni's light widens, and later closes in over, so that it ends where it began; and the ticks it circles and drifts.

Referenced by fdEffectRunAngledApproachPhases().

Definition at line 10 of file script_commands_djinni.c.

DJINNI_LIGHT_CIRCLING_TICKS

#define DJINNI_LIGHT_CIRCLING_TICKS 40

Referenced by fdEffectRunAngledApproachPhases().

Definition at line 11 of file script_commands_djinni.c.

DJINNI_LIGHT_DRIFTING_TICKS

#define DJINNI_LIGHT_DRIFTING_TICKS 40

Referenced by fdEffectRunAngledApproachPhases().

Definition at line 12 of file script_commands_djinni.c.

LEAP_SOUND

#define LEAP_SOUND WHEN(DJINNI_LEAP_HIGH_JUMP_SOUND, SE_HIGH_JUMP, SE_WHOOSH)

The sound of the Djinni's leap: SE_WHOOSH in the Japanese edition, SE_HIGH_JUMP from it.

Referenced by fdDjinnRunBattleStartHop().

Definition at line 53 of file script_commands_djinni.c.

Enumerations in detail

DJINNI_LIGHT_STATE

enum DJINNI_LIGHT_STATE

The states of a Jupiter Djinni's light particle, in order.

EnumeratorValueDescription
DJINNI_LIGHT_WIDENING0circles as its radius grows
DJINNI_LIGHT_CIRCLING1
DJINNI_LIGHT_DRIFTING2its centre drifts toward the leader
DJINNI_LIGHT_CLOSING3circles as its radius shrinks
DJINNI_LIGHT_DONE4frees its slot

Definition at line 15 of file script_commands_djinni.c.

Functions in detail

fdEffectAdvanceSpinAngle

void fdEffectAdvanceSpinAngle(ACTOR *actor)

Per-tick update: spins an actor 1/8 turn a tick.

Referenced by fdDjinnRunBattleStartHop().

Definition at line 25 of file script_commands_djinni.c.

fdActorMoveHalfwayTowardTarget

void fdActorMoveHalfwayTowardTarget(ACTOR *actor)

Per-tick update: halves the actor's distance to its watched actor along x, y and z.

References Sint32.

Referenced by fdDjinnRunBattleStartHop().

Definition at line 32 of file script_commands_djinni.c.

fdDjinnRunBattleStartHop

void fdDjinnRunBattleStartHop(Sint32 djinniId)

A Djinni's battle start: the Djinni (actor id) bounces twice, turns to face the leader with an anger vein over it, jumps three times where it stands, spinning and each time higher, then leaps 16 pixels at the leader trailing eight afterimages tinted for its element, and stops once it has come down within 20 pixels of the leader's height.

References fdActorCreateStub(), fdActorFaceDirectionById(), fdActorGetById(), fdActorJump(), fdActorMoveHalfwayTowardTarget(), fdActorRunRepeatedMotion(), fdActorSelectAnimationStub(), fdActorSetSpriteColorModeStub(), fdActorSetSpriteFlagsStub(), fdActorSetTargetPosFromMagnitudeAngle(), fdActorShowEmoteById(), fdEffectAdvanceSpinAngle(), fdScriptEnd(), fdScriptStart(), fdSpriteShareVRAMCacheEntry(), MainRoutineStateWork, Sint32, sySoundPlayStub() and sySynch().

Referenced by fdRequestDjinnBattle().

Definition at line 60 of file script_commands_djinni.c.

fdDjinnJoinParty

void fdDjinnJoinParty(Sint32 actor, Sint32 element, Sint32 djinni)

A Djinni joins. The element's last Djinni stands for the one of The Broken Seal's chosen for it (SCENE_STATE_CHOSEN_DJINN; none: nothing happens). While FLAG_DJINN_LESSON is set it joins the leader by its flag alone, otherwise the party member with the fewest; if it found one, the element's join effect plays at the actor (none for actor -1), the Djinni is added, and the actor's script slot is cleared (in every edition but the Japanese; the Japanese release leaves it set).

References fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdScriptEnd(), fdScriptStart(), fdWorldMapFreeze(), fdWorldMapReloadPendingAreaGraphics(), gmDjinnGiveToPartyStub(), MainRoutineStateWork, mnDjinnShowJoinedMessageStub(), SceneLocalState, Sint32, syGameFlagGet() and syGameFlagSet().

Referenced by dbTestGiveDjinni(), fdDjinnResolvePending(), scAncientLemuriaRimeJoins(), scApojiiIslandsHazeJoinsParty(), scAttekaInletGeodeJoins(), scContigoFreedDjinniJoinsParty(), scContigoSaltJoinsParty(), scFieldDjinnJoinParty(), scGarohMahaTellsTheLegend(), scIzumoRoomsGiveUzumeTheDoll(), scLohoMeetLull(), scMadraRoomsGiveHealingFungus(), scMagmaRockInsideMeetDjinni(), scMikasallaMeetSpark(), scProxMercuryDjinniJoins(), scProxMoldJoins(), scSettlementsMeetGel(), scSettlementsMeetLostJupiterDjinni(), scSettlementsMeetTinder(), scShamanVillageMeetAroma() and scTreasureIsleVenusDjinniJoins().

Definition at line 187 of file script_commands_djinni.c.

fdDjinnRestoreActorAfterBattle

void fdDjinnRestoreActorAfterBattle(void)

Puts a Djinni's actor back where its battle started from: for a pending Djinni battle (pendingDjinni from DJINNI_BATTLE_SCRIPT_FIRST, one for each Djinni, FLAG_KEEP_PARTY_POSITION set, the battle over) the scene's actor placed for that Djinni (condition = its flag) goes back to its placement's position, or 32 pixels north of the leader when the script has DJINN_NO_HOP set, and stands. fdEngineRun calls it as it rebuilds the scene, only while a script is still pending after fdDjinnResolvePending's first call, that is after a won battle; the second call then makes this actor join the party.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorSetPosAndResetMotionStub(), fdFindActorPlacement(), MainRoutineStateWork, Sint32 and syGameFlagGet().

Referenced by fdEngineRun().

Definition at line 239 of file script_commands_djinni.c.

fdDjinnResolvePending

void fdDjinnResolvePending(Sint32 shown)

Settles a pending Djinni battle as a scene loads, from the battle's result in engineResult (the enemies defeated, BATTLE_OUTCOME_FLED when the party fled, -1 when it lost), as The Broken Seal's; a mimic chest's script (CONDITION_FLAG_SET) falls through to the clear.

References fdDjinnJoinParty(), fdFindActorPlacement(), MainRoutineStateWork, Sint32, syGameFlagSet() and sySynch().

Referenced by fdEngineRun().

Definition at line 300 of file script_commands_djinni.c.

fdEffectUpdateAllSlots

void fdEffectUpdateAllSlots(void)

Event: updates the field effect sprites.

References fdParticleUpdate() and Sint32.

Referenced by fdEffectInitSlots() and fdEffectReleaseSlots().

Definition at line 369 of file script_commands_djinni.c.

fdEffectInitSlots

void fdEffectInitSlots(void)

Allocates and clears the field effect sprites (HEAP_SLOT_FIELD_EFFECT) and starts their update event.

References fdEffectUpdateAllSlots(), Sint32, syHeapSlotAllocate() and sySetEvent().

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect() and fdDjinnRunVenusJoinEffect().

Definition at line 381 of file script_commands_djinni.c.

fdEffectReleaseSlots

void fdEffectReleaseSlots(void)

Stops the field effect sprites: removes their event, frees every slot still in use and releases their heap block, the field Psynergy's state with it.

References fdEffectUpdateAllSlots(), fdParticleFree(), Sint32, syCloseEvent(), syHeapSlotRelease() and sySynch().

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect() and fdDjinnRunVenusJoinEffect().

Definition at line 393 of file script_commands_djinni.c.

fdDjinnAdvanceSpinAngle

void fdDjinnAdvanceSpinAngle(ACTOR *djinni)

Per-tick update of a joining Venus or Jupiter Djinni: spins it an eighth of a turn, as fdEffectAdvanceSpinAngle does.

Referenced by fdDjinnRunJupiterJoinEffect() and fdDjinnRunVenusJoinEffect().

Definition at line 412 of file script_commands_djinni.c.

fdEffectRunAngledApproachPhases

void fdEffectRunAngledApproachPhases(FIELD_PARTICLE *particle)

Field effect sprite callback of a Jupiter Djinni's light particles: each circles its centre while it widens, circles, drifts toward a point 20 pixels over the leader and closes in, and is freed. It turns 1/32 turn a tick throughout, and its radius grows, then shrinks, by 1 pixel a tick. The slot's origin is the centre, in screen coordinates (fdCameraWorldToScreen).

References fdActorGetById(), fdCameraWorldToScreen(), fdParticleFree(), MainRoutineStateWork and syVectorAddPolarOffset().

Referenced by fdDjinnRunJupiterJoinEffect().

Definition at line 422 of file script_commands_djinni.c.