1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#include "d/snd/d_snd_harp_song_mgr.h"
#include "common.h"
#include "d/snd/d_snd_bgm_mml_parsers.h"
#include "d/snd/d_snd_harp_song_data.h"
#include "d/snd/d_snd_util.h"
#include "d/snd/d_snd_wzsound.h"
SND_DISPOSER_DEFINE(dSndHarpSongMgr_c);
dSndHarpSongMgr_c::dSndHarpSongMgr_c()
: field_0x010(0),
field_0x011(0),
mDataLoaded(false),
field_0x014(0),
field_0x018(0),
field_0x01C(0),
field_0x020(0),
field_0x024(0),
field_0x028(0),
field_0x02C(0),
field_0x030(0),
field_0x034(0),
field_0x038(0.0f),
field_0x03C(1.0f),
field_0x040(0),
field_0x041(0),
field_0x042(0),
field_0x043(0),
field_0x044(1),
field_0x048(0),
field_0x04C(3),
field_0x050(3),
field_0x054(3),
field_0x064(0),
field_0x068(0),
field_0x070(0),
field_0x078(0),
mpTmpData(nullptr),
field_0x5AC(0),
field_0x5B4(0),
field_0x5B8(0),
field_0x5BC(0),
field_0x5C0(4),
field_0x5C4(4) {
resetFloatArr1();
resetFloatArr2();
field_0x058 = 3;
field_0x05C = 3;
field_0x060 = 3;
mpData = new dSndHarpSongData_c[dSndHarpSongData_c::sNumHarpSongs];
}
void dSndHarpSongMgr_c::setup() {
// no-op
}
void dSndHarpSongMgr_c::setupState0() {
if (mDataLoaded) {
return;
}
dSndBgmMmlParserHarpSong_c parser;
for (int i = 0; i < dSndHarpSongData_c::sNumHarpSongs; i++) {
mpData[i].init(i);
u32 soundId = LABEL_HARP_TONE_RAW_START + 1 + i;
parser.parseData(soundId, mpData + i);
mpData[i].setSoundId(soundId);
mpData[i].loadStaticValues();
}
mDataLoaded = true;
}
void dSndHarpSongMgr_c::shiftFloat1(f32 val) {
if (val < 0.0f) {
val = 0.0f;
}
if (val > 150.0f) {
val = 150.0f;
}
// @bug (?) this loop ends up copying the value of field_0x07C[0]
// to all array elements when surely the intention was to
// move each of them back by one position. TODO: are array entries
// other than [0] read anywhere?
for (int i = 1; i < 300; i++) {
field_0x07C[i] = field_0x07C[i - 1];
}
field_0x07C[0] = val;
}
void dSndHarpSongMgr_c::shiftFloat2(f32 val) {
if (val < 0.0f) {
val = 0.0f;
}
if (val > 240.0f) {
val = 240.0f;
}
// @bug (?) this loop ends up copying the value of field_0x52C[0]
// to all array elements when surely the intention was to
// move each of them back by one position. TODO: are array entries
// other than [0] read anywhere?
for (int i = 1; i < 30; i++) {
field_0x52C[i] = field_0x52C[i - 1];
}
field_0x52C[0] = val;
}
void dSndHarpSongMgr_c::resetFloatArr1() {
for (int i = 0; i < 300; i++) {
field_0x07C[i] = 0.0f;
}
}
void dSndHarpSongMgr_c::resetFloatArr2() {
for (int i = 0; i < 30; i++) {
field_0x52C[i] = 0.0f;
}
}
bool dSndHarpSongMgr_c::isContinuousStrumming() {
return field_0x01C;
}
bool dSndHarpSongMgr_c::isPlayingHarpRelated() {
return fn_80381150() == false;
}
bool dSndHarpSongMgr_c::fn_80381150() {
if (isContinuousStrumming()) {
return field_0x042;
}
return true;
}
|