DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
dispfade.cpp
1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
3
4#include "title/dispfade.hpp"
5
6#include "mglib.hpp"
7#include "rect.hpp"
8
9void CDispFade::FadeOutStart(float speed, int colour) {
10 fade_speed = speed;
11 mode = 1;
12 fade_colour = colour;
13}
14
15void CDispFade::FadeInStart(float speed, int colour) {
16 fade_speed = speed;
17 mode = 2;
18 fade_colour = colour;
19}
20
21void CDispFade::FadeInit(float initial_rate) {
22 fade_rate = initial_rate;
23 mode = -1;
24 fade_colour = 0;
25}
26
28 return fade_rate;
29}
30
32 if (mode != 1) {
33 return fade_rate;
34 }
35
36 if (fade_rate == 0.0f && fade_speed == 0.0f) {
37 return fade_rate;
38 }
39
41
42 if (fade_rate > 128.0f) {
43 fade_rate = 128.0f;
44 }
45
46 for (s32 x = 0; x < 640; x += 64) {
47 if (fade_colour != 0) {
48#ifdef PAL
49 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 16) {
50#else
51 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 32) {
52#endif
53 CRect_i_ rect;
54 rect.x = x * 16;
55 rect.y = y * 16;
56 rect.width = 1024;
57#ifdef PAL
58 rect.height = 256;
59#else
60 rect.height = 512;
61#endif
62 MGFillBox(rect, 255, 255, 255, static_cast<u8>(fade_rate));
63 }
64 } else {
65#ifdef PAL
66 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 16) {
67#else
68 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 32) {
69#endif
70 CRect_i_ rect;
71 rect.x = x * 16;
72 rect.y = y * 16;
73 rect.width = 1024;
74#ifdef PAL
75 rect.height = 256;
76#else
77 rect.height = 512;
78#endif
79 MGFillBox(rect, 0, 0, 0, static_cast<u8>(fade_rate));
80 }
81 }
82 }
83
84 if (fade_rate >= 128.0f) {
85 fade_rate = 128.0f;
86 fade_speed = 0.0f;
87 }
88
89 return fade_rate;
90}
91
93 if (mode != 2) {
94 return fade_rate;
95 }
96
97 if (fade_rate == 0.0f && fade_speed == 0.0f) {
98 return fade_rate;
99 }
100
102
103 if (fade_rate < 0.0f) {
104 fade_rate = 0.0f;
105 }
106
107 for (s32 x = 0; x < 640; x += 64) {
108 if (fade_colour != 0) {
109#ifdef PAL
110 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 16) {
111#else
112 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 32) {
113#endif
114 CRect_i_ rect;
115 rect.x = x * 16;
116 rect.y = y * 16;
117 rect.width = 1024;
118#ifdef PAL
119 rect.height = 256;
120#else
121 rect.height = 512;
122#endif
123 MGFillBox(rect, 255, 255, 255, static_cast<u8>(fade_rate));
124 }
125 } else {
126#ifdef PAL
127 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 16) {
128#else
129 for (s32 y = 0; y < SCREEN_HALF_HEIGHT; y += 32) {
130#endif
131 CRect_i_ rect;
132 rect.x = x * 16;
133 rect.y = y * 16;
134 rect.width = 1024;
135#ifdef PAL
136 rect.height = 256;
137#else
138 rect.height = 512;
139#endif
140 MGFillBox(rect, 0, 0, 0, static_cast<u8>(fade_rate));
141 }
142 }
143 }
144
145 if (fade_rate <= 0.0f) {
146 fade_rate = 0.0f;
147 fade_speed = 0.0f;
148 mode = -1;
149 }
150
151 return fade_rate;
152}
void FadeOutStart(float speed, int colour)
Definition dispfade.cpp:9
float GetRate()
Definition dispfade.cpp:27
s32 fade_colour
Definition dispfade.hpp:15
float FadeOut(sceVif1Packet *packet)
Definition dispfade.cpp:31
float FadeIn(sceVif1Packet *packet)
Definition dispfade.cpp:92
void FadeInit(float initial_rate)
Definition dispfade.cpp:21
float fade_rate
Definition dispfade.hpp:12
float fade_speed
Definition dispfade.hpp:13
void FadeInStart(float speed, int colour)
Definition dispfade.cpp:15
s32 x
Definition rect.hpp:18
s32 width
Definition rect.hpp:20
s32 height
Definition rect.hpp:21
s32 y
Definition rect.hpp:19