summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ShapeLoader.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/ShapeLoader.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/ShapeLoader.java')
-rw-r--r--NET/worlds/scape/ShapeLoader.java182
1 files changed, 182 insertions, 0 deletions
diff --git a/NET/worlds/scape/ShapeLoader.java b/NET/worlds/scape/ShapeLoader.java
new file mode 100644
index 0000000..6d7d13c
--- /dev/null
+++ b/NET/worlds/scape/ShapeLoader.java
@@ -0,0 +1,182 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.network.URL;
+/* */ import java.util.Enumeration;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class ShapeLoader
+/* */ implements BGLoaded
+/* */ {
+/* */ Shape shape;
+/* */ int binaryParam;
+/* */ private int numTexturesLoading;
+/* */ private Vector<Texture> textures;
+/* */ private boolean wasError;
+/* */
+/* */ public ShapeLoader(Shape s)
+/* */ {
+/* 30 */ this.shape = s;
+/* */ }
+/* */
+/* */
+/* */ public Room getBackgroundLoadRoom()
+/* */ {
+/* 36 */ return this.shape.getRoom();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Object asyncBackgroundLoad(String localName, URL remoteName)
+/* */ {
+/* 50 */ if (localName == null) {
+/* 51 */ return null;
+/* */ }
+/* */
+/* 54 */ if ((remoteName.endsWith(".rwg")) || (remoteName.endsWith(".RWG"))) {
+/* 55 */ this.binaryParam = loadBinaryFile(localName, remoteName);
+/* 56 */ return new Object(); }
+/* 57 */ if ((remoteName.endsWith(".rwx")) || (remoteName.endsWith(".RWX")))
+/* */ {
+/* 59 */ loadTextFile(localName, remoteName);
+/* 60 */ return localName; }
+/* 61 */ if ((remoteName.endsWith(".bod")) || (remoteName.endsWith(".BOD")))
+/* */ {
+/* 63 */ return localName;
+/* */ }
+/* 65 */ return null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public boolean syncBackgroundLoad(Object o, URL remoteURL)
+/* */ {
+/* 79 */ if (o == null) {
+/* 80 */ return false;
+/* */ }
+/* */
+/* 83 */ if (this.numTexturesLoading > 0) {
+/* 84 */ return true;
+/* */ }
+/* */
+/* */
+/* */
+/* 89 */ if (!remoteURL.equals(this.shape.realFile)) {
+/* 90 */ this.wasError = true;
+/* 91 */ } else if ((!this.shape.hasClump()) && (this.shape.isDefault))
+/* */ {
+/* 93 */ this.wasError = true;
+/* */
+/* */
+/* 96 */ if (!this.shape.isLoaded()) {
+/* 97 */ this.shape.setState(0, null);
+/* */ }
+/* */ }
+/* */ int newModel;
+/* */ int newModel;
+/* 102 */ if ((o instanceof String)) { int newModel;
+/* 103 */ if (!this.wasError) { int newModel;
+/* 104 */ if (remoteURL.endsWith(".bod")) {
+/* 105 */ newModel = loadBodFile((String)o, this.shape.getBodPartNum());
+/* */ } else
+/* 107 */ newModel = finishLoadingTextFile((String)o);
+/* */ } else {
+/* 109 */ newModel = 0;
+/* */ }
+/* 111 */ } else { newModel = finishLoadingBinaryFile(this.binaryParam, this.wasError);
+/* */ }
+/* */
+/* 114 */ if (newModel != 0) {
+/* 115 */ this.shape.setState(newModel, this.textures);
+/* */ }
+/* 117 */ if ((newModel == 0) || (newModel == -1))
+/* */ {
+/* 119 */ if (this.textures != null)
+/* */ {
+/* 121 */ for (Enumeration<Texture> en = this.textures.elements(); en.hasMoreElements();) {
+/* 122 */ ((Texture)en.nextElement()).decRef();
+/* */ }
+/* */ }
+/* */ }
+/* 126 */ this.textures = null;
+/* */
+/* 128 */ return false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private void startTextureLoad(String relName, URL remoteName)
+/* */ {
+/* 139 */ this.numTexturesLoading += 1;
+/* */
+/* */
+/* 142 */ BackgroundLoader.get(new ShapeTextureLoader(this),
+/* 143 */ URL.make(remoteName, relName),
+/* 144 */ true);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ synchronized void textureLoadEnd(Texture tex)
+/* */ {
+/* 157 */ this.numTexturesLoading -= 1;
+/* 158 */ if (tex != null) {
+/* 159 */ if (this.textures == null)
+/* 160 */ this.textures = new Vector();
+/* 161 */ this.textures.addElement(tex);
+/* */ } else {
+/* 163 */ this.wasError = true;
+/* */ }
+/* */ }
+/* */
+/* */ private native void loadTextFile(String paramString, URL paramURL);
+/* */
+/* */ private native int finishLoadingTextFile(String paramString);
+/* */
+/* */ private native int loadBodFile(String paramString, int paramInt);
+/* */
+/* */ private native int loadBinaryFile(String paramString, URL paramURL);
+/* */
+/* */ private native int finishLoadingBinaryFile(int paramInt, boolean paramBoolean);
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\ShapeLoader.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file