Final core launch animation / Added option to skip core animations

This commit is contained in:
Anuken
2021-07-27 19:02:04 -04:00
parent 497a68e792
commit 5ca5025fb1
7 changed files with 65 additions and 18 deletions
+1
View File
@@ -835,6 +835,7 @@ category.items = Items
category.crafting = Input/Output category.crafting = Input/Output
category.function = Function category.function = Function
category.optional = Optional Enhancements category.optional = Optional Enhancements
setting.skipcoreanimation.name = Skip Core Launch/Land Animation
setting.landscape.name = Lock Landscape setting.landscape.name = Lock Landscape
setting.shadows.name = Shadows setting.shadows.name = Shadows
setting.blockreplace.name = Automatic Block Suggestions setting.blockreplace.name = Automatic Block Suggestions
+2 -6
View File
@@ -103,8 +103,8 @@ public class Vars implements Loadable{
public static final float invasionGracePeriod = 20; public static final float invasionGracePeriod = 20;
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */ /** min armor fraction damage; e.g. 0.05 = at least 5% damage */
public static final float minArmorDamage = 0.1f; public static final float minArmorDamage = 0.1f;
/** land animation duration */ /** land/launch animation duration */
public static final float coreLandDuration = 150f; public static final float coreLandDuration = 160f;
/** size of tiles in units */ /** size of tiles in units */
public static final int tilesize = 8; public static final int tilesize = 8;
/** size of one tile payload (^2) */ /** size of one tile payload (^2) */
@@ -142,10 +142,6 @@ public class Vars implements Loadable{
public static boolean clientLoaded = false; public static boolean clientLoaded = false;
/** max GL texture size */ /** max GL texture size */
public static int maxTextureSize = 2048; public static int maxTextureSize = 2048;
/** Whether to show the core landing animation. */
public static boolean showLandAnimation = true;
/** Whether to show the campaign core launch animation. */
public static boolean showLaunchAnimation = true;
/** Whether to show sector info upon landing. */ /** Whether to show sector info upon landing. */
public static boolean showSectorLandInfo = true; public static boolean showSectorLandInfo = true;
/** Whether to check for memory use before taking screenshots. */ /** Whether to check for memory use before taking screenshots. */
+10
View File
@@ -184,6 +184,16 @@ public class Fx{
Lines.square(e.x, e.y, tilesize / 2f * e.rotation + e.fin() * 3f); Lines.square(e.x, e.y, tilesize / 2f * e.rotation + e.fin() * 3f);
}), }),
coreLaunchConstruct = new Effect(35, e -> {
color(Pal.accent);
stroke(4f - e.fin() * 3f);
Lines.square(e.x, e.y, tilesize / 2f * e.rotation * 1.2f + e.fin() * 5f);
randLenVectors(e.id, 5 + (int)(e.rotation * 5), e.rotation * 3f + (tilesize * e.rotation) * e.finpow() * 1.5f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * (4f + e.rotation));
});
}),
tapBlock = new Effect(12, e -> { tapBlock = new Effect(12, e -> {
color(Pal.accent); color(Pal.accent);
stroke(3f - e.fin() * 2f); stroke(3f - e.fin() * 2f);
+6 -1
View File
@@ -201,7 +201,7 @@ public class Control implements ApplicationListener, Loadable{
camera.position.set(core); camera.position.set(core);
player.set(core); player.set(core);
if(showLandAnimation){ if(!settings.getBool("skipcoreanimation")){
//delay player respawn so animation can play. //delay player respawn so animation can play.
player.deathTimer = -80f; player.deathTimer = -80f;
//TODO this sounds pretty bad due to conflict //TODO this sounds pretty bad due to conflict
@@ -544,6 +544,11 @@ public class Control implements ApplicationListener, Loadable{
core.items.each((i, a) -> i.unlock()); core.items.each((i, a) -> i.unlock());
} }
//cannot launch while paused
if(state.is(State.paused) && renderer.isCutscene()){
state.set(State.playing);
}
if(Core.input.keyTap(Binding.pause) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){ if(Core.input.keyTap(Binding.pause) && !renderer.isCutscene() && !scene.hasDialog() && !scene.hasKeyboard() && !ui.restart.isShown() && (state.is(State.paused) || state.is(State.playing))){
state.set(state.is(State.playing) ? State.paused : State.playing); state.set(state.is(State.playing) ? State.paused : State.playing);
} }
+16 -3
View File
@@ -51,6 +51,7 @@ public class Renderer implements ApplicationListener{
public TextureRegion[] bubbles = new TextureRegion[16], splashes = new TextureRegion[12]; public TextureRegion[] bubbles = new TextureRegion[16], splashes = new TextureRegion[12];
private @Nullable CoreBuild landCore; private @Nullable CoreBuild landCore;
private @Nullable CoreBlock launchCoreType;
private Color clearColor = new Color(0f, 0f, 0f, 1f); private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float private float
//seed for cloud visuals, 0-1 //seed for cloud visuals, 0-1
@@ -340,7 +341,7 @@ public class Renderer implements ApplicationListener{
float fin = 1f - fout; float fin = 1f - fout;
//draw core //draw core
var block = (CoreBlock)build.block; var block = launching && launchCoreType != null ? launchCoreType : (CoreBlock)build.block;
TextureRegion reg = block.fullIcon; TextureRegion reg = block.fullIcon;
float scl = Scl.scl(4f) / camerascale; float scl = Scl.scl(4f) / camerascale;
float shake = 0f; float shake = 0f;
@@ -373,6 +374,15 @@ public class Renderer implements ApplicationListener{
Draw.color(); Draw.color();
Draw.mixcol(Color.white, Interp.pow5In.apply(fout)); Draw.mixcol(Color.white, Interp.pow5In.apply(fout));
//accent tint indicating that the core was just constructed
if(launching){
float f = Mathf.clamp(1f - fout * 12f);
if(f > 0.001f){
Draw.mixcol(Pal.accent, f);
}
}
Draw.scl(scl); Draw.scl(scl);
Draw.alpha(1f); Draw.alpha(1f);
@@ -492,13 +502,16 @@ public class Renderer implements ApplicationListener{
cloudSeed = Mathf.random(1f); cloudSeed = Mathf.random(1f);
} }
public void showLaunch(){ public void showLaunch(CoreBlock coreType){
Vars.ui.hudfrag.showLaunch(); Vars.ui.hudfrag.showLaunch();
launchCoreType = coreType;
launching = true; launching = true;
landCore = player.team().core(); landCore = player.team().core();
cloudSeed = Mathf.random(1f); cloudSeed = Mathf.random(1f);
landTime = coreLandDuration; landTime = coreLandDuration;
//TODO other stuff. if(landCore != null){
Fx.coreLaunchConstruct.at(landCore.x, landCore.y, coreType.size);
}
} }
public void takeMapScreenshot(){ public void takeMapScreenshot(){
@@ -32,6 +32,7 @@ import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
import static arc.Core.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
import static mindustry.graphics.g3d.PlanetRenderer.*; import static mindustry.graphics.g3d.PlanetRenderer.*;
import static mindustry.ui.dialogs.PlanetDialog.Mode.*; import static mindustry.ui.dialogs.PlanetDialog.Mode.*;
@@ -913,19 +914,38 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}else{ }else{
CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard; CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard;
//TODO load launchFrom sector right before launching so animation is correct
loadouts.show(block, from, () -> { loadouts.show(block, from, () -> {
var schemCore = universe.getLastLoadout().findCore();
from.removeItems(universe.getLastLoadout().requirements()); from.removeItems(universe.getLastLoadout().requirements());
from.removeItems(universe.getLaunchResources()); from.removeItems(universe.getLaunchResources());
launching = true; if(settings.getBool("skipcoreanimation")){
zoom = 0.5f; //just... go there
control.playSector(from, sector);
//hide only after load screen is shown
Time.runTask(8f, this::hide);
}else{
//hide immediately so launch sector is visible
hide();
//TODO //allow planet dialog to finish hiding before actually launching
renderer.showLaunch(); Time.runTask(5f, () -> {
hide(); Runnable doLaunch = () -> {
//run with less delay, as the loading animation is delayed by several frames renderer.showLaunch(schemCore);
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector)); //run with less delay, as the loading animation is delayed by several frames
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector));
};
//load launchFrom sector right before launching so animation is correct
if(!from.isBeingPlayed()){
//run *after* the loading animation is done
Time.runTask(9f, doLaunch);
control.playSector(from);
}else{
doLaunch.run();
}
});
}
}); });
} }
}else if(mode == select){ }else if(mode == select){
@@ -448,6 +448,8 @@ public class SettingsMenuDialog extends Dialog{
} }
} }
graphics.checkPref("skipcoreanimation", false);
if(!mobile){ if(!mobile){
Core.settings.put("swapdiagonal", false); Core.settings.put("swapdiagonal", false);
} }