mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Kotlin 2.0 migration
This commit is contained in:
8
.idea/artifacts/TerrarumBuild.xml
generated
8
.idea/artifacts/TerrarumBuild.xml
generated
@@ -13,8 +13,6 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-controllers-desktop-2.2.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/GetCpuName.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jxinput-1.0.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$KOTLIN_BUNDLED$/lib/kotlin-stdlib.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-csv-1.8.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/prtree.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/Terrarum_Joise.jar" path-in-jar="/" />
|
||||
@@ -85,9 +83,9 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-platform-1.12.1-natives-desktop.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/gdx-platform-1.12.1-natives-x86_64.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/TerranVirtualDisk.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
8
.idea/kotlinc.xml
generated
8
.idea/kotlinc.xml
generated
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Kotlin2JvmCompilerArguments">
|
||||
<option name="jvmTarget" value="21" />
|
||||
<option name="jvmTarget" value="1.8" />
|
||||
</component>
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="apiVersion" value="1.9" />
|
||||
<option name="languageVersion" value="1.9" />
|
||||
<option name="apiVersion" value="2.0" />
|
||||
<option name="languageVersion" value="2.0" />
|
||||
</component>
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.23-release-779" />
|
||||
<option name="version" value="2.0.0" />
|
||||
</component>
|
||||
</project>
|
||||
11
.idea/libraries/KotlinJavaRuntime.xml
generated
11
.idea/libraries/KotlinJavaRuntime.xml
generated
@@ -1,14 +1,23 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime" type="repository">
|
||||
<properties include-transitive-deps="false" maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.0" />
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
13
.idea/libraries/jetbrains_kotlin_reflect.xml
generated
13
.idea/libraries/jetbrains_kotlin_reflect.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jetbrains.kotlin.reflect" type="repository">
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-reflect:1.8.22" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.8.22/kotlin-reflect-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/kotlin-stdlib-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.22/kotlin-stdlib-common-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
26
.idea/libraries/jetbrains_kotlin_test.xml
generated
26
.idea/libraries/jetbrains_kotlin_test.xml
generated
@@ -1,26 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jetbrains.kotlin.test" type="repository">
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.22/kotlin-stdlib-jdk8-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/kotlin-stdlib-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.22/kotlin-stdlib-common-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.22/kotlin-stdlib-jdk7-1.8.22.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.22/kotlin-stdlib-jdk8-1.8.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/kotlin-stdlib-1.8.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.22/kotlin-stdlib-common-1.8.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.22/kotlin-stdlib-jdk7-1.8.22-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.22/kotlin-stdlib-jdk8-1.8.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/kotlin-stdlib-1.8.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.22/kotlin-stdlib-common-1.8.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.22/kotlin-stdlib-jdk7-1.8.22-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
13
.idea/libraries/jetbrains_kotlin_test1.xml
generated
13
.idea/libraries/jetbrains_kotlin_test1.xml
generated
@@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="jetbrains.kotlin.test1" type="repository">
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-test:1.8.22" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-test/1.8.22/kotlin-test-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/kotlin-stdlib-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.22/kotlin-stdlib-common-1.8.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -13,12 +13,9 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="TerrarumSansBitmap" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="badlogicgames.gdx" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="badlogicgames.gdx.backend.lwjgl3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jetbrains.kotlin.reflect" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jetbrains.kotlin.test" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="io.airlift.aircompressor" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jetbrains.kotlin.test1" level="project" />
|
||||
<orderEntry type="library" name="gdx-platform-1.12.1-natives-arm64-v8a" level="project" />
|
||||
<orderEntry type="library" name="TerranVirtualDisk" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -7,13 +7,12 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jetbrains.kotlin.test" level="project" />
|
||||
<orderEntry type="module" module-name="TerrarumBuild" scope="PROVIDED" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="badlogicgames.gdx" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="io.airlift.aircompressor" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="TerrarumSansBitmap" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="apache.commons.math3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jetbrains.kotlin.test1" level="project" />
|
||||
<orderEntry type="library" name="gdx-platform-1.12.1-natives-arm64-v8a" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -94,8 +94,11 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
private var currentlySelectedAlbum: AlbumProp? = null
|
||||
|
||||
/** Returns the internal playlist of the MusicGovernor */
|
||||
private val songsInGovernor: List<MusicContainer>
|
||||
get() = ingame.backgroundMusicPlayer.extortField<List<MusicContainer>>("songs")!!
|
||||
private val songsInGovernorrrrrrrrrr: List<MusicContainer>
|
||||
get() = ingame.musicStreamer.extortField<List<MusicContainer>>("songs")!!
|
||||
|
||||
// the value must be "latched" to stay consistent
|
||||
private fun getCurrentPlaylist() = MusicService.currentPlaylist
|
||||
|
||||
/*private val shouldPlayerBeDisabled: Boolean
|
||||
get() {
|
||||
@@ -107,7 +110,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
* is recommended as an ingame interaction may cancel the playback from the playlist from the MusicPlayer
|
||||
* (e.g. interacting with a jukebox) */
|
||||
private val internalPlaylistName: String
|
||||
get() = ingame.backgroundMusicPlayer.playlistName
|
||||
get() = ingame.musicStreamer.playlistName
|
||||
|
||||
fun registerPlaylist(path: String, fileToName: JsonValue?, shuffled: Boolean, diskJockeyingMode: String): TerrarumMusicPlaylist {
|
||||
fun String.isNum(): Boolean {
|
||||
@@ -120,7 +123,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
}
|
||||
}
|
||||
|
||||
val playlist = ingame.backgroundMusicPlayer.queueDirectory(path, shuffled, diskJockeyingMode, false) { filename ->
|
||||
val playlist = ingame.musicStreamer.queueDirectory(path, shuffled, diskJockeyingMode, false) { filename ->
|
||||
fileToName?.get(filename).let {
|
||||
if (it == null)
|
||||
filename.substringBeforeLast('.').replace('_', ' ').split(" ").map { it.capitalize() }.let {
|
||||
@@ -136,19 +139,19 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
}
|
||||
}
|
||||
|
||||
ingame.backgroundMusicPlayer.addMusicStartHook { music ->
|
||||
ingame.musicStreamer.addMusicStartHook { music ->
|
||||
setMusicName(music.name)
|
||||
if (mode <= MODE_PLAYING)
|
||||
transitionRequest = MODE_PLAYING
|
||||
}
|
||||
|
||||
ingame.backgroundMusicPlayer.addMusicStopHook { music ->
|
||||
ingame.musicStreamer.addMusicStopHook { music ->
|
||||
setIntermission()
|
||||
if (mode <= MODE_PLAYING)
|
||||
transitionRequest = MODE_IDLE
|
||||
}
|
||||
|
||||
setPlaylistDisplayVars(songsInGovernor)
|
||||
setPlaylistDisplayVars(playlist)
|
||||
|
||||
return playlist
|
||||
}
|
||||
@@ -189,6 +192,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
|
||||
override fun updateImpl(delta: Float) {
|
||||
val transactionLocked = MusicService.transactionLocked
|
||||
val currentPlaylist = getCurrentPlaylist()
|
||||
|
||||
// process transition request
|
||||
if (transitionRequest != null) {
|
||||
@@ -348,7 +352,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
// prev song
|
||||
if (mode < MODE_SHOW_LIST) {
|
||||
MusicService.playPrevSongInPlaylist {
|
||||
ingame.backgroundMusicPlayer.startMusic(this) // required for "intermittent" mode
|
||||
ingame.musicStreamer.startMusic(this) // required for "intermittent" mode
|
||||
iHitTheStopButton = false
|
||||
stopRequested = false
|
||||
}
|
||||
@@ -401,7 +405,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
// next song
|
||||
if (mode < MODE_SHOW_LIST) {
|
||||
MusicService.playNextSongInPlaylist {
|
||||
ingame.backgroundMusicPlayer.startMusic(this) // required for "intermittent" mode
|
||||
ingame.musicStreamer.startMusic(this) // required for "intermittent" mode
|
||||
iHitTheStopButton = false
|
||||
stopRequested = false
|
||||
}
|
||||
@@ -442,10 +446,10 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
// make playlist clicking (change song within the playlist) work
|
||||
else if (listViewPanelScroll == 1f && mouseOnList != null) {
|
||||
val index = playlistScroll + mouseOnList!!
|
||||
val list = songsInGovernor
|
||||
if (index < list.size) {
|
||||
if (currentPlaylist != null) {
|
||||
if (index < currentPlaylist.musicList.size) {
|
||||
// if selected song != currently playing
|
||||
if (App.audioMixer.musicTrack.currentTrack == null || list[index] != App.audioMixer.musicTrack.currentTrack) {
|
||||
if (App.audioMixer.musicTrack.currentTrack == null || currentPlaylist.musicList[index] != App.audioMixer.musicTrack.currentTrack) {
|
||||
// FIXME the olde way -- must be replaced with one that utilises MusicService
|
||||
// rebuild playlist
|
||||
//ingame.backgroundMusicPlayer.queueIndexFromPlaylist(index)
|
||||
@@ -459,13 +463,14 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
}*/
|
||||
|
||||
MusicService.playNthSongInPlaylist(index) {
|
||||
ingame.backgroundMusicPlayer.startMusic(this) // required for "intermittent" mode
|
||||
ingame.musicStreamer.startMusic(this) // required for "intermittent" mode
|
||||
iHitTheStopButton = false
|
||||
stopRequested = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// make album list clicking (send new playlist to the MusicService) work
|
||||
else if (listViewPanelScroll == 0f && mouseOnList != null) {
|
||||
val index = albumlistScroll + mouseOnList!!
|
||||
@@ -474,7 +479,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
if (index < list.size) {
|
||||
// if selected album is not the same album currently playing, queue that album immediately
|
||||
// (navigating into the selected album involves too much complication :p)
|
||||
if (ingame.backgroundMusicPlayer.playlistSource != albumsList[index].canonicalPath) {
|
||||
if (ingame.musicStreamer.playlistSource != albumsList[index].canonicalPath) {
|
||||
// FIXME the olde way -- must be replaced with one that utilises MusicService
|
||||
// fade out
|
||||
/*App.audioMixer.requestFadeOut(App.audioMixer.musicTrack, AudioMixer.DEFAULT_FADEOUT_LEN / 3f) {
|
||||
@@ -510,10 +515,10 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
ingame.backgroundMusicPlayer.stopMusic(this)
|
||||
}
|
||||
}
|
||||
else*/ if (ingame.backgroundMusicPlayer.playCaller is PlaysMusic && !jukeboxStopMonitorAlert && !App.audioMixer.musicTrack.isPlaying) {
|
||||
else*/ if (ingame.musicStreamer.playCaller is PlaysMusic && !jukeboxStopMonitorAlert && !App.audioMixer.musicTrack.isPlaying) {
|
||||
jukeboxStopMonitorAlert = true
|
||||
val interval = ingame.backgroundMusicPlayer.getRandomMusicInterval()
|
||||
ingame.backgroundMusicPlayer.stopMusic(this, false, interval)
|
||||
val interval = ingame.musicStreamer.getRandomMusicInterval()
|
||||
ingame.musicStreamer.stopMusic(this, false, interval)
|
||||
}
|
||||
else if (App.audioMixer.musicTrack.isPlaying) {
|
||||
jukeboxStopMonitorAlert = false
|
||||
@@ -525,7 +530,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
private var stopRequested = false
|
||||
|
||||
private fun resetAlbumlistScroll() {
|
||||
val currentlyPlaying = albumsList.indexOfFirst { it.canonicalPath.replace('\\', '/') == ingame.backgroundMusicPlayer.playlistSource }
|
||||
val currentlyPlaying = albumsList.indexOfFirst { it.canonicalPath.replace('\\', '/') == ingame.musicStreamer.playlistSource }
|
||||
if (currentlyPlaying >= 0) {
|
||||
albumlistScroll = (currentlyPlaying / PLAYLIST_LINES) * PLAYLIST_LINES
|
||||
}
|
||||
@@ -535,7 +540,9 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
}
|
||||
|
||||
private fun resetPlaylistScroll(song: MusicContainer? = null) {
|
||||
val currentlyPlaying = songsInGovernor.indexOf(song ?: App.audioMixer.musicTrack.currentTrack)
|
||||
val currentPlaylist = getCurrentPlaylist()
|
||||
if (currentPlaylist != null) {
|
||||
val currentlyPlaying = currentPlaylist.musicList.indexOf(song ?: App.audioMixer.musicTrack.currentTrack)
|
||||
if (currentlyPlaying >= 0) {
|
||||
playlistScroll = (currentlyPlaying / PLAYLIST_LINES) * PLAYLIST_LINES
|
||||
}
|
||||
@@ -543,6 +550,10 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
playlistScroll = 0
|
||||
}
|
||||
}
|
||||
else {
|
||||
playlistScroll = 0
|
||||
}
|
||||
}
|
||||
|
||||
/*private fun getPrevSongFromPlaylist(): MusicContainer? {
|
||||
val list = songsInGovernor.slice(songsInGovernor.indices) // make copy of the list
|
||||
@@ -804,9 +815,9 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
albumlistNameOverflown.clear()
|
||||
}
|
||||
|
||||
private fun setPlaylistDisplayVars(plist: List<MusicContainer>) {
|
||||
private fun setPlaylistDisplayVars(plist: TerrarumMusicPlaylist) {
|
||||
resetPlaylistDisplay()
|
||||
plist.forEachIndexed { i, music ->
|
||||
plist.musicList.forEachIndexed { i, music ->
|
||||
val len = App.fontGameFBO.getWidth(music.name)
|
||||
val overflown = (len >= playlistNameLenMax)
|
||||
playlistRealNameLen[i] = len
|
||||
@@ -828,6 +839,9 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
private fun drawPlayList(camera: OrthographicCamera, delta: Float, batch: SpriteBatch, x: Float, y: Float, alpha: Float, scale: Float) {
|
||||
batch.end()
|
||||
|
||||
val currentPlaylist = getCurrentPlaylist()
|
||||
|
||||
if (currentPlaylist != null) {
|
||||
playlistFBOs.forEachIndexed { i, it ->
|
||||
val pnum = i + playlistScroll
|
||||
it.inAction(camera, batch) {
|
||||
@@ -837,29 +851,49 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
// draw text
|
||||
App.fontGameFBO.draw(batch, if (pnum in songsInGovernor.indices) songsInGovernor[pnum].name else "", maskOffWidth - playlistNameScrolls[pnum], (PLAYLIST_LINE_HEIGHT - 24) / 2)
|
||||
App.fontGameFBO.draw(
|
||||
batch,
|
||||
if (pnum in currentPlaylist.musicList.indices) currentPlaylist.musicList[pnum].name else "",
|
||||
maskOffWidth - playlistNameScrolls[pnum],
|
||||
(PLAYLIST_LINE_HEIGHT - 24) / 2
|
||||
)
|
||||
|
||||
// mask off the area
|
||||
batch.color = Color.WHITE
|
||||
blendAlphaMask(batch)
|
||||
batch.draw(textmask.get(0, 0), 0f, 0f, maskOffWidth.toFloat(), PLAYLIST_LINE_HEIGHT)
|
||||
batch.draw(textmask.get(1, 0), maskOffWidth.toFloat(), 0f, PLAYLIST_NAME_LEN - 2f * maskOffWidth, PLAYLIST_LINE_HEIGHT)
|
||||
batch.draw(textmask.get(2, 0), PLAYLIST_NAME_LEN - maskOffWidth.toFloat(), 0f, maskOffWidth.toFloat(), PLAYLIST_LINE_HEIGHT)
|
||||
batch.draw(
|
||||
textmask.get(1, 0),
|
||||
maskOffWidth.toFloat(),
|
||||
0f,
|
||||
PLAYLIST_NAME_LEN - 2f * maskOffWidth,
|
||||
PLAYLIST_LINE_HEIGHT
|
||||
)
|
||||
batch.draw(
|
||||
textmask.get(2, 0),
|
||||
PLAYLIST_NAME_LEN - maskOffWidth.toFloat(),
|
||||
0f,
|
||||
maskOffWidth.toFloat(),
|
||||
PLAYLIST_LINE_HEIGHT
|
||||
)
|
||||
|
||||
blendNormalStraightAlpha(batch) // qnd hack to make sure this line gets called, otherwise the screen briefly goes blank when the playlist view is closed
|
||||
Toolkit.fillArea(batch, 999f, 999f, 1f, 1f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
batch.begin()
|
||||
blendNormalStraightAlpha(batch)
|
||||
if (alpha > 0f) {
|
||||
playlistFBOs.forEachIndexed { i, it ->
|
||||
|
||||
if (currentPlaylist != null) {
|
||||
val alpha2 = alpha + (playListAnimAkku[i] * 0.2f)
|
||||
val pnum = i + playlistScroll
|
||||
|
||||
val m1 = songsInGovernor.getOrNull(pnum)
|
||||
val m1 = currentPlaylist.musicList.getOrNull(pnum)
|
||||
val m2 = App.audioMixer.musicTrack.currentTrack
|
||||
val currentlyPlaying = if (m1 == null || m2 == null) false else (m1 == m2)
|
||||
|
||||
@@ -878,7 +912,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
batch.color = Color(1f, 1f, 1f, alpha * 0.75f)
|
||||
App.fontSmallNumbers.draw(
|
||||
batch,
|
||||
if (pnum in songsInGovernor.indices) "${pnum + 1}" else "",
|
||||
if (pnum in currentPlaylist.musicList.indices) "${pnum + 1}" else "",
|
||||
x + xoff,
|
||||
y + yoff + PLAYLIST_LINE_HEIGHT * i * scale
|
||||
)
|
||||
@@ -887,6 +921,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
// print the name
|
||||
batch.color = Color(1f, 1f, 1f, alpha2)
|
||||
batch.draw(it.colorBufferTexture, x + PLAYLIST_LEFT_GAP * scale, y + PLAYLIST_LINE_HEIGHT * i * scale, it.width * scale, it.height * scale)
|
||||
}
|
||||
|
||||
// separator
|
||||
batch.color = Color(1f, 1f, 1f, alpha * 0.25f)
|
||||
@@ -936,7 +971,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
val pnum = i + albumlistScroll
|
||||
|
||||
val currentlyPlaying = if (pnum in albumsList.indices) {
|
||||
val m1 = ingame.backgroundMusicPlayer.playlistSource
|
||||
val m1 = ingame.musicStreamer.playlistSource
|
||||
val m2 = albumsList[pnum].canonicalPath.replace('\\', '/')
|
||||
(m1 == m2)
|
||||
}
|
||||
@@ -1303,7 +1338,7 @@ class MusicPlayerControl(private val ingame: TerrarumIngame) : UICanvas() {
|
||||
track.doGaplessPlayback = (albumProp.diskJockeyingMode == "continuous")
|
||||
if (track.doGaplessPlayback) {
|
||||
track.pullNextTrack = {
|
||||
track.currentTrack = ingame.backgroundMusicPlayer.pullNextMusicTrack(true)
|
||||
track.currentTrack = ingame.musicStreamer.pullNextMusicTrack(true)
|
||||
setMusicName(track.currentTrack?.name ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,14 @@
|
||||
<orderEntry type="library" name="gdx-controllers-desktop-2.2.1" level="project" />
|
||||
<orderEntry type="library" name="jxinput-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="graalvm-js 22.3.1" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
<orderEntry type="library" name="badlogicgames.gdx" level="project" />
|
||||
<orderEntry type="library" name="badlogicgames.gdx.backend.lwjgl3" level="project" />
|
||||
<orderEntry type="library" name="jetbrains.kotlin.reflect" level="project" />
|
||||
<orderEntry type="library" name="jetbrains.kotlin.test" level="project" />
|
||||
<orderEntry type="library" name="io.github.classgraph" level="project" />
|
||||
<orderEntry type="library" name="apache.commons.math3" level="project" />
|
||||
<orderEntry type="library" name="github.wendykierp.JTransforms" level="project" />
|
||||
<orderEntry type="library" name="io.airlift.aircompressor" level="project" />
|
||||
<orderEntry type="library" name="jetbrains.kotlin.test1" level="project" />
|
||||
<orderEntry type="library" name="gdx-platform-1.12.1-natives-arm64-v8a" level="project" />
|
||||
<orderEntry type="library" name="TerranVirtualDisk" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/android-lint/kxml2-2.3.0.jar
LFS
BIN
lib/android-lint/kxml2-2.3.0.jar
LFS
Binary file not shown.
Binary file not shown.
@@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.android.tools.lint</groupId>
|
||||
<artifactId>lint</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<name>com.android.tools.lint.lint</name>
|
||||
<description>Lint tools. Both a Command line tool and a library to add lint features to other tools</description>
|
||||
<url>http://tools.android.com/</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>The Android Open Source Project</name>
|
||||
</developer>
|
||||
</developers>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.lint</groupId>
|
||||
<artifactId>lint-api</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.lint</groupId>
|
||||
<artifactId>lint-checks</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.external.com-intellij</groupId>
|
||||
<artifactId>intellij-core</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.external.com-intellij</groupId>
|
||||
<artifactId>kotlin-compiler</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.external.org-jetbrains</groupId>
|
||||
<artifactId>uast</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.analytics-library</groupId>
|
||||
<artifactId>protos</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.analytics-library</groupId>
|
||||
<artifactId>shared</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.analytics-library</groupId>
|
||||
<artifactId>tracker</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.build</groupId>
|
||||
<artifactId>manifest-merger</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools.layoutlib</groupId>
|
||||
<artifactId>layoutlib-api</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools</groupId>
|
||||
<artifactId>sdk-common</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.android.tools</groupId>
|
||||
<artifactId>sdklib</artifactId>
|
||||
<version>31.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.0.1-jre</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.kxml</groupId>
|
||||
<artifactId>kxml2</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-reflect</artifactId>
|
||||
<version>1.7.10</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>1.7.10</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/android-lint/uast-31.0.1.jar
LFS
BIN
lib/android-lint/uast-31.0.1.jar
LFS
Binary file not shown.
@@ -240,8 +240,8 @@ class Application(val WIDTH: Int, val HEIGHT: Int) : Game() {
|
||||
|
||||
}
|
||||
|
||||
ymaxDisp.text = "${ys.max()}"
|
||||
ymaxDisp2.text = "${ys2.max()}"
|
||||
ymaxDisp.text = "${ys.maxOrNull()}"
|
||||
ymaxDisp2.text = "${ys2.maxOrNull()}"
|
||||
|
||||
//System.exit(0)
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
|
||||
noticelet.sendNotification(itemID, itemCount)
|
||||
}
|
||||
|
||||
open val backgroundMusicPlayer: BackgroundMusicPlayer = BackgroundMusicPlayer()
|
||||
open val musicStreamer: MusicStreamer = MusicStreamer()
|
||||
}
|
||||
|
||||
inline fun Lock.lock(body: () -> Unit) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.torvald.terrarum.transaction.TransactionState
|
||||
*/
|
||||
object MusicService : TransactionListener() {
|
||||
|
||||
private var currentPlaylist: TerrarumMusicPlaylist? = null
|
||||
var currentPlaylist: TerrarumMusicPlaylist? = null; private set
|
||||
|
||||
override fun getCurrentStatusForTransaction(): TransactionState {
|
||||
return TransactionState(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
open class BackgroundMusicPlayer {
|
||||
open class MusicStreamer {
|
||||
|
||||
open fun update(ingameInstance: IngameInstance, delta: Float) {
|
||||
|
||||
@@ -123,8 +123,7 @@ class AudioMixer : Disposable {
|
||||
|
||||
fun getFreeGuiTrackNoMatterWhat(): TerrarumAudioMixerTrack {
|
||||
synchronized(this) {
|
||||
val it = getFreeGuiTrack() ?: guiTracks.minBy { it.playStartedTime }.also { it.checkedOutTime = System.nanoTime() }
|
||||
return it
|
||||
return getFreeGuiTrack() ?: guiTracks.minByOrNull { it.playStartedTime }.also { it!!.checkedOutTime = System.nanoTime() }!!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +141,7 @@ class AudioMixer : Disposable {
|
||||
*/
|
||||
fun getFreeTrackNoMatterWhat(): TerrarumAudioMixerTrack {
|
||||
synchronized(this) {
|
||||
return getFreeTrack() ?: dynamicTracks.minBy { it.playStartedTime }.also { it.checkedOutTime = System.nanoTime() }
|
||||
return getFreeTrack() ?: dynamicTracks.minByOrNull { it.playStartedTime }.also { it!!.checkedOutTime = System.nanoTime() }!!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
lateinit var gameWorld: GameWorld
|
||||
|
||||
override val backgroundMusicPlayer = TerrarumBackgroundMusicPlayer()
|
||||
override val musicStreamer = TerrarumMusicStreamer()
|
||||
|
||||
init {
|
||||
gameUpdateGovernor = ConsistentUpdateRate
|
||||
@@ -396,7 +396,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
|
||||
backgroundMusicPlayer.update(this, delta)
|
||||
musicStreamer.update(this, delta)
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
// blockMarkings.dispose()
|
||||
uiPenMenu.dispose()
|
||||
uiGetPoiName.dispose()
|
||||
backgroundMusicPlayer.dispose()
|
||||
musicStreamer.dispose()
|
||||
}
|
||||
|
||||
fun getPoiNameForExport(w: Int, h: Int, callback: (String) -> Unit) {
|
||||
|
||||
@@ -262,7 +262,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
override var gameFullyLoaded = false
|
||||
internal set
|
||||
|
||||
override val backgroundMusicPlayer = TerrarumBackgroundMusicPlayer()
|
||||
override val musicStreamer = TerrarumMusicStreamer()
|
||||
|
||||
|
||||
//////////////
|
||||
@@ -1006,7 +1006,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
oldSelectedWireRenderClass = selectedWireRenderClass
|
||||
}
|
||||
|
||||
backgroundMusicPlayer.update(this, delta)
|
||||
musicStreamer.update(this, delta)
|
||||
|
||||
////////////////////////
|
||||
// ui-related updates //
|
||||
@@ -1795,7 +1795,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
catch (e: IllegalArgumentException) {}
|
||||
}
|
||||
|
||||
backgroundMusicPlayer.dispose()
|
||||
musicStreamer.dispose()
|
||||
super.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.audio.audiobank.MusicContainer
|
||||
import net.torvald.terrarum.gameworld.WorldTime.Companion.DAY_LENGTH
|
||||
import java.io.File
|
||||
|
||||
class TerrarumBackgroundMusicPlayer : BackgroundMusicPlayer() {
|
||||
class TerrarumMusicStreamer : MusicStreamer() {
|
||||
private val STATE_INIT = 0
|
||||
private val STATE_FIREPLAY = 1
|
||||
private val STATE_PLAYING = 2
|
||||
@@ -30,41 +30,7 @@ class TerrarumBackgroundMusicPlayer : BackgroundMusicPlayer() {
|
||||
private var shuffled = true
|
||||
private var diskJockeyingMode = "intermittent" // intermittent, continuous
|
||||
|
||||
private fun registerSongsFromDir(musicDir: String, fileToName: ((String) -> String)?) {
|
||||
val musicDir = musicDir.replace('\\', '/')
|
||||
playlistSource = musicDir
|
||||
printdbg(this, "registerSongsFromDir $musicDir")
|
||||
|
||||
val fileToName = if (fileToName == null) {
|
||||
{ name: String -> name.substringBeforeLast('.').replace('_', ' ').split(" ").map { it.capitalize() }.joinToString(" ") }
|
||||
}
|
||||
else fileToName
|
||||
|
||||
playlistName = musicDir.substringAfterLast('/')
|
||||
|
||||
playlist = File(musicDir).listFiles()?.sortedBy { it.name }?.mapNotNull {
|
||||
printdbg(this, "Music: ${it.absolutePath}")
|
||||
try {
|
||||
MusicContainer(
|
||||
fileToName(it.name),
|
||||
it
|
||||
).also { muscon ->
|
||||
|
||||
printdbg(this, "MusicTitle: ${muscon.name}")
|
||||
|
||||
muscon.songFinishedHook = {
|
||||
if (App.audioMixer.musicTrack.currentTrack == it) {
|
||||
stopMusic(this, true, getRandomMusicInterval())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e: GdxRuntimeException) {
|
||||
e.printStackTrace()
|
||||
null
|
||||
}
|
||||
} ?: emptyList() // TODO test code
|
||||
}
|
||||
|
||||
private fun restockMusicBin() {
|
||||
musicBin = ArrayList(if (shuffled) playlist.shuffled() else playlist.slice(playlist.indices))
|
||||
@@ -232,7 +198,7 @@ class TerrarumBackgroundMusicPlayer : BackgroundMusicPlayer() {
|
||||
val timeNow = System.currentTimeMillis()
|
||||
val trackThis = App.audioMixer.musicTrack.currentTrack
|
||||
|
||||
if (caller is TerrarumBackgroundMusicPlayer) {
|
||||
if (caller is TerrarumMusicStreamer) {
|
||||
if (stopCaller == null) {
|
||||
// printdbg(this, "Caller: this, prev caller: $stopCaller, len: $pauseLen, obliging stop request")
|
||||
stopMusic0(trackThis, callStopMusicHook, pauseLen)
|
||||
@@ -19,7 +19,7 @@ import net.torvald.terrarum.gameactors.Hitbox
|
||||
import net.torvald.terrarum.gameactors.Lightbox
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumBackgroundMusicPlayer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumMusicStreamer
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.ItemFileRef
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.MusicDiscHelper
|
||||
@@ -106,7 +106,7 @@ class FixtureJukebox : Electric, PlaysMusic {
|
||||
|
||||
// supress the normal background music playback
|
||||
if (musicIsPlaying && !flagDespawn) {
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, true)
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class FixtureJukebox : Electric, PlaysMusic {
|
||||
printdbg(this, "Stop music $title - $artist")
|
||||
|
||||
// can't call stopDiscPlayback() because of the recursion
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, pauseLen = (INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).getRandomMusicInterval())
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, pauseLen = (INGAME.musicStreamer as TerrarumMusicStreamer).getRandomMusicInterval())
|
||||
}
|
||||
|
||||
discCurrentlyPlaying = index
|
||||
@@ -185,7 +185,7 @@ class FixtureJukebox : Electric, PlaysMusic {
|
||||
*/
|
||||
fun stopGracefully() {
|
||||
stopDiscPlayback()
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, pauseLen = (INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).getRandomMusicInterval())
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, pauseLen = (INGAME.musicStreamer as TerrarumMusicStreamer).getRandomMusicInterval())
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,13 @@ package net.torvald.terrarum.modulebasegame.gameactors
|
||||
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.audio.AudioMixer
|
||||
import net.torvald.terrarum.audio.audiobank.MusicContainer
|
||||
import net.torvald.terrarum.audio.TerrarumAudioMixerTrack
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumBackgroundMusicPlayer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumMusicStreamer
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.ItemFileRef
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.MusicDiscHelper
|
||||
@@ -96,7 +95,7 @@ class FixtureMusicalTurntable : Electric, PlaysMusic {
|
||||
|
||||
// supress the normal background music playback
|
||||
if (musicIsPlaying && !flagDespawn) {
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, true)
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ class FixtureMusicalTurntable : Electric, PlaysMusic {
|
||||
App.printdbg(this, "Stop music $title - $artist")
|
||||
|
||||
// can't call stopDiscPlayback() because of the recursion
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, pauseLen = (INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).getRandomMusicInterval())
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, pauseLen = (INGAME.musicStreamer as TerrarumMusicStreamer).getRandomMusicInterval())
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +162,7 @@ class FixtureMusicalTurntable : Electric, PlaysMusic {
|
||||
*/
|
||||
fun stopGracefully() {
|
||||
stopDiscPlayback()
|
||||
(INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).stopMusic(this, pauseLen = (INGAME.backgroundMusicPlayer as TerrarumBackgroundMusicPlayer).getRandomMusicInterval())
|
||||
(INGAME.musicStreamer as TerrarumMusicStreamer).stopMusic(this, pauseLen = (INGAME.musicStreamer as TerrarumMusicStreamer).getRandomMusicInterval())
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class UIItemSpinner(
|
||||
|
||||
val intermediate = (0..(maxd - mind).div(stepd).ceilToInt()).map {
|
||||
it to ((mind + stepd * it) - id).absoluteValue
|
||||
}.minBy { it.second }.first * stepd + mind
|
||||
}.minByOrNull { it.second }!!.first * stepd + mind
|
||||
initialValue = when (initialValue.javaClass.simpleName) {
|
||||
"Integer" -> intermediate.toInt()
|
||||
else -> intermediate
|
||||
|
||||
Reference in New Issue
Block a user