summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/Material.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/Material.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/Material.java')
-rw-r--r--NET/worlds/scape/Material.java1053
1 files changed, 1053 insertions, 0 deletions
diff --git a/NET/worlds/scape/Material.java b/NET/worlds/scape/Material.java
new file mode 100644
index 0000000..6522e41
--- /dev/null
+++ b/NET/worlds/scape/Material.java
@@ -0,0 +1,1053 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.Main;
+/* */ import NET.worlds.console.MainCallback;
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.network.NetUpdate;
+/* */ import NET.worlds.network.URL;
+/* */ import java.awt.Color;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class Material
+/* */ extends SuperRoot
+/* */ implements BGLoaded, MainCallback
+/* */ {
+/* */ static
+/* */ {
+/* 131 */ nativeInit();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static native void nativeInit();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Material(float ambient, float diffuse, float specular, Color color, Texture texture, float opacity, boolean smooth, boolean filter)
+/* */ {
+/* 157 */ if (botMode) {
+/* 158 */ texture = null;
+/* */ }
+/* 160 */ this.ambient = ambient;
+/* 161 */ this.diffuse = diffuse;
+/* 162 */ this.specular = specular;
+/* 163 */ setColor(color);
+/* 164 */ if (texture != null) {
+/* 165 */ this.textures = new Texture[1];
+/* 166 */ this.textures[0] = texture;
+/* */ }
+/* 168 */ this.opacity = opacity;
+/* 169 */ this.smooth = smooth;
+/* 170 */ this.filter = filter;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Material(Color color)
+/* */ {
+/* 181 */ this(0.75F, 0.0F, 0.0F, color, null, 1.0F, false, false);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Material(Texture texture)
+/* */ {
+/* 191 */ this(0.75F, 0.0F, 0.0F, Color.black, texture, 1.0F, false, false);
+/* */ }
+/* */
+/* */ public Material(Color initialColor, URL textureName) {
+/* 195 */ this(initialColor != null ? initialColor : new Color(128, 128, 128));
+/* 196 */ if (!botMode)
+/* 197 */ loadTexture(textureName);
+/* */ }
+/* */
+/* 200 */ static int serial = 0;
+/* */
+/* */ public Material(URL tileTexture, int x, int y)
+/* */ {
+/* 204 */ this(0.75F, 0.0F, 0.0F, Color.black, null, 1.0F, false, false);
+/* 205 */ this.hRes = x;
+/* 206 */ this.vRes = y;
+/* 207 */ serial += 1;
+/* */
+/* 209 */ int numSubs = getHRes() * getVRes();
+/* 210 */ this.textures = new Texture[numSubs];
+/* */
+/* 212 */ makeMaterials();
+/* */
+/* 214 */ this.subnames = new URL[numSubs];
+/* 215 */ String lowResBaseName = tileTexture.getBase();
+/* */
+/* 217 */ int nextSubname = 0;
+/* 218 */ for (int v = this.vRes; v > 0; v--) {
+/* 219 */ String vExt = v;
+/* 220 */ for (int h = 0; h < this.hRes; nextSubname++) {
+/* 221 */ URL subname = URL.make(tileTexture, lowResBaseName + serial +
+/* 222 */ vExt + (h + 1) + ".cmp");
+/* 223 */ this.subnames[nextSubname] = subname;
+/* 224 */ syncBackgroundLoad(tileTexture.unalias(), subname);h++;
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 238 */ public static boolean botMode = false;
+/* */
+/* */ public Material(URL textureName) {
+/* 241 */ this(null, textureName);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Material() {}
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ protected void noteAddingTo(SuperRoot owner)
+/* */ {
+/* 258 */ if (((WObject)owner).hasClump())
+/* 259 */ addRwChildren();
+/* */ }
+/* */
+/* */ public void detach() {
+/* 263 */ if (this.ids != null) {
+/* 264 */ markVoid();
+/* */ }
+/* 266 */ super.detach();
+/* */ }
+/* */
+/* */ public Texture[] getTextures() {
+/* 270 */ return this.textures;
+/* */ }
+/* */
+/* 273 */ private boolean keepLoaded = false;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private int[] ids;
+/* */
+/* */
+/* */
+/* */
+/* */ private Texture[] textures;
+/* */
+/* */
+/* */
+/* */
+/* 289 */ private int vRes = 1;
+/* 290 */ private int hRes = 1;
+/* 291 */ private int sPos = -1;
+/* */
+/* 293 */ private final boolean loResMode = false;
+/* */
+/* */
+/* */
+/* */ URL textureName;
+/* */
+/* */
+/* */
+/* */ protected URL[] subnames;
+/* */
+/* */
+/* */ private boolean doReclump;
+/* */
+/* */
+/* */
+/* */ public void addRwChildren()
+/* */ {
+/* 310 */ if (this.ids == null) {
+/* 311 */ if ((this.textures == null) && (this.textureName != null)) {
+/* 312 */ loadTextures();
+/* */ } else {
+/* 314 */ makeMaterials();
+/* 315 */ if (this.textures != null)
+/* 316 */ for (int i = 0; i < this.ids.length; i++)
+/* 317 */ nativeSetTexture(i, this.textures[i]);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */ public void markVoid() {
+/* 323 */ if (!this.keepLoaded)
+/* */ {
+/* 325 */ if (this.textureName != null) {
+/* 326 */ removeTextures();
+/* */ }
+/* 328 */ closeMaterials();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setKeepLoaded(boolean f)
+/* */ {
+/* 338 */ boolean klWas = this.keepLoaded;
+/* 339 */ this.keepLoaded = f;
+/* 340 */ if ((!f) && (klWas))
+/* */ {
+/* 342 */ SuperRoot o = getOwner();
+/* 343 */ if ((o == null) || (!((WObject)o).hasClump())) {
+/* 344 */ markVoid();
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static Material restore(Restorer r)
+/* */ throws IOException, TooNewException
+/* */ {
+/* 356 */ Material m = (Material)r.restoreMaybeNull();
+/* 357 */ if ((m != null) &&
+/* 358 */ (r.version() < 6))
+/* */ {
+/* 360 */ if (m.getOwner() != null)
+/* 361 */ m = (Material)m.clone();
+/* */ }
+/* 363 */ return m;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private native void nativeSetTexture(int paramInt, Texture paramTexture);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private synchronized void setTexture(int texNum, Texture texture)
+/* */ {
+/* 380 */ if (this.textures[texNum] != null) {
+/* 381 */ Texture t = extractTexture(texNum);
+/* */
+/* 383 */ if (t != null) {
+/* 384 */ t.decRef();
+/* */ }
+/* */ }
+/* */
+/* 388 */ this.textures[texNum] = texture;
+/* */
+/* 390 */ nativeSetTexture(texNum, texture);
+/* */
+/* 392 */ if (!this.doReclump) {
+/* 393 */ this.doReclump = true;
+/* 394 */ Main.register(this);
+/* */ }
+/* */ }
+/* */
+/* */ public void mainCallback() {
+/* 399 */ Main.unregister(this);
+/* */
+/* 401 */ if (this.doReclump) {
+/* 402 */ propagateTextureChange();
+/* */ }
+/* */
+/* 405 */ this.doReclump = false;
+/* */ }
+/* */
+/* */
+/* */
+/* */ private void propagateTextureChange()
+/* */ {
+/* 412 */ if (this.ids != null) {
+/* 413 */ Object o = getOwner();
+/* 414 */ if ((o instanceof WObject))
+/* 415 */ if (((o instanceof Surface)) && (((Surface)o).getMaterial() == this)) {
+/* 416 */ ((Surface)o).setMaterial(this, true);
+/* 417 */ } else if (((o instanceof Shape)) &&
+/* 418 */ (((Shape)o).getMaterial() == this)) {
+/* 419 */ ((Shape)o).setMaterial(this);
+/* */ } else
+/* 421 */ ((WObject)o).reclump();
+/* */ }
+/* 423 */ this.doReclump = false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public synchronized void setTexture(Texture texture)
+/* */ {
+/* 437 */ this.textureName = null;
+/* 438 */ if ((this.textures != null) && (this.textures.length != 1)) {
+/* 439 */ removeTextures();
+/* */
+/* 441 */ this.textures = new Texture[1];
+/* 442 */ setTexture(0, texture);
+/* */ }
+/* */ else {
+/* 445 */ if (this.textures == null) {
+/* 446 */ this.textures = new Texture[1];
+/* 447 */ } else if (texture == this.textures[0]) {
+/* 448 */ return;
+/* */ }
+/* 450 */ setTexture(0, texture);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ synchronized native Texture extractTexture(int paramInt);
+/* */
+/* */ private void removeTextures()
+/* */ {
+/* 459 */ if (this.textures != null) {
+/* 460 */ for (int i = 0; i < this.textures.length; i++) {
+/* 461 */ Texture t = extractTexture(i);
+/* 462 */ if (t != null)
+/* 463 */ t.decRef();
+/* */ }
+/* 465 */ this.textures = null;
+/* */ }
+/* 467 */ this.hRes = (this.vRes = 1);
+/* 468 */ this.sPos = -1;
+/* 469 */ closeMaterials();
+/* */ }
+/* */
+/* */ protected void finalize()
+/* */ {
+/* 474 */ removeTextures();
+/* 475 */ super.finalize();
+/* */ }
+/* */
+/* */ private native void closeMaterial(int paramInt);
+/* */
+/* */ private void closeMaterials()
+/* */ {
+/* 482 */ if (this.ids != null) {
+/* 483 */ for (int i = 0; i < this.ids.length; i++)
+/* 484 */ closeMaterial(i);
+/* 485 */ this.ids = null;
+/* */ }
+/* */ }
+/* */
+/* 489 */ private static boolean tryBMP = IniFile.gamma().getIniInt("TRYBMP", 0) != 0;
+/* */
+/* */ private float ambient;
+/* */
+/* */ private float diffuse;
+/* */ private float specular;
+/* */ private float opacity;
+/* */ private boolean smooth;
+/* */
+/* */ private int calcRes()
+/* */ {
+/* 500 */ this.hRes = 1;
+/* 501 */ this.vRes = 1;
+/* 502 */ this.sPos = -1;
+/* */
+/* 504 */ if (this.textureName == null) {
+/* 505 */ return -1;
+/* */ }
+/* 507 */ String name = this.textureName.getInternal();
+/* 508 */ int len = name.length();
+/* */
+/* 510 */ if ((len >= 4) && (name.regionMatches(true, len - 4, ".mov", 0, 4))) {
+/* 511 */ this.sPos = 0;
+/* */ }
+/* */
+/* */
+/* */
+/* 516 */ if ((len > 7) && (name.regionMatches(true, len - 5, "*.", 0, 2))) {
+/* */ int num;
+/* 518 */ for (int nextStarIndex = len - 5; (nextStarIndex > 2) &&
+/* 519 */ (name.charAt(nextStarIndex) == '*') &&
+/* 520 */ ((num = name.charAt(nextStarIndex - 2) - '0') > 0) && (
+/* 521 */ num <= 9); nextStarIndex -= 3) { int num;
+/* 522 */ char control = Character.toLowerCase(name
+/* 523 */ .charAt(nextStarIndex - 1));
+/* 524 */ if (control == 'h') {
+/* 525 */ this.hRes = num;
+/* 526 */ } else if (control == 'v') {
+/* 527 */ this.vRes = num;
+/* 528 */ } else if ((control == 's') && (this.sPos >= 0)) {
+/* 529 */ this.sPos = (num - 1);
+/* */ }
+/* */ }
+/* 532 */ return len - (nextStarIndex + 1);
+/* */ }
+/* 534 */ return -1;
+/* */ }
+/* */
+/* */
+/* */ private boolean filter;
+/* */ private int r;
+/* */ private int g;
+/* */ private int b;
+/* */ private Color color;
+/* */ private void loadTextures()
+/* */ {
+/* 545 */ int endLen = calcRes();
+/* */
+/* 547 */ if (endLen >= 0) {
+/* 548 */ String lowResBaseName = this.textureName.getBase();
+/* 549 */ int baseEnd = lowResBaseName.length() - endLen;
+/* 550 */ lowResBaseName = lowResBaseName.substring(0, baseEnd);
+/* */
+/* 552 */ int numSubs = getHRes() * getVRes();
+/* 553 */ this.textures = new Texture[numSubs];
+/* 554 */ makeMaterials();
+/* */
+/* 556 */ if (this.sPos >= 0)
+/* */ {
+/* 558 */ this.subnames = new URL[1];
+/* 559 */ this.subnames[0] = URL.make(this.textureName, lowResBaseName + ".mov");
+/* 560 */ BackgroundLoader.get(this, this.subnames[0]);
+/* */ } else {
+/* 562 */ this.subnames = new URL[numSubs];
+/* */
+/* 564 */ int nextSubname = 0;
+/* 565 */ for (int v = this.vRes; v > 0; v--) {
+/* 566 */ String vExt = v;
+/* 567 */ for (int h = 0; h < this.hRes; nextSubname++) {
+/* 568 */ URL subname = URL.make(this.textureName, lowResBaseName +
+/* 569 */ vExt + (h + 1) + ".cmp");
+/* 570 */ this.subnames[nextSubname] = subname;
+/* 571 */ BackgroundLoader.get(this, subname);h++;
+/* */ }
+/* */
+/* */ }
+/* */ }
+/* */ }
+/* */ else
+/* */ {
+/* 576 */ this.subnames = null;
+/* 577 */ this.textures = new Texture[1];
+/* 578 */ makeMaterials();
+/* 579 */ BackgroundLoader.get(this, this.textureName);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void loadTexture(URL textureName)
+/* */ {
+/* 588 */ boolean vis = this.ids != null;
+/* */
+/* 590 */ removeTextures();
+/* 591 */ this.textureName = textureName;
+/* 592 */ calcRes();
+/* */
+/* 594 */ if (vis) {
+/* 595 */ addRwChildren();
+/* */ }
+/* */
+/* */
+/* 599 */ Object o = getOwner();
+/* 600 */ if ((o instanceof WObject)) {
+/* 601 */ ((WObject)o).reclump();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private static native int makeMaterial(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean);
+/* */
+/* */
+/* */
+/* */ private void makeMaterials()
+/* */ {
+/* 614 */ int numSubs = getHRes() * getVRes();
+/* 615 */ this.ids = new int[numSubs];
+/* */
+/* 617 */ for (int i = 0; i < numSubs; i++) {
+/* 618 */ this.ids[i] = makeMaterial(this.ambient, this.diffuse, this.specular, this.opacity,
+/* 619 */ this.color.getRed(), this.color.getGreen(), this.color.getBlue(), this.smooth);
+/* */ }
+/* */ }
+/* */
+/* */ private void loadError(URL name) {
+/* 624 */ SuperRoot owner = getOwner();
+/* 625 */ System.out.println("Unable to load texture " + name + (
+/* 626 */ owner == null ? "" : new StringBuilder(" for ").append(owner.getName()).toString()) + ".");
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float getAmbient()
+/* */ {
+/* 635 */ return this.ambient;
+/* */ }
+/* */
+/* */ public float getDiffuse() {
+/* 639 */ return this.diffuse;
+/* */ }
+/* */
+/* */ public float getSpecular() {
+/* 643 */ return this.specular;
+/* */ }
+/* */
+/* */ public float getOpacity() {
+/* 647 */ return this.opacity;
+/* */ }
+/* */
+/* */ public boolean getSmooth() {
+/* 651 */ return this.smooth;
+/* */ }
+/* */
+/* */ public boolean getFilter() {
+/* 655 */ return this.filter;
+/* */ }
+/* */
+/* */ public boolean getHiRes() {
+/* 659 */ return (this.vRes > 1) || (this.hRes > 1);
+/* */ }
+/* */
+/* */ public int getVRes() {
+/* 663 */ return this.vRes;
+/* */ }
+/* */
+/* */ public int getHRes() {
+/* 667 */ return this.hRes;
+/* */ }
+/* */
+/* */ public int getRed() {
+/* 671 */ return this.r;
+/* */ }
+/* */
+/* */ public int getGreen() {
+/* 675 */ return this.g;
+/* */ }
+/* */
+/* */ public int getBlue() {
+/* 679 */ return this.b;
+/* */ }
+/* */
+/* */ public Color getColor() {
+/* 683 */ return this.color;
+/* */ }
+/* */
+/* */ public native void paramChange();
+/* */
+/* */ public void setAmbient(float ambient)
+/* */ {
+/* 690 */ this.ambient = ambient;
+/* 691 */ paramChange();
+/* */ }
+/* */
+/* */ public void setDiffuse(float diffuse) {
+/* 695 */ this.diffuse = diffuse;
+/* 696 */ paramChange();
+/* */ }
+/* */
+/* */ public void setSpecular(float specular) {
+/* 700 */ this.specular = specular;
+/* 701 */ paramChange();
+/* */ }
+/* */
+/* */ public void setOpacity(float opacity) {
+/* 705 */ this.opacity = opacity;
+/* 706 */ paramChange();
+/* */ }
+/* */
+/* */ public void setSmooth(boolean smooth) {
+/* 710 */ this.smooth = smooth;
+/* 711 */ paramChange();
+/* */ }
+/* */
+/* */ public void setFilter(boolean filter) {
+/* 715 */ this.filter = filter;
+/* 716 */ paramChange();
+/* */ }
+/* */
+/* */ public void setColor(Color color) {
+/* 720 */ this.color = color;
+/* 721 */ this.r = color.getRed();
+/* 722 */ this.g = color.getGreen();
+/* 723 */ this.b = color.getBlue();
+/* 724 */ paramChange();
+/* */ }
+/* */
+/* */ public Object asyncBackgroundLoad(String localName, URL remoteURL) {
+/* 728 */ return localName;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public boolean syncBackgroundLoad(Object obj, URL remoteURL)
+/* */ {
+/* 736 */ int texNum = 0;
+/* */
+/* 738 */ if (this.textures == null) {
+/* 739 */ return false;
+/* */ }
+/* */
+/* */
+/* 743 */ String urlString = remoteURL.getAbsolute();
+/* */
+/* 745 */ String avatarDir = IniFile.gamma().getIniString("avatarDir", "avatar/");
+/* 746 */ if (!avatarDir.endsWith("/"))
+/* 747 */ avatarDir = avatarDir + "/";
+/* 748 */ String avStart = URL.make(NetUpdate.getUpgradeServerURL() + avatarDir)
+/* 749 */ .getAbsolute();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 756 */ String remoteBase = remoteURL == null ? null : remoteURL.getBase();
+/* 757 */ String textureBase = this.textureName == null ? null : this.textureName.getBase();
+/* */
+/* 759 */ if (!remoteBase.equals(textureBase))
+/* */ {
+/* 761 */ if ((this.textureName != null) && (this.textureName.endsWith(".mov"))) {
+/* 762 */ String rawBase = this.textureName.getBaseWithoutExt();
+/* 763 */ String rawRemote = remoteURL.getBaseWithoutExt();
+/* */
+/* 765 */ if (!rawBase.startsWith(rawRemote)) {
+/* 766 */ return false;
+/* */ }
+/* */ }
+/* 769 */ else if (this.subnames != null) {
+/* 770 */ for (; texNum < this.subnames.length; texNum++) {
+/* 771 */ String subBase = this.subnames[texNum].getBase();
+/* */
+/* 773 */ if (remoteBase.equals(subBase))
+/* */ break;
+/* */ }
+/* 776 */ if (texNum == this.textures.length)
+/* 777 */ return false;
+/* */ } else {
+/* 779 */ return false;
+/* */ }
+/* */ }
+/* */
+/* 783 */ String localName = (String)obj;
+/* */
+/* */
+/* 786 */ if (this.ids == null) {
+/* 787 */ return false;
+/* */ }
+/* 789 */ if (localName != null) {
+/* 790 */ if (this.sPos < 0) {
+/* 791 */ Texture t = TextureDecoder.decode(remoteURL, localName);
+/* */
+/* 793 */ if ((t != null) && (t.textureID != 0)) {
+/* 794 */ setTexture(texNum, t);
+/* */ } else {
+/* 796 */ localName = null;
+/* */ }
+/* */ }
+/* */ else
+/* */ {
+/* 801 */ Texture[] ts = new ScapePicMovie(localName, remoteURL)
+/* 802 */ .getTextures();
+/* 803 */ if ((ts == null) || (this.hRes * this.vRes * (this.sPos + 1) > ts.length))
+/* */ {
+/* 805 */ localName = null;
+/* */ } else {
+/* 807 */ int i = this.hRes * this.vRes * this.sPos;
+/* 808 */ for (int v = (this.vRes - 1) * this.hRes; v >= 0; v -= this.hRes)
+/* 809 */ for (int h = 0; h < this.hRes; i++) {
+/* 810 */ setTexture(v + h, ts[i]);h++;
+/* */ }
+/* */ }
+/* */ }
+/* */ } else {
+/* 815 */ int len = urlString.length();
+/* 816 */ if ((tryBMP) && (this.sPos == -1) && (len > 4) &&
+/* 817 */ (urlString.regionMatches(true, len - 4, ".cmp", 0, 4)) &&
+/* 818 */ (!remoteURL.isRemote()))
+/* */ {
+/* 820 */ String lName = urlString.substring(0, len - 4) + ".bmp";
+/* 821 */ Texture t = TextureDecoder.decode(URL.make(lName), lName);
+/* 822 */ if ((t != null) && (t.textureID != 0)) {
+/* 823 */ setTexture(texNum, t);
+/* 824 */ localName = lName;
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* 829 */ if (localName == null)
+/* */ {
+/* */
+/* 832 */ if (urlString.startsWith("avatar:"))
+/* */ {
+/* 834 */ BackgroundLoader.get(this,
+/* 835 */ URL.make(avStart + urlString.substring(7)));
+/* 836 */ return false;
+/* */ }
+/* */
+/* 839 */ loadError(remoteURL);
+/* */ }
+/* */
+/* 842 */ return false;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Room getBackgroundLoadRoom()
+/* */ {
+/* 850 */ WObject owner = (WObject)getOwner();
+/* 851 */ if (owner == null)
+/* 852 */ return null;
+/* 853 */ return owner.getRoom();
+/* */ }
+/* */
+/* 856 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException {
+/* 859 */ s.saveVersion(4, classCookie);
+/* 860 */ super.saveState(s);
+/* 861 */ s.saveFloat(getAmbient());
+/* 862 */ s.saveFloat(getDiffuse());
+/* 863 */ s.saveFloat(getSpecular());
+/* 864 */ s.saveFloat(getOpacity());
+/* 865 */ s.saveBoolean(getSmooth());
+/* 866 */ s.saveBoolean(getFilter());
+/* 867 */ s.saveInt(getRed());
+/* 868 */ s.saveInt(getGreen());
+/* 869 */ s.saveInt(getBlue());
+/* 870 */ URL.save(s, this.textureName);
+/* 871 */ s.saveBoolean(this.keepLoaded);
+/* 872 */ if (this.textureName == null) {
+/* 873 */ if ((this.textures != null) && (this.textures.length != 1)) {
+/* 874 */ s.saveMaybeNull(null);
+/* */ } else {
+/* 876 */ s.saveMaybeNull(this.textures == null ? null : this.textures[0]);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException {
+/* 882 */ Texture texture = null;
+/* */
+/* 884 */ int vers = r.restoreVersion(classCookie);
+/* 885 */ switch (vers) {
+/* */ case 2:
+/* */ case 3:
+/* */ case 4:
+/* 889 */ super.restoreState(r);
+/* 890 */ this.ambient = r.restoreFloat();
+/* 891 */ this.diffuse = r.restoreFloat();
+/* 892 */ this.specular = r.restoreFloat();
+/* 893 */ this.opacity = r.restoreFloat();
+/* 894 */ if (vers > 3) {
+/* 895 */ this.smooth = r.restoreBoolean();
+/* 896 */ this.filter = r.restoreBoolean();
+/* */ }
+/* 898 */ int red = r.restoreInt();
+/* 899 */ int green = r.restoreInt();
+/* 900 */ int blue = r.restoreInt();
+/* 901 */ setColor(new Color(red, green, blue));
+/* 902 */ URL name = URL.restore(r);
+/* 903 */ if (vers > 2)
+/* 904 */ setKeepLoaded(r.restoreBoolean());
+/* 905 */ if (name == null) {
+/* 906 */ texture = (Texture)r.restoreMaybeNull();
+/* */ } else
+/* 908 */ loadTexture(name);
+/* 909 */ break;
+/* */
+/* */ case 1:
+/* 912 */ super.restoreState(r);
+/* */ case 0:
+/* 914 */ this.ambient = r.restoreFloat();
+/* 915 */ this.diffuse = r.restoreFloat();
+/* 916 */ this.specular = r.restoreFloat();
+/* 917 */ this.opacity = r.restoreFloat();
+/* 918 */ int red = r.restoreInt();
+/* 919 */ int green = r.restoreInt();
+/* 920 */ int blue = r.restoreInt();
+/* 921 */ setColor(new Color(red, green, blue));
+/* 922 */ texture = (Texture)r.restoreMaybeNull();
+/* 923 */ break;
+/* */ default:
+/* 925 */ throw new TooNewException();
+/* */ }
+/* */
+/* 928 */ if (texture != null) {
+/* 929 */ this.textures = new Texture[1];
+/* 930 */ this.textures[0] = texture;
+/* */ }
+/* */
+/* 933 */ assert ((r.version() >= 6) || (getOwner() == null));
+/* */ }
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 941 */ Object ret = null;
+/* 942 */ switch (index - offset) {
+/* */ case 0:
+/* 944 */ if (mode == 0) {
+/* 945 */ ret = new Property(this, index, "Texture").allowSetNull();
+/* 946 */ } else if (mode == 1) { MaterialTexture mt;
+/* */ MaterialTexture mt;
+/* 948 */ if ((this.textures != null) && ((this.textures[0] instanceof StringTexture))) {
+/* 949 */ mt = new MaterialTexture((StringTexture)this.textures[0]);
+/* */ } else
+/* 951 */ mt = new MaterialTexture(this.textureName);
+/* 952 */ add(mt);
+/* 953 */ ret = mt;
+/* 954 */ } else if (mode == 2) {
+/* 955 */ if (value == null) {
+/* 956 */ loadTexture(null);
+/* */ } else
+/* 958 */ Console.println(Console.message("Cant-undo-tex"));
+/* */ }
+/* 960 */ break;
+/* */ case 1:
+/* 962 */ if (mode == 0) {
+/* 963 */ ret = ColorPropertyEditor.make(new Property(this, index,
+/* 964 */ "Color"));
+/* 965 */ } else if (mode == 1) {
+/* 966 */ ret = getColor();
+/* 967 */ } else if (mode == 2)
+/* 968 */ setColor((Color)value);
+/* 969 */ break;
+/* */ case 2:
+/* 971 */ if (mode == 0) {
+/* 972 */ ret = FloatPropertyEditor.make(new Property(this, index,
+/* 973 */ "Ambient Reflection Coefficient"), 0.0F, 1.0F);
+/* 974 */ } else if (mode == 1) {
+/* 975 */ ret = new Float(getAmbient());
+/* 976 */ } else if (mode == 2)
+/* 977 */ setAmbient(((Float)value).floatValue());
+/* 978 */ break;
+/* */ case 3:
+/* 980 */ if (mode == 0) {
+/* 981 */ ret = FloatPropertyEditor.make(new Property(this, index,
+/* 982 */ "Diffuse Reflection Coefficient"), 0.0F, 1.0F);
+/* 983 */ } else if (mode == 1) {
+/* 984 */ ret = new Float(getDiffuse());
+/* 985 */ } else if (mode == 2)
+/* 986 */ setDiffuse(((Float)value).floatValue());
+/* 987 */ break;
+/* */ case 4:
+/* 989 */ if (mode == 0) {
+/* 990 */ ret = FloatPropertyEditor.make(new Property(this, index,
+/* 991 */ "Specular Reflection Coefficient"), 0.0F, 1.0F);
+/* 992 */ } else if (mode == 1) {
+/* 993 */ ret = new Float(getSpecular());
+/* 994 */ } else if (mode == 2)
+/* 995 */ setSpecular(((Float)value).floatValue());
+/* 996 */ break;
+/* */ case 5:
+/* 998 */ if (mode == 0) {
+/* 999 */ ret = FloatPropertyEditor.make(new Property(this, index,
+/* 1000 */ "Opacity"), 0.0F, 1.0F);
+/* 1001 */ } else if (mode == 1) {
+/* 1002 */ ret = new Float(getOpacity());
+/* 1003 */ } else if (mode == 2)
+/* 1004 */ setOpacity(((Float)value).floatValue());
+/* 1005 */ break;
+/* */ case 6:
+/* 1007 */ if (mode == 0) {
+/* 1008 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 1009 */ "Smooth"), "No", "Yes");
+/* 1010 */ } else if (mode == 1) {
+/* 1011 */ ret = new Boolean(getSmooth());
+/* 1012 */ } else if (mode == 2)
+/* 1013 */ setSmooth(((Boolean)value).booleanValue());
+/* 1014 */ break;
+/* */ case 7:
+/* 1016 */ if (mode == 0) {
+/* 1017 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 1018 */ "Filter"), "No", "Yes");
+/* 1019 */ } else if (mode == 1) {
+/* 1020 */ ret = new Boolean(getFilter());
+/* 1021 */ } else if (mode == 2)
+/* 1022 */ setFilter(((Boolean)value).booleanValue());
+/* 1023 */ break;
+/* */ default:
+/* 1025 */ ret = super.properties(index, offset + 8, mode, value);
+/* */ }
+/* 1027 */ return ret;
+/* */ }
+/* */
+/* */ public String toString() {
+/* 1031 */ return
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 1039 */ getName() + "[" + (this.textures == null ? null : this.textureName != null ? this.textureName.toString() : this.textures.toString()) + ", " + getColor() + ", Ambient " + getAmbient() + ", Diffuse " + getDiffuse() + ", Specular " + getSpecular() + ", Opacity " + getOpacity() + ", Smooth " + getSmooth() + ", Filter " + getFilter() + ", hRes " + this.hRes + ", vRes " + this.vRes + ", loResMode " + false + "]";
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Material.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file