Skip to Content
The Alchemy Project

src/field/field_psynergy_summon_tablet.c

A summon tablet read: its pictures cycling, its pebbles and runes flying, and placing the flag blocks. More…

Included by field_psynergy.c.

Structures

NameDescription
structCHASEA point on the screen chasing its target, 16.16 pixels, as fdCameraWorldToScreen gives one: z down the screen.
structTABLET_PIECEOne rune or pebble and a tick count, negative before it starts.
structSUMMON_TABLET_STATEThe summon tablet's state (heap slot battleEffect): the decoded pictures, the pebbles and runes that fly between the tablet and the leader, and the circle the runes gather on.
structACTOR_FLAGA flag block: a puddle's actor and the flag that says it is frozen, in a list ended by ACTOR_LIST_END (fdFlagBlockPlaceAll).

Macros

NameDescription
#defineSIGN_BIT 0x80000000The sign bit of a 32-bit number: two numbers' signs differ where their exclusive or has it.
#defineTABLET_PEBBLE_COUNT 32The pebbles that fly off the tablet, a power of two: the next wraps by a mask.
#defineTABLET_PEBBLES_ON_IMPACT 25The pebbles thrown off at once by the last, heavy blow (SE_HEAVY_IMPACT).
#definePEBBLE_PICTURES 4A pebble's four pictures (RESOURCE_PEBBLES, 16 by 16 and shrinking), five ticks each; a picture of 256 colours is 8 tile numbers.
#definePEBBLE_PICTURE_TICKS 5
#definePEBBLE_PICTURE_TILES 8
#defineTABLET_RUNE_COUNT 48The tablet's runes, in three rows of 16.
#defineTABLET_RUNE_ROW 16
#defineTABLET_RUNE_PICTURES 16RESOURCE_RUNES' 16 grey runes, 8 by 8, and after them the same runes lit in blue and green; an 8 by 8 tile of 256 colours is two tile numbers.
#defineRUNE_LIT (TABLET_RUNE_PICTURES * 2)

Enumerations

NameDescription
enumRUNE_MOTION { RUNES_LINE_UP, RUNES_CIRCLE, RUNES_GATHER }What the runes do (SUMMON_TABLET_STATE.state).
enumTABLET_STAGE { TABLET_STRUCK, TABLET_RUNES_LIGHT, TABLET_LEADER_TURNS, TABL … }The stages of a summon tablet's reading.

Functions

NameDescription
voidfdSummonTabletCyclePictures (ACTOR *actor)The summon tablet's update while its runes fly: on the actor's timer, its sprite flashes white and outlined, then outlined, white again, and plain, redrawn each tick; the fourth step leaves the outline as it was.
voidfdMotionStepTowardTarget (CHASE *chase, FIXED speed)Moves toward the target by speed, stopping on it on overshoot.
voidfdSummonTabletUpdateRunes (void)Event of fdSummonTabletPlayRunes: moves and draws the runes and pebbles.
voidfdSummonTabletPlayRunes (Sint32 targetId)Plays a summon tablet's reading (a CONTAINER_STONE_TABLET treasure, "examined the stone tablet"): pebbles fly off the tablet as it is struck, and its runes light up and fly round the leader, with their sounds, before mnSummonShowLearnedMessage.
voidfdFlagBlockPlaceAll (ACTOR_FLAG *actors)Sets up a scene's flag blocks, the puddles Frost turns into pillars of ice (actor and flag pairs, ended by ACTOR_LIST_END): each stops being solid and blocks its metatile; one whose flag is set shows the ice pillar and has the flag cleared, the others the puddle.
voidfdMapGridMarkJumpIfOpen (FIXED x, FIXED z, Sint32 layer, FIXED base)Marks the metatile at (x, z) MAP_METATILE_JUMP, a gap the leader jumps across, where no ground lies above height base.

Variables

NameDescription
extern const Sint32SummonTabletSquashScript []Sets full size, then squashes and stretches for ever, as RepeatedSquashScript does (fdSummonTabletPlayRunes).
extern const Uint8MovementTypeSquashScript []MOVEMENT_TYPE_SQUASH: the actor bounces on the spot, squashing and stretching, for ever.

Description

A summon tablet read: its pictures cycling, its pebbles and runes flying, and placing the flag blocks. Part of field_psynergy.c.

Macros in detail

SIGN_BIT

#define SIGN_BIT 0x80000000

The sign bit of a 32-bit number: two numbers' signs differ where their exclusive or has it.

Referenced by fdMotionStepTowardTarget().

Definition at line 51 of file field_psynergy_summon_tablet.c.

TABLET_PEBBLE_COUNT

#define TABLET_PEBBLE_COUNT 32

The pebbles that fly off the tablet, a power of two: the next wraps by a mask.

Referenced by fdSummonTabletPlayRunes() and fdSummonTabletUpdateRunes().

Definition at line 93 of file field_psynergy_summon_tablet.c.

TABLET_PEBBLES_ON_IMPACT

#define TABLET_PEBBLES_ON_IMPACT 25

The pebbles thrown off at once by the last, heavy blow (SE_HEAVY_IMPACT).

Referenced by fdSummonTabletPlayRunes().

Definition at line 95 of file field_psynergy_summon_tablet.c.

PEBBLE_PICTURES

#define PEBBLE_PICTURES 4

A pebble's four pictures (RESOURCE_PEBBLES, 16 by 16 and shrinking), five ticks each; a picture of 256 colours is 8 tile numbers.

Referenced by fdSummonTabletUpdateRunes().

Definition at line 98 of file field_psynergy_summon_tablet.c.

PEBBLE_PICTURE_TICKS

#define PEBBLE_PICTURE_TICKS 5

Referenced by fdSummonTabletUpdateRunes().

Definition at line 99 of file field_psynergy_summon_tablet.c.

PEBBLE_PICTURE_TILES

#define PEBBLE_PICTURE_TILES 8

Referenced by fdSummonTabletUpdateRunes().

Definition at line 100 of file field_psynergy_summon_tablet.c.

TABLET_RUNE_COUNT

#define TABLET_RUNE_COUNT 48

The tablet's runes, in three rows of 16.

Referenced by fdSummonTabletPlayRunes() and fdSummonTabletUpdateRunes().

Definition at line 102 of file field_psynergy_summon_tablet.c.

TABLET_RUNE_ROW

#define TABLET_RUNE_ROW 16

Referenced by fdSummonTabletPlayRunes().

Definition at line 103 of file field_psynergy_summon_tablet.c.

TABLET_RUNE_PICTURES

#define TABLET_RUNE_PICTURES 16

RESOURCE_RUNES' 16 grey runes, 8 by 8, and after them the same runes lit in blue and green; an 8 by 8 tile of 256 colours is two tile numbers.

Referenced by fdSummonTabletPlayRunes().

Definition at line 106 of file field_psynergy_summon_tablet.c.

RUNE_LIT

#define RUNE_LIT (TABLET_RUNE_PICTURES * 2)

Referenced by fdSummonTabletPlayRunes().

Definition at line 107 of file field_psynergy_summon_tablet.c.

Enumerations in detail

RUNE_MOTION

enum RUNE_MOTION

What the runes do (SUMMON_TABLET_STATE.state).

EnumeratorValueDescription
RUNES_LINE_UP0each flies from the tablet to its place in the rows
RUNES_CIRCLE2each chases the one before round the circle
RUNES_GATHER3each flies to the leader and is drawn till it lands

Definition at line 110 of file field_psynergy_summon_tablet.c.

TABLET_STAGE

enum TABLET_STAGE

The stages of a summon tablet's reading.

EnumeratorValueDescription
TABLET_STRUCK0pebbles fly off it, then it vanishes
TABLET_RUNES_LIGHT1the runes, lined up, light up in a wave
TABLET_LEADER_TURNS2
TABLET_ARMS_RAISED3
TABLET_RUNES_CIRCLE4the runes stream round in a circle
TABLET_RUNES_TO_LEADER5the circle moves over the leader
TABLET_RUNES_CLOSE_IN6and shrinks to nothing on it
TABLET_LEADER_SQUASHED7

Definition at line 231 of file field_psynergy_summon_tablet.c.

Functions in detail

fdSummonTabletCyclePictures

void fdSummonTabletCyclePictures(ACTOR *actor)

The summon tablet's update while its runes fly: on the actor's timer, its sprite flashes white and outlined, then outlined, white again, and plain, redrawn each tick; the fourth step leaves the outline as it was.

Referenced by fdSummonTabletPlayRunes().

Definition at line 9 of file field_psynergy_summon_tablet.c.

fdMotionStepTowardTarget

void fdMotionStepTowardTarget(CHASE *chase, FIXED speed)

Moves toward the target by speed, stopping on it on overshoot.

References Sint32, syAtan(), syCos() and sySin().

Referenced by fdSummonTabletUpdateRunes().

Definition at line 54 of file field_psynergy_summon_tablet.c.

fdSummonTabletUpdateRunes

void fdSummonTabletUpdateRunes(void)

Event of fdSummonTabletPlayRunes: moves and draws the runes and pebbles.

References fdAdvanceWithGravity3D(), fdEffectSpriteDraw(), fdEffectSpriteDrawAtWorldPos(), fdMotionStepTowardTarget(), Sint32 and syVectorAddPolarOffset().

Referenced by fdSummonTabletPlayRunes().

Definition at line 142 of file field_psynergy_summon_tablet.c.

fdSummonTabletPlayRunes

void fdSummonTabletPlayRunes(Sint32 targetId)

Plays a summon tablet's reading (a CONTAINER_STONE_TABLET treasure, "examined the stone tablet"): pebbles fly off the tablet as it is struck, and its runes light up and fly round the leader, with their sounds, before mnSummonShowLearnedMessage.

References fdActorFaceDirectionById(), fdActorLookup(), fdActorSelectAnimationStub(), fdActorStartScriptStub(), fdCameraWorldToScreen(), fdEffectSpriteInit(), fdPartyGetLeaderActor(), fdPsynergyFadeFromCastColor(), fdScriptWait(), fdStartColorTransition(), fdSummonTabletCyclePictures(), fdSummonTabletUpdateRunes(), FieldPsynergyCastColors, MovementTypeSquashScript, Sint32, SummonTabletSquashScript, syCloseEvent(), syDecompressTaggedLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syRandom(), syResourceGetTableEntry(), sySetEvent(), sySoundPlayStub(), sySynch(), syVectorAddPolarOffset(), syVRAMCacheFindFreeEntry(), syVRAMCacheFreeEntry(), syVRAMCacheLoad() and TickCount.

Referenced by fdTalkToActor() and scLemuriaSpringGivePrize().

Definition at line 250 of file field_psynergy_summon_tablet.c.

fdFlagBlockPlaceAll

void fdFlagBlockPlaceAll(ACTOR_FLAG *actors)

Sets up a scene's flag blocks, the puddles Frost turns into pillars of ice (actor and flag pairs, ended by ACTOR_LIST_END): each stops being solid and blocks its metatile; one whose flag is set shows the ice pillar and has the flag cleared, the others the puddle. Then fdFlagBlockApplyFlags raises the frozen ones and sets their flags again, and the leader is lifted onto the ground if it now lies below it. A scene with such puddles calls it as it starts.

References fdActorGetById(), fdActorGetMetatileIndex(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdFlagBlockApplyFlags(), fdMapGridGetTerrainHeightStub(), MainRoutineStateWork, Sint32, syGameFlagClear() and syGameFlagGet().

Referenced by scInit(), scKibomboInitStatueGrounds(), scKibomboInitVillage(), scLemurianShipSetUpPillarRoom(), scLemurianShipSetUpPipeRoom(), scLemurianShipSetUpSixJellyRoom(), scLemurianShipSetUpTwoJellyRoom() and scMadraCatacombsSetUpVillage().

Definition at line 551 of file field_psynergy_summon_tablet.c.

fdMapGridMarkJumpIfOpen

void fdMapGridMarkJumpIfOpen(FIXED x, FIXED z, Sint32 layer, FIXED base)

Marks the metatile at (x, z) MAP_METATILE_JUMP, a gap the leader jumps across, where no ground lies above height base.

References fdMapGridGetMetatileAttributesAt(), fdMapGridGetTerrainHeightAboveStub(), fdMapGridSetMetatileAttributesAt() and Sint32.

Referenced by fdFlagBlockPlaceAllMarkingEdges().

Definition at line 589 of file field_psynergy_summon_tablet.c.