Final Fantasy I & II: Dawn of Souls:FF1 Animation Scripting

From Data Crystal
Jump to: navigation, search

Spell and attack animations in Final Fantasy I use a shared scripting language to define how animations play out. Here follows a list of known script commands; there are many more yet to be discovered and understood.


0x00: End animation
 0x4 bytes long
0x01: Execute previous commands
 0x8 Bytes long
 And do some bookkeeping too?
 Repeat until all previous commands are finished?
 Don't load subsequent commands until that time either
0x02: Conditional Test
 If the conditional fails, skip to the next 0x4 or 0x3 command
 0xC bytes long
 $00: Which $1F130 test to run
 $04: Test parameter (if applicable)
0x03: Failed conditional marker 1
 0x04 bytes
 -When this is encountered after a 0x02 fail, execute all of the following chunks until
 an 0x4 is reached
0x04: Failed conditional marker 2
 0x04 bytes
 -used as an end marker for failed 0x02 conditionals
 -Set the command after this one as the place to begin reading from
 -Used by Kill to skip part of its animation if it fails to inflict Death
0x05:
 -Used to handle spells like Blind that play an effect on individual targets before proceeding with 'main' effect
 -Loops for all 9 monsters or all 4 PCs, depending on who the target is
 -For each target, 
 $04: Mode byte; indexes to a routine jump table
  $1F130
  Run for each target to determine if that target will have the effect played	
  0x00: Return 0x1
  0x01: Return 0x1 for all living targets
  0x02: If caster is a monster, return 0x0; if a PC, return 0x1
  0x03: If target(s) is/are monster(s), return 0x0; if targets are PC, return 0x1
  0x04: Return 0x1 only on targets who are effected by the spell? (for Kill, etc?)
  0x05: (same as 0x01)
  0x06: Depending on Encounter ID, returns a variable:
 $08: Some number that becomes the Param1 of a 0x7 Chunk - delay between each iteration
 $0C: Number of subsequent chunks to load
(these next chunks are applied to every valid target)
After loading those chunks, a 0x7 Chunk is created, and the delay set to $08's value
0x06, Jump to different script offsets based on conditional
 0x18 bytes
 -If the conditional returns 0x1, choose Branch A; if 0x0, choose Branch B
 $04: Delay
 $08: Conditional ID:
   $00: Return 0x1
   $01: Return 0x1 if unit of parameter's ID may be targeted; else return 0x0
   $02: If caster is a PC, return 0x1; if a monster, return 0x0
   $03: If target(s) is/are PCs, return 0x1; if monster(s), return 0x0
   $04: If target (or any among targets) received a status effect from this attack return 0x1; else 0x0
   $05: Same as $01
   $06: Checks encounter ID for special type; if equal to Parameter return 0x1; else 0x0
 $0C: Conditional Parameter
 $10: Branch A offset
 $14: Branch B offset
0x07, Perform some animation-related bookkeeping for a targeted animation
 0x8 bytes
 $04: Delay in frames
0x08, Play Sound:
 0xC Bytes
 $04: Sound delay, in frames(?), from when this command is first read
 $08: Sound Effect ID
0x0A, Animate standing tile
 0x1C Bytes
 $04: Spawn Delay
 $08: TSA/animation pointer? Affects how the tile GFX are loaded and animated
 $0C: More TSA/animation stuff?
 $10: Origin point type of GFX:
   0x00: Top-left corner of screen
   0x01: Center of screen
   0x02: Mid-left of screen
   0x03: Just above caster?
   0x04: Caster
   0x05: First enemy/target?
   0x06: Target?
   0x07: Caster?
   0x08: Top-left corner of screen?
 $14: Y-displacement (positive is down), hw
 $16: X-displacement (positive is right), hw
 $18: Same deal as $14 in Chunk 0x17...a zoom factor??
0x0B, (used for Kill)
 0x10 bytes
 $04: Pointer to compressed tile data
 $08: Some parameter...an identifier?
0x0D, Animate tile from target?
 0x20 bytes
 $04: Spawn delay
 $08: TSA/animation pointer
 $0C: Origin point type
 $10: Y-displacement from origin
 $12: X-displacement from origin
 $14: ??
 $18: ??
 $1C: ?? (zero?)
0x0F, Animated moving object (straight line)
 0x24 bytes
 $04: Delay
 $08: Tile data pointer?
 $0C: Origin type
 $10: Y starting pos
 $12: X starting pos
 $14: Some layering/zoom param:
   0x10000000: Flip horizontally
 $18: Y-speed; positive values are down, negative are up
 $1A: X-speed; positive values are to the right, negative to the left
 $1C: Index to tile data?
 $20: Time, in frames, this object will last; affects speed as well
0x10, Non-animated moving object (straight line)
 0x24 bytes
 $04: Delay
 $08: Tile data pointer?
 $0C: Some stuff to do with the origin...
 $10: Y origin
 $12: X origin
 $14: Y displacement (total)
 $16: X displacement (total)
 $18: Some sort of layering/zoom param?
  If 0x10000000, flip horizontally?
 $1C: Some sort of index to sprites within a spritesheet
 $20: Time; number of frames movement will take; lower values = faster, shorter
0x13, Animate tile 
 0x28 bytes
 $04: Delay (frames)
 $08: TSA/animation pointer
 $0C: Origin
 $10: Y-offset (hw)
 $12: X-offset
 $14: Some zoom factor? Same as $14 in Chunk 0x17
 $18: ??
 $1C: ??
 $20: ??
 $24: If non-0x1, tile stops animating...
 $26: If 0x1, tile is drawn beneath PC sprites
0x14, Draw object spiraling in
 0x30 (!!) bytes long
 $04: Delay
 $08: Tile data pointer
 $0C: Origin type to base destination coords off of
 $10: Destination Y-coord
 $12: Destination X-coord
 $14: Spiral Y magnitude
 $16: Spiral X magnitude
 $18: ???
 $1C: Direction/distance A and starting position on spiral
 $20: Direction/distance B
   -If A > B, go counterclockwise a distance of A - B
   -If A < B, go clockwise a distance of B - A
   -A's value also determines starting position along the spiral
 $24: More zoom params; same 0x10000000 bit to flip horizontally
 $28: Animation mode and flags?
   0x400000: Flicker
 $2C: Total time
0x17, Animate moving tile:
 $04: Spawn delay, in frames, from the start of the animation
 $08: Some ROM pointer that affects how the GFX tiles are loaded
 $0C: Origin point of moving tile, to be modified by coordinates
 $10: Displacement from the origin for the GFX tile to emerge from
  $10-11: Y-coord
  $12-13: X-coord (both are signed)
 $14: Something...displacement after spawning?
 $18:
 $19-1A:
 $1B: Layer to draw on? (in front of/behind sprites)
 $1C: Path? Only values below 0x1F are accepted; indexes to a jump table of routines
   0x00: Move in a circle?
   0x02: Spiral outwards?
   0x05: Wobble downwards (fast)
   0x06: Wobble down-right (slow)
   0x12: Sway up+down then change
   0x16: Move to left edge of screen...or mid-left at least?
   0x18: Move to right edge of screen
 $20: Parameter relating to the $1C param
0x1C, Load fixed tile?
 0x10  bytes long
 $04: Anim/Tile data pointer
 $08: Palette pointer
 $0C: ?
0x1E, Something for the end of anims
 0x08 bytes long
 $04: Delay
0x1D, load BG overlay?
 0x18 bytes long
 $04: Delay
 $08: Tile data pointer
 $0C: Y-offset in tile data
 $0E: X-offset in tile data
 $10: ?
 $14: ?
0x1F, set anim data for fixed tile?
 0x0C bytes long
 $04: Delay
 $08: Layering?
  0x1 Draw translucently over sprites
  0x2 Draw under sprites
  0x3 Draw, and remove PC sprites!
0x21: Something to do with palettes...loads palette for cycling, sets the params
 0x18 bytes long
 $04: Delay
 $08: Palette pointer
 $0C: Number of frames to play before looping
 $10: Palette cycling speed
 $14: Total time to pause before moving on
0x23: Something about activating an animation...
 0x10 bytes long
 $04: Delay
 $08: Tile data pointer..?
0x24: Restore normal brightness
 0x0C bytes long
 $04: Delay
 $08: Light speed
0x26: Tint spell GFX
 0x18 bytes long
 $04: Delay
 $08: ?
 $0C: ?           0xC and 0xC makes a faded tint...
0x27: Darken screen
 0x18 bytes long
 $04: Delay (before beginning)
 $08: Colour (only red?)
 $0C: Intensity
 $10: Flags:
   0x00: Fade BG
   0x01: Fade PCs
   0x02: Fade Monsters
   0x04: Fade spell animation
   0x05: Fade everything?
 $14: Fade speed (frames) - don't move to next command until finished darkening
0x30: Create screen distortion effect (w/ extra BG layer?)

0x18 bytes long $04: Delay $08: If nonzero, don't animate $0C: Distortion frequency $10: Distortion intensity $14: What to distort?

     0x00: BG only
     0x01: BG and monsters
     0x02: ?
     0x03: ?
0x31: (BG distortion-related)
 0x0C bytes long
 $04: Delay
 $08: Some modifier for BG overlay distortion pattern?
    very high values = less distortion
0x38: (BG effect-related)
 0x0C bytes long
 $04: Delay
 $08: Y-coord?
 $0A: X-coord?