DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
cursol.cpp
1#include "title/cursol.hpp"
2
3#include <cmath>
4
5#include "mathutil.hpp"
6
8 select = TITLE_MENU_NEW_GAME;
9 y = 288.0f;
10 target_y = 288.0f;
11 alpha[0] = alpha[1] = alpha[2] = alpha[3] = alpha[4] = 0;
12}
13
15 select = TITLE_MENU_NEW_GAME;
16#ifdef PAL
17 y = 304.0f;
18#else
19 y = 288.0f;
20#endif
21#ifdef PAL
22 target_y = 304.0f;
23#else
24 target_y = 288.0f;
25#endif
26 alpha[0] = alpha[1] = alpha[2] = alpha[3] = alpha[4] = 0;
27}
28
30 if (target_y > y) {
31 y = y + (target_y - y) / 4.0f;
32
33 if (target_y - y < 1.0f) {
34 y = target_y;
35 arrived = true;
36 } else {
37 arrived = false;
38 }
39 }
40
41 if (target_y < y) {
42 y = y - (y - target_y) / 4.0f;
43
44 if (y - target_y < 1.0f) {
45 y = target_y;
46 arrived = true;
47 } else {
48 arrived = false;
49 }
50 }
51
52 switch (select) {
53 case TITLE_MENU_NEW_GAME:
54 if (alpha[0] < 127) {
55 alpha[0] += 8;
56 }
57
58 if (alpha[1] > 0) {
59 alpha[1] -= 8;
60 }
61
62 if (alpha[2] > 0) {
63 alpha[2] -= 8;
64 }
65
66 if (alpha[3] > 0) {
67 alpha[3] -= 8;
68 }
69
70 if (alpha[4] > 0) {
71 alpha[4] -= 8;
72 }
73
74 break;
75 case TITLE_MENU_LOAD:
76 if (alpha[0] > 0) {
77 alpha[0] -= 8;
78 }
79
80 if (alpha[1] < 127) {
81 alpha[1] += 8;
82 }
83
84 if (alpha[2] > 0) {
85 alpha[2] -= 8;
86 }
87
88 if (alpha[3] > 0) {
89 alpha[3] -= 8;
90 }
91
92 if (alpha[4] > 0) {
93 alpha[4] -= 8;
94 }
95
96 break;
97 case TITLE_MENU_OPTION:
98 if (alpha[0] > 0) {
99 alpha[0] -= 8;
100 }
101
102 if (alpha[1] > 0) {
103 alpha[1] -= 8;
104 }
105
106 if (alpha[2] < 127) {
107 alpha[2] += 8;
108 }
109
110 if (alpha[3] > 0) {
111 alpha[3] -= 8;
112 }
113
114 if (alpha[4] > 0) {
115 alpha[4] -= 8;
116 }
117
118 break;
119 case TITLE_MENU_ATTRACT:
120 if (alpha[0] > 0) {
121 alpha[0] -= 8;
122 }
123
124 if (alpha[1] > 0) {
125 alpha[1] -= 8;
126 }
127
128 if (alpha[2] > 0) {
129 alpha[2] -= 8;
130 }
131
132 if (alpha[3] < 127) {
133 alpha[3] += 8;
134 }
135
136 if (alpha[4] > 0) {
137 alpha[4] -= 8;
138 }
139
140 break;
141 case TITLE_MENU_UNK_4:
142 if (alpha[0] > 0) {
143 alpha[0] -= 8;
144 }
145
146 if (alpha[1] > 0) {
147 alpha[1] -= 8;
148 }
149
150 if (alpha[2] > 0) {
151 alpha[2] -= 8;
152 }
153
154 if (alpha[3] > 0) {
155 alpha[3] -= 8;
156 }
157
158 if (alpha[4] < 127) {
159 alpha[4] += 8;
160 }
161
162 break;
163 }
164
165 if (target_y == y) {
166 return 1;
167 }
168
169 return 0;
170}
171
172void CCursol::Set(float new_target_y) {
173 target_y = new_target_y;
174}
175
177 return select;
178}
179
181 return (int) y;
182}
void Set(float new_target_y)
Definition cursol.cpp:172
float y
Definition cursol.hpp:24
CCursol()
Definition cursol.cpp:7
int Move()
Definition cursol.cpp:29
char arrived
Definition cursol.hpp:28
float target_y
Definition cursol.hpp:25
int alpha[5]
Definition cursol.hpp:26
int GetPos()
Definition cursol.cpp:180
int GetSelect()
Definition cursol.cpp:176
int select
Definition cursol.hpp:27
void Init()
Definition cursol.cpp:14