generated from MrSphay/codex-agent-repository-kit
112 lines
4.4 KiB
Java
112 lines
4.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package com.vinlanx.explosionoverhaul.mixin;
|
|
|
|
import com.sonicether.soundphysics.SoundPhysics;
|
|
import com.vinlanx.explosionoverhaul.client.SoundPhysicsCompatibility;
|
|
import org.lwjgl.openal.AL10;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
@Mixin(value={SoundPhysics.class}, remap=false)
|
|
public abstract class SoundPhysicsEnvironmentMixin {
|
|
@Inject(method={"setEnvironment"}, at={@At(value="HEAD")})
|
|
private static void onSetEnvironment(int sourceID, float sg0, float sg1, float sg2, float sg3, float sc0, float sc1, float sc2, float sc3, float dc, float dg, CallbackInfo ci) {
|
|
SoundPhysicsCompatibility.cacheParams(sourceID, sg0, sg1, sg2, sg3, sc0, sc1, sc2, sc3, dc, dg);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=0, argsOnly=true)
|
|
private static float modifySendGain0(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineGain(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=1, argsOnly=true)
|
|
private static float modifySendGain1(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineGain(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=2, argsOnly=true)
|
|
private static float modifySendGain2(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineGain(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=3, argsOnly=true)
|
|
private static float modifySendGain3(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineGain(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=4, argsOnly=true)
|
|
private static float modifySendCutoff0(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineHF(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=5, argsOnly=true)
|
|
private static float modifySendCutoff1(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineHF(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=6, argsOnly=true)
|
|
private static float modifySendCutoff2(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineHF(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=7, argsOnly=true)
|
|
private static float modifySendCutoff3(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineHF(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=8, argsOnly=true)
|
|
private static float modifyDirectCutoff(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineHF(value);
|
|
}
|
|
|
|
@ModifyVariable(method={"setEnvironment"}, at=@At(value="HEAD"), ordinal=9, argsOnly=true)
|
|
private static float modifyDirectGain(float value, int sourceID) {
|
|
if (SoundPhysicsEnvironmentMixin.isRelative(sourceID)) {
|
|
return value;
|
|
}
|
|
return SoundPhysicsCompatibility.combineGain(value);
|
|
}
|
|
|
|
private static boolean isRelative(int sourceID) {
|
|
try {
|
|
return AL10.alGetSourcei((int)sourceID, (int)514) == 1;
|
|
}
|
|
catch (Throwable ignored) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|