mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
new properties in apploader: aspectRatio
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
|0x10_0000..0x0FFF_FFFF|Items (dynamic\*) (267M possible)|
|
|0x10_0000..0x0FFF_FFFF|Items (dynamic\*) (267M possible)|
|
||||||
|0x1000_0000..0x7FFF_FFFF|Actors (1879M possible)|
|
|0x1000_0000..0x7FFF_FFFF|Actors (1879M possible)|
|
||||||
|-1..-65536|Virtual Tiles|
|
|-1..-65536|Virtual Tiles|
|
||||||
|-2147483648..-1 (all negative numbers)|Faction (2147M possible)|
|
|-2147483648..-65537 (all negative numbers)|Faction (2147M possible)|
|
||||||
|
|
||||||
* dynamic items have own properties that will persist through savegame.
|
* dynamic items have own properties that will persist through savegame.
|
||||||
|
|
||||||
@@ -20,3 +20,5 @@ Actors range in-depth
|
|||||||
|0x5000_0000..0x5FFF_FFFF|Special (e.g. weapon swung, bullets, dropped item, particles)|
|
|0x5000_0000..0x5FFF_FFFF|Special (e.g. weapon swung, bullets, dropped item, particles)|
|
||||||
|0x6000_0000..0x6FFF_FFFF|Rendered front (e.g. fake tile)|
|
|0x6000_0000..0x6FFF_FFFF|Rendered front (e.g. fake tile)|
|
||||||
|0x7000_0000..0x7FFF_FFFF|Rendered as screen overlay, not affected by light nor environment overlays|
|
|0x7000_0000..0x7FFF_FFFF|Rendered as screen overlay, not affected by light nor environment overlays|
|
||||||
|
|
||||||
|
Actor IDs are assigned in 256 groups, single actor can have 256 sub-actors
|
||||||
@@ -243,6 +243,7 @@ public class AppLoader implements ApplicationListener {
|
|||||||
public static int halfScreenH = 0;
|
public static int halfScreenH = 0;
|
||||||
public static float halfScreenWf = 0f;
|
public static float halfScreenWf = 0f;
|
||||||
public static float halfScreenHf = 0f;
|
public static float halfScreenHf = 0f;
|
||||||
|
public static float aspectRatio = 0f;
|
||||||
|
|
||||||
public static Texture textureWhiteSquare;
|
public static Texture textureWhiteSquare;
|
||||||
public static Texture textureWhiteCircle;
|
public static Texture textureWhiteCircle;
|
||||||
@@ -680,6 +681,8 @@ public class AppLoader implements ApplicationListener {
|
|||||||
halfScreenWf = (float) halfScreenW;
|
halfScreenWf = (float) halfScreenW;
|
||||||
halfScreenHf = (float) halfScreenH;
|
halfScreenHf = (float) halfScreenH;
|
||||||
|
|
||||||
|
aspectRatio = screenWf / screenHf;
|
||||||
|
|
||||||
updateFullscreenQuad(screenW, screenH);
|
updateFullscreenQuad(screenW, screenH);
|
||||||
|
|
||||||
printdbg(this, "Resize end");
|
printdbg(this, "Resize end");
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ object Terrarum : Disposable {
|
|||||||
|
|
||||||
var ret: Int
|
var ret: Int
|
||||||
do {
|
do {
|
||||||
ret = HQRNG().nextInt().and(0x7FFFFFFF) // set new ID
|
ret = HQRNG().nextInt().and(0x7FFFFF00) // set new ID
|
||||||
} while (hasCollision(ret)) // check for collision
|
} while (hasCollision(ret)) // check for collision
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
|||||||
private const val WIDTH_RATIO = 0.7
|
private const val WIDTH_RATIO = 0.7
|
||||||
private const val PREVIEW_UPDATE_RATE = 1 / 5f
|
private const val PREVIEW_UPDATE_RATE = 1 / 5f
|
||||||
|
|
||||||
private val COL_WALL = Color.WHITE
|
private val COL_TERR = Color.WHITE
|
||||||
private val COL_TERR = Color(.5f, .5f, .5f, 1f)
|
private val COL_WALLED = Color(.5f, .5f, .5f, 1f)
|
||||||
private val COL_AIR = Color.BLACK
|
private val COL_AIR = Color.BLACK
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +94,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
|||||||
val wx = (world.width.toFloat() / previewWidth * x).roundToInt()
|
val wx = (world.width.toFloat() / previewWidth * x).roundToInt()
|
||||||
val wy = (world.height.toFloat() / previewHeight * y).roundToInt()
|
val wy = (world.height.toFloat() / previewHeight * y).roundToInt()
|
||||||
|
|
||||||
val colT = if (world.getTileFromTerrain(wx, wy) != 0) COL_WALL else COL_TERR
|
val outCol = if (world.getTileFromTerrain(wx, wy) > 15) COL_TERR else if (world.getTileFromWall(wx, wy) > 15) COL_WALLED else COL_AIR
|
||||||
val colW = if (world.getTileFromWall(wx, wy) != 0) COL_WALL else COL_AIR
|
|
||||||
val outCol = colW mul colT
|
|
||||||
|
|
||||||
previewPixmap.setColor(outCol)
|
previewPixmap.setColor(outCol)
|
||||||
previewPixmap.drawPixel(x, previewHeight - 1 - y) // this flips Y
|
previewPixmap.drawPixel(x, previewHeight - 1 - y) // this flips Y
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
|||||||
AppLoader.printdbg(this, "Waking up Worldgen")
|
AppLoader.printdbg(this, "Waking up Worldgen")
|
||||||
}
|
}
|
||||||
|
|
||||||
val nearbyArr = arrayOf(
|
companion object {
|
||||||
|
private const val slices = 5
|
||||||
|
private val nearbyArr = arrayOf(
|
||||||
(-1 to -1), // tileTL
|
(-1 to -1), // tileTL
|
||||||
(+1 to -1), // tileTR
|
(+1 to -1), // tileTR
|
||||||
(-1 to +1), // tileBL
|
(-1 to +1), // tileBL
|
||||||
@@ -70,11 +72,18 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
|||||||
(-1 to 0), // tileL
|
(-1 to 0), // tileL
|
||||||
(+1 to 0) // tileR
|
(+1 to 0) // tileR
|
||||||
)
|
)
|
||||||
|
private const val TL = 0
|
||||||
|
private const val TR = 1
|
||||||
|
private const val BL = 2
|
||||||
|
private const val BR = 3
|
||||||
|
private const val TP = 4
|
||||||
|
private const val BT = 5
|
||||||
|
private const val LF = 6
|
||||||
|
private const val RH = 7
|
||||||
|
}
|
||||||
|
|
||||||
private fun draw(x: Int, y: Int, noiseValue: List<Double>, world: GameWorld) {
|
private fun draw(x: Int, y: Int, noiseValue: List<Double>, world: GameWorld) {
|
||||||
val control = noiseValue[0].times(4).minus(0.00001f).toInt().fmod(4)
|
val control = noiseValue[0].times(slices).minus(0.00001f).toInt().fmod(slices)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (y > 0) {
|
if (y > 0) {
|
||||||
val tileThis = world.getTileFromTerrain(x, y)
|
val tileThis = world.getTileFromTerrain(x, y)
|
||||||
@@ -84,22 +93,30 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
|
|||||||
|
|
||||||
when (control) {
|
when (control) {
|
||||||
0 -> { // woodlands
|
0 -> { // woodlands
|
||||||
if (world.getTileFromTerrain(x, y) == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
||||||
world.setTileTerrain(x, y, Block.GRASS)
|
world.setTileTerrain(x, y, Block.GRASS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1 -> { // shrublands
|
1 -> { // shrublands
|
||||||
if (world.getTileFromTerrain(x, y) == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
||||||
world.setTileTerrain(x, y, Block.GRASS)
|
world.setTileTerrain(x, y, Block.GRASS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2 -> { // plains
|
2, 3 -> { // plains
|
||||||
if (world.getTileFromTerrain(x, y) == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
|
||||||
world.setTileTerrain(x, y, Block.GRASS)
|
world.setTileTerrain(x, y, Block.GRASS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3 -> { // rockylands
|
/*3 -> { // sands
|
||||||
if (world.getTileFromTerrain(x, y) == Block.DIRT) {
|
if (tileThis == Block.DIRT && (nearbyTerr[BT] == Block.STONE || nearbyTerr[BT] == Block.AIR)) {
|
||||||
|
world.setTileTerrain(x, y, Block.SANDSTONE)
|
||||||
|
}
|
||||||
|
else if (tileThis == Block.DIRT) {
|
||||||
|
world.setTileTerrain(x, y, Block.SAND)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
4 -> { // rockylands
|
||||||
|
if (tileThis == Block.DIRT) {
|
||||||
world.setTileTerrain(x, y, Block.STONE)
|
world.setTileTerrain(x, y, Block.STONE)
|
||||||
world.setTileWall(x, y, Block.STONE)
|
world.setTileWall(x, y, Block.STONE)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ internal object BiomeMaker : NoiseMaker {
|
|||||||
0x229944ff.toInt(), // woodlands
|
0x229944ff.toInt(), // woodlands
|
||||||
0x77bb77ff.toInt(), // shrubland
|
0x77bb77ff.toInt(), // shrubland
|
||||||
0x88bb66ff.toInt(), // plains
|
0x88bb66ff.toInt(), // plains
|
||||||
|
0xeeddbbff.toInt(), // sands
|
||||||
0x888888ff.toInt() // rockyland
|
0x888888ff.toInt() // rockyland
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
digraph EnergyFlow {
|
digraph EnergyFlow {
|
||||||
|
labelfloat = true;
|
||||||
|
ranksep = 0.6;
|
||||||
|
nodesep = 0.4;
|
||||||
|
sep = 1.0;
|
||||||
|
overlap = voronoi;
|
||||||
|
splines = true;
|
||||||
|
newrank=true;
|
||||||
|
|
||||||
subgraph power_source { // remove cluster_ to not visualize
|
subgraph power_source { // remove cluster_ to not visualize
|
||||||
node [shape=box];
|
node [shape=box];
|
||||||
@@ -12,7 +19,7 @@ digraph EnergyFlow {
|
|||||||
Water;
|
Water;
|
||||||
}
|
}
|
||||||
|
|
||||||
subgraph power {
|
subgraph cluster_power {
|
||||||
node [style=filled];
|
node [style=filled];
|
||||||
label = Power;
|
label = Power;
|
||||||
|
|
||||||
@@ -46,12 +53,4 @@ digraph EnergyFlow {
|
|||||||
|
|
||||||
Electric -> Battery [dir=both, weight = 16.0];
|
Electric -> Battery [dir=both, weight = 16.0];
|
||||||
Kinetic -> "Compressed Air" [dir=both];
|
Kinetic -> "Compressed Air" [dir=both];
|
||||||
|
|
||||||
|
|
||||||
labelfloat = true;
|
|
||||||
ranksep = 0.6;
|
|
||||||
nodesep = 0.4;
|
|
||||||
sep = 1.0;
|
|
||||||
overlap = voronoi;
|
|
||||||
splines = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user