summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/SetPoint3Action.java
blob: 98830dc0a05f3718f0898651cc7abaf89d5a0d6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class SetPoint3Action
/*     */   extends SlidePropertyAction
/*     */ {
/*  17 */   private Point3 _value = null;
/*     */   
/*     */   private Point3 _start;
/*     */   
/*     */ 
/*     */   public Persister trigger(Event e, Persister seqID)
/*     */   {
/*  24 */     Persister ret = null;
/*  25 */     Point3 val = null;
/*  26 */     if (useParam()) {
/*  27 */       String p = param();
/*  28 */       if (p == null) {
/*  29 */         this._value = null;
/*     */       } else {
/*  31 */         float x = 0.0F;float y = 0.0F;float z = 0.0F;
/*  32 */         boolean ok = true;
/*  33 */         int comma = p.indexOf(',');
/*  34 */         if (comma == -1) {
/*  35 */           ok = false;
/*     */         } else {
/*     */           try {
/*  38 */             x = Float.valueOf(p.substring(0, comma)).floatValue();
/*  39 */             p = p.substring(comma + 1);
/*  40 */             comma = p.indexOf(',');
/*  41 */             if (comma == -1) {
/*  42 */               ok = false;
/*     */             } else {
/*  44 */               y = 
/*  45 */                 Float.valueOf(p.substring(0, comma)).floatValue();
/*  46 */               p = p.substring(comma + 1);
/*  47 */               z = Float.valueOf(p).floatValue();
/*     */             }
/*     */           }
/*     */           catch (NumberFormatException nfe) {
/*  51 */             ok = false;
/*     */           }
/*     */         }
/*  54 */         if (!ok) {
/*  55 */           System.out.println(getName() + " unable to parse " + 
/*  56 */             paramName());
/*  57 */           x = 0.0F;
/*  58 */           y = 0.0F;
/*  59 */           z = 0.0F;
/*     */         }
/*  61 */         this._value = new Point3(x, y, z);
/*     */       }
/*     */     }
/*  64 */     if (this._value == null) {
/*  65 */       if ((!$assertionsDisabled) && (slide())) throw new AssertionError();
/*     */     }
/*     */     else {
/*  68 */       if (slide()) {
/*  69 */         if (seqID == null) {
/*  70 */           start();
/*  71 */           this._start = ((Point3)get());
/*     */         }
/*  73 */         float frac = fraction();
/*  74 */         if (frac < 1.0D) {
/*  75 */           val = new Point3(this._value);
/*  76 */           val.x = ((this._value.x - this._start.x) * frac + this._start.x);
/*  77 */           val.y = ((this._value.y - this._start.y) * frac + this._start.y);
/*  78 */           val.z = ((this._value.z - this._start.z) * frac + this._start.z);
/*  79 */           ret = this;
/*     */         }
/*     */       }
/*  82 */       if (val == null)
/*  83 */         val = this._value;
/*     */     }
/*  85 */     set(val);
/*  86 */     return ret;
/*     */   }
/*     */   
/*     */   public Object properties(int index, int offset, int mode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/*  92 */     Object ret = null;
/*  93 */     switch (index - offset) {
/*     */     case 0: 
/*  95 */       if (mode == 0) {
/*  96 */         ret = Point3PropertyEditor.make(new Property(this, index, 
/*  97 */           "Set To").allowSetNull());
/*  98 */         if (this._value == null) {
/*  99 */           ret = MaybeNullPropertyEditor.make((Property)ret, 
/* 100 */             new Point3());
/*     */         }
/*     */       }
/* 103 */       else if (mode == 1) {
/* 104 */         ret = this._value;
/* 105 */       } else if (mode == 2) {
/* 106 */         this._value = ((Point3)value);
/* 107 */       } else if (mode == 4) {
/* 108 */         this._value = null; }
/* 109 */       break;
/*     */     default: 
/* 111 */       ret = super.properties(index, offset + 1, mode, value);
/*     */     }
/* 113 */     return ret;
/*     */   }
/*     */   
/* 116 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/* 120 */     s.saveVersion(1, classCookie);
/* 121 */     super.saveState(s);
/* 122 */     s.saveMaybeNull(this._value);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 127 */     switch (r.restoreVersion(classCookie)) {
/*     */     case 1: 
/* 129 */       super.restoreState(r);
/* 130 */       this._value = ((Point3)r.restoreMaybeNull());
/* 131 */       break;
/*     */     
/*     */     default: 
/* 134 */       throw new TooNewException();
/*     */     }
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SetPoint3Action.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */