Skip to content

Commit

Permalink
Revert try/catch in engine loops
Browse files Browse the repository at this point in the history
Bump version and date
  • Loading branch information
EXL committed Feb 4, 2017
1 parent e048a0a commit 0009bc8
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.exlmoto.astrosmash"
android:versionCode="1"
android:versionName="1.0" >
android:versionCode="2"
android:versionName="1.1" >

<uses-sdk
android:minSdkVersion="8"
Expand Down
2 changes: 1 addition & 1 deletion res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<string name="CreditsHelp">Помощь</string>
<string name="ButtonHelp">Помощь</string>
<string name="AboutHelpLabel">Справка и помощь</string>
<string name="Version">v1.1 | 23-JAN-2017</string>
<string name="Version">v1.1 | 04-FEB-2017</string>
<string name="IconDesc">Иконка AstroSmash</string>
<string name="AboutString">Портирование с Java ME (J2ME) MIDlet на Android OS с использованием отрисовки с помощью канваса SurfaceView:\n• © 2016 S. \"EXL\" KLS\nemail: [email protected]\nemail: [email protected]\n\nИсходный код:\nhttp://github.com/EXL/AstroSmash\n\nСтатья про портирование AstroSmash:\nhttp://exlmoto.ru/astrosmash-droid\n\nБлагодарности:\n• Данилу Медведеву за идею и поддержку;\n• Никите Прокопчику за классные фотографии;\n• mvb06\'у за тестирование APK-пакета;\n• baat\'у за помощь и поддержку;\n• Zorge.R\'у за хостинг, терпение и помощь.</string>
<string name="DoubleFire">Два снаряда</string>
Expand Down
2 changes: 1 addition & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<string name="CreditsHelp">Help</string>
<string name="ButtonHelp">Help Game</string>
<string name="AboutHelpLabel">About &amp; Help</string>
<string name="Version">v1.1 | 23-JAN-2017</string>
<string name="Version">v1.1 | 04-FEB-2017</string>
<string name="IconDesc">Icon AstroSmash</string>
<string name="AboutString">Porting from Java ME (J2ME) MIDlet to Android OS application with using SurfaceView Canvas drawing:\n• © 2016 S. \"EXL\" KLS\nemail: [email protected]\nemail: [email protected]\n\nSource Code:\nhttp://github.com/EXL/AstroSmash\n\nArticle About Porting AstroSmash:\nhttp://exlmoto.ru/astrosmash-droid\n\nThanks to:\n• Danil Medvedev for idea and support;\n• Nikita Prokopchik for cool photos;\n• mvb06 for testing APK-package;\n• baat for help and support;\n• Zorge.R for hosting, patience and help.</string>
<string name="DoubleFire">Double Fire</string>
Expand Down
138 changes: 69 additions & 69 deletions src/ru/exlmoto/astrosmash/AstroSmashEngine/GameWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,18 @@ public void fireBullet() {
}

protected void tickBullets(long paramLong) {
// try {
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
localCollidable.tick(paramLong, this);
int j = localCollidable.getY() + localCollidable.getHeight();
if (j <= 0) {
sendBulletToHell(localCollidable);
try {
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
localCollidable.tick(paramLong, this);
int j = localCollidable.getY() + localCollidable.getHeight();
if (j <= 0) {
sendBulletToHell(localCollidable);
}
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
localArrayIndexOutOfBoundsException.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
// localArrayIndexOutOfBoundsException.printStackTrace();
// }
}

protected void paintMessage(Canvas canvas, Paint paint, String paramString1, String paramString2) {
Expand All @@ -263,57 +263,57 @@ protected void paintMessage(Canvas canvas, Paint paint, String paramString1, Str
}

protected void paintFlyingBullets(Canvas canvas, Paint paint) {
// try {
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
localCollidable.paint(canvas, paint);
try {
for (int i = 0; i < this.m_vecFlyingBullets.size(); i++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(i);
localCollidable.paint(canvas, paint);
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
localArrayIndexOutOfBoundsException.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
// localArrayIndexOutOfBoundsException.printStackTrace();
// }
}

protected void hyperSpace() {
this.m_ship.setX(AstroSmashView.getAbsRandomInt() % (this.m_nScreenWidth - this.m_ship.getWidth()));
}

protected void tickEnemies(long paramLong) {
// try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy localEnemy2 = this.m_vecFlyingEnemies.elementAt(i);
localEnemy2.tick(paramLong, this);
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getX() + localEnemy2.getWidth() >= this.m_nScreenWidth) || (localEnemy2.getY() < 0) || (localEnemy2.getX() < 0)) {
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getY() < 0)) {
updateScore(localEnemy2.getGroundScore());
}
this.m_EnemiesToRecycleStack.push(localEnemy2);
if ((localEnemy2.getEnemyTypeId() == 8) || (localEnemy2.getEnemyTypeId() == 9)) {
this.m_ship.setCollided(true);
shipDestroyed();
updateScore(-100);
break;
}
} else {
if (this.m_ship.intersects(localEnemy2)) {
shipDestroyed();
updateScore(-100);
break;
}
for (int k = 0; k < this.m_vecFlyingBullets.size(); k++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(k);
if (localCollidable.intersects(localEnemy2, 1, 2)) {
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_SHORT);
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_HIT);
updateScore(localEnemy2.getHitScore());
sendBulletToHell(localCollidable);
try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy localEnemy2 = this.m_vecFlyingEnemies.elementAt(i);
localEnemy2.tick(paramLong, this);
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getX() + localEnemy2.getWidth() >= this.m_nScreenWidth) || (localEnemy2.getY() < 0) || (localEnemy2.getX() < 0)) {
if ((localEnemy2.getY() + localEnemy2.getHeight() >= this.m_groundHeight) || (localEnemy2.getY() < 0)) {
updateScore(localEnemy2.getGroundScore());
}
this.m_EnemiesToRecycleStack.push(localEnemy2);
if ((localEnemy2.getEnemyTypeId() == 8) || (localEnemy2.getEnemyTypeId() == 9)) {
this.m_ship.setCollided(true);
shipDestroyed();
updateScore(-100);
break;
}
} else {
if (this.m_ship.intersects(localEnemy2)) {
shipDestroyed();
updateScore(-100);
break;
}
for (int k = 0; k < this.m_vecFlyingBullets.size(); k++) {
Collidable localCollidable = this.m_vecFlyingBullets.elementAt(k);
if (localCollidable.intersects(localEnemy2, 1, 2)) {
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_SHORT);
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_HIT);
updateScore(localEnemy2.getHitScore());
sendBulletToHell(localCollidable);
break;
}
}
}
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
localArrayIndexOutOfBoundsException.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
// localArrayIndexOutOfBoundsException.printStackTrace();
// }
sendWaitingEnemiesToFactory();
if (!this.m_bSuspendEnemies) {
if (this.m_vecFlyingEnemies.size() < MAX_NUM_ENEMIES[this.m_nLevel]) {
Expand Down Expand Up @@ -378,14 +378,14 @@ protected void sendDeadEnemyToHell(Enemy paramEnemy) {
}

protected void paintEnemies(Canvas canvas, Paint paint) {
// try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy localEnemy = this.m_vecFlyingEnemies.elementAt(i);
localEnemy.paint(canvas, paint);
try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy localEnemy = this.m_vecFlyingEnemies.elementAt(i);
localEnemy.paint(canvas, paint);
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
localArrayIndexOutOfBoundsException.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException) {
// localArrayIndexOutOfBoundsException.printStackTrace();
// }
}

protected void sendBulletToHell(Collidable paramCollidable) {
Expand All @@ -396,23 +396,23 @@ protected void sendBulletToHell(Collidable paramCollidable) {
protected void shipDestroyed() {
AstroSmashLauncher.doVibrate(AstroSmashLauncher.VIBRATE_LONG);
AstroSmashLauncher.playSound(AstroSmashLauncher.SOUND_SHIP);
// try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy enemy = this.m_vecFlyingEnemies.elementAt(i);
this.m_EnemiesToRecycleStack.push(enemy);
try {
for (int i = 0; i < this.m_vecFlyingEnemies.size(); i++) {
Enemy enemy = this.m_vecFlyingEnemies.elementAt(i);
this.m_EnemiesToRecycleStack.push(enemy);
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
localArrayIndexOutOfBoundsException1.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
// localArrayIndexOutOfBoundsException1.printStackTrace();
// }
sendWaitingEnemiesToFactory();
// try {
for (int j = 0; j < this.m_vecFlyingBullets.size(); j++) {
Collidable collidable = this.m_vecFlyingBullets.elementAt(j);
this.m_BulletsToRecycleStack.push(collidable);
try {
for (int j = 0; j < this.m_vecFlyingBullets.size(); j++) {
Collidable collidable = this.m_vecFlyingBullets.elementAt(j);
this.m_BulletsToRecycleStack.push(collidable);
}
} catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
localArrayIndexOutOfBoundsException2.printStackTrace();
}
// } catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
// localArrayIndexOutOfBoundsException2.printStackTrace();
// }
this.m_vecFlyingBullets.removeAllElements();
while (!this.m_BulletsToRecycleStack.empty()) {
Collidable localCollidable = this.m_BulletsToRecycleStack.pop();
Expand Down

0 comments on commit 0009bc8

Please sign in to comment.