home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class wavy extends Applet implements Runnable {
- private Thread engineThread;
- private String lbl;
- private char[] label;
- private int stringLen;
- private int count;
- private int loop;
- private int speed;
- private int sleepTime;
- private int jumpheight;
- private myFont font;
- private boolean userPause;
- private int bred;
- private int bgreen;
- private int bblue;
- private int fred;
- private int fgreen;
- private int fblue;
- private int red = 255;
- private int blue;
- private int green;
- private int fade;
- private int jump_char;
- private int char_up = -1;
- private int movey;
- private boolean doneMove;
- private boolean yUp = true;
- private boolean goingUp = true;
- private boolean stayDown;
- private boolean readyToPaint;
- private boolean popcorn;
- private int height;
- // $FF: renamed from: x int
- private int field_0;
- // $FF: renamed from: y int
- private int field_1;
- private int org_y;
- // $FF: renamed from: fm java.awt.FontMetrics
- private FontMetrics field_2;
- private Image offImage;
- private Graphics offGraphics;
- private boolean matched;
- private boolean unreg = true;
- private boolean debug;
-
- public void stop() {
- if (this.engineThread != null && this.engineThread.isAlive()) {
- this.engineThread.stop();
- }
-
- this.engineThread = null;
- }
-
- private void prePaint(Graphics var1) {
- var1.setColor(new Color(this.bred, this.bgreen, this.bblue));
- var1.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
- var1.setColor(new Color(this.red, this.green, this.blue));
- var1.setFont(this.font);
- this.field_2 = var1.getFontMetrics();
- this.field_0 = ((Component)this).size().width / 2 - this.field_2.stringWidth(this.lbl) / 2;
-
- for(int var2 = 0; var2 < this.stringLen; ++var2) {
- var1.drawChars(this.label, var2, 1, this.field_0, this.movey);
- this.field_0 += this.field_2.charWidth(this.label[var2]);
- if (this.yUp) {
- this.movey -= this.speed;
- } else {
- this.movey += this.speed;
- }
-
- if (this.movey < this.height) {
- this.yUp = false;
- } else if (this.movey > this.org_y) {
- this.movey = this.org_y;
- this.yUp = true;
- }
- }
-
- }
-
- private void xyUpdate() {
- this.movey = this.field_1;
- if (this.goingUp) {
- this.field_1 -= this.speed;
- } else {
- this.field_1 += this.speed;
- }
-
- if (this.field_1 < this.height) {
- this.goingUp = false;
- } else if (this.field_1 > this.org_y) {
- this.goingUp = true;
- this.field_1 = this.org_y;
- }
-
- this.yUp = this.goingUp;
- }
-
- public void paint(Graphics var1) {
- if (this.offGraphics != null) {
- this.prePaint(this.offGraphics);
- var1.drawImage(this.offImage, 0, 0, this);
- } else {
- this.prePaint(var1);
- }
-
- }
-
- private void dbg(String var1) {
- if (this.debug) {
- System.out.println(var1);
- }
-
- }
-
- public void update(Graphics var1) {
- if (this.readyToPaint) {
- this.paint(var1);
- }
-
- }
-
- public void start() {
- if (this.engineThread == null) {
- this.engineThread = new Thread(this);
- }
-
- this.engineThread.start();
- }
-
- public String getAppletInfo() {
- return "Swami - wavy.class v1.0 Copyright (c) Sausage SoftWare 1996";
- }
-
- public void run() {
- Thread.currentThread().setPriority(1);
-
- while(true) {
- if (this.unreg) {
- ((Applet)this).getAppletContext().showStatus("Unregistered version. Copyright (c) Sausage Software 1996");
- }
-
- ((Component)this).repaint();
-
- try {
- Thread.sleep((long)this.sleepTime);
- } catch (Exception var1) {
- }
-
- this.readyToPaint = false;
- this.xyUpdate();
- this.readyToPaint = true;
- }
- }
-
- public void init() {
- String var1 = ((Applet)this).getParameter("fontsize");
- int var2 = var1 == null ? 12 : Integer.valueOf(var1);
- int var3 = 0;
- var1 = ((Applet)this).getParameter("style");
- var3 = myFont.getFontStyle(var1);
- var1 = ((Applet)this).getParameter("font");
- String var4 = myFont.getFontName(var1);
- this.dbg(var4);
- this.font = new myFont(var4, var3, var2);
- var1 = ((Applet)this).getParameter("text");
- this.lbl = var1 == null ? "Sausage Software" : var1;
- this.label = this.lbl.toCharArray();
- this.stringLen = this.lbl.length();
- String var5 = ((Applet)this).getParameter("reguser");
- if (var5 == null) {
- ver.NotRegistered();
- }
-
- if (var5.toLowerCase().equals("unregistered")) {
- this.unreg = true;
- } else {
- this.unreg = false;
- }
-
- String var6 = ((Applet)this).getParameter("serialid");
- if (var6 == null) {
- ver.NotRegistered();
- }
-
- ver var7 = new ver(var5, var6);
- this.matched = var7.verifyUser(this.lbl);
- if (!this.matched) {
- ver.NotRegistered();
- }
-
- var1 = ((Applet)this).getParameter("vertical");
- this.speed = var1 == null ? 5 : Integer.parseInt(var1);
- var1 = ((Applet)this).getParameter("jumpheight");
- this.jumpheight = var1 == null ? this.speed * 3 : Integer.parseInt(var1);
- var1 = ((Applet)this).getParameter("color");
- if (var1 != null) {
- createColor var8 = new createColor(var1, ",");
- var8.getColor();
- this.red = var8.getRed();
- this.green = var8.getGreen();
- this.blue = var8.getBlue();
- }
-
- var1 = ((Applet)this).getParameter("background");
- if (var1 != null) {
- createColor var19 = new createColor(var1, ",");
- var19.getColor();
- this.bred = var19.getRed();
- this.bgreen = var19.getGreen();
- this.bblue = var19.getBlue();
- }
-
- var1 = ((Applet)this).getParameter("speed");
- this.sleepTime = var1 == null ? 0 : Integer.parseInt(var1);
-
- try {
- this.offImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.offGraphics = this.offImage.getGraphics();
- } catch (Exception var9) {
- this.offGraphics = null;
- }
-
- this.field_1 = ((Component)this).size().height / 2 + var2 / 2;
- this.movey = this.org_y = this.field_1;
- this.height = this.field_1 - this.jumpheight;
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 501) {
- if (this.userPause) {
- this.engineThread.resume();
- } else {
- this.engineThread.suspend();
- }
-
- this.userPause = !this.userPause;
- } else if (var1.id == 201) {
- this.stop();
- System.exit(0);
- }
-
- return true;
- }
- }
-