Skip to Content
The Alchemy Project

include/field/script_inline.h

The script inlines: one typed inline for each script command a script calls by its own name, passing it on to the main image's import (fdActorFaceEachOther calls fdActorTurnToFaceEachOther). More…

Included by level.c, altin_peak.c, altmiller_cave.c, babi_lighthouse.c, babi_palace.c, battle_arena.c, bilibin.c, colosseum_azart_match.c, colosseum_navampa_match.c, colosseum_satrage_match.c, cottage_rooms_a.c, crossbone_isle.c, crossbone_isle_keys.c, crossbone_isle_stepping_stones.c, goma_cave_pillar.c, imil.c, imil_fuchin_falls.c, kalay_tolbi_docks.c, kolima.c, lalivero.c, lamakan_desert.c, lemurian_ship.c, log_rooms_a.c, lunpa_fortress.c, mccoy_palace.c, mccoy_palace_grounds.c, sanctum.c, ship_rooms.c, sol_sanctum_elemental_star_room.c, sol_sanctum_entrance.c, sol_sanctum_eruption.c, sol_sanctum_luna_sol_rooms.c, sol_sanctum_statue.c, timber_rooms_a.c, timber_rooms_bc.c, title.c, tolbi.c, tolbi_games.c, tolbi_ship_deck.c, tolbi_ship_mast.c, tree_rooms.c, tunnel_ruins.c, vale.c, vale_kradens_cottage.c, vale_plaza.c, vale_prologue.c, venus_lighthouse.c, venus_lighthouse_aerie.c, world_map.c and xian.c.

Macros

NameDescription
#definescFieldVectorAddPolarOffset (radius, heading, probe)Moves a point a radius in whole pixels along a heading: scFieldVectorAddPolarOffset(16, heading, &probe).

Functions

NameDescription
static inline voidfdActorFaceEachOther (Sint32 actorId, Sint32 other, Sint32 ticks)Turns two actors toward each other, as a conversation between them begins.
static inline voidfdCameraWaitForMove (void)Holds the script until the camera's pan is done.
static inline voidfdPaletteFadeInterpolate (Sint32 ticks)Runs a script's palette fade, from the source colours to the target ones, over ticks.
static inline voidgmItemLoadIcon (Sint32 item)Draws an item's icon, ready for a script to show it.
static inline voidgmItemShowFound (Sint32 item, Sint32 flags)Holds an item's picture up over the leader, as when the party finds it.
static inline voidfdMapGridRedraw (void)Redraws the room around the point the camera follows, after a script has moved it.
static inline voidmnMessageShowCentered (Sint32 msg, Sint32 flags)Shows a message in the middle of the screen rather than in a speech window.
static inline Sint32gmPartyGiveItem (Sint32 item, Sint32 flags)Gives the party an item from a script and says who got it; -1 when it was left behind.
static inline voidfdPsynergyCancel (void)Ends a script's wave effect and restores the colours it changed.
static inline Sint32mnVRAMLoad (Sint32 block, Sint32 size, const void *data)Loads a scene's sprite picture into VRAM; returns its first tile number, 0 when there's no room.
static inline voidscFieldActorSetDestinationOffset (Sint32 actorId, Sint32 xOffset, Sint32 zOffset)fdActorSetDestinationOffset, by a second inline over the same function.
static inline Sint32sySetOrUpdateTickEvent (EVENT_FUNC callback, Sint32 priority)sySetTickEvent (system_call.h) under a second name.
static inline voidfdSetMetatileBehaviorAt (Sint32 layer, Sint32 x, Sint32 y, Sint32 behavior)Changes the metatile behavior of the metatile at (x, y), in whole pixels, opening or closing the way (fdMapGridSetMetatileBehaviorAt): fdSetMetatileBehaviorAt(0, 544, 288, METATILE_BEHAVIOR_CLIMB).
static inline voidfdSetWorldMapGridTile (Sint32 x, Sint32 y, Sint32 metatileX, Sint32 metatileY)Changes one 512-pixel tile of the World Map, drawn at once when it's next to the view (fdWorldMapSetGridTile).
static inline voidscFieldActorLaunchFromLeader (Sint32 actorId, Sint32 dx, Sint32 dz, Sint32 facing)Puts an actor on the leader and sends it walking off by (dx, dz), then turns it to face facing (fdActorLaunchFromLeader).
static inline voidscFieldActorWatchAndStartScript (Sint32 object, Sint32 target, const Sint32 *actions)Makes an actor follow another and starts a script on it (fdActorWatchAndStartScript).
static inline voidscFieldVectorAddPolarOffsetFX (FIXED radius, Sint32 heading, FIELD_POS *probe)Moves a point radius, in 16.16 fixed point, along a heading on the ground plane (syVectorAddPolarOffset).

Description

The script inlines: one typed inline for each script command a script calls by its own name, passing it on to the main image's import (fdActorFaceEachOther calls fdActorTurnToFaceEachOther).

A script writes fdActorFaceEachOther(ACTOR_GARET, ACTOR_PARTY_LEADER, 30); and the inline makes the call. Where an inline would have its function's name, the function keeps it and the inline takes a second name, as scFieldActorLaunchFromLeader passes on to fdActorLaunchFromLeader.

Macros in detail

scFieldVectorAddPolarOffset

#define scFieldVectorAddPolarOffset(radius, heading, probe)

Moves a point a radius in whole pixels along a heading: scFieldVectorAddPolarOffset(16, heading, &probe).

Referenced by scAltinPeakRollCart(), scAltinPeakTurnCartLeft(), scAltinPeakTurnCartRight(), scLamakanDesertMeetManticore(), scLeaderSlideOnIce(), scTunnelRuinsHopLeaderTo(), scXianJumpOverSpilledWater() and scXianTalkToKungFuStudent().

Definition at line 146 of file script_inline.h.

Functions in detail

fdActorFaceEachOther

static inline void fdActorFaceEachOther(Sint32 actorId, Sint32 other, Sint32 ticks)

Turns two actors toward each other, as a conversation between them begins.

References fdActorTurnToFaceEachOther() and Sint32.

Referenced by scAltmillerCaveMeetInvisibleBabi(), scAltmillerCaveRestoreBabiAndInviteParty(), scBabiLighthouseExplainTruthDoor(), scBabiLighthouseFaranAsksPartyToOpenDoor(), scBabiPalaceHearSoldiersReport(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalacePassOnBabisWord(), scBabiPalaceWakeAfterFinals(), scColossoReachArena(), scCottageRoomsAAskAboutKradensStudies(), scCottageRoomsAAskToScareVisitors(), scKolimaWitnessForestCurse(), scLaliveroIodemGivesBlackOrb(), scLogRoomsADiscussMindReading(), scLogRoomsAFaceEachOtherAndWait(), scLogRoomsAIvanJoinsRodSearch(), scLogRoomsAReadCorneredSuspectsMinds(), scLogRoomsAReturnStolenGoods(), scLunpaFortressDonpaJudgesDodonpa(), scLunpaFortressFindHammet(), scLunpaFortressTalkToDonpa(), scSanctumActOutSolSanctum(), scSanctumAskToAcceptQuest(), scSanctumReceiveWiseOnesMission(), scSanctumTalkAboutGoldenStatue(), scShipRoomsIntroduceReplacementOarsman(), scSolSanctumElementalStarRoomAlexTakesStars(), scSolSanctumElementalStarRoomDemandElementalStars(), scSolSanctumElementalStarRoomEnterStarRoom(), scSolSanctumElementalStarRoomTakeMarsStar(), scSolSanctumElementalStarRoomTalkToJenna(), scSolSanctumElementalStarRoomTalkToKraden(), scSolSanctumEntranceKradenSuspectsHiddenPassage(), scSolSanctumEruptionPlayHostageScript(), scSolSanctumLunaSolRoomsRiseToElementalStarRoom(), scSolSanctumStatueExplainStatuePuzzle(), scSolSanctumStatueExplainTrapDisarmed(), scTimberRoomsAIodemQuestionsWoundedSoldiers(), scTimberRoomsBCReportToFaran(), scTolbiTalkToOlderBrother(), scTolbiTalkToYoungerSister(), scValeArgueWithGaretsSister(), scValeAskWhetherJennaHasReturned(), scValeJennaSaysKradenIsWaiting(), scValeKradensCottageKradenPlansSanctumVisit(), scValeKradensCottageMeetSaturosAndMenardi(), scValeMendingTheRoof(), scValePlazaAskAboutMeditation(), scValePlazaAskAboutTheTravelers(), scValePlazaBoyLiftsSmallRock() and 20 more.

Definition at line 22 of file script_inline.h.

fdCameraWaitForMove

static inline void fdCameraWaitForMove(void)

Holds the script until the camera's pan is done.

References fdCameraWaitForArrival().

Referenced by scAltinPeakAwardFrostJewelAndDrain(), scAltinPeakFirstBeastHopsAway(), scAltinPeakRollCart(), scAltinPeakRunBoulderChase(), scAltinPeakShowFirstBeastRoute(), scAltmillerCaveRestoreBabiAndInviteParty(), scBabiLighthouseExplainTruthDoor(), scBabiLighthouseFaranAsksPartyToOpenDoor(), scBabiPalaceHearSoldiersReport(), scBabiPalaceMeetBabiAfterColosso(), scBilibinJillGivesHardNut(), scColosseumAzartMatchDousePipe(), scColosseumAzartMatchExplainFinalsRules(), scColosseumAzartMatchPushPipeworksPipe(), scColosseumAzartMatchTalkToBridgeAttendant(), scColosseumAzartMatchTalkToLumberAttendant(), scColosseumAzartMatchTalkToPipeworksAttendant(), scColosseumAzartMatchTalkToRockAttendant(), scColosseumNavampaMatchTalkToFreeClimbAttendant(), scColosseumNavampaMatchTalkToLogRollingAttendant(), scColosseumNavampaMatchTalkToMovingSidewalkAttendant(), scColosseumNavampaMatchTalkToScalesAttendant(), scColosseumNavampaMatchTalkToSteppingStoneAttendant(), scColosseumNavampaMatchTalkToWallWedgeAttendant(), scColosseumSatrageMatchTalkToBoardWalkAttendant(), scColosseumSatrageMatchTalkToLogRollingAttendant(), scColosseumSatrageMatchTalkToMiniMazeAttendant(), scColosseumSatrageMatchTalkToShiftingFloorAttendant(), scColosseumSatrageMatchTalkToWallAttendant(), scCottageRoomsAGaretComesHome(), scCrossboneIsleKeysBaneFirstEscape(), scCrossboneIsleKeysBaneSecondEscape(), scCrossboneIsleSteppingStonesFlipWaterSwitch(), scCrossboneIsleSteppingStonesFreezeThirdPuddle(), scImilMeetMiaAtOldCouplesHouse(), scImilTalkToArmorMerchant(), scImilTalkToWeaponMerchant(), scKalayTolbiDocksGaretSeesTheKaragol(), scKalayTolbiDocksPassengersBlameTourGuide(), scKolimaLowerBridge(), scLemurianShipSetSail(), scLogRoomsADefeatThieves(), scLogRoomsADiscussMindReading(), scLogRoomsAFightThievesAgain(), scLogRoomsALoseToThieves(), scLunpaFortressFindHammet(), scLunpaFortressRevealMonster(), scLunpaFortressTalkToAttendant(), scSanctumAskToAcceptQuest(), scSanctumReceiveWiseOnesMission() and 58 more.

Definition at line 29 of file script_inline.h.

fdPaletteFadeInterpolate

static inline void fdPaletteFadeInterpolate(Sint32 ticks)

Runs a script's palette fade, from the source colours to the target ones, over ticks.

References fdPaletteFadeStartInterpolation() and Sint32.

Referenced by scVenusLighthouseAerieCombineSaturosAndMenardi().

Definition at line 36 of file script_inline.h.

gmItemLoadIcon

static inline void gmItemLoadIcon(Sint32 item)

Draws an item's icon, ready for a script to show it.

References mnIconDrawItem() and Sint32.

Referenced by scInit(), scVenusLighthouseAerieCombineSaturosAndMenardi() and scWorldMapUseBlackOrb().

Definition at line 42 of file script_inline.h.

gmItemShowFound

static inline void gmItemShowFound(Sint32 item, Sint32 flags)

Holds an item's picture up over the leader, as when the party finds it.

References fdItemDisplayShowItem() and Sint32.

Referenced by scAltinPeakAwardFrostJewelAndDrain(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalaceOfferCloakBall(), scBilibinJillGivesHardNut(), scCrossboneIsleKeysGetKey(), scInit(), scLogRoomsAOfferBones(), scLunpaFortressTakeCellKey(), scSolSanctumElementalStarRoomGiveMythrilBags(), scTolbiShipMastFindAnchorCharm(), scTolbiSpringRevealPrize(), scTolbiTalkToSnackVendor() and scWorldMapRunBlackOrbScript().

Definition at line 48 of file script_inline.h.

fdMapGridRedraw

static inline void fdMapGridRedraw(void)

Redraws the room around the point the camera follows, after a script has moved it.

References fdMapGridCenterOnFollowedPoint().

Referenced by scVenusLighthouseAerieCombineSaturosAndMenardi().

Definition at line 55 of file script_inline.h.

mnMessageShowCentered

static inline void mnMessageShowCentered(Sint32 msg, Sint32 flags)

Shows a message in the middle of the screen rather than in a speech window.

References mnFieldMessageShow() and Sint32.

Referenced by scWorldMapMeetFlint() and scWorldMapUseBlackOrb().

Definition at line 61 of file script_inline.h.

gmPartyGiveItem

static inline Sint32 gmPartyGiveItem(Sint32 item, Sint32 flags)

Gives the party an item from a script and says who got it; -1 when it was left behind.

References fdPartyInventoryGiveItem() and Sint32.

Referenced by scAltinPeakAwardFrostJewelAndDrain(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalaceOfferCloakBall(), scBilibinJillGivesHardNut(), scCottageRoomsAGiveFarewellHerb(), scCrossboneIsleKeysGetKey(), scFuchinFallsCaveFindDragonsEye(), scInit(), scKalayTolbiDocksTalkToWomanSellingTickets(), scLaliveroIodemGivesBlackOrb(), scLogRoomsAMayorGivesWaterOfLife(), scLogRoomsAOfferBones(), scLunpaFortressTakeCellKey(), scLunpaFortressTryTakeChestItem(), scMcCoyPalaceClaimReward(), scTolbiShipMastFindAnchorCharm(), scTolbiSpringRevealPrize(), scTolbiTalkToSnackVendor(), scValePlazaDepartForQuest() and scWorldMapRunBlackOrbScript().

Definition at line 68 of file script_inline.h.

fdPsynergyCancel

static inline void fdPsynergyCancel(void)

Ends a script's wave effect and restores the colours it changed.

References fdPsynergyStopMindReadWave().

Referenced by scBabiPalaceReadShebasMind().

Definition at line 74 of file script_inline.h.

mnVRAMLoad

static inline Sint32 mnVRAMLoad(Sint32 block, Sint32 size, const void *data)

Loads a scene's sprite picture into VRAM; returns its first tile number, 0 when there's no room.

References Sint32 and syVRAMCacheLoad().

Referenced by scColossoLoadLettering(), scInit(), scTitleLoadSprites(), scVenusLighthouseAerieCombineSaturosAndMenardi() and scWorldMapUseBlackOrb().

Definition at line 81 of file script_inline.h.

scFieldActorSetDestinationOffset

static inline void scFieldActorSetDestinationOffset(Sint32 actorId, Sint32 xOffset, Sint32 zOffset)

fdActorSetDestinationOffset, by a second inline over the same function.

References fdActorSetDestinationOffsetById() and Sint32.

Referenced by scBabiLighthouseHopClearOfPillar().

Definition at line 87 of file script_inline.h.

sySetOrUpdateTickEvent

static inline Sint32 sySetOrUpdateTickEvent(EVENT_FUNC callback, Sint32 priority)

sySetTickEvent (system_call.h) under a second name.

References Sint32 and sySetTickEvent().

Referenced by scCrossboneIsleKeysInitBane(), scCrossboneIsleKeysInitStatues(), scLogRoomsASpreadOutToCornerSuspects(), scValePlazaBoyLiftsSmallRock() and scValePrologueWatchBoulderFall().

Definition at line 94 of file script_inline.h.

fdSetMetatileBehaviorAt

static inline void fdSetMetatileBehaviorAt(Sint32 layer, Sint32 x, Sint32 y, Sint32 behavior)

Changes the metatile behavior of the metatile at (x, y), in whole pixels, opening or closing the way (fdMapGridSetMetatileBehaviorAt): fdSetMetatileBehaviorAt(0, 544, 288, METATILE_BEHAVIOR_CLIMB).

References fdMapGridSetMetatileBehaviorAt() and Sint32.

Referenced by scInit(), scSolSanctumStatueCenterStatueMoved(), scSolSanctumStatueLeftBeamStatueMoved(), scSolSanctumStatuePrepareMoveOnCenterStatue(), scSolSanctumStatuePrepareMoveOnLeftBeamStatue(), scSolSanctumStatuePrepareMoveOnRightBeamStatue(), scSolSanctumStatueRightBeamStatueMoved() and scTolbiGrowSprout().

Definition at line 103 of file script_inline.h.

fdSetWorldMapGridTile

static inline void fdSetWorldMapGridTile(Sint32 x, Sint32 y, Sint32 metatileX, Sint32 metatileY)

Changes one 512-pixel tile of the World Map, drawn at once when it's next to the view (fdWorldMapSetGridTile).

References fdWorldMapSetGridTile() and Sint32.

Referenced by scInit().

Definition at line 111 of file script_inline.h.

scFieldActorLaunchFromLeader

static inline void scFieldActorLaunchFromLeader(Sint32 actorId, Sint32 dx, Sint32 dz, Sint32 facing)

Puts an actor on the leader and sends it walking off by (dx, dz), then turns it to face facing (fdActorLaunchFromLeader).

References fdActorLaunchFromLeader() and Sint32.

Referenced by scAltmillerCaveMeetInvisibleBabi(), scAltmillerCaveRestoreBabiAndInviteParty(), scBabiLighthouseExplainTruthDoor(), scBabiLighthouseFaranAsksPartyToOpenDoor(), scBabiPalaceMeetBabiAfterColosso(), scBabiPalaceRestInPalaceBeds(), scKalayTolbiDocksGaretSeesTheKaragol(), scLaliveroIodemGivesBlackOrb(), scLaliveroWatchWoundedSoldiers(), scLemurianShipSetSail(), scTimberRoomsAIodemQuestionsWoundedSoldiers() and scTimberRoomsBCReportToFaran().

Definition at line 119 of file script_inline.h.

scFieldActorWatchAndStartScript

static inline void scFieldActorWatchAndStartScript(Sint32 object, Sint32 target, const Sint32 *actions)

Makes an actor follow another and starts a script on it (fdActorWatchAndStartScript).

References fdActorWatchAndStartScript() and Sint32.

Referenced by scAltinPeakRestoreFirstWaterBeastRoom(), scAltinPeakShowFirstBeastRoute(), scBilibinJillGivesHardNut(), scCottageRoomsAGaretComesHome(), scCottageRoomsAGiveFarewellHerb(), scImilMeetMiaAtOldCouplesHouse(), scInit(), scKolimaLowerBridge(), scMcCoyPalaceAudienceWithMcCoy(), scMcCoyPalaceGroundsRestoreStory(), scMcCoyPalaceGroundsTalkToEastGuard(), scMcCoyPalaceMcCoyRewardsParty(), scValeKradensCottageMeetSaturosAndMenardi(), scValeKradensCottageTalkToRockslideSurvivor(), scValePlazaDepartForQuest(), scValePlazaFightTravelers() and scValePlazaSentToAidElders().

Definition at line 129 of file script_inline.h.

scFieldVectorAddPolarOffsetFX

static inline void scFieldVectorAddPolarOffsetFX(FIXED radius, Sint32 heading, FIELD_POS *probe)

Moves a point radius, in 16.16 fixed point, along a heading on the ground plane (syVectorAddPolarOffset).

References Sint32 and syVectorAddPolarOffset().

Referenced by scAltinPeakAdvanceCart().

Definition at line 138 of file script_inline.h.