recursal/Fanatic-Fandom huggingface dataset:
FF7/Field/Script/Opcodes/14 IFUB

* Opcode: **0x14**
* Short name: **IFUB**
* Long name: If (Unsigned Byte)

* **const UByte** *V*: Unsigned value to compare the retrieved value to, or address from the second bank of the value to retrieve.
* **const UByte** *C*: Type of comparison to perform.
* **const UByte** *E*: Amount to jump if the comparison does not hold.

#### Description

Performs a comparison between a retrieved values from memory at specific banks and addresses. If **B2** is zero, then the value retrieved from bank **B1**, address **A** is compared with the value specified by **V**. If **B2** is not zero, then the value retrieved from bank **B1**, address **A** is compared with the value retrieved from bank **B2**, address **V**.

The type of comparison used is shown in the table below. If the comparison fails, the script pointer jumps forward by the amount specified in the final argument; the starting offset for this jump is just before the jump value argument itself. This, combined with an appropriate jump forward, is used to implement if/else functionality in scripts, as demonstrated below.

If the content of the 'if' block following the IFUB line is longer than 0xFF, the jump argument will also need to be longer than 0xFF, and hence the IFUBL variant is used instead. If the value to compare is larger than 0xFF, the IFUW/IFUWL variants are used. If the value being compared is negative, the IFSW/IFSWL variants are used.

#### If/Else Example

In this example, if the value found is greater than 0x30, the script halts for a shorter period of time; otherwise, the script halts for a long period of time. Note how the jump forward placed before the longer WAIT (start of the required 'else' block) ensures that on completion of the 'if' block, execution of the 'else' block is avoided. It jumps forward to just before the 0x200 WAIT, which it then executes, and returns.

The 'else' block only executes if it is jumped into by the final argument of the IFUB argument list (thus avoiding the execution of the 'if' block). Once the 'else' block is executed, script execution just continues and the 0x200 WAIT and RET is executed. Since this is also executed by the 'if' block having jumped forward to skip the else block, this demonstrates that the two code paths converge. In C++ (below) this is the equivalent of the if/else block being completed.

```
IFUB (10,20,30,02,06)
WAIT (00,01)
JMPF (04)
WAIT (00,04)
WAIT (00,02)
RET ()

```

<cpp>

```
if(<10>[20] > 30)
{
 WAIT(100);
}
else
{
 WAIT(400);
}

```

```
WAIT(200);
return;

```

</cpp>
FF7/Field/Script/Opcodes/42 MPRA2

* Opcode: **0x42**
* Short name: **MPRA2**
* Long name: Message Parameter (16-bit)

#### Arguments

* **const UByte** *B*: Bank to retrieve value from, or zero if using a literal value.
* **const UByte** *W*: WINDOW ID for this parameter.
* **const UByte** *I*: ID of the "Variable" dialog code that this value will replace.
* **const UShort** *V*: Value to insert into dialog, or address of value, if *B* is non-zero.

#### Description

Similar to MPARA, but allows a constant value of greater than one byte to be supplied. This does not apply if *B* is non-zero, as the address the value is retrieved from must be in the range 0 to 0xFF.
FF7/Field/Script/Opcodes/39 GOLDu

* Opcode: **0x39**
* Short name: **GOLDu**
* Long name: Gil Up

* **const UByte** *0*: Zero.
* **const ULong** *A*: Amount to increase.

Increase by an amount found in memory:

* **const Bit[4]** *B*: Source bank.
* **const UByte** *A*: Source address.
* **const UByte[3]** *0*: Three zero bytes.

#### Description

Increases the amount of gil by a constant amount, or by an amount found in the source bank *B* and address *A*.

The total gil is capped above by 0xFFFFFFFF; attempts to increment further will fail.
FF8/Field/Script/Opcodes

By Aali, myst6re and Shard.

## The language

The field script language in ff8 is a simple assembly language with a stack. Here is an example:

```
stack = []

```

```
PSHM_W       1024      # push var1024 onto the stack (stack = [var1024])
PSHN_L       6         # push number 6 onto the stack (stack = [6Â ; var1024])
CAL          EQ        # compare the two numbers at the top of the stack, pop this numbers, and push the result (1 or 0) into the stack (stack = [1 or 0])
JPF          LABEL1    # if the popped top of the stack is 0, jump to LABEL1 (stack = [])
PSHN_L       0         # push 0 at the top of the stack (stack = [0])
POPM_W       1024      # pop the top of the stack into var1024 (stack = [])
JMP          LABEL2    # goto LABEL2
LABEL1
PSHN_L       1         # push 1 at the top of the stack (stack = [1])
POPM_W       1024      # pop the top of the stack into var1024 (stack = [])
LABEL2
...

```

In standard code, it's equivalent to:

```
if(var1024 == 6) {
    var1024 = 0;
} else {
    var1024 = 1;
}

```

## Reading Documentation

Each Opcode's page lists all the parameters for that function in the order you would put them on the stack before the function call. The inline argument is listed separately, if the function requires one. For example, on the page for SET3, the parameters are listed like this:

*XCoord*
*YCoord*
*ZCoord*
**SET3**
Which means when you call **SET3**, the ZCoord is the top item on the stack, YCoord is under it, and XCoord is under that, for example

```
PSHN_L      402   (XCoord)
PSHN_L      -381  (YCoord)
PSHN_L      20    (ZCoord)
SET3        17    (walkmesh triangle ID)

```
FF7/Field/Script/Opcodes/63 SCRLA

* Opcode: **0x63**
* Short name: **SCRLA**
* Long name: Scroll To Entity

#### Arguments

* **const UByte** *B*: Bank for the scroll speed, or zero if it is specified as a literal value.
* **const UShort** *S*: Speed of the scroll, in frames, or the address to find the speed if *B* is non-zero.
* **const UByte** *E*: Entity ID to scroll to.
* **const UByte** *T*: Type of scroll.

#### Description

Scrolls the current view so that the field object associated with entity *E* is in the center of the view. The scroll occurs at speed *S*, and with a particular style, *T*. If an entity is given that does not have a field object, the view centers on the walkmesh origin. If the object is moving as the scroll occurs, the scroll will follow the object until it is centered. Also of note is that the scroll will not leave the boundaries of the background (as defined by the range values in section 8), unlike the standard "scroll to coordinate" opcodes.

#### Scroll Types

 1
 2
 3
FF8/FileFormat TDW

By myst6re.

## font

For the field, this is a file for the japanese PSX version only, it adds text characters. In the PC version, the file *sysfnt.tdw* in main.fs is used to know the width of each character, the texture part is not used (you can find the used texture in sysfnt.tex in menu.fs).

 4
 offsetWidths
 offsetData

### Character widths

Each width is 4 bits (two widths per byte).

### Texture

Texture is a TIM file with 8 colors: dark grey, grey, yellow, red, green, blue, purple and white.

*TODO: Explain the palette mechanism in japanese version (16 pal instead of 8).*
FF7/Field/Script/Opcodes/32 IFKEYOFF

* Opcode: **0x32**
* Short name: **IFKEYOFF**
* Long name: If Key Lifted

#### Description

Similar to IFKEYON. Rather than check if this is the first time the user has pressed the button with the given ID, **IFKEYOFF** will not execute the body of the "if" statement until the user has lifted the key that was previously held down or pressed. This way, the body of the statement will only be executed once, when the key is no longer pressed.
FF7/Field/Script/Opcodes/95 INC

* Opcode: **0x95**
* Short name: **INC**
* Long name: Increment (8-bit)

#### Description

Increments the 8-bit value found at bank **B**, address **A**. If the value is 0xFF, it will roll over to 0x00. If you specify a 16-bit bank, only the lower byte will be incremented, and if the lower byte is 0xFF, the higher byte will be unaffected whilst the lower byte will return to 0x00.
FF7/Field/Script/Opcodes/48 ASK

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

* **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.

#### Description

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.
FF7/Field/Script/Opcodes/03 REQEW

* Opcode: **0x03**
* Short name: **REQEW**
* Long name: Request remote execution (synchronous, guaranteed)

* **const Bit[3]** *P*: The priority at which we want to execute the remote script (high 3 bits of byte).
* **const Bit[5]** *F*: The ID of the specific member function of *E* to be executed (low 5 bits of byte).

#### Description

Requests that a remote entity executes one of its member functions at a specified priority. The request will block until remote execution has finished before returning.
FF7/Field/Triggers

## range

```
typedef struct {
  S16 left;
  S16 bottom; // maybe top, I dont know/care Its nearly always centred
  S16 right;
  S16 top;    // maybe bottom.
} Range;

```

## Vertex

```
typedef struct {
  S16 x;
  S16 z;
  S16 y;
} Vertex;

```

## Gateways data

For each gateway:

 6
 12
 18
 20

For each trigger:

 6
 12
 13
 14
 15

0 - OnTrigger - ON
 1 - OnTrigger - OFF
 2 - OnTrigger - ON, AwayFromTrigger - OFF
 3 - OnTrigger - OFF, AwayFromTrigger - ON
 4 - OnTrigger - ON, AwayFromTriggerOnPlusSide - OFF
 5 - OnTrigger - OFF, AwayFromTriggerOnPlusSide - ON

## Shown arrows

For each gateway you can show an arrow. If shown arrow = 1, a red arrow is displayed in the middle of the corresponding gateway line.

## Arrows

This an arrow list to position an arrow where you want.

 4
 8
 12
FF7/PSX/Sound/Overview

## Overview

PSX FF7 sound system is tightly connected with PSX SPU implementation. There are 2 main types of sounds in FF7: streaming sound (background noise in video sequences) and tracker sound. Square Enix programmers didn't use any standard PSX formats such as SEQ, VAB & VAG, they wrote their own custom tracker. Streaming sound is standard PSX XA-ADPCM format, all sound streaming data is in Mode 2 sectors on FF7 CDROM game discs.
FF7/Field/Script/Opcodes/58 STITM

* Opcode: **0x58**
* Short name: **STITM**
* Long name: Set Item

#### Arguments

* **const Bit[4]** *B1*: Source bank 1, or zero if *T* is set as a constant value.
* **const Bit[4]** *B2*: Source bank 2, or zero if *A* is set as a constant value.
* **const UShort** *T*: Type of item to add, or source address to retrieve item type from.
* **const UByte** *A*: Amount of item to add, or source address to retrieve item quantity from.

#### Description

Adds a new item to the inventory. Either the item is added explicitly with values, in which case *B1* and *B2* are zero, or the item type and quantity are retrieved from memory. In this case, bank *B1* and address *T* retrieve the item type, whilst bank *B2* and address *A* retrieve the quantity to add.

#### Example

The following example adds 10 (0xA) Elixirs (ID 0x5) using temporary bank 5 and address 1C for item type, and a value for item quantity.

```
SETBYTE(50,1C,5)
STITM(50,1C,0,A)

```
FF7/Field/Script/Opcodes/B5 TURN

* Opcode: **0xB5**
* Short name: **TURN**
* Long name: Generate Turn

#### Arguments

* **const Bit[4]** *B2*: Bank to retrieve Final rotation, or zero if specifying *Final rotation* as a literal value.
* **const Bute** *Final rotation*: Rotation value to which model will be rotated.
* **const Short** *ignored*: Although this is set in script it is compleatly ignored by opcode.
* **const Short** *Steps in rotation*: Set number of steps in rotation.
* **const UShort** *Type of steps calculation*: Specify how to calculate rotation step by step. (1 - linear/ 2 - smooth.).

#### Description

This is deprecated opcode, only 4 field in game use it.
This opcode do turn the same way as TURNGEN, but go to specify direction without modification. So if current direction is 0 (top) and target direction is 255 (top left) it will rotate all way clockwise and you can't do anything about 0 direction.
This opcode will be called until turn is over and then continue script execution.
FF7/Field/Script/Opcodes/21 TUTOR

* Opcode: **0x21**
* Short name: **TUTOR**
* Long name: Play Tutorial

#### Description

Opens the main menu and plays the tutorial specified. The tutorial with the given ID must exist in the field file (PlayStation) or inside the flevel.lgp archive (PC), or the menu will not be closable.

On the PlayStation version, the tutorials reside after the dialog and AKAO blocks of Section 1. On the PC version, the same tutorials can be found in this location, but are not used and redundant since the dialogs are PlayStation-specific, such as "You'll need a Memory Card to save your games". Instead, the PC-specific tutorials are used, which are located in the flevel.lgp archive and end with the extension **.tut**.
FF7/Field/Script/Opcodes/E1 BGOFF

* Opcode: **0xE1**
* Short name: **BGOFF**
* Long name: Background Off

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve *A*, or zero if *A* is specified as a literal.
* **const Bit[4]** *B2*: Bank to retrieve *L*, or zero if *L* is specified as a literal.
* **const UByte** *A*: The ID of the background area to manipulate, as specified in the background's sprite.
* **const UByte** *L*: The ID of the layer of *L* to hide (turn off), as specified in the background's sprite.

#### Description

Similar to BGON, only this opcode turns *off* the portion of background whose background sprite specifies it as belonging to the scripted area and layer specified.
FF7/Field/Script/Opcodes/10 JMPF

* Opcode: **0x10**
* Short name: **JMPF**
* Long name: Jump forward

#### Description

Jumps forward in the current script a specified amount. The jump begins just after the jump opcode itself and then skips the specified number of bytes. In the following example, the WAIT line is skipped.

```
JMPF (04)
WAIT (70,00)
SOLID (01)

```

If a jump longer than 0xFF is required, use JMPFL instead.
FF7/Field/Script/Opcodes/C3 OFST

* Opcode: **0xC3**
* Short name: **OFST**
* Long name: Offset Object

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve X offset, or zero if *X* is specified as a literal.
* **const Bit[4]** *B2*: Bank to retrieve Y offset, or zero if *Y* is specified as a literal.
* **const Bit[4]** *B3*: Bank to retrieve Z offset, or zero if *Z* is specified as a literal.
* **const Bit[4]** *B4*: Bank to retrieve speed, or zero if *S* is specified as a literal.
* **const UByte** *T*: Type of movement.
* **const Short** *X*: X offset amount, relative to current position, or address to find X offset, if *B1* is non-zero.
* **const Short** *Y*: Y offset amount, relative to current position, or address to find Y offset, if *B2* is non-zero.
* **const Short** *Z*: Z offset amount, relative to current position, or address to find Z offset, if *B3* is non-zero.
* **const UShort** *S*: Speed of the offset movement, if type is non-zero, or address to find speed, if *B4* is non-zero.

#### Description

Offsets the field object, belonging to the entity whose script this opcode resides in, by a certain amount. After being offset, the character continues to be constrained in movement as defined by the walkmesh's shape, but at a certain distance away from the normal walkmesh position. Other field objects are unaffected, and their position or movements are maintained on the walkmesh's original position.

If B1, B2, B3 or B4 is non-zero, then the value for that particular component is taken from memory using the corresponding bank and address specified, rather than as a literal value. Both retrieved values and literals can be used for different components. If using *T*, *X*, *Y* or *S* as addresses, the lower byte should hold the address whilst the higher byte should be zero.

The amount to offset is specified relative to the current position. If **T**ype is specified, the object moves gradually from its current point to the offset position; this can be used to simulate movements such as elevators. Any type outside the range in the table will cause the offset not to occur. If the object is set to move gradually, then the speed of offset can be set; the greater the number, the slower the object moves to its target offset.

Script execution may also be halted until the gradual offset has been completed. For this, see OFSTW.

#### Movement Types

 1
 2
FF7/Field/Script/Opcodes/20 MINIGAME

* Opcode: **0x20**
* Short name: **MINIGAME**
* Long name: Minigame Start

#### Description

Begins the minigame as defined by the final byte. Once the minigame has completed, the map ID given as the argument is loaded and the playable character is moved to the XYZ co-ordinates also specified. If an invalid minigame ID is passed as the final argument, the return map is loaded immediately.

#### Minigame IDs

 1
 2
 3
 4
 5
 6
FF7/Field/Script/Opcodes/13 JMPBL

* Opcode: **0x13**
* Short name: **JMPBL**
* Long name: Jump back (long)

#### Description

Jumps backward in the current script a specified amount. The jump begins just before the jump opcode itself and then moves the current byte pointer back the specified number of bytes. Unlike JMPB, this jump command allows jumps longer than 0xFF bytes.
FF7/Field/Script/Opcodes/AF ANIM!1

* Opcode: **0xAF**
* Short name: **ANIM!1**
* Long name: Wait While Animate/Stay

* **const UByte** *S*: Speed the animation is played at. Higher numbers indicate slower animations.

#### Description

Similarly to ANIME1, **ANIM!1** plays the animation found at ID *A* in this entity's field object, at the speed marked by *S*. However, when the animation is completed, the field object stays posed in the last frame of the animation.

Script execution is not halted whilst the animation plays.
FF7/Field/Script/Opcodes/3A GOLDd

* Opcode: **0x3A**
* Short name: **GOLDd**
* Long name: Gil Down

* **const UByte** *0*: Zero.
* **const ULong** *A*: Amount to increase.

Decrease by an amount found in memory:

* **const Bit[4]** *B*: Source bank.
* **const UByte** *A*: Source address.
* **const UByte[3]** *0*: Three zero bytes.

#### Description

Decreases the amount of gil by a constant amount, or by an amount found in the source bank *B* and address *A*.

The total gil is capped below by 0; attempts to decrement further will fail.
FF7/Battle/Targeting Data

## Targeting Data

Before targeting is explained in full, some information of rows must be understood. There are two or three rows in any battle. Most normal battles have two rows, allies and enemies. Pincer Attacks and Side Attacks have three rows. Two enemy rows for pincer attacks and one for side attacks. Furthermore, under most conditions, a "viable target" is a battle participant (enemy or ally) that is not inflicted with "Death".

Targeting is set by a single byte with eight different effects for each bit that is set:

Targets are set in three places. On Commands, on Attacks, and on Weapons. The Command's target (if not NULL [FFh]) trumps any target information provided by the Attack or the Weapon. As such, it is analyzed first. Any additional settings are added through the weapon or attack.
This is further trumped by "Confuse" and "Berserk" which will set the target data to C0h and 97h respectively. Confuse will pick any available command to perform and Berserk will just attack with the equipped weapon.

Although the cursor can move to an ally with the "Death" status, if no targets selected to receive the attack are viable the attack will "re-target". A dead enemy cannot be targeted, dead allies can. This is true for monsters and PCs. A "re-target" takes the original targeting data and multiple targets and random is added.

Eg1: Fire (Target of 0Fh) is selected to be performed on an enemy. That action is put into the queue, but the enemy dies before Fire is performed. Fire's targeting data (0Fh) is then and'd with 87h.

```
New Target = (0Fh And 87h) = 87h ' random enemy

```

Eg2: Cure (Target of 0Dh) is queued to heal a suffering ally. Before Cure is cast, the ally dies. Cure is re-targeted:

```
New Target = (0Dh And 87h) = 85h ' random ally

```

NOTE: Setting a target in enemy attack data does not control how the enemy selects targets. That is defined in their AI. Targets in enemy attack data only get used while they are being manipulated.

## Examples:

Defend/Change: Has a target of 00h. This will only allow the caster to perform the command on itself.

Shield: This has a target of 01h. This will only allow the caster to perform the spell on itself or one ally.

Summons: Target of 17h. A PC cannot perform a summon that attacks on his/her own character or row. It will only target all of any enemy row, but only one row.

Some of Aeris's and Cait Sith's Limit Breaks: Set at 15h. Same as above, but only the caster's row.

Most weapons: 23h. This makes some of the weapons into a short range attack. If the "Long Range" Materia is equipped, bit 20h of this targeting data is forced to 0.

Comet2/Berserk: 97h. This will target one target of the enemy row at random.

Roulette: C7h. Will choose one target at random from among all battle participants not inflicted with "Death" status.
FF7/Field/Walkmesh

### Section 5: Walkmesh (Kero)

]]<div]]Every every offset is here relative, 00 is at the start of section 5 (after length indicator).

Section 5 of field files is a stored walkmesh. A walkmesh is a mesh of polygons on which characters move, telling the engine for example how high it is, and using this the character can, for example, cross bridges with the real feeling that in the middle he is at a higher place than on the sides. It has very simple structure.

 0x0004
 0x0004 + 24 \* NoS

#### Section 5 Header

Startofs 0x00 Length 0x04

The walkmesh information is preceeded by a DWORD (4 bytes) unsigned int, named **NoS**, short for the Number of Sectors in the walkmesh.

#### Sector pool

Startofs 0x04 Length NoS\*24

```
typedef struct {
   short x,y,z,res;		// short is a 2 byte signed integer
} vertex_3s;			// 3s == 3 short although there are 4 this is for 32 bit data alignment in PSX

```

```
typedef struct {
   vertex_3s v[3];		// a triangle has 3 vertices
} sect_t; 			// Sector Type

```

The pool consists of sectors, which are in fact triangles, each with their vertices position. For each sector there are 3 vertices (3 vertex\_3s). Res is always equal to v[0].z (it is just a padding value). The polygons are 'wound' clockwise, this makes determining if a point is within a triangle easier.

#### Access pool

Startofs 0x04 + NoS\*24 Length NoS\*6

```
typedef {
   short acces1,acces2,acces3;
}

```

The access pool is an array of access data (ID's of triangles in the Mesh) in the mesh, the ID is the triangle you should be in if you cross that edge.

acces1 is for line from vertex 0 to 1 acces2 is for line from vertex 1 to 2 acces3 is for line from vertex 2 to 0

If the edge value is 0xFFFF, than this edge cannot be crossed (it's blocked). The access pool and sector pool have the same number of entries, thus you use the same index value for both pools of data to access the data for the same triangle. The access data merely informs one that if the PC object crosses this line the object should be in the indentified triangle. FF7 will halt running if you are not in the **access** specified triangle.
FF7/Field/Script/Opcodes/A3 ANIME1

* Opcode: **0xA3**
* Short name: **ANIME1**
* Long name: Wait While Animate/Return

* **const UByte** *S*: Speed the animation is played at. Real model animation speed divide by this to calculate real play speed.

#### Description

Plays the animation found at ID *A* in this entity's field object, at the speed marked by *S*. When the animation is completed, the field object returns to its original state.

The current script's execution is halted whilst the animation is played, and continues when the animation has completed.
FF7/Field/Script/Opcodes/2B SLIP

* Opcode: **0x2B**
* Short name: **SLIP**
* Long name: Slipability

#### Description

If SLIP is set to off, the player will be unable to let the playable character run *against* and *along* the wall by pressing two buttons together. For example, if there is a wall beyond the character running left-to-right, and the character presses up and right together, the character will normally run to the right along the wall. If SLIP is off, the character will stop moving until the player presses right by itself; the combination of up and right together is disallowed. This is sometimes used in areas such as shops.

This should be used in combination with a LINE to specify the line along which the player may not 'slip'.
FF7/Technical

When trying to play Final Fantasy VII on PC, you can encounter variety of problems. Here I'll try to describe most common problems with their solution.

### Before actual game

* 'Error 112' during installation
* I get some weird error about C:\WINDOWS\SYSTEM32\AUTOEXEC.NT when launching the installer
* I can't select Hardware rendering in game configuration
* I get some error while starting game executable or game won't run at all
* After pressing 'New game' I get only black screen or game crashes

### During the game

* Game crashes when I try to enter Chocobo races
* Movies are played upside down
* I have Sound Blaster Live/Audigy card and problems with sound
* Game backgrounds or text looks crappy
* Game crashes after first fight in new game
* Bike minigame speed is way too fast
* Game crashes in some places
* Game crashes when entering a battle
* No movies are played at all
FF7/Field/Script/Opcodes/8C DIV2

* Opcode: **0x8C**
* Short name: **DIV2**
* Long name: Division (16-bit)

* **const UByte** *Dest*: Contains the nominator of the division and receives the quotient.
* **const SWord** *Den*: The denominator of the division.

#### Description

Divides â€œDestâ€ by â€œDenâ€ and stores the result back into â€œDestâ€. The result of the division is rounded towards negative infinity to the nearest integer.
If the Source Bank is 0 then the â€œDenâ€ is the denominator.
If the Source Bank is an 16 bit bank, then the â€œDenâ€ is the address in that bank where the denominator is.
FF7/Field/Script/Opcodes/6B FADE

* Opcode: **0x6B**
* Short name: **FADE**
* Long name: Fade

#### Arguments

* **const Bit[4]** *B1*: Bank to retrieve *R*, or zero if *R* is given as a literal value.
* **const Bit[4]** *B2*: Bank to retrieve *G*, or zero if *G* is given as a literal value.
* **const Bit[4]** *0*: Zero.
* **const Bit[4]** *B3*: Bank to retrieve *B*, or zero if *B* is given as a literal value.
* **const UByte** *R*: Red component value, or address of red value if *B1* is non-zero.
* **const UByte** *G*: Green component value, or address of green value if *B2* is non-zero.
* **const UByte** *B*: Blue component value, or address of blue value if *B3* is non-zero.
* **const UByte** *S*: Speed of fade. Larger numbers indicate faster fades.
* **const UByte** *T*: Type of fade; see table.
* **const UByte** *A*: Adjusts the speed of the fade, based on fade in/out.

#### Description

Fades the screen to the colour specified, either as literal values or values from memory, using the type of fade specified by *T*.

The speed of the fade is specified by *S*, but can also be adjusted based on the type of fade. If the fade type is a fade out (to the colour given), the adjustment ranges from a value of zero (fades at speed *S*), and a value of 0xFF (instant fade). If the fade type is a fade back (from fade colour back to the normal screen), these are reversed, and zero indicates an instant return, whilst 0xFF fades back at speed *S*.

#### Fade Types

 4
 5
 6
FF7/Field/Script/Opcodes/9A LBYTE

* Opcode: **0x9A**
* Short name: **LBYTE**
* Long name: Low Byte

#### Description

Retrieves the low byte of a two-byte word from the source bank and address, and places the byte value into the destination bank and address. If the source is an 8-bit bank, this will simply copy the value from source to destination; if the destination is a 16-bit bank, the high byte of the destination will remain unchanged.
FF7/Field/Script/Opcodes/B3 DIR

* Opcode: **0xB3**
* Short name: **DIR**
* Long name: Direction

#### Arguments

* **const UByte** *B*: Bank to retrieve direction value, or zero if it is specified as a literal value.
* **const UByte** *D*: Direction to face, or address if *B* is non-zero.

#### Description

Instantaneously turns the field object for this entity to the direction specified by *D*. The direction is in the standard direction format for the game.
FF7/Attack Special Effects

Attacks and Items can have additional Special Effects that take place after Damage Calculation is performed. Several of them take a Modifier that further defines what action to take. If the Effect doesn't take a modifier, the modifier is NULL (FFh). In addition, these effects have specific timings. There are six different timings that will be explained later. Here are the valid values (between 0 - 23h) with examples of some attacks that have these values. If another value is provided it will be ignored. Damage Calculations A0 - A8 are handled using the highlighted effects and defaulting to damage calculation 11h.

NOTE: For these two Effects, if they are not called as part of a Limit Break they will return an index of 0.
 For Effect 0Fh, this means performing "Game Over" and ending the battle in a victory.
 For Effect 13h, the player's characters' battle queues freeze and no PC can perform any action after this was selected. Enemies still attack. The reason for this is unknown.
 For Effects 16h and 17h, only the performer gets the stat boost. The in-game English description of Lunatic High suggests this is not intentional. The statuses are granted by the actual Limit attack. Since Howling Moon only targets the caster this isn't an issue, but additional targets would not get the stat boost.
 For Effect 18h, the game assumes the second attack's animation indexes are of the same scope as the first attack's (e.g. if you call an enemy skill as the follow up for a spell, the game will (attempt) to use a magic animation).

## Timings

As mentioned, the different timings indicate when the effects take place during the process of executing the command:

* **T0:** Takes place immediately before damage calculation occurs. If there is no damage calculation, this will not activate.
* **T1:** Takes place immediately after damage calculation occurs. If there is no damage calculation, this will not activate.
* **T2:** After Command is selected and loaded, but before anything actually happens.
* **T3:** Takes place immediately after damage calculation would occur. Will activate whether there is damage done or not.
* **T4:** Activates as long as the action passes accuracy checks (Doesn't 'Miss').
* **T5:** Action Resolution. After Damage Calculations are done this will be triggered for each active actor.

For effects that have more than one timing, there are more than one functions associated with them.
 ex.
 Effect 05h ends the battle without reward. It has a T2 and a T5 command. The T2 command will check if the battle can be escaped from. If it can it sets the "run modifier" to full. The T5 command will actually set the battle to having been escaped from. If it's possible to escape from the battle, it will.
FF7/Field/Script/Opcodes/F1 SOUND

* Opcode: **0xF1**
* Short name: **SOUND**
* Long name: Play Sound

#### Arguments

* **const Bit[4]** *B1*: Source bank 1, or zero if *I* is set as a constant value.
* **const Bit[4]** *B2*: Source bank 2, or zero if *D* is set as a constant value.
* **const UShort** *I*: Sound ID to play, or lower byte indicating address and higher byte zero, if *B1* is non-zero.
* **const UByte** *D*: Directional sound, or address to find direction value, if *B2* is non-zero.

#### Description

Plays the sound file indicated by *I*, or if *B1* is non-zero, plays the sound with ID found at bank *B1* and address *I*. The direction of the sound can also be specified, with 0 indicating the left speaker, 40 indicating center, and 7F indicating the right speaker.
FF7/Field/Script/Opcodes/66 SCR2DC

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

#### 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.

#### Description

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*.
FF7/Materia data

## KERNEL.BIN - Section 9: Materia data format

This section contains the Materia data. Each record is 20 bytes long.

#### Equip Effects

*\** Although the Materia equip menu will claim that certain materia increase the Magic Def stat, they really increase Spirit.

+ These are valid bonus values in the PC version, but they're unused.

++ This value is allowable in the PC version although technically a memory leak.
FF7/Field/Script/Opcodes/7F RDMSD

* Opcode: **0x7F**
* Short name: **RDMSD**
* Long name: Seed Random Generator

#### Arguments

* **const UByte** *B*: Bank in which the seed value is stored, or zero if *S* is specified as a literal value.
* **const UByte** *S*: Seed for the random generator, or address for the seed if *B* is non-zero.

#### Description

Seeds the random number generator used by RANDOM. The lower four bits of the arguments are used as the seed value by altering the offset used to take a value from the table of pseudo-random numbers.
FF7/Field/Script/Opcodes/18 IFUW

* Opcode: **0x18**
* Short name: **IFUW**
* Long name: If (Unsigned Word)

* **const UShort** *V*: Unsigned value to compare the retrieved value to, or address from the second bank of the value to retrieve, if *B2* is non-zero.
* **const UByte** *C*: Type of comparison to perform.
* **const UByte** *E*: Amount to jump if the comparison does not hold.

#### Description

This is similar to the IFUB opcode, but it allows the value to be larger than 0xFF.
FF7/Field/Script/Opcodes/22 BTMD2

* Opcode: **0x22**
* Short name: **BTMD2**
* Long name: Battle Mode

#### Description

Sets properties for the battle module. The argument is a bit field with bits that can be ORd together to set multiple battle properties.

#### Bit Tables

All the bytes used by the game are listed here, along with some that are not used but still have an effect on the battle module. The purpose of the bits not listed in the tables is not yet known, but they likely affect the battle module in an as-yet unseen way.

##### First Byte (MSB)

 0x40 (01000000)
 0x20 (00100000)
 0x08 (00001000)
 0x04 (00000100)
 0x02 (00000010)
FF7/Field/Script/Opcodes/4D HPu

* Opcode: **0x4D**
* Short name: **HPu**
* Long name: HP Up

#### Arguments

* **const UByte** *B*: Bank to retrieve value for increasing, or zero if the amount is specified by a constant in *V*.
* **const UByte** *P*: Party member whose HP will increase (0 to 2).
* **const UShort** *V*: Value to increase HP by, or address to retrieve value from if *B* is non-zero.

#### Description

Increases the HP of the party member specified by *P* by the amount *V*. If *B* is non-zero, then the value to increase by is retrieved from bank *B* and address *V*.
FF7/Field/Script/Opcodes/91 OR

* Opcode: **0x91**
* Short name: **OR**
* Long name: Bitwise OR (8-bit)

* **const UByte** *Dest*: Contains an operand of the bitwise OR and receives the result.
* **const UByte** *Oper*: The second operand of the bitwise OR.

#### Description

Performs a bitwise OR operation between "Dest" and "Oper" and stores the result back into "Dest".
If the Source Bank is 0 then the â€œOperâ€ is the operand to OR with.
If the Source Bank is an 8 bit bank, then the â€œOperâ€ is the address in that bank where the operand is.
FF7/Technical/New game

### Symptoms

When I select *New Game* from main menu, screen goes black and nothing happens or the game crashes.

### Causes

There should be a FMV played here, and it's not because game can't find codec to play it.

### Solution

This is probably your fault - you unchecked installing DirectShow and DirectX drivers when installing the game. Game needs these drivers to show FMVs, so you must reinstall the game - checking to install these drivers. You can also try this solution if installing DirectShow don't help. Or this solution if you have some codec packs installed.

Back to Technical Problems page
Mandrake/Relationships

### Olive

Olive is Mandrake's subordinate, though Mandrake heavily dislikes her. He constantly puts her down and considers her abstinence from killing "weak", often threatening her with death if she does not comply. Like Olive's own spirit, he enjoys belittling her and his treatment of her turns physically violent at times. The two often have clashes in plans due to Mandrake's bloodlust.

Despite this, he has some degree of trust in her given how he let her have his knife to stab Thyme (assuming he isn't just stupid). However Olive betrays him in the last episode and stabs him in the chest, stunning him in the process.
Transformations

Episode 3 (transcript)

"**Transformations**" is the third episode of High Guardian Spice.

## Synopsis

Rosemary accidentally damages Flowering Thorn right before she’s called into Professor Caraway’s office to discuss her studies.

## Events

*This article is a stub.
You can help High Guardian Spice Wiki by expanding it.*

A montage plays of High Guardian Spice training. Talking over them, The Triad discusses the importance of the vows the students made, and for the students to periodically evaluate themselves as they continue their journey to becoming guardians.

## Episode credits

* **Animation Service provided by DR Movie**
* Production Managers: Sunchui Hwang, Jongyeol Im
* Production Coordinators: Narae Lee, Steve Lee
* Animation Director: Jae-eui Kwak
* Animation Supervisor[note]: Youngsik Im
* Background Director: Yoonho Lee
* Layout Artists: Younghee Han, Chanhee Kim
* Key Animators: Jaehoon Choi, Hyeongoek Jang, Jaejun Kim, Jooyoung Kim, Bumgil Lee, Okmi Lee, Hoon Park, Siok Park, Hyunkyu Shin, Sungsoo Yuk
* Inbetween Animators[note]: Yong-o Bae, Hyejin Jeon, Jinki Kim, Euna Park
* Inbetween Checker[note]: Jong Min Choi
* Scan
Kyeong hwa Choi, Kyesoon Kang
* Digital Coloring[note]: Junggyun Han, Jinkyung Kim
* Compositor[note]: Unsik Kim

## References

1. ↑ https://www.crunchyroll.com/high-guardian-spice/episode-3-transformations-820471
FF7/Field/Script/Opcodes/0F SPECIAL/F5 ARROW

* Opcode: **0x0FF5**
* Short name: **SPECIAL: ARROW**
* Long name: Special: Arrow Switch

#### Description

Turns on or off the *availability* of the hand pointer that hovers above the playable character's head; this does not do the same as pressing the Assist button, but rather toggles whether the hand will appear when the user has the hand and arrows set to display. Other indicators that are available, such as the red/green arrows that are turned on or off along with the hand pointer, are not affected by this sub-opcode.
PSX/HRC

## HRC Hierarchy data format

An HRC file is product of the original Playstation Psy-Q 3D development libraries. They describe the bone hierarchy of a 3D model. Most of the time they originally start as a plain text file exported from 3D editing software, or from a 3D file converter. From this they can be "compiled" into binary form more usable for the PSX.

On the PC version of Final Fantasy 7, a text HRC file is used to define the skeletal hierarchy of the field models. The Battle Models use the compiled Format.

But I think that since you read this document, you've got some knowledge 'bout 3D models and skeletons. Let's just start, this format's quite simple! ^\_^

### HRC file format

Since the HRC files are simple plain-text files, you can open them in notepad or any other text editor. Here are the first four bones of "abjb.hrc" (Yuffie's Hierarchy)

```
:HEADER_BLOCK 2
 :SKELETON sd_yufi_sk
 :BONES 24

 hip
 root
 2.9662
 1 ABJC

 chest
 hip
 4.0621967
 1 ABJE

 head
 chest
 5.017107
 1 ACAA

 joint
 head
 3.5236073
 0

 ribon_a
 joint
 8.52051
 1 ACAF
 ....

```

The other bones look the same as the ones listed here. These are the parts of the file.

#### Header

As most files, also the HRC files have got a kind of header. That are the first three lines.

```
:HEADER_BLOCK 2

```

This seems to be a simple "ID". As far as I know, this is the first line in all HRCs...

```
:SKELETON sd_yufi_sk

```

This tells you the name of the skeleton, in our example "sd\_yufi\_sk".

```
:BONES 24

```

Tells you how much bones are stored in this skeleton.

#### Bones

Every bone consist of 4 Lines, which look like this. Let's first take a look at the lines of the first bone:

 First Line: ("hip")

This is the name of the current bone.

Second Line: ("root")

This is the name of the parent bone. The parent bone must be already listed above in the skeleton file,or it can be "root" (origin).

Third Line: ("2.9662")

That's the Length of the bone.

 Fourth Line #1: ("0")

Fourth Line #2: ("1 ABJC")

Fourth Line #3: ("2 ABJC ABJD")

This line consist of 2 or more different values. First, there is a number telling many RSD files are aligned to this model. If it has no RSD File, the number is 0. If the number is 1, there is a string after the number telling you the name of the Resource Data File (RSD). The RSD file tells you which .p Model to use.

There may be even more than 2 RSD Files on 1 Bone, however this has yet be be seen.

### Notes

There are no bone angles, just bone lengths. The HRC file only contains hierarchy data. To build a skeleton, animation files are required.
FF7/Technical/Source

Source Code Forensics

The PC port's executable contains some very interesting artifacts from it's development cycle.
This is a listing of the known source files referenced within Final Fantasy 7's PC executable. This
listing is attainable with a single UNIX like command, and cleaned up with a little editing.

This is by far not a complete listing of source files. These only reference files that did memory
allocation. Their function originally was to trace memory allocations and what source file was
responsible. During the final build, it would seem the debug data was left in the executable, (abet
disabled), and was in a plain-text format that could be grepped with the Linux "strings" command.
FF7/Field/Script/Opcodes/85 PLUS

* Opcode: **0x85**
* Short name: **PLUS**
* Long name: Addition (8-bit)

* **const UByte** *Dest*: The destination variable, to which the operand is added.
* **const UByte** *Oper*: The operand, added to the destination.

#### Description

Adds two numbers together and stores the result back into â€œDestâ€. The result of the addition wraps around into the range of 0-255.
If the Source Bank is 0 then the â€œOperâ€ is added to the destination value.
If the Source Bank is an 8 bit bank, then the â€œOperâ€ is the address in that bank where the operand is.
FF7/Field/Script/Opcodes/64 SCR2D

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

#### 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.

#### Description

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.
FF7/Kernel/Kernel.bin

## The KERNEL.BIN Archive

The file KERNEL.BIN archive is in BIN-GZIP format. It consists of 27 gziped sections concatenated together with a 6 byte header for each. This file is the same both on the PC and PSX versions. This holds all the static data and menu text for the game, with a look up table at the beginning of the section. The first 9 sections of data (i.e. The non-text related items) are in typical BIN file archive format. Sections 10-27 are FF Text files. The text sections have a header of pointers at the beginning of each section and point to a text block below.

The KERNEL.BIN file consists of the following sections.

## The KERNEL2.BIN Archive

On the PC version there exists a secondary kernel archive called KERNEL2.BIN. This archive contains only sections 10-27 (Text data) of KERNEL.BIN. The data was ungzipped from the original archive, concatenated together, and then LZSed into a single archive with a 4 byte header giving the length of the file.

The maximum allotted storage space on the PC version for all un-LZSed data in the kernel2.bin is 27KB (27648 bytes). This means that the total size of the extracted files (text and pointers) must be less than this.
FF7/Field/Script/Opcodes/09 SPLIT

* Opcode: **0x09**
* Short name: **SPLIT**
* Long name: Party Field Split

#### Arguments

* **const Bit[4]** *B1*: Bank for *XA*, or zero if *XA* is specified as a literal value.
* **const Bit[4]** *B2*: Bank for *YA*, or zero if *YA* is specified as a literal value.
* **const Bit[4]** *B3*: Bank for *DA*, or zero if *DA* is specified as a literal value.
* **const Bit[4]** *B4*: Bank for *XB*, or zero if *XB* is specified as a literal value.
* **const Bit[4]** *B5*: Bank for *YB*, or zero if *YB* is specified as a literal value.
* **const Bit[4]** *B6*: Bank for *DB*, or zero if *DB* is specified as a literal value.
* **const Short** *XA*: X-coordinate of the second character in the party after the split, or address for the value if *B1* is non-zero.
* **const Short** *YA*: Y-coordinate of the second character in the party after the split, or address for the value if *B2* is non-zero.
* **const UByte** *DA*: Direction the second character faces after the split, or address for the value if *B3* is non-zero.
* **const Short** *XB*: X-coordinate of the third character in the party after the split, or address for the value if *B4* is non-zero.
* **const Short** *YB*: Y-coordinate of the third character in the party after the split, or address for the value if *B5* is non-zero.
* **const UByte** *DB*: Direction the third character faces after the split, or address for the value if *B6* is non-zero.
* **const UByte** *S*: Speed that the characters split.

#### Description

Causes the common 'split effect' whereby the second and third characters in the current party 'come out' from the party leader. That is, they become visible in the field, starting from the centre of the party leader, and move out to the coordinates specified in the argument list. This is commonly used when the other characters in the current party have an action or dialog to perform and must be individually visible in the field. As well as specifying final coordinates for the two other party characters, the directions each character faces after the split are specified as a byte, using the common direction values found throughout the game. Speed is also given and is used to specify the rate at which the characters leave the party leader, using a scale from 1 (almost instant) to FF (extremely slow walk); this must be non-zero.