Core launch/land SFX

This commit is contained in:
Anuken
2025-12-11 13:29:32 -05:00
parent 034392c231
commit 90796d041d
13 changed files with 27 additions and 38 deletions

View File

@@ -125,11 +125,10 @@ dependencies{
natives "com.github.Anuken.Arc:natives-android:$arcHash" natives "com.github.Anuken.Arc:natives-android:$arcHash"
natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash" natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash"
def version; def version, highestVersion
def highestVersion;
new File((String)findSdkDir(), "/platforms").eachFileMatch ~/android-\d+/, { new File((String)findSdkDir(), "/platforms").eachFileMatch ~/android-\d+/, {
version = it.name.find(/\d+/).toInteger(); version = it.name.find(/\d+/).toInteger()
highestVersion = version > highestVersion ? version : highestVersion; highestVersion = version > highestVersion ? version : highestVersion
} }
def sdkFile = new File((String)findSdkDir(), "/platforms/android-${highestVersion}/android.jar") def sdkFile = new File((String)findSdkDir(), "/platforms/android-${highestVersion}/android.jar")

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,6 +3,7 @@ package mindustry.audio;
import arc.*; import arc.*;
import arc.audio.*; import arc.audio.*;
import arc.struct.*; import arc.struct.*;
import mindustry.*;
import static mindustry.gen.Sounds.*; import static mindustry.gen.Sounds.*;
@@ -11,12 +12,15 @@ public class SoundPriority{
static int lastGroup = 1; static int lastGroup = 1;
public static void init(){ public static void init(){
//launching should not get interrupted by the loading screen
coreLaunch.setBus(Vars.control.sound.uiBus);
max(7, beamPlasma, shootMeltdown, beamMeltdown); max(7, beamPlasma, shootMeltdown, beamMeltdown);
//priority 3: absolutely do not interrupt these //priority 3: absolutely do not interrupt these
set( set(
3f, 3f,
acceleratorLaunch, acceleratorCharge acceleratorLaunch, acceleratorCharge, coreLand, coreLaunch
); );
//priority 2: long weapon loops and big explosions //priority 2: long weapon loops and big explosions

View File

@@ -1190,7 +1190,7 @@ public class Blocks{
size = 2; size = 2;
ambientSound = Sounds.loopMachineSpin; ambientSound = Sounds.loopMachineSpin;
ambientSoundVolume = 0.09f; ambientSoundVolume = 0.1f;
consumePower(0.20f); consumePower(0.20f);
consumeItems(with(Items.coal, 1, Items.lead, 2, Items.sand, 2)); consumeItems(with(Items.coal, 1, Items.lead, 2, Items.sand, 2));
@@ -1204,7 +1204,7 @@ public class Blocks{
size = 2; size = 2;
envEnabled |= Env.space; envEnabled |= Env.space;
ambientSound = Sounds.loopMachineSpin; ambientSound = Sounds.loopMachineSpin;
ambientSoundVolume = 0.1f; ambientSoundVolume = 0.12f;
consumeItems(with(Items.pyratite, 1, Items.sporePod, 1)); consumeItems(with(Items.pyratite, 1, Items.sporePod, 1));
consumePower(0.40f); consumePower(0.40f);
@@ -1936,7 +1936,7 @@ public class Blocks{
consumePower(3.50f); consumePower(3.50f);
size = 2; size = 2;
consumeItem(Items.phaseFabric).boost(); consumeItem(Items.phaseFabric).boost();
ambientSoundVolume = 0.05f; ambientSoundVolume = 0.08f;
}}; }};
overdriveDome = new OverdriveProjector("overdrive-dome"){{ overdriveDome = new OverdriveProjector("overdrive-dome"){{
@@ -1946,6 +1946,7 @@ public class Blocks{
range = 200f; range = 200f;
speedBoost = 2.5f; speedBoost = 2.5f;
useTime = 300f; useTime = 300f;
ambientSoundVolume = 0.12f;
hasBoost = false; hasBoost = false;
consumeItems(with(Items.phaseFabric, 1, Items.silicon, 1)); consumeItems(with(Items.phaseFabric, 1, Items.silicon, 1));
}}; }};

View File

@@ -216,9 +216,11 @@ public class Control implements ApplicationListener, Loadable{
if(settings.getInt("musicvol") > 0){ if(settings.getInt("musicvol") > 0){
//TODO what to do if another core with different music is already playing? //TODO what to do if another core with different music is already playing?
Music music = core.landMusic(); Music music = core.landMusic();
music.stop(); if(music != null){
music.play(); music.stop();
music.setVolume(settings.getInt("musicvol") / 100f); music.play();
music.setVolume(settings.getInt("musicvol") / 100f);
}
} }
renderer.showLanding(core); renderer.showLanding(core);

View File

@@ -2,7 +2,6 @@ package mindustry.core;
import arc.*; import arc.*;
import arc.assets.loaders.TextureLoader.*; import arc.assets.loaders.TextureLoader.*;
import arc.audio.*;
import arc.files.*; import arc.files.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.Texture.*; import arc.graphics.Texture.*;
@@ -568,11 +567,6 @@ public class Renderer implements ApplicationListener{
launching = true; launching = true;
landTime = landCore.launchDuration(); landTime = landCore.launchDuration();
Music music = landCore.launchMusic();
music.stop();
music.play();
music.setVolume(settings.getInt("musicvol") / 100f);
landCore.beginLaunch(true); landCore.beginLaunch(true);
} }

View File

@@ -1,6 +1,7 @@
package mindustry.world.blocks; package mindustry.world.blocks;
import arc.audio.*; import arc.audio.*;
import arc.util.*;
import mindustry.gen.*; import mindustry.gen.*;
public interface LaunchAnimator{ public interface LaunchAnimator{
@@ -17,13 +18,9 @@ public interface LaunchAnimator{
float launchDuration(); float launchDuration();
default Music landMusic(){ default @Nullable Music landMusic(){
return Musics.land; return Musics.land;
} }
default Music launchMusic(){
return Musics.launch;
}
float zoomLaunch(); float zoomLaunch();
} }

View File

@@ -40,9 +40,8 @@ public class Accelerator extends Block{
/** Override for planets that this block can launch to. If null, the planet's launch candidates are used. */ /** Override for planets that this block can launch to. If null, the planet's launch candidates are used. */
public @Nullable Seq<Planet> launchCandidates; public @Nullable Seq<Planet> launchCandidates;
public Music launchMusic = Musics.coreLaunch;
public Sound lightningSound = new RandomSound(Sounds.acceleratorLightning1, Sounds.acceleratorLightning2, Sounds.shootArc); public Sound lightningSound = new RandomSound(Sounds.acceleratorLightning1, Sounds.acceleratorLightning2, Sounds.shootArc);
public float lightningSoundVolume = 0.9f; public float lightningSoundVolume = 0.85f;
public Sound chargeSound = Sounds.acceleratorCharge; public Sound chargeSound = Sounds.acceleratorCharge;
public Sound launchSound = Sounds.acceleratorLaunch; public Sound launchSound = Sounds.acceleratorLaunch;
public Sound constructSound = Sounds.acceleratorConstruct; public Sound constructSound = Sounds.acceleratorConstruct;
@@ -311,13 +310,7 @@ public class Accelerator extends Block{
@Override @Override
public Music landMusic(){ public Music landMusic(){
//unused return null;
return launchMusic;
}
@Override
public Music launchMusic(){
return launchMusic;
} }
@Override @Override

View File

@@ -56,7 +56,9 @@ public class CoreBlock extends StorageBlock{
public UnitType unitType = UnitTypes.alpha; public UnitType unitType = UnitTypes.alpha;
public float landDuration = 160f; public float landDuration = 160f;
public Music landMusic = Musics.land; public Music landMusic = Musics.land;
public Music launchMusic = Musics.coreLaunch; public float launchSoundVolume = 1f, landSoundVolume = 1f;
public Sound launchSound = Sounds.coreLaunch;
public Sound landSound = Sounds.coreLand;
public Effect launchEffect = Fx.launch; public Effect launchEffect = Fx.launch;
public Interp landZoomInterp = Interp.pow3; public Interp landZoomInterp = Interp.pow3;
@@ -303,11 +305,6 @@ public class CoreBlock extends StorageBlock{
return landMusic; return landMusic;
} }
@Override
public Music launchMusic(){
return launchMusic;
}
@Override @Override
public void beginLaunch(boolean launching){ public void beginLaunch(boolean launching){
cloudSeed = Mathf.random(1f); cloudSeed = Mathf.random(1f);
@@ -316,6 +313,7 @@ public class CoreBlock extends StorageBlock{
} }
if(!headless){ if(!headless){
(launching ? launchSound : landSound).play(launchSoundVolume);
// Add fade-in and fade-out foreground when landing or launching. // Add fade-in and fade-out foreground when landing or launching.
if(renderer.isLaunching()){ if(renderer.isLaunching()){
float margin = 30f; float margin = 30f;

View File

@@ -51,6 +51,7 @@ public class UnitFactory extends UnitBlock{
regionRotated1 = 1; regionRotated1 = 1;
commandable = true; commandable = true;
ambientSound = Sounds.loopUnitBuilding; ambientSound = Sounds.loopUnitBuilding;
ambientSoundVolume = 0.09f;
config(Integer.class, (UnitFactoryBuild build, Integer i) -> { config(Integer.class, (UnitFactoryBuild build, Integer i) -> {
if(!configurable) return; if(!configurable) return;

View File

@@ -26,4 +26,4 @@ org.gradle.caching=true
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
android.enableR8.fullMode=false android.enableR8.fullMode=false
archash=ce729c4fe4 archash=ec20fc49b9