Skip to Content
The Alchemy Project

src/field/field_psynergy_actor_metatiles.c

Actors standing as blocks in the map: their metatiles tagged and the tags cleared, the actor at a position, and effect sprites filled and queued. More…

Included by field_psynergy.c.

Macros

NameDescription
#defineHEIGHT_STEPS (height) (FIXEDtoINT(height) >> 3)A 16.16 height in the 8-pixel steps a shape entry's height counts.
#defineBLOCK_HEIGHT_STEPS 4A block's height, 32 pixels, in those steps.
#defineOBJ_SIZE_SHIFT 30Where an attr01 word holds a sprite's size (attribute 1's top two bits) and shape (attribute 0's).
#defineOBJ_SHAPE_SHIFT 14

Functions

NameDescription
voidfdActorPlaceBlocks (Uint16 *actors)Makes each listed actor (ids, ended by ACTOR_LIST_END) a block in the map: its metatile's shape is tagged BLOCK_HEIGHT_STEPS above the ground, so the party can stand on it, its metatile is marked MAP_METATILE_JUMP, a gap to jump onto from another block (the old mark kept in the actor), and the overhead layer's metatile is a wall.
voidfdActorLiftTargetBlock (Uint16 *actors)Takes the block about to move out of the map: the field effect's target while one runs, else the actor ahead of the leader, if it is one of the listed actors.
voidfdActorPlaceMovedBlock (void)Puts the block fdActorLiftTargetBlock remembered back into the map at the metatile it has moved to, as fdActorPlaceBlocks places each.
ACTOR *fdLeaderFindActorAhead (void)Returns the actor one metatile, or failing that two metatiles, ahead of the leader at the leader's height, or NULL.
ACTOR *fdActorFindAtMetatile (Sint32 *pos, Sint32 checkY)Returns the first of the placed actors (not the treasure spots) on position's metatile, at its height too when checkY is set, or NULL.
voidfdEffectSpriteInit (EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes, Sint32 tile)Fills an effect sprite: OAM attributes 0 and 1 as given (no affine matrix, 256 colours), the tiles, unscaled and unrotated at depth 255, and the picture's size from its shape, pivoted at (pivotX, pivotY).
voidfdEffectSpriteDraw (EFFECT_SPR *sprite)Draws a field effect's sprite.
voidfdEffectSpriteDrawAtWorldPos (EFFECT_SPR *sprite, Sint32 *pos)Places sprite at the screen position of world position and draws it.

Variables

NameDescription
extern const Uint8OamShapeSizes [][2]The width and height of each OAM shape and size, in pixels, by the shape times 4 plus the size.

Description

Actors standing as blocks in the map: their metatiles tagged and the tags cleared, the actor at a position, and effect sprites filled and queued. Part of field_psynergy.c.

Macros in detail

HEIGHT_STEPS

#define HEIGHT_STEPS(height) (FIXEDtoINT(height) >> 3)

A 16.16 height in the 8-pixel steps a shape entry's height counts.

Referenced by fdActorLiftTargetBlock(), fdActorPlaceBlocks() and fdActorPlaceMovedBlock().

Definition at line 6 of file field_psynergy_actor_metatiles.c.

BLOCK_HEIGHT_STEPS

#define BLOCK_HEIGHT_STEPS 4

A block's height, 32 pixels, in those steps.

Referenced by fdActorLiftTargetBlock(), fdActorPlaceBlocks() and fdActorPlaceMovedBlock().

Definition at line 8 of file field_psynergy_actor_metatiles.c.

OBJ_SIZE_SHIFT

#define OBJ_SIZE_SHIFT 30

Where an attr01 word holds a sprite's size (attribute 1's top two bits) and shape (attribute 0's).

Referenced by fdEffectSpriteInit().

Definition at line 203 of file field_psynergy_actor_metatiles.c.

OBJ_SHAPE_SHIFT

#define OBJ_SHAPE_SHIFT 14

Referenced by fdEffectSpriteInit().

Definition at line 204 of file field_psynergy_actor_metatiles.c.

Functions in detail

fdActorPlaceBlocks

void fdActorPlaceBlocks(Uint16 *actors)

Makes each listed actor (ids, ended by ACTOR_LIST_END) a block in the map: its metatile's shape is tagged BLOCK_HEIGHT_STEPS above the ground, so the party can stand on it, its metatile is marked MAP_METATILE_JUMP, a gap to jump onto from another block (the old mark kept in the actor), and the overhead layer's metatile is a wall. A leader below the new ground is lifted onto it. Scenes call it as they start, for the blocks Move pushes.

References fdActorGetById(), fdActorGetMetatileIndex(), fdActorSetSpriteFlagsStub(), fdMapGridGetTerrainHeightStub(), fdMapGridGetTerrainKindStub(), fdMapShapeFindOrAdd(), MainRoutineStateWork, MapShapeGrid and Sint32.

Referenced by scDehkanPlateauInitPillars(), scDehkanPlateauInitTightropes(), scGarohInitEntrance(), scInit(), scKandoreanTempleStartChestbeaterRoom(), scKandoreanTempleStartLiftRoom(), scKandoreanTempleStartVentRoom(), scLemurianShipSetUpLedgeRoom(), scLemurianShipSetUpPillarRoom(), scLemurianShipSetUpPipeRoom(), scLemurianShipSetUpSixJellyRoom(), scMadraCatacombsSetUpVillage(), scShrineOfTheSeaGodInitBreath(), scShrineOfTheSeaGodInitCrossroads() and scShrineOfTheSeaGodInitSideRoom().

Definition at line 16 of file field_psynergy_actor_metatiles.c.

fdActorLiftTargetBlock

void fdActorLiftTargetBlock(Uint16 *actors)

Takes the block about to move out of the map: the field effect's target while one runs, else the actor ahead of the leader, if it is one of the listed actors. Its metatile goes back to the ground and its old mark, and the script state remembers it for fdActorPlaceMovedBlock.

References fdActorGetById(), fdActorGetMetatileIndex(), fdLeaderFindActorAhead(), fdMapGridGetTerrainHeightStub(), fdMapGridGetTerrainKindStub(), fdMapShapeFindOrAdd(), MapShapeGrid and Sint32.

Referenced by scAirsRockInsideStartPushingPillar(), scAirsRockLiftPillar(), scAnemosInnerSanctumStartMovingBlock(), scDehkanPlateauLiftPillarsStonePillar(), scDehkanPlateauLiftTightropesPillar(), scGarohLiftPillar(), scGarohLiftPushedPillar(), scIzumoRuinsStartMovingPillar(), scIzumoStartMovingStone(), scJupiterLighthouseLiftPushedBlock(), scKandoreanTempleStartMovingBlock(), scKandoreanTempleStartMovingPillar(), scKandoreanTempleStartMovingPot(), scLemurianShipLiftCrate(), scLemurianShipLiftLedgeCrate(), scLemurianShipLiftPillar(), scMadraCatacombsStartMovingPushedPillar(), scMagmaRockInsideStartPushingPillar(), scMagmaRockStartPushingPillar(), scSettlementsStartPushingFallsObject(), scSettlementsUnblockCrate(), scSettlementsUnblockFallsObjects(), scShrineOfTheSeaGodLiftBlock() and scTundariaTowerStartPillarMove().

Definition at line 67 of file field_psynergy_actor_metatiles.c.

fdActorPlaceMovedBlock

void fdActorPlaceMovedBlock(void)

Puts the block fdActorLiftTargetBlock remembered back into the map at the metatile it has moved to, as fdActorPlaceBlocks places each.

References fdActorGetMetatileIndex(), fdMapGridGetTerrainHeightStub(), fdMapGridGetTerrainKindStub(), fdMapShapeFindOrAdd() and Sint32.

Referenced by scAirsRockInsideFinishPushingPillar(), scAirsRockPlacePillar(), scAnemosInnerSanctumFinishMovingBlock(), scDehkanPlateauPlacePillarsStonePillar(), scDehkanPlateauPlaceTightropesPillar(), scGarohPlaceFirstPillar(), scGarohPlaceFourthPillar(), scGarohPlacePushedPillar(), scGarohPlaceSecondPillar(), scGarohPlaceThirdPillar(), scIzumoFinishMovingStone(), scIzumoRuinsFinishMovingPillar(), scJupiterLighthousePlacePushedBlock(), scKandoreanTempleFinishMovingBlock(), scKandoreanTempleFinishMovingPillar(), scKandoreanTempleFinishMovingPot(), scLemurianShipPushCrateOffLedge(), scLemurianShipSetDownCrate(), scLemurianShipSetDownPillar(), scMadraCatacombsFinishMovingPushedPillar(), scMagmaRockFinishPushingPillar(), scMagmaRockInsideFinishPushingPillar(), scSettlementsBlockCrate(), scSettlementsMoveCrate(), scSettlementsMovePillar(), scSettlementsPushIntoFalls(), scShrineOfTheSeaGodMovePillar(), scShrineOfTheSeaGodSetDownTorch(), scTundariaTowerSetDownPillar() and scTundariaTowerSlidePillar().

Definition at line 112 of file field_psynergy_actor_metatiles.c.

fdLeaderFindActorAhead

ACTOR *fdLeaderFindActorAhead(void)

Returns the actor one metatile, or failing that two metatiles, ahead of the leader at the leader's height, or NULL.

References fdActorFindAtMetatile(), fdActorGetById(), MainRoutineStateWork, Sint32 and syVectorAddPolarOffset().

Referenced by fdActorLiftTargetBlock() and scPillarLowerHeldMetatiles().

Definition at line 145 of file field_psynergy_actor_metatiles.c.

fdActorFindAtMetatile

ACTOR *fdActorFindAtMetatile(Sint32 *pos, Sint32 checkY)

Returns the first of the placed actors (not the treasure spots) on position's metatile, at its height too when checkY is set, or NULL.

References Sint32.

Referenced by fdLeaderCanPushObjectAhead(), fdLeaderFindActorAhead(), fdLeaderPushObjectAhead(), scActorStopAtPushTarget(), scCavernsFinishMovingAngaraBlock(), scCrumblingPillarStep(), scCrumblingPillarStepWithStandIn(), scLeaderCheckCrumblingStep(), scMagmaRockInsideStepOnTrap(), scMagmaRockStepOnCrumblingPillar(), scMagmaRockStepOnTrap(), scMarsLighthouseTowersPushStoneAlongLedge(), scTrialRoadStepOnTrap() and scYampiDesertCaveStopLeaderAtLog().

Definition at line 172 of file field_psynergy_actor_metatiles.c.

fdEffectSpriteInit

void fdEffectSpriteInit(EFFECT_SPR *sprite, Sint32 pivotX, Sint32 pivotY, Uint32 attributes, Sint32 tile)

Fills an effect sprite: OAM attributes 0 and 1 as given (no affine matrix, 256 colours), the tiles, unscaled and unrotated at depth 255, and the picture's size from its shape, pivoted at (pivotX, pivotY).

References OamShapeSizes and Sint32.

Referenced by dbPsynergyTest2StartRocks(), dbPsynergyTestStartRings(), fdActorAppearInSparks(), fdBattleEffectDrawCanvasSprite(), fdBattleEffectSpawnScaledArcObjects(), fdEffectSpriteInitWithFadeOverlay(), fdEffectSpriteInitWithFadeOverlayBlended(), fdParticleBurstStart(), fdPsynergyArrow(), fdPsynergyBlaze(), fdPsynergyBurst(), fdPsynergyCyclone(), fdPsynergyEndRing(), fdPsynergyGrindOnTarget(), fdPsynergyHover(), fdPsynergyLash(), fdPsynergyParch(), fdPsynergyPound(), fdPsynergyRing(), fdPsynergyScoop(), fdPsynergyStartSceneSprite(), fdPsynergyTremorOnTarget(), fdSandInitLeaderSprite(), fdSandSpawnGrain(), fdSummonTabletPlayRunes(), fdTeleportPlaySparks(), fdTeleportPlayWhirl(), scContigoStartSparkle(), scFieldEffectSpriteInit(), scJupiterLighthouseStartBeam(), scLemuriaPalaceLoadMaps(), scMagmaRockStartFallingRocks(), scMarsLighthouseAerieStartRisingRings(), scNorthernReachesShatterIceWall(), scTundariaTowerStartFallingRocks(), scVenusLighthouseEntranceBlastActorSkyward() and scVenusLighthouseEntranceStartDust().

Definition at line 209 of file field_psynergy_actor_metatiles.c.

fdEffectSpriteDraw

void fdEffectSpriteDraw(EFFECT_SPR *sprite)

Draws a field effect's sprite. An unscaled, unrotated sprite needs no affine matrix; any other takes one, and one scaled past 1 is drawn in a double-size box. The picture's pivot is turned and scaled with it, so the pivot stays on the sprite's position. A sprite wholly off screen is not queued; the rest join the OAM bucket of their depth.

References Sint32, syCos(), syOAMAddSpriteAtDepthClamped(), syOAMMatrixAllocateFromTransform() and sySin().

Referenced by dbPsynergyTestUpdateRings(), fdActorAppearInSparks(), fdBattleEffectDrawCanvasSprite(), fdBattleEffectUpdateArcEffect(), fdBlazeUpdateSpray(), fdEffectSpriteDrawAtWorldPos(), fdEffectSpriteDrawAtWorldXYZ(), fdGrowingParticleUpdate(), fdHoverGlowUpdate(), fdParticleBurstUpdate(), fdPsynergyDrawCanvasSprite(), fdPsynergyParch(), fdPsynergyPound(), fdPsynergyUpdateArrow(), fdPsynergyUpdateBurst(), fdPsynergyUpdatePound(), fdSandDrawLeaderSprite(), fdScoopDustUpdateGrain(), fdScoopUpdate(), fdSummonTabletUpdateRunes(), fdTeleportPlayWhirl(), scChampaCliffCavesDrawForgeFire(), scChampaCliffCavesStartFlash(), scContigoRaiseSparkle(), scEpiloguePlacePortraitFrame(), scLemuriaPalaceDrawMaps() and scMarsLighthouseAerieUpdateRisingRings().

Definition at line 244 of file field_psynergy_actor_metatiles.c.

fdEffectSpriteDrawAtWorldPos

void fdEffectSpriteDrawAtWorldPos(EFFECT_SPR *sprite, Sint32 *pos)

Places sprite at the screen position of world position and draws it.

References fdCameraWorldToScreen(), fdEffectSpriteDraw() and Sint32.

Referenced by dbPsynergyTest2UpdateRocks(), fdBlazeUpdateSpray(), fdPsynergyEndRing(), fdPsynergyGrindOnTarget(), fdPsynergyRing(), fdPsynergyUpdateBurst(), fdPsynergyUpdateLash(), fdPsynergyUpdateRing(), fdScoopUpdate(), fdSummonTabletUpdateRunes(), fdTeleportPlaySparks(), scJupiterLighthouseUpdateBeam(), scNorthernReachesShatterIceWall(), scParticleUpdateFalling(), scVenusLighthouseEntranceUpdateBlastColumn() and scVenusLighthouseEntranceUpdateDust().

Definition at line 341 of file field_psynergy_actor_metatiles.c.