V-Gears 0
Free Final Fantasy VII engine.
FieldCameraInstruction Class Reference

A camera instruction. More...

#include <FieldCameraInstruction.h>

Inheritance diagram for FieldCameraInstruction:
Collaboration diagram for FieldCameraInstruction:

Public Member Functions

virtual void ProcessInst (Function &func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen) override
 Processes the instruction. More...
 
- Public Member Functions inherited from KernelCallInstruction
virtual bool IsKernelCall () const
 Checks if the instruction is a call to a kernel function. More...
 
- Public Member Functions inherited from Instruction
virtual std::ostream & Print (std::ostream &output) const
 Print the instruction to a stream. More...
 
virtual bool IsJump () const
 Checks if the instruction is a jump of some sort. More...
 
virtual bool IsCondJump () const
 Checks if the instruction is a conditional jump. More...
 
virtual bool IsUncondJump () const
 Checks if the instruction is an unconditional jump. More...
 
virtual bool IsStackOp () const
 Checks if the instruction is a stack operation. More...
 
virtual bool IsFuncCall () const
 Checks if the instruction is a call to a script function. More...
 
virtual bool IsReturn () const
 Checks if the instruction is a return statement. More...
 
virtual bool IsKernelCall () const
 Checks if the instruction is a call to a kernel function. More...
 
virtual bool IsLoad () const
 Checks if the instruction is a load operation. More...
 
virtual bool IsStore () const
 Checks if the instruction is a store operation. More...
 
virtual uint32 GetDestAddress () const
 Returns the destination address of a jump instruction. More...
 
virtual void ProcessInst (Function &function, ValueStack &stack, Engine *engine, CodeGenerator *code_gen)=0
 Process an instruction for code generation. More...
 
uint32 GetOpcode () const
 Retrieves the instruction opcode. More...
 
void SetOpcode (uint32 opcode)
 Sets the instruction opcode. More...
 
uint32 GetAddress () const
 Retrieves the instruction address. More...
 
void SetAddress (uint32 address)
 Sets the instruction address. More...
 
std::string GetName () const
 Retrieves the instruction name (the opcode name). More...
 
void SetName (std::string name)
 
int16 GetStackChange () const
 Checks how much the instruction changes the stack pointer. More...
 
void SetStackChange (int16 stack_change)
 Defines how much the instruction changes the stack pointer. More...
 
std::vector< ValuePtrGetParams () const
 Retrieves the list of instruction parameters. More...
 
ValuePtr GetParam (uint32 index) const
 Retrieves a instruction parameter. More...
 
void SetParams (std::vector< ValuePtr > params)
 Sets the instructions parameters. More...
 
void AddParam (ValuePtr value)
 Adds a parameter to the instructions. More...
 
std::string GetCodeGenData () const
 Retrieves metadata for code generation. More...
 
void SetCodeGenData (std::string code_gen_data)
 Sets metadata for code generation. More...
 
bool LabelRequired () const
 Checks if the instruction requires a label. More...
 
void SetLabelRequired (bool required)
 Indicates if the instruction needs a label. More...
 

Private Member Functions

void ProcessNFADE (CodeGenerator *code_gen)
 
void ProcessSCR2D (CodeGenerator *code_gen)
 Prodesses a SCR2D opcode. More...
 
void ProcessSCRLC (CodeGenerator *code_gen)
 Processes a SCRLC opcode. More...
 
void ProcessSCRCC (CodeGenerator *code_gen)
 Processes a SCRCC opcode. More...
 
void ProcessSCR2DC (CodeGenerator *code_gen)
 Processes a SCR2DC opcode. More...
 
void ProcessSCR2DL (CodeGenerator *code_gen)
 Processes a SCR2DL opcode. More...
 
void ProcessVWOFT (CodeGenerator *code_gen)
 Processes a VWOFT opcode. More...
 
void ProcessFADE (CodeGenerator *code_gen)
 

Additional Inherited Members

- Static Public Attributes inherited from Instruction
static int INST_TYPE_BINARY_OP
 Binary operation (e.g. More...
 
static int INST_TYPE_BOOL_NEGATE
 Boolean negation. More...
 
static int INST_TYPE_CALL
 Regular function call. More...
 
static int INST_TYPE_COND_JUMP
 Conditional jump. More...
 
static int INST_TYPE_DUP
 Instruction duplicates the most recent stack entry. More...
 
static int INST_TYPE_JUMP
 Unconditional jump. More...
 
static int INST_TYPE_KERNEL_CALL
 Kernel functions. More...
 
static int INST_TYPE_LOAD
 Load value from memory. More...
 
static int INST_TYPE_RETURN
 Return from regular function call. More...
 
static int INST_TYPE_STACK
 Stack allocation or deallocation (altering stack pointer). More...
 
static int INST_TYPE_STORE
 Store value in memory. More...
 
static int INST_TYPE_UNARY_OP_PRE
 Unary operation (e.g. More...
 
static int INST_TYPE_UNARY_OP_POST
 Unary operation with operator placed after the operator. More...
 
- Protected Member Functions inherited from RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
- Protected Attributes inherited from Instruction
uint32 opcode_
 The instruction opcode. More...
 
uint32 address_
 The instruction address. More...
 
std::string name_
 The instruction name (opcode name). More...
 
int16 stack_change_
 How much this instruction changes the stack pointer by. More...
 
std::vector< ValuePtrparams_
 Array of parameters used for the instruction. More...
 
std::string code_gen_data_
 String containing metadata for code generation. More...
 
bool label_required_ = false
 Indicates if a label is required. More...
 

Detailed Description

A camera instruction.

Member Function Documentation

◆ ProcessFADE()

void FieldCameraInstruction::ProcessFADE ( CodeGenerator code_gen)
private

◆ ProcessInst()

void FieldCameraInstruction::ProcessInst ( Function func,
ValueStack stack,
Engine engine,
CodeGenerator code_gen 
)
overridevirtual

Processes the instruction.

Parameters
[in]funcFunction to process.
[out]stackFunction stack.
[in]engineEngine. Unused
[in,out]code_genCode generator to append lines.

Implements Instruction.

◆ ProcessNFADE()

void FieldCameraInstruction::ProcessNFADE ( CodeGenerator code_gen)
private

◆ ProcessSCR2D()

void FieldCameraInstruction::ProcessSCR2D ( CodeGenerator code_gen)
private

Prodesses a SCR2D opcode.

Opcode: 0x64 Short name: SCR2D Long name: Scroll 2D

Memory layout (4 bytes) |0x64|B1/B2|X|Y|

Arguments

  • const Bit[4] B1: Source bank 1, or zero if X is set as a constant value.
  • const Bit[4] B2: Source bank 2, or zero if Y is set as a constant value.
  • const Short X: X-coordinate to scroll to, or address to find X if B1 is non-zero.
  • const Short Y: Y-coordinate to scroll to, or address to find Y if B2 is non-zero.

Instantaneously scrolls the current view to the coordinates found in the arguments (or the values found at the addresses if memory banks and address are specified). The move to the new coordinates is instant; variants exist for linear and smooth scrolling.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessSCR2DC()

void FieldCameraInstruction::ProcessSCR2DC ( CodeGenerator code_gen)
private

Processes a SCR2DC opcode.

Opcode: 0x66 Short name: SCR2DC Long name: Scroll to Coordinates (Smooth)

Memory layout (6 bytes) |0x66|B1/B2|0/B3|X|Y|S|

Arguments

  • const Bit[4] B1: Source bank 1, or zero if X is set as a constant value.
  • const Bit[4] B2: Source bank 2, or zero if Y is set as a constant value.
  • const Bit[4] 0: Zero.
  • const Bit[4] B4: Source bank 3, or zero if S is set as a constant value.
  • const Short X: X-coordinate to scroll to.
  • const Short Y: Y-coordinate to scroll to.
  • const UShort S: Speed to scroll; higher values scroll more slowly.

Similar to SCR2D, except the scroll is not instantaneous and is performed smoothly, with a slower start and ending, with speed peaking in the center of the scroll. The overall speed can be set with S.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessSCR2DL()

void FieldCameraInstruction::ProcessSCR2DL ( CodeGenerator code_gen)
private

Processes a SCR2DL opcode.

Opcode: 0x68 Short name: SCR2DC Long name: Scroll to Coordinates (Linear)

Memory layout (6 bytes) |0x68|B1/B2|0/B3|X|Y|S|

Arguments

  • const Bit[4] B1: Source bank 1, or zero if X is set as a constant value.
  • const Bit[4] B2: Source bank 2, or zero if Y is set as a constant value.
  • const Bit[4] 0: Zero.
  • const Bit[4] B4: Source bank 3, or zero if S is set as a constant value.
  • const Short X: X-coordinate to scroll to.
  • const Short Y: Y-coordinate to scroll to.
  • const UShort S: Speed to scroll; higher values scroll more slowly.

Similar to SCR2D, except the scroll to the coordinates is linear; that is, the speed is constant throughout the duration of the screen scroll.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessSCRCC()

void FieldCameraInstruction::ProcessSCRCC ( CodeGenerator code_gen)
private

Processes a SCRCC opcode.

Opcode: 0x65 Short name: SCRCC Long name: Scroll To Playable Character

Memory layout (1 byte) |0x65|

Instantaneously scrolls the current view so that it is centered on the current playable character.

◆ ProcessSCRLC()

void FieldCameraInstruction::ProcessSCRLC ( CodeGenerator code_gen)
private

Processes a SCRLC opcode.

Opcode: 0x62 Short name: SCRLC Long name: Scroll To Playable Character Stop Movement

Memory layout (5 bytes) |0x63|B|S|U|T|

Arguments

  • const UByte B: PRESUME -> Bank for the scroll speed, or zero if it is specified as a literal value. Always zero in game data
  • const UShort S: Speed of the scroll, in frames, or the address to find the speed if B is non-zero.
  • const UByte U: Unknown -> Always zero in game data. Seems to affect the speed above.
  • const UByte T: Type of scroll.

Scrolls the current view so that the main playable character is in the center of the view. The script executes asynchronously and does not block whilst the camera movement is active but returns control to the next script operation. This is tweened over a period of S frames. If the main playable character also moves during this time period, the tween position is also updated to match the new playable character location. Once the camera has completed its movement, the camera NO LONGER follows the main playable character's movement. It stays in place.

Scroll Types: 2 - Linear. 3 - Smooth (QuadraticInAndOut).

◆ ProcessVWOFT()

void FieldCameraInstruction::ProcessVWOFT ( CodeGenerator code_gen)
private

Processes a VWOFT opcode.

Opcode: 0x6A Short name: VWOFT Long name: View Offset

Memory layout (5 bytes) |0x6A|B1/B2|Y|X|S|

Arguments

  • const Bit[4] B1: Bank to retrieve the destination Y offset amount from, or zero if it is given as a literal value.
  • const Bit[4]: Bank to retrieve the destination X offset amount from, or zero if it is given as a literal value.
  • const Short Y: Amount to offset the camera in the Y coordinate, or the address to retrieve it if B1 is non-zero.
  • const Short X: Amount to offset the camera in the X coordinate, or the address to retrieve it if B2 is non-zero.
  • const UShort S: Movement speed. Lower values move the camera faster.

Scrolls the current view by the values supplied in X and Y coordinates, instantly.

Parameters
[in,out]code_genCode generator to append lines.
Todo:
Y is the Y coordinate for sure, but I dont't know about X and S.

The documentation for this class was generated from the following files: