Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Script/Opcodes/6B FADE

5,832 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.
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: Where 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, 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 the 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| colorInverse4 to field subtractive, hold field| Async, ensure wait for| Subtractive| colorInverse4| colorBlack| colorBlack| speedToSeconds| 0xFF|-| align="center" | 2| field to colorInverse4 subtractive, hold color| Async, ensure wait for| Subtractive| colorBlack| colorInverse4| colorInverse4| speedToSeconds| 0x00
|-
| align="center" | 3
| Black to Screen (Instant)Not in use...| | | | | | |
|-
| align="center" | 4
| Screen to Black (instant no wait black, hold black| Instant), no fade| Normal| | colorBlack| colorBlack| Instant| 0x00
|-
| align="center" | 5
| Colour Fade colorStandard to Screenfield additive, hold field| Async, ensure wait for| Additive| colorStandard| colorBlack| colorBlack| speedToSeconds| 0xFF
|-
| align="center" | 6
| Screen field to Colour colorStandard additive, hold color| Async, ensure wait for| Normal| colorBlack| colorStandard| colorStandard| speedToSeconds| 0x00|-| align="center" | 7| instant but wait colorInverse1 subtractive, hold field| Async, ensure wait for| Subtractive| colorInverse1| colorInverse1| colorBlack| speedToSeconds| 0xFF|-| align="center" | 8| instant but wait colorInverse1 subtractive, hold color| Async, ensure wait for| Subtractive| colorInverse1| colorInverse1| colorInverse1| speedToSeconds| 0x00|-| align="center" | 9| instant but wait colorStandard additive, hold field| Async, ensure wait for| Additive| colorStandard| colorStandard| colorBlack| speedToSeconds| 0xFF|-| align="center" | 10| instant but wait colorStandard additive, hold color| Async, ensure wait for| Additive| colorStandard| colorStandard| colorStandard| speedToSeconds| 0x00|} ==== FadeTypes - 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(204,204,204)" width="40" | Speed|-| align="center" | 0| instant no wait show field, hold field| Instant, no fade| Subtractive| | colorBlack| colorBlack| Instant|-| align="center" | 11| field to colorStandard additive, hold color| Async, ensure 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