Started organizing CS2/Protocol-related functions

This commit is contained in:
Pazaz 2022-04-25 04:02:02 -04:00
parent 46740027df
commit ef6a5d7385
268 changed files with 5936 additions and 6093 deletions

View file

@ -60,4 +60,76 @@ public class SoundPlayer {
anIntArray68[anInt4451] = 0;
anInt4451++;
}
@OriginalMember(owner = "client!ed", name = "d", descriptor = "(B)V")
public static void loop() {
for (@Pc(5) int local5 = 0; local5 < anInt4451; local5++) {
@Pc(12) int local12 = anIntArray362[local5]--;
if (anIntArray362[local5] >= -10) {
@Pc(79) SynthSound local79 = aClass138Array1[local5];
if (local79 == null) {
local79 = SynthSound.create(client.js5Archive4, anIntArray421[local5], 0);
if (local79 == null) {
continue;
}
anIntArray362[local5] += local79.method3990();
aClass138Array1[local5] = local79;
}
if (anIntArray362[local5] < 0) {
@Pc(209) int local209;
if (anIntArray68[local5] == 0) {
local209 = Preferences.soundEffectVolume;
} else {
@Pc(125) int local125 = (anIntArray68[local5] & 0xFF) * 128;
@Pc(133) int local133 = anIntArray68[local5] >> 8 & 0xFF;
@Pc(141) int local141 = anIntArray68[local5] >> 16 & 0xFF;
@Pc(151) int local151 = local133 * 128 + 64 - PlayerList.self.zFine;
if (local151 < 0) {
local151 = -local151;
}
@Pc(167) int local167 = local141 * 128 + 64 - PlayerList.self.xFine;
if (local167 < 0) {
local167 = -local167;
}
@Pc(180) int local180 = local167 + local151 - 128;
if (local125 < local180) {
anIntArray362[local5] = -100;
continue;
}
if (local180 < 0) {
local180 = 0;
}
local209 = Preferences.ambientSoundsVolume * (local125 - local180) / local125;
}
if (local209 > 0) {
@Pc(223) PcmSound local223 = local79.method3989().method2648(client.resampler);
@Pc(228) SoundPcmStream local228 = Static284.method404(local223, local209);
local228.method396(anIntArray563[local5] - 1);
client.soundStream.method1343(local228);
}
anIntArray362[local5] = -100;
}
} else {
anInt4451--;
for (@Pc(28) int local28 = local5; local28 < anInt4451; local28++) {
anIntArray421[local28] = anIntArray421[local28 + 1];
aClass138Array1[local28] = aClass138Array1[local28 + 1];
anIntArray563[local28] = anIntArray563[local28 + 1];
anIntArray362[local28] = anIntArray362[local28 + 1];
anIntArray68[local28] = anIntArray68[local28 + 1];
}
local5--;
}
}
if (MidiPlayer.jingle && !Static136.method2655()) {
if (Preferences.musicVolume != 0 && MusicPlayer.groupId != -1) {
Static122.method2410(client.js5Archive6, MusicPlayer.groupId, Preferences.musicVolume);
}
MidiPlayer.jingle = false;
} else if (Preferences.musicVolume != 0 && MusicPlayer.groupId != -1 && !Static136.method2655()) {
Protocol.outboundBuffer.p1isaac(137);
Protocol.outboundBuffer.p4(MusicPlayer.groupId);
MusicPlayer.groupId = -1;
}
}
}