better load screen and animations (offline download compatible!!!)

This commit is contained in:
ParadoxGitHub 2023-03-15 22:25:18 -04:00
parent 6277394d76
commit cd49f4229c
11 changed files with 25155 additions and 24623 deletions

BIN
javascript/Aller_Bd.ttf Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

258
javascript/animTest.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -469,4 +469,12 @@ public class PlatformRuntime {
public static void toggleRec() { public static void toggleRec() {
// //
} }
public static void showMojangScreen(){
//
}
public static void removeLoadScreen(){
//
}
} }

View File

@ -29,6 +29,7 @@ import dev.resent.util.misc.W;
import dev.resent.visual.ui.clickgui.PreGUI; import dev.resent.visual.ui.clickgui.PreGUI;
import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.IOUtils; import net.lax1dude.eaglercraft.v1_8.IOUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard; import net.lax1dude.eaglercraft.v1_8.Keyboard;
@ -459,6 +460,9 @@ public class Minecraft implements IThreadListener {
this.renderEngine.deleteTexture(this.mojangLogo); this.renderEngine.deleteTexture(this.mojangLogo);
this.mojangLogo = null; this.mojangLogo = null;
this.loadingScreen = new LoadingScreenRenderer(this); this.loadingScreen = new LoadingScreenRenderer(this);
PlatformRuntime.removeLoadScreen();
EagUtils.sleep(200l);
} }
private void registerMetadataSerializers() { private void registerMetadataSerializers() {
@ -609,6 +613,11 @@ public class Minecraft implements IThreadListener {
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
GlStateManager.alphaFunc(GL_GREATER, 0.1F); GlStateManager.alphaFunc(GL_GREATER, 0.1F);
this.updateDisplay(); this.updateDisplay();
PlatformRuntime.showMojangScreen();
EagUtils.sleep(200l);
} }
public void func_181536_a(int parInt1, int parInt2, int parInt3, int parInt4, int parInt5, int parInt6, int parInt7, public void func_181536_a(int parInt1, int parInt2, int parInt3, int parInt4, int parInt5, int parInt6, int parInt7,

View File

@ -95,8 +95,8 @@ public class PlatformInput {
public static boolean keyboardLockSupported = false; public static boolean keyboardLockSupported = false;
public static boolean lockKeys = false; public static boolean lockKeys = false;
@JSBody(params = {}, script = "window.onbeforeunload = () => {return false;};") @JSBody(params = {}, script = "")
private static native void onBeforeCloseRegister(); private static native void onBeforeCloseRegister();
static void initHooks(Window window, HTMLCanvasElement canvaz) { static void initHooks(Window window, HTMLCanvasElement canvaz) {
@ -605,7 +605,7 @@ public class PlatformInput {
if (mouseEvents.isEmpty() && keyEvents.isEmpty() && !hasBeenActive()) { if (mouseEvents.isEmpty() && keyEvents.isEmpty() && !hasBeenActive()) {
EarlyLoadScreen.paintEnable(); EarlyLoadScreen.paintEnable();
while (mouseEvents.isEmpty() && keyEvents.isEmpty()) { while (!checkIfSiteInteractionHappened()) {
EagUtils.sleep(100l); EagUtils.sleep(100l);
} }
} }
@ -616,6 +616,9 @@ public class PlatformInput {
keyEvents.clear(); keyEvents.clear();
} }
@JSBody(params = {}, script = "return returnHasSiteInteractionHappened()")
private static native boolean checkIfSiteInteractionHappened();
@JSBody(params = {}, script = "return window.matchMedia('(display-mode: fullscreen)');") @JSBody(params = {}, script = "return window.matchMedia('(display-mode: fullscreen)');")
private static native JSObject fullscreenMediaQuery(); private static native JSObject fullscreenMediaQuery();

View File

@ -35,6 +35,7 @@ import com.jcraft.jzlib.InflaterInputStream;
import dev.resent.client.ClientInfo; import dev.resent.client.ClientInfo;
import dev.resent.client.Resent; import dev.resent.client.Resent;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion; import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer; import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.EaglerArrayBufferAllocator; import net.lax1dude.eaglercraft.v1_8.internal.buffer.EaglerArrayBufferAllocator;
@ -152,8 +153,12 @@ public class PlatformRuntime {
throw new RuntimeInitializationFailureException("Could not download EPK file \"" + url + "\""); throw new RuntimeInitializationFailureException("Could not download EPK file \"" + url + "\"");
} }
logger.info("Decompressing: {}", logURL);
remove(); remove();
// give enough time for screen to update and say "decompressing assets"
EagUtils.sleep(50l);
logger.info("Decompressing: {}", logURL);
try { try {
EPKLoader.loadEPK(epkFileData, epkFiles[i].path, PlatformAssets.assets); EPKLoader.loadEPK(epkFileData, epkFiles[i].path, PlatformAssets.assets);
@ -168,10 +173,17 @@ public class PlatformRuntime {
logger.info("Initializing sound engine..."); logger.info("Initializing sound engine...");
enableScreen();
PlatformInput.pressAnyKeyScreen(); PlatformInput.pressAnyKeyScreen();
PlatformAudio.initialize(); PlatformAudio.initialize();
loadingScreen();
// so that animations wont lag
EagUtils.sleep(200l);
if (finalLoadScreen != null) { if (finalLoadScreen != null) {
EarlyLoadScreen.paintFinal(finalLoadScreen); EarlyLoadScreen.paintFinal(finalLoadScreen);
} }
@ -188,6 +200,12 @@ public class PlatformRuntime {
@JSBody( script = "die()") @JSBody( script = "die()")
public static native void remove(); public static native void remove();
@JSBody( script = "enable()")
public static native void enableScreen();
@JSBody( script = "loading()")
public static native void loadingScreen();
@JSBody(params = {}, script = "return {antialias: false, depth: false, powerPreference: \"high-performance\", desynchronized: true, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false};") @JSBody(params = {}, script = "return {antialias: false, depth: false, powerPreference: \"high-performance\", desynchronized: true, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false};")
public static native JSObject youEagler(); public static native JSObject youEagler();
@ -593,4 +611,8 @@ public class PlatformRuntime {
mediaRec = null; mediaRec = null;
} }
} }
@JSBody(params = {}, script = "showMojang();")
public static native void showMojangScreen();
@JSBody(params = {}, script = "die2();")
public static native void removeLoadScreen();
} }

View File

@ -220,7 +220,7 @@ public class MainClass {
HTMLElement el = doc.getElementById(configRootElement); HTMLElement el = doc.getElementById(configRootElement);
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
str.append(ClientInfo.name + " " + ClientInfo.version + "has crashed! DM this crash message to me on discord, my tag is hooman#1196, along with steps to recreate the crash. \n\n"); str.append(ClientInfo.name + " " + ClientInfo.version + " has crashed! DM this crash message to me on discord, my tag is hooman#1196, along with steps to recreate the crash. \n\n");
str.append(t); str.append(t);
str.append('\n').append('\n'); str.append('\n').append('\n');
str.append("eaglercraft.version = \"").append(EaglercraftVersion.projectForkVersion).append("\"\n"); str.append("eaglercraft.version = \"").append(EaglercraftVersion.projectForkVersion).append("\"\n");