Skip to Content
The Alchemy Project

src/field/field_psynergy_tremor.c

Tremor: the view swayed from side to side. More…

Included by field_psynergy.c.

Structures

NameDescription
structTREMOR_STATETremor's state (heap slot HEAP_SLOT_BATTLE_EFFECT): the view's sway, the picture of the shaken actor and its falling pieces.

Macros

NameDescription
#defineSHAKE_SPRITE_COUNT 64The sprites of RESOURCE_SHAKE_TILES' two tiles the state sets up.
#defineSHAKE_SPRITE_PALETTE 14The OBJ palette the shake sprites take.
#definePICTURE_SIZE 4096
#definePICTURE_MAX_PIXELS 2048
#defineSHAKE_STEP (TRIG_TURN * 3 / 32)How far round the nearby objects' shaking goes each tick: 3/32 of a turn.
#defineSTRONG_SHAKE_PIXELS_PER_TURN 128The objects shake as far as a whole turn for every STRONG_SHAKE_PIXELS_PER_TURN pixels the view sways past SWAY_SHAKE.
#defineSTRONG_SWAY_PEAK toFIXED(12)The stronger sway at an object (16.16 pixels): from SWAY_START up to STRONG_SWAY_PEAK, ramping more slowly and holding longer.
#defineSTRONG_SWAY_RAMP (toFIXED(1) / 10)0.1 pixels a tick.
#defineSWAY_SHAKE toFIXED(4)Sprites shake only past this.
#defineSTRONG_SWAY_HOLD_TICKS 40
#defineSWAY_SHAKE_TICKS 50The sway's hold while nearby objects shake with it, in place of SWAY_HOLD_TICKS.
#defineSHAKE_PIXELS_PER_TURN 384The objects shake as far as a whole turn for every SHAKE_PIXELS_PER_TURN pixels the view sways.

Enumerations

NameDescription
enumanonymous enum { SWAY_GROW, SWAY_HOLD, SWAY_SHRINK, SWAY_SETTLE, SWAY_DONE }The stages of a sway of the view (Tremor's and Grind's): it grows, holds, shrinks and settles, and SWAY_DONE ends it.

Functions

NameDescription
voidfdSpriteSetAnimationSpeedStub (void *sprite, Sint32 value)Sets the step of each of a sprite's layers: 0 stops its animation, ANIM_STEP_NORMAL runs it at normal speed.
voidfdPsynergyTremorOnTarget (void)Tremor ("Shake objects left and right.") on the chosen object: sways the view from side to side, as fdPsynergyTremor does with no object: the swing grows from SWAY_START to STRONG_SWAY_PEAK, holds STRONG_SWAY_HOLD_TICKS, shrinks back and stops.
voidfdPsynergyTremor (void)Sways the view from side to side, with a sound every 16 ticks: the swing grows from SWAY_START to SWAY_PEAK, holds, shrinks back and stops.
voidfdBattleEffectShiftRowsDown (Uint8 *base, Sint32 stride, Sint32 rows)Moves rows 1 to rows - 2 of a buffer down one row by DMA, dropping the last, then clears row 0 (stride bytes per row).

Description

Tremor: the view swayed from side to side. Part of field_psynergy.c.

Macros in detail

SHAKE_SPRITE_COUNT

#define SHAKE_SPRITE_COUNT 64

The sprites of RESOURCE_SHAKE_TILES' two tiles the state sets up.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 7 of file field_psynergy_tremor.c.

SHAKE_SPRITE_PALETTE

#define SHAKE_SPRITE_PALETTE 14

The OBJ palette the shake sprites take.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 9 of file field_psynergy_tremor.c.

PICTURE_SIZE

#define PICTURE_SIZE 4096

Definition at line 10 of file field_psynergy_tremor.c.

PICTURE_MAX_PIXELS

#define PICTURE_MAX_PIXELS 2048

Referenced by fdPsynergyTremorOnTarget().

Definition at line 11 of file field_psynergy_tremor.c.

SHAKE_STEP

#define SHAKE_STEP (TRIG_TURN * 3 / 32)

How far round the nearby objects' shaking goes each tick: 3/32 of a turn.

Referenced by fdPsynergyTremor() and fdPsynergyTremorOnTarget().

Definition at line 14 of file field_psynergy_tremor.c.

STRONG_SHAKE_PIXELS_PER_TURN

#define STRONG_SHAKE_PIXELS_PER_TURN 128

The objects shake as far as a whole turn for every STRONG_SHAKE_PIXELS_PER_TURN pixels the view sways past SWAY_SHAKE.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 17 of file field_psynergy_tremor.c.

STRONG_SWAY_PEAK

#define STRONG_SWAY_PEAK toFIXED(12)

The stronger sway at an object (16.16 pixels): from SWAY_START up to STRONG_SWAY_PEAK, ramping more slowly and holding longer.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 21 of file field_psynergy_tremor.c.

STRONG_SWAY_RAMP

#define STRONG_SWAY_RAMP (toFIXED(1) / 10)

0.1 pixels a tick.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 23 of file field_psynergy_tremor.c.

SWAY_SHAKE

#define SWAY_SHAKE toFIXED(4)

Sprites shake only past this.

Referenced by fdPsynergyTremorOnTarget().

Definition at line 25 of file field_psynergy_tremor.c.

STRONG_SWAY_HOLD_TICKS

#define STRONG_SWAY_HOLD_TICKS 40

Referenced by fdPsynergyTremorOnTarget().

Definition at line 26 of file field_psynergy_tremor.c.

SWAY_SHAKE_TICKS

#define SWAY_SHAKE_TICKS 50

The sway's hold while nearby objects shake with it, in place of SWAY_HOLD_TICKS.

Referenced by fdPsynergyTremor().

Definition at line 215 of file field_psynergy_tremor.c.

SHAKE_PIXELS_PER_TURN

#define SHAKE_PIXELS_PER_TURN 384

The objects shake as far as a whole turn for every SHAKE_PIXELS_PER_TURN pixels the view sways.

Referenced by fdPsynergyTremor().

Definition at line 218 of file field_psynergy_tremor.c.

Enumerations in detail

anonymous enum

enum { SWAY_GROW, SWAY_HOLD, SWAY_SHRINK, SWAY_SETTLE, … }

The stages of a sway of the view (Tremor's and Grind's): it grows, holds, shrinks and settles, and SWAY_DONE ends it.

EnumeratorValueDescription
SWAY_GROW
SWAY_HOLD
SWAY_SHRINK
SWAY_SETTLE
SWAY_DONE999

Definition at line 30 of file field_psynergy_tremor.c.

Functions in detail

fdSpriteSetAnimationSpeedStub

void fdSpriteSetAnimationSpeedStub(void *sprite, Sint32 value)

Sets the step of each of a sprite's layers: 0 stops its animation, ANIM_STEP_NORMAL runs it at normal speed.

Referenced by fdPsynergyGrindOnTarget(), fdPsynergyTremorOnTarget() and mnSanctumRunMemberIconBurst().

Definition at line 51 of file field_psynergy_tremor.c.

fdPsynergyTremorOnTarget

void fdPsynergyTremorOnTarget(void)

Tremor ("Shake objects left and right.") on the chosen object: sways the view from side to side, as fdPsynergyTremor does with no object: the swing grows from SWAY_START to STRONG_SWAY_PEAK, holds STRONG_SWAY_HOLD_TICKS, shrinks back and stops. Past SWAY_SHAKE the nearby objects' sprites shake with it. The state also takes the object's picture and SHAKE_SPRITE_COUNT sprites, which nothing here draws. An object whose picture is larger than PICTURE_MAX_PIXELS gets no sway.

References fdBattleEffectSetObjectUpdateMode(), fdEffectSpriteInit(), fdPsynergyDecodePicture(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdSpriteSetAnimationSpeedStub(), fdViewMoveEnd(), fdViewMoveRestoreNearbySprites(), fdViewMoveSaveNearbySprites(), fdViewMoveStart(), fdViewMoveSwing(), Sint32, syDecompressTaggedLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), sySin(), sySoundPlayStub(), sySynch(), syVRAMCacheFindFreeEntry(), syVRAMCacheFreeEntry() and syVRAMCacheLoad().

Referenced by fdPsynergyDispatch().

Definition at line 60 of file field_psynergy_tremor.c.

fdPsynergyTremor

void fdPsynergyTremor(void)

Sways the view from side to side, with a sound every 16 ticks: the swing grows from SWAY_START to SWAY_PEAK, holds, shrinks back and stops. On a town or dungeon map the nearby objects' sprites shake with it; when there are any, the hold lasts SWAY_SHAKE_TICKS instead of SWAY_HOLD_TICKS. Then the view bounds and the sprites come back.

References fdBattleEffectSetObjectUpdateMode(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdViewMoveEnd(), fdViewMoveRestoreNearbySprites(), fdViewMoveSaveNearbySprites(), fdViewMoveStart(), fdViewMoveSwing(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), sySin(), sySoundPlayStub() and sySynch().

Referenced by fdPsynergyRun().

Definition at line 225 of file field_psynergy_tremor.c.

fdBattleEffectShiftRowsDown

void fdBattleEffectShiftRowsDown(Uint8 *base, Sint32 stride, Sint32 rows)

Moves rows 1 to rows - 2 of a buffer down one row by DMA, dropping the last, then clears row 0 (stride bytes per row).

References Sint32 and syDMAXCopy().

Referenced by fdPsynergyGrindOnTarget().

Definition at line 326 of file field_psynergy_tremor.c.