gdx 1.10/lwjgl3 migration; removing old Lua stuffs

This commit is contained in:
minjaesong
2021-07-27 12:43:01 +09:00
parent f75b5da0e1
commit a91156ac21
323 changed files with 937 additions and 12100 deletions

View File

@@ -642,8 +642,8 @@ internal object BlocksDrawer {
var tilesInVertical = -1; private set
fun resize(screenW: Int, screenH: Int) {
tilesInHorizontal = (AppLoader.screenWf / TILE_SIZE).ceilInt() + 1
tilesInVertical = (AppLoader.screenHf / TILE_SIZE).ceilInt() + 1
tilesInHorizontal = (AppLoader.screenSize.screenWf / TILE_SIZE).ceilInt() + 1
tilesInVertical = (AppLoader.screenSize.screenHf / TILE_SIZE).ceilInt() + 1
val oldTH = (oldScreenW.toFloat() / TILE_SIZE).ceilInt() + 1
val oldTV = (oldScreenH.toFloat() / TILE_SIZE).ceilInt() + 1
@@ -669,9 +669,9 @@ internal object BlocksDrawer {
tilesQuad.setVertices(floatArrayOf( // WARNING! not ususal quads; TexCoords of Y is flipped
0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f, 0f,
AppLoader.screenWf, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 0f,
AppLoader.screenWf, AppLoader.screenHf, 0f, 1f, 1f, 1f, 1f, 1f, 1f,
0f, AppLoader.screenHf, 0f, 1f, 1f, 1f, 1f, 0f, 1f
AppLoader.screenSize.screenWf, 0f, 0f, 1f, 1f, 1f, 1f, 1f, 0f,
AppLoader.screenSize.screenWf, AppLoader.screenSize.screenHf, 0f, 1f, 1f, 1f, 1f, 1f, 1f,
0f, AppLoader.screenSize.screenHf, 0f, 1f, 1f, 1f, 1f, 0f, 1f
))
tilesQuad.setIndices(shortArrayOf(0, 1, 2, 2, 3, 0))
}

View File

@@ -45,7 +45,7 @@ object FeaturesDrawer {
* usually targeted for the environmental temperature (desert/winterland), hence the name.
*/
fun drawEnvOverlay(batch: SpriteBatch) {
val onscreen_tiles_max = FastMath.ceil(AppLoader.screenH * AppLoader.screenW / FastMath.sqr (TILE_SIZE.toFloat())) * 2
val onscreen_tiles_max = FastMath.ceil(AppLoader.screenSize.screenH * AppLoader.screenSize.screenW / FastMath.sqr (TILE_SIZE.toFloat())) * 2
val onscreen_tiles_cap = onscreen_tiles_max / 4f
val onscreen_cold_tiles = BlockStats.getCount(*TILES_COLD).toFloat()
val onscreen_warm_tiles = BlockStats.getCount(*TILES_WARM).toFloat()
@@ -59,8 +59,8 @@ object FeaturesDrawer {
batch.color = ColourTemp(colTemp)
batch.fillRect(0f, 0f,
AppLoader.screenW * if (zoom < 1) 1f / zoom else zoom,
AppLoader.screenH * if (zoom < 1) 1f / zoom else zoom
AppLoader.screenSize.screenW * if (zoom < 1) 1f / zoom else zoom,
AppLoader.screenSize.screenH * if (zoom < 1) 1f / zoom else zoom
)
blendNormal(batch)

View File

@@ -10,7 +10,6 @@ import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.concurrent.ThreadExecutor
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gameactors.Luminous
import net.torvald.terrarum.gameworld.BlockAddress
@@ -68,8 +67,8 @@ object LightmapRenderer {
const val overscan_open: Int = 40
const val overscan_opaque: Int = 10
private var LIGHTMAP_WIDTH: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenW).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
private var LIGHTMAP_HEIGHT: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenH).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
private var LIGHTMAP_WIDTH: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenSize.screenW).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
private var LIGHTMAP_HEIGHT: Int = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenSize.screenH).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
//private val noopMask = HashSet<Point2i>((LIGHTMAP_WIDTH + LIGHTMAP_HEIGHT) * 2)
@@ -836,11 +835,11 @@ object LightmapRenderer {
// copied from BlocksDrawer, duh!
// FIXME 'lightBuffer' is not zoomable in this way
val tilesInHorizontal = (AppLoader.screenWf / TILE_SIZE).ceilInt() + 1
val tilesInVertical = (AppLoader.screenHf / TILE_SIZE).ceilInt() + 1
val tilesInHorizontal = (AppLoader.screenSize.screenWf / TILE_SIZE).ceilInt() + 1
val tilesInVertical = (AppLoader.screenSize.screenHf / TILE_SIZE).ceilInt() + 1
LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenW).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenH).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenSize.screenW).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenSize.screenH).div(TILE_SIZE).ceilInt() + overscan_open * 2 + 3
if (_init) {
lightBuffer.dispose()

View File

@@ -63,8 +63,8 @@ object WorldCamera {
fun update(world: GameWorld, player: ActorWithBody?) {
if (player == null) return
width = AppLoader.screenW//FastMath.ceil(AppLoader.screenW / zoom) // div, not mul
height = AppLoader.screenH//FastMath.ceil(AppLoader.screenH / zoom)
width = AppLoader.screenSize.screenW//FastMath.ceil(AppLoader.terrarumAppConfig.screenW / zoom) // div, not mul
height = AppLoader.screenSize.screenH//FastMath.ceil(AppLoader.terrarumAppConfig.screenH / zoom)
zoom = Terrarum.ingame?.screenZoom ?: 1f
zoomSamplePoint = (1f - 1f / zoom) / 2f // will never quite exceed 0.5
@@ -93,8 +93,8 @@ object WorldCamera {
private fun Int.clampCameraY(world: GameWorld): Int {
return if (this < 0)
0
else if (this > world.height.times(TILE_SIZE) - AppLoader.screenH)
world.height.times(TILE_SIZE) - AppLoader.screenH
else if (this > world.height.times(TILE_SIZE) - AppLoader.screenSize.screenH)
world.height.times(TILE_SIZE) - AppLoader.screenSize.screenH
else
this
}