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

A window instruction. More...

#include <FieldWindowInstruction.h>

Inheritance diagram for FieldWindowInstruction:
Collaboration diagram for FieldWindowInstruction:

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 ProcessSTTIM (CodeGenerator *code_gen)
 Processes a STTIM opcode. More...
 
void ProcessMESSAGE (CodeGenerator *code_gen, const std::string &script_name)
 
void ProcessASK (CodeGenerator *code_gen, const std::string &script_name)
 Processes an ASK opcode. More...
 
void ProcessMPNAM (CodeGenerator *code_gen, const std::string &script_name)
 
void ProcessMENU (CodeGenerator *code_gen)
 Processes a MENU opcode. More...
 
void ProcessMENU2 (CodeGenerator *code_gen)
 
void ProcessWINDOW (CodeGenerator *code_gen)
 
void ProcessWCLSE (CodeGenerator *code_gen)
 
void ProcessWSIZW (CodeGenerator *code_gen)
 Processes a WSIZW opcode. More...
 
void ProcessWSPCL (CodeGenerator *code_gen)
 Processes a WSPCL opcode. More...
 
void ProcessWMODE (CodeGenerator *code_gen)
 Processes a WMODE opcode. More...
 

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 window instruction.

Member Function Documentation

◆ ProcessASK()

void FieldWindowInstruction::ProcessASK ( CodeGenerator code_gen,
const std::string &  script_name 
)
private

Processes an ASK opcode.

Opcode: 0x48 Short name: ASK Long name: Ask Question

Memory layout (7 bytes) |0x48|Bank|Win|Mess|First|Last|Addr|

Arguments

const UByte Bank: Bank to put line number selected. const UByte Win: Window ID to place the question in. (Initialized with WINDOW) const UByte Mess: Which dialog to display from dialog table. const UByte First: Line from dialog where the first question is. const UByte Last: Line from dialog where the last question is. const UByte Addr: Address in bank where line selected is written.

The ASK command opens a window with a set of choices to be picked with the "selector finger". If ASK is called on an open window ID, the window will shrink closed and re-open with the new data.

◆ ProcessInst()

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

Processes the instruction.

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

Implements Instruction.

◆ ProcessMENU()

void FieldWindowInstruction::ProcessMENU ( CodeGenerator code_gen)
private

Processes a MENU opcode.

Opcode: 0x49 Short name: MENU Long name: Menu

Memory layout (4 bytes) |0x49|B|T|E|

Arguments

  • const UByte B: Bank for parameter, or zero if P is specified as a literal value.
  • const UByte T: Type of menu, or special event.
  • const UByte P: Parameter to the menu, or address of parameter value, if B is non-zero.

MENU has two uses. Its primary function is to display a menu or other special screen. These menus range from the character name entry screen, to a shop, and even the staff credit display. The other function is to provide a set of special events that would normally be accomplished through a set of opcodes, but are instead coded directly into a MENU call. Some types of menu are erroneous or produce erratic behaviour, and were most likely used for testing. As such, they are not listed here.

Standard Menu Types

ID Menu Type 5 FF7 Credits 6 Character Name Entry 7 Party Select 8 Shop 9 Main Menu E Save Screen

Special Event Types ID Event Type F Yuffie's Materia Steal (Remove All Materia) 12 Remove Cloud's Materia 13 Restore Cloud's Materia

Parameters

Character Name Entry: Parameter indicates the name of the character to edit, and follows the standard Character IDs, as well as 0x64 to indicate the Chocobo naming screen.

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

◆ ProcessMENU2()

void FieldWindowInstruction::ProcessMENU2 ( CodeGenerator code_gen)
private

◆ ProcessMESSAGE()

void FieldWindowInstruction::ProcessMESSAGE ( CodeGenerator code_gen,
const std::string &  script_name 
)
private

◆ ProcessMPNAM()

void FieldWindowInstruction::ProcessMPNAM ( CodeGenerator code_gen,
const std::string &  script_name 
)
private

◆ ProcessSTTIM()

void FieldWindowInstruction::ProcessSTTIM ( CodeGenerator code_gen)
private

Processes a STTIM opcode.

Opcode: 0x38 Short name: STTIM Long name: Set Timer

Memory layout (6 bytes) |0x38|B1/B2|0/B3|H|M|S|

Arguments

  • const Bit[4] B1: Bank to find hours value, or zero if hours (B1) is passed as a value.
  • const Bit[4] B2: Bank to find minutes value, or zero if minutes (B2) is passed as a value.
  • const Bit[4] 0: Zero.
  • const Bit[4] B3: Bank to find seconds value, or zero if seconds (B3) is passed as a value.
  • const UByte H: Hours, or address to find hours value, if B1 is non-zero.
  • const UByte M: Minutes, or address to find minutes value, if B2 is non-zero.
  • const UByte S: Seconds, or address to find seconds value, if B3 is non-zero.

Sets the clock, as found in the WSPCL opcode. If the hours, minutes or seconds are specified in the argument, the corresponding B nybble is zero. Otherwise, the value for the time component is retrieved from the bank and address specified. The separate time components can be retrieved from memory or specified as a value, in the same argument list. Hours are not directly visible on the clock, as it only displays minutes and seconds. Hours are translated into minutes.

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

◆ ProcessWCLSE()

void FieldWindowInstruction::ProcessWCLSE ( CodeGenerator code_gen)
private

◆ ProcessWINDOW()

void FieldWindowInstruction::ProcessWINDOW ( CodeGenerator code_gen)
private

◆ ProcessWMODE()

void FieldWindowInstruction::ProcessWMODE ( CodeGenerator code_gen)
private

Processes a WMODE opcode.

Opcode: 0x52 Short name: WMODE Long name: Window Mode

Memory layout (4 bytes) |0x52|N|M|C|

Arguments

  • const UByte N: The ID of the window whose mode will be set.
  • const UByte M: Mode of the window.
  • const UByte C: Window permanency.

Changes properties associated with the WINDOW whose ID is specified. The mode byte sets the style of the window, as detailed below. If the final byte is set to 1, the window cannot be closed by the player pushing [OK]. The mode of the window should be changed before it is displayed with MESSAGE or ASK, or the changes will not be visible unless the window is closed and reopened.

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

◆ ProcessWSIZW()

void FieldWindowInstruction::ProcessWSIZW ( CodeGenerator code_gen)
private

Processes a WSIZW opcode.

Opcode: 0x2F Short name: WSIZW Long name: Window Resize

Memory layout (6 bytes). |0x2F|I|X|Y|W|H|

Arguments:

  • const UByte I: WINDOW ID to resize.
  • const UShort X: X-coordinate of the window.
  • const UShort Y: Y-coordinate of the window.
  • const UShort W: Width of the window.
  • const UShort H: Height of the window.

Resizes and/or repositions the window, after it has been created with the WINDOW opcode. On the next MESSAGE or ASK, the window will be positioned and sized with the new properties.

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

◆ ProcessWSPCL()

void FieldWindowInstruction::ProcessWSPCL ( CodeGenerator code_gen)
private

Processes a WSPCL opcode.

Opcode: 0x36 Short name: WSPCL Long name: Window Special (Numerical Display)

Memory layout (5 bytes.) |0x36|W|T|X|Y|

Arguments

  • const UByte W: WINDOW ID to apply the change to.
  • const UByte T: Type of display.
  • const UByte X: X-coordinate of the numerical display, relative to the top-left of the window.
  • const UByte Y: Y-coordinate of the numerical display, relative to the top-left of the window.

Creates a numerical display inside the given window. The display can be either in the form of a clock, or a scoreboard with six digits. This only creates the numerical display; to actually show it, a MESSAGE or ASK command needs to be issued. Using a blank line of dialog will allow you to create a numerical display in the top-left of the window without field dialog hidden behind it. Alternatively, dialog can be shown along with the display by placing the display in an appropriate area of the window. To set the time for the clock variant, STTIM is used. To set the number for the numerical display, WNUMB is used.

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

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