include/macros.h
Small statement macros both games use for positions, velocities and bounds.
Included by battle_internal.h, battle_tables.c, battle_effect_internal.h, actor_update_arm.c, field_engine_internal.h, field_internal.h, lucky_dice.c, lucky_wheels.c, script_commands_internal.h, game_internal.h, menu_internal.h, title_intro.c, altin_peak.c, altmiller_cave.c, colosseum_azart_match.c, colosseum_entrance.c, colosseum_navampa_match.c, colosseum_satrage_match.c, file_screen.c, imil.c, kalay.c, kolima_forest_floodgate.c, kolima_forest_tree.c, lamakan_desert.c, log_rooms_a.c, lunpa.c, mercury_lighthouse_aerie.c, kolima_curse_dust.c, ship_rooms.c, sol_sanctum_entrance.c, sol_sanctum_eruption.c, sol_sanctum_luna_sol_rooms.c, sol_sanctum_statue.c, title.c, tolbi_games.c, tolbi_ship_deck.c, tolbi_ship_mast.c, tree_rooms.c, tret_tree_branch.c, venus_lighthouse_aerie.c, xian.c, screens_internal.h, window_internal.h and actor_step.h.
Macros
| Name | Description | |
|---|---|---|
#define | SET_VECTOR (v, x, y, z) ((v)[0] = (x), (v)[1] = (y), (v)[2] = (z)) | Sets the x, y and z of a three-part vector: a position about to be projected, a per-tick step, a camera point or a scale. |
#define | SET_POSITION (p, newX, newY, newZ) | Sets the position or the velocity of a particle, a piece of debris or anything else with plain x, y and z in one statement (SET_ACTOR_POSITION sets an actor's). |
#define | SET_VELOCITY (p, vx, vy, vz) | |
#define | CLAMP (v, low, high) | Keeps v within low to high, the low bound tested first. |
#define | ABS (v) ((v) < 0 ? -(v) : (v)) | The magnitude of v. v is read twice. |
#define | ARRAY_COUNT (array) (sizeof(array) / sizeof((array)[0])) | The entries of an array whose size is declared, as pret's global.h has it. |
#define | ALIGNED (n) __attribute__((aligned(n))) | Data aligned as the ROM places it, where its own type would not. |
#define | BSS_DATA __attribute__((section(".bss"))) | A global kept in its object's .bss in the order written, where a plain one would be a common symbol the linker places in an order of its own. |
Description
Small statement macros both games use for positions, velocities and bounds.
Macros in detail
SET_VECTOR
#define SET_VECTOR(v, x, y, z) ((v)[0] = (x), (v)[1] = (y), (v)[2] = (z))
Sets the x, y and z of a three-part vector: a position about to be projected, a per-tick step, a camera point or a scale.
Referenced by btCameraSetDefaultView(), btCameraSetView(), btCameraSetViewAtDepth(), btEffectRunBind(), btEffectRunBreak(), btEffectRunCybele(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunFrost(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunMoteFountain(), btEffectRunOrbitingSkulls(), btEffectRunQuake(), btEffectRunSleep(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStatReduction(), btEffectRunSwirlingStars(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunThor(), btEffectRunUnusedOrbitingSpirals(), btEffectRunUnusedTriangleStrike(), btMotionProjectPos(), btRun(), fdActorUpdateAllOnField(), fdCameraResetViewDefaults(), fdEffectRunSparkEmitter(), fdEffectSpawnBurstParticleField(), fdLuckyDiceRun(), fdRenderPlaceProjectedSprite(), fdWorldMapBuildScanlineTable(), fdWorldMapInitPerspective(), fdWorldMapUpdateView(), mnTitlePaletteFadeBuildColors(), scAltinPeakStartSpittingFX(), scBabiLighthouseLandWithParticles(), scColosseumNavampaMatchRollLongLog(), scColossoSparkleAroundPrize(), scImilSwayAndSpark(), scInit(), scKolimaForestFloodgateRollLog(), scKolimaForestTreeUpdateOrbitSpark(), scLunpaKickUpLeaderDust(), scMercuryLighthouseSparkleBurst(), scSolSanctumStatueUnusedPutOutSeals(), scValeTrailSparkles() and 5 more.
Definition at line 8 of file macros.h.
SET_POSITION
#define SET_POSITION(p, newX, newY, newZ)
Sets the position or the velocity of a particle, a piece of debris or
anything else with plain x, y and z in one statement (SET_ACTOR_POSITION sets
an actor's).
Referenced by btEffectRunAnnihilation(), btEffectRunAstralBlast(), btEffectRunAttackSlash(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunCybele(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunDrain(), btEffectRunFire(), btEffectRunFlurry(), btEffectRunFrost(), btEffectRunFroth(), btEffectRunGaia(), btEffectRunGatheringLights(), btEffectRunGround(), btEffectRunHealingMotes(), btEffectRunLobbedShells(), btEffectRunMoteFountain(), btEffectRunProcne(), btEffectRunProjectileVolley(), btEffectRunRay(), btEffectRunShiningStar(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStreakVolley(), btEffectRunSwirlingStars(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunVolcano(), btObjectGetAnchor(), fdActorResetForLeader(), fdActorScriptWanderNearHome(), fdActorStepFrom(), fdActorUpdateAll(), fdActorWander(), fdClimbDown(), fdClimbUp(), fdEffectGetPosAboveActor(), fdPsynergyDouse(), fdPsynergyFrost(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget(), scAltinPeakAdvanceCart(), scAltinPeakTurnCartLeft(), scAltinPeakTurnCartRight() and scMercuryLighthouseAerieJumpToNextPlatform().
Definition at line 13 of file macros.h.
SET_VELOCITY
#define SET_VELOCITY(p, vx, vy, vz)
Referenced by btEffectRunAnnihilation(), btEffectRunAttackSlash(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunCybele(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunDragonCloud(), btEffectRunDrain(), btEffectRunEruption(), btEffectRunFire(), btEffectRunFlurry(), btEffectRunFroth(), btEffectRunGaia(), btEffectRunGatheringLights(), btEffectRunGround(), btEffectRunLobbedShells(), btEffectRunMoteFountain(), btEffectRunRushingStrike(), btEffectRunStarfieldFall(), btEffectRunStreakVolley(), btEffectRunSwirlingStars(), btEffectRunTargetStrike(), btParticleAdvanceWithGravity3D(), fdActorMoveByKeys(), fdActorSetHorizontalPosWithTerrain(), fdActorSetPosAndResetMotion(), fdActorSetPosWithTerrain(), fdActorUpdateAllOnField(), fdLuckyDiceRun(), fdPsynergyStartCast(), fdPsynergySteerPushedTarget(), fdTalkToActor(), scAltinPeakSpawnDebris(), scColosseumEntranceFinalsStart(), scShipRoomsResetActor(), scSolSanctumEruptionStepShards(), scSolSanctumEruptionThrowEruptionRing(), scSolSanctumStatueCenterStatueMoved(), scTolbiShipMastFlyBirdAway(), scTolbiShipMastStopBirdDrifting(), scValeJennaSaysKradenIsWaiting(), scValeVanishMoveHand() and scVenusLighthouseAerieStopActorMotion().
Definition at line 15 of file macros.h.
CLAMP
#define CLAMP(v, low, high)
Keeps v within low to high, the low bound tested first. A plain block, so
it cannot stand before an else.
Referenced by btActionRunBuild(), btEffectBuildWindowEdgeTable(), btEffectDrawClippedCanvasLine(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunEruption(), btEffectRunFire(), btEffectRunFroth(), btEffectRunGaia(), btEffectRunHealingMotes(), btEffectRunJudgment(), btEffectRunProcne(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunSwirlingStars(), btEffectUpdatePhasePalette(), btEnemyAdjustLevel(), fdEncounterCountStepsAndSelectFormation(), fdMapGridSetCameraCenter(), fdMapGridUpdateLayerScroll(), fdScriptShowMessageAtPos(), gmUnitCalculate(), gmUnitLevelUp(), mnColorScaleComponents(), mnDjinnMenuShowMemberStatus(), mnMessageType() and mnWindowColorApply().
Definition at line 20 of file macros.h.
ABS
#define ABS(v) ((v) < 0 ? -(v) : (v))
The magnitude of v. v is read twice.
Referenced by btEffectDrawClippedCanvasLine(), btEffectRunProjectileVolley(), fdLuckyWheelsDrawCanvasLine(), fdWorldMapSetGridTile() and scAltinPeakRideCart().
Definition at line 29 of file macros.h.
ARRAY_COUNT
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
The entries of an array whose size is declared, as pret's global.h has it.
Referenced by btEffectCountDownBattlerTints(), btEffectRunBladeRain(), btEffectRunBurstShower(), btEffectRunDjinniEntrance(), btEffectRunDouse(), btEffectRunDragonFire(), btEffectRunElementBurst(), btEffectRunFrost(), btEffectRunKirin(), btEffectRunNereid(), btEffectRunOrbitingSkulls(), btEffectRunProcne(), btEffectRunRamses(), btEffectRunStarfieldFall(), btEffectRunTargetBursts(), btEffectRunTargetStrike(), btFormationSelectLevelMatchedCandidate(), fdActorResetForLeader(), fdEncounterSelectMapZones(), fdFindActorPlacement(), fdPaletteCycleAdd(), fdPaletteCycleInit(), fdScriptSpawnActorPlacements(), fdTilesetAnimationUpdate(), gmSummonDefinitionGetNear(), gmSummonListLearned(), mnCreatePartyFigures(), mnMessageCloseFinishedWindows(), mnPortraitClearSlots(), mnSettingsMenuRun(), mnStatusScreenCreateStatusIcons(), mnStatusScreenMovePartyMember(), mnWindowCloseAll() and scAltmillerCaveReleaseWallBurst().
Definition at line 32 of file macros.h.
ALIGNED
#define ALIGNED(n) __attribute__((aligned(n)))
Data aligned as the ROM places it, where its own type would not.
Definition at line 35 of file macros.h.
BSS_DATA
#define BSS_DATA __attribute__((section(".bss")))
A global kept in its object's .bss in the order written, where a plain one would be a common symbol the linker places in an order of its own.
Definition at line 39 of file macros.h.