Alchemy
Loading...
Searching...
No Matches

xian.c File Reference

Xian: the water carrier who spills her water, Frost on the spill, the kung fu student and his training tree, Feizhi, and a Mercury Djinni. More...

Go to the source code of this file.

Macros

#define NULL   ((void *)0)
#define XIAN_WATER_CARRIER_UPDATE   ((void *)Xian_WatchWaterCarrierPath)

Enumerations

enum  {
  ACTOR_KUNG_FU_STUDENT = 14 , ACTOR_FEIZHI = 17 , ACTOR_WATER_CARRIER , ACTOR_TRAINING_TREE ,
  ACTOR_PUDDLE , ACTOR_FORCE_TARGET , ACTOR_DJINNI , ACTOR_FIRST_DECORATION
}
 The actors, numbered from the placements (the first placed is actor 8). More...
enum  { ANIM_PUDDLE_FROZEN = 5 }
enum  { XIAN_TRIGGER_CARRIER_BLOCKED = 200 , XIAN_CARRIER_BLOCKED_FRAMES = 120 }
 The trigger the water carrier raises when the leader has stood in her way for two seconds. More...

Functions

static void Xian_RecruitVillageDjinni (void)
 Talking to the Djinni: it joins the party (Mercury Djinni 2).
static void Xian_UpdateFrozenPuddleLayer (void)
 Draws the frozen puddle under the leader while the leader stands on top of it.
static void Xian_RotateTrainingTree (void)
 Rotates the training tree during the student's strike and Force animation.
static void Xian_SpawnTrainingParticles (void)
 Emits particles beside the student every fourth frame.
static s32 Xian_UpdateCarrierTracking (struct FieldActor *actor, struct FieldActor *target, s32 distanceLimit, s32 forceTracking)
 Tracks a nearby target only within the actor's current facing sector.
static s32 Xian_WatchWaterCarrierPath (union FieldObject *fieldObject)
const struct SceneEntrance * Xian_GetEntrances (void)
const struct SceneRegion * Xian_GetRegions (void)
const u32 * Xian_GetExits (void)
const struct ScenePlacement * Xian_GetPlacements (void)
 Once Xian has heard Hsu is trapped, actor 15 turns to face the party.
static void Xian_AskAboutYoungWarriors (void)
 Asks about the young warriors' way here.
static void Xian_TalkToWaterCarrier (void)
 Talking to the water carrier.
static void Xian_UpdatePuddlePriority (void)
 Frost on the spilled water, before it freezes: the puddle is drawn in front while the leader stands north of it.
static void Xian_FreezeSpilledWater (void)
 Frost freezes the spilled water: the puddle turns to ice the leader can stand on, and there is nothing left to jump over.
static void Xian_TalkToKungFuStudent (void)
 The kung fu student.
static void Xian_TalkToFeizhi (void)
 Talking to Feizhi.
static void Xian_JumpOverSpilledWater (void)
 Walking into the spilled water before it is frozen: the leader jumps two cells over it, where nothing stands in the way.
static void Xian_WalkThroughExit (s32 exitId)
 Walks the leader through a doorway and leaves by its exit.
static void Xian_OpenDoorAndLeave (void)
 Walking into one of Xian's doors: it opens and the party goes in.
static void Xian_StrikeTrainingTreeWithForce (void)
 Force on the training tree: it jumps, and the student cries out.
static void Xian_MoveAsideForWaterCarrier (void)
 The leader has stood in the water carrier's way for two seconds: both walk to the start of her route, the leader turns west, and she sets off again.
const struct SceneEvent * Xian_GetEvents (void)
s32 Xian_Initialize (void)
 Queues sound 169 and sets up the village as the story and this visit left it.

Variables

s32 gEffectScript0 []
s32 gEffectScript1 []
s32 gEffectScript2 []
const s32 * gEffectScripts []
s32 gXian_WaterCarrierRoute []
 The water carrier's round: from (280, 232) east to (424, 232), up to (424, 216) and back, pausing at each end.
s32 gXian_TrainingTreeJump []
 The struck tree jumps 32 pixels and drops back.
s32 gXian_TreeImpactScript []
 The effect at the tree's foot when the student strikes it: 18 frames.
s32 gXian_TrainingParticleScript []
 Each particle beside the leaping student, facing west: 16 frames.
u16 gXian_DoorSteps1 []
 The doors' opening frames, copied from map cells.
u16 gXian_DoorSteps2 []
u16 gXian_DoorSteps3 []
u16 gXian_DoorSteps4 []
u16 gXian_DoorSteps5 []
struct SceneEntrance gXian_Entrances []
u32 gXian_Exits []
struct ScenePlacement gXian_Placements []
struct SceneEvent gXian_Events []

Detailed Description

Xian: the water carrier who spills her water, Frost on the spill, the kung fu student and his training tree, Feizhi, and a Mercury Djinni.

Definition in file xian.c.

Macro Definition Documentation

◆ NULL

#define NULL   ((void *)0)

Definition at line 15 of file xian.c.

◆ XIAN_WATER_CARRIER_UPDATE

#define XIAN_WATER_CARRIER_UPDATE   ((void *)Xian_WatchWaterCarrierPath)

Definition at line 208 of file xian.c.

Referenced by Xian_Initialize(), Xian_MoveAsideForWaterCarrier(), and Xian_TalkToWaterCarrier().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The actors, numbered from the placements (the first placed is actor 8).

Enumerator
ACTOR_KUNG_FU_STUDENT 

Strikes the tree before him with a shout. "Hoo-whaaa... Hachaaa!".

ACTOR_FEIZHI 

Feizhi, as at Alpine Crossing: looking for someone to take her west.

ACTOR_WATER_CARRIER 

Carries water along the street. "You made me spill my water!".

ACTOR_TRAINING_TREE 

The tree the student strikes; it jumps when hit.

ACTOR_PUDDLE 

The spilled water, which Frost freezes.

ACTOR_FORCE_TARGET 

Force's mark on the training tree.

ACTOR_DJINNI 
ACTOR_FIRST_DECORATION 

The first of three actors kept below the others.

Definition at line 50 of file xian.c.

◆ anonymous enum

anonymous enum
Enumerator
ANIM_PUDDLE_FROZEN 

Definition at line 68 of file xian.c.

◆ anonymous enum

anonymous enum

The trigger the water carrier raises when the leader has stood in her way for two seconds.

Enumerator
XIAN_TRIGGER_CARRIER_BLOCKED 
XIAN_CARRIER_BLOCKED_FRAMES 

Definition at line 72 of file xian.c.

Function Documentation

◆ Xian_RecruitVillageDjinni()

void Xian_RecruitVillageDjinni ( void )
static

Talking to the Djinni: it joins the party (Mercury Djinni 2).

Definition at line 75 of file xian.c.

Referenced by Xian_RecruitVillageDjinni().

◆ Xian_UpdateFrozenPuddleLayer()

void Xian_UpdateFrozenPuddleLayer ( void )
static

Draws the frozen puddle under the leader while the leader stands on top of it.

Definition at line 81 of file xian.c.

Referenced by Xian_FreezeSpilledWater(), Xian_Initialize(), and Xian_UpdateFrozenPuddleLayer().

◆ Xian_RotateTrainingTree()

void Xian_RotateTrainingTree ( void )
static

Rotates the training tree during the student's strike and Force animation.

Definition at line 91 of file xian.c.

Referenced by Xian_RotateTrainingTree(), Xian_StrikeTrainingTreeWithForce(), and Xian_TalkToKungFuStudent().

◆ Xian_SpawnTrainingParticles()

void Xian_SpawnTrainingParticles ( void )
static

Emits particles beside the student every fourth frame.

Definition at line 98 of file xian.c.

Referenced by Xian_SpawnTrainingParticles(), and Xian_TalkToKungFuStudent().

◆ Xian_UpdateCarrierTracking()

s32 Xian_UpdateCarrierTracking ( struct FieldActor * actor,
struct FieldActor * target,
s32 distanceLimit,
s32 forceTracking )
static

Tracks a nearby target only within the actor's current facing sector.

Definition at line 122 of file xian.c.

Referenced by Xian_UpdateCarrierTracking(), and Xian_WatchWaterCarrierPath().

◆ Xian_WatchWaterCarrierPath()

s32 Xian_WatchWaterCarrierPath ( union FieldObject * fieldObject)
static

Definition at line 170 of file xian.c.

Referenced by Xian_WatchWaterCarrierPath().

◆ Xian_GetEntrances()

const struct SceneEntrance * Xian_GetEntrances ( void )

Definition at line 211 of file xian.c.

Referenced by Xian_GetEntrances().

◆ Xian_GetRegions()

const struct SceneRegion * Xian_GetRegions ( void )

Definition at line 213 of file xian.c.

Referenced by Xian_GetRegions().

◆ Xian_GetExits()

const u32 * Xian_GetExits ( void )

Definition at line 215 of file xian.c.

Referenced by Xian_GetExits().

◆ Xian_GetPlacements()

const struct ScenePlacement * Xian_GetPlacements ( void )

Once Xian has heard Hsu is trapped, actor 15 turns to face the party.

Definition at line 218 of file xian.c.

Referenced by Xian_GetPlacements().

◆ Xian_AskAboutYoungWarriors()

void Xian_AskAboutYoungWarriors ( void )
static

Asks about the young warriors' way here.

"Young warriors, very gallant! You came through Mogall Forest?"

Definition at line 226 of file xian.c.

Referenced by Xian_AskAboutYoungWarriors().

◆ Xian_TalkToWaterCarrier()

void Xian_TalkToWaterCarrier ( void )
static

Talking to the water carrier.

While she carries her water east of x = 320 the first time, she spills it: a puddle spreads at her feet, she cries "You made me spill my water!" and walks back west to fetch more, the leader stepping aside if he is in her way. Otherwise she only answers: "Do not speak to me. I might spill my water.", or once it is spilled, "Now I must get water again."

Definition at line 239 of file xian.c.

Referenced by Xian_TalkToWaterCarrier().

◆ Xian_UpdatePuddlePriority()

void Xian_UpdatePuddlePriority ( void )
static

Frost on the spilled water, before it freezes: the puddle is drawn in front while the leader stands north of it.

Definition at line 373 of file xian.c.

Referenced by Xian_UpdatePuddlePriority().

◆ Xian_FreezeSpilledWater()

void Xian_FreezeSpilledWater ( void )
static

Frost freezes the spilled water: the puddle turns to ice the leader can stand on, and there is nothing left to jump over.

Definition at line 381 of file xian.c.

Referenced by Xian_FreezeSpilledWater().

◆ Xian_TalkToKungFuStudent()

void Xian_TalkToKungFuStudent ( void )
static

The kung fu student.

The first time: "Hoo-whaaa... Hachaaa!", the leader steps back, and the student leaps at the tree, which jumps under his strike; "Heh heh heh..." Afterwards: "My kung fu is strong."

Definition at line 403 of file xian.c.

Referenced by Xian_TalkToKungFuStudent().

◆ Xian_TalkToFeizhi()

void Xian_TalkToFeizhi ( void )
static

Talking to Feizhi.

"You are the warriors from the school... Are you strong warriors?"

Definition at line 493 of file xian.c.

Referenced by Xian_TalkToFeizhi().

◆ Xian_JumpOverSpilledWater()

void Xian_JumpOverSpilledWater ( void )
static

Walking into the spilled water before it is frozen: the leader jumps two cells over it, where nothing stands in the way.

Definition at line 502 of file xian.c.

Referenced by Xian_JumpOverSpilledWater().

◆ Xian_WalkThroughExit()

void Xian_WalkThroughExit ( s32 exitId)
static

Walks the leader through a doorway and leaves by its exit.

Definition at line 539 of file xian.c.

Referenced by Xian_OpenDoorAndLeave(), and Xian_WalkThroughExit().

◆ Xian_OpenDoorAndLeave()

void Xian_OpenDoorAndLeave ( void )
static

Walking into one of Xian's doors: it opens and the party goes in.

Definition at line 553 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ Xian_StrikeTrainingTreeWithForce()

void Xian_StrikeTrainingTreeWithForce ( void )
static

Force on the training tree: it jumps, and the student cries out.

"Wha-Wha-What happened? The tree jumped on its own!", the next time "...It jumped again... I am too tired...".

Definition at line 598 of file xian.c.

Referenced by Xian_StrikeTrainingTreeWithForce().

◆ Xian_MoveAsideForWaterCarrier()

void Xian_MoveAsideForWaterCarrier ( void )
static

The leader has stood in the water carrier's way for two seconds: both walk to the start of her route, the leader turns west, and she sets off again.

Definition at line 629 of file xian.c.

Referenced by Xian_MoveAsideForWaterCarrier().

◆ Xian_GetEvents()

const struct SceneEvent * Xian_GetEvents ( void )

Definition at line 664 of file xian.c.

Referenced by Xian_GetEvents().

◆ Xian_Initialize()

s32 Xian_Initialize ( void )

Queues sound 169 and sets up the village as the story and this visit left it.

Definition at line 668 of file xian.c.

Referenced by Xian_Initialize().

Variable Documentation

◆ gEffectScript0

s32 gEffectScript0[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(22, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}
#define SC_LOOP(n, to)
Repeat up to n times.
Definition objcmd.h:28
#define SC_POS(x, y, z)
Set position.
Definition objcmd.h:18
#define SC_FREE
Release.
Definition objcmd.h:43
#define SC_WAIT(n)
Wait n frames.
Definition objcmd.h:16
#define SC_TOP
Script start.
Definition objcmd.h:13

Definition at line 733 of file xian.c.

◆ gEffectScript1

s32 gEffectScript1[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(44, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}

Definition at line 738 of file xian.c.

◆ gEffectScript2

s32 gEffectScript2[]
Initial value:
= {
SC_WAIT(1), SC_LOOP(126, SC_TOP), SC_WAIT(1),
SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}

Definition at line 743 of file xian.c.

◆ gEffectScripts

const s32* gEffectScripts[]
Initial value:
= {
}
s32 gEffectScript0[]
s32 gEffectScript1[]
s32 gEffectScript2[]

Definition at line 748 of file xian.c.

◆ gXian_WaterCarrierRoute

s32 gXian_WaterCarrierRoute[]
Initial value:
= {
SC_SET(SW_SPEED, 0x6666),
SC_SET(SW_ACCEL, 0x1999),
SC_WAIT(60),
SC_ARG(3),
SC_WAIT(60),
SC_ARG(3),
SC_WAIT(180),
SC_ARG(2),
SC_MOVE(PIXELS(424), 0, PIXELS(232)),
SC_MOVE(PIXELS(424), 0, PIXELS(216)),
SC_WAIT(10),
SC_SET(SW_FACING, 0x1000),
SC_WAIT(10),
SC_ARG(3),
SC_WAIT(60),
SC_ARG(3),
SC_WAIT(120),
SC_ARG(2),
SC_MOVE(PIXELS(424), 0, PIXELS(232)),
SC_MOVE(PIXELS(280), 0, PIXELS(232)),
}
#define PIXELS(value)
#define SC_LABEL(n)
Branch destination.
Definition objcmd.h:11
#define SC_SET(w, v)
Write a work value.
Definition objcmd.h:37
#define SC_SYNC
Wait for arrival.
Definition objcmd.h:17
#define SC_FOREVER
Definition objcmd.h:14
#define SC_TO(n)
Definition objcmd.h:12
#define SC_ARG(v)
Definition objcmd.h:44
#define SC_MOVE(x, y, z)
Move toward the target.
Definition objcmd.h:19
#define SC_END
Return to the main script.
Definition objcmd.h:32
@ SW_ACCEL
Definition objcmd.h:68
@ SW_SPEED
Definition objcmd.h:67
@ SW_FACING
Definition objcmd.h:57

The water carrier's round: from (280, 232) east to (424, 232), up to (424, 216) and back, pausing at each end.

Definition at line 756 of file xian.c.

Referenced by Xian_MoveAsideForWaterCarrier().

◆ gXian_TrainingTreeJump

s32 gXian_TrainingTreeJump[]
Initial value:
= {
SC_SET(SW_SPEED, 0x30000),
SC_SET(SW_ACCEL, 0x18000),
SC_MOVE(PIXELS(168), PIXELS(48), PIXELS(312)),
SC_SET(SW_SPEED, 0x30000),
SC_SET(SW_ACCEL, 0x1999),
SC_MOVE(PIXELS(168), PIXELS(16), PIXELS(312)),
}
@ SW_SNAP
Definition objcmd.h:78

The struck tree jumps 32 pixels and drops back.

Definition at line 787 of file xian.c.

Referenced by Xian_StrikeTrainingTreeWithForce(), and Xian_TalkToKungFuStudent().

◆ gXian_TreeImpactScript

s32 gXian_TreeImpactScript[]
Initial value:
= {
SC_WAIT(18), SC_WAIT(1), SC_POS(0, 0, 0), SC_WAIT(1), SC_FREE,
}

The effect at the tree's foot when the student strikes it: 18 frames.

Definition at line 802 of file xian.c.

Referenced by Xian_TalkToKungFuStudent().

◆ gXian_TrainingParticleScript

s32 gXian_TrainingParticleScript[]
Initial value:
= {
SC_WAIT(16),
SC_WAIT(1),
SC_POS(0, 0, 0),
SC_WAIT(1),
}
@ FACING_WEST
Definition field_scene.h:30

Each particle beside the leaping student, facing west: 16 frames.

Definition at line 807 of file xian.c.

Referenced by Xian_SpawnTrainingParticles().

◆ gXian_DoorSteps1

u16 gXian_DoorSteps1[]
Initial value:
= {
MAP_CELL_STEP(64, 48, 1, 2, 4),
MAP_CELL_STEP(63, 48, 1, 2, 4),
}
#define MAP_CELL_STEP(srcX, srcY, width, height, frames)
Definition field_event.h:59
#define MAP_CELL_STEPS_END
Definition field_event.h:61

The doors' opening frames, copied from map cells.

Definition at line 817 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ gXian_DoorSteps2

u16 gXian_DoorSteps2[]
Initial value:
= {
MAP_CELL_STEP(69, 50, 2, 2, 4),
MAP_CELL_STEP(65, 50, 2, 2, 4),
}

Definition at line 823 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ gXian_DoorSteps3

u16 gXian_DoorSteps3[]
Initial value:
= {
MAP_CELL_STEP(66, 46, 3, 2, 4),
MAP_CELL_STEP(63, 46, 3, 2, 4),
}

Definition at line 829 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ gXian_DoorSteps4

u16 gXian_DoorSteps4[]
Initial value:
= {
MAP_CELL_STEP(67, 50, 4, 2, 4),
MAP_CELL_STEP(63, 50, 4, 2, 4),
}

Definition at line 835 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ gXian_DoorSteps5

u16 gXian_DoorSteps5[]
Initial value:
= {
MAP_CELL_STEP(66, 44, 3, 2, 4),
MAP_CELL_STEP(63, 44, 3, 2, 4),
}

Definition at line 841 of file xian.c.

Referenced by Xian_OpenDoorAndLeave().

◆ gXian_Entrances

struct SceneEntrance gXian_Entrances[]
Initial value:
= {
{0, CONDITION_ALWAYS, 172, 0, 149, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{1, CONDITION_ALWAYS, 376, 0, 504, FACING_NORTH, 0, -1, -1, -1, -1, 0},
{5, CONDITION_ALWAYS, 344, 0, 328, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{6, CONDITION_ALWAYS, 376, 0, 216, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{7, CONDITION_ALWAYS, 424, 0, 216, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{8, CONDITION_ALWAYS, 408, 0, 424, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{9, CONDITION_ALWAYS, 216, 0, 184, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{10, CONDITION_ALWAYS, 392, 0, 184, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
{11, CONDITION_ALWAYS, 176, 0, 216, FACING_SOUTH, 0, -1, -1, -1, -1, 0},
}
@ SCENE_TABLE_END
Definition field_scene.h:43
@ CONDITION_ALWAYS
Definition field_scene.h:44
@ FACING_NORTH
Definition field_scene.h:32
@ FACING_SOUTH
Definition field_scene.h:28

Definition at line 847 of file xian.c.

Referenced by Xian_GetEntrances().

◆ gXian_Exits

u32 gXian_Exits[]
Initial value:
= {
SCENE_EXITS(72), SCENE_EXIT(1, 73, 1), SCENE_EXIT(2, 73, 2),
SCENE_EXIT(3, 73, 3), SCENE_EXIT(4, 73, 4), SCENE_EXIT(5, 73, 6),
SCENE_EXIT(6, 9, 32), SCENE_EXIT(7, 61, 2), SCENE_EXIT(8, 2, 14),
}
#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 860 of file xian.c.

Referenced by Xian_GetExits().

◆ gXian_Placements

struct ScenePlacement gXian_Placements[]

Definition at line 868 of file xian.c.

Referenced by Xian_GetPlacements().

◆ gXian_Events

struct SceneEvent gXian_Events[]

Definition at line 908 of file xian.c.

Referenced by Xian_GetEvents().