summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ScapePicMovie.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/ScapePicMovie.java
downloadarchived-worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
archived-worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/ScapePicMovie.java')
-rw-r--r--NET/worlds/scape/ScapePicMovie.java140
1 files changed, 140 insertions, 0 deletions
diff --git a/NET/worlds/scape/ScapePicMovie.java b/NET/worlds/scape/ScapePicMovie.java
new file mode 100644
index 0000000..773e72d
--- /dev/null
+++ b/NET/worlds/scape/ScapePicMovie.java
@@ -0,0 +1,140 @@
+package NET.worlds.scape;
+
+import NET.worlds.console.Console;
+import NET.worlds.network.URL;
+import java.io.IOException;
+import java.util.Hashtable;
+
+public class ScapePicMovie implements Persister {
+ private static Hashtable movieDict = new Hashtable();
+ private ScapePicTexture[] movie;
+ private String localName;
+ private URL url;
+ private int frameCount;
+ private int width;
+ private int height;
+ private static Object classCookie = new Object();
+
+ static {
+ nativeInit();
+ }
+
+ public ScapePicMovie() {
+ }
+
+ public ScapePicMovie(String localName, URL url) {
+ this.localName = localName;
+ this.url = url;
+ this.movie = this.getAll();
+ }
+
+ public static native void nativeInit();
+
+ public int getW() {
+ return this.width;
+ }
+
+ public int getH() {
+ return this.height;
+ }
+
+ public int length() {
+ return this.frameCount;
+ }
+
+ public URL getURL() {
+ return this.url;
+ }
+
+ public ScapePicTexture getTexture(int frameNumber) {
+ ScapePicTexture ret = null;
+ if (this.movie != null) {
+ ret = this.movie[frameNumber];
+ this.movie[frameNumber] = null;
+ int i = 0;
+
+ while (i < this.frameCount && this.movie[i] == null) {
+ i++;
+ }
+
+ if (i == this.frameCount) {
+ this.movie = null;
+ }
+ }
+
+ return ret;
+ }
+
+ public ScapePicTexture[] getTextures() {
+ ScapePicTexture[] ret = this.movie;
+ this.movie = null;
+ return ret;
+ }
+
+ private synchronized ScapePicTexture[] getAll() {
+ String name = this.url.getAbsolute();
+ ScapePicMovie proto = (ScapePicMovie)movieDict.get(name);
+ ScapePicTexture[] a = (ScapePicTexture[])null;
+ if (proto != null) {
+ this.frameCount = proto.length();
+ this.width = proto.getW();
+ this.height = proto.getH();
+ a = this.lookupTextures(name, this.frameCount, this.width, this.height);
+ }
+
+ if (a == null) {
+ a = this.makeTextures(this.localName, name);
+ if (a != null && proto == null) {
+ this.frameCount = a.length;
+ this.width = a[0].getW();
+ this.height = a[0].getH();
+ movieDict.put(name, this);
+ }
+ }
+
+ return a;
+ }
+
+ private native ScapePicTexture[] lookupTextures(String var1, int var2, int var3, int var4);
+
+ private native ScapePicTexture[] makeTextures(String var1, String var2);
+
+ @Override
+ public void saveState(Saver s) throws IOException {
+ Console.println(Console.message("Obs-ScapePicMov") + this.url);
+ s.saveVersion(2, classCookie);
+ this.url.save(s);
+ }
+
+ @Override
+ public void restoreState(Restorer r) throws IOException, TooNewException {
+ switch (r.restoreVersion(classCookie)) {
+ case 0:
+ this.localName = r.restoreString();
+ this.url = URL.make(this.localName);
+ r.restoreBoolean();
+ break;
+ case 1:
+ this.localName = r.restoreString();
+ this.url = URL.make(this.localName);
+ break;
+ case 2:
+ this.url = URL.restore(r);
+ this.localName = this.url.unalias();
+ break;
+ default:
+ throw new TooNewException();
+ }
+
+ this.movie = this.getAll();
+ }
+
+ @Override
+ public void postRestore(int version) {
+ }
+
+ @Override
+ public String toString() {
+ return this.url.getAbsolute();
+ }
+}