-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlegacy-migration.patch
More file actions
339 lines (317 loc) · 18.3 KB
/
legacy-migration.patch
File metadata and controls
339 lines (317 loc) · 18.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
index b936053d..1703cf33 100644
--- a/android/build.gradle.kts
+++ b/android/build.gradle.kts
@@ -60,7 +60,7 @@ android {
defaultConfig {
applicationId = ApplicationInfo.packageName
- minSdk = 23
+ minSdk = 16
targetSdk = 36
versionCode = ApplicationInfo.versionCode
diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro
index 6879d376..2bd4dad4 100644
--- a/android/proguard-rules.pro
+++ b/android/proguard-rules.pro
@@ -24,3 +24,5 @@
-keep class com.badlogic.gdx.** { *; }
-keep @kotlinx.serialization.Serializable class * { *; }
+
+-dontwarn com.badlogic.gdx.jnigen.**
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index 66ba35ec..8feee9c3 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
+ <uses-sdk tools:overrideLibrary="co.touchlab.kermit,co.touchlab.kermit.core" />
+
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
index 660e37fd..d0fd1b99 100644
--- a/buildSrc/src/main/kotlin/Versions.kt
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -10,7 +10,7 @@ object Versions {
*
* [Source](https://github.com/libgdx/libgdx)
*/
- const val gdx = "1.13.1"
+ const val gdx = "1.9.10"
/**
* Dagger version
@@ -66,14 +66,14 @@ object Versions {
*
* [Source](https://github.com/libgdx/box2dlights)
*/
- const val box2dLights = "1.5"
+ const val box2dLights = "1.4"
/**
* Kotlin extensions for libGDX.
*
* [Source](https://github.com/libktx/ktx)
*/
- const val libKtx = "1.13.1-rc1"
+ const val libKtx = "1.9.10-b6"
/**
* Kotlin coroutines
diff --git a/core/data/save/src/main/kotlin/ru/fredboy/cavedroid/data/save/repository/SaveDataRepositoryImpl.kt b/core/data/save/src/main/kotlin/ru/fredboy/cavedroid/data/save/repository/SaveDataRepositoryImpl.kt
index 8504e5d8..2552d1cb 100644
--- a/core/data/save/src/main/kotlin/ru/fredboy/cavedroid/data/save/repository/SaveDataRepositoryImpl.kt
+++ b/core/data/save/src/main/kotlin/ru/fredboy/cavedroid/data/save/repository/SaveDataRepositoryImpl.kt
@@ -5,6 +5,7 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.PixmapIO
+import com.badlogic.gdx.utils.ScreenUtils
import com.badlogic.gdx.utils.TimeUtils
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromByteArray
@@ -338,7 +339,7 @@ internal class SaveDataRepositoryImpl @Inject constructor(
return
}
- val pixmap = Pixmap.createFromFrameBuffer(
+ val pixmap = ScreenUtils.getFrameBufferPixmap(
halfWidth - screenshotHalfSize,
halfHeight - screenshotHalfSize,
screenshotHalfSize shl 1,
diff --git a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/GameInputProcessor.kt b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/GameInputProcessor.kt
index d9cfc2ca..ce46aafa 100644
--- a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/GameInputProcessor.kt
+++ b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/GameInputProcessor.kt
@@ -110,8 +110,6 @@ class GameInputProcessor @Inject constructor(
)
}
- override fun touchCancelled(p0: Int, p1: Int, p2: Int, p3: Int): Boolean = false
-
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
val (touchX, touchY) = gameContextRepository.getCameraContext().getViewportCoordinates(screenX, screenY)
@@ -147,13 +145,13 @@ class GameInputProcessor @Inject constructor(
override fun mouseMoved(p0: Int, p1: Int): Boolean = false
- override fun scrolled(amountX: Float, amountY: Float): Boolean {
+ override fun scrolled(amount: Int): Boolean {
val action: MouseInputAction? = mouseInputActionMapper
.mapScrolled(
mouseX = Gdx.input.x.toFloat(),
mouseY = Gdx.input.y.toFloat(),
- amountX = amountX,
- amountY = amountY,
+ amountX = 0f,
+ amountY = amount.toFloat(),
)
return handleMouseAction(action)
}
diff --git a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/MouseCursorInputHandler.kt b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/MouseCursorInputHandler.kt
index 09ccc5a5..b21d185a 100644
--- a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/MouseCursorInputHandler.kt
+++ b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/MouseCursorInputHandler.kt
@@ -38,7 +38,7 @@ class MouseCursorInputHandler @Inject constructor(
private fun getPlayerHeadRotation(mouseWorldX: Float, mouseWorldY: Float): Float {
val h = mouseWorldX - player.position.x
val v = mouseWorldY - (player.position.y - player.height / 2f + player.width / 2f)
- val rotation = MathUtils.atan(v / h) * MathUtils.radDeg
+ val rotation = kotlin.math.atan((v / h).toDouble()).toFloat() * MathUtils.radDeg
return MathUtils.clamp(rotation, -45f, 45f)
}
diff --git a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/UseItemMouseInputHandler.kt b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/UseItemMouseInputHandler.kt
index 55f6c9b9..91135eb3 100644
--- a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/UseItemMouseInputHandler.kt
+++ b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/mouse/UseItemMouseInputHandler.kt
@@ -183,7 +183,7 @@ class UseItemMouseInputHandler @Inject constructor(
x = mobController.player.position.x + mobController.player.direction.basis,
y = mobController.player.position.y - mobController.player.height / 3f,
velocity = Vector2.X.cpy()
- .setAngleDeg(mobController.player.headRotation + 180f * (1 - mobController.player.direction.index))
+ .setAngle(mobController.player.headRotation + 180f * (1 - mobController.player.direction.index))
.scl(300f * ((mobController.player.bowState.toFloat() + 1f) / 3f)),
)
mobController.player.isPullingBow = false
diff --git a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/touch/TouchCursorInputHandler.kt b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/touch/TouchCursorInputHandler.kt
index 4ec77fc9..37aebf8c 100644
--- a/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/touch/TouchCursorInputHandler.kt
+++ b/core/gameplay/controls/src/main/kotlin/ru/fredboy/cavedroid/gameplay/controls/input/handler/touch/TouchCursorInputHandler.kt
@@ -153,7 +153,7 @@ class TouchCursorInputHandler @Inject constructor(
x = mobController.player.position.x + mobController.player.direction.basis,
y = mobController.player.position.y - mobController.player.height / 3f,
velocity = Vector2.X.cpy()
- .setAngleDeg(mobController.player.headRotation + 180f * (1 - mobController.player.direction.index))
+ .setAngle(mobController.player.headRotation + 180f * (1 - mobController.player.direction.index))
.scl(300f * ((mobController.player.bowState.toFloat() + 1f) / 3f)),
)
mobController.player.isPullingBow = false
@@ -323,7 +323,7 @@ class TouchCursorInputHandler @Inject constructor(
private fun getPlayerHeadRotation(mouseWorldX: Float, mouseWorldY: Float): Float {
val h = mouseWorldX - player.position.x
val v = mouseWorldY - (player.position.y - player.height / 2f + player.width / 2f)
- val rotation = MathUtils.atan(v / h) * MathUtils.radDeg
+ val rotation = kotlin.math.atan((v / h).toDouble()).toFloat() * MathUtils.radDeg
return MathUtils.clamp(rotation, -45f, 45f)
}
diff --git a/core/gameplay/lighting-box2d/src/main/kotlin/box2dLight/DirectionalLightExtention.kt b/core/gameplay/lighting-box2d/src/main/kotlin/box2dLight/DirectionalLightExtention.kt
index 2898e99c..a8c22bd4 100644
--- a/core/gameplay/lighting-box2d/src/main/kotlin/box2dLight/DirectionalLightExtention.kt
+++ b/core/gameplay/lighting-box2d/src/main/kotlin/box2dLight/DirectionalLightExtention.kt
@@ -3,3 +3,7 @@ package box2dLight
fun Light.publicUpdate() {
update()
}
+
+fun Light.setDirectionCompat(direction: Float) {
+ this.direction = direction
+}
diff --git a/core/gameplay/lighting-box2d/src/main/kotlin/ru/fredboy/cavedroid/gameplay/lighting/box2d/Box2dLightingSystem.kt b/core/gameplay/lighting-box2d/src/main/kotlin/ru/fredboy/cavedroid/gameplay/lighting/box2d/Box2dLightingSystem.kt
index 440e25c6..7b9a9ec4 100644
--- a/core/gameplay/lighting-box2d/src/main/kotlin/ru/fredboy/cavedroid/gameplay/lighting/box2d/Box2dLightingSystem.kt
+++ b/core/gameplay/lighting-box2d/src/main/kotlin/ru/fredboy/cavedroid/gameplay/lighting/box2d/Box2dLightingSystem.kt
@@ -5,6 +5,7 @@ import box2dLight.Light
import box2dLight.PointLight
import box2dLight.RayHandler
import box2dLight.publicUpdate
+import box2dLight.setDirectionCompat
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.math.MathUtils
@@ -123,7 +124,7 @@ class Box2dLightingSystem(
if (MathUtils.isEqual(90f, sunAngle, 0.1f)) {
sunAngle = 90.1f
}
- sunLight.direction = sunAngle
+ sunLight.setDirectionCompat(sunAngle)
sunLight.color = Color().apply { a = max(gameWorld.getSunlight(), 0.1f) }
sunLight.publicUpdate()
}
diff --git a/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/hud/CrosshairRenderer.kt b/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/hud/CrosshairRenderer.kt
index 922657d5..862d71c0 100644
--- a/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/hud/CrosshairRenderer.kt
+++ b/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/hud/CrosshairRenderer.kt
@@ -2,10 +2,10 @@ package ru.fredboy.cavedroid.gameplay.rendering.renderer.hud
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
-import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.math.Rectangle
+import com.badlogic.gdx.utils.ScreenUtils
import ru.fredboy.cavedroid.common.di.GameScope
import ru.fredboy.cavedroid.common.utils.drawSprite
import ru.fredboy.cavedroid.common.utils.invertColor
@@ -30,7 +30,7 @@ class CrosshairRenderer @Inject constructor(
get() = RENDER_LAYER
private fun getTintColor(x: Float, y: Float, viewport: Rectangle): Color {
- val pixmap = Pixmap.createFromFrameBuffer(
+ val pixmap = ScreenUtils.getFrameBufferPixmap(
/* x = */ (x * (Gdx.graphics.width / viewport.width)).toInt(),
/* y = */ Gdx.graphics.height - (y * (Gdx.graphics.height / viewport.height)).toInt(),
/* w = */ 1,
diff --git a/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/world/ProjectilesRenderer.kt b/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/world/ProjectilesRenderer.kt
index 8060d353..60716e20 100644
--- a/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/world/ProjectilesRenderer.kt
+++ b/core/gameplay/rendering/src/main/kotlin/ru/fredboy/cavedroid/gameplay/rendering/renderer/world/ProjectilesRenderer.kt
@@ -37,7 +37,7 @@ class ProjectilesRenderer @Inject constructor(
y = projectileRect.y,
width = projectileRect.width,
height = projectileRect.height,
- rotation = projectile.velocity.get().angleDeg() + rotationOffset,
+ rotation = projectile.velocity.get().angle() + rotationOffset,
origin = SpriteOrigin.CENTER,
)
}
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/about/AboutMenuView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/about/AboutMenuView.kt
index 6fcdf3fc..7f794f06 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/about/AboutMenuView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/about/AboutMenuView.kt
@@ -47,7 +47,7 @@ fun Stage.aboutMenuView(viewModel: AboutMenuViewModel) = viewModel.also {
Copyright © 2018-2026 Fedor Ivanov <fredboy@protonmail.com>
""".trimIndent(),
) {
- wrap = true
+ setWrap(true)
setAlignment(Align.center)
}.cell(
expand = true,
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/attribution/AttributionMenuView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/attribution/AttributionMenuView.kt
index de7d4cf9..7c1c530b 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/attribution/AttributionMenuView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/attribution/AttributionMenuView.kt
@@ -29,7 +29,7 @@ suspend fun Stage.attributionMenuView(viewModel: AttributionMenuViewModel) = vie
scrollPane {
label(attributions) {
- wrap = true
+ setWrap(true)
}
}.cell(
expand = true,
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/disclaimer/AdsDisclaimerView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/disclaimer/AdsDisclaimerView.kt
index 1f7a9e2f..aa716644 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/disclaimer/AdsDisclaimerView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/disclaimer/AdsDisclaimerView.kt
@@ -37,7 +37,7 @@ fun Stage.adsDisclaimerView(viewModel: AdsDisclaimerViewModel) = viewModel.also
row()
scrollPane {
- label(viewModel.getLocalizedString("adsDisclaimerBody")) { wrap = true }
+ label(viewModel.getLocalizedString("adsDisclaimerBody")) { setWrap(true) }
}.cell(
expand = true,
fill = true,
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/notice/NoticeMenuView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/notice/NoticeMenuView.kt
index 591b1f5b..824c49bf 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/notice/NoticeMenuView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/notice/NoticeMenuView.kt
@@ -28,7 +28,7 @@ suspend fun Stage.noticeMenuView(viewModel: NoticeMenuViewModel) = viewModel.als
pad(8f)
scrollPane {
- label(state.notices) { wrap = true }
+ label(state.notices) { setWrap(true) }
}.cell(
expand = true,
fill = true,
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/singleplayer/SinglePlayerMenuView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/singleplayer/SinglePlayerMenuView.kt
index 43c29421..638c5919 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/singleplayer/SinglePlayerMenuView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/singleplayer/SinglePlayerMenuView.kt
@@ -1,7 +1,9 @@
package ru.fredboy.cavedroid.gdx.menu.v2.view.singleplayer
+import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.scenes.scene2d.Stage
import com.badlogic.gdx.scenes.scene2d.Touchable
+import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
import com.badlogic.gdx.scenes.scene2d.utils.TiledDrawable
import com.badlogic.gdx.utils.Align
@@ -9,7 +11,6 @@ import ktx.scene2d.KTableWidget
import ktx.scene2d.KWidget
import ktx.scene2d.Scene2dDsl
import ktx.scene2d.actors
-import ktx.scene2d.image
import ktx.scene2d.imageButton
import ktx.scene2d.label
import ktx.scene2d.scrollPane
@@ -186,12 +187,10 @@ private fun <S> KWidget<S>.saveItem(
isDisabled = true
saveInfo.screenshot?.let { screenshot ->
- image(screenshot) {
+ val img = Image(TextureRegionDrawable(TextureRegion(screenshot))).apply {
touchable = Touchable.disabled
- }.cell(
- width = 80f,
- height = 80f,
- )
+ }
+ add(img).width(80f).height(80f)
}
}.cell(
width = 100f,
diff --git a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/stats/StatsMenuView.kt b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/stats/StatsMenuView.kt
index 6a628dea..a14f467f 100644
--- a/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/stats/StatsMenuView.kt
+++ b/core/gdx/src/main/kotlin/ru/fredboy/cavedroid/gdx/menu/v2/view/stats/StatsMenuView.kt
@@ -28,7 +28,7 @@ suspend fun Stage.statsMenuView(viewModel: StatsMenuViewModel) = viewModel.also
pad(8f)
scrollPane {
- label(buildContent(viewModel, state)) { wrap = true }
+ label(buildContent(viewModel, state)) { setWrap(true) }
}.cell(
expand = true,
fill = true,