Skip to content

Commit 2b11dbd

Browse files
committed
refactor: automatic field refactor
1 parent dc2fad9 commit 2b11dbd

11 files changed

Lines changed: 41 additions & 37 deletions

‎src/OpenSHC/Audio/SFX/SFXState/playAmbientSoundStreamUnk.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace Audio {
1818
return;
1919
}
2020
DAT_SoundSystemState::instance.streamFileVolumeNextUnk_0x48[1]
21-
= DAT_SpeechDefinedData::instance.AmbientSounds[ambientSoundIndexUnk]
22-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[ambientSoundIndexUnk].variationIndex];
21+
= DAT_SpeechDefinedData::instance.AmbientSounds[ambientSoundIndexUnk].volumeUnk_0x28
22+
[DAT_SpeechDefinedData::instance.AmbientSounds[ambientSoundIndexUnk].variationIndex];
2323
if (DAT_GameCore::instance.currentMenuViewType == UI::Enums::MVT_HISTORIC_MISSION_PICTURE
2424
|| DAT_GameCore::instance.currentMenuViewType == UI::Enums::MVT_HISTORIC_MISSION_INTRO
2525
|| DAT_GameCore::instance.currentMenuViewType == UI::Enums::MVT_HISTORIC_CAMPAIGN_INTRO) {

‎src/OpenSHC/Audio/SFX/SFXState/playUnitSpeech.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ namespace Audio {
184184
int numberOfVariations = DAT_SpeechDefinedData::instance.UnitSpeech[actionID].numberOfVariations;
185185
if (1 < numberOfVariations) {
186186
/* Calculate action speech variation. */
187-
variationIndex
188-
= DAT_SpeechDefinedData::instance.UnitSpeech[actionID].variationCounter[_soundSet]++;
187+
variationIndex = DAT_SpeechDefinedData::instance.UnitSpeech[actionID].variationCounter[_soundSet]++;
189188
if (DAT_SpeechDefinedData::instance.UnitSpeech[actionID].variationCounter[_soundSet]
190189
>= numberOfVariations) {
191190
DAT_SpeechDefinedData::instance.UnitSpeech[actionID].variationCounter[_soundSet] = 0;

‎src/OpenSHC/Audio/SFX/SFXState/tweakVolume.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ namespace Audio {
4040
if (DAT_SpeechDefinedData::instance.field10_0x49d4b4 == 7) {
4141
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
4242
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_2Unk,
43-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[5]
44-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[5].variationIndex]
43+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[5].volumeUnk_0x28
44+
[DAT_SpeechDefinedData::instance.AmbientSounds[5].variationIndex]
4545
* FLOAT_00b986e8::instance)
4646
/ 100.0));
4747
}
4848
if (DAT_SpeechDefinedData::instance.field10_0x49d4b4 == 8) {
4949
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
5050
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_2Unk,
51-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[6]
52-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[6].variationIndex]
51+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[6].volumeUnk_0x28
52+
[DAT_SpeechDefinedData::instance.AmbientSounds[6].variationIndex]
5353
* FLOAT_00b986e8::instance)
5454
/ 100.0));
5555
}
@@ -67,16 +67,16 @@ namespace Audio {
6767
if (DAT_SpeechDefinedData::instance.field10_0x49d4b4 == 7) {
6868
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
6969
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_2Unk,
70-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[5]
71-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[5].variationIndex]
70+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[5].volumeUnk_0x28
71+
[DAT_SpeechDefinedData::instance.AmbientSounds[5].variationIndex]
7272
* FLOAT_00b986e8::instance)
7373
/ 100.0));
7474
}
7575
if (DAT_SpeechDefinedData::instance.field10_0x49d4b4 == 8) {
7676
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
7777
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_2Unk,
78-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[6]
79-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[6].variationIndex]
78+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[6].volumeUnk_0x28
79+
[DAT_SpeechDefinedData::instance.AmbientSounds[6].variationIndex]
8080
* FLOAT_00b986e8::instance)
8181
/ 100.0));
8282
}

‎src/OpenSHC/Audio/SFX/SFXState/updateAmbientSoundStream.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ namespace Audio {
115115
if (DAT_SpeechDefinedData::instance.currentStreamID == 6) {
116116
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
117117
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_1Unk,
118-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[4]
119-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[4].variationIndex]
118+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[4].volumeUnk_0x28
119+
[DAT_SpeechDefinedData::instance.AmbientSounds[4].variationIndex]
120120
* FLOAT_00b986f8::instance)
121121
/ 100.0));
122122
}
123123
if (DAT_SpeechDefinedData::instance.currentStreamID == 5) {
124124
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
125125
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_1Unk,
126-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[3]
127-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[3].variationIndex]
126+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[3].volumeUnk_0x28
127+
[DAT_SpeechDefinedData::instance.AmbientSounds[3].variationIndex]
128128
* FLOAT_00b986f8::instance)
129129
/ 100.0));
130130
}
@@ -142,16 +142,16 @@ namespace Audio {
142142
if (DAT_SpeechDefinedData::instance.currentStreamID == 6) {
143143
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
144144
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_1Unk,
145-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[4]
146-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[4].variationIndex]
145+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[4].volumeUnk_0x28
146+
[DAT_SpeechDefinedData::instance.AmbientSounds[4].variationIndex]
147147
* FLOAT_00b986f8::instance)
148148
/ 100.0));
149149
}
150150
if (DAT_SpeechDefinedData::instance.currentStreamID == 5) {
151151
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::setStreamAndSampleVolumeUnk,
152152
DAT_SoundSystemState::ptr)(MSS::enums::SND_STR_SFX_1Unk,
153-
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[3]
154-
.volumeUnk_0x28[DAT_SpeechDefinedData::instance.AmbientSounds[3].variationIndex]
153+
(int)((DAT_SpeechDefinedData::instance.AmbientSounds[3].volumeUnk_0x28
154+
[DAT_SpeechDefinedData::instance.AmbientSounds[3].variationIndex]
155155
* FLOAT_00b986f8::instance)
156156
/ 100.0));
157157
}

‎src/OpenSHC/Audio/mss/SoundSystem/playMusicFileByName.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ namespace Audio {
2323
if (this->musicFadeState == 1) {
2424
this->streamFileVolumeNextUnk_0x48[0] = 0;
2525
} else {
26-
this->streamFileVolumeNextUnk_0x48[0] = (this->musicVolumePercent * this->currIdSoundFileVolumeUnk_0x150) / 100;
26+
this->streamFileVolumeNextUnk_0x48[0]
27+
= (this->musicVolumePercent * this->currIdSoundFileVolumeUnk_0x150) / 100;
2728
}
2829
MACRO_CALL_MEMBER(SoundSystem_Func::playSoundStreamUnk, this)(enums::SND_STR_MUSIC, filename, 0);
29-
this->streamFileVolumeNextUnk_0x48[0] = (this->musicVolumePercent * this->currIdSoundFileVolumeUnk_0x150) / 100;
30+
this->streamFileVolumeNextUnk_0x48[0]
31+
= (this->musicVolumePercent * this->currIdSoundFileVolumeUnk_0x150) / 100;
3032
}
3133

3234
}

‎src/OpenSHC/Audio/mss/SoundSystem/playRandomAmbientMusic.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ namespace Audio {
152152
if (DAT_SoundEffectsHelperData1::instance.playerTroopValueBaseline < 1) {
153153
DAT_SoundEffectsHelperData1::instance.playerTroopValueBaseline = 1;
154154
}
155-
int somePercentage1
156-
= (currentPlayerTotalTroopValue * 100) / DAT_SoundEffectsHelperData1::instance.playerTroopValueBaseline;
155+
int somePercentage1 = (currentPlayerTotalTroopValue * 100)
156+
/ DAT_SoundEffectsHelperData1::instance.playerTroopValueBaseline;
157157
if (100 < somePercentage1) {
158158
somePercentage1 = 100;
159159
}
@@ -215,8 +215,8 @@ namespace Audio {
215215
return;
216216
}
217217

218-
if (timeGetTime() - this->lastMusicChangeTime
219-
<= DAT_SFXDefinedData::instance.MusicDelays[DAT_SoundEffectsHelperData1::instance.musicDelayIndex]) {
218+
if (timeGetTime() - this->lastMusicChangeTime <= DAT_SFXDefinedData::instance
219+
.MusicDelays[DAT_SoundEffectsHelperData1::instance.musicDelayIndex]) {
220220
return;
221221
}
222222

@@ -290,8 +290,8 @@ namespace Audio {
290290
return;
291291
}
292292

293-
if (timeGetTime() - this->lastMusicChangeTime
294-
<= DAT_SFXDefinedData::instance.MusicDelays[DAT_SoundEffectsHelperData1::instance.musicDelayIndex]) {
293+
if (timeGetTime() - this->lastMusicChangeTime <= DAT_SFXDefinedData::instance
294+
.MusicDelays[DAT_SoundEffectsHelperData1::instance.musicDelayIndex]) {
295295
return;
296296
}
297297

‎src/OpenSHC/Audio/mss/SoundSystem/playRandomBackgroundMusicUnk.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,14 @@ namespace Audio {
161161
}
162162
int iVar1 = DAT_SFXDefinedData::instance.field3_0x4a4[i];
163163
int battleMoodState = DAT_SoundEffectsHelperData1::instance.battleMoodState;
164-
if ((iVar1 == 1 && iVar1 == battleMoodState) || (iVar1 == 2 && iVar1 == battleMoodState)) {
164+
if ((iVar1 == 1 && iVar1 == battleMoodState)
165+
|| (iVar1 == 2 && iVar1 == battleMoodState)) {
165166
continue;
166167
}
167168
aiStack_50[iVar6++] = i;
168-
if (field6_0x34 == 1 && iVar1 == 2) {
169+
if (battleMoodState == 1 && iVar1 == 2) {
169170
aiStack_50[iVar6++] = i;
170-
} else if (field6_0x34 == 2 && iVar1 == 1) {
171+
} else if (battleMoodState == 2 && iVar1 == 1) {
171172
aiStack_50[iVar6++] = i;
172173
}
173174
}

‎src/OpenSHC/Audio/mss/SoundSystem/playSpeechSfx.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ namespace Audio {
3939
this->streamFileVolumeNextUnk_0x48[4] = nextVolume;
4040
MACRO_CALL_MEMBER(SoundSystem_Func::playSoundStreamUnk, this)(
4141
(SHC_SoundStream)DAT_SFXDefinedData::instance.speechStreamCursor, soundFileName, 1);
42-
DAT_SoundSystemState::instance.lastUsedSpeechStreamUnk_0x3284 = DAT_SFXDefinedData::instance.speechStreamCursor;
42+
DAT_SoundSystemState::instance.lastUsedSpeechStreamUnk_0x3284
43+
= DAT_SFXDefinedData::instance.speechStreamCursor;
4344
}
4445
}
4546

‎src/OpenSHC/Global/PrintToDestination.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
namespace OpenSHC {
55

66
// FUNCTION: STRONGHOLDCRUSADER 0x0045D060
7-
void Global::PrintToDestination(wchar_t* destination, wchar_t* format, ...)
7+
void Global::PrintToDestination(wchar_t* destination, wchar_t const* format, ...)
88
{
99
va_list args;
1010
va_start(args, format);
11-
MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, format, args);
11+
MACRO_CALL(OpenSHC::OS_Func::__vswprintf)(destination, (wchar_t*)format, args);
1212
}
1313

1414
}

‎src/OpenSHC/Util/Timing/Stopwatch/start.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace OpenSHC {
66
namespace Util {
77
namespace Timing {
8-
8+
99
using OpenSHC::WindowsHelper::Enums::BOOLEnum;
10-
10+
1111
// FUNCTION: STRONGHOLDCRUSADER 0x0046CED0
1212
void Stopwatch::start()
1313
{

0 commit comments

Comments
 (0)