Land animation progress / IntelliJ android plugin hack
This commit is contained in:
@@ -107,6 +107,7 @@ importPackage(Packages.mindustry.maps.planet)
|
|||||||
importPackage(Packages.mindustry.net)
|
importPackage(Packages.mindustry.net)
|
||||||
importPackage(Packages.mindustry.service)
|
importPackage(Packages.mindustry.service)
|
||||||
importPackage(Packages.mindustry.type)
|
importPackage(Packages.mindustry.type)
|
||||||
|
importPackage(Packages.mindustry.type.ammo)
|
||||||
importPackage(Packages.mindustry.type.weapons)
|
importPackage(Packages.mindustry.type.weapons)
|
||||||
importPackage(Packages.mindustry.type.weather)
|
importPackage(Packages.mindustry.type.weather)
|
||||||
importPackage(Packages.mindustry.ui)
|
importPackage(Packages.mindustry.ui)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
public @Nullable Bloom bloom;
|
public @Nullable Bloom bloom;
|
||||||
public FrameBuffer effectBuffer = new FrameBuffer();
|
public FrameBuffer effectBuffer = new FrameBuffer();
|
||||||
public boolean animateShields, drawWeather = true, drawStatus;
|
public boolean animateShields, drawWeather = true, drawStatus;
|
||||||
|
public float weatherAlpha;
|
||||||
/** minZoom = zooming out, maxZoom = zooming in */
|
/** minZoom = zooming out, maxZoom = zooming in */
|
||||||
public float minZoom = 1.5f, maxZoom = 6f;
|
public float minZoom = 1.5f, maxZoom = 6f;
|
||||||
public Seq<EnvRenderer> envRenderers = new Seq<>();
|
public Seq<EnvRenderer> envRenderers = new Seq<>();
|
||||||
@@ -51,9 +52,25 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
private @Nullable CoreBuild landCore;
|
private @Nullable CoreBuild landCore;
|
||||||
private Color clearColor = new Color(0f, 0f, 0f, 1f);
|
private Color clearColor = new Color(0f, 0f, 0f, 1f);
|
||||||
private float cloudSeed = 0f;
|
private float
|
||||||
private float targetscale = Scl.scl(4), camerascale = targetscale, landscale, landTime, landPTimer, weatherAlpha, minZoomScl = Scl.scl(0.01f);
|
//seed for cloud visuals, 0-1
|
||||||
private float shakeIntensity, shaketime;
|
cloudSeed = 0f,
|
||||||
|
//target camera scale that is lerp-ed to
|
||||||
|
targetscale = Scl.scl(4),
|
||||||
|
//current actual camera scale
|
||||||
|
camerascale = targetscale,
|
||||||
|
//minimum camera zoom value for landing/launching; constant TODO make larger?
|
||||||
|
minZoomScl = Scl.scl(0.02f),
|
||||||
|
//starts at coreLandDuration, ends at 0. if positive, core is landing.
|
||||||
|
landTime,
|
||||||
|
//timer for core landing particles
|
||||||
|
landPTimer,
|
||||||
|
//intensity for screen shake
|
||||||
|
shakeIntensity,
|
||||||
|
//current duration of screen shake
|
||||||
|
shakeTime;
|
||||||
|
//for landTime > 0: if true, core is currently *launching*, otherwise landing.
|
||||||
|
private boolean isLaunching;
|
||||||
private Vec2 camShakeOffset = new Vec2();
|
private Vec2 camShakeOffset = new Vec2();
|
||||||
|
|
||||||
public Renderer(){
|
public Renderer(){
|
||||||
@@ -63,7 +80,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
public void shake(float intensity, float duration){
|
public void shake(float intensity, float duration){
|
||||||
shakeIntensity = Math.max(shakeIntensity, intensity);
|
shakeIntensity = Math.max(shakeIntensity, intensity);
|
||||||
shaketime = Math.max(shaketime, duration);
|
shakeTime = Math.max(shakeTime, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEnvRenderer(int mask, Runnable render){
|
public void addEnvRenderer(int mask, Runnable render){
|
||||||
@@ -112,9 +129,13 @@ public class Renderer implements ApplicationListener{
|
|||||||
if(!state.isPaused()){
|
if(!state.isPaused()){
|
||||||
landTime -= Time.delta;
|
landTime -= Time.delta;
|
||||||
}
|
}
|
||||||
landscale = landInterp.apply(minZoomScl, Scl.scl(4f), 1f - landTime / coreLandDuration);
|
camerascale = landInterp.apply(minZoomScl, Scl.scl(4f), 1f - landTime / coreLandDuration);
|
||||||
camerascale = landscale;
|
|
||||||
weatherAlpha = 0f;
|
weatherAlpha = 0f;
|
||||||
|
|
||||||
|
//snap camera to cutscene core regardless of player input
|
||||||
|
if(landCore != null){
|
||||||
|
camera.position.set(landCore);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
weatherAlpha = Mathf.lerpDelta(weatherAlpha, 1f, 0.08f);
|
weatherAlpha = Mathf.lerpDelta(weatherAlpha, 1f, 0.08f);
|
||||||
}
|
}
|
||||||
@@ -126,12 +147,12 @@ public class Renderer implements ApplicationListener{
|
|||||||
landTime = 0f;
|
landTime = 0f;
|
||||||
graphics.clear(Color.black);
|
graphics.clear(Color.black);
|
||||||
}else{
|
}else{
|
||||||
if(shaketime > 0){
|
if(shakeTime > 0){
|
||||||
float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * 0.75f;
|
float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * 0.75f;
|
||||||
camShakeOffset.setToRandomDirection().scl(Mathf.random(intensity));
|
camShakeOffset.setToRandomDirection().scl(Mathf.random(intensity));
|
||||||
camera.position.add(camShakeOffset);
|
camera.position.add(camShakeOffset);
|
||||||
shakeIntensity -= 0.25f * Time.delta;
|
shakeIntensity -= 0.25f * Time.delta;
|
||||||
shaketime -= Time.delta;
|
shakeTime -= Time.delta;
|
||||||
shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f);
|
shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f);
|
||||||
}else{
|
}else{
|
||||||
camShakeOffset.setZero();
|
camShakeOffset.setZero();
|
||||||
@@ -148,16 +169,13 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLanding(){
|
/** @return whether a launch/land cutscene is playing. */
|
||||||
|
public boolean isCutscene(){
|
||||||
return landTime > 0;
|
return landTime > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float weatherAlpha(){
|
|
||||||
return weatherAlpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float landScale(){
|
public float landScale(){
|
||||||
return landTime > 0 ? landscale : 1f;
|
return landTime > 0 ? camerascale : 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -290,7 +308,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void drawBackground(){
|
private void drawBackground(){
|
||||||
|
//nothing to draw currently
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLandParticles(){
|
void updateLandParticles(){
|
||||||
@@ -378,7 +396,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
if(state.rules.cloudColor.a > 0.0001f){
|
if(state.rules.cloudColor.a > 0.0001f){
|
||||||
//clouds
|
//clouds
|
||||||
float scaling = cloudScaling;
|
float scaling = cloudScaling;
|
||||||
float sscl = Math.max(1f + Mathf.clamp(fin + cfinOffset)* cfinScl, 0f) * landscale;
|
float sscl = Math.max(1f + Mathf.clamp(fin + cfinOffset)* cfinScl, 0f) * camerascale;
|
||||||
|
|
||||||
Tmp.tr1.set(clouds);
|
Tmp.tr1.set(clouds);
|
||||||
Tmp.tr1.set(
|
Tmp.tr1.set(
|
||||||
@@ -454,11 +472,19 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showLanding(){
|
public void showLanding(){
|
||||||
landscale = minZoomScl;
|
isLaunching = false;
|
||||||
|
camerascale = minZoomScl;
|
||||||
landTime = coreLandDuration;
|
landTime = coreLandDuration;
|
||||||
cloudSeed = Mathf.random(1f);
|
cloudSeed = Mathf.random(1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showLaunch(){
|
||||||
|
isLaunching = true;
|
||||||
|
landCore = player.team().core();
|
||||||
|
cloudSeed = Mathf.random(1f);
|
||||||
|
//TODO other stuff.
|
||||||
|
}
|
||||||
|
|
||||||
public void takeMapScreenshot(){
|
public void takeMapScreenshot(){
|
||||||
int w = world.width() * tilesize, h = world.height() * tilesize;
|
int w = world.width() * tilesize, h = world.height() * tilesize;
|
||||||
int memory = w * h * 4 / 1024 / 1024;
|
int memory = w * h * 4 / 1024 / 1024;
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ public class DesktopInput extends InputHandler{
|
|||||||
panning = false;
|
panning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO awful UI state checking code
|
|
||||||
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||||
if(input.keyDown(Binding.mouse_move)){
|
if(input.keyDown(Binding.mouse_move)){
|
||||||
panCam = true;
|
panCam = true;
|
||||||
@@ -237,7 +236,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player.dead() && !state.isPaused() && !scene.hasField()){
|
if(!player.dead() && !state.isPaused() && !scene.hasField() && !renderer.isCutscene()){
|
||||||
updateMovement(player.unit());
|
updateMovement(player.unit());
|
||||||
|
|
||||||
if(Core.input.keyTap(Binding.respawn)){
|
if(Core.input.keyTap(Binding.respawn)){
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player.dead() && !state.isPaused()){
|
if(!player.dead() && !state.isPaused() && !renderer.isCutscene()){
|
||||||
updateMovement(player.unit());
|
updateMovement(player.unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,7 +822,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
shiftDeltaX %= tilesize;
|
shiftDeltaX %= tilesize;
|
||||||
shiftDeltaY %= tilesize;
|
shiftDeltaY %= tilesize;
|
||||||
}
|
}
|
||||||
}else if(!renderer.isLanding()){
|
}else{
|
||||||
//pan player
|
//pan player
|
||||||
Core.camera.position.x -= deltaX;
|
Core.camera.position.x -= deltaX;
|
||||||
Core.camera.position.y -= deltaY;
|
Core.camera.position.y -= deltaY;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package mindustry.mod;
|
package mindustry.mod;
|
||||||
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.type.ammo.*;
|
|
||||||
|
|
||||||
/** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */
|
/** Generated class. Maps simple class names to concrete classes. For use in JSON mods. */
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class ClassMap{
|
public class ClassMap{
|
||||||
@@ -54,8 +52,6 @@ public class ClassMap{
|
|||||||
classes.put("Research", mindustry.game.Objectives.Research.class);
|
classes.put("Research", mindustry.game.Objectives.Research.class);
|
||||||
classes.put("SectorComplete", mindustry.game.Objectives.SectorComplete.class);
|
classes.put("SectorComplete", mindustry.game.Objectives.SectorComplete.class);
|
||||||
classes.put("AmmoType", mindustry.type.AmmoType.class);
|
classes.put("AmmoType", mindustry.type.AmmoType.class);
|
||||||
classes.put("ItemAmmoType", ItemAmmoType.class);
|
|
||||||
classes.put("PowerAmmoType", PowerAmmoType.class);
|
|
||||||
classes.put("Category", mindustry.type.Category.class);
|
classes.put("Category", mindustry.type.Category.class);
|
||||||
classes.put("ErrorContent", mindustry.type.ErrorContent.class);
|
classes.put("ErrorContent", mindustry.type.ErrorContent.class);
|
||||||
classes.put("Item", mindustry.type.Item.class);
|
classes.put("Item", mindustry.type.Item.class);
|
||||||
@@ -75,6 +71,8 @@ public class ClassMap{
|
|||||||
classes.put("Weapon", mindustry.type.Weapon.class);
|
classes.put("Weapon", mindustry.type.Weapon.class);
|
||||||
classes.put("Weather", mindustry.type.Weather.class);
|
classes.put("Weather", mindustry.type.Weather.class);
|
||||||
classes.put("WeatherEntry", mindustry.type.Weather.WeatherEntry.class);
|
classes.put("WeatherEntry", mindustry.type.Weather.WeatherEntry.class);
|
||||||
|
classes.put("ItemAmmoType", mindustry.type.ammo.ItemAmmoType.class);
|
||||||
|
classes.put("PowerAmmoType", mindustry.type.ammo.PowerAmmoType.class);
|
||||||
classes.put("PointDefenseWeapon", mindustry.type.weapons.PointDefenseWeapon.class);
|
classes.put("PointDefenseWeapon", mindustry.type.weapons.PointDefenseWeapon.class);
|
||||||
classes.put("RepairBeamWeapon", mindustry.type.weapons.RepairBeamWeapon.class);
|
classes.put("RepairBeamWeapon", mindustry.type.weapons.RepairBeamWeapon.class);
|
||||||
classes.put("HealBeamMount", mindustry.type.weapons.RepairBeamWeapon.HealBeamMount.class);
|
classes.put("HealBeamMount", mindustry.type.weapons.RepairBeamWeapon.HealBeamMount.class);
|
||||||
|
|||||||
@@ -342,15 +342,15 @@ public class Weather extends UnlockableContent{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
if(renderer.weatherAlpha() > 0.0001f && renderer.drawWeather && Core.settings.getBool("showweather")){
|
if(renderer.weatherAlpha > 0.0001f && renderer.drawWeather && Core.settings.getBool("showweather")){
|
||||||
Draw.draw(Layer.weather, () -> {
|
Draw.draw(Layer.weather, () -> {
|
||||||
Draw.alpha(renderer.weatherAlpha() * opacity * weather.opacityMultiplier);
|
Draw.alpha(renderer.weatherAlpha * opacity * weather.opacityMultiplier);
|
||||||
weather.drawOver(self());
|
weather.drawOver(self());
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
Draw.draw(Layer.debris, () -> {
|
Draw.draw(Layer.debris, () -> {
|
||||||
Draw.alpha(renderer.weatherAlpha() * opacity * weather.opacityMultiplier);
|
Draw.alpha(renderer.weatherAlpha * opacity * weather.opacityMultiplier);
|
||||||
weather.drawUnder(self());
|
weather.drawUnder(self());
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -920,8 +920,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
launching = true;
|
launching = true;
|
||||||
zoom = 0.5f;
|
zoom = 0.5f;
|
||||||
|
|
||||||
ui.hudfrag.showLaunchDirect();
|
//TODO
|
||||||
//TODO animation; 140 is fine
|
renderer.showLaunch();
|
||||||
|
hide();
|
||||||
Time.runTask(launchDuration, () -> control.playSector(from, sector));
|
Time.runTask(launchDuration, () -> control.playSector(from, sector));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -22,7 +22,11 @@ if(new File(settingsDir, 'local.properties').exists()){
|
|||||||
if(System.getenv("JITPACK") == "true") hasSdk = false
|
if(System.getenv("JITPACK") == "true") hasSdk = false
|
||||||
|
|
||||||
if(hasSdk){
|
if(hasSdk){
|
||||||
include 'android'
|
//hack: pretend the Android module doesn't exist when imported through IntelliJ
|
||||||
|
//why? because IntelliJ chokes on the new version of the Android plugin
|
||||||
|
if(!System.getProperty("jna.tmpdir")?.contains("JetBrains")){
|
||||||
|
include 'android'
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
println("No Android SDK found. Skipping Android module.")
|
println("No Android SDK found. Skipping Android module.")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public class ScriptMainGenerator{
|
|||||||
"mindustry.ai.types",
|
"mindustry.ai.types",
|
||||||
"mindustry.type.weather",
|
"mindustry.type.weather",
|
||||||
"mindustry.type.weapons",
|
"mindustry.type.weapons",
|
||||||
|
"mindustry.type.ammo",
|
||||||
"mindustry.game.Objectives",
|
"mindustry.game.Objectives",
|
||||||
"mindustry.world.blocks",
|
"mindustry.world.blocks",
|
||||||
"mindustry.world.draw",
|
"mindustry.world.draw",
|
||||||
|
|||||||
Reference in New Issue
Block a user