some sort of error screen impl

This commit is contained in:
minjaesong
2017-08-20 22:10:47 +09:00
parent 25ce7958ae
commit 2bf9acb07a
29 changed files with 555 additions and 169 deletions

View File

@@ -39,12 +39,14 @@ Contain everything on [TEVD](github.com/minjaesong/TerranVirtualDisk)
worldinfo2 -- tileprop worldinfo2 -- tileprop
worldinfo3 -- itemprop worldinfo3 -- itemprop
worldinfo4 -- materialprop worldinfo4 -- materialprop
worldinfo5 -- modules loadorder
* Human-readable * Human-readable
- Tiles_list.txt -- list of tiles in csv - Tiles_list.txt -- list of tiles in csv
- Items_list.txt -- list of items in csv - Items_list.txt -- list of items in csv
- Materials_list.txt -- list of materials in csv - Materials_list.txt -- list of materials in csv
- load_order.txt -- module load order
@@ -68,3 +70,5 @@ Directory:
--- (UUID) virtual disk --- (UUID) virtual disk
+--- tapestries +--- tapestries
--- (random Int) tapestry --- (random Int) tapestry
Alongside with save1.tevd (extension should not exist in real game), keep save1.backup.tevd as a last-working save.

39
assets/loadingCircle.frag Normal file
View File

@@ -0,0 +1,39 @@
#version 120
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform float rcount = 64.0;
uniform float gcount = 64.0;
uniform float bcount = 64.0;
uniform float acount = 1.0;
uniform vec2 circleCentrePoint;
uniform vec2 colorCentrePoint;
uniform float circleSize;
void main() {
vec2 screenCoord = gl_FragCoord.xy;
float distToCircleCentre =
(screenCoord.x - circleCentrePoint.x + 0.5) * (screenCoord.x - circleCentrePoint.x + 0.5) +
(screenCoord.y - circleCentrePoint.y + 0.5) * (screenCoord.y - circleCentrePoint.y + 0.5);
float circleSizeSqr = circleSize * circleSize / 4;
if (distToCircleCentre <= circleSizeSqr) {
gl_FragColor = vec4(0.993, 0.993, 0.993, 1.0);
}
else if (distToCircleCentre <= circleSizeSqr + 200) { // dunno why it's 200; 2000 makes 10px feather
gl_FragColor = vec4(0.993, 0.993, 0.993, 1 - (distToCircleCentre - circleSizeSqr) / 200);
}
else {
gl_FragColor = vec4(0,0,0,1);
}
}

View File

@@ -2057,7 +2057,7 @@
}, },
{ {
"n": "MENU_LABEL_MORE", "n": "MENU_LABEL_MORE",
"s": "다른" "s": "더 보기"
}, },
{ {
"n": "MENU_LABEL_MUSIC", "n": "MENU_LABEL_MUSIC",

View File

@@ -1,10 +1,6 @@
# Load Order # Load Order
# Modules are loaded from top to bottom. # Modules are loaded from top to bottom.
# Acceptable formats: # You can disable basegame, but we don't recommend.
# module_name,description_in_English_no_comma,(entry_point.kts),(external Jars sep'd by semicolon)...
# If entry_point is not given, the program will try to run <modulename>.kts.
# if even that does not exist, an the program will quit with error.
# and yes, you can disable basegame, but we don't recommend.
basegame basegame
dwarventech dwarventech
1 # Load Order
2 # Modules are loaded from top to bottom.
3 # Acceptable formats: # You can disable basegame, but we don't recommend.
# module_name,description_in_English_no_comma,(entry_point.kts),(external Jars sep'd by semicolon)...
# If entry_point is not given, the program will try to run <modulename>.kts.
# if even that does not exist, an the program will quit with error.
# and yes, you can disable basegame, but we don't recommend.
4 basegame
5 dwarventech
6

View File

@@ -1,5 +1,6 @@
{ {
"MENU_LABEL_NEW_WORLD": "New World", "MENU_LABEL_NEW_WORLD": "New World",
"MENU_LABEL_DELETE_WORLD" : "Delete World",
"COPYRIGHT_ALL_RIGHTS_RESERVED": "All rights reserved", "COPYRIGHT_ALL_RIGHTS_RESERVED": "All rights reserved",
"COPYRIGHT_GNU_GPL_3": "Distributed under GNU GPL 3", "COPYRIGHT_GNU_GPL_3": "Distributed under GNU GPL 3",

View File

@@ -14,5 +14,7 @@
"GAME_INVENTORY_BLOCKS" : "ブロック", "GAME_INVENTORY_BLOCKS" : "ブロック",
"GAME_INVENTORY_WALLS" : "壁", "GAME_INVENTORY_WALLS" : "壁",
"CONTEXT_ITEM_TOOL_PLURAL" : "道具", "CONTEXT_ITEM_TOOL_PLURAL" : "道具",
"GAME_INVENTORY_FAVORITES" : "登録" "GAME_INVENTORY_FAVORITES" : "お気に入り",
"GAME_INVENTORY_REGISTER" : "登録する"
} }

View File

@@ -14,5 +14,7 @@
"GAME_INVENTORY_BLOCKS" : "블록", "GAME_INVENTORY_BLOCKS" : "블록",
"GAME_INVENTORY_WALLS" : "벽지", "GAME_INVENTORY_WALLS" : "벽지",
"CONTEXT_ITEM_TOOL_PLURAL" : "도구", "CONTEXT_ITEM_TOOL_PLURAL" : "도구",
"GAME_INVENTORY_FAVORITES" : "등록" "GAME_INVENTORY_FAVORITES" : "즐겨찾기",
"GAME_INVENTORY_REGISTER" : "등록하기"
} }

View File

@@ -304,6 +304,27 @@ final public class FastMath {
} }
public static float interpolateHermite(float scale, float p0, float p1, float p2, float p3) {
return interpolateHermite(scale, p0, p1, p2, p3, 1f, 0f);
}
public static float interpolateHermite(float scale, float p0, float p1, float p2, float p3, float tension, float bias) {
float mu2 = scale * scale;
float mu3 = mu2 * scale;
float m0 = (p1 - p0) * (1f + bias) * (1f - tension) / 2f;
m0 += (p2 - p1) * (1f + bias) * (1f - tension) / 2f;
float m1 = (p2 - p1) * (1f + bias) * (1f - tension) / 2f;
m1 += (p3 - p2) * (1f + bias) * (1f - tension) / 2f;
float a0 = 2 * mu3 - 3 * mu2 + 1;
float a1 = mu3 - 2 * mu2 + scale;
float a2 = mu3 - mu2;
float a3 = -2 * mu3 + 3 * mu2;
return a0 * p1 + a1 * m0 + a2 * m1 + a3 * p2;
}
/** /**
* Returns the arc cosine of an angle given in radians.<br> * Returns the arc cosine of an angle given in radians.<br>
* Special cases: * Special cases:

View File

@@ -6,13 +6,14 @@ object CreditSingleton {
val credit: List<String>; get() = val credit: List<String>; get() =
("${Lang["CREDITS_PROGRAMMER"]}\n\nTorvald (minjaesong)\n\n" + ("${Lang["CREDITS_PROGRAMMER"]}\n\nTorvald (minjaesong)\n\n" +
"${Lang["CREDITS_ARTIST_PLURAL"]}\n\nTorvald (minjaesong)\nRoundworld (leedonggeun)" + "${Lang["CREDITS_ARTIST_PLURAL"]}\n\nTorvald (minjaesong)\nRoundworld (leedonggeun)\n\n" +
"${Lang["CREDITS_POLYGLOT"]}" +
""" """
Copyright Informations Copyright Information

View File

@@ -0,0 +1,102 @@
package net.torvald.terrarum
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Screen
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.GL20
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.utils.GdxRuntimeException
import net.torvald.terrarum.langpack.Lang
object ErrorDisp : Screen {
val logoTex = TerrarumAppLoader.logo
val font = TerrarumAppLoader.fontGame
var title = Lang["ERROR_GENERIC_TEXT"]
var text = arrayListOf<String>("")
lateinit var batch: SpriteBatch
val textPosX = 45f
lateinit var camera: OrthographicCamera
val titleTextLeftMargin = 8
val titleText = "${TerrarumAppLoader.GAME_NAME} ${TerrarumAppLoader.getVERSION_STRING()}"
override fun show() {
batch = SpriteBatch()
camera = OrthographicCamera(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
camera.setToOrtho(true)
camera.update()
}
override fun render(delta: Float) {
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
// draw background
// draw logo
batch.inUse {
batch.projectionMatrix = camera.combined
val headerLogoW = (logoTex.texture.width / 4f).toInt()
val headerLogoH = (logoTex.texture.height / 4f).toInt()
val headerTextWidth = font.getWidth(titleText)
val headerTotalWidth = headerLogoW + titleTextLeftMargin + headerTextWidth
val headerLogoXPos = (Gdx.graphics.width - headerTotalWidth).div(2)
val headerLogoYPos = 25 + headerLogoH
batch.color = Color.WHITE
batch.draw(logoTex.texture, headerLogoXPos.toFloat(), headerLogoYPos.toFloat(), headerLogoW.toFloat(), -headerLogoH.toFloat())
font.draw(batch, titleText, headerLogoXPos + headerLogoW.toFloat() + titleTextLeftMargin, headerLogoYPos -(headerLogoH / 2f) - font.lineHeight + 4)
// draw error text
batch.color = Color(0xff8080ff.toInt())
font.draw(batch, title, textPosX, logoTex.texture.height / 4f * 2 + 50f)
batch.color = Color.WHITE
text.forEachIndexed { index, s ->
font.draw(batch, s, textPosX, logoTex.texture.height / 4f * 2 + 130f + index * font.lineHeight)
}
}
}
override fun hide() {
}
override fun pause() {
}
override fun resume() {
}
override fun resize(width: Int, height: Int) {
}
override fun dispose() {
}
}
class TerrarumRuntimeException(messageTitle: String, message: List<String>? = null) : RuntimeException() {
init {
}
}

View File

@@ -244,7 +244,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
println("[Ingame] loaded successfully.") println("[Ingame] loaded successfully.")
} }
else { else {
LoadScreen.addMessage("${Terrarum.NAME} version ${Terrarum.VERSION_STRING}") LoadScreen.addMessage("${Terrarum.NAME} version ${TerrarumAppLoader.getVERSION_STRING()}")
LoadScreen.addMessage("Creating new world") LoadScreen.addMessage("Creating new world")

View File

@@ -268,7 +268,7 @@ object LoadScreen : ScreenAdapter() {
Thread.sleep(80) Thread.sleep(80)
Terrarum.changeScreen(screenToLoad!!) Terrarum.setScreen(screenToLoad!!)
} }
} }

View File

@@ -72,33 +72,38 @@ object ModMgr {
val moduleName = it[0] val moduleName = it[0]
println("[ModMgr] Loading module $moduleName") println("[ModMgr] Loading module $moduleName")
val modMetadata = Properties() try {
modMetadata.load(FileInputStream("$modDir/$moduleName/metadata.properties")) val modMetadata = Properties()
modMetadata.load(FileInputStream("$modDir/$moduleName/metadata.properties"))
val properName = modMetadata.getProperty("propername") val properName = modMetadata.getProperty("propername")
val description = modMetadata.getProperty("description") val description = modMetadata.getProperty("description")
val author = modMetadata.getProperty("author") val author = modMetadata.getProperty("author")
val entryPoint = modMetadata.getProperty("entrypoint") val entryPoint = modMetadata.getProperty("entrypoint")
val releaseDate = modMetadata.getProperty("releasedate") val releaseDate = modMetadata.getProperty("releasedate")
val version = modMetadata.getProperty("version") val version = modMetadata.getProperty("version")
val libs = modMetadata.getProperty("libraries").split(';').toTypedArray() val libs = modMetadata.getProperty("libraries").split(';').toTypedArray()
val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs) moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs)
println(moduleInfo[moduleName]) println(moduleInfo[moduleName])
// run entry script in entry point // run entry script in entry point
if (entryPoint.isNotBlank()) { if (entryPoint.isNotBlank()) {
val extension = entryPoint.split('.').last() val extension = entryPoint.split('.').last()
val engine = ScriptEngineManager().getEngineByExtension(extension)!! val engine = ScriptEngineManager().getEngineByExtension(extension)!!
val invocable = engine as Invocable val invocable = engine as Invocable
engine.eval(FileReader(getFile(moduleName, entryPoint))) engine.eval(FileReader(getFile(moduleName, entryPoint)))
invocable.invokeFunction("invoke", moduleName) invocable.invokeFunction("invoke", moduleName)
}
println("[ModMgr] $moduleName loaded successfully")
}
catch (noSuchModule: FileNotFoundException) {
System.err.println("[ModMgr] No such module: $moduleName, skipping...")
} }
println("[ModMgr] $moduleName loaded successfully")
} }

View File

@@ -0,0 +1,119 @@
package net.torvald.terrarum
import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShaderProgram
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
/**
* Created by minjaesong on 2017-08-11.
*/
fun main(args: Array<String>) { // LWJGL 3 won't work? java.lang.VerifyError
val config = LwjglApplicationConfiguration()
//config.useGL30 = true
config.vSyncEnabled = false
config.resizable = false
config.width = 1072
config.height = 742
config.foregroundFPS = 9999
LwjglApplication(ShitOnGlsl, config)
}
object ShitOnGlsl : ApplicationAdapter() {
lateinit var shader: ShaderProgram
lateinit var font: GameFontBase
lateinit var fullscreenQuad: Mesh
lateinit var camera: OrthographicCamera
lateinit var batch: SpriteBatch
lateinit var fucktex: Texture
override fun create() {
ShaderProgram.pedantic = false
shader = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/loadingCircle.frag"))
font = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = false)
if (!shader.isCompiled) {
Gdx.app.log("Shader", shader.log)
System.exit(1)
}
fullscreenQuad = Mesh(
true, 4, 6,
VertexAttribute.Position(),
VertexAttribute.ColorUnpacked(),
VertexAttribute.TexCoords(0)
)
fullscreenQuad.setVertices(floatArrayOf(
0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f, 1f,
Gdx.graphics.width.toFloat(), 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f,
Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat(), 0f, 1f, 1f, 1f, 1f, 1f, 0f,
0f, Gdx.graphics.height.toFloat(), 0f, 1f, 1f, 1f, 1f, 0f, 0f
))
fullscreenQuad.setIndices(shortArrayOf(0, 1, 2, 2, 3, 0))
camera = OrthographicCamera(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
camera.setToOrtho(true, Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
camera.update()
batch = SpriteBatch()
fucktex = Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga"))
}
override fun render() {
Gdx.graphics.setTitle("ShitOnGlsl — F: ${Gdx.graphics.framesPerSecond}")
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
batch.inUse {
batch.shader = shader
shader.setUniformMatrix("u_projTrans", camera.combined)
shader.setUniformi("u_texture", 0)
shader.setUniformf("circleCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
shader.setUniformf("colorCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
shader.setUniformf("circleSize", 200f)
//fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
batch.draw(fucktex, 0f, 0f, Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
}
/*shader.begin()
shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)
shader.setUniformi("u_texture", 0)
shader.setUniformf("circleCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
shader.setUniformf("colorCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
shader.setUniformf("circleSize", 200f)
fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
shader.end()*/
}
override fun dispose() {
shader.dispose()
}
}

View File

@@ -11,6 +11,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.badlogic.gdx.graphics.glutils.ShaderProgram import com.badlogic.gdx.graphics.glutils.ShaderProgram
import com.badlogic.gdx.graphics.glutils.ShapeRenderer import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.utils.GdxRuntimeException
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonPrimitive import com.google.gson.JsonPrimitive
import net.torvald.random.HQRNG import net.torvald.random.HQRNG
@@ -30,10 +31,12 @@ import net.torvald.terrarum.worlddrawer.FeaturesDrawer
import net.torvald.terrarum.worlddrawer.WorldCamera import net.torvald.terrarum.worlddrawer.WorldCamera
import net.torvald.terrarumsansbitmap.gdx.GameFontBase import net.torvald.terrarumsansbitmap.gdx.GameFontBase
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.lwjgl.BufferUtils
import org.lwjgl.input.Controllers import org.lwjgl.input.Controllers
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.lang.management.ManagementFactory import java.lang.management.ManagementFactory
import java.nio.IntBuffer
import java.util.* import java.util.*
/** /**
@@ -73,8 +76,8 @@ object Terrarum : Screen {
lateinit var appLoader: TerrarumAppLoader lateinit var appLoader: TerrarumAppLoader
internal var screenW: Int? = null var screenW = 0
internal var screenH: Int? = null var screenH = 0
lateinit var batch: SpriteBatch lateinit var batch: SpriteBatch
lateinit var shapeRender: ShapeRenderer // DO NOT USE!! for very limited applications e.g. WeatherMixer lateinit var shapeRender: ShapeRenderer // DO NOT USE!! for very limited applications e.g. WeatherMixer
@@ -90,12 +93,12 @@ object Terrarum : Screen {
////////////////////////////// //////////////////////////////
val WIDTH: Int val WIDTH: Int
get() = if ((screenW ?: Gdx.graphics.width) % 2 == 0) (screenW ?: Gdx.graphics.width) else (screenW ?: Gdx.graphics.width) - 1 get() = if (screenW % 2 == 0) screenW else screenW - 1
val HEIGHT: Int val HEIGHT: Int
get() = if ((screenH ?: Gdx.graphics.height) % 2 == 0) (screenH ?: Gdx.graphics.height) else (screenH ?: Gdx.graphics.height) - 1 get() = if (screenH % 2 == 0) screenH else screenH - 1
val WIDTH_MIN = 800 //val WIDTH_MIN = 800
val HEIGHT_MIN = 600 //val HEIGHT_MIN = 600
inline val HALFW: Int inline val HALFW: Int
get() = WIDTH.ushr(1) get() = WIDTH.ushr(1)
@@ -153,7 +156,8 @@ object Terrarum : Screen {
val memXmx: Long val memXmx: Long
get() = Runtime.getRuntime().maxMemory() shr 20 get() = Runtime.getRuntime().maxMemory() shr 20
val environment: RunningEnvironment var environment: RunningEnvironment
private set
private val localeSimple = arrayOf("de", "en", "es", "it") private val localeSimple = arrayOf("de", "en", "es", "it")
var gameLocale = "lateinit" var gameLocale = "lateinit"
@@ -179,7 +183,7 @@ object Terrarum : Screen {
lateinit var fontGame: GameFontBase val fontGame: GameFontBase = TerrarumAppLoader.fontGame
lateinit var fontSmallNumbers: TinyAlphNum lateinit var fontSmallNumbers: TinyAlphNum
var joypadLabelStart: Char = 0xE000.toChar() // lateinit var joypadLabelStart: Char = 0xE000.toChar() // lateinit
@@ -236,18 +240,7 @@ object Terrarum : Screen {
private lateinit var configDir: String private lateinit var configDir: String
/** const val NAME = TerrarumAppLoader.GAME_NAME
* 0xAA_BB_XXXX
* AA: Major version
* BB: Minor version
* XXXX: Revision (Repository commits)
*
* e.g. 0x02010034 can be translated as 2.1.52
*/
const val VERSION_RAW = 0x00_02_0226
const val VERSION_STRING: String =
"${VERSION_RAW.ushr(24)}.${VERSION_RAW.and(0xFF0000).ushr(16)}.${VERSION_RAW.and(0xFFFF)}"
const val NAME = "Terrarum"
val systemArch = System.getProperty("os.arch") val systemArch = System.getProperty("os.arch")
@@ -256,8 +249,6 @@ object Terrarum : Screen {
lateinit var shaderBlur: ShaderProgram lateinit var shaderBlur: ShaderProgram
lateinit var shaderRGBOnly: ShaderProgram
lateinit var shaderAOnly: ShaderProgram
lateinit var shaderBayer: ShaderProgram lateinit var shaderBayer: ShaderProgram
lateinit var shaderBayerSkyboxFill: ShaderProgram lateinit var shaderBayerSkyboxFill: ShaderProgram
lateinit var shaderBlendGlow: ShaderProgram lateinit var shaderBlendGlow: ShaderProgram
@@ -274,7 +265,7 @@ object Terrarum : Screen {
init { init {
println("$NAME version $VERSION_STRING") println("$NAME version ${TerrarumAppLoader.getVERSION_STRING()}")
getDefaultDirectory() getDefaultDirectory()
@@ -331,6 +322,16 @@ object Terrarum : Screen {
Gdx.graphics.glVersion.minorVersion * 10 + Gdx.graphics.glVersion.minorVersion * 10 +
Gdx.graphics.glVersion.releaseVersion Gdx.graphics.glVersion.releaseVersion
val MINIMAL_GL_VERSION = 210 val MINIMAL_GL_VERSION = 210
val GL_MAX_TEXTURE_SIZE: Int
get() {
val intBuffer = BufferUtils.createIntBuffer(16) // size must be at least 16, or else LWJGL complains
Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_SIZE, intBuffer)
intBuffer.rewind()
return intBuffer.get()
}
val MINIMAL_GL_MAX_TEXTURE_SIZE = 4096
override fun show() { override fun show() {
@@ -341,12 +342,13 @@ object Terrarum : Screen {
println("[Terrarum] GL_VERSION = $GL_VERSION") println("[Terrarum] GL_VERSION = $GL_VERSION")
println("[Terrarum] GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE")
println("[Terrarum] GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info println("[Terrarum] GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info
if (GL_VERSION < MINIMAL_GL_VERSION) { if (GL_VERSION < MINIMAL_GL_VERSION || GL_MAX_TEXTURE_SIZE < MINIMAL_GL_MAX_TEXTURE_SIZE) {
// TODO notify properly // TODO notify properly
throw Error("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required: $MINIMAL_GL_VERSION") throw GdxRuntimeException("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required: $MINIMAL_GL_VERSION; GL_MAX_TEXTURE_SIZE: $GL_MAX_TEXTURE_SIZE, required: $MINIMAL_GL_MAX_TEXTURE_SIZE")
} }
@@ -377,7 +379,7 @@ object Terrarum : Screen {
shapeRender = ShapeRenderer() shapeRender = ShapeRenderer()
fontGame = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = true) //fontGame = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = true)
fontSmallNumbers = TinyAlphNum fontSmallNumbers = TinyAlphNum
@@ -398,9 +400,6 @@ object Terrarum : Screen {
shaderBayerSkyboxFill = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer_skyboxfill.frag")) shaderBayerSkyboxFill = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer_skyboxfill.frag"))
shaderRGBOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/rgbonly.frag"))
shaderAOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/aonly.frag"))
shaderBlendGlow = ShaderProgram(Gdx.files.internal("assets/blendGlow.vert"), Gdx.files.internal("assets/blendGlow.frag")) shaderBlendGlow = ShaderProgram(Gdx.files.internal("assets/blendGlow.vert"), Gdx.files.internal("assets/blendGlow.frag"))
if (!shaderBlendGlow.isCompiled) { if (!shaderBlendGlow.isCompiled) {
@@ -444,7 +443,7 @@ object Terrarum : Screen {
appLoader.setScreen(TitleScreen(batch)) appLoader.setScreen(TitleScreen(batch))
} }
internal fun changeScreen(screen: Screen) { internal fun setScreen(screen: Screen) {
appLoader.setScreen(screen) appLoader.setScreen(screen)
} }
@@ -475,6 +474,12 @@ object Terrarum : Screen {
MessageWindow.SEGMENT_BLACK.dispose() MessageWindow.SEGMENT_BLACK.dispose()
MessageWindow.SEGMENT_WHITE.dispose() MessageWindow.SEGMENT_WHITE.dispose()
//dispose any other resources used in this level //dispose any other resources used in this level
shaderBayer.dispose()
shaderBayerSkyboxFill.dispose()
shaderBlur.dispose()
shaderBlendGlow.dispose()
} }
override fun hide() { override fun hide() {
@@ -482,11 +487,14 @@ object Terrarum : Screen {
} }
override fun resize(width: Int, height: Int) { override fun resize(width: Int, height: Int) {
var width = maxOf(width, WIDTH_MIN) //var width = maxOf(width, WIDTH_MIN)
var height = maxOf(height, HEIGHT_MIN) //var height = maxOf(height, HEIGHT_MIN)
if (width % 2 == 1) width += 1 var width = width
if (height % 2 == 1) height += 1 var height = height
if (width % 2 == 1) width -= 1
if (height % 2 == 1) height -= 1
screenW = width screenW = width
screenH = height screenH = height
@@ -521,7 +529,7 @@ object Terrarum : Screen {
OperationSystem = "OSX" OperationSystem = "OSX"
defaultDir = System.getProperty("user.home") + "/Library/Application Support/Terrarum" defaultDir = System.getProperty("user.home") + "/Library/Application Support/Terrarum"
} }
else if (OS.contains("NUX") || OS.contains("NIX")) { else if (OS.contains("NUX") || OS.contains("NIX") || OS.contains("BSD")) {
OperationSystem = "LINUX" OperationSystem = "LINUX"
defaultDir = System.getProperty("user.home") + "/.Terrarum" defaultDir = System.getProperty("user.home") + "/.Terrarum"
} }
@@ -529,6 +537,11 @@ object Terrarum : Screen {
OperationSystem = "SOLARIS" OperationSystem = "SOLARIS"
defaultDir = System.getProperty("user.home") + "/.Terrarum" defaultDir = System.getProperty("user.home") + "/.Terrarum"
} }
else if (System.getProperty("java.runtime.name").toUpperCase().contains("ANDROID")) {
OperationSystem = "ANDROID"
defaultDir = System.getProperty("user.home") + "/.Terrarum"
environment = RunningEnvironment.MOBILE
}
else { else {
OperationSystem = "UNKNOWN" OperationSystem = "UNKNOWN"
defaultDir = System.getProperty("user.home") + "/.Terrarum" defaultDir = System.getProperty("user.home") + "/.Terrarum"

View File

@@ -9,6 +9,8 @@ import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
/** /**
* Created by minjaesong on 2017-08-01. * Created by minjaesong on 2017-08-01.
@@ -18,8 +20,23 @@ public class TerrarumAppLoader implements ApplicationListener {
public static final String GAME_NAME = "Terrarum"; public static final String GAME_NAME = "Terrarum";
public static final String COPYRIGHT_DATE_NAME = "Copyright 2013-2017 Torvald (minjaesong)"; public static final String COPYRIGHT_DATE_NAME = "Copyright 2013-2017 Torvald (minjaesong)";
/**
* 0xAA_BB_XXXX
* AA: Major version
* BB: Minor version
* XXXX: Revision (Repository commits)
*
* e.g. 0x02010034 can be translated as 2.1.52
*/
public static final int VERSION_RAW = 0x00_02_0226;
public static final String getVERSION_STRING() {
return String.format("%d.%d.%d", VERSION_RAW >>> 24, (VERSION_RAW & 0xff0000) >>> 16, VERSION_RAW & 0xFFFF);
}
private static LwjglApplicationConfiguration appConfig; private static LwjglApplicationConfiguration appConfig;
public static GameFontBase fontGame;
public static void main(String[] args) { public static void main(String[] args) {
appConfig = new LwjglApplicationConfiguration(); appConfig = new LwjglApplicationConfiguration();
appConfig.vSyncEnabled = false; appConfig.vSyncEnabled = false;
@@ -38,7 +55,7 @@ public class TerrarumAppLoader implements ApplicationListener {
private Mesh fullscreenQuad; private Mesh fullscreenQuad;
private OrthographicCamera camera; private OrthographicCamera camera;
private SpriteBatch batch; private SpriteBatch batch;
private TextureRegion logo; public static TextureRegion logo;
private Color gradWhiteTop = new Color(0xf8f8f8ff); private Color gradWhiteTop = new Color(0xf8f8f8ff);
private Color gradWhiteBottom = new Color(0xd8d8d8ff); private Color gradWhiteBottom = new Color(0xd8d8d8ff);
@@ -92,6 +109,10 @@ public class TerrarumAppLoader implements ApplicationListener {
logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga"))); logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")));
logo.flip(false, true); logo.flip(false, true);
TextureRegionPack.Companion.setGlobalFlipY(true);
fontGame = new GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", false, true, Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
} }
@Override @Override
@@ -99,6 +120,7 @@ public class TerrarumAppLoader implements ApplicationListener {
if (screen == null) { if (screen == null) {
shaderBayerSkyboxFill.begin(); shaderBayerSkyboxFill.begin();
shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined); shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined);
shaderBayerSkyboxFill.setUniformf("parallax_size", 0f);
shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b); shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b);
shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b); shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b);
fullscreenQuad.render(shaderBayerSkyboxFill, GL20.GL_TRIANGLES); fullscreenQuad.render(shaderBayerSkyboxFill, GL20.GL_TRIANGLES);
@@ -121,7 +143,10 @@ public class TerrarumAppLoader implements ApplicationListener {
if (loadTimer >= showupTime) { if (loadTimer >= showupTime) {
Terrarum.INSTANCE.setAppLoader(this); Terrarum.INSTANCE.setAppLoader(this);
setScreen(Terrarum.INSTANCE); Terrarum.INSTANCE.setScreenW(appConfig.width);
Terrarum.INSTANCE.setScreenH(appConfig.height);
//setScreen(Terrarum.INSTANCE);
setScreen(ErrorDisp.INSTANCE);
} }
} }
else { else {
@@ -131,7 +156,9 @@ public class TerrarumAppLoader implements ApplicationListener {
@Override @Override
public void resize(int width, int height) { public void resize(int width, int height) {
initViewPort(width, height); //initViewPort(width, height);
if (screen != null) screen.resize(width, height);
} }
@Override @Override

View File

@@ -171,41 +171,20 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
private var blurWriteBuffer = lightmapFboA private var blurWriteBuffer = lightmapFboA
private var blurReadBuffer = lightmapFboB private var blurReadBuffer = lightmapFboB
private val minimumIntroTime: Second = 2.0f
private val introUncoverTime: Second = 0.3f private val introUncoverTime: Second = 0.3f
private var showIntroDeltaCounter = 0f
private var introUncoverDeltaCounter = 0f private var introUncoverDeltaCounter = 0f
private var updateDeltaCounter = 0.0 private var updateDeltaCounter = 0.0
protected val updateRate = 1.0 / Terrarum.TARGET_INTERNAL_FPS protected val updateRate = 1.0 / Terrarum.TARGET_INTERNAL_FPS
override fun render(delta: Float) { override fun render(delta: Float) {
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f) if (!loadDone) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT) loadThingsWhileIntroIsVisible()
if (!loadDone || showIntroDeltaCounter < minimumIntroTime) {
// draw load screen
Terrarum.shaderBayerSkyboxFill.begin()
Terrarum.shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined)
Terrarum.shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b)
Terrarum.shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b)
Terrarum.fullscreenQuad.render(Terrarum.shaderBayerSkyboxFill, GL20.GL_TRIANGLES)
Terrarum.shaderBayerSkyboxFill.end()
batch.inUse {
batch.color = Color.WHITE
blendNormal()
batch.shader = null
setCameraPosition(0f, 0f)
batch.draw(logo, (Terrarum.WIDTH - logo.regionWidth) / 2f, (Terrarum.HEIGHT - logo.regionHeight) / 2f)
}
if (!loadDone) {
loadThingsWhileIntroIsVisible()
}
} }
else { else {
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
// async update // async update
updateDeltaCounter += delta updateDeltaCounter += delta
while (updateDeltaCounter >= updateRate) { while (updateDeltaCounter >= updateRate) {
@@ -215,11 +194,8 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
// render? just do it anyway // render? just do it anyway
renderScreen() renderScreen()
} }
showIntroDeltaCounter += delta
} }
fun updateScreen(delta: Float) { fun updateScreen(delta: Float) {

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.console
import com.badlogic.gdx.Gdx import com.badlogic.gdx.Gdx
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.TerrarumAppLoader
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
/** /**
@@ -10,7 +11,7 @@ import net.torvald.terrarum.langpack.Lang
internal object Version : ConsoleCommand { internal object Version : ConsoleCommand {
override fun execute(args: Array<String>) { override fun execute(args: Array<String>) {
Echo("${Terrarum.NAME} ${Terrarum.VERSION_STRING}") Echo("${Terrarum.NAME} ${TerrarumAppLoader.getVERSION_STRING()}")
Echo("Polyglot language pack version ${Lang.POLYGLOT_VERSION}") Echo("Polyglot language pack version ${Lang.POLYGLOT_VERSION}")
Echo("GL_VERSION: ${Terrarum.GL_VERSION}") Echo("GL_VERSION: ${Terrarum.GL_VERSION}")
Echo("Renderer: ${Gdx.graphics.glVersion.rendererString}, ${Gdx.graphics.glVersion.vendorString}") Echo("Renderer: ${Gdx.graphics.glVersion.rendererString}, ${Gdx.graphics.glVersion.vendorString}")

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum.gameactors.ai package net.torvald.terrarum.gameactors.ai
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.TerrarumAppLoader
import net.torvald.terrarum.gameactors.AIControlled import net.torvald.terrarum.gameactors.AIControlled
import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameactors.ActorWithPhysics import net.torvald.terrarum.gameactors.ActorWithPhysics
@@ -380,13 +381,13 @@ internal class AILuaAPI(g: Globals, actor: ActorWithPhysics) {
class GameVersion : ZeroArgFunction() { class GameVersion : ZeroArgFunction() {
override fun call(): LuaValue { override fun call(): LuaValue {
return Terrarum.VERSION_STRING.toLua() return TerrarumAppLoader.getVERSION_STRING().toLua()
} }
} }
class GameVersionRaw : ZeroArgFunction() { class GameVersionRaw : ZeroArgFunction() {
override fun call(): LuaValue { override fun call(): LuaValue {
return Terrarum.VERSION_RAW.toLua() return TerrarumAppLoader.VERSION_RAW.toLua()
} }
} }
} }

View File

@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.dataclass.HistoryArray import net.torvald.dataclass.HistoryArray
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.TerrarumAppLoader
import net.torvald.terrarum.console.Authenticator import net.torvald.terrarum.console.Authenticator
import net.torvald.terrarum.console.CommandInterpreter import net.torvald.terrarum.console.CommandInterpreter
import net.torvald.terrarum.fillRect import net.torvald.terrarum.fillRect
@@ -180,7 +181,7 @@ class ConsoleWindow : UICanvas() {
commandInputPool = StringBuilder() commandInputPool = StringBuilder()
if (Authenticator.b()) { if (Authenticator.b()) {
sendMessage("${Terrarum.NAME} ${Terrarum.VERSION_STRING}") sendMessage("${Terrarum.NAME} ${TerrarumAppLoader.getVERSION_STRING()}")
sendMessage(Lang["DEV_MESSAGE_CONSOLE_CODEX"]) sendMessage(Lang["DEV_MESSAGE_CONSOLE_CODEX"])
} }
} }

View File

@@ -37,7 +37,7 @@ class UIItemList<Item: UIItem>(
init { init {
itemList.forEachIndexed { index, item -> itemList.forEachIndexed { index, item ->
item.posX = this.posX item.posX = this.posX
item.posY = if (index == 0) this.posY else itemList[index - 1].posY + itemList[index - 1].height + this.posY item.posY = if (index == 0) this.posY else itemList[index - 1].posY + itemList[index - 1].height
} }
} }

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.ModMgr import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.gameactors.floor import net.torvald.terrarum.gameactors.floor
class UIItemModuleInfoCell( class UIItemModuleInfoCell(
@@ -19,47 +20,49 @@ class UIItemModuleInfoCell(
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4 private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
override fun render(batch: SpriteBatch) { override fun render(batch: SpriteBatch) {
blendNormal()
if (ModMgr.moduleInfo.containsKey(moduleName)) { if (ModMgr.moduleInfo.containsKey(moduleName)) {
val modInfo = ModMgr.moduleInfo[moduleName]!! val modInfo = ModMgr.moduleInfo[moduleName]!!
// print load order index // print load order index
batch.color = Color(0x7f7f7fff) batch.color = Color(0xccccccff.toInt())
var strlen = Terrarum.fontSmallNumbers.getWidth(modInfo.order.toString()) var strlen = Terrarum.fontSmallNumbers.getWidth(modInfo.order.toString())
Terrarum.fontSmallNumbers.draw(batch, Terrarum.fontSmallNumbers.draw(batch,
modInfo.order.toString(), modInfo.order.toString(),
(numberAreaWidth - strlen).div(2f).floor(), posX + (numberAreaWidth - strlen).div(2f).floor(),
(height - Terrarum.fontSmallNumbers.H).div(2f).floor() posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
) )
// print module name // print module name
batch.color = Color.WHITE batch.color = Color.WHITE
Terrarum.fontGame.draw(batch, Terrarum.fontGame.draw(batch,
"${modInfo.properName} (${modInfo.version})", "${modInfo.properName} (${modInfo.version})",
numberAreaWidth.toFloat(), posX + numberAreaWidth.toFloat(),
0f posY.toFloat()
) )
// print author name // print author name
strlen = Terrarum.fontGame.getWidth(modInfo.author) strlen = Terrarum.fontGame.getWidth(modInfo.author)
Terrarum.fontGame.draw(batch, Terrarum.fontGame.draw(batch,
modInfo.author, modInfo.author,
width - strlen.toFloat(), posX + width - strlen.toFloat(),
0f posY.toFloat()
) )
// print description // print description
Terrarum.fontGame.draw(batch, Terrarum.fontGame.draw(batch,
modInfo.description, modInfo.description,
numberAreaWidth.toFloat(), posX + numberAreaWidth.toFloat(),
Terrarum.fontGame.lineHeight posY + Terrarum.fontGame.lineHeight
) )
// print releasedate // print releasedate
strlen = Terrarum.fontGame.getWidth(modInfo.releaseDate) strlen = Terrarum.fontGame.getWidth(modInfo.releaseDate)
Terrarum.fontGame.draw(batch, Terrarum.fontGame.draw(batch,
modInfo.releaseDate, modInfo.releaseDate,
width - strlen.toFloat(), posX + width - strlen.toFloat(),
Terrarum.fontGame.lineHeight posY + Terrarum.fontGame.lineHeight
) )
} }
@@ -69,8 +72,8 @@ class UIItemModuleInfoCell(
val strlen = Terrarum.fontSmallNumbers.getWidth(str) val strlen = Terrarum.fontSmallNumbers.getWidth(str)
Terrarum.fontSmallNumbers.draw(batch, Terrarum.fontSmallNumbers.draw(batch,
str, str,
(width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth, posX + (width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
(height - Terrarum.fontSmallNumbers.H).div(2f).floor() posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
) )
} }
} }

View File

@@ -3,14 +3,16 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.graphics.Camera import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.gameactors.Second import net.torvald.terrarum.gameactors.Second
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
/** /**
* Created by minjaesong on 2017-08-01. * Created by minjaesong on 2017-08-01.
*/ */
/*class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() { class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() {
val menuLabels = arrayOf( val menuLabels = arrayOf(
"MENU_LABEL_RETURN" "MENU_LABEL_RETURN"
@@ -22,9 +24,7 @@ import net.torvald.terrarum.langpack.Lang
override var openCloseTime: Second = 0f override var openCloseTime: Second = 0f
private val moduleListWidth = Terrarum.WIDTH / 2 private val menubar = UIItemTextButtonList(
private val moduleList = UIItemList<UIItemModuleInfoCell>(
this, this,
menuLabels, menuLabels,
0, UITitleRemoConRoot.menubarOffY, 0, UITitleRemoConRoot.menubarOffY,
@@ -39,44 +39,44 @@ import net.torvald.terrarum.langpack.Lang
) )
private val textAreaHMargin = 48 private val moduleAreaHMargin = 48
private val textAreaWidth = (Terrarum.WIDTH * 0.75).toInt() private val moduleAreaWidth = (Terrarum.WIDTH * 0.75).toInt() - moduleAreaHMargin
private val textAreaHeight = Terrarum.HEIGHT - textAreaHMargin * 2 private val moduleAreaHeight = Terrarum.HEIGHT - moduleAreaHMargin * 2
/*private val textArea = UIItemTextArea(this,
Terrarum.WIDTH - textAreaWidth, textAreaHMargin, private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
textAreaWidth, textAreaHeight, // build module list
align = UIItemTextArea.Align.CENTRE init {
)*/ ModMgr.moduleInfo.toList().sortedBy { it.second.order }.forEachIndexed { index, it ->
private val localeList = Lang.languageList.toList().sorted() moduleInfoCells.add(UIItemModuleInfoCell(
private val textArea = UIItemTextButtonList(this, this,
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(), it.first,
Terrarum.WIDTH - textAreaWidth, textAreaHMargin, moduleAreaWidth,
textAreaWidth, textAreaHeight, 0, 0 // placeholder
textAreaWidth = textAreaWidth, ))
readFromLang = false, }
activeBackCol = Color(0), }
highlightBackCol = Color(0),
backgroundCol = Color(0), private val mouduleArea = UIItemList<UIItemModuleInfoCell>(
inactiveCol = Color.WHITE, this,
defaultSelection = null moduleInfoCells,
(Terrarum.WIDTH * 0.25f).toInt(), moduleAreaHMargin,
moduleAreaWidth,
moduleAreaHeight,
inactiveCol = Color.WHITE
) )
init { init {
uiItems.add(menubar) uiItems.add(menubar)
uiItems.add(mouduleArea)
//textArea.entireText = Lang.languageList.toList().sorted().map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }
//////////////////////////// ////////////////////////////
// attach listeners // attach listeners
textArea.selectionChangeListener = { _, newSelectionIndex ->
Terrarum.gameLocale = localeList[newSelectionIndex]
}
menubar.buttons[menuLabels.indexOf("MENU_LABEL_RETURN")].clickOnceListener = { _, _, _ -> menubar.buttons[menuLabels.indexOf("MENU_LABEL_RETURN")].clickOnceListener = { _, _, _ ->
this.setAsClose() this.setAsClose()
@@ -88,14 +88,15 @@ import net.torvald.terrarum.langpack.Lang
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
menubar.update(delta) menubar.update(delta)
textArea.update(delta) mouduleArea.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
menubar.render(batch) menubar.render(batch)
batch.color = Color.WHITE batch.color = Color.WHITE
textArea.render(batch) blendNormal()
mouduleArea.render(batch)
} }
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {
@@ -113,4 +114,4 @@ import net.torvald.terrarum.langpack.Lang
override fun dispose() { override fun dispose() {
} }
}*/ }

View File

@@ -3,6 +3,9 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.graphics.Camera import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.random.HQRNG
import net.torvald.terrarum.Ingame
import net.torvald.terrarum.LoadScreen
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
class UITitleRemoConRoot : UICanvas() { class UITitleRemoConRoot : UICanvas() {
@@ -45,20 +48,20 @@ class UITitleRemoConRoot : UICanvas() {
) )
//private val paneCredits = UIHandler()
private val remoConCredits = UITitleRemoConCredits(this) private val remoConCredits = UITitleRemoConCredits(this)
private val remoConLanguage = UITitleRemoConLanguage(this) private val remoConLanguage = UITitleRemoConLanguage(this)
private val remoConModules = UITitleRemoConModules(this)
init { init {
remoConLanguage.setPosition(0, 0) remoConLanguage.setPosition(0, 0)
remoConCredits.setPosition(0, 0) remoConCredits.setPosition(0, 0)
remoConModules.setPosition(0, 0)
addSubUI(remoConLanguage) addSubUI(remoConLanguage)
addSubUI(remoConCredits) addSubUI(remoConCredits)
addSubUI(remoConModules)
//////////////////////////// ////////////////////////////
@@ -68,6 +71,26 @@ class UITitleRemoConRoot : UICanvas() {
// attach listeners // attach listeners
// TEST TEST TEST
menubar.buttons[menuLabels.indexOf("MENU_MODE_SINGLEPLAYER")].clickOnceListener = { _, _, _ ->
this.setAsClose()
Thread.sleep(50)
Terrarum.ingame = Ingame(Terrarum.batch)
Terrarum.ingame!!.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
Terrarum.ingame!!.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
LoadScreen.screenToLoad = Terrarum.ingame!!
Terrarum.setScreen(LoadScreen)
}
menubar.buttons[menuLabels.indexOf("MENU_MODULES")].clickOnceListener = { _, _, _ ->
this.setAsClose()
Thread.sleep(50)
remoConModules.setAsOpen()
}
menubar.buttons[menuLabels.indexOf("MENU_LABEL_LANGUAGE")].clickOnceListener = { _, _, _ -> menubar.buttons[menuLabels.indexOf("MENU_LABEL_LANGUAGE")].clickOnceListener = { _, _, _ ->
this.setAsClose() this.setAsClose()
Thread.sleep(50) Thread.sleep(50)

View File

@@ -637,9 +637,8 @@ object WorldGenerator {
val splineP3 = splineControlPoints[ clamp(x_1 + 2, 0, dirtStoneLine.size / POINTS_GAP) ].second.toFloat() val splineP3 = splineControlPoints[ clamp(x_1 + 2, 0, dirtStoneLine.size / POINTS_GAP) ].second.toFloat()
if (x in POINTS_GAP - 1..WIDTH - 2 * POINTS_GAP) { if (x in POINTS_GAP - 1..WIDTH - 2 * POINTS_GAP) {
dirtStoneLine[x] = Math.round(FastMath.interpolateCatmullRom( dirtStoneLine[x] = Math.round(FastMath.interpolateHermite(
(x - splineX1) / POINTS_GAP.toFloat(), (x - splineX1) / POINTS_GAP.toFloat(),
-0.3f,//0.01f,
splineP0, splineP0,
splineP1, splineP1,
splineP2, splineP2,
@@ -647,9 +646,8 @@ object WorldGenerator {
)) ))
} }
else { else {
dirtStoneLine[x] = Math.round(FastMath.interpolateCatmullRom( dirtStoneLine[x] = Math.round(FastMath.interpolateHermite(
(x - splineX1) / POINTS_GAP.toFloat(), (x - splineX1) / POINTS_GAP.toFloat(),
-0.3f,//0.01f,
splineP0, splineP0,
splineP1, splineP1,
splineP2, splineP2,

View File

@@ -77,6 +77,9 @@ see SAVE_FORMAT.md
Attacked thrice: All the NPCs within the same faction become hostile until the player is away Attacked thrice: All the NPCs within the same faction become hostile until the player is away
Deceased HISTORICAL actors are stored to the inventory of DEBUG CHAR (id: 0x51621D) to make them not accidentally GC'd and for the lore.
## Ownership of lands ## ## Ownership of lands ##
* Codex of Real Estate → assign owner to the tiles → copy the information to the NPC instance * Codex of Real Estate → assign owner to the tiles → copy the information to the NPC instance
@@ -103,3 +106,12 @@ Villages can be either independent or part of larger country (_Dwarf Fortress_)
Anything goes as long as it does not exceed TL11 of GURPS. Although the universe has the existence of traditional sorcery, the laws of physics of the universe itself is same as we know it. Simply put: NO FUCKING PERPETUAL MOTION AND PERFECT PROPHECY Anything goes as long as it does not exceed TL11 of GURPS. Although the universe has the existence of traditional sorcery, the laws of physics of the universe itself is same as we know it. Simply put: NO FUCKING PERPETUAL MOTION AND PERFECT PROPHECY
## New light sim: Raytracer
Only take NEAREST SUNLIGHT tile into render, as there will be not much artificial lights on the screen.
Not sure about the performance, but it can be fully multi-threaded.
"You know, the world can always use more ideas." - probably not Oxton

View File

@@ -25,7 +25,7 @@ If things would run with infinite energy, I'm out. We need realism to implement
+ Transparent solar panel (window panel) + Transparent solar panel (window panel)
- Capacitor - Capacitor
+ Battery pack + Battery pack
+ Pu-238 RTG (super long-lasting battery with radiooactive taste) + Pu-238 RTG (super long-lasting battery with radioactive taste)

View File

@@ -16,10 +16,10 @@ Simulation of the world, day and night fast, camera follows landscape
# Singleplayer # Singleplayer
## RemoCon ## RemoCon
- New Character - New Character (CONTEXT_CHARACTER_NEW)
- Delete Character - Delete Character (CONTEXT_CHARACTER_DELETE)
- Name - Rename (MENU_LABEL_RENAME -- check Polyglot project's Core Editing)
- Return - Return (MENU_LABEL_RETURN)
## Panel ## Panel
- Character selection screen, limited to 8 entries - Character selection screen, limited to 8 entries
@@ -31,15 +31,36 @@ Simulation of the world, day and night fast, camera follows landscape
+ Name --------- | Creation date | Last play date | Total play time + Name --------- | Creation date | Last play date | Total play time
+ Name of the current universe | Number of multiverses (if >= 2) + Name of the current universe | Number of multiverses (if >= 2)
### New Character
Step 1:
<chargen UI TBA>
Step 2:
Select world or create new world
If personaCount > 1, new player can join the existing world or universe (if the universe contains multiple world, one can choose one of the world within the universe)
### New World
Options:
- Size (MENU_OPTIONS_SIZE)
+ Small (CONTEXT_DESCRIPTION_SMALL)
+ Big (CONTEXT_DESCRIPTION_BIG)
+ Huge (CONTEXT_DESCRIPTION_HUGE)
- More (MENU_LABEL_MORE)
+ SEED (* Do-not-translate)
# Options # Options
## RemoCon ## RemoCon
- Controls - Controls (MENU_OPTIONS_CONTROLS)
- Graphics - Graphics (MENU_LABEL_GRAPHICS)
- Gameplay Options - Gameplay Options (MENU_OPTIONS_GAMEPLAY)
- MIDI (* Do-not-translate) - MIDI (* Do-not-translate)
- Return - Return (MENU_LABEL_RETURN)
Save configuration to disk upon Return
# Modules # Modules
@@ -62,6 +83,8 @@ Simulation of the world, day and night fast, camera follows landscape
## RemoCon ## RemoCon
- Return - Return
Save configuration to disk upon Return
## Panel ## Panel
- List of languages available, click to change immediately - List of languages available, click to change immediately

View File

@@ -0,0 +1,15 @@
## Blocks
Range: 4 Tiles default
Can only be placed if there's one or more solid tile near 4 blocks (plus-shaped arrangement) OR there's wall right behind it
## Pickaxe
Range: 6-8+ tiles (higher range for higher tier)
## Sledgehammer
Can only take down wall from the top (or bottom in reverse grav.)