Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Script/Opcodes/6B FADE

4,978 bytes added, 20:10, 30 October 2020
Large update
Fades the screen to the colour specified, either as literal values or values from memory, using the type of fade specified by ''T''.
Fades are linear tweens that sit above the field. The speed from color and to color of the fade is specified by ''S'', but can also be adjusted based on the type of fadetweens are detailed below. If After the fade type is a fade out (to the colour given)tween has completed, the adjustment ranges from a value of zero (fades at speed ''S''), and also set or do not set a value of 0xFF (instant fade)holding color. If For example, some fades go from the fade type is field colors to a fade back (from fade colour back to the normal screen)light coloured overlay, these are reversedbut once finish, and zero indicates an instant return, whilst 0xFF fades reset to back at speed ''S''to field backgrounds.
==== Fade Types ====The transition fades between fields and menus do not appear to affected by this op code.
The overlay sits infront of field models and background (apart from any special models with KAWAI or SHINE effects). It also sits behind any messages that appear on the screen. If a FADE (or NFADE) is in progress but another FADE (or NFADE) is called, the current fade is stopped and the new one continues. Both op codes control, what essentially is, a single fade layer, I believe... ''Note: Not 100% accurateWhere colorBlack is mentioned, this essentially means 'transparent', eg you see the field without any overlay'' ==== Speed ==== The speed of the fade is specified by ''S'', and is base on:  1 -> 240 frames -> 8 secs 2 -> 120 frames -> 4 secs 4 -> 60 frames -> 2 secs 8 -> 30 frames -> 1 secs 16 -> 15 frames -> 0.5 secs 32 -> 7.5 frames -> 0.25 secs In the table below, I refer to a calculation formula ''speedToSeconds'' for ''S'' to seconds is represented as:  const speedToSeconds = (speed) => { return 8 / Math.pow(2, Math.log2(speed)) } With 'NFADE', the speed calculation is not required, the fade speed ''S'' represents the frame count for the fade. ==== Adjust ==== If the type id is odd, the adjust is 0xFF, if even, it is 0x00.Whilst I haven't gone into depth with the adjust, but it seemingly affects the wait for (FADEW). If set as per the table below, then the fade will take the time take as above and the FADEW will resolve once completed. ==== Colours ====Simple formulas based on PCthe passed ''r'', ''g'', ''b'' values:  colorBlack -> rgb(0, 0, 0) colorStandard -> rgb(r, g, b) colorInverse1 -> rgb(0xFF - r, 0xFF - g, 0xFF - b) colorInverse4 -> rgb(4 * (0xFF - r), 4 * (0xFF - g), 4 * (0xFF - b)) Frame by frame, the tweens will calculate the correct values between the '''from''' and '''to''' colours over the period of time of the fade.Eg: FROM rgb(10,10,10) -> TO rgb(30,20,10) will increase like this:  rgb(10,10,10) rgb(12,11,10) rgb(14,12,10) rgb(16,13,10) rgb(18,14,10) rgb(20,15,10) rgb(22,16,10) rgb(24,17,10) rgb(26,18,10) rgb(29,19,10) rgb(30,20,10) ==== Blending Modes ==== Whilst it seems as though a fade my be a gradual opacity, in FF7, it isn't. Instead it is a blending of colors ontop of each other.Eg: We have a 2 pixel, a dark red one and a dark blue one and an orange overly, we apply it like this:  GREEN rgb( 40, 150, 70) -> BLEND DARK BLUE rgb( 50, 60, 130) ADDITIVE -> rgb( 90, 210, 200) GREEN rgb( 40, 150, 70) -> BLEND DARK BLUE rgb( 50, 60, 130) SUBTRACTIVE -> rgb( 0, 90, 0) ORANGE rgb(255, 130, 0) -> BLEND DARK BLUE rgb( 50, 60, 130) ADDITIVE -> rgb(255, 190, 130) ORANGE rgb(255, 130, 0) -> BLEND DARK BLUE rgb( 50, 60, 130) SUBTRACTIVE -> rgb(205, 70, 0) ''Note: Values are clamped below 0x00 and above 0xFF''  ==== Fade Types - FADE ====
{| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"
! style="background:rgb(204,204,204)" width="40" | ID
! style="background:rgb(204,204,204)" width="250" | Fade Description! style="background:rgb(204,204,204)" width="40" | Async/Sync! style="background:rgb(204,204,204)" width="40" | Blending Type! style="background:rgb(204,204,204)" width="40" | From color! style="background:rgb(204,204,204)" width="40" | To color! style="background:rgb(204,204,204)" width="40" | Hold end color after finished! style="background:rgb(204,204,204)" width="40" | Speed! style="background:rgb(204,204,204)" width="40" | Adjust (typically)
|-
| align="center" | 1
| Color colorInverse4 to screen (alpha 1 -> 0) with field subtractive blending, colors are inverse x3 - (3 * 255-c)hold field| Async, ensure wait for| Subtractive| colorInverse4| colorBlack| colorBlack| speedToSeconds| 0xFF
|-
| align="center" | 2
| Screen field to colour fadeIn (alpha 0 -> 1) with colorInverse4 subtractive blending, colors are inverse x3hold color| Async, ensure wait for| Subtractive| colorBlack| colorInverse4| colorInverse4| speedToSeconds| 0x00
|-
| align="center" | 3
| There are none of these Not in the PC fieldsuse... But previously mentioned, colour fade to screen| | | | | | |
|-
| align="center" | 4
| Show instant no wait black (alpha = 1) instant, hold black| Instant, no fade| Normal| | colorBlack| colorBlack| Instant| 0x00
|-
| align="center" | 5
| Colour colorStandard to screen fadeout (alpha 1 -> 0) with field additive blending, hold field| Async, ensure wait for| Additive| colorStandard| colorBlack| colorBlack| speedToSeconds| 0xFF
|-
| align="center" | 6
| en field to colour fadeIn (alpha 0 -> 1) with colorStandard additive blending, hold color| Async, ensure wait for| Normal| colorBlack| colorStandard| colorStandard| speedToSeconds| 0x00
|-
| align="center" | 7
| Haven't worked this out yet. trackininstant but wait colorInverse1 subtractive, shmeihold field| Async, script 1ensure wait for| Subtractive| colorInverse1| colorInverse1| colorBlack| speedToSeconds| 0xFF
|-
| align="center" | 8
| Screen to colour fadeIn (alpha 0 -> 1) with multiply blendinginstant but wait colorInverse1 subtractive, hold color| Async, ensure wait for| Subtractive| colorInverse1| colorInverse1| colorInverse1| speedToSeconds| 0x00
|-
| align="center" | 9
| Screen to color (alpha = 1) instant with normal blendingbut wait colorStandard additive, hold field| Async, ensure wait for| Additive| colorStandard| colorStandard| colorBlack| speedToSeconds| 0xFF
|-
| align="center" | 10
| Screen to colour fadeIn instant but wait colorStandard additive, hold color| Async, ensure wait for| Additive| colorStandard| colorStandard| colorStandard| speedToSeconds| 0x00|} ==== Fade Types - NFADE ==== {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;"! style="background:rgb(204,204,204)" width="40" | ID! style="background:rgb(204,204,204)" width="250" | Description! style="background:rgb(204,204,204)" width="40" | Async/Sync! style="background:rgb(204,204,204)" width="40" | Blending Type! style="background:rgb(204,204,204)" width="40" | From color! style="background:rgb(204,204,204)" width="40" | To color! style="background:rgb(204,204,204)" width="40" | Hold end color after finished! style="background:rgb(alpha 204,204,204)" width="40" | Speed|-| align="center" | 0 | instant no wait show field, hold field| Instant, no fade| Subtractive| | colorBlack| colorBlack| Instant|-> 1) with | align="center" | 11| field to colorStandard additive blending, hold colorNeed to look at this more| Async, looks like an additional layer ontop of the current fade layerensure wait for| Additive| colorBlack| colorStandard| colorStandard| ''S'' = frames
|-
| align="center" | 12
| field to colorStandard subtractive, hold color
| Async, ensure wait for
| Subtractive
| colorBlack
| colorStandard
| colorStandard
| ''S'' = frames
|}
50
edits