FF7/Field/Script/Opcodes/D3 SLINE
- Opcode: 0xD3
- Short name: SLINE
- Long name: Set Line
Contents
Memory layout
0xD3 | B1 / B2 | B3 / B4 | B5 / B6 | XA | YA | ZA | XB | YB | ZB |
---|
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 ZA, or zero if ZA 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 ZB, or zero if ZB is specified as a literal value.
- const Short XA: X-coordinate of the first point of the line, or address to find value if B1 is non-zero.
- const Short YA: Y-coordinate of the first point of the line, or address to find value if B2 is non-zero.
- const Short ZA: Z-coordinate of the first point of the line, or address to find value if B3 is non-zero.
- const Short XB: X-coordinate of the second point of the line, or address to find value if B4 is non-zero.
- const Short YB: Y-coordinate of the second point of the line, or address to find value if B5 is non-zero.
- const Short ZB: Z-coordinate of the second point of the line, or address to find value if B6 is non-zero.
Description
Alters the two points of a previously defined LINE. In addition to allowing a line to be adjusted after creation, this opcode also provides the ability to retrieve line end-point values from memory.
If two or more lines are defined in one entity, SLINE only updates the first LINE definition.
Additional Detail
There are generally 6 scripts (other than the init and main) if the entity is a LINE (taken from Makou Reactor):
- script index 2 -> S1 - [OK]
- script index 3 -> S2 - Move
- script index 4 -> S3 - Move
- script index 5 -> S4 - Go
- script index 6 -> S5 - Go 1x
- script index 7 -> S6 - Go away
[OK]
Occurrences - This is often present, but mostly contains a single RET op code.
Behaviour - I'm sure this is triggered when the player is close to the line and presses the [OK] button, eg blin59
Move
- Occurrences
The script index 2 Move is often present, but again mostly contains a single RET op code.
The script index 3 Move is not often present but when it is, the script index 2 typically isn't, again, always ends with a RET.
There are 11 occurrences when both index 2 & 3 Move are present and both have more than one single RET op code.
10 of these contain exactly the same ops in both (fields - hyou4, hyou5_4) - A REQEW and a RET with exactly the same params. Every one of these leads to a MAPJUMP.
1 of these (field - del12) contains 2 ops in the index 2 Move script (UC,MENU, and no RET). The index 3 Move script contains 11 ops including a final RET op
As a result of the above, I believe that it is relatively safe to assume the following logic:
- Behaviour
This is triggered every time the player is close to the line.
If the index 2 Move is present, it executes until it receives a RET or finishes all of the ops, then
If the index 3 Move is present, it executes until it receives a RET or finishes all of the ops.
Go
Occurrences - This is often present, and always contains a final RET op code.
Behaviour - I'm sure this is triggered every time the player leaves the line
Go 1x
Occurrences - This is occasioanlly present, and always contains a final RET op code. If a Go 1x script is present, I don't think that a Go script will be present for the same entity. Need to investigate.
Behaviour - I'm sure this is triggered when the player leaves the line, but only once for the duration of the time in the field. Come examples are doors remaining open after they are programmatically triggered. bugin2.
Go away
Occurrences - Can be present alongside Go and Go 1x. Always contains a final RET op code.
Behaviour - Very similar to Go, but the distance that the player has to be away from the point is large (maybe 4x). Examples are the jumps on las0_6
It's worth noting that any combination of Go, Go 1x and Go away can be present an executable on any script.
Here is a JSON file containing a little more details on the occurrences, frequencies and combinations of the LINE op code usage: https://github.com/dangarfield/ff7-fenrir/blob/master/workings-out/output/line-occurences.json