41#include "text/msg_ids.h"
90#define SUHALLA_REVEAL_PALETTE_COLOR (*(volatile u16 *)0x0500019e)
167 if (remainingFrames != 0) {
168 if (remainingFrames == 1) {
171 remainingFrames -= 1;
188 stormIdCopy = stormId;
192 if (captureActive == 0) {
199 storm->
z.
part.pixel);
211 selectedActor->
velocityY = captureActive;
259 s32 appearanceRestored;
263 stormIdCopy = stormId;
267 leaderX = selectedActor->
x.
part.pixel;
268 leaderZ = selectedActor->
z.
part.pixel;
274 storm->
scaleX = ((frame << 11) + 0x800);
275 storm->
scaleY = ((frame << 12) + 0x1000);
276 if (appearanceRestored == 0) {
277 nextFrame = frame + 1;
281 nextFrame = frame + 1;
285 }
while (frame <= 15);
294 if ((
s32)leader != 0) {
324 if ((
s32)leader != 0) {
326 leader->
z.
part.pixel);
426 actor->
speed = 0x18000;
444 if (dx + (dz >= 0 ? actor->
z.
fixed - selectedActor->
z.
fixed
460 if (sparkFrame == 0) {
465 sparkFrame, 0x880001, &options);
547 selectedActor->
frozen = 1;
550 for (frame = 0; frame < 60; frame++) {
573 if (brightnessFrame > 31)
574 brightnessFrame = 64 - brightnessFrame;
575 color = (brightnessFrame >> 1) + 7;
576 color |= (color << 10) | (color << 5);
604 return removalResult;
706 actor->sprite->flags = 0;
745 sprite = actor->sprite;
753 sprite = actor->sprite;
807 {0,
CONDITION_ALWAYS, 256, 0, 100,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
812 {1,
CONDITION_ALWAYS, 264, 0, 56,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
813 {2,
CONDITION_ALWAYS, 24, 0, 936,
FACING_EAST, 0, -1, -1, -1, -1, 0},
818 {1,
CONDITION_ALWAYS, 488, 0, 456,
FACING_WEST, 0, -1, -1, -1, -1, 0},
819 {2,
CONDITION_ALWAYS, 488, 0, 1208,
FACING_WEST, 0, -1, -1, -1, -1, 0},
820 {3,
CONDITION_ALWAYS, 440, 0, 624,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
821 {4,
CONDITION_ALWAYS, 56, 0, 624,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
826 {1,
CONDITION_ALWAYS, 72, 0, 248,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
827 {2,
CONDITION_ALWAYS, 440, 0, 152,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
828 {3,
CONDITION_ALWAYS, 632, 0, 152,
FACING_SOUTH, 0, -1, -1, -1, -1, 0},
829 {4,
CONDITION_ALWAYS, 648, 0, 280,
FACING_NORTH, 0, -1, -1, -1, -1, 0},
Ability numbers, named from the English release.
struct FieldActor * Object_GetById(s32 actor)
Returns an actor, or NULL if it does not exist.
const struct ScenePlacement * Scene_GetPlacements(void)
const struct SceneEntrance * Scene_GetEntrances(void)
const struct SceneEvent * Scene_GetEvents(void)
const u32 * Scene_GetExits(void)
Both scenes share one exit table.
const struct SceneRegion * Scene_GetRegions(void)
s32 Scene_Initialize(void)
Sets up whichever scene is being entered and runs its arrival events.
const s32 * gEffectScripts[]
Calls through a function pointer, by argument count.
The engine calls the debug menus import, and their palette swatch tiles.
Djinn numbers, named from the English release.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
The engine call layer: one typed inline for each of the thirteen main-image routines below that the s...
static s32 FieldScheduler_AddCallback(SchedulerCallback callback, s32 priority)
Registers a main-image scheduler callback.
static s32 FieldGameFlag_GetByte(s32 flag)
static void FieldGameFlag_SetByte(s32 flag, s32 value)
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)
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)
static void Actor_WalkToAndWait(s32 actor, s32 x, s32 z)
s32 Engine_TaskRemoveCallback(void(*callback)(void))
void Engine_ActorFaceDirection(s32 actor, s32 facing, s32 frames)
void Engine_EventCloseScreen(void)
void Engine_ActorSetDestination(s32 actor, s32 x, s32 z)
void Engine_ActorWalkToAndWait(s32 actor, s32 x, s32 z)
static void Actor_FaceActor(s32 actor, s32 target, s32 frames)
void Engine_EventWaitForScreen(void)
static void Actor_ShowEmote(s32 actor, s32 emote, s32 frames)
void Engine_GameFlagSet(s32 flag)
void Engine_GameFlagClear(s32 flag)
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)
static void Map_CopyCellAttributes(s32 srcX, s32 srcY, s32 width, s32 height, s32 destX, s32 destY)
void Engine_ActorStop(s32 actor)
void Engine_ActorRunRepeatedMotion(s32 actor, s32 repeats)
void Engine_ActorWalkTo(s32 actor, s32 x, s32 z)
static void Event_ShowMessage(s32 speaker, s32 flags)
static void Event_PlayCue(s32 cue)
s32 Engine_GameFlagIsSet(s32 flag)
static s32 Event_AskYesNo(s32 speaker, s32 flags)
static void MapObject_SetPosition(s32 object, s32 fixed_x, s32 fixed_z)
static void Actor_SetSpeed(s32 actor, s32 speed, s32 acceleration)
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)
static struct FieldActor * Actor_Get(s32 actor)
void Marker_MoveLeaderAway(void)
Keeps the party leader off the markers: a leader within 16 pixels of a marker cell's centre is moved ...
Field objects and actors, and the scene transition styles.
#define ACTOR_NO_TARGET
A target coordinate that is not set: the object has no target.
#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 PSYNERGY_IN_AREA(ability, phase)
#define IF_FLAG_SET(flag)
#define FIND_PSYNERGY_STONE
#define SCENE_EXIT(exit, scene, entrance)
#define PSYNERGY_ON_ACTOR(ability)
#define EVENT_SCRIPT(script)
#define PLACEMENT_SHARE_PREVIOUS_SPRITE
Game flags, named where their meaning is shown.
#define FLAG_IODEM_MET_WOUNDED_SOLDIERS
Set at Babi's palace as his audience after Colosso begins; afterwards Suhalla's people talk of the To...
#define FLAG_SCENE_TEMP_0F
#define FLAG_SUHALLA_DESERT_TALKED_OF_SHEBA
search on or go to Lalivero
#define FLAG_SCENE_TEMP_09
#define FLAG_SCENE_TEMP_0E
#define FLAG_SCENE_TEMP_0A
#define FLAG_SCENE_TEMP_08
#define FLAG_SCENE_TEMP_06
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_SUHALLA_DESERT_IODEM_WARNED
Iodem warned of a sandstorm. "A sandstorm!".
#define FLAG_SCENE_TEMP_10
#define FLAG_IODEM_FOLLOWING_PARTY
#define FLAG_SCENE_TEMP_18
#define FLAG_SCENE_TEMP_07
#define FLAG_MENU_OPEN
Set while the field menu is open; scenes hold their moving actors still.
#define FLAG_SUHALLA_DESERT_CHASING_STORM_DOUSED
volatile u32 gFrameCount
Frames WaitFrames has finished.
BattleFxScene, the work of a battle or field Psynergy effect scene, and its arc objects.
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.
The heap's work slots and HeapState.
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
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...
Io_Write16, a 16-bit write to a register or memory.
#define Io_Write16(v, reg)
Writes a value to a 16-bit register or memory location.
Item numbers, named from the English release.
Maps: their cells, layers, animations and blend scripts, and the map state.
The reel game's title lettering.
Field object scripts: one s32 command word, then its operands, as gScriptObject_CommandTable runs the...
#define SC_LOOP(n, to)
Repeat up to n times.
#define SC_POS(x, y, z)
Set position.
#define SC_WAIT(n)
Wait n frames.
#define SC_TOP
Script start.
#define SC_END
Return to the main script.
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 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.
Scene numbers, named after their places.
char SceneId_SuhallaDesert2
char SceneId_SuhallaDesert1
char SceneId_SuhallaDesert3
The field object script interpreter and the operands its commands read.
Song and sound effect ids, indices into gSound_SongTable.
void Engine_ActorSetAnimation()
struct EventWork * gEventWork
void Engine_ActorSetPosition(u32 actor, s32 x, s32 z)
void Engine_EventEnd(void)
void Engine_AudioPlayCue()
void Engine_EventBegin(void)
void Engine_EventSetMessage()
void Engine_EventShowMessage()
One animation layer of a sprite: its animation id, frames, running script and timer.
u8 param
SpriteColorMode its pixels are drawn with; 0 when taken.
An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.
u8 flags
bits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
struct AnimationEntry * entries[4]
its layers; empty ones null
u8 dirty
nonzero redraws its pixels into VRAM when next drawn
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...
The options of a spawned field effect, each used when its EFFECT_USE_ flag (or EFFECT_SCALE_TO_TARGET...
s32 startScaleY
16.16 fixed point, 0x10000 full size
u16 spin
1/65536 turns per frame
s32 startScaleX
16.16 fixed point, 0x10000 full size
The running scene's event work: its placement and event tables, its actors, the triggers and exit it ...
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).
A field actor: a person or thing on the field with a position, motion toward a target,...
s32 speed
speed limit, 16.16 fixed-point pixels per frame
s32 targetX
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
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
s32 targetZ
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
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.
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 targetY
16.16 fixed-point pixels; ACTOR_NO_TARGET when unset
s32 scaleX
16.16 fixed point, 0x10000 full size
s32 scaleY
16.16 fixed point, 0x10000 full size
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 movementMode
1 while the leader is climbing, 0 otherwise
s32 selectedActor
the leader: its unit and its actor
The map work in heap slot 8 (struct MapScrollWork), seen as its tile animation channels,...
u16 flags
REG_DISPCNT bits; Map_SetShownLayers sets BG1 to BG3.
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...
An actor a scene places: its sprite, the condition for placing it, how it behaves,...
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.
struct SceneEntrance gSuhallaDesertEntrances1[]
static s32 SuhallaDesert_ClearActorSpriteAndCollisionFlags(struct ScriptInterpreter *interpreter)
A storm's placement script: clears its sprite and collision flags.
static void Event_CaughtByFirstStorm(void)
The leader walks into the first storm of the scene.
static void Event_DouseStorm(s32 unused, s32 stormId)
Douse stops the storm that caught the leader: it is doused for good, and the monster in it attacks.
struct ScenePlacement gSuhallaDesertPlacements1[]
@ WORLD_MAP_STORM_DROP_FOURTH
static void Event_CaughtByFourthStorm(void)
The leader walks into the fourth storm.
static void Event_ThirdStormRises(void)
The party nears the third storm.
static void Event_DouseCastAtStorm(void)
Douse cast at the storm that caught the leader: sets the Psynergy effect's child option (its meaning ...
struct ScenePlacement gSuhallaDesertPlacements3[]
static void Event_CaughtBySecondStorm(void)
The leader walks into the second storm.
static void Event_FirstStormRises(void)
The party nears the first storm.
void QueueSceneSound(s32 cue)
struct SceneEvent gSuhallaDesertEvents3[]
static void SuhallaDesert_SetUpFirstSceneStorms(void)
The first scene's storms on entry: a doused storm counts as risen, the others start small (unless the...
static void Event_IodemAsksWhetherToPressOn(void)
Near the second scene's way out to the world map, once Iodem has heard the wounded soldiers: he steps...
static void Event_CaughtByThirdStorm(void)
The leader walks into the third storm.
static void Event_FifthStormRises(void)
The party nears the fifth storm.
struct SceneEvent gSuhallaDesertEventsOther[]
static s32 Event_RevealStarts(void)
Reveal in the second scene: the hidden object appears at 248, 712, map cells and the map object at 10...
struct SceneEntrance gSuhallaDesertEntrancesOther[]
struct SceneEntrance gSuhallaDesertEntrances3[]
u32 gSuhallaDesertExits[]
static void SuhallaDesert_SetUpSecondSceneStorms(void)
The second scene's storms on entry, as the first scene's; the fourth storm's first sprite part takes ...
struct SceneEntrance gSuhallaDesertEntrances2[]
static s32 SuhallaDesert_ChaseLeader(struct ScriptInterpreter *interpreter)
The chasing storm's script: it follows the leader, throwing up sand every eight frames,...
static u16 sSuhallaDesertSavedColor
static void Event_CaughtByFifthStorm(void)
The leader walks into the first scene's fifth storm, or the chasing storm reaches the moving leader.
s32 gSuhallaDesertFourthStormScript[]
static void Event_StormGivesChase(void)
In the second scene, until the chasing storm has been doused: it appears behind the party and gives c...
static void SuhallaDesert_CatchInStorm(s32 stormId)
The leader walks into a storm: drawn to its centre and lifted, the party spins until Douse stops the ...
static void Event_SecondStormRises(void)
The party nears the second storm.
static s32 SuhallaDesert_ToggleActorActive(struct ScriptInterpreter *interpreter)
A storm's placement script: toggles its single-sprite storage.
#define SUHALLA_REVEAL_PALETTE_COLOR
static void Event_FourthStormRises(void)
The party nears the fourth storm.
@ REVEALED_OBJECT
in the second scene, seen with Reveal
@ STORM_FIRST
the storms are actors 8 to 12
@ STORM_CHASING
in the second scene the last storm gives chase
static void SuhallaDesert_PulseRevealPalette(void)
While Reveal lasts: one palette color pulses, brightening and dimming over 64 frames.
s32 gSuhallaDesertChaseScript[]
static void Event_StormCarriesPartyAway(void)
The spinning runs out: the storm rises into the sky with the party, the screen closes,...
static void SuhallaDesert_RaiseStorm(s32 stormId)
As the party nears a storm it rises, growing to full size with the sand haze fading in the first time...
@ FLAG_STORMS_RISEN
A storm has risen: the sand haze stays faded in.
@ FLAG_SECOND_SCENE_STORM_DOUSED
@ FLAG_FIRST_SCENE_STORM_DOUSED
struct ScenePlacement gSuhallaDesertPlacements2[]
s32 gSuhallaDesertStormScript[]
static s32 Event_RevealEnds(void)
Reveal ends, or a scene is entered: in the second scene, what Reveal showed is hidden again and the p...
static void SuhallaDesert_UpdateCaptureTimer(void)
Each frame while caught: spins the leader, and counts down to raising event 99, the storm carrying th...
struct ScenePlacement gSuhallaDesertPlacementsOther[]
static void Event_FightDjinni(void)
Talking to the Djinni starts its battle.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
struct FieldCoordinate::@024321007066302143002254325121164243234242211074 part
s32 fixed
16.16 fixed-point pixels
The patch levels: our groups of the measured changes from the Japanese release.