some bad sounds

This commit is contained in:
Anuken
2019-08-12 23:29:24 -04:00
parent a1269c05c5
commit a818da5eb7
30 changed files with 920 additions and 841 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 717 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 KiB

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 KiB

After

Width:  |  Height:  |  Size: 575 KiB

@@ -1323,6 +1323,7 @@ public class Blocks implements ContentList{
shootCone = 35f;
health = 200 * size * size;
shootSound = Sounds.shootSnap;
}};
scorch = new ItemTurret("scorch"){{
@@ -1,7 +1,7 @@
package io.anuke.mindustry.core;
import io.anuke.arc.*;
import io.anuke.arc.Application.*;
import io.anuke.arc.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.input.*;
@@ -12,9 +12,9 @@ import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.impl.BaseEntity;
import io.anuke.mindustry.entities.traits.HealthTrait;
import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.*;
import io.anuke.mindustry.game.EventType.BlockDestroyEvent;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.modules.*;
@@ -45,6 +45,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
private boolean dead = false;
private boolean sleeping;
private float sleepTime;
private @Nullable SoundLoop sound;
@Remote(called = Loc.server, unreliable = true)
public static void onTileDamage(Tile tile, float health){
@@ -69,6 +70,9 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
x = tile.drawx();
y = tile.drawy();
block = tile.block();
if(block.idleSound != Sounds.none){
sound = new SoundLoop(block.idleSound, block.idleSoundVolume);
}
health = block.health;
timer = new Interval(block.timers);
@@ -231,6 +235,13 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
return proximity;
}
@Override
public void removed(){
if(sound != null){
sound.stop();
}
}
@Override
public void health(float health){
this.health = health;
@@ -286,6 +297,10 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
return; //no need to update anymore
}
if(sound != null){
sound.update(x, y, block.shouldIdleSound(tile));
}
Block previous = block;
block.update(tile);
if(block == previous && cons != null){
@@ -1,4 +1,49 @@
package io.anuke.mindustry.game;
import io.anuke.arc.audio.*;
import io.anuke.arc.math.*;
import io.anuke.arc.util.*;
/** A simple class for playing a looping sound at a position.*/
public class SoundLoop{
private static final float fadeSpeed = 0.05f;
private final Sound sound;
private long id = -1;
private float volume, baseVolume;
public SoundLoop(Sound sound, float baseVolume){
this.sound = sound;
this.baseVolume = baseVolume;
}
public void update(float x, float y, boolean play){
if(baseVolume < 0) return;
if(id < 0){
if(play){
id = sound.loop(sound.calcVolume(x, y) * volume * baseVolume, 1f, sound.calcPan(x, y));
}
}else{
//fade the sound in or out
if(play){
volume = Mathf.clamp(volume + fadeSpeed * Time.delta());
}else{
volume = Mathf.clamp(volume - fadeSpeed * Time.delta());
if(volume <= 0.001f){
sound.stop(id);
id = -1;
}
}
sound.setPan(id, sound.calcPan(x, y), sound.calcVolume(x, y) * volume * baseVolume);
}
}
public void stop(){
if(id != -1){
sound.stop(id);
id = -1;
volume = baseVolume = -1;
}
}
}
@@ -160,6 +160,7 @@ public abstract class InputHandler implements InputProcessor{
if(((!frag.config.isShown() && tile.block().shouldShowConfigure(tile, player)) //if the config fragment is hidden, show
//alternatively, the current selected block can 'agree' to switch config tiles
|| (frag.config.isShown() && frag.config.getSelectedTile().block().onConfigureTileTapped(frag.config.getSelectedTile(), tile)))){
Sounds.click.at(tile);
frag.config.showConfig(tile);
}
//otherwise...
@@ -184,6 +184,7 @@ public class SettingsMenuDialog extends SettingsDialog{
@Override
public void add(SettingsTable table){
table.addButton("$tutorial.retake", () -> {
hide();
control.playTutorial();
}).size(220f, 60f).pad(6).left();
table.add();
@@ -638,15 +638,17 @@ public class HudFragment extends Fragment{
}
private boolean canSkipWave(){
return state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0 && !world.spawner.isSpawning();
return state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0 && !world.spawner.isSpawning() && !state.rules.tutorial;
}
private void addPlayButton(Table table){
table.right().addImageButton("icon-play", "right", 30f, () -> {
if(Net.client() && player.isAdmin){
Call.onAdminRequest(player, AdminAction.wave);
}else{
}else if(inLaunchWave()){
ui.showConfirm("$confirm", "$launch.skip.confirm", () -> !canSkipWave(), () -> state.wavetime = 0f);
}else{
state.wavetime = 0f;
}
}).growY().fillX().right().width(40f)
.visible(this::canSkipWave);
+10 -1
View File
@@ -99,7 +99,11 @@ public class Block extends BlockStorage{
/** Whether this block has a shadow under it. */
public boolean hasShadow = true;
/** Sounds made when this block breaks.*/
public Sound breakSound = Sounds.die;
public Sound breakSound = Sounds.boom;
/** The sound that this block makes while active.*/
public Sound idleSound = Sounds.none;
/** Idle sound base volume. */
public float idleSoundVolume = 0.5f;
/** Cost of constructing this block. */
public ItemStack[] buildRequirements = new ItemStack[]{};
@@ -207,6 +211,11 @@ public class Block extends BlockStorage{
return progressIncrease;
}
/** @return whether this block should play its idle sound.*/
public boolean shouldIdleSound(Tile tile){
return canProduce(tile);
}
public void drawLayer(Tile tile){
}
@@ -1,17 +1,17 @@
package io.anuke.mindustry.world.blocks.defense;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.Core;
import io.anuke.arc.Graphics.Cursor;
import io.anuke.arc.Graphics.Cursor.SystemCursor;
import io.anuke.arc.*;
import io.anuke.arc.Graphics.*;
import io.anuke.arc.Graphics.Cursor.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.mindustry.content.Fx;
import io.anuke.arc.math.geom.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.Effects.Effect;
import io.anuke.mindustry.entities.Effects.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.world.*;
import java.io.*;
@@ -45,6 +45,7 @@ public class Door extends Wall{
}else{
Effects.effect(door.closefx, tile.drawx(), tile.drawy());
}
Sounds.door.at(tile);
}
}
@@ -64,6 +64,9 @@ public class Drill extends Block{
hasLiquids = true;
liquidCapacity = 5f;
hasItems = true;
//idleSound = Sounds.drill;
//idleSoundVolume = 0.5f;
}
@Override
@@ -17,6 +17,7 @@ import java.util.*;
import static io.anuke.mindustry.Vars.*;
public class DesktopPlatform extends Platform{
static boolean useDiscord = OS.is64Bit;
final static String applicationId = "610508934456934412";
+1 -1
View File
@@ -320,7 +320,7 @@ task pack(dependsOn: classes){
//antialias everything except UI elements
fileTree(dir: '../core/assets-raw/sprites_out/', include: "**/*.png").visit{ file ->
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/"))) return
if(file.isDirectory() || (file.toString().replace("\\", "/").contains("/ui/") && !file.toString().contains("icon-small") && !file.toString().contains("icon-medium") && !file.toString().contains("icon-large"))) return
antialias(file.file)
}