home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.awt.image.ImageObserver;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Date;
- import java.util.Stack;
- import java.util.Vector;
-
- public class anim3simple extends Applet implements Runnable {
- private boolean initialized;
- private static final int STARTUP_ID = 0;
- private static final int BACKGROUND_ID = 1;
- private static final int ANIMATION_ID = 2;
- private MediaTracker tracker;
- private Thread engine;
- private int num_sprites;
- private boolean local;
- private Vector[] images;
- private int active_anims;
- private URL baseDir;
- private int[] frameNum;
- private int[] frameNumKey;
- private int[] repeat;
- private int[] currentLoop;
- private int[] priority;
- private int[] maxWidth;
- private int[] maxHeight;
- private int appWidth;
- private int appHeight;
- private Dimension bgSize;
- private boolean error;
- private boolean BigError;
- private boolean loaded;
- private Image startUpImage;
- private URL startUpImageURL;
- private Image endimage;
- private URL endURL;
- private Image backgroundImage;
- private URL backgroundImageURL;
- private Image offScrImage;
- private Graphics offScrGC;
- private int globalPause;
- private boolean[] mousePause;
- private int[] moveEW;
- private int[] moveNS;
- private int[] currentX;
- private int[] currentY;
- private boolean[] bounce;
- private int bgR = 192;
- private int bgG = 192;
- private int bgB = 192;
- private int delay;
- private int[] timeout;
- private long[] wantsecs;
- private URL glob_destination;
- private boolean[] active;
- private String SausCRC = "";
- private int CRCint;
- static final boolean debug = true;
-
- public void stop() {
- this.dbg("Thread stopped");
- if (this.engine != null && this.engine.isAlive()) {
- this.engine.stop();
- }
-
- this.engine = null;
- }
-
- private boolean parsePriority(String var1) {
- int var2 = 0;
- int[] var3 = new int[this.num_sprites];
-
- for(int var4 = 0; var4 < var1.length() && var2 <= this.num_sprites; ++var2) {
- int var5 = var1.indexOf(44, var4);
- if (var5 == -1) {
- var5 = var1.length();
- }
-
- if (var5 == var4) {
- Object var6 = null;
- return false;
- }
-
- var3[var2] = Integer.parseInt(var1.substring(var4, var5).trim());
- var4 = var5 + 1;
- }
-
- for(int var8 = 0; var8 < this.num_sprites; ++var8) {
- this.priority[var8] = var3[this.num_sprites - var8 - 1];
- }
-
- Object var7 = null;
- return true;
- }
-
- private void msg(String var1) {
- ((Applet)this).showStatus(var1);
- }
-
- private boolean parseMovement(String var1, int var2) {
- int var3 = 0;
- int var4 = var1.indexOf(44, 0);
- if (var4 == -1) {
- return false;
- } else {
- this.moveEW[var2] = Integer.parseInt(var1.substring(0, var4).trim());
- var3 = var4 + 1;
- var4 = var1.indexOf(44, var4 + 1);
- if (var4 == -1) {
- var4 = var1.length();
- }
-
- this.moveNS[var2] = Integer.parseInt(var1.substring(var3, var4).trim());
- return true;
- }
- }
-
- private void generateCRC(String var1) {
- int var3 = var1.length();
-
- for(int var2 = 0; var2 < var3; ++var2) {
- this.CRCint += var1.charAt(var2);
- }
-
- }
-
- private boolean parseStartPos(String var1, int var2) {
- int var3 = 0;
- int var4 = var1.indexOf(44, 0);
- if (var4 == -1) {
- return false;
- } else {
- this.currentX[var2] = Integer.parseInt(var1.substring(0, var4).trim());
- var3 = var4 + 1;
- var4 = var1.indexOf(44, var4 + 1);
- if (var4 == -1) {
- var4 = var1.length();
- }
-
- this.currentY[var2] = Integer.parseInt(var1.substring(var3, var4).trim());
- return true;
- }
- }
-
- private Vector parseURLs(String var1) {
- Vector var2 = new Vector(1);
- this.msg("Egor - Fetching URLs");
-
- int var4;
- for(int var5 = 0; var5 < var1.length(); var5 = var4 + 1) {
- var4 = var1.indexOf(44, var5);
- if (var4 == -1) {
- var4 = var1.length();
- }
-
- if (var4 == var5) {
- Object var3 = null;
- var2.addElement((Object)null);
- } else {
- String var8 = var1.substring(var5, var4);
-
- try {
- var2.addElement(new URL((URL)null, var8));
- } catch (MalformedURLException var7) {
- this.dbg("Egor 3.0 - Malformed URL " + var8 + ". Trying to make it absolute");
-
- try {
- var2.addElement(new URL(this.baseDir, var8));
- } catch (MalformedURLException var6) {
- this.dbg("Egor 3.0 - Malformed URL " + this.baseDir + var8 + ". Ignoring");
- var2.addElement((Object)null);
- }
- }
- }
- }
-
- return var2;
- }
-
- private Vector prepareImages(String var1) throws MalformedURLException {
- this.msg("Egor - Fetching images");
- Vector var3 = new Vector(1);
-
- int var5;
- for(int var4 = 0; var4 < var1.length(); var4 = var5 + 1) {
- var5 = var1.indexOf(44, var4);
- if (var5 == -1) {
- var5 = var1.length();
- }
-
- String var6 = var1.substring(var4, var5);
- URL var2 = new URL(this.baseDir, var6);
- var3.addElement(var2);
- }
-
- return var3;
- }
-
- private boolean ptInRect(int var1, int var2, int var3, int var4, int var5, int var6) {
- return var1 <= var5 && var1 >= var3 && var2 <= var6 && var2 >= var4;
- }
-
- public void update(Graphics var1) {
- this.paint(var1);
- }
-
- public void start() {
- this.dbg("Thread started");
- if (this.engine == null) {
- this.engine = new Thread(this);
- this.engine.start();
- }
-
- }
-
- public String getAppletInfo() {
- return "Egor 3.0 animator (c) Sausage Software. Coded by JavaGirl";
- }
-
- public void pause() {
- for(int var1 = 0; var1 < this.num_sprites; ++var1) {
- this.mousePause[var1] = !this.mousePause[var1];
- this.active[var1] = !this.active[var1];
- }
-
- }
-
- boolean fetchImages(Vector[] var1, int var2) {
- this.dbg("Storing images for anim " + var2);
- this.msg("Storing images for anim " + var2);
-
- int var3;
- try {
- var3 = var1[var2].size();
- } catch (NullPointerException var11) {
- this.msg("Egor 3.0 - No images fed in!");
- this.dbg("No images fed in!");
- return false;
- }
-
- Vector var4 = var1[var2];
- Stack var5 = new Stack();
-
- for(int var8 = 0; var8 < var3; ++var8) {
- Object var9 = var4.elementAt(var8);
- if (var9 instanceof URL) {
- URL var6 = (URL)var9;
- Image var7 = ((Applet)this).getImage(var6);
- if (var5.search(var6) == -1) {
- this.tracker.addImage(var7, 2);
- var5.push(var6);
- this.dbg("adding " + var6);
- }
-
- var4.setElementAt(var7, var8);
- }
- }
-
- Object var12 = null;
-
- try {
- this.tracker.waitForID(2);
- } catch (InterruptedException var10) {
- }
-
- if (this.tracker.isErrorID(2)) {
- if ((this.tracker.statusID(2, false) & 4) != 0 || (this.tracker.statusID(2, false) & 2) != 0) {
- this.dbg("Error loading frames - error or abort");
- }
-
- this.msg("Error loading frames - error or abort");
- return false;
- } else {
- for(int var13 = 0; var13 < var3; ++var13) {
- this.updateMaxDims(this.getImageDimensions((Image)var4.elementAt(var13)), var2);
- }
-
- return true;
- }
- }
-
- private Dimension getImageDimensions(Image var1) {
- return new Dimension(var1.getWidth((ImageObserver)null), var1.getHeight((ImageObserver)null));
- }
-
- private boolean updateXY(int var1) {
- int[] var10000 = this.currentX;
- var10000[var1] += this.moveEW[var1];
- var10000 = this.currentY;
- var10000[var1] += this.moveNS[var1];
- boolean var2 = false;
- if (this.bounce[var1]) {
- if (this.currentX[var1] > this.appWidth - this.maxWidth[var1] || this.currentX[var1] < 0) {
- this.moveEW[var1] = -this.moveEW[var1];
- var10000 = this.currentX;
- var10000[var1] += this.moveEW[var1];
- var2 = true;
- }
-
- if (this.currentY[var1] > this.appHeight - this.maxHeight[var1] || this.currentY[var1] < 0) {
- this.moveNS[var1] = -this.moveNS[var1];
- var10000 = this.currentY;
- var10000[var1] += this.moveNS[var1];
- var2 = true;
- }
- } else {
- if (this.currentX[var1] > this.appWidth) {
- this.currentX[var1] = -this.maxWidth[var1] + 1;
- var2 = true;
- } else if (this.currentX[var1] < -this.maxWidth[var1]) {
- this.currentX[var1] = this.appWidth - 1;
- var2 = true;
- }
-
- if (this.currentY[var1] > this.appHeight + this.maxHeight[var1]) {
- this.currentY[var1] = -this.maxHeight[var1] + 1;
- var2 = true;
- } else if (this.currentY[var1] < -this.maxHeight[var1]) {
- this.currentY[var1] = this.appHeight + this.maxHeight[var1];
- var2 = true;
- }
- }
-
- return var2;
- }
-
- private void init_arrays() {
- this.images = new Vector[this.num_sprites];
- this.currentLoop = new int[this.num_sprites];
- this.repeat = new int[this.num_sprites];
- this.maxWidth = new int[this.num_sprites];
- this.maxHeight = new int[this.num_sprites];
- this.globalPause = 10;
- this.mousePause = new boolean[this.num_sprites];
- this.moveEW = new int[this.num_sprites];
- this.moveNS = new int[this.num_sprites];
- this.currentX = new int[this.num_sprites];
- this.currentY = new int[this.num_sprites];
- this.bounce = new boolean[this.num_sprites];
- this.priority = new int[this.num_sprites];
- this.delay = 0;
- this.timeout = new int[this.num_sprites];
- this.wantsecs = new long[this.num_sprites];
- this.frameNum = new int[this.num_sprites];
- this.frameNumKey = new int[this.num_sprites];
- this.active = new boolean[this.num_sprites];
-
- for(int var1 = 0; var1 < this.num_sprites; ++var1) {
- this.images[var1] = new Vector();
- this.currentLoop[var1] = 0;
- this.repeat[var1] = -1;
- this.maxWidth[var1] = 0;
- this.maxHeight[var1] = 0;
- this.moveEW[var1] = 0;
- this.moveNS[var1] = 0;
- this.frameNum[var1] = 0;
- this.frameNumKey[var1] = 0;
- this.currentX[var1] = 0;
- this.currentY[var1] = 0;
- this.timeout[var1] = -1000;
- this.wantsecs[var1] = 0L;
- this.mousePause[var1] = false;
- this.active[var1] = true;
- this.priority[var1] = var1;
- this.bounce[var1] = false;
- }
-
- }
-
- private final int setFrameNum(int var1, int var2) {
- this.frameNumKey[var2] = var1;
- this.frameNum[var2] = var1;
- return var1;
- }
-
- public synchronized void paint(Graphics var1) {
- if (!this.error && this.loaded) {
- if (this.active_anims == 0 && (this.endimage != null || this.endURL != null)) {
- if (this.endimage != null) {
- var1.clearRect(0, 0, this.appWidth, this.appHeight);
- if (this.backgroundImage != null) {
- var1.drawImage(this.backgroundImage, 0, 0, this);
- }
-
- var1.drawImage(this.endimage, 0, 0, this);
- }
-
- if (this.endURL != null) {
- this.msg("Egor 3.0 - switching pages to " + this.endURL);
- ((Applet)this).getAppletContext().showDocument(this.endURL);
- return;
- }
- }
-
- this.offScrGC.fillRect(0, 0, this.appWidth, this.appHeight);
- if (this.backgroundImage != null) {
- this.offScrGC.drawImage(this.backgroundImage, 0, 0, this);
- }
-
- for(int var3 = 0; var3 < this.num_sprites; ++var3) {
- Image var4 = null;
- int var7 = this.priority[var3];
- if (this.images[var7] != null && this.images[var7].size() > 0) {
- if (this.frameNum[var7] < this.images[var7].size()) {
- if (this.active[var7]) {
- boolean var5 = this.updateXY(var7);
- if (var5 && this.delay > 10) {
- try {
- Thread.sleep((long)this.delay);
- } catch (InterruptedException var6) {
- }
- }
- }
-
- if (var4 == null) {
- var4 = (Image)this.images[var7].elementAt(this.frameNum[var7]);
- }
-
- this.offScrGC.drawImage(var4, this.currentX[var7], this.currentY[var7], this);
- } else {
- var4 = (Image)this.images[var7].lastElement();
- this.offScrGC.drawImage(var4, this.currentX[var7], this.currentY[var7], this);
- }
- }
- }
-
- var1.drawImage(this.offScrImage, 0, 0, this);
- } else {
- Dimension var2 = new Dimension();
- if (this.appWidth != 0) {
- var2.width = this.appWidth;
- }
-
- if (this.appHeight != 0) {
- var2.height = this.appHeight;
- }
-
- var1.clearRect(0, 0, this.appWidth, this.appHeight);
- if (this.backgroundImage != null) {
- if (this.tracker.checkID(1)) {
- var1.clearRect(0, 0, this.appWidth, this.appHeight);
- var1.drawImage(this.backgroundImage, 0, 0, this);
- }
- } else {
- var1.clearRect(0, 0, this.appWidth, this.appHeight);
- }
-
- if (this.startUpImage != null && this.tracker.checkID(0)) {
- var1.drawImage(this.startUpImage, 0, 0, this);
- }
-
- }
- }
-
- private void dbg(String var1) {
- System.out.println(var1);
- ((Applet)this).showStatus(var1);
- }
-
- private boolean checkCRC(String var1) {
- String var2 = Integer.toString(this.CRCint);
- int var4 = var2.length();
- if (var4 > var1.length()) {
- return false;
- } else {
- for(int var3 = 0; var3 < var4; ++var3) {
- this.SausCRC = this.SausCRC + (char)(65 + Integer.parseInt(var2.substring(var3, var3 + 1)));
- }
-
- return this.SausCRC.equals(var1.substring(0, this.SausCRC.length()));
- }
- }
-
- private boolean parseHexBG(String var1) {
- if (var1.length() < 6) {
- return false;
- } else {
- this.bgR = Integer.parseInt(var1.substring(0, 2), 16);
- this.bgG = Integer.parseInt(var1.substring(2, 4), 16);
- this.bgB = Integer.parseInt(var1.substring(4, 6), 16);
- return true;
- }
- }
-
- public void setBehaviour(boolean var1) {
- for(int var2 = 0; var2 < this.num_sprites; ++var2) {
- this.bounce[var2] = var1;
- }
-
- }
-
- public void run() {
- Thread.currentThread();
- if (!this.initialized) {
- this.var_init();
- }
-
- this.dbg("Egor 3.0 animation running");
- Date var1 = new Date();
- long var4 = var1.getTime();
-
- for(int var6 = 0; var6 < this.num_sprites; ++var6) {
- int var3 = this.priority[var6];
- this.currentLoop[var3] = 1;
- int var2 = this.timeout[var3];
- if (var2 > 0) {
- this.wantsecs[var3] = var4 + (long)var2;
- } else {
- this.wantsecs[var3] = var4 - 1000L;
- }
- }
-
- if (!this.loaded) {
- try {
- if (this.BigError) {
- this.msg("Egor - Bad User - Use Egor to change the image list");
- this.error = true;
- return;
- }
-
- Dimension var13 = new Dimension();
- if (this.appWidth != 0) {
- var13.width = this.appWidth;
- }
-
- if (this.appHeight != 0) {
- var13.height = this.appHeight;
- }
-
- ((Component)this).repaint();
- if (this.backgroundImageURL != null) {
- this.backgroundImage = ((Applet)this).getImage(this.backgroundImageURL);
- this.tracker.addImage(this.backgroundImage, 1);
- this.tracker.waitForID(1);
- if (this.tracker.isErrorID(1)) {
- this.msg("Egor - Error loading background image");
- }
-
- this.bgSize = this.getImageDimensions(this.backgroundImage);
- ((Component)this).repaint();
- }
-
- if (this.error) {
- this.msg("Egor - Can't find images");
- return;
- }
-
- this.offScrImage = ((Component)this).createImage(this.appWidth, this.appHeight);
- this.offScrGC = this.offScrImage.getGraphics();
- Color var7 = new Color(this.bgR, this.bgG, this.bgB);
- this.offScrGC.setColor(var7);
- this.loaded = true;
- this.error = false;
- } catch (Exception var10) {
- this.error = true;
- ((Throwable)var10).printStackTrace();
- }
- }
-
- this.active_anims = this.num_sprites;
-
- while(this.active_anims > 0) {
- for(int var14 = 0; var14 < this.num_sprites; ++var14) {
- int var12 = this.priority[var14];
-
- while(!this.active[var12] && var14 < this.num_sprites) {
- ++var14;
- if (var14 < this.num_sprites) {
- var12 = this.priority[var14];
- }
- }
-
- if (var14 == this.num_sprites) {
- break;
- }
-
- if (this.images[var12].size() > 0) {
- var1 = new Date();
- long var15 = var1.getTime();
- if (this.frameNum[var12] >= this.images[var12].size()) {
- if (this.repeat[var12] == 0 || this.currentLoop[var12] >= this.repeat[var12] && this.repeat[var12] > 0 || var15 > this.wantsecs[var12] && this.timeout[var12] > 0) {
- this.active_anims += -1;
- this.active[var12] = false;
- continue;
- }
-
- this.setFrameNum(0, var12);
- if (this.repeat[var12] > 0 && this.currentLoop[var12] < this.repeat[var12]) {
- int var10002 = this.currentLoop[var12]++;
- }
- }
- }
-
- this.update(((Component)this).getGraphics());
-
- try {
- Thread.sleep((long)this.globalPause);
- } catch (InterruptedException var9) {
- }
-
- for(int var16 = 0; var16 < this.num_sprites; ++var16) {
- if (this.active[var16]) {
- this.setFrameNum(this.frameNum[var16] + 1, var16);
- }
- }
- }
- }
-
- }
-
- public void setSound(boolean var1) {
- }
-
- public void changeSpeed(int var1) {
- this.globalPause = var1;
- }
-
- public int getSpeed() {
- return this.globalPause;
- }
-
- private void updateMaxDims(Dimension var1, int var2) {
- this.maxWidth[var2] = Math.max(var1.width, this.maxWidth[var2]);
- this.maxHeight[var2] = Math.max(var1.height, this.maxHeight[var2]);
- }
-
- private boolean parseBackground(String var1) {
- int var2 = 0;
- int var3 = var1.length();
- if (var1.charAt(0) == '#') {
- return this.parseHexBG(var1.substring(1));
- } else {
- int var4 = var1.indexOf(44, 0);
- if (var4 == -1) {
- return false;
- } else {
- this.bgR = Integer.parseInt(var1.substring(0, var4).trim());
- var2 = var4 + 1;
- if (var2 >= var3) {
- return false;
- } else {
- var4 = var1.indexOf(44, var2);
- if (var4 == -1) {
- return false;
- } else {
- this.bgG = Integer.parseInt(var1.substring(var2, var4).trim());
- var2 = var4 + 1;
- if (var2 >= var3) {
- return false;
- } else {
- var4 = var1.indexOf(44, var2);
- if (var4 == -1) {
- this.bgB = Integer.parseInt(var1.substring(var2).trim());
- }
-
- return true;
- }
- }
- }
- }
- }
- }
-
- private void var_init() {
- Object var1 = null;
- Object var2 = null;
- this.initialized = true;
-
- try {
- String var25 = ((Applet)this).getParameter("REGUSER");
- if (var25 == null) {
- this.BigError = true;
- return;
- }
-
- this.dbg("User = " + var25);
- if (var25.equals("Unregistered") && !this.local) {
- this.dbg("Egor 3.0 must be registered to work on the Web");
- this.msg("Egor 3.0 must be registered to work on the Web");
- this.BigError = true;
- return;
- }
-
- this.generateCRC(var25);
- String var11 = ((Applet)this).getParameter("NUM_SPRITES");
- if (var11 == null) {
- this.num_sprites = 1;
- } else {
- this.num_sprites = Integer.parseInt(var11);
- }
-
- this.dbg("NUM_SPRITES = " + this.num_sprites);
- this.init_arrays();
-
- for(int var3 = 0; var3 < this.num_sprites; ++var3) {
- var11 = ((Applet)this).getParameter("REPEAT_" + Integer.toString(var3));
- if (var11 != null) {
- this.repeat[var3] = Integer.parseInt(var11);
- } else {
- this.repeat[var3] = -1;
- }
-
- this.dbg("REPEAT_" + var3 + " = " + this.repeat[var3]);
- }
-
- var11 = ((Applet)this).getParameter("PRIORITY");
- if (var11 != null && !this.parsePriority(var11)) {
- this.msg("Invalid priority. Resetting to default");
-
- for(int var26 = 0; var26 < this.num_sprites; this.priority[var26] = var26++) {
- }
- }
-
- this.dbg("PRIORITY " + var11);
- var11 = ((Applet)this).getParameter("PAUSE");
- this.dbg("PAUSE " + var11);
- if (var11 != null) {
- this.globalPause = Integer.parseInt(var11);
- if (this.globalPause < 0) {
- this.globalPause = 10;
- }
- } else {
- this.globalPause = 10;
- }
-
- this.appWidth = ((Component)this).size().width;
- this.appHeight = ((Component)this).size().height;
-
- for(int var27 = 0; var27 < this.num_sprites; ++var27) {
- var11 = ((Applet)this).getParameter("TIMEOUT_" + Integer.toString(var27));
- Date var4 = new Date();
- int var5 = (int)var4.getTime();
- if (var11 != null) {
- this.timeout[var27] = Integer.parseInt(var11);
- if (this.timeout[var27] <= 0) {
- this.wantsecs[var27] = (long)(var5 - 1000);
- } else {
- this.wantsecs[var27] = (long)(var5 + Integer.parseInt(var11));
- }
- } else {
- this.timeout[var27] = -1000;
- this.wantsecs[var27] = (long)(var5 - 1000);
- }
-
- this.dbg("TIMEOUT_" + var27 + " = " + var11);
- }
-
- var11 = ((Applet)this).getParameter("URL");
- if (var11 != null) {
- try {
- this.glob_destination = new URL((URL)null, var11);
- } catch (MalformedURLException var9) {
- this.dbg("Egor 3.0 - Malformed global destination " + this.glob_destination + ". Trying it as a relative reference");
-
- try {
- this.glob_destination = new URL(this.baseDir, var11);
- } catch (MalformedURLException var8) {
- this.dbg("Egor 3.0 - Malformed global destination " + this.baseDir + this.glob_destination + ". Ignoring.");
- this.glob_destination = null;
- }
- }
- }
-
- this.dbg("URL = " + this.glob_destination);
- var11 = ((Applet)this).getParameter("ENDDELAY");
- this.dbg("ENDDELAY " + var11);
- if (var11 != null) {
- this.delay = Integer.parseInt(var11);
- } else {
- this.delay = 0;
- }
-
- var11 = ((Applet)this).getParameter("ENDIMAGE");
- if (var11 != null) {
- try {
- this.endimage = ((Applet)this).getImage(new URL(this.baseDir, var11));
- } catch (MalformedURLException var7) {
- this.msg("Malformed endimage path. Discarding");
- this.endimage = null;
- }
- }
-
- this.dbg("ENDIMAGE = " + this.baseDir + var11);
- var11 = ((Applet)this).getParameter("ENDURL");
- if (var11 != null) {
- try {
- this.endURL = new URL((URL)null, var11);
- } catch (MalformedURLException var6) {
- this.msg("Malformed end URL. Discarding");
- this.endURL = null;
- }
- }
-
- this.dbg("ENDURL = " + this.endURL);
-
- for(int var28 = 0; var28 < this.num_sprites; ++var28) {
- var11 = ((Applet)this).getParameter("IMAGELIST_" + Integer.toString(var28));
- this.dbg("IMAGELIST_" + var28 + " = " + var11);
- if (var11 == null) {
- this.msg("Egor - No image list. Essential!");
- this.error = true;
- return;
- }
-
- this.images[var28] = this.prepareImages(var11);
- this.generateCRC(var11);
- }
-
- var11 = ((Applet)this).getParameter("SERIALID");
- if (var11 == null) {
- this.BigError = true;
- return;
- }
-
- if (!var25.equals("Unregistered") && !this.checkCRC(var11)) {
- this.BigError = true;
- return;
- }
-
- for(int var29 = 0; var29 < this.num_sprites; ++var29) {
- if (!this.fetchImages(this.images, var29)) {
- this.error = true;
- }
- }
-
- for(int var30 = 0; var30 < this.num_sprites; ++var30) {
- if (this.appWidth == 0) {
- if (this.bgSize.width > this.maxWidth[var30]) {
- this.appWidth = this.bgSize.width;
- } else {
- this.appWidth = this.maxWidth[var30];
- }
- }
-
- if (this.appHeight == 0) {
- if (this.bgSize.height > this.maxHeight[var30]) {
- this.appHeight = this.bgSize.height;
- } else {
- this.appHeight = this.maxHeight[var30];
- }
- }
- }
-
- for(int var31 = 0; var31 < this.num_sprites; ++var31) {
- var11 = ((Applet)this).getParameter("BOUNCE_" + Integer.toString(var31));
- this.bounce[var31] = var11 == null ? true : var11.equalsIgnoreCase("yes") || var11.equalsIgnoreCase("true");
- this.dbg("BOUNCE_" + var31 + " = " + var11);
- }
-
- for(int var32 = 0; var32 < this.num_sprites; ++var32) {
- var11 = ((Applet)this).getParameter("STARTPOS_" + Integer.toString(var32));
- this.dbg("STARTPOS_" + var32 + " =" + var11);
- if (var11 != null) {
- if (!this.parseStartPos(var11, var32)) {
- this.msg("Egor - Invalid start position");
- this.currentX[var32] = 0;
- this.currentY[var32] = 0;
- }
-
- if (this.currentX[var32] > this.appWidth - this.maxWidth[var32]) {
- this.currentX[var32] = this.appWidth - this.maxWidth[var32];
- } else if (this.currentX[var32] < 0) {
- this.currentX[var32] = 0;
- }
-
- if (this.currentY[var32] > this.appHeight - this.maxHeight[var32]) {
- this.currentY[var32] = this.appHeight - this.maxHeight[var32];
- } else if (this.currentY[var32] < 0) {
- this.currentY[var32] = 0;
- }
- } else {
- this.currentX[var32] = 0;
- this.currentY[var32] = 0;
- }
- }
-
- for(int var33 = 0; var33 < this.num_sprites; ++var33) {
- var11 = ((Applet)this).getParameter("MOVE_" + Integer.toString(var33));
- this.dbg("MOVE_" + Integer.toString(var33) + " = " + var11);
- if (var11 != null) {
- if (!this.parseMovement(var11, var33)) {
- this.msg("Egor - Invalid movement param");
- this.moveEW[var33] = 0;
- this.moveNS[var33] = 0;
- }
- } else {
- this.moveEW[var33] = 0;
- this.moveNS[var33] = 0;
- }
- }
- } catch (MalformedURLException var10) {
- }
-
- }
-
- public void init() {
- this.dbg("Applet starting");
- this.tracker = new MediaTracker(this);
- this.baseDir = ((Applet)this).getDocumentBase();
- this.dbg("BASEDIR = " + this.baseDir);
- String var1 = ((Applet)this).getParameter("BACKGROUND");
- if (var1 != null) {
- try {
- this.backgroundImageURL = new URL((URL)null, var1);
- } catch (MalformedURLException var7) {
- this.dbg("Malformed background image path " + var1 + " Trying to make it absolute");
-
- try {
- this.backgroundImageURL = new URL(this.baseDir, var1);
- } catch (MalformedURLException var6) {
- this.dbg("Malformed background image path " + this.baseDir + var1 + ". Ignoring");
- this.backgroundImageURL = null;
- }
- }
- }
-
- this.dbg("BACKGROUNDIMG = " + this.backgroundImageURL);
- var1 = ((Applet)this).getParameter("BG");
- if (var1 != null && !this.parseBackground(var1)) {
- this.msg("Egor - Background messed up, using default");
- this.bgR = 170;
- this.bgG = 170;
- this.bgB = 170;
- }
-
- Color var2 = new Color(this.bgR, this.bgG, this.bgB);
- ((Component)this).setBackground(var2);
- this.loaded = false;
- this.dbg("BG = " + this.bgR + ", " + this.bgG + ", " + this.bgB);
- this.update(((Component)this).getGraphics());
- var1 = ((Applet)this).getParameter("STARTUP");
- if (var1 != null) {
- try {
- this.startUpImageURL = new URL(this.baseDir, var1);
- } catch (MalformedURLException var5) {
- this.dbg("Malformed startup path " + this.baseDir + var1);
- }
- }
-
- this.dbg("STARTUP = " + this.startUpImageURL);
- if (this.startUpImageURL != null) {
- this.startUpImage = ((Applet)this).getImage(this.startUpImageURL);
- this.tracker.addImage(this.startUpImage, 0);
-
- try {
- this.tracker.waitForID(0);
- } catch (InterruptedException var4) {
- }
-
- if (this.tracker.isErrorID(0)) {
- this.msg("Egor - Load error startup image");
- }
-
- if (this.tracker.checkID(0)) {
- ((Component)this).getGraphics().drawImage(this.startUpImage, 0, 0, this);
- }
- }
-
- for(int var3 = 0; var3 < this.num_sprites; ++var3) {
- this.setFrameNum(0, var3);
- }
-
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id != 501) {
- if (var1.id == 503) {
- if (this.BigError) {
- this.msg("Egor 3.0 Unrecoverable error (imagelist or timeout)");
- } else {
- this.msg("Egor 3.0 animation");
- }
-
- return true;
- } else {
- return super.handleEvent(var1);
- }
- } else {
- if (this.loaded) {
- boolean var3 = false;
-
- for(int var4 = 0; var4 < this.num_sprites; ++var4) {
- int var2 = this.priority[this.num_sprites - var4 - 1];
- if (this.ptInRect(var1.x, var1.y, this.currentX[var2], this.currentY[var2], this.currentX[var2] + this.maxWidth[var2], this.currentY[var2] + this.maxWidth[var2])) {
- var3 = true;
- if (this.engine != null && this.engine.isAlive()) {
- if (this.glob_destination != null) {
- this.msg("Egor - Switching pages to " + this.glob_destination);
- ((Applet)this).getAppletContext().showDocument(this.glob_destination);
- } else {
- if (!this.mousePause[var2] && this.active[var2]) {
- this.active_anims += -1;
- this.active[var2] = false;
- } else {
- this.active[var2] = true;
- ++this.active_anims;
- if (this.frameNum[var2] >= this.images[var2].size()) {
- this.setFrameNum(0, var2);
- this.currentLoop[var2] = 0;
- }
- }
-
- this.mousePause[var2] = !this.mousePause[var2];
- }
- } else {
- for(int var5 = 0; var5 < this.num_sprites; ++var5) {
- this.mousePause[var5] = false;
- this.active[var5] = true;
- this.setFrameNum(0, var5);
- }
-
- this.active_anims = this.num_sprites;
- this.engine = new Thread(this);
- this.engine.start();
- }
-
- return true;
- }
- }
-
- if (!var3) {
- this.pause();
- }
- }
-
- return true;
- }
- }
-
- public void changeDirection(int var1) {
- for(int var2 = 0; var2 < this.num_sprites; ++var2) {
- switch (var1) {
- case 1:
- int var12 = this.moveNS[var2]++;
- break;
- case 2:
- int var10 = this.moveEW[var2]++;
- var10 = this.moveNS[var2]++;
- break;
- case 3:
- int var9 = this.moveEW[var2]++;
- break;
- case 4:
- int[] var7 = this.moveNS;
- var7[var2] += -1;
- int var8 = this.moveEW[var2]++;
- break;
- case 5:
- int[] var6 = this.moveNS;
- var6[var2] += -1;
- break;
- case 6:
- int[] var4 = this.moveEW;
- var4[var2] += -1;
- var4 = this.moveNS;
- var4[var2] += -1;
- break;
- case 7:
- int[] var3 = this.moveEW;
- var3[var2] += -1;
- break;
- case 8:
- int var10002 = this.moveNS[var2]++;
- int[] var10000 = this.moveEW;
- var10000[var2] += -1;
- }
- }
-
- }
- }
-