Final core launch animation / Added option to skip core animations
This commit is contained in:
@@ -103,8 +103,8 @@ public class Vars implements Loadable{
|
||||
public static final float invasionGracePeriod = 20;
|
||||
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */
|
||||
public static final float minArmorDamage = 0.1f;
|
||||
/** land animation duration */
|
||||
public static final float coreLandDuration = 150f;
|
||||
/** land/launch animation duration */
|
||||
public static final float coreLandDuration = 160f;
|
||||
/** size of tiles in units */
|
||||
public static final int tilesize = 8;
|
||||
/** size of one tile payload (^2) */
|
||||
@@ -142,10 +142,6 @@ public class Vars implements Loadable{
|
||||
public static boolean clientLoaded = false;
|
||||
/** max GL texture size */
|
||||
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. */
|
||||
public static boolean showSectorLandInfo = true;
|
||||
/** Whether to check for memory use before taking screenshots. */
|
||||
|
||||
@@ -184,6 +184,16 @@ public class Fx{
|
||||
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 -> {
|
||||
color(Pal.accent);
|
||||
stroke(3f - e.fin() * 2f);
|
||||
|
||||
@@ -201,7 +201,7 @@ public class Control implements ApplicationListener, Loadable{
|
||||
camera.position.set(core);
|
||||
player.set(core);
|
||||
|
||||
if(showLandAnimation){
|
||||
if(!settings.getBool("skipcoreanimation")){
|
||||
//delay player respawn so animation can play.
|
||||
player.deathTimer = -80f;
|
||||
//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());
|
||||
}
|
||||
|
||||
//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))){
|
||||
state.set(state.is(State.playing) ? State.paused : State.playing);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class Renderer implements ApplicationListener{
|
||||
public TextureRegion[] bubbles = new TextureRegion[16], splashes = new TextureRegion[12];
|
||||
|
||||
private @Nullable CoreBuild landCore;
|
||||
private @Nullable CoreBlock launchCoreType;
|
||||
private Color clearColor = new Color(0f, 0f, 0f, 1f);
|
||||
private float
|
||||
//seed for cloud visuals, 0-1
|
||||
@@ -340,7 +341,7 @@ public class Renderer implements ApplicationListener{
|
||||
float fin = 1f - fout;
|
||||
|
||||
//draw core
|
||||
var block = (CoreBlock)build.block;
|
||||
var block = launching && launchCoreType != null ? launchCoreType : (CoreBlock)build.block;
|
||||
TextureRegion reg = block.fullIcon;
|
||||
float scl = Scl.scl(4f) / camerascale;
|
||||
float shake = 0f;
|
||||
@@ -373,6 +374,15 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
Draw.color();
|
||||
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.alpha(1f);
|
||||
@@ -492,13 +502,16 @@ public class Renderer implements ApplicationListener{
|
||||
cloudSeed = Mathf.random(1f);
|
||||
}
|
||||
|
||||
public void showLaunch(){
|
||||
public void showLaunch(CoreBlock coreType){
|
||||
Vars.ui.hudfrag.showLaunch();
|
||||
launchCoreType = coreType;
|
||||
launching = true;
|
||||
landCore = player.team().core();
|
||||
cloudSeed = Mathf.random(1f);
|
||||
landTime = coreLandDuration;
|
||||
//TODO other stuff.
|
||||
if(landCore != null){
|
||||
Fx.coreLaunchConstruct.at(landCore.x, landCore.y, coreType.size);
|
||||
}
|
||||
}
|
||||
|
||||
public void takeMapScreenshot(){
|
||||
|
||||
@@ -32,6 +32,7 @@ import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.graphics.g3d.PlanetRenderer.*;
|
||||
import static mindustry.ui.dialogs.PlanetDialog.Mode.*;
|
||||
@@ -913,19 +914,38 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}else{
|
||||
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, () -> {
|
||||
var schemCore = universe.getLastLoadout().findCore();
|
||||
from.removeItems(universe.getLastLoadout().requirements());
|
||||
from.removeItems(universe.getLaunchResources());
|
||||
|
||||
launching = true;
|
||||
zoom = 0.5f;
|
||||
if(settings.getBool("skipcoreanimation")){
|
||||
//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
|
||||
renderer.showLaunch();
|
||||
hide();
|
||||
//run with less delay, as the loading animation is delayed by several frames
|
||||
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector));
|
||||
//allow planet dialog to finish hiding before actually launching
|
||||
Time.runTask(5f, () -> {
|
||||
Runnable doLaunch = () -> {
|
||||
renderer.showLaunch(schemCore);
|
||||
//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){
|
||||
|
||||
@@ -448,6 +448,8 @@ public class SettingsMenuDialog extends Dialog{
|
||||
}
|
||||
}
|
||||
|
||||
graphics.checkPref("skipcoreanimation", false);
|
||||
|
||||
if(!mobile){
|
||||
Core.settings.put("swapdiagonal", false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user