home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.image.ImageObserver;
-
- class BounceImage {
- static float inelasticity = 0.96F;
- // $FF: renamed from: Ax float
- static float field_0;
- // $FF: renamed from: Ay float
- static float field_1 = 2.0E-4F;
- // $FF: renamed from: Ar float
- static float field_2 = 0.9F;
- // $FF: renamed from: x float
- public float field_3;
- // $FF: renamed from: y float
- public float field_4;
- public int width;
- public int height;
- // $FF: renamed from: Vx float
- public float field_5 = 0.1F;
- // $FF: renamed from: Vy float
- public float field_6 = 0.05F;
- public int index;
- // $FF: renamed from: Vr float
- public float field_7 = 0.005F + (float)Math.random() * 0.001F;
- public float findex;
- BounceItem parent;
- static boolean imagesReadIn;
-
- public void play(int var1) {
- if (this.parent.sounds[var1] != null) {
- this.parent.sounds[var1].play();
- }
-
- }
-
- public BounceImage(BounceItem var1) {
- this.parent = var1;
- this.width = 65;
- this.height = 72;
- }
-
- public void move(float var1, float var2) {
- this.field_3 = var1;
- this.field_4 = var2;
- }
-
- public void paint(Graphics var1) {
- int var2 = this.index;
- if (this.parent.bounceimages[var2] == null) {
- var2 = 0;
- }
-
- var1.drawImage(this.parent.bounceimages[var2], (int)this.field_3, (int)this.field_4, (ImageObserver)null);
- }
-
- public void step(long var1) {
- boolean var3 = false;
- boolean var4 = false;
- float var5 = (float)Math.random() * 0.01F - 0.005F;
- this.field_3 = (float)((double)this.field_3 + (double)(this.field_5 * (float)var1) + (double)field_0 / (double)2.0F * (double)var1 * (double)var1);
- this.field_4 = (float)((double)this.field_4 + (double)(this.field_6 * (float)var1) + (double)field_1 / (double)2.0F * (double)var1 * (double)var1);
- if (this.field_3 <= 0.0F) {
- this.field_3 = 0.0F;
- this.field_5 = -this.field_5 * inelasticity + var5;
- var3 = true;
- this.play((int)(Math.random() * (double)3.0F));
- }
-
- Dimension var6 = this.parent.size();
- if (this.field_3 + (float)this.width >= (float)var6.width) {
- this.field_3 = (float)(var6.width - this.width);
- this.field_5 = -this.field_5 * inelasticity + var5;
- var3 = true;
- this.play((int)(Math.random() * (double)3.0F));
- }
-
- if (this.field_4 <= 0.0F) {
- this.field_4 = 0.0F;
- this.field_6 = -this.field_6 * inelasticity + var5;
- var4 = true;
- this.play((int)(Math.random() * (double)3.0F));
- }
-
- if (this.field_4 + (float)this.height >= (float)var6.height) {
- this.field_4 = (float)(var6.height - this.height);
- this.field_5 *= inelasticity;
- this.field_6 = -this.field_6 * inelasticity + var5;
- var4 = true;
- }
-
- this.move(this.field_3, this.field_4);
- this.field_6 += field_1 * (float)var1;
- this.field_5 += field_0 * (float)var1;
- this.findex += this.field_7 * (float)var1;
- if (var3 || var4) {
- this.field_7 *= field_2;
- }
-
- while((double)this.findex <= (double)0.0F) {
- this.findex += (float)this.parent.bounceimages.length;
- }
-
- this.index = (int)this.findex % this.parent.bounceimages.length;
- }
- }
-