/* */ 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 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 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 */