39#include "text/msg_ids.h"
161 if (actor->
timer <= 0) {
193 spark->sprite->image.priority = 1;
356 work->requestedExit = exitBefore;
358 work->requestedExit = exitAfter;
373 work->requestedExit = exitBefore;
375 work->requestedExit = exitAfter;
428 leaderReach = leader->sprite->scale * leader->
radius;
430 actor =
work->viewCenter;
457 scale = actor->sprite->scale;
462 reach = leaderReach + actor->
radius * scale;
657 record->
z.
part.pixel);
666 record->
z.
part.pixel);
675 record->
z.
part.pixel);
732 if (spriteActor != 0) {
844 actor->sprite->rotation = 0xf000;
853 }
while (actor->
timer == 0);
943 if (spriteActor != 0) {
945 spriteActor->
z.
part.pixel);
1064 }
while (actor->
timer == 0);
1093 }
while (actor->
timer == 0);
1122 }
while (actor->
timer == 0);
1155 }
while (actor->
timer == 0);
1265 for (i = 0; i < 16; i++) {
1279 for (i = 59; i >= 0; i--) {
1311 for (; i < 16; i++) {
1320 for (i = 7; i >= 0; i--) {
1356 count = MsgWorldMapAbilityVenusDjinni;
1508 if (leader !=
NULL) {
1722 sprite = orb->sprite;
1744 message = MsgWorldMapMatter;
1795 if (actor !=
NULL) {
1797 actor->
z.
part.pixel);
1821#define WORLD_MAP_QUEUE_TRANSITION_FRAME(buffer, offset) \
1822 IO_WRITE_QUEUE_PUSH(0x06002000, (u32)((buffer) + (offset)), 0x84000140)
1912 Event_ShowTwoMessagesAndWait(5, 7, 13, 2, 12, 8, 9, 4, 4, 3, 0);
1957 s32 transitionDelay = 3200;
1983 if (
object !=
NULL) {
1989 object->motionFlags = 0;
1990 object->scaleX =
scale;
1991 object->scaleY =
scale;
2061 return positiveTotal - negativeTotal;
2069 switch (selection) {
2083 for (offset = 0; offset < 9; offset++) {
2106 sprite = actor->sprite;
2110 actor->
x.
fixed -= back >> 1;
2115 value = (
s32)value >> 1;
2178 if (progress != 0) {
2179 if (progress == 1) {
2192 s32 alreadyTraveling;
2200 if (alreadyTraveling == 0) {
2276 for (frames = 59; frames >= 0; --frames) {
2308 sx = record->
x.
part.pixel;
2309 sy = record->
z.
part.pixel;
2718 {0,
CONDITION_ALWAYS, 5656, 0, 1256,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2719 {1,
CONDITION_ALWAYS, 5680, 0, 1226,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2720 {2,
CONDITION_ALWAYS, 5688, 0, 1224,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2721 {3,
CONDITION_ALWAYS, 5848, 0, 1608,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2722 {4,
CONDITION_ALWAYS, 6424, 0, 1320,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2723 {5,
CONDITION_ALWAYS, 6584, 0, 1224,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2724 {6,
CONDITION_ALWAYS, 6928, 0, 1368,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2725 {7,
CONDITION_ALWAYS, 7328, 0, 1240,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2726 {8,
CONDITION_ALWAYS, 7136, 0, 1054,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2727 {9,
CONDITION_ALWAYS, 5928, 0, 296,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2728 {10,
CONDITION_ALWAYS, 6024, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2729 {11,
CONDITION_ALWAYS, 7568, 0, 1416,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2730 {12,
CONDITION_ALWAYS, 7880, 0, 1592,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2731 {13,
CONDITION_ALWAYS, 7852, 0, 1688,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2732 {14,
CONDITION_ALWAYS, 7544, 0, 2008,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2733 {15,
CONDITION_ALWAYS, 7144, 0, 1736,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2734 {16,
CONDITION_ALWAYS, 7008, 0, 1624,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2735 {17,
CONDITION_ALWAYS, 6888, 0, 1736,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2736 {18,
CONDITION_ALWAYS, 6888, 0, 1828,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2737 {19,
CONDITION_ALWAYS, 5560, 0, 2136,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2738 {20,
CONDITION_ALWAYS, 5592, 0, 2168,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2739 {21,
CONDITION_ALWAYS, 5424, 0, 2264,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2740 {22,
CONDITION_ALWAYS, 5004, 0, 2328,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2741 {23,
CONDITION_ALWAYS, 4904, 0, 2312,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2742 {24,
CONDITION_ALWAYS, 4840, 0, 1992,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2743 {25,
CONDITION_ALWAYS, 4940, 0, 2648,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2744 {26,
CONDITION_ALWAYS, 5656, 0, 2424,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2745 {27,
CONDITION_ALWAYS, 5388, 0, 2840,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2746 {28,
CONDITION_ALWAYS, 5448, 0, 2920,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2747 {29,
CONDITION_ALWAYS, 5864, 0, 3400,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2748 {30,
CONDITION_ALWAYS, 5996, 0, 2930,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2749 {31,
CONDITION_ALWAYS, 5996, 0, 2840,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2750 {32,
CONDITION_ALWAYS, 6032, 0, 3192,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2751 {33,
CONDITION_ALWAYS, 5976, 0, 3432,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2752 {34,
CONDITION_ALWAYS, 5896, 0, 1160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2753 {35,
CONDITION_ALWAYS, 5990, 0, 804,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2754 {38,
CONDITION_ALWAYS, 7376, 0, 1240,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2755 {39,
CONDITION_ALWAYS, 5956, 0, 266,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2756 {40,
CONDITION_ALWAYS, 6484, 0, 1212,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2757 {41,
CONDITION_ALWAYS, 5480, 0, 2632,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2758 {42,
CONDITION_ALWAYS, 5928, 0, 3272,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2759 {43,
CONDITION_ALWAYS, 7792, 0, 2104,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2760 {44,
CONDITION_ALWAYS, 5848, 0, 1544,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2761 {45,
CONDITION_ALWAYS, 6248, 0, 520,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2762 {46,
CONDITION_ALWAYS, 7568, 0, 1352,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2763 {47,
CONDITION_ALWAYS, 6976, 0, 1360,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2764 {48,
CONDITION_ALWAYS, 6228, 0, 552,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2765 {49,
CONDITION_ALWAYS, 5860, 0, 1212,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2766 {50,
CONDITION_ALWAYS, 7056, 0, 1656,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2767 {51,
CONDITION_ALWAYS, 7000, 0, 1736,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2768 {52,
CONDITION_ALWAYS, 6920, 0, 1696,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2769 {53,
CONDITION_ALWAYS, 6090, 0, 2232,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2770 {54,
CONDITION_ALWAYS, 4940, 0, 2728,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2771 {55,
CONDITION_ALWAYS, 5416, 0, 3272,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2772 {56,
CONDITION_ALWAYS, 5416, 0, 2808,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2773 {57,
CONDITION_ALWAYS, 5444, 0, 2840,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2774 {58,
CONDITION_ALWAYS, 5424, 0, 2200,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2775 {59,
CONDITION_ALWAYS, 5996, 0, 2856,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
2776 {60,
CONDITION_ALWAYS, 5480, 0, 2120,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2777 {61,
CONDITION_ALWAYS, 6152, 0, 3212,
FACING_EAST, 0, -1, -1, -1, -1, 0},
2778 {64,
CONDITION_ALWAYS, 5848, 0, 1608,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2779 {65,
CONDITION_ALWAYS, 5384, 0, 2248,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2780 {66,
CONDITION_ALWAYS, 7944, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2781 {67,
CONDITION_ALWAYS, 7944, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2782 {68,
CONDITION_ALWAYS, 7944, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2783 {69,
CONDITION_ALWAYS, 7944, 0, 200,
FACING_SOUTH, 0, -1, 128, -1, -1, 0},
2784 {70,
CONDITION_ALWAYS, 5096, 0, 2328,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2785 {71,
CONDITION_ALWAYS, 5528, 0, 2120,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2786 {72,
CONDITION_ALWAYS, 7464, 0, 200,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2787 {73,
CONDITION_ALWAYS, 6088, 0, 3176,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2788 {74,
CONDITION_ALWAYS, 4728, 0, 424,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2789 {75,
CONDITION_ALWAYS, 4872, 0, 808,
FACING_WEST, 0, -1, -1, -1, -1, 0},
2790 {76,
CONDITION_ALWAYS, 4576, 0, 508,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2791 {77,
CONDITION_ALWAYS, 4392, 0, 328,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2792 {78,
CONDITION_ALWAYS, 8, 0, 8,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2793 {80,
CONDITION_ALWAYS, 7552, 0, 3504,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2794 {90,
CONDITION_ALWAYS, 6024, 0, 160,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2795 {91,
CONDITION_ALWAYS, 6088, 0, 3168,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2796 {97,
CONDITION_ALWAYS, 6248, 0, 872,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2797 {98,
CONDITION_ALWAYS, 4248, 0, 2424,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
2798 {99,
CONDITION_ALWAYS, 5576, 0, 2088,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
3131 7, 5, 8, 4, 9, 12, 6, 3,
Ability numbers, named from the English release.
void ObjectGroup_SetChildValue(struct FieldActor *actor, s32 param)
Sets the param byte of every animated part of an actor's sprite.
void Object_RefreshSelectorById(u32 objectId)
Waits, at most 300 frames, for an actor's script to reach its end (command 0x10).
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
Animated sprites: their layers, frames and colour modes, and the resource slots they draw from.
Calls through a function pointer, by argument count.
void(*) SchedulerCallback(void)
The engine calls the debug menus import, and their palette swatch tiles.
Djinn numbers, named from the English release.
void Djinn_JoinParty(s32 slot, s32 element, s32 djinn)
A Djinni joins the party: djinn (0 to 19) of element goes to the member with the fewest Djinn,...
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
static s32 FieldResource_DecodeType01(const void *source, void *destination)
Decodes type-01 compressed data.
static s32 FieldGameFlag_GetByte(s32 flag)
static void FieldGameFlag_SetByte(s32 flag, s32 value)
void ObjectDispatch_StartIdle(struct DispatchObject *object)
Starts an object on the idle script (a lone SC_END).
void Map_LoadAreaGraphics(void)
Reloads the world map area's palette and tiles after the still view, puts the default cells back and ...
void WorldMap_BeginStillView(void)
Freezes the world map's perspective view as a still picture on BG1: saves BG1's tiles,...
void Map_LoadDefaultCellsAndUpdateBlock(void)
Puts the default world map cells back after the still view and returns to the perspective view,...
const u8 gWorldMapPalettes[]
const u8 gWorldMapPackedTiles[]
const u8 gWorldMapPackedFrames[]
Field effects, their scripts and the flags that spawn them.
The scene script layer: the engine services a scene's events call, declared once (Engine_EventBegin,...
void Engine_ObjectSetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
#define SPEAKER_PORTRAIT_LEFT
static s32 Event_OpenMessage(s32 speaker, s32 flags)
static void Actor_SetDestination(s32 actor, s32 x, s32 z)
static void Actor_FaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_ActorSetAnimationAndWait(s32 actor, s32 animation)
void Object_SetMode(struct FieldActor *object, s32 animation)
void Engine_PsynergyBegin(s32 ability, s32 flags)
struct FieldActor * Engine_ActorLookup(s32 actor)
static void Event_ShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
void Engine_MessageShowCentered(s32 message, s32 flags)
void Engine_ObjectSetPartPalettes(struct FieldActor *object, s32 palette)
s32 Engine_PartyGiveItem(s32 item, s32 flags)
void Engine_EventShowMessageAndWait(s32 speaker, s32 flags, s32 frames)
#define SPEAKER_PORTRAIT_RIGHT
void Engine_CameraSetSpeed(s32 speed, s32 acceleration)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
static void Camera_SetSpeed(s32 speed, s32 acceleration)
void Engine_CameraMoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_ActorJump(s32 actor, s32 height, s32 frames)
static void Actor_MoveToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_MathSin(s32 angle)
void Engine_ItemShowFound(s32 item, s32 height)
static void Actor_SetDestinationOffset(s32 actor, s32 dx, s32 dz)
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ObjectDispatchRelease(struct FieldActor *object)
static void Actor_RunActionScriptAndWait(s32 actor, const s32 *script)
Runs a script, waiting at most 300 frames for its final command.
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
static void ColorBuffer_ApplyTarget(s32 value, s32 mode)
static void Actor_WalkTo(s32 actor, s32 x, s32 z)
void Engine_EventWaitForScreen(void)
void Engine_ActorDestroy(s32 actor)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_ObjectSetScript(struct FieldActor *object, const s32 *script)
static s32 Math_Divide(s32 dividend, s32 divisor)
static void Event_ShowTwoMessagesAndWait(s32 speaker, s32 x, s32 y, s32 arg, s32 extra, s32 otherSpeaker, s32 otherX, s32 otherY, s32 otherArg, s32 otherExtra, s32 flags)
void Engine_EventOpenScreen(void)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
void Engine_CameraWaitForMove(void)
static void Actor_SetActionScript(s32 actor, const s32 *script)
The engine encodes either a built-in action or an action-script address.
void Engine_ActorWaitForMove(s32 actor)
void Engine_CameraFollowActor(s32 actor, s32 keep_position)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
static void Event_ShowMessage(s32 speaker, s32 flags)
void Engine_ActorSetAttachedEffect(s32 actor, s32 effect)
static void Event_PlayCue(s32 cue)
void Engine_ActorSetChildValue(s32 actor, s32 value)
static void Actor_SetChildValue(s32 actor, s32 value)
s32 Engine_GameFlagIsSet(s32 flag)
void Engine_ActorStartRepeatedMotion(s32 actor, s32 repeats)
static struct FieldActor * Object_Create(s32 type, s32 fixed_x, s32 fixed_y, s32 fixed_z)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
static s32 Random_Next(void)
void Engine_ColorBufferInterpolate(s32 frames)
static void Camera_MoveTo(s32 fixed_x, s32 fixed_y, s32 fixed_z, s32 pan)
static void Actor_SetPosition(s32 actor, s32 fixed_x, s32 fixed_z)
void Engine_EventWait(s32 frames)
static void Actor_SetAttachedEffect(s32 actor, s32 effect)
void Engine_ColorBufferApplyTarget(s32 value, s32 mode)
void Engine_ColorBufferApplySource(s32 value, s32 mode)
static struct FieldActor * Actor_Get(s32 actor)
Field objects and actors, and the scene transition styles.
@ TRANSITION_BACKDROP_FADE
@ ACTOR_PRIORITY_UNDERFOOT
The depth sort treats it as 320 pixels higher on the screen.
#define SCENE_TRANSITION(style, variant)
@ ACTOR_FACES_MOTION
turns toward its velocity, 1/16 turn a frame
The scene table formats: entrances, exits, placements and events, and the macros that write them.
#define PSYNERGY_PHASE_ON_ACTOR(ability, phase)
A Psynergy event on an actor at one phase of the cast, as PSYNERGY_IN_AREA is for an area.
#define SCENE_EXITS(scene)
#define IF_FLAG_SET(flag)
#define SCENE_EXIT(exit, scene, entrance)
@ TALK_FACE_PARTY_AND_BACK
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define TOUCH_WALKING_INTO(facing)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
The scene service layer: one typed inline for each engine service a scene calls by its own name,...
static void Event_End(void)
static void Actor_RunRepeatedMotion(s32 actor, s32 repeats)
static s32 Vram_Load(s32 block, s32 size, const void *data)
static void Message_ShowCentered(s32 message, s32 flags)
static void Task_Wait(s32 frames)
static void Event_Begin(void)
static void Actor_WaitForMove(s32 actor)
static void Actor_SetAnimation(s32 actor, s32 animation)
static void Actor_SetAnimationAndWait(s32 actor, s32 animation)
static void Event_Wait(s32 frames)
static void Item_LoadIcon(s32 item)
static void Heap_Release(s32 slot)
static void Actor_Jump(s32 actor, s32 height, s32 frames)
static s32 Event_ChooseYesNo(s32 actor, s32 flags)
static void Event_SetMessage(s32 message)
static void FieldObject_SetPosition(struct FieldActor *object, s32 fixed_x, s32 fixed_y, s32 fixed_z)
static void FieldMap_SetWindowCellTile(s32 a0, s32 a1, s32 a2, s32 a3)
static void * Heap_Allocate(s32 slot, s32 size)
16.16 fixed-point constants, sine and cosine, and the library division.
#define Q16_ONE
One in the engine's signed 16.16 fixed-point format.
Game flags, named where their meaning is shown.
#define FLAG_ARRIVE_FALLING
The leader falls into the next scene from 160 pixels above (ObjectEffect_RunPendingFlagEvent),...
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_SCENE_TEMP_35
#define FLAG_BLACK_ORB_RETURNED
The Black Orb did nothing on Babi's ship and was handed back.
#define FLAG_NO_ENCOUNTERS
No random encounters while set (Encounter_SelectEnemyGroup), unless flag 0x15f is set; debug entrance...
#define FLAG_DJINNI_0
the flag of Djinni 0, set once it is caught
#define FLAG_TOLBI_SHIP_REACHED_TOLBI
The ship reached Tolbi. "The ship has arrived safely".
#define FLAG_SKIP_SCENE_CHANGE_SOUND
The next scene change is silent: the scene loader clears it in place of playing SE_288,...
#define FLAG_KEEP_MUSIC
The next scene keeps the music that is playing; scene.c clears FLAG_KEEP_MUSIC as it does,...
#define FLAG_SCENE_TEMP_34
#define FLAG_TOLBI_SHIP_ROWING
the oars are moving
#define FLAG_KOLIMA_BRIDGE_COLLAPSED
Kolima's bridge fell as the party crossed it.
#define FLAG_BUNZAS_WAGON_LEFT
Bunza's wagon has left West Lunpa Cave, with the party aboard or without.
#define FLAG_LUNPA_TRADE_REOPENED
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_SCENE_TEMP_00
#define FLAG_WORLD_MAP_TURTLE_BOOTS
buried, found by searching
#define FLAG_TOLBI_SHIP_AT_ISLAND
at anchor off the island
#define FLAG_DJINN_TUTORIAL_PART_A
With FLAG_DJINN_TUTORIAL set, these two choose the part of the tutorial the Djinn menu plays: neither...
#define FLAG_SCENE_TEMP_F8
#define FLAG_DJINN_TUTORIAL
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_SAW_SHIP_FROM_VENUS_LIGHTHOUSE
The party saw the ship from Venus Lighthouse before coming back.
#define FLAG_LAMAKAN_SAND_MONSTER_BEATEN
on the third map
#define FLAG_SCENE_TEMP_F0
#define FLAG_DEBUG_STEPS_OFF
In debug mode, steps on the field are not processed (Field_RunScene) and the world map's places do no...
#define FLAG_LALIVERO_WOUNDED_SOLDIERS_SEEN
#define FLAG_SCENE_TEMP_F1
#define FLAG_GUARDS_SUSPECT_KALAY
Set on the world map; from then on the east guard asks whether the party came from Kalay.
#define FLAG_NOT_ON_MAP
the current place is not on the world map
#define FLAG_DJINN_TUTORIAL_PART_B
#define FLAG_MENU_OPEN
Set while the field menu is open; scenes hold their moving actors still.
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
u8 gDebugMode
Debug builds: Start+Select pauses the frame loop.
volatile u32 gFrameCount
Frames WaitFrames has finished.
BattleFxScene, the work of a battle or field Psynergy effect scene, and its arc objects.
s32 Djinn_AddToOwner(s32 owner, s32 element, s32 djinnIndex)
Gives Djinni djinnIndex of element to a unit: sets its bit in djinnAvailable and counts it.
u32 * DjinnRecovery_AddStandby(u32 owner, u32 element, u32 djinnIndex)
Puts the owner's Djinni at the end of its side's list on standby (turns -1), moving it there if it wa...
GameState, the game's state: play time, coins, the scene and the leader's position,...
#define Battle_SetStart(mode)
Sets the battle start type.
struct GameState gGameState
The work slots of gWorkSlot, read through their own names.
void * gEffectWork
Slot 56: points to a scene-specific structure.
The screen blend's globals and the graphics routines.
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
The main-image routines scene overlays import.
s32 PartyInventory_Discard(s32 itemId)
Discards one itemId from whoever carries it first, as Inventory_Discard does; always returns 0.
gOverflowItem, an item slot the spoils code uses when items are handed out.
void IoWriteQueue_Store16(u32 address, u32 value)
Queues a halfword store.
The hardware's I/O registers and their bits, as pret names them.
The register write queue that VBlank carries out after each finished frame.
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped...
Item numbers, named from the English release.
The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address,...
#define Iwram_MulQ16(left, right)
MapRenderWork, the map renderer's work.
void Vector_AddPolarOffset(s32 radius, s32 angle, void *position)
Moves the point position by radius in direction angle on the ground plane: x by the cosine,...
The heaps: allocating and freeing blocks.
void MemFree(void *buffer)
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LABEL(n)
Branch destination.
#define SC_SET(w, v)
Write a work value.
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_POS(x, y, z)
Set position.
#define SC_SYNC
Wait for arrival.
#define SC_MOVE(x, y, z)
Move toward the target.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
#define SC_MOVE_BY(x, y, z)
Move by a relative offset.
void Event_SetDestination(s32 scene, s32 entrance)
Makes the event leave for the given entrance of the given scene: raises the exit request 999 and writ...
void BattleEffect_CleanupSceneObjects(void)
Ends a Psynergy effect: frees the effect slots still in use and, unless another effect is being resol...
void BattleFx_ScheduleRatioTransition(s32 zoom, s32 frames)
Starts a zoom to zoom (16.16) over frames frames, on the world map (event mode 3) only.
void Event_WaitForZoomTransition(void)
Waits for a zoom transition to end (on the world map only, at most 300 frames).
void FieldObject_WaitForMove(void *fieldObject)
Waits a frame at a time until a field object has arrived at its target, at most 600 frames.
void PaletteGlow_Update(s32 phase, s32 brightness)
Sets the window colours (BG palette 15, colours 4 to 10) for a window hue (0 to 23) and brightness (0...
Palette fades, the battle effect palette buffers and the colour channel curves.
@ PALETTE_TRANSFORM_MUTED
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
#define DJINN_NO_HOP
Field_RequestDjinnBattle's flag: the Djinni does not hop first.
void Field_RequestBattleFromEncounterTable(s32 zoneNo, s32 slotNo)
Sets up a battle with enemy group slot of encounter table zone.
void Field_RequestDjinnBattle(s32 flag, s32 no)
Sets up the battle with Djinni number no.
static s32 WorldMap_ApplyMapRotation(struct ScriptInterpreter *interpreter)
Aligns the actor's sprite rotation to the map.
static s32 WorldMap_InitializeProgressMarker(struct ScriptInterpreter *interpreter)
Resets the map marker after the corresponding story progress.
static void WorldMap_ShakeTransferStartCamera(void)
Shakes the camera around the departure point.
s32 gWorldMapPlacement4[]
struct ScenePlacement gWorldMapPlacements80[]
static void Event_MeetFlint(void)
Walking up to Flint: he joins the party and shows how Djinn are set and put on standby; then comes th...
s32 gWorldMapTriggerActor
static void WorldMap_DepartWithTravelers(void)
Stages the travelers' departure and their transfer to the next scene.
s32 gActorEightPuffScript[]
static UNUSED void WorldMap_UpdateCyclingLinkedEffects(struct FieldActor *actor)
Cycles an unused actor's palettes and periodically creates linked effects.
static void WorldMap_RunOpeningRise(void)
Stages the rising actor and its trailing puffs before the next arrival.
static void WorldMap_BoardBunzasWagon(void)
Out of West Lunpa Cave by wagon: Bunza and Hammet nod to each other and climb aboard with the hero,...
static void Event_MeetCorona(void)
Walking near Corona, or talking to him: once a battle is nearly due, Corona fights.
static void WorldMap_TransferToExit102(void)
Stages the next leg of travel and leaves through exit 102.
static void WorldMap_MoveShakeCamera(s32 x, s32 z)
Moves to the next camera-shake point and holds it for four frames.
static void Event_StartDousingTravelMarker(void)
Starting to cast Douse on the marker.
static void WorldMap_ShakeTransferLandingCamera(void)
Shakes the camera around the landing point.
static void Event_SearchShipwreck(void)
Searching the shipwreck.
s32 gTransitionSparkScript[]
static void WorldMap_PulseOrbAndSpawnSparks(union FieldObject *fieldObject)
Pulses the orb's scale and emits short-lived sparks.
static void Event_TalkAboutBlackOrb(void)
Talking to the one who gave the Black Orb (or reading his mind): he urges its use.
static void WorldMap_UpdateLocationContacts(void)
Culls distant location sprites and detects the leader touching nearby ones.
struct ScenePlacement gWorldMapPlacements64[]
s32 gTransferLeaderTurn[]
static void WorldMap_CompleteTransfer(void)
Finishes the journey and restores the leader's movement.
static void WorldMap_TransferToTolbiShipInteriors(void)
Stages the travelers' arrival in the ship interior.
#define ACTOR
The one actor placed for entrance 75, which travels north to exit 110.
static void Event_DouseTravelMarker(void)
Douse on the marker: the party comes down and a battle begins.
struct ScenePlacement gWorldMapPlacements[]
static UNUSED void WorldMap_UpdateBlinkingLinkedEffects(struct FieldActor *actor)
Blinks an unused actor and periodically creates its linked effects.
static void WorldMap_ActivateSite138(s32 actor)
Turns the exit at cell code 138 into a touch event that runs Event_StopLeavingShip,...
static void WorldMap_PlayLighthouseTransition(s32 palette)
Animates the lighthouse transition frames, palette, and camera.
struct ScenePlacement gWorldMapPlacements49[]
static void Event_UseBlackOrb(void)
Using the Black Orb on the shipwreck: nothing happens, the orb is taken back and the party is to pres...
static void WorldMap_JitterTransitionCamera(void)
Jitters the view around the selected actor during the transition.
static void WorldMap_RestoreExitTrigger(void)
Makes cell code 138 an exit again, to exit 33.
@ TRANSITION_EFFECT_WIDTH
@ TRANSITION_EFFECT_DEPTH
const struct ScenePlacement * WorldMap_GetPlacements(void)
static void WorldMap_MoveActorEightToExit(void)
Moves the arrival actor along the staged route to its exit.
static void Event_MeetVine(void)
Walking near Vine, or talking to him: once a battle is nearly due, half the time Vine fights; otherwi...
static void WorldMap_SpawnActorEightPuff(void)
Spawns a puff behind the moving actor at staggered intervals.
static void Event_PassThroughFirstNorthSouthPassage(void)
As Event_PassThroughWestEastPassage, for a passage crossed north to south.
static void WorldMap_SelectExitByZ(s32 trigger, s32 exitBefore, s32 exitAfter)
Chooses a passage exit from the leader's north-south approach.
static void WorldMap_UpdateAirborneTravelTimer(void)
Rotates the traveler and counts down to the raised travel event.
static void Event_PassThroughWestEastPassage(void)
Walking into a passage: the side the party comes from decides which exit takes it through to the othe...
static void WorldMap_TransferToExit106(void)
Stages the next leg of travel and leaves through exit 106.
struct SceneEntrance gWorldMapEntrances[]
static void WorldMap_RunBlackOrbScene(void)
Introduces the Black Orb and prompts Isaac to use it on the ship.
static UNUSED void WorldMap_CycleActorPalettes(struct FieldActor *actor)
Advances an unused actor's palette on odd frames.
s32 WorldMap_Initialize(void)
Restores the map's state and runs the sequence its arrival entrance selects: 90 and 91 carry the part...
struct ScenePlacement gWorldMapPlacements72[]
static void WorldMap_UpdateTransitionEffect(void)
Scatters transition particles and jitters the camera.
static void Event_EnterTransferRoute(void)
Walking onto this spot: the first time the travel scene plays, later it is an ordinary entrance.
static s32 WorldMap_ComputeOpposingRewardTotals(void)
Subtracts the opposing pair's rewards from the first pair's total.
static void WorldMap_StartTransitionEffect(void)
Starts the sparkling travel transition and fades out to its destination.
static void Event_MeetHail(void)
Walking near Hail, or talking to him: once a battle is nearly due, Hail fights.
static void WorldMap_ShowTransitionFrame(u8 *buffer, s32 offset, s32 frames)
Displays a transition frame before advancing its animation delay.
s32 gWorldMapPlacement3[]
static void Event_PassThroughThirdNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage.
s32 gWorldMapPlacement1[]
struct SceneEvent gWorldMapEvents[]
static void WorldMap_UpdateBobbingMarker(union FieldObject *fieldObject)
Cycles the marker's palette and orbits it around its map position.
const struct SceneEntrance * WorldMap_GetEntrances(void)
static s32 WorldMap_ApplyMapRotationAndMode(struct ScriptInterpreter *interpreter)
Aligns the actor to the map and selects its flagged animation mode.
const struct SceneRegion * WorldMap_GetRegions(void)
s32 gWorldMapPlacement2[]
static void Event_LeaveEastward(void)
Walking east off this edge of the map, once allowed.
const u32 * WorldMap_GetExits(void)
s32 gWorldMapPlacement0[]
static void Event_PassThroughSecondNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage.
static void WorldMap_StartAirborneTravel(s32 targetActor)
Moves the selected actor toward the travel marker and starts its timer.
static s32 WorldMap_ApplyMapRotationAndCollision(struct ScriptInterpreter *interpreter)
Enables the actor's collision and aligns its sprite to the map.
static void WorldMap_UpdateTransitionBlend(void)
Refreshes the transition's blend registers on alternating frames.
struct ScenePlacement gWorldMapPlacements71[]
static s32 WorldMap_GetSelectedReward(u32 selection)
Looks up the reward selected by the first set progress flag.
static void Event_EnterAirborneTravel(void)
Walking onto the marker: the party is lifted up into the air.
static void Event_FinishAirborneTravel(void)
When the time in the air runs out: the party and the marker fly off, and the map reopens elsewhere.
struct ScenePlacement gWorldMapPlacements65[]
static s32 WorldMap_BlinkActorSprite(struct ScriptInterpreter *interpreter)
Blinks a visible actor on alternating frames.
static void WorldMap_SelectExitByX(s32 trigger, s32 exitBefore, s32 exitAfter)
Chooses a passage exit from the side of the actor the leader approaches.
const struct SceneEvent * WorldMap_GetEvents(void)
s32 gBlackOrbLeaderScript[]
static s32 WorldMap_InitializeFirstDjinni(struct ScriptInterpreter *interpreter)
Animates the first Djinni until it has met the party.
static void WorldMap_TransferToExit104(void)
Stages the next leg of travel and leaves through exit 104.
#define WORLD_MAP_QUEUE_TRANSITION_FRAME(buffer, offset)
static void WorldMap_ShowDjinnTutorial(void)
Demonstrates setting a Djinni and placing it on standby.
static void WorldMap_DisembarkCarriage(void)
Brings the carriage to a stop and lets Isaac disembark.
static void WorldMap_UpdateTransferredActorLanding(void)
Keeps the transferred actor above the guide and triggers its landing once.
static void WorldMap_TransferToExit103(void)
Stages the next leg of travel and leaves through exit 103.
s32 gTransferLeaderIdle[]
struct ScenePlacement gWorldMapPlacements73[]
static void Event_StopLeavingShip(void)
Walking away from the shipwreck with the Black Orb: the hero walks back.
static void WorldMap_ReleaseSparkAfterDelay(union FieldObject *fieldObject)
Releases the spark after its initial timer step.
static void Event_PassThroughFourthNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage.
static void WorldMap_ShowEndingScene(void)
Shows Jenna and Kraden's closing scene before returning to the title.
struct ScenePlacement gWorldMapPlacements66[]
Scene numbers, named after their places.
char SceneId_MercuryLighthouseAerie1
char SceneId_VenusLighthouseAerie
The field object script interpreter and the operands its commands read.
Song and sound effect ids, indices into gSound_SongTable.
#define SE_MENU_CURSOR_MOVE
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_EventRequestExit()
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_ActorShowEmote()
void Engine_EventSetMessage()
void Engine_EventShowMessage()
void WorldMap_CreateLinkedEffects(struct FieldActor *parent)
Attaches two rising particles to the actor, sharing the effect's cached tiles.
void WorldMap_EndEvent(void)
Ends what WorldMap_BeginEvent started: on the world map, reloads the area's graphics and sets the cam...
void WorldMap_BeginEvent(void)
Starts an event or menu on the world map: ends any colour ratio transition in progress,...
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
struct AnimationSpritePart image
u16 rotation
1/65536 turns
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
u8 slot
VRAM cache entry holding its tiles.
u8 count
layers in use, up to the last one present
s32 scale
16.16 fixed point, 0x10000 full size
u16 fullColor
256 colours; set for both parts when created
u16 priority
2 when created
The work of a Psynergy effect scene: its caster and target, where it takes place, the map state it re...
s8 childOption
Set by some scenes before an effect; Carry, Frost, Force and Reveal treat the target differently with...
A field object as the object dispatcher's far calls take it.
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
s32 encounterThreshold
encounter steps before a battle
u16 encounterEnemyGroup
the next battle's enemy group, 0 for none
s16 raisedTrigger
a raised event for Scene_RunRaisedEvent
s32 startTransition
SCENE_TRANSITION(style, variant).
u16 unk172
FieldWork's menu request; scenes set it to 1.
s32 encounterBias
randomized distance adjustment between battles
s32 transitionFrames
frames
u16 message
the next message, advanced as each window opens
A field actor: a person or thing on the field with a position, motion toward a target,...
s16 timer
The parameter its action script reads (a follow distance or an angle to face), the player's frames to...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
u16 radius
Collision radius in pixels: 16, or half the sprite metadata's boxY, when created; the overlap checks ...
u8 steeringFlags
ActorSteeringFlag bits.
u8 motionFlags
ActorMotionFlag bits; zero is free flight in 3D, and 3 is set on creation.
union FieldCoordinate x
16.16 fixed-point pixels
u8 paused
nonzero skips its script and motion, not its update
s32 bounce
The share of its falling speed kept as it bounces on landing, 16.16 fixed point (0x4000 when created)...
union FieldCoordinate y
16.16 fixed-point pixels
u8 priorityFlags
ActorPriorityFlag bits, read by the scrolling camera.
s32 terrainHeight
16.16 fixed-point pixels
s32 velocityY
16.16 fixed-point pixels per frame
u8 spriteStorageKind
Zero hides sprites; one draws a single sprite, two draws a group.
s32 gravity
Taken off the vertical velocity each frame while it is above the ground, in 16.16 fixed-point pixels ...
union FieldCoordinate z
16.16 fixed-point pixels
s32 acceleration
Added toward the target each frame, or taken off the speed when there is none, in 16....
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
void(*) update(union FieldObject *object)
Called each frame before the object's script, while the object is live.
u16 work
The side of the player's next footprint (2 after a stop), or scene scratch.
u8 collisionFlags
bits: 7 refuses to move into a solid object | 4 nearer for Psynergy targets | 3 never a talk or Psyne...
u8 frozen
Nonzero skips steering, terrain, gravity and floating; its velocity still moves it (ScriptMotionObjec...
The game's state: play time, coins, the scene and the leader's position, the active party and the opt...
u8 paletteGlow[2]
window hue (0 to 24), brightness
s32 encounterSteps
the encounter count, reset with a new group
u8 movementMode
1 while the leader is climbing, 0 otherwise
s32 selectedActor
the leader: its unit and its actor
s16 savedScene
where a defeat returns to without a defeat point
s16 savedEntrance
where a defeat returns to without a defeat point
The world map's perspective work (struct PerspectiveWork) as the world map scene sees it,...
u16 rotation
PerspectiveWork's yaw, 1/65536 turns.
A scene entrance: where and facing which way the party arrives, and the camera's bounds there (-1 for...
A scene event: its kind and detail, the trigger it answers, its condition and its value (a message or...
u32 value
A message below 0x10000, else an event function; for an exit, the exit kind its scene's exit table ma...
u32 control
The kind and its detail, read by Scene_FindEvent and the item, Psynergy and search lookups; -1 ends t...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
s32 x
16.16 fixed-point pixels
u16 facing
1/65536 turns (enum Facing)
s32 z
16.16 fixed-point pixels
A scene's exit region: the box that, while its condition holds, takes the party leader out through it...
The prefix that command handlers read from a field object's 0x70-byte slot.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
Values that differ by patch level or language, chosen once for their code.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
An object on the field, read as an actor or as an effect.
void Party_RestoreHpPp(s32 cureConditions)
Restores every party member's HP and PP; with cureConditions 1 it also cures poison and haunting.
The patch levels: our groups of the measured changes from the Japanese release.
The sprite VRAM block cache and its owners.
void UiWork_PushValueSlot(u32 value, u32 kind)
Adds a message argument of kind (MSG_ARG_) with value to the first free place of the argument table; ...