summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ShapeLoader.java
blob: 6d7d13c07c8ad222ee92a7e0482b8d84c988541d (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*     */ 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<Texture> 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<Texture> 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
 */