summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/TransAttribute.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/TransAttribute.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/TransAttribute.java')
-rw-r--r--NET/worlds/scape/TransAttribute.java305
1 files changed, 305 insertions, 0 deletions
diff --git a/NET/worlds/scape/TransAttribute.java b/NET/worlds/scape/TransAttribute.java
new file mode 100644
index 0000000..f500878
--- /dev/null
+++ b/NET/worlds/scape/TransAttribute.java
@@ -0,0 +1,305 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.io.DataInputStream;
+/* */ import java.io.DataOutputStream;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class TransAttribute
+/* */ extends Attribute
+/* */ {
+/* */ private Point3 defPos;
+/* */ private Point3 defRAxis;
+/* */ private float defRotation;
+/* */ private Point3 defScale;
+/* */
+/* */ public TransAttribute(int attrID)
+/* */ {
+/* 42 */ super(attrID);
+/* */ }
+/* */
+/* */
+/* */ public TransAttribute() {}
+/* */
+/* */
+/* */ protected void noteAddingTo(SuperRoot owner)
+/* */ {
+/* 51 */ WObject w = (WObject)((Sharer)owner).getOwner();
+/* */
+/* 53 */ w._transformAttribute = this;
+/* */
+/* */
+/* */
+/* 57 */ initDefault();
+/* */ }
+/* */
+/* */ public void detach()
+/* */ {
+/* 62 */ WObject w = (WObject)((Sharer)getOwner()).getOwner();
+/* 63 */ w._transformAttribute = null;
+/* 64 */ super.detach();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void noteChange()
+/* */ {
+/* 72 */ if (TCompressor.dontSend)
+/* 73 */ return;
+/* 74 */ super.noteChange();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void generateNetData(DataOutputStream s)
+/* */ throws IOException
+/* */ {
+/* 88 */ WObject w = (WObject)getOwner().getOwner();
+/* */
+/* */
+/* */
+/* */
+/* 93 */ if (this._shorthandVersion == 0)
+/* */ {
+/* 95 */ Point3Temp pos = w.getPosition();
+/* 96 */ s.writeFloat(pos.x);
+/* 97 */ s.writeFloat(pos.y);
+/* 98 */ s.writeFloat(pos.z);
+/* 99 */ Point3Temp scale = w.getScale();
+/* 100 */ s.writeFloat(scale.x);
+/* 101 */ s.writeFloat(scale.y);
+/* 102 */ s.writeFloat(scale.z);
+/* 103 */ return;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 110 */ initDefault();
+/* */
+/* 112 */ TCompressor.compress(w, this.defPos, this.defRAxis, this.defRotation, this.defScale,
+/* 113 */ this._sharingMode, s);
+/* */ }
+/* */
+/* */ private void initDefault()
+/* */ {
+/* 118 */ if (this.defPos == null)
+/* */ {
+/* 120 */ WObject w = (WObject)((Sharer)getOwner()).getOwner();
+/* */
+/* 122 */ this.defPos = new Point3(w.getPosition());
+/* 123 */ this.defRAxis = new Point3();
+/* 124 */ this.defRotation = w.getSpin(this.defRAxis);
+/* 125 */ this.defScale = new Point3(w.getScale());
+/* */ }
+/* */ }
+/* */
+/* */ public void setFromNetData(DataInputStream ds, int len) throws IOException
+/* */ {
+/* 131 */ WObject w = (WObject)getOwner().getOwner();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 137 */ initDefault();
+/* */
+/* */
+/* */
+/* */
+/* */ try
+/* */ {
+/* 144 */ TCompressor.decompress(w, this.defPos, this.defRAxis, this.defRotation, this.defScale,
+/* 145 */ this._sharingMode, len, ds);
+/* */ }
+/* */ catch (IOException e)
+/* */ {
+/* 149 */ TCompressor.dontSend = false;
+/* 150 */ throw e;
+/* */ }
+/* */ }
+/* */
+/* */
+/* 155 */ private int _sharingMode = 57344;
+/* */
+/* */ public boolean getSharingPosition() {
+/* 158 */ return (this._sharingMode & 0x8000) != 0;
+/* */ }
+/* */
+/* */ public void setSharingPosition(boolean b) {
+/* 162 */ if (b) {
+/* 163 */ this._sharingMode |= 0x8000;
+/* */ } else {
+/* 165 */ this._sharingMode &= 0xFFFF7FFF;
+/* */ }
+/* */ }
+/* */
+/* */ public boolean getSharingRotation() {
+/* 170 */ return (this._sharingMode & 0x4000) != 0;
+/* */ }
+/* */
+/* */ public void setSharingRotation(boolean b)
+/* */ {
+/* 175 */ if (b) {
+/* 176 */ this._sharingMode |= 0x4000;
+/* */ } else {
+/* 178 */ this._sharingMode &= 0xBFFF;
+/* */ }
+/* */ }
+/* */
+/* */ public boolean getSharingScale() {
+/* 183 */ return (this._sharingMode & 0x2000) != 0;
+/* */ }
+/* */
+/* */ public void setSharingScale(boolean b)
+/* */ {
+/* 188 */ if (b) {
+/* 189 */ this._sharingMode |= 0x2000;
+/* */ } else {
+/* 191 */ this._sharingMode &= 0xDFFF;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 199 */ Object ret = null;
+/* */
+/* 201 */ switch (index - offset) {
+/* */ case 0:
+/* 203 */ if (mode == 0) {
+/* 204 */ ret = BooleanPropertyEditor.make(
+/* 205 */ new Property(this, index, "Share Position"), "No", "Yes");
+/* 206 */ } else if (mode == 1) {
+/* 207 */ ret = new Boolean(getSharingPosition());
+/* 208 */ } else if (mode == 2)
+/* 209 */ setSharingPosition(((Boolean)value).booleanValue());
+/* 210 */ break;
+/* */ case 1:
+/* 212 */ if (mode == 0) {
+/* 213 */ ret = BooleanPropertyEditor.make(
+/* 214 */ new Property(this, index, "Share Rotation"), "No", "Yes");
+/* 215 */ } else if (mode == 1) {
+/* 216 */ ret = new Boolean(getSharingRotation());
+/* 217 */ } else if (mode == 2)
+/* 218 */ setSharingRotation(((Boolean)value).booleanValue());
+/* 219 */ break;
+/* */ case 2:
+/* 221 */ if (mode == 0) {
+/* 222 */ ret = BooleanPropertyEditor.make(
+/* 223 */ new Property(this, index, "Share Scale"),
+/* 224 */ "No", "Yes");
+/* 225 */ } else if (mode == 1) {
+/* 226 */ ret = new Boolean(getSharingScale());
+/* 227 */ } else if (mode == 2)
+/* 228 */ setSharingScale(((Boolean)value).booleanValue());
+/* 229 */ break;
+/* */
+/* */ default:
+/* 232 */ ret = super.properties(index, offset + 3, mode, value);
+/* */ }
+/* 234 */ return ret;
+/* */ }
+/* */
+/* */
+/* */
+/* 239 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 243 */ s.saveVersion(2, classCookie);
+/* 244 */ super.saveState(s);
+/* */
+/* */
+/* */
+/* 248 */ initDefault();
+/* */
+/* 250 */ s.saveInt(this._sharingMode);
+/* 251 */ s.saveFloat(this.defPos.x);
+/* 252 */ s.saveFloat(this.defPos.y);
+/* 253 */ s.saveFloat(this.defPos.z);
+/* 254 */ s.saveFloat(this.defRAxis.x);
+/* 255 */ s.saveFloat(this.defRAxis.y);
+/* 256 */ s.saveFloat(this.defRAxis.z);
+/* 257 */ s.saveFloat(this.defRotation);
+/* 258 */ s.saveFloat(this.defScale.x);
+/* 259 */ s.saveFloat(this.defScale.y);
+/* 260 */ s.saveFloat(this.defScale.z);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 265 */ int vers = r.restoreVersion(classCookie);
+/* 266 */ switch (vers) {
+/* */ case 0:
+/* 268 */ super.restoreState(r);
+/* 269 */ break;
+/* */ case 1:
+/* */ case 2:
+/* 272 */ this.defPos = new Point3();
+/* 273 */ this.defRAxis = new Point3();
+/* 274 */ this.defScale = new Point3();
+/* */
+/* 276 */ super.restoreState(r);
+/* 277 */ this._sharingMode = r.restoreInt();
+/* 278 */ this.defPos.x = r.restoreFloat();
+/* 279 */ this.defPos.y = r.restoreFloat();
+/* 280 */ this.defPos.z = r.restoreFloat();
+/* 281 */ this.defRAxis.x = r.restoreFloat();
+/* 282 */ this.defRAxis.y = r.restoreFloat();
+/* 283 */ this.defRAxis.z = r.restoreFloat();
+/* 284 */ this.defRotation = r.restoreFloat();
+/* 285 */ this.defScale.x = r.restoreFloat();
+/* 286 */ this.defScale.y = r.restoreFloat();
+/* 287 */ this.defScale.z = r.restoreFloat();
+/* */
+/* 289 */ break;
+/* */ default:
+/* 291 */ throw new TooNewException();
+/* */ }
+/* */
+/* 294 */ if (vers < 2)
+/* 295 */ this._shorthandVersion = vers;
+/* */ }
+/* */
+/* 298 */ public int getMaxShorthandVersion() { return 1; }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\TransAttribute.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file