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(); } }