Alchemy

lib

games/tbs/include/lib on GitHub

call.h

games/tbs/include/lib/call.h

Functions

Value2

static __inline__ s32 Value2(s32 (*f)(), s32 a0, s32 a1)

Calls f with two integer arguments and returns its result. LuckyDice_Run decodes its board and sprite pictures through it.

Used by LuckyDice_Run.

Line 11

fixed_math.h

games/tbs/include/lib/fixed_math.h

Macros

Q16_ONE

#define Q16_ONE (1 << 16)

One in the engine's signed 16.16 fixed-point format.

Used by AltmillerCave_Initialize, AltmillerCave_ReleaseWallBurst, AltmillerCave_SpinLights, AltmillerCave_TurnRock, ColosseumEntrance_ShowClearedTrial, ColosseumEntrance_ShowFailedTrial, ColossoLogRollingStage_AdvanceParticleMotion, ColossoLogRollingStage_SpawnPeriodicParticle, ColossoLog_Initialize, ColossoLog_PlayPostBattleReunion, CrossboneIslePillarRooms_ShrinkPillar, CrossboneIslePillarRooms_SpawnFrostParticle, CrossboneIslePillarRooms_SpawnThawParticle, CrossboneIslePillarRooms_SpawnUnusedLeaderParticle, CrossboneIsle_RestoreIvy, Effect_AnimateVerticalNegative, Effect_AnimateVerticalPositive, Encounter_SelectSceneZones, Event_AudienceWithMcCoy, Event_BagMercuryStar, Event_BagVenusStar, Event_CenterStatueMoved, Event_DoraWakesIsaac, Event_FreezeOnScales, Event_FrostRaisesPillar, Event_GaretJoinsIsaac, Event_KradenPlansSanctumVisit, Event_MeetFlint, Event_MeetSaturosAndMenardi, Event_OverhearKraden, Event_PushStumpOver, Event_ReactToAnotherTremor, Event_ReturnFromMtAleph, Event_RiseToElementalStarRoom, Event_Rock11Falls, Event_Rock12Falls, Event_Rock13Falls, Event_Rock14Falls, Event_ShowMythrilBag, Event_SinkPillarA and 139 more.

Line 10

Declarations, without a comment: Trig_Sin, Trig_Cos, __modsi3.

lib.h

games/tbs/include/lib/lib.h

Macros, without a comment: LIB_H.

lzpack.h

games/tbs/include/lib/lzpack.h

Structures

LzPackNode

struct LzPackNode

A position of the LZ packer's window in the chain of the byte value it holds.

FieldDeclared as
nextstruct LzPackNode *nextNext node with the same value.
prevstruct LzPackNode *prevPrevious node, or the bucket field at the head.
slots32 slot

Used by LzPack_FindWindowMatch, LzPack_InsertSlotNode, LzPack_ResetSlotBuckets.

Line 16

LzPackWork

struct LzPackWork

The LZ packer's work: a node per window position, a chain head per byte value, the byte at each position, the best match and the output.

FieldDeclared as
nodesstruct LzPackNode nodes[0x400]
bucketstruct LzPackNode *bucket[0x100]
flagMasks32 flagMask
bucketBySlots32 bucketBySlot[0x400]
outCnts32 outCnt
outBufu8 outBuf[0x24]
matchOffsets32 matchOffset
matchLens32 matchLen
poss32 pos
inputCursoru32 inputCursor
outTotals32 outTotal
inputLimitu32 inputLimit

Used by LzPack_ConsumeSlotBytes, LzPack_CopyBufferedBytes, LzPack_InsertSlotNode, LzPack_PackStream, gFlash_Handler3.

Line 24

macros.h

games/tbs/include/lib/macros.h

Macros

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-frame step, a camera point or a scale.

Used by BabiLighthouse_LandWithParticles, BattleEffect_SpawnBurstParticleField, BattleFx_RunBreak, BattleFx_RunCybele, BattleFx_RunDeathPlunge, BattleFx_RunDjinnBeams, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunFrost, BattleFx_RunHaunt, BattleFx_RunHealingMotes, BattleFx_RunMoteFountain, BattleFx_RunOrbitingSkulls, BattleFx_RunOrbitingSpirals, BattleFx_RunParticleStreams, BattleFx_RunQuake, BattleFx_RunSleep, BattleFx_RunSparkEmitter, BattleFx_RunStatBoost, BattleFx_RunStatReduction, BattleFx_RunSwirlingStars, BattleFx_RunTargetBursts, BattleFx_RunTargetMotes, BattleFx_RunThor, BattleMotion_ProjectPosition, Battle_RunEncounter, Camera_InitDefaultTransform, Camera_ResetSceneDefaults, ColossoLogRollingStage_SpawnRandomSceneEffect, ColossoRiver_SpawnRandomEffect, ColossoWall_SpawnRandomSceneEffect, Event_JumpToNextPillar, Event_RollLongLog, Event_WatchThePuppies, Imil_SwayAndSpark, KolimaForestBend_RollLog, KolimaForestTree_UpdateOrbitSpark, LuckyDice_Run, Lunpa_KickUpLeaderDust, Motion_SetTargetPositionFromMagnitudeAngle and 6 more.

Line 12

SET_POSITION

#define SET_POSITION(p, px, py, pz)

Sets the position or the velocity of a particle, a piece of debris or an object in one statement.

Used by BattleEffect_RunFallbackObjectTransition, BattleFx_GetPositionAboveActor, BattleFx_RunAnnihilation, BattleFx_RunAstralBlast, BattleFx_RunBeamSequence, BattleFx_RunBurstScene, BattleFx_RunCastingImpact, BattleFx_RunCybele, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunDrain, BattleFx_RunFire, BattleFx_RunFrost, BattleFx_RunFroth, BattleFx_RunGaia, BattleFx_RunGatheringLights, BattleFx_RunGround, BattleFx_RunHealingMotes, BattleFx_RunLobbedShells, BattleFx_RunMoteFountain, BattleFx_RunParticleStreams, BattleFx_RunProcne, BattleFx_RunProjectileVolley, BattleFx_RunRay, BattleFx_RunRingAndSparkScene, BattleFx_RunShiningStar, BattleFx_RunSparkEmitter, BattleFx_RunStatBoost, BattleFx_RunStreakVolley, BattleFx_RunSwirlingStars, BattleFx_RunTargetBursts, BattleFx_RunTargetMotes, BattleFx_RunTargetStrike, BattleFx_RunVolcano, BattleFx_SteerLiftedTarget, BattleFx_SteerPushedTarget, Battle_GetWorkEntryPair, Camera_FollowActor, Camera_FollowLeaderInBounds, Camera_FollowObject and 20 more.

Line 16

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.

Used by BattleCommand_BuildPlan, BattleEnemy_AdjustLevel, BattleFx_BuildWindowEdgeTable, BattleFx_DrawClippedCanvasLine, BattleFx_RunCastingImpact, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunEruption, BattleFx_RunFire, BattleFx_RunFroth, BattleFx_RunGaia, BattleFx_RunHealingMotes, BattleFx_RunParticleStreams, BattleFx_RunRingAndSparkScene, BattleFx_RunStatBoost, BattleFx_RunSwirlingStars, Color_ScaleComponents, DjinnMenu_ShowOwnerStatus, Encounter_SelectEnemyGroup, Event_ShowMessageAtPosition, Graphics_UpdatePhasePalette, Map_SetCameraCenter, Map_UpdateLayerScroll, PaletteGlow_Update, UiWork_StepChannelScript.

Line 23

ABS

#define ABS(v) ((v) < 0 ? -(v) : (v))

The magnitude of v. v is read twice.

Used by BattleFx_DrawClippedCanvasLine, BattleFx_RunProjectileVolley, ReelGame_DrawCanvasLine.

Line 32

Also, macros without a comment: SET_VELOCITY.

static_assert.h

games/tbs/include/lib/static_assert.h

Macros

STATIC_ASSERT

#define STATIC_ASSERT(condition)

C89 permits repeated extern declarations of the same array. A false condition gives it an invalid size; a true one emits no code or storage.

Used by offsetof.

Line 15

Also, macros without a comment: STATIC_ASSERT.

stddef.h

games/tbs/include/lib/stddef.h

Types, without a comment: wchar_t.

Macros, without a comment: NULL, offsetof, offsetof.

string.h

games/tbs/include/lib/string.h

On this page