Skip to content

Commit 5ebab5f

Browse files
committed
Fixed dealing with OpenAL bug in credits screen and bug extracting ink texts.
1 parent dccf521 commit 5ebab5f

File tree

4 files changed

+45
-32
lines changed

4 files changed

+45
-32
lines changed

adventure-editor/src/main/java/com/bladecoder/engineeditor/common/ModelTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ else if (v.name.equals("s"))
507507
extractInkTextsInternal(aValue, sbTSV, sbMD, prop);
508508
}
509509

510-
} else if (v.isString() && v.asString().charAt(0) == '^') {
510+
} else if (v.isString() && !v.asString().isEmpty() && v.asString().charAt(0) == '^') {
511511
String value = v.asString().substring(1).trim();
512512

513513
if (value.length() == 0 || value.charAt(0) == '>')

adventure-editor/src/main/resources/versions.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ buildToolsVersion=29.0.2
55
libgdxVersion=1.9.10
66
roboVMGradlePluginVersion=2.3.7
77
roboVMVersion=2.3.8
8-
version=3.2.4
8+
version=3.2.5-SNAPSHOT

blade-engine/src/com/bladecoder/engine/ui/CreditsScreen.java

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Locale;
2424
import java.util.Map;
2525

26+
import com.badlogic.gdx.Application.ApplicationType;
2627
import com.badlogic.gdx.Gdx;
2728
import com.badlogic.gdx.Input;
2829
import com.badlogic.gdx.InputAdapter;
@@ -70,8 +71,7 @@ public class CreditsScreen extends ScreenAdapter implements BladeScreen {
7071
private final InputProcessor inputProcessor = new InputAdapter() {
7172
@Override
7273
public boolean keyUp(int keycode) {
73-
if (keycode == Input.Keys.ESCAPE
74-
|| keycode == Input.Keys.BACK)
74+
if (keycode == Input.Keys.ESCAPE || keycode == Input.Keys.BACK)
7575
ui.setCurrentScreen(Screens.MENU_SCREEN);
7676

7777
return true;
@@ -110,31 +110,32 @@ public void render(float delta) {
110110
for (int i = stringHead; i < credits.size(); i++) {
111111
String s = credits.get(i);
112112

113-
char type = 'c'; // types are 'c' -> credit, 't' -> title, 'i' -> image, 's' -> space, 'm' -> music
113+
char type = 'c'; // types are 'c' -> credit, 't' -> title, 'i' -> image, 's' -> space, 'm' ->
114+
// music
114115

115116
if (s.indexOf('#') != -1) {
116117
type = s.charAt(0);
117118
s = s.substring(2);
118119
}
119120

120121
switch (type) {
121-
case 't':
122-
y = processCreditTitle(batch, width, height, y, i, s);
123-
break;
124-
case 'i':
125-
y = processCreditImage(batch, width, height, y, i, s);
126-
break;
127-
case 's':
128-
y = processCreditSpace(height, y, i, s);
129-
break;
130-
case 'm':
131-
processCreditMusic(s);
132-
credits.remove(i);
133-
i--;
134-
break;
135-
default:
136-
y = processCreditDefault(batch, width, height, y, i, s);
137-
break;
122+
case 't':
123+
y = processCreditTitle(batch, width, height, y, i, s);
124+
break;
125+
case 'i':
126+
y = processCreditImage(batch, width, height, y, i, s);
127+
break;
128+
case 's':
129+
y = processCreditSpace(height, y, i, s);
130+
break;
131+
case 'm':
132+
processCreditMusic(s);
133+
credits.remove(i);
134+
i--;
135+
break;
136+
default:
137+
y = processCreditDefault(batch, width, height, y, i, s);
138+
break;
138139
}
139140

140141
if (y < 0) {
@@ -188,22 +189,34 @@ private float processCreditSpace(int height, float y, int i, String s) {
188189
private void processCreditMusic(final String s) {
189190
if (music != null)
190191
music.dispose();
191-
192-
final String sound = EngineAssetManager.getInstance().checkIOSSoundName("music/" + s);
192+
193+
final String file = EngineAssetManager.getInstance().checkIOSSoundName("music/" + s);
193194

194195
new Thread() {
195196
@Override
196197
public void run() {
197-
music = Gdx.audio.newMusic(EngineAssetManager.getInstance().getAsset(sound));
198-
198+
music = Gdx.audio.newMusic(EngineAssetManager.getInstance().getAsset(file));
199+
199200
try {
200201
music.play();
201-
} catch(Exception e) {
202-
// sometimes the play method fails on desktop.
203-
EngineLogger.error("Error Playing music: " + s, e);
202+
music.setVolume(0.5f);
203+
} catch (Exception e) {
204+
205+
// DEAL WITH OPENAL BUG
206+
if (Gdx.app.getType() == ApplicationType.Desktop && e.getMessage().contains("40963")) {
207+
EngineLogger.debug("!!!!!!!!!!!!!!!!!!!!!!!ERROR playing music trying again...!!!!!!!!!!!!!!!");
208+
209+
music = Gdx.audio.newMusic(EngineAssetManager.getInstance().getAsset(file));
210+
music.play();
211+
music.setVolume(0.5f);
212+
213+
return;
214+
}
215+
216+
EngineLogger.error("Error Playing music: " + file);
204217
}
205218
}
206-
}.start();
219+
}.start();
207220
}
208221

209222
private float processCreditDefault(SpriteBatch batch, int width, int height, float y, int i, String s) {
@@ -307,7 +320,7 @@ public void drawCenteredScreenX(SpriteBatch batch, BitmapFont font, CharSequence
307320

308321
layout.setText(font, str, Color.WHITE, viewportWidth, Align.center, true);
309322

310-
//x = (viewportWidth - layout.width)/2;
323+
// x = (viewportWidth - layout.width)/2;
311324

312325
font.draw(batch, layout, x, y);
313326
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=3.2.4
1+
version=3.2.5-SNAPSHOT
22
libgdxVersion=1.9.10
33
roboVMVersion=2.3.8
44
roboVMGradlePluginVersion=2.3.7

0 commit comments

Comments
 (0)