blob: b2dd1ed2ebe593fdc65fb9df8621810b9fed8594 (
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
|
package NET.worlds.scape;
import NET.worlds.console.Console;
import java.io.IOException;
import java.text.MessageFormat;
public class ScapePicTexture extends Texture implements Persister {
private int w;
private int h;
private String _urlName;
private ScapePicMovie _movie;
private int _movieFrame;
private static Object classCookie = new Object();
static {
nativeInit();
}
public ScapePicTexture(String urlName, String filename) {
this._urlName = urlName;
this.makeTexture(urlName, filename);
}
public ScapePicTexture() {
}
public static native void nativeInit();
@Override
public int getW() {
return this.w;
}
@Override
public int getH() {
return this.h;
}
private native void makeTexture(String var1, String var2);
@Override
public String getName() {
return this._urlName;
}
@Override
public void saveState(Saver s) throws IOException {
s.saveVersion(1, classCookie);
super.saveState(s);
if (this._movie != null) {
s.saveBoolean(true);
s.save(this._movie);
s.saveInt(this._movieFrame);
} else {
s.saveBoolean(false);
s.saveString(this._urlName);
}
}
@Override
public void restoreState(Restorer r) throws IOException, TooNewException {
switch (r.restoreVersion(classCookie)) {
case 0:
super.restoreState(r);
r.restoreBoolean();
break;
case 1:
super.restoreState(r);
break;
default:
throw new TooNewException();
}
if (r.restoreBoolean()) {
this._movie = (ScapePicMovie)r.restore();
this._movieFrame = r.restoreInt();
ScapePicTexture t = this._movie.getTexture(this._movieFrame);
if (t == null) {
Object[] arguments = new Object[]{new String("" + this._movieFrame), new String("" + this._movie)};
Console.println(MessageFormat.format(Console.message("Error-frame"), arguments));
} else {
this.textureID = t.textureID;
}
} else {
this._urlName = r.restoreString();
this.makeTexture(this._urlName, this._urlName);
}
}
@Override
public String toString() {
return this._movie == null ? this._urlName : this._movie.toString();
}
}
|