world_map.c
The world map: the Djinn met on it, the passages between its regions, the map markers, and the actors of particular arrivals.
games/tbs/src/scene/world_map.c on GitHub
The world map: the Djinn met on it, the passages between its regions, the map markers, and the actors of particular arrivals.
Functions
Event_MeetVine
static void Event_MeetVine(void)
Walking near Vine, or talking to him: once a battle is nearly due, half the time Vine fights; otherwise the next step brings an ordinary battle. Reached by talking to actor 8, or by walking onto cell code 92 until Vine is caught.
Used by gWorldMapEvents.
Event_MeetCorona
static void Event_MeetCorona(void)
Walking near Corona, or talking to him: once a battle is nearly due, Corona fights. Reached by talking to actor 9, or by walking onto cell code 91 until Corona is caught.
Used by gWorldMapEvents.
Event_MeetHail
static void Event_MeetHail(void)
Walking near Hail, or talking to him: once a battle is nearly due, Hail fights. Reached by talking to actor 10, or by walking onto cell code 93 until Hail is caught.
Used by gWorldMapEvents.
WorldMap_ReleaseSparkAfterDelay
static void WorldMap_ReleaseSparkAfterDelay(union FieldObject *fieldObject)
Releases the spark after its initial timer step.
Used by WorldMap_PulseOrbAndSpawnSparks.
WorldMap_PulseOrbAndSpawnSparks
static void WorldMap_PulseOrbAndSpawnSparks(union FieldObject *fieldObject)
Pulses the orb's scale and emits short-lived sparks.
Used by Event_UseBlackOrb.
WorldMap_UpdateBobbingMarker
static void WorldMap_UpdateBobbingMarker(union FieldObject *fieldObject)
Cycles the marker's palette and orbits it around its map position.
Used by WorldMap_InitializeFirstDjinni.
WorldMap_InitializeFirstDjinni
static s32 WorldMap_InitializeFirstDjinni(struct ScriptInterpreter *interpreter)
Animates the first Djinni until it has met the party.
Used by gWorldMapPlacement0.
WorldMap_ApplyMapRotationAndMode
static s32 WorldMap_ApplyMapRotationAndMode(struct ScriptInterpreter *interpreter)
Aligns the actor to the map and selects its flagged animation mode.
Used by gWorldMapPlacement2.
WorldMap_ApplyMapRotation
static s32 WorldMap_ApplyMapRotation(struct ScriptInterpreter *interpreter)
Aligns the actor's sprite rotation to the map.
Used by WorldMap_ApplyMapRotationAndMode, gWorldMapPlacement1.
WorldMap_ApplyMapRotationAndCollision
static s32 WorldMap_ApplyMapRotationAndCollision(struct ScriptInterpreter *interpreter)
Enables the actor's collision and aligns its sprite to the map.
Used by gWorldMapPlacement4.
WorldMap_InitializeProgressMarker
static s32 WorldMap_InitializeProgressMarker(struct ScriptInterpreter *interpreter)
Resets the map marker after the corresponding story progress. Called by its object script as the travel marker is placed. Once the Tolbi ship lies at anchor off the island (FLAG_TOLBI_SHIP_AT_ISLAND), sets FLAG_SCENE_TEMP_F1 and puts the marker away at the map's origin.
Used by gWorldMapPlacement3.
WorldMap_BlinkActorSprite
static s32 WorldMap_BlinkActorSprite(struct ScriptInterpreter *interpreter)
Blinks a visible actor on alternating frames.
Used by gWorldMapPlacement3.
WorldMap_SelectExitByX
static void WorldMap_SelectExitByX(s32 trigger, s32 exitBefore, s32 exitAfter)
Chooses a passage exit from the side of the actor the leader approaches.
Used by Event_PassThroughWestEastPassage.
WorldMap_SelectExitByZ
static void WorldMap_SelectExitByZ(s32 trigger, s32 exitBefore, s32 exitAfter)
Chooses a passage exit from the leader's north-south approach.
Used by Event_PassThroughFirstNorthSouthPassage, Event_PassThroughFourthNorthSouthPassage, Event_PassThroughSecondNorthSouthPassage, Event_PassThroughThirdNorthSouthPassage.
Event_PassThroughWestEastPassage
static void Event_PassThroughWestEastPassage(void)
Walking into a passage: the side the party comes from decides which exit takes it through to the other side. Reached by walking onto cell code 130.
Used by gWorldMapEvents.
Event_PassThroughFirstNorthSouthPassage
static void Event_PassThroughFirstNorthSouthPassage(void)
As Event_PassThroughWestEastPassage, for a passage crossed north to south. Reached by walking onto cell code 150.
Used by gWorldMapEvents.
Event_PassThroughSecondNorthSouthPassage
static void Event_PassThroughSecondNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage. Reached by walking onto cell code 116.
Used by gWorldMapEvents.
Event_PassThroughThirdNorthSouthPassage
static void Event_PassThroughThirdNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage. Reached by walking onto cell code 151.
Used by gWorldMapEvents.
Event_PassThroughFourthNorthSouthPassage
static void Event_PassThroughFourthNorthSouthPassage(void)
As Event_PassThroughFirstNorthSouthPassage. Reached by walking onto cell code 125.
Used by gWorldMapEvents.
WorldMap_UpdateLocationContacts
static void WorldMap_UpdateLocationContacts(void)
Culls distant location sprites and detects the leader touching nearby ones. Run each frame on the world map; WorldMap_Initialize adds it.
Used by WorldMap_Initialize.
Event_EnterTransferRoute
static void Event_EnterTransferRoute(void)
Walking onto this spot: the first time the travel scene plays, later it is an ordinary entrance. Reached by walking onto cell code 112.
Used by gWorldMapEvents.
Event_LeaveEastward
static void Event_LeaveEastward(void)
Walking east off this edge of the map, once allowed. Reached by walking east into cell code 74 once the Tolbi ship lies at anchor off the island (FLAG_TOLBI_SHIP_AT_ISLAND).
Used by gWorldMapEvents.
WorldMap_Initialize
s32 WorldMap_Initialize(void)
Restores the map's state and runs the sequence its arrival entrance selects: 90 and 91 carry the party from a lighthouse's beam up to its aerie, 1 marks the first time the party leaves Vale, 33 the Black Orb, 49 Bunza's wagon, 64 the travellers' departure, 65 to 70 the Tolbi ship's crossing, 71 the carriage, 78 a discarded item, 72 and 73 the transitions, 75 the travelling actor, 80 the ending, and 74, 76 and 77 resume airborne travel. The scene's initialization. Sets FLAG_RETREAT_BLOCKED on the map; entrance 99, a debug start, sets FLAG_NO_ENCOUNTERS, FLAG_DEBUG_STEPS_OFF and flag 0x161. Entrance 1 sets FLAG_PARTY_LEFT_VALE and flag 0x85c the first time. XXX: flags 0x161 and 0x85c are read by no code of this game; a reader would say what they record.
WorldMap_BoardBunzasWagon
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, and the wagon rolls off. Called by WorldMap_Initialize at entrance 49, after the trade reopens (FLAG_LUNPA_TRADE_REOPENED) and until the wagon has left; sets FLAG_BUNZAS_WAGON_LEFT.
Used by WorldMap_Initialize.
WorldMap_DepartWithTravelers
static void WorldMap_DepartWithTravelers(void)
Stages the travelers' departure and their transfer to the next scene. Called by WorldMap_Initialize at entrance 64 until FLAG_GUARDS_SUSPECT_KALAY is set; sets it.
Used by WorldMap_Initialize.
WorldMap_MoveShakeCamera
static inline void WorldMap_MoveShakeCamera(s32 x, s32 z)
Moves to the next camera-shake point and holds it for four frames.
Used by WorldMap_ShakeTransferLandingCamera, WorldMap_ShakeTransferStartCamera.
WorldMap_ShakeTransferStartCamera
static void WorldMap_ShakeTransferStartCamera(void)
Shakes the camera around the departure point.
Used by WorldMap_DepartWithTravelers.
WorldMap_ShakeTransferLandingCamera
static void WorldMap_ShakeTransferLandingCamera(void)
Shakes the camera around the landing point.
Used by WorldMap_DepartWithTravelers.
WorldMap_UpdateTransferredActorLanding
static void WorldMap_UpdateTransferredActorLanding(void)
Keeps the transferred actor above the guide and triggers its landing once. Run each frame while WorldMap_DepartWithTravelers carries an actor; sets FLAG_SCENE_TEMP_00 as it lands.
Used by WorldMap_DepartWithTravelers.
WorldMap_TransferToExit102
static void WorldMap_TransferToExit102(void)
Stages the next leg of travel and leaves through exit 102. Called by WorldMap_Initialize at entrance 65; sets FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_TransferToExit103
static void WorldMap_TransferToExit103(void)
Stages the next leg of travel and leaves through exit 103. Called by WorldMap_Initialize at entrance 66; sets FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_TransferToExit104
static void WorldMap_TransferToExit104(void)
Stages the next leg of travel and leaves through exit 104. Called by WorldMap_Initialize at entrance 67; sets FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_TransferToTolbiShipInteriors
static void WorldMap_TransferToTolbiShipInteriors(void)
Stages the travelers' arrival in the ship interior. Called by WorldMap_Initialize at entrance 68; sets FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_TransferToExit106
static void WorldMap_TransferToExit106(void)
Stages the next leg of travel and leaves through exit 106. Called by WorldMap_Initialize at entrance 69; sets FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_CompleteTransfer
static void WorldMap_CompleteTransfer(void)
Finishes the journey and restores the leader's movement. Called by WorldMap_Initialize at entrance 70; sets FLAG_TOLBI_SHIP_REACHED_TOLBI and clears FLAG_TOLBI_SHIP_ROWING.
Used by WorldMap_Initialize.
WorldMap_ShowDjinnTutorial
static void WorldMap_ShowDjinnTutorial(void)
Demonstrates setting a Djinni and placing it on standby. Called by Event_MeetFlint; sets and clears FLAG_DJINN_TUTORIAL_PART_A and _PART_B to choose the menu's two lessons.
Used by Event_MeetFlint.
Event_MeetFlint
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 the tutorial battle. Reached by walking onto cell code 90 until Flint (Djinni 0) is caught. Sets FLAG_DJINN_TUTORIAL and its two part flags for each lesson, and clears them all after the battle.
Used by gWorldMapEvents.
WorldMap_DisembarkCarriage
static void WorldMap_DisembarkCarriage(void)
Brings the carriage to a stop and lets Isaac disembark. Called by WorldMap_Initialize at entrance 71.
Used by WorldMap_Initialize.
WorldMap_RunBlackOrbScene
static void WorldMap_RunBlackOrbScene(void)
Introduces the Black Orb and prompts Isaac to use it on the ship. Called by WorldMap_Initialize at entrance 33 until the Black Orb is handed back and before the wounded soldiers are seen in Lalivero (FLAG_LALIVERO_WOUNDED_SOLDIERS_SEEN). Sets FLAG_SCENE_TEMP_34 and FLAG_SAW_SHIP_FROM_VENUS_LIGHTHOUSE, and turns the exit at cell code 138 into Event_StopLeavingShip.
Used by WorldMap_Initialize.
WorldMap_ActivateSite138
static void WorldMap_ActivateSite138(s32 actor)
Turns the exit at cell code 138 into a touch event that runs Event_StopLeavingShip, and places the Black Orb's giver (sprite 57) at pixel (6036, 3400). Called by WorldMap_RunBlackOrbScene, and by WorldMap_Initialize when the party returns to entrance 33 with the orb still to use.
Used by WorldMap_Initialize, WorldMap_RunBlackOrbScene.
WorldMap_RestoreExitTrigger
static void WorldMap_RestoreExitTrigger(void)
Makes cell code 138 an exit again, to exit 33. Called by Event_UseBlackOrb once the orb is handed back.
Used by Event_UseBlackOrb.
Event_TalkAboutBlackOrb
static void Event_TalkAboutBlackOrb(void)
Talking to the one who gave the Black Orb (or reading his mind): he urges its use. "Now use it... on the ship." Reached by talking to actor 55, or by Mind Read on it.
Used by gWorldMapEvents.
Event_StopLeavingShip
static void Event_StopLeavingShip(void)
Walking away from the shipwreck with the Black Orb: the hero walks back. "(Hero), where you going? I said to use the Orb on Babi's ship!" Reached by walking onto cell code 138 while WorldMap_ActivateSite138 has made it a touch event.
Used by WorldMap_ActivateSite138.
Event_SearchShipwreck
static void Event_SearchShipwreck(void)
Searching the shipwreck. "The wreckage of a ship scuttled off the coast." Reached by searching cell code 96.
Used by gWorldMapEvents.
Event_UseBlackOrb
static void Event_UseBlackOrb(void)
Using the Black Orb on the shipwreck: nothing happens, the orb is taken back and the party is to press on to Babi Lighthouse. Reached by using the Black Orb on cell code 96 until it is handed back. Clears FLAG_SCENE_TEMP_34 and sets FLAG_BLACK_ORB_RETURNED.
Used by gWorldMapEvents.
WorldMap_ShowEndingScene
static void WorldMap_ShowEndingScene(void)
Shows Jenna and Kraden's closing scene before returning to the title. Called by WorldMap_Initialize at entrance 80.
Used by WorldMap_Initialize.
WorldMap_StartTransitionEffect
static void WorldMap_StartTransitionEffect(void)
Starts the sparkling travel transition and fades out to its destination. Called by WorldMap_Initialize at entrance 73; sets FLAG_KEEP_MUSIC.
Used by WorldMap_Initialize.
WorldMap_UpdateTransitionEffect
static void WorldMap_UpdateTransitionEffect(void)
Scatters transition particles and jitters the camera.
Used by WorldMap_StartTransitionEffect.
WorldMap_MoveActorEightToExit
static void WorldMap_MoveActorEightToExit(void)
Moves the arrival actor along the staged route to its exit. Called by WorldMap_Initialize at entrance 75.
Used by WorldMap_Initialize.
WorldMap_ComputeOpposingRewardTotals
static s32 WorldMap_ComputeOpposingRewardTotals(void)
Subtracts the opposing pair's rewards from the first pair's total.
Used by WorldMap_TransferToExit106.
WorldMap_GetSelectedReward
static s32 WorldMap_GetSelectedReward(u32 selection)
Looks up the reward selected by the first set progress flag.
Used by WorldMap_ComputeOpposingRewardTotals.
WorldMap_SpawnActorEightPuff
static void WorldMap_SpawnActorEightPuff(void)
Spawns a puff behind the moving actor at staggered intervals.
Used by WorldMap_RunOpeningRise.
WorldMap_RunOpeningRise
static void WorldMap_RunOpeningRise(void)
Stages the rising actor and its trailing puffs before the next arrival. Called by WorldMap_Initialize at entrance 72.
Used by WorldMap_Initialize.
WorldMap_UpdateAirborneTravelTimer
static void WorldMap_UpdateAirborneTravelTimer(void)
Rotates the traveler and counts down to the raised travel event. Run each frame while the party is in the air; stores the frames left in the byte at FLAG_SCENE_TEMP_F8.
Used by WorldMap_Initialize, WorldMap_StartAirborneTravel.
WorldMap_StartAirborneTravel
static void WorldMap_StartAirborneTravel(s32 targetActor)
Moves the selected actor toward the travel marker and starts its timer. Called by Event_EnterAirborneTravel. Sets FLAG_SCENE_TEMP_F0 and gives the party 180 frames in the air (FLAG_SCENE_TEMP_F8).
Used by Event_EnterAirborneTravel.
Event_EnterAirborneTravel
static void Event_EnterAirborneTravel(void)
Walking onto the marker: the party is lifted up into the air. Reached by walking onto cell code 95 until the airborne journey is over (FLAG_SCENE_TEMP_F1).
Used by gWorldMapEvents.
Event_StartDousingTravelMarker
static void Event_StartDousingTravelMarker(void)
Starting to cast Douse on the marker. Reached by the first phase of Douse on the marker (actor 54) while the party is in the air (FLAG_SCENE_TEMP_F0).
Used by gWorldMapEvents.
Event_DouseTravelMarker
static void Event_DouseTravelMarker(void)
Douse on the marker: the party comes down and a battle begins. Reached by Douse on the marker (actor 54) while the party is in the air. Clears FLAG_SCENE_TEMP_F0, sets FLAG_SCENE_TEMP_F1 and empties the timer.
Used by gWorldMapEvents.
Event_FinishAirborneTravel
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. Reached by the scene raising 99 as the timer runs out. Sets FLAG_ARRIVE_FALLING and sends the party to the world map's entrance 27.
Used by gWorldMapEvents.
WorldMap_UpdateTransitionBlend
static void WorldMap_UpdateTransitionBlend(void)
Refreshes the transition's blend registers on alternating frames.
Used by WorldMap_PlayLighthouseTransition.
WorldMap_JitterTransitionCamera
static void WorldMap_JitterTransitionCamera(void)
Jitters the view around the selected actor during the transition.
Used by WorldMap_PlayLighthouseTransition.
WorldMap_ShowTransitionFrame
static inline void WorldMap_ShowTransitionFrame(u8 *buffer, s32 offset, s32 frames)
Displays a transition frame before advancing its animation delay.
Used by WorldMap_PlayLighthouseTransition.
WorldMap_PlayLighthouseTransition
static void WorldMap_PlayLighthouseTransition(s32 palette)
Animates the lighthouse transition frames, palette, and camera. Called by WorldMap_Initialize at entrances 90 (Mercury Lighthouse) and 91 (Venus Lighthouse). Clears FLAG_KEEP_PARTY_POSITION and sets FLAG_SKIP_SCENE_CHANGE_SOUND.
Used by WorldMap_Initialize.
WorldMap_UpdateBlinkingLinkedEffects
UNUSED static void WorldMap_UpdateBlinkingLinkedEffects(struct FieldActor *actor)
Blinks an unused actor and periodically creates its linked effects.
WorldMap_UpdateCyclingLinkedEffects
UNUSED static void WorldMap_UpdateCyclingLinkedEffects(struct FieldActor *actor)
Cycles an unused actor's palettes and periodically creates linked effects.
WorldMap_CycleActorPalettes
UNUSED static void WorldMap_CycleActorPalettes(struct FieldActor *actor)
Advances an unused actor's palette on odd frames.
Also, functions without a comment: WorldMap_GetEntrances, WorldMap_GetRegions, WorldMap_GetExits, WorldMap_GetPlacements, WorldMap_GetEvents.
Macros
ACTOR
#define ACTOR 8
The one actor placed for entrance 75, which travels north to exit 110.
Used by WorldMap_MoveActorEightToExit.
Also, macros without a comment: SITE, WORLD_MAP_QUEUE_TRANSITION_FRAME.
Globals, without a comment: gWorldMapTriggerActor, gWorldMapBlend, gTransferArrive10, gTransferDepart10, gTransferReturn10, gTransferGather, gTransferArrive11, gTransferDepart11, gTransferReturn11, gTransferArrive12, gTransferDepart12, gTransferReturn12, gTransferArrive13, gTransferDepart13, gTransferReturn13, gTransferGuide14, gBlackOrbLeaderScript, gPresentGuide9, gPresentGuide8, gPresentGuide5, gTransitionSparkScript, gTransferLeaderIdle, gTransferLeaderTurn, gOpeningLeaderRise, gWorldMapPlacement0, gWorldMapEntrances, gWorldMapExits, gWorldMapPlacement2, gWorldMapPlacement1, gWorldMapPlacement4, gWorldMapPlacement3, gWorldMapPlacements, gWorldMapPlacements64, gWorldMapPlacements49, gWorldMapPlacements65, gWorldMapPlacements66, gWorldMapPlacements71, gWorldMapPlacements80, gWorldMapPlacements72, gWorldMapPlacements73, gWorldMapEvents, gWorldMapRewards, gActorEightPuffScript.