project: volumes support

This commit is contained in:
Owain van Brakel
2019-10-24 06:47:13 +02:00
parent 90b7775965
commit 45c0774093
18 changed files with 496 additions and 44 deletions

View File

@@ -213,7 +213,8 @@ public final class Client extends GameShell implements Usernamed {
@ObfuscatedGetter(
intValue = 892519291
)
static int field868;
@Export("areaSoundEffectVolume")
static int areaSoundEffectVolume;
@ObfuscatedName("no")
static int[] field820;
@ObfuscatedName("nb")
@@ -363,7 +364,8 @@ public final class Client extends GameShell implements Usernamed {
@ObfuscatedGetter(
intValue = -114703177
)
static int field761;
@Export("musicVolume")
static int musicVolume;
@ObfuscatedName("pu")
@Export("mapIconYs")
static int[] mapIconYs;
@@ -1508,11 +1510,11 @@ public final class Client extends GameShell implements Usernamed {
destinationX = 0;
destinationY = 0;
minimapState = 0;
field761 = 255;
musicVolume = 255;
field666 = -1;
field759 = false;
soundEffectVolume = 127;
field868 = 127;
areaSoundEffectVolume = 127;
soundEffectCount = 0;
soundEffectIds = new int[50];
queuedSoundEffectLoops = new int[50];
@@ -4282,7 +4284,7 @@ public final class Client extends GameShell implements Usernamed {
Varps.Varps_main[var5] = var16;
}
NetSocket.method3472(var5);
NetSocket.changeGameOptions(var5);
field782[++field823 - 1 & 31] = var5;
var1.serverPacket = null;
return true;
@@ -4738,7 +4740,7 @@ public final class Client extends GameShell implements Usernamed {
Varps.Varps_main[var16] = var40;
}
NetSocket.method3472(var16);
NetSocket.changeGameOptions(var16);
field782[++field823 - 1 & 31] = var16;
var1.serverPacket = null;
return true;
@@ -4795,7 +4797,7 @@ public final class Client extends GameShell implements Usernamed {
for (var16 = 0; var16 < Varps.Varps_main.length; ++var16) {
if (Varps.Varps_temp[var16] != Varps.Varps_main[var16]) {
Varps.Varps_main[var16] = Varps.Varps_temp[var16];
NetSocket.method3472(var16);
NetSocket.changeGameOptions(var16);
field782[++field823 - 1 & 31] = var16;
}
}

View File

@@ -704,8 +704,8 @@ public class ClientPacket implements class181 {
)
@Export("playSoundJingle")
static void playSoundJingle(int var0, int var1) {
if (Client.field761 != 0 && var0 != -1) {
class83.method2068(ClanMate.archive11, var0, 0, Client.field761, false);
if (Client.musicVolume != 0 && var0 != -1) {
class83.method2068(ClanMate.archive11, var0, 0, Client.musicVolume, false);
Client.field759 = true;
}

View File

@@ -308,7 +308,7 @@ final class GrandExchangeOfferTotalQuantityComparator implements Comparator {
var9 = var1.method5511();
if (var38 >= 0 && var4 >= 0 && var38 < 104 && var4 < 104) {
var10 = var6 + 1;
if (class223.localPlayer.pathX[0] >= var38 - var10 && class223.localPlayer.pathX[0] <= var10 + var38 && class223.localPlayer.pathY[0] >= var4 - var10 && class223.localPlayer.pathY[0] <= var10 + var4 && Client.field868 != 0 && var7 > 0 && Client.soundEffectCount < 50) {
if (class223.localPlayer.pathX[0] >= var38 - var10 && class223.localPlayer.pathX[0] <= var10 + var38 && class223.localPlayer.pathY[0] >= var4 - var10 && class223.localPlayer.pathY[0] <= var10 + var4 && Client.areaSoundEffectVolume != 0 && var7 > 0 && Client.soundEffectCount < 50) {
Client.soundEffectIds[Client.soundEffectCount] = var8;
Client.queuedSoundEffectLoops[Client.soundEffectCount] = var7;
Client.queuedSoundEffectDelays[Client.soundEffectCount] = var9;

View File

@@ -113,7 +113,7 @@ public class HealthBarUpdate extends Node {
var8 = 0;
}
var2 = (var3 - var8) * Client.field868 / var3;
var2 = (var3 - var8) * Client.areaSoundEffectVolume / var3;
} else {
var2 = Client.soundEffectVolume;
}
@@ -151,8 +151,8 @@ public class HealthBarUpdate extends Node {
}
if (!var12) {
if (Client.field761 != 0 && Client.field666 != -1) {
class83.method2068(class225.archive6, Client.field666, 0, Client.field761, false);
if (Client.musicVolume != 0 && Client.field666 != -1) {
class83.method2068(class225.archive6, Client.field666, 0, Client.musicVolume, false);
}
Client.field759 = false;

View File

@@ -437,7 +437,7 @@ public class InvDefinition extends DualNode {
if (var14.cs1Instructions != null && var14.cs1Instructions[0][0] == 5) {
int var12 = var14.cs1Instructions[0][1];
Varps.Varps_main[var12] = 1 - Varps.Varps_main[var12];
NetSocket.method3472(var12);
NetSocket.changeGameOptions(var12);
}
} else if (opcode == 29) {
PacketBufferNode var8 = InterfaceParent.getPacketBufferNode(ClientPacket.field2261, Client.packetWriter.isaacCipher);
@@ -448,7 +448,7 @@ public class InvDefinition extends DualNode {
int var12 = var14.cs1Instructions[0][1];
if (Varps.Varps_main[var12] != var14.cs1ComparisonValues[0]) {
Varps.Varps_main[var12] = var14.cs1ComparisonValues[0];
NetSocket.method3472(var12);
NetSocket.changeGameOptions(var12);
}
}
} else if (opcode == 30) {

View File

@@ -320,7 +320,7 @@ public final class KeyHandler implements KeyListener, FocusListener {
} else if (var29 == ScriptOpcodes.SET_VARP) {
var11 = var6[var17];
Varps.Varps_main[var11] = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize];
NetSocket.method3472(var11);
NetSocket.changeGameOptions(var11);
} else if (var29 == ScriptOpcodes.SCONST) {
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var3.stringOperands[var17];
} else if (var29 == ScriptOpcodes.JUMP) {

View File

@@ -64,9 +64,9 @@ public class MusicPatchNode2 {
static void playSong(int var0) {
if (var0 == -1 && !Client.field759) {
VertexNormal.method2960();
} else if (var0 != -1 && var0 != Client.field666 && Client.field761 != 0 && !Client.field759) {
} else if (var0 != -1 && var0 != Client.field666 && Client.musicVolume != 0 && !Client.field759) {
Archive var1 = class225.archive6;
int var2 = Client.field761;
int var2 = Client.musicVolume;
class197.field2386 = 1;
class197.musicTrackArchive = var1;
class188.musicTrackGroupId = var0;

View File

@@ -378,7 +378,8 @@ public final class NetSocket extends AbstractSocket implements Runnable {
signature = "(II)V",
garbageValue = "-1514465632"
)
static final void method3472(int var0) {
@Export("changeGameOptions")
static final void changeGameOptions(int var0) {
class325.method6190();
for (ObjectSound var1 = (ObjectSound)ObjectSound.objectSounds.last(); var1 != null; var1 = (ObjectSound)ObjectSound.objectSounds.previous()) {
@@ -436,8 +437,8 @@ public final class NetSocket extends AbstractSocket implements Runnable {
var3 = 0;
}
if (var3 != Client.field761) {
if (Client.field761 == 0 && Client.field666 != -1) {
if (var3 != Client.musicVolume) {
if (Client.musicVolume == 0 && Client.field666 != -1) {
class83.method2068(class225.archive6, Client.field666, 0, var3, false);
Client.field759 = false;
} else if (var3 == 0) {
@@ -449,7 +450,7 @@ public final class NetSocket extends AbstractSocket implements Runnable {
class49.midiPcmStream.method3760(var3);
}
Client.field761 = var3;
Client.musicVolume = var3;
}
}
@@ -489,23 +490,23 @@ public final class NetSocket extends AbstractSocket implements Runnable {
if (var4 == 10) {
if (var2 == 0) {
Client.field868 = 127;
Client.areaSoundEffectVolume = 127;
}
if (var2 == 1) {
Client.field868 = 96;
Client.areaSoundEffectVolume = 96;
}
if (var2 == 2) {
Client.field868 = 64;
Client.areaSoundEffectVolume = 64;
}
if (var2 == 3) {
Client.field868 = 32;
Client.areaSoundEffectVolume = 32;
}
if (var2 == 4) {
Client.field868 = 0;
Client.areaSoundEffectVolume = 0;
}
}

View File

@@ -167,13 +167,13 @@ public class class3 implements Enumerated {
var5 += var4.y * 128 - var2;
}
if (var5 - 64 <= var4.field1061 && Client.field868 != 0 && var0 == var4.plane) {
if (var5 - 64 <= var4.field1061 && Client.areaSoundEffectVolume != 0 && var0 == var4.plane) {
var5 -= 64;
if (var5 < 0) {
var5 = 0;
}
int var6 = (var4.field1061 - var5) * Client.field868 / var4.field1061;
int var6 = (var4.field1061 - var5) * Client.areaSoundEffectVolume / var4.field1061;
if (var4.stream1 == null) {
if (var4.soundEffectId >= 0) {
SoundEffect var7 = SoundEffect.readSoundEffect(GrandExchangeOfferAgeComparator.archive4, var4.soundEffectId, 0);

View File

@@ -122,7 +122,7 @@ public class class30 {
)
@Export("addSequenceSoundEffect")
static void addSequenceSoundEffect(SequenceDefinition var0, int var1, int var2, int var3) {
if (Client.soundEffectCount < 50 && Client.field868 != 0) {
if (Client.soundEffectCount < 50 && Client.areaSoundEffectVolume != 0) {
if (var0.soundEffects != null && var1 < var0.soundEffects.length) {
int var4 = var0.soundEffects[var1];
if (var4 != 0) {