|
resonance 1.0.1
|
Driver of the full-screen metagame fade. More...
#include <metfade.h>
Public Types | |
| enum | State { kStateIdle = 0 , kStateOut = 1 , kStateIn = 2 } |
| The fade in progress. More... | |
Public Member Functions | |
| MetFade (MetRenderer *pRenderer) | |
| Resolve the fade rectangle and prime the two timers. | |
| void | FadeOut (float duration, float start, FadeUser *pUser, int nRetainView) |
| Start the fade out, the one a screen runs as it departs. | |
| void | FadeIn (float duration, float start, FadeUser *pUser, int nRetainView) |
| Start the fade in, the one a screen runs as it enters. | |
| void | Update (float frame) |
| Advance whichever fade is running. | |
Driver of the full-screen metagame fade.
The class emits no RTTI descriptor and no __FILE__ path survives for its translation unit, because its constructor writes no virtual function table pointer and it declares no destructor. The name here is inferred from the two literals its constructor and its fade routines use, metfade.rect at 0x007d8dd0 and met_fade.view at 0x007d8de0.
The global operator new(0x2c) at its allocation sites fixes the object size at 0x2c bytes. MetLoadGameScreen and MetMemDetectStartup each build one and each release it through the scalar deallocator with no null test. A delete expression compiles to the same call for a class with no destructor. The European release also builds one in MetLogoScreen.
A fade runs from a start frame to an end frame. While one runs, the fade view is attached to the renderer's screen scene and the rectangle's vertex alpha follows a linear ramp over the span. When it finishes, the receiver passed to FadeOut() or FadeIn() is notified. No member name is attested anywhere in the image, so every identifier below is inferred.
The European release detaches the view before it attaches it at the start of a fade. A finished fade sets the final alpha before it hides the rectangle, and the rectangle stays hidden.
| enum MetFade::State |
| MetFade::MetFade | ( | MetRenderer * | pRenderer | ) |
Resolve the fade rectangle and prime the two timers.
Both start frames begin at 1.0e9, which is the sentinel for a fade that is not running. The rectangle is the object named metfade.rect, cast to Rnd::Mesh, and a null result is stored as such. The constructor then hides the rectangle without testing it for null.
| pRenderer | The front-end renderer the fade draws through. |
| void MetFade::FadeOut | ( | float | duration, |
| float | start, | ||
| FadeUser * | pUser, | ||
| int | nRetainView ) |
Start the fade out, the one a screen runs as it departs.
Shows the rectangle, records the span and the ramp, and attaches met_fade.view to the renderer's screen scene. The ramp runs the rectangle's alpha from 1 at the start frame down to 0 at the end frame.
| duration | The length of the fade in frames. |
| start | The frame the fade starts on. |
| pUser | The receiver whose slot 2 runs when the fade finishes, or null for none. |
| nRetainView | Stored for UpdateIn(). The fade out itself never reads it. |
| void MetFade::FadeIn | ( | float | duration, |
| float | start, | ||
| FadeUser * | pUser, | ||
| int | nRetainView ) |
Start the fade in, the one a screen runs as it enters.
The same as FadeOut() against the second timer, except that the rectangle is not shown and the ramp runs the alpha from 0 at the start frame up to 1 at the end frame.
| duration | The length of the fade in frames. |
| start | The frame the fade starts on. |
| pUser | The receiver whose slot 3 runs when the fade finishes, or null for none. |
| nRetainView | Non-zero to leave the view attached and the rectangle shown when the fade finishes. |
| void MetFade::Update | ( | float | frame | ) |
Advance whichever fade is running.
Any state other than kStateIdle and kStateOut advances the fade in.
| frame | The current frame. |