Skip to content

Commit

Permalink
More collision related functions renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
rndtrash committed Apr 2, 2023
1 parent 9d0671e commit 8ddc40e
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/main/java/com/nokia/mid/appl/boun/BounceGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ public void WriteToStore(int what) {
dataOutputStream.writeInt(this.v.score);
dataOutputStream.writeInt(this.v.l);
dataOutputStream.writeInt(this.v.k);
dataOutputStream.writeInt(this.v.aq.s);
dataOutputStream.writeInt(this.v.aq.r);
dataOutputStream.writeInt(this.v.aq.TODO_unkX);
dataOutputStream.writeInt(this.v.aq.TODO_unkY);
dataOutputStream.writeInt(this.v.aq.l);
dataOutputStream.writeInt(this.v.aq.o);
dataOutputStream.writeInt(0);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/nokia/mid/appl/boun/Vec2S.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ public Vec2S(short x, short y) {
this.y = y;
}

public Vec2S() {
this((short) 0, (short) 0);
}
}
84 changes: 42 additions & 42 deletions src/main/java/com/nokia/mid/appl/boun/b.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ public static final class SpriteIDs {

public boolean d;

protected int s;
protected int TODO_ballInitialX;

protected int S;
protected int TODO_ballInitialY;

/**
* Either 12 (small) or 16 (big)
*/
public int BallSize;

protected int W;
protected int exitX;

protected int V;
protected int exitY;

public short[][] LevelTiles;

Expand Down Expand Up @@ -169,9 +169,9 @@ public static final class SpriteIDs {

public Image imageHoop;

public int al;
public int tileX;

public int u;
public int tileY;

public Image aa;

Expand Down Expand Up @@ -226,17 +226,17 @@ public void LoadLevelId(int levelId) {
try {
levelStream = getClass().getResourceAsStream("/levels/J2MElvl." + levelName);
levelDIS = new DataInputStream(levelStream);
this.s = levelDIS.read();
this.S = levelDIS.read();
this.TODO_ballInitialX = levelDIS.read();
this.TODO_ballInitialY = levelDIS.read();
int isBigBall = levelDIS.read();
if (isBigBall == 0) {
this.BallSize = 12;
} else {
this.BallSize = 16;
}
this.W = levelDIS.read();
this.V = levelDIS.read();
CreateTiles(this.W, this.V, this.Sprites[SpriteIDs.EXIT]);
this.exitX = levelDIS.read();
this.exitY = levelDIS.read();
CreateTiles(this.exitX, this.exitY, this.Sprites[SpriteIDs.EXIT]);
this.HoopsTotal = levelDIS.read();
this.TODO_width = levelDIS.read();
this.TODO_height = levelDIS.read();
Expand Down Expand Up @@ -337,32 +337,32 @@ public void RunGarbageCollector() {
Runtime.getRuntime().gc();
}

public void o() {
for (byte b1 = 0; b1 < this.DynThornsCount; b1++) {
short s1 = this.DynThornsBottomLeft[b1].x;
short s2 = this.DynThornsBottomLeft[b1].y;
short s3 = this.w[b1].x;
short s4 = this.w[b1].y;
this.w[b1].x = (short) (this.w[b1].x + this.ae[b1].x);
int n = (this.DynThornsTopRight[b1].x - s1 - 2) * 12;
int i1 = (this.DynThornsTopRight[b1].y - s2 - 2) * 12;
if (this.w[b1].x < 0) {
this.w[b1].x = 0;
} else if (this.w[b1].x > n) {
this.w[b1].x = (short) n;
}
if (this.w[b1].x == 0 || this.w[b1].x == n)
this.ae[b1].x = (short) -this.ae[b1].x;
this.w[b1].y = (short) (this.w[b1].y + this.ae[b1].y);
if (this.w[b1].y < 0) {
this.w[b1].y = 0;
} else if (this.w[b1].y > i1) {
this.w[b1].y = (short) i1;
}
if (this.w[b1].y == 0 || this.w[b1].y == i1)
this.ae[b1].y = (short) (this.ae[b1].y * -1);
short s5 = this.w[b1].x;
short s6 = this.w[b1].y;
public void UpdateDynThorns() {
for (byte thorn = 0; thorn < this.DynThornsCount; thorn++) {
short s1 = this.DynThornsBottomLeft[thorn].x;
short s2 = this.DynThornsBottomLeft[thorn].y;
short s3 = this.w[thorn].x;
short s4 = this.w[thorn].y;
this.w[thorn].x = (short) (this.w[thorn].x + this.ae[thorn].x);
int n = (this.DynThornsTopRight[thorn].x - s1 - 2) * 12;
int i1 = (this.DynThornsTopRight[thorn].y - s2 - 2) * 12;
if (this.w[thorn].x < 0) {
this.w[thorn].x = 0;
} else if (this.w[thorn].x > n) {
this.w[thorn].x = (short) n;
}
if (this.w[thorn].x == 0 || this.w[thorn].x == n)
this.ae[thorn].x = (short) -this.ae[thorn].x;
this.w[thorn].y = (short) (this.w[thorn].y + this.ae[thorn].y);
if (this.w[thorn].y < 0) {
this.w[thorn].y = 0;
} else if (this.w[thorn].y > i1) {
this.w[thorn].y = (short) i1;
}
if (this.w[thorn].y == 0 || this.w[thorn].y == i1)
this.ae[thorn].y = (short) (this.ae[thorn].y * -1);
short s5 = this.w[thorn].x;
short s6 = this.w[thorn].y;
if (s5 < s3) {
short s = s5;
s5 = s3;
Expand Down Expand Up @@ -453,8 +453,8 @@ public void CreateTiles(int paramInt1, int paramInt2, int paramInt3, int paramIn
graphics.drawImage(this.Sprites[com.nokia.mid.appl.boun.d.b[tileId - 13]], paramInt3, paramInt4, Graphics.TOP | Graphics.LEFT);
}
case 9 -> { // TODO: what's this tile???
j = (paramInt1 - this.al) * 12;
k = (paramInt2 - this.u) * 12;
j = (paramInt1 - this.tileX) * 12;
k = (paramInt2 - this.tileY) * 12;
graphics.setClip(paramInt3, paramInt4, 12, 12);
graphics.drawImage(this.aa, paramInt3 - j, paramInt4 - k, Graphics.TOP | Graphics.LEFT);
graphics.setClip(0, 0, this.E.getWidth(), this.E.getHeight());
Expand Down Expand Up @@ -806,9 +806,9 @@ public static Image CreateTiles(String path) {
return image;
}

public void CreateTiles(int paramInt1, int paramInt2, Image paramImage) {
this.al = paramInt1;
this.u = paramInt2;
public void CreateTiles(int tileX, int tileY, Image paramImage) {
this.tileX = tileX;
this.tileY = tileY;
this.o = paramImage;
this.aa = Image.createImage(24, 24);
this.b = 0;
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/com/nokia/mid/appl/boun/e.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void a(int paramInt1, int paramInt2) {
AddScore();
this.p = 120;
this.y = true;
if (this.game.e != this.s && this.game.b != this.S)
if (this.game.e != this.TODO_ballInitialX && this.game.b != this.TODO_ballInitialY)
this.LevelTiles[this.game.b][this.game.e] = (short) (0x8 | this.LevelTiles[this.game.b][this.game.e] & 0x40);
a(paramInt1, paramInt2, this.game.A, this.game.a, this.game.g);
synchronized (this.aq) {
Expand All @@ -118,13 +118,13 @@ private void InitializeGame() {
this.HoopsScored = 0;
this.p = 120;
this.y = true;
a(this.s * 12 + 6, this.S * 12 + 6, this.BallSize, 0, 0);
this.aq.a(this.s, this.S);
a(this.TODO_ballInitialX * 12 + 6, this.TODO_ballInitialY * 12 + 6, this.BallSize, 0, 0);
this.aq.a(this.TODO_ballInitialX, this.TODO_ballInitialY);
this.T = true;
}

public void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5) {
this.aq = new f(paramInt1, paramInt2, paramInt3, this);
public void a(int paramInt1, int paramInt2, int ballSize, int paramInt4, int paramInt5) {
this.aq = new f(paramInt1, paramInt2, ballSize, this);
this.aq.l = paramInt4;
this.aq.o = paramInt5;
this.l = 0;
Expand All @@ -133,7 +133,7 @@ public void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int pa
}

public void e() {
int i = this.aq.s - 64;
int i = this.aq.TODO_unkX - 64;
if (i < 0) {
i = 0;
} else if (i > this.TODO_width * 12 - 156) {
Expand All @@ -143,9 +143,9 @@ public void e() {
this.v = this.l * 12 - i;
this.Z = 156;
this.G = this.l + 13;
while (this.aq.r - 6 < this.k * 12)
while (this.aq.TODO_unkY - 6 < this.k * 12)
this.k -= 7;
while (this.aq.r + 6 > this.k * 12 + 96)
while (this.aq.TODO_unkY + 6 > this.k * 12 + 96)
this.k += 7;
f();
}
Expand All @@ -169,7 +169,7 @@ public void q() {
}
}
a(this.X, this.v);
CreateTiles(this.X, this.aq.s, this.aq.r, this.aq.p, this.v);
CreateTiles(this.X, this.aq.TODO_unkX, this.aq.TODO_unkY, this.aq.p, this.v);
this.X.setClip(0, 0, 128, 128);
if (this.y) {
this.X.setColor(0x0853aa); // Blue background
Expand Down Expand Up @@ -209,8 +209,8 @@ public void paint(Graphics paramGraphics) {
public void a(Graphics paramGraphics, int paramInt) {
if (this.aq == null)
return;
int i = this.aq.s - this.l * 12;
int j = this.aq.r - this.k * 12;
int i = this.aq.TODO_unkX - this.l * 12;
int j = this.aq.TODO_unkY - this.k * 12;
if (this.aq.z == 2) {
paramGraphics.drawImage(this.aq.spritePoppedBall, i - 6 + paramInt, j - 6, 20);
} else {
Expand Down Expand Up @@ -259,7 +259,7 @@ public void Tick() {
this.p--;

synchronized (this.aq) {
if (this.aq.r - 6 < this.k * 12 || this.aq.r + 6 > this.k * 12 + 96) {
if (this.aq.TODO_unkY - 6 < this.k * 12 || this.aq.TODO_unkY + 6 > this.k * 12 + 96) {
e();
} else {
this.aq.b();
Expand All @@ -280,20 +280,20 @@ public void Tick() {
this.aq.b = k;
}
if (this.DynThornsCount != 0)
o();
UpdateDynThorns();
if (this.HoopsScored == this.HoopsTotal)
this.TODO_ExitUnlocked = true;
if (this.TODO_ExitUnlocked && this.z && (this.W + 1) * 12 > m() && this.W * 12 < g()) {
if (this.TODO_ExitUnlocked && this.z && (this.exitX + 1) * 12 > m() && this.exitX * 12 < g()) {
if (this.M) {
this.z = false;
this.TODO_ExitUnlocked = false;
} else {
h();
}
this.LevelTiles[this.u][this.al] = (short) (this.LevelTiles[this.u][this.al] | 0x80);
this.LevelTiles[this.u][this.al + 1] = (short) (this.LevelTiles[this.u][this.al + 1] | 0x80);
this.LevelTiles[this.u + 1][this.al] = (short) (this.LevelTiles[this.u + 1][this.al] | 0x80);
this.LevelTiles[this.u + 1][this.al + 1] = (short) (this.LevelTiles[this.u + 1][this.al + 1] | 0x80);
this.LevelTiles[this.tileY][this.tileX] = (short) (this.LevelTiles[this.tileY][this.tileX] | 0x80);
this.LevelTiles[this.tileY][this.tileX + 1] = (short) (this.LevelTiles[this.tileY][this.tileX + 1] | 0x80);
this.LevelTiles[this.tileY + 1][this.tileX] = (short) (this.LevelTiles[this.tileY + 1][this.tileX] | 0x80);
this.LevelTiles[this.tileY + 1][this.tileX + 1] = (short) (this.LevelTiles[this.tileY + 1][this.tileX + 1] | 0x80);
}
this.boostTimer = 0;
if (this.aq.TODO_somePowerUp1 != 0 || this.aq.powerUpGravity != 0 || this.aq.TODO_somePowerUp3 != 0) {
Expand All @@ -307,7 +307,7 @@ public void Tick() {
this.y = true;
}
}
LoadSpriteSheet(this.aq.s);
LoadSpriteSheet(this.aq.TODO_unkX);
q();
repaint();
if (this.e) {
Expand Down
Loading

0 comments on commit 8ddc40e

Please sign in to comment.