| 71 | } |
| 72 | |
| 73 | void Transition::Init(Type type, Scene *linked_scene, int duration, bool next_erase) { |
| 74 | // Triggering multiple transitions on a single frame is a bug. |
| 75 | assert(!IsActive()); |
| 76 | |
| 77 | if (duration < 0) { |
| 78 | duration = GetDefaultFrames(type); |
| 79 | } |
| 80 | transition_type = type; |
| 81 | scene = linked_scene; |
| 82 | |
| 83 | current_frame = 0; |
| 84 | flash = {}; |
| 85 | flash_power = 0; |
| 86 | flash_iterations = 0; |
| 87 | flash_duration = 0; |
| 88 | total_frames = 0; |
| 89 | from_erase = to_erase; |
| 90 | |
| 91 | SetVisible(false); |
| 92 | |
| 93 | // Erase transitions are skipped entirely if screen already erased. |
| 94 | if (type != TransitionNone && from_erase && next_erase) { |
| 95 | transition_type = TransitionNone; |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | screen1.reset(); |
| 100 | screen2.reset(); |
| 101 | |
| 102 | // Show Screen, the current frame is captured immediately |
| 103 | if (!next_erase) { |
| 104 | screen1 = DisplayUi->CaptureScreen(); |
| 105 | } |
| 106 | |
| 107 | // Total frames and erased have to be set *after* the above drawing code. |
| 108 | // Otherwise IsActive() / IsErasedNotActive() will mess up drawing. |
| 109 | total_frames = duration; |
| 110 | |
| 111 | // TransitionNone is neither a Show or Erase, it just waits and does nothing. |
| 112 | // Screen state is not changed. |
| 113 | if (type == TransitionNone) { |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | to_erase = next_erase; |
| 118 | |
| 119 | SetAttributesTransitions(); |
| 120 | } |
| 121 | |
| 122 | void Transition::SetAttributesTransitions() { |
| 123 | int w, h, beg_i, mid_i, end_i, length; |
nothing calls this directly
no test coverage detected