diff options
Diffstat (limited to 'NET/worlds/scape/Surface.java')
| -rw-r--r-- | NET/worlds/scape/Surface.java | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/NET/worlds/scape/Surface.java b/NET/worlds/scape/Surface.java new file mode 100644 index 0000000..5e9dd93 --- /dev/null +++ b/NET/worlds/scape/Surface.java @@ -0,0 +1,290 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import NET.worlds.console.Console; +/* */ import NET.worlds.console.GammaFrame; +/* */ import java.awt.Color; +/* */ import java.io.IOException; +/* */ import java.text.MessageFormat; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class Surface +/* */ extends WObject +/* */ implements Animatable +/* */ { +/* */ private int[] polygonIDs; +/* */ protected Material material; +/* */ +/* */ public Surface(Material m) +/* */ { +/* 58 */ if ((m != null) && (m.getOwner() != null)) { +/* 59 */ m = (Material)m.clone(); +/* */ } +/* 61 */ setMaterial(m); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ static +/* */ { +/* 72 */ nativeInit(); +/* */ } +/* */ +/* */ public void loadInit() { +/* 76 */ setMaterial(null); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ protected void markVoid() +/* */ { +/* 86 */ super.markVoid(); +/* */ +/* */ +/* 89 */ this.polygonIDs = null; +/* */ +/* 91 */ this.material.markVoid(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void recursiveAddRwChildren(WObject container) +/* */ { +/* 100 */ this.material.addRwChildren(); +/* */ +/* 102 */ super.recursiveAddRwChildren(container); +/* */ +/* 104 */ int hres = this.material.getHRes(); +/* 105 */ int vres = this.material.getVRes(); +/* */ +/* */ +/* */ +/* 109 */ int numVerts = getNumVerts(); +/* */ +/* */ +/* 112 */ if ((numVerts == 4) && ((this.material.getHiRes()) || (uvOutOfRange()))) { +/* 113 */ int numTiles = addSubPolys(hres, vres); +/* 114 */ if ((numTiles >= 100) && (Console.getFrame().isShaperVisible())) { +/* 115 */ Object[] arguments = { new Integer(numTiles), +/* 116 */ new String(getRoom().getName()), new String(getName()) }; +/* 117 */ Console.println(MessageFormat.format( +/* 118 */ Console.message("Memory-hog"), arguments)); +/* */ } +/* */ } else { +/* 121 */ assert (numVerts > 0); +/* 122 */ int[] vi = new int[numVerts]; +/* */ +/* 124 */ for (int i = 0; i < numVerts; i++) { +/* 125 */ vi[i] = (i + 1); +/* */ } +/* 127 */ this.polygonIDs = new int[1]; +/* 128 */ addPolygon(vi); +/* */ } +/* */ +/* 131 */ nativeSetMaterial(); +/* 132 */ doneWithEditing(); +/* */ } +/* */ +/* */ protected void setVFlip(boolean b) { +/* 136 */ if (b) { +/* 137 */ this.flags |= 0x100000; +/* */ } else +/* 139 */ this.flags &= 0xFFEFFFFF; +/* */ } +/* */ +/* */ protected void setUFlip(boolean b) { +/* 143 */ if (b) { +/* 144 */ this.flags |= 0x80000; +/* */ } else +/* 146 */ this.flags &= 0xFFF7FFFF; +/* */ } +/* */ +/* */ protected boolean getUFlip() { +/* 150 */ return (this.flags & 0x80000) != 0; +/* */ } +/* */ +/* */ protected boolean getVFlip() { +/* 154 */ return (this.flags & 0x100000) != 0; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public void setMaterial(Material m) +/* */ { +/* 162 */ setMaterial(m, false); +/* */ } +/* */ +/* */ public void setMaterial(Material m, boolean forceReload) { +/* 166 */ if (m == null) { +/* 167 */ m = new Material(new Color((int)(Math.random() * 1.6777216E7D))); +/* 168 */ } else if ((this.material == m) && (!forceReload)) { +/* 169 */ return; +/* */ } +/* 171 */ boolean sameSize = (this.polygonIDs != null) && (this.polygonIDs.length >= 1) && +/* 172 */ (this.material.getHRes() == m.getHRes()) && +/* 173 */ (this.material.getVRes() == m.getVRes()); +/* */ +/* 175 */ if (this.material != m) { +/* 176 */ if (this.material != null) +/* 177 */ this.material.detach(); +/* 178 */ add(m); +/* 179 */ this.material = m; +/* */ } +/* */ +/* 182 */ if (this.polygonIDs != null) { +/* 183 */ if (sameSize) { +/* 184 */ nativeSetMaterial(); +/* */ } else { +/* 186 */ reclump(); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Material getMaterial() +/* */ { +/* 204 */ return this.material; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void getChildren(DeepEnumeration d) +/* */ { +/* 227 */ super.getChildren(d); +/* */ +/* 229 */ d.addChildElement(this.material); +/* */ } +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException +/* */ { +/* 234 */ Object ret = null; +/* 235 */ switch (index - offset) { +/* */ case 0: +/* 237 */ if (mode == 0) { +/* 238 */ ret = new Property(this, index, "Material"); +/* 239 */ } else if (mode == 1) +/* 240 */ ret = this.material; +/* 241 */ break; +/* */ default: +/* 243 */ ret = super.properties(index, offset + 1, mode, value); +/* */ } +/* 245 */ return ret; +/* */ } +/* */ +/* 248 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException { +/* 251 */ s.saveVersion(1, classCookie); +/* 252 */ super.saveState(s); +/* 253 */ s.save(this.material); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException { +/* 257 */ switch (r.restoreVersion(classCookie)) { +/* */ case 1: +/* 259 */ super.restoreState(r); +/* 260 */ setMaterial((Material)r.restore()); +/* 261 */ break; +/* */ case 0: +/* 263 */ super.restoreState(r); +/* 264 */ setMaterial(Material.restore(r)); +/* 265 */ break; +/* */ default: +/* 267 */ throw new TooNewException(); +/* */ } +/* */ } +/* */ +/* */ Surface() {} +/* */ +/* */ public static native void nativeInit(); +/* */ +/* */ private native void nativeSetMaterial(); +/* */ +/* */ private native boolean uvOutOfRange(); +/* */ +/* */ native void addVertex(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5); +/* */ +/* */ native void addPolygon(int[] paramArrayOfInt); +/* */ +/* */ private native int addSubPolys(int paramInt1, int paramInt2); +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Surface.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |