11#define EXIT_SCENE_MASK 0xfff
12#define EXIT_ENTRANCE(word) (((word) & 0xff000) >> 12)
13#define EXIT_KIND(word) (((word) & 0x0ff00000) >> 20)
14#define EXIT_HAS_FLAG 0x10000000
15#define EXIT_TABLE_END 0x1ff
16#define EXIT_KIND_ANY 0xff
52 if (scene != currentScene)
55 firstExit = exitTable;
65 nextScene = *firstExit & 0x1ff;
71 nextEntrance = entrance;
110 for (i = 0; i < 2; i++) {
119 if (scene == -1 && entrance == -1) {
136 if (scene != -1 || entrance != -1) {
301#define SCENE_RECORD(id) (&gField_SceneTable[id])
317 for (flag = 0x200; flag <= 0x2ff; flag++)
321 for (flag = 0x300; flag <= 0x3ff; flag++)
334 for (flag = 0x80; flag <= 0xdf; flag++)
357#undef EXIT_SCENE_MASK
#define Unit_UpdateGauges(unit)
Recalculates HP and PP gauges, keeping at least one when any points remain.
s32 Runtime_BlankDisplayAndRunFar()
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
s32 Battle_RunEncounterFar(s32 enemyGroup)
struct BattleUnit * UnitGetFar(u32 owner)
s32 GameFlag_TestFar(s32 flag)
s32 GameFlag_SetBitFar(s32 flag)
void GameFlag_RefreshLureCapFar(void)
void GameFlag_ClearBitFar(s32 flag)
void GameState_InitDefaultsFar(void)
void AudioCommand_PlayFar(s32 id)
void PaletteGlow_UpdateFar(s32 phase, s32 brightness)
const struct SceneRecord gField_SceneTable[]
struct SceneEntries gOverlayArea
#define FLAG_SHOW_LOCATION_NAME
#define FLAG_MERCURY_LIGHTHOUSE_LIT
#define FLAG_VENUS_LIGHTHOUSE_LIT
#define FLAG_KEEP_MUSIC
The next scene keeps the music that is playing; scene.c clears FLAG_KEEP_MUSIC as it does,...
#define FLAG_MARS_LIGHTHOUSE_LIT
#define FLAG_RETREAT_BLOCKED
Retreat is blocked, from Psynergy or an item.
#define FLAG_KEEP_PARTY_POSITION
#define FLAG_JUPITER_LIGHTHOUSE_LIT
#define FLAG_CHILDHOOD
the prologue: Isaac and Garet are children
#define FLAG_KEEP_MUSIC_HELD
#define FLAG_NOT_ON_MAP
the current place is not on the world map
void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler)
Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and...
u8 gDebugMode
Debug builds: Start+Select pauses the frame loop.
struct GameState gGameState
void Runtime_InitializeHeap(void)
Empties the heap: clears the 64 words of gWorkSlot (both pool pointers and every named slot) and sets...
void * MemAlloc(s32 size)
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise...
#define DMA_START_TIMING_DRQ_REPEAT
A DMA control's start timing (bits 12 and 13), cartridge request (bit 11) and repeat (bit 9): the bit...
#define BG_PLTT_COLOR(palette, color)
void MemFree(void *buffer)
void Scene_ResolveInteractionResult(void)
Chooses the current scene's field music (gGameState.cue) from the first rule matching the scene or it...
What every part of object.c shares: its includes and the macros and types more than one part uses.
#define EXIT_NONE
Field_RunScene's result when the scene was not left (scene.c, run_scene.c).
s32 Field_RunScene(s32 entrance)
Runs the current field scene, which the party entered by entrance, until it leaves; returns the exit ...
void Audio_PlayCueFromEventWork(void)
Starts the current scene's field music, chosen by Scene_ResolveInteractionResult.
static __inline__ s32 RunReelGame(s32 entrance)
Runs the slot machine, preserving BG palettes 14 and 15.
s32 BattleFx_GetResourceGroup(s32 scene)
Returns the group scene belongs to.
void Scene_TakeExit(s32 exitKind)
Chooses the scene and entrance to go to when the party leaves the current scene.
void Scene_ResetFlagsOnEnter(s32 unused, s32 keep)
Updates the flags and state that last for one scene or one group of scenes, on entering the current s...
void Game_ResetForNewGame(s32 mode)
The game's main loop, which never returns.
#define EXIT_ENTRANCE(word)
void Scene_LoadOverlay(s32 unused)
Loads the current scene's overlay code (its resource) into gOverlayArea.
void Scene_ReturnFromBattle(s32 result)
Chooses where the game continues after a battle or another scene that is not a field map (see Game_Re...
static __inline__ s32 RunLuckyDice(s32 entrance)
Runs the Lucky Dice minigame, preserving BG palettes 14 and 15.
void Scheduler_ResetTaskTable(void)
Empties the task table: every slot gets no routine, order 0xffff (sorted last) and no flags.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s16 hp
current HP, 0 when downed
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s16 nextScene
where the event sends the party next; -1 for none
u8 paletteGlow[2]
window hue (0 to 24), brightness
s16 nextEntrance
where the event sends the party next; -1 for none
s16 map
the scene's map; SceneId_Clear for the world map
s16 sceneGroup
the current scene's group; a new group resets its flags
s16 defaultEntrance
the entrance it was entered by
s16 hazardSteps
reset on entering a new scene group
s32 encounterSteps
the encounter count, reset with a new group
s16 defeatEntrance
where a defeat returns to; -1 for none
s16 sceneChangeReason
the last battle's result; -1 for a defeat
s16 retreatEntrance
where Retreat goes; the group's first entrance
s16 defeatScene
where a defeat returns to; -1 for none
s16 retreatScene
where Retreat goes; the group's first entrance
s16 defaultScene
the scene being run, kept as it starts
s16 sceneVariant
the current scene's variant from its record
s32 selectedActor
the leader: its unit and its actor
s16 savedScene
where a defeat returns to without a defeat point
s16 cue
the current scene's field music
s16 returnCue
music playing when the field left; -1 for none
s16 savedEntrance
where a defeat returns to without a defeat point
const u32 *(*) exits(void)
An actor's animation object, seen for the flags and rotation that lay a wounded soldier in his bed.
void Resource_LoadCode(u32 index, void *destination)
Decodes the compressed code resource index to destination and resolves its long branches there,...
void DebugText_Clear(void)
Blanks the debug text screen, homes the cursor and points BG0 at it.
void VramCache_Reset(void)
Frees every block and every cache entry.