Author Topic: Jumping in FFVII.  (Read 2121 times)

Akari

  • *
  • Posts: 766
    • View Profile
Jumping in FFVII.
« on: 2007-11-29 13:19:40 »
Finished reversing of JUMP routine in FFVII.

Opcode define X, Y and triangle_id of final point. And number of steps for jump.
Opcode set model state to 0x3 (JUMP) and stage to 0x0 (init).
Script is wait until stage reach 2, then continue execution.

Main update function go through all entity with JUMP state and if stage is 0 it calculates final Z point according to triangle id. It sets current coords as start coords. The main thing this function does is set B coefficient for later calculation.
It defines as follows:

B = (Z_final - Z_start) / steps + steps * 1.45;

Then it set current step to 0 and stage to 1. On next update other part of function works. It's calculate real position.
First it increment current step number. Then it calculate X and Y. They change linear so nothing interesting here. Then here we go... Z calculation:

Z_current = - step^2 * 1.45 + step * B + Z_start;

If current substep equal number of steps then we set current triangle to final triangle and set stage to 2. Which finilize routine on next opcode call.
« Last Edit: 2007-12-14 14:40:47 by Akari »