light calc takes fluid into account

This commit is contained in:
minjaesong
2019-01-27 00:30:56 +09:00
parent 55cfae831a
commit 02f9a5e127
18 changed files with 133 additions and 87 deletions

View File

@@ -71,7 +71,7 @@ The control is omnidirectional. In other words, \emph{not} cell-based.
\subsubsection{ISO\slash ANSI\slash JIS pedalboards} \subsubsection{ISO\slash ANSI\slash JIS pedalboards}
Your default moving around uses ESDF (qwerty)\slash FRST (colemak)\slash .OEW (dvorak) pedals for default `WASD', in order for you to provide more modifier pedals---QAZ (qwerty\slash colemak), /A; (dvorak)---that are pressed with your little finger and more comfort to some pedalboards with Topre actuators.\footnote{Writers of this book would recommend you to use pedalboard with Cherry MX Red actuators, though any decent pedalboard should be sufficient.} Your default moving around uses ESDF (qwerty)\slash FRST (colemak)\slash .OEW (dvorak) pedals for default `WASD', in order for you to provide more modifier pedals---QAZ (qwerty\slash colemak), /A; (dvorak)---that are pressed with your little finger and more comfort to some pedalboards with Topre actuators.\footnote{Writers of this book would recommend you to use pedalboard with Cherry MX Red actuators, though any decent pedalboard should be sufficient.}
\subsubsection{Joypads} \subsubsection{gamepads}
Your moving around uses left stick, and direction of the movement is \emph{not} limited to 8 directions, hence the term, “omni\-direc\-tion\-al”. Your moving around uses left stick, and direction of the movement is \emph{not} limited to 8 directions, hence the term, “omni\-direc\-tion\-al”.
\section{World} \section{World}

View File

@@ -98,15 +98,15 @@
"256"; "256";"BLOCK_LANTERN_IRON_REGULAR" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"FXTR"; "0"; "0"; "1"; "0"; "0"; "0"; "N/A"; "0";"16";"1.0000";"0.6372";"0.0000";"0.0000" "256"; "256";"BLOCK_LANTERN_IRON_REGULAR" ;"0.0312";"0.0312";"0.0312";"0.0312"; "1"; "N/A";"FXTR"; "0"; "0"; "1"; "0"; "0"; "0"; "N/A"; "0";"16";"1.0000";"0.6372";"0.0000";"0.0000"
"257"; "257";"BLOCK_SUNSTONE" ;"0.1252";"0.1252";"0.1252";"0.1252"; "1"; "N/A";"ROCK"; "1"; "0"; "0"; "0"; "0"; "2"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000" "257"; "257";"BLOCK_SUNSTONE" ;"0.1252";"0.1252";"0.1252";"0.1252"; "1"; "N/A";"ROCK"; "1"; "0"; "0"; "0"; "0"; "2"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000"
"258"; "258";"BLOCK_DAYLIGHT_CAPACITOR" ;"0.1252";"0.1252";"0.1252";"0.1252"; "1"; "N/A";"GLAS"; "1"; "0"; "0"; "0"; "0"; "3"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000" "258"; "258";"BLOCK_DAYLIGHT_CAPACITOR" ;"0.1252";"0.1252";"0.1252";"0.1252"; "1"; "N/A";"GLAS"; "1"; "0"; "0"; "0"; "0"; "3"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000"
"4094"; "0";"BLOCK_LAVA" ;"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK"; "0"; "0"; "1"; "0"; "0"; "0"; "32"; "0";"16";"0.7664";"0.2032";"0.0000";"0.0000" "4096"; "0";"BLOCK_WATER" ;"0.1016";"0.0744";"0.0508";"0.0508";"100";"1000";"WATR"; "0"; "0"; "1"; "0"; "0"; "0"; "16"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000"
"4095"; "0";"BLOCK_WATER" ;"0.1016";"0.0744";"0.0508";"0.0508";"100";"1000";"WATR"; "0"; "0"; "1"; "0"; "0"; "0"; "16"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000" "4097"; "0";"BLOCK_LAVA" ;"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK"; "0"; "0"; "1"; "0"; "0"; "0"; "32"; "0";"16";"0.7664";"0.2032";"0.0000";"0.0000"
"-1"; "0";"BLOCK_NULL" ;"4.0000";"4.0000";"4.0000";"4.0000"; "-1";"2600";"NULL"; "0"; "0"; "1"; "1"; "0"; "0"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000" "-1"; "0";"BLOCK_NULL" ;"4.0000";"4.0000";"4.0000";"4.0000"; "-1";"2600";"NULL"; "0"; "0"; "1"; "1"; "0"; "0"; "N/A"; "0";"16";"0.0000";"0.0000";"0.0000";"0.0000"
## Notes ## ## Notes ##
# #
# Lava/Water props are left for future references, do not delete them until FluidCodex is built # # Lava/Water props are left for future references, do not delete them until FluidCodex is built #
# #
# id: Block ID # id: Block ID. ID equal to or greater than 4096 is for fluids, mainly for lighting calculation.
# drop: Drop ID # drop: Drop ID
# #
# shdr/g/b, lumr/g/b: Shade RGB/ Lum RGB. # shdr/g/b, lumr/g/b: Shade RGB/ Lum RGB.
Can't render this file because it contains an unexpected character in line 1 and column 20.

View File

@@ -8,22 +8,22 @@
"multithread": true, "multithread": true,
"joypadkeyn": 4, "gamepadkeyn": 4,
"joypadkeyw": 1, "gamepadkeyw": 1,
"joypadkeys": 2, "gamepadkeys": 2,
"joypadkeye": 3, "gamepadkeye": 3,
"joypadlup": 4, "gamepadlup": 4,
"joypadrup": 5, "gamepadrup": 5,
"joypadldown": 6, "gamepadldown": 6,
"joypadrdown": 7, "gamepadrdown": 7,
"joypadlstickx": 0, "gamepadlstickx": 0,
"joypadlsticky": 1, "gamepadlsticky": 1,
"joypadrstickx": 2, "gamepadrstickx": 2,
"joypadrsticky": 3, "gamepadrsticky": 3,
"joypadlabelstyle": "msxb360", "gamepadlabelstyle": "msxb360",
"keyup": 33, "keyup": 33,

View File

@@ -24,6 +24,8 @@ import net.torvald.terrarum.utils.JsonFetcher;
import net.torvald.terrarum.utils.JsonWriter; import net.torvald.terrarum.utils.JsonWriter;
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.input.Controller;
import org.lwjgl.input.Controllers;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -160,6 +162,10 @@ public class AppLoader implements ApplicationListener {
public static GameFontBase fontGame; public static GameFontBase fontGame;
public static TinyAlphNum fontSmallNumbers; public static TinyAlphNum fontSmallNumbers;
/** A gamepad. Multiple gamepads may controll this single virtualised gamepad. */
public static org.lwjgl.input.Controller gamepad = null;
public static float gamepadDeadzone = 0.1f;
/** /**
* For the events depends on rendering frame (e.g. flicker on post-hit invincibility) * For the events depends on rendering frame (e.g. flicker on post-hit invincibility)
*/ */
@@ -244,14 +250,17 @@ public class AppLoader implements ApplicationListener {
@Override @Override
public void create() { public void create() {
// set basis of draw
logoBatch = new SpriteBatch(); logoBatch = new SpriteBatch();
camera = new OrthographicCamera(((float) appConfig.width), ((float) appConfig.height)); camera = new OrthographicCamera(((float) appConfig.width), ((float) appConfig.height));
initViewPort(appConfig.width, appConfig.height); initViewPort(appConfig.width, appConfig.height);
// logo here :p
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);
// set GL graphics constants
shaderBayerSkyboxFill = loadShader("assets/4096.vert", "assets/4096_bayer_skyboxfill.frag"); shaderBayerSkyboxFill = loadShader("assets/4096.vert", "assets/4096_bayer_skyboxfill.frag");
shaderHicolour = loadShader("assets/4096.vert", "assets/hicolour.frag"); shaderHicolour = loadShader("assets/4096.vert", "assets/hicolour.frag");
shaderColLUT = loadShader("assets/4096.vert", "assets/passthru.frag"); shaderColLUT = loadShader("assets/4096.vert", "assets/passthru.frag");
@@ -263,6 +272,22 @@ public class AppLoader implements ApplicationListener {
VertexAttribute.TexCoords(0) VertexAttribute.TexCoords(0)
); );
updateFullscreenQuad(appConfig.width, appConfig.height); updateFullscreenQuad(appConfig.width, appConfig.height);
// enlist suitable gamepads
try {
Controllers.create();
printdbg(this, "Available gamepads: " + Controllers.getControllerCount());
for (int x = 0; x < Controllers.getControllerCount(); x++) {
Controller gamepad = Controllers.getController(x);
printdbg(this, String.format("Gamepad #%d: %s", x + 1, gamepad.getName()));
}
}
catch (Throwable e) {
printdbg(this, "Exception occured while creating controllers -- there will be no gamepads available.");
printdbg(this, e);
}
} }
/** /**
@@ -407,7 +432,7 @@ public class AppLoader implements ApplicationListener {
} }
IngameRenderer.INSTANCE.dispose(); IngameRenderer.INSTANCE.dispose();
if (Controllers.isCreated()) Controllers.destroy();
// delete temp files // delete temp files
new File("./tmp_wenquanyi.tga").delete(); // FIXME this is pretty much ad-hoc new File("./tmp_wenquanyi.tga").delete(); // FIXME this is pretty much ad-hoc
@@ -440,6 +465,9 @@ public class AppLoader implements ApplicationListener {
printdbg(this, "Screen transisiton complete: " + this.screen.getClass().getCanonicalName()); printdbg(this, "Screen transisiton complete: " + this.screen.getClass().getCanonicalName());
} }
/**
* Init stuffs which needs GL context
*/
private void postInit() { private void postInit() {
textureWhiteSquare = new Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga")); textureWhiteSquare = new Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga"));
textureWhiteSquare.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest); textureWhiteSquare.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

View File

@@ -28,22 +28,22 @@ object DefaultConfig {
// control-gamepad // control-gamepad
jsonObject.addProperty("joypadkeyn", 4) jsonObject.addProperty("gamepadkeyn", 4)
jsonObject.addProperty("joypadkeyw", 1) jsonObject.addProperty("gamepadkeyw", 1)
jsonObject.addProperty("joypadkeys", 2) jsonObject.addProperty("gamepadkeys", 2)
jsonObject.addProperty("joypadkeye", 3) // logitech indices jsonObject.addProperty("gamepadkeye", 3) // logitech indices
jsonObject.addProperty("joypadlup", 4) jsonObject.addProperty("gamepadlup", 4)
jsonObject.addProperty("joypadrup", 5) jsonObject.addProperty("gamepadrup", 5)
jsonObject.addProperty("joypadldown", 6) jsonObject.addProperty("gamepadldown", 6)
jsonObject.addProperty("joypadrdown", 7) // logitech indices jsonObject.addProperty("gamepadrdown", 7) // logitech indices
jsonObject.addProperty("joypadlstickx", 0) jsonObject.addProperty("gamepadlstickx", 0)
jsonObject.addProperty("joypadlsticky", 1) jsonObject.addProperty("gamepadlsticky", 1)
jsonObject.addProperty("joypadrstickx", 2) jsonObject.addProperty("gamepadrstickx", 2)
jsonObject.addProperty("joypadrsticky", 3) // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck? jsonObject.addProperty("gamepadrsticky", 3) // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck?
jsonObject.addProperty("joypadlabelstyle", "msxb360") // "nwii", "logitech", "sonyps", "msxb360", "generic" jsonObject.addProperty("gamepadlabelstyle", "msxb360") // "nwii", "logitech", "sonyps", "msxb360", "generic"

View File

@@ -124,20 +124,20 @@ object Terrarum : Screen {
val fontGame: GameFontBase = AppLoader.fontGame val fontGame: GameFontBase = AppLoader.fontGame
val fontSmallNumbers: TinyAlphNum = AppLoader.fontSmallNumbers val fontSmallNumbers: TinyAlphNum = AppLoader.fontSmallNumbers
var joypadLabelStart: Char = 0xE000.toChar() // lateinit var gamepadLabelStart: Char = 0xE000.toChar() // lateinit
var joypadLableSelect: Char = 0xE000.toChar() // lateinit var gamepadLableSelect: Char = 0xE000.toChar() // lateinit
var joypadLabelNinA: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinA: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinB: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinB: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinX: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinX: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinY: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinY: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinL: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinL: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinR: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinR: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinZL: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinZL: Char = 0xE000.toChar() // lateinit TODO
var joypadLabelNinZR: Char = 0xE000.toChar() // lateinit TODO var gamepadLabelNinZR: Char = 0xE000.toChar() // lateinit TODO
val joypadLabelLEFT = 0xE068.toChar() val gamepadLabelLEFT = 0xE068.toChar()
val joypadLabelDOWN = 0xE069.toChar() val gamepadLabelDOWN = 0xE069.toChar()
val joypadLabelUP = 0xE06A.toChar() val gamepadLabelUP = 0xE06A.toChar()
val joypadLabelRIGHT = 0xE06B.toChar() val gamepadLabelRIGHT = 0xE06B.toChar()
// 0x0 - 0xF: Game-related // 0x0 - 0xF: Game-related
// 0x10 - 0x1F: Config // 0x10 - 0x1F: Config
@@ -160,10 +160,6 @@ object Terrarum : Screen {
val STATE_ID_TOOL_NOISEGEN = 0x200 val STATE_ID_TOOL_NOISEGEN = 0x200
val STATE_ID_TOOL_RUMBLE_DIAGNOSIS = 0x201 val STATE_ID_TOOL_RUMBLE_DIAGNOSIS = 0x201
var controller: org.lwjgl.input.Controller? = null
private set
val CONTROLLER_DEADZONE = 0.1f
/** Available CPU threads */ /** Available CPU threads */
val THREADS = Runtime.getRuntime().availableProcessors() + 1 val THREADS = Runtime.getRuntime().availableProcessors() + 1
@@ -223,12 +219,12 @@ object Terrarum : Screen {
println("vendor = $processorVendor") println("vendor = $processorVendor")
joypadLabelStart = when (getConfigString("joypadlabelstyle")) { gamepadLabelStart = when (getConfigString("gamepadlabelstyle")) {
"nwii" -> 0xE04B.toChar() // + mark "nwii" -> 0xE04B.toChar() // + mark
"logitech" -> 0xE05A.toChar() // number 10 "logitech" -> 0xE05A.toChar() // number 10
else -> 0xE042.toChar() // |> mark (sonyps, msxb360, generic) else -> 0xE042.toChar() // |> mark (sonyps, msxb360, generic)
} }
joypadLableSelect = when (getConfigString("joypadlabelstyle")) { gamepadLableSelect = when (getConfigString("gamepadlabelstyle")) {
"nwii" -> 0xE04D.toChar() // - mark "nwii" -> 0xE04D.toChar() // - mark
"logitech" -> 0xE059.toChar() // number 9 "logitech" -> 0xE059.toChar() // number 9
"sonyps" -> 0xE043.toChar() // solid rectangle "sonyps" -> 0xE043.toChar() // solid rectangle

View File

@@ -1,6 +1,8 @@
package net.torvald.terrarum.blockproperties package net.torvald.terrarum.blockproperties
import net.torvald.terrarum.AppLoader import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.gameworld.FluidType
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.gameworld.MapLayer import net.torvald.terrarum.gameworld.MapLayer
import net.torvald.terrarum.gameworld.PairedMapLayer import net.torvald.terrarum.gameworld.PairedMapLayer
import net.torvald.terrarum.utils.CSVFetcher import net.torvald.terrarum.utils.CSVFetcher
@@ -72,6 +74,19 @@ object BlockCodex {
} }
} }
operator fun get(fluidType: FluidType?): BlockProp {
if (fluidType == null || fluidType.value == 0) {
return blockProps[Block.AIR]
}
try {
return blockProps[fluidType.abs() + GameWorld.TILES_SUPPORTED - 1]
}
catch (e: NullPointerException) {
throw NullPointerException("Blockprop with raw id $fluidType does not exist.")
}
}
fun getOrNull(rawIndex: Int?): BlockProp? { fun getOrNull(rawIndex: Int?): BlockProp? {
if (rawIndex == null || rawIndex == Block.NULL) { if (rawIndex == null || rawIndex == Block.NULL) {
return null return null

View File

@@ -210,13 +210,13 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
// you can add alias to address something like LEGGINGS, BREASTPLATE, RINGS, NECKLACES, etc. // you can add alias to address something like LEGGINGS, BREASTPLATE, RINGS, NECKLACES, etc.
@JvmStatic val BODY_ARMOUR = 0 @JvmStatic val BODY_ARMOUR = 0
@JvmStatic val BODY_BACKPACK = 1 // wings, jetpacks, etc. @JvmStatic val BODY_FOOTWEAR = 1 // wings, jetpacks, etc.
@JvmStatic val HEADGEAR = 2 @JvmStatic val HEADGEAR = 2
@JvmStatic val FOOTWEAR = 3 @JvmStatic val HAND_GAUNTLET = 3
@JvmStatic val HAND_GRIP = 4 @JvmStatic val HAND_GRIP = 4
@JvmStatic val HAND_GAUNTLET = 5 @JvmStatic val TOOL_HOOKSHOT = 5
@JvmStatic val BODY_BUFF1 = 6 @JvmStatic val BODY_BUFF1 = 6
@JvmStatic val BODY_BUFF2 = 8 @JvmStatic val BODY_BUFF2 = 8

View File

@@ -118,7 +118,7 @@ object Lang {
// special treatment // special treatment
if (key.startsWith("MENU_LABEL_PRESS_START_SYMBOL")) if (key.startsWith("MENU_LABEL_PRESS_START_SYMBOL"))
return ret2.replace('>', Terrarum.joypadLabelStart).capitalize() return ret2.replace('>', Terrarum.gamepadLabelStart).capitalize()
return if (key.getEndTag().contains("bg")) return if (key.getEndTag().contains("bg"))
"${AppLoader.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideDefault}" "${AppLoader.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideDefault}"

View File

@@ -225,20 +225,20 @@ open class ActorHumanoid(
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyright")) isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyright"))
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump"))
if (Terrarum.controller != null) { if (AppLoader.gamepad != null) {
axisX = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadlstickx")) axisX = AppLoader.gamepad!!.getAxisValue(AppLoader.getConfigInt("gamepadlstickx"))
axisY = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadlsticky")) axisY = AppLoader.gamepad!!.getAxisValue(AppLoader.getConfigInt("gamepadlsticky"))
axisRX = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadrstickx")) axisRX = AppLoader.gamepad!!.getAxisValue(AppLoader.getConfigInt("gamepadrstickx"))
axisRY = Terrarum.controller!!.getAxisValue(AppLoader.getConfigInt("joypadrsticky")) axisRY = AppLoader.gamepad!!.getAxisValue(AppLoader.getConfigInt("gamepadrsticky"))
// deadzonning // deadzonning
if (Math.abs(axisX) < Terrarum.CONTROLLER_DEADZONE) axisX = 0f if (Math.abs(axisX) < AppLoader.gamepadDeadzone) axisX = 0f
if (Math.abs(axisY) < Terrarum.CONTROLLER_DEADZONE) axisY = 0f if (Math.abs(axisY) < AppLoader.gamepadDeadzone) axisY = 0f
if (Math.abs(axisRX) < Terrarum.CONTROLLER_DEADZONE) axisRX = 0f if (Math.abs(axisRX) < AppLoader.gamepadDeadzone) axisRX = 0f
if (Math.abs(axisRY) < Terrarum.CONTROLLER_DEADZONE) axisRY = 0f if (Math.abs(axisRY) < AppLoader.gamepadDeadzone) axisRY = 0f
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) || isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) ||
Terrarum.controller!!.isButtonPressed(GAMEPAD_JUMP) AppLoader.gamepad!!.isButtonPressed(GAMEPAD_JUMP)
} }
} }
else { else {
@@ -250,7 +250,7 @@ open class ActorHumanoid(
} }
private inline val hasController: Boolean private inline val hasController: Boolean
get() = if (isGamer) Terrarum.controller != null get() = if (isGamer) AppLoader.gamepad != null
else true else true
private fun processInput(delta: Float) { private fun processInput(delta: Float) {
@@ -384,7 +384,7 @@ open class ActorHumanoid(
* *
* Be warned. * Be warned.
* *
* @param left (even if the game is joypad controlled, you must give valid value) * @param left (even if the game is gamepad controlled, you must give valid value)
* @param absAxisVal (set AXIS_KEYBOARD if keyboard controlled) * @param absAxisVal (set AXIS_KEYBOARD if keyboard controlled)
* @author minjaesong * @author minjaesong
*/ */
@@ -424,7 +424,7 @@ open class ActorHumanoid(
/** /**
* @param up (even if the game is joypad controlled, you must give valid value) * @param up (even if the game is gamepad controlled, you must give valid value)
* * * *
* @param absAxisVal (set AXIS_KEYBOARD if keyboard controlled) * @param absAxisVal (set AXIS_KEYBOARD if keyboard controlled)
*/ */

View File

@@ -142,9 +142,9 @@ package net.torvald.terrarum.modulebasegame.ui
"${0xe011.toChar()}..${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" + "${0xe011.toChar()}..${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
"${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}" "${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}"
else else
"$joypadLabelNinY ${Lang["GAME_INVENTORY_USE"]}$SP" + "$gamepadLabelNinY ${Lang["GAME_INVENTORY_USE"]}$SP" +
"${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" + "${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
"$joypadLabelNinA ${Lang["GAME_INVENTORY_DROP"]}" "$gamepadLabelNinA ${Lang["GAME_INVENTORY_DROP"]}"
val listControlClose: String val listControlClose: String
get() = if (Terrarum.environment == RunningEnvironment.PC) get() = if (Terrarum.environment == RunningEnvironment.PC)
"${0xe037.toChar()} ${Lang["GAME_ACTION_CLOSE"]}" "${0xe037.toChar()} ${Lang["GAME_ACTION_CLOSE"]}"

View File

@@ -51,9 +51,9 @@ class UIInventoryFull(
"${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}" "${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}"
else else
"${0xe069.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" + "${0xe069.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"${Terrarum.joypadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" + "${Terrarum.gamepadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" +
"${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" + "${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
"${Terrarum.joypadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}" "${Terrarum.gamepadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}"
val controlHelpHeight = Terrarum.fontGame.lineHeight val controlHelpHeight = Terrarum.fontGame.lineHeight
private var encumbrancePerc = 0f private var encumbrancePerc = 0f

View File

@@ -1,9 +1,7 @@
package net.torvald.terrarum.modulebasegame.ui package net.torvald.terrarum.modulebasegame.ui
import net.torvald.terrarum.AppLoader import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.QNDTreeNode
import net.torvald.terrarum.Yaml import net.torvald.terrarum.Yaml
import java.util.*
@@ -24,6 +22,9 @@ object UITitleRemoConYaml {
- MENU_OPTIONS - MENU_OPTIONS
- MENU_OPTIONS_GRAPHICS - MENU_OPTIONS_GRAPHICS
- MENU_OPTIONS_CONTROLS - MENU_OPTIONS_CONTROLS
- MENU_CONTROLS_KEYBOARD
- MENU_CONTROLS_GAMEPAD
- MENU_LABEL_RETURN
- MENU_OPTIONS_SOUND - MENU_OPTIONS_SOUND
- MENU_LABEL_RETURN - MENU_LABEL_RETURN
- MENU_MODULES : net.torvald.terrarum.modulebasegame.ui.UITitleModules - MENU_MODULES : net.torvald.terrarum.modulebasegame.ui.UITitleModules

View File

@@ -182,10 +182,10 @@ class BasicDebugInfoWindow : UICanvas() {
batch.color = Color.WHITE batch.color = Color.WHITE
if (Terrarum.controller != null) { if (AppLoader.gamepad != null) {
drawGamepadAxis(batch, drawGamepadAxis(batch,
Terrarum.controller!!.getAxisValue(3), AppLoader.gamepad!!.getAxisValue(3),
Terrarum.controller!!.getAxisValue(2), AppLoader.gamepad!!.getAxisValue(2),
Terrarum.WIDTH - 135, Terrarum.WIDTH - 135,
40 40
) )
@@ -304,8 +304,8 @@ class BasicDebugInfoWindow : UICanvas() {
val pointDX = axisX * halfW val pointDX = axisX * halfW
val pointDY = axisY * halfH val pointDY = axisY * halfH
val padName = if (Terrarum.controller!!.name.isEmpty()) "Gamepad" val padName = if (AppLoader.gamepad!!.name.isEmpty()) "Gamepad"
else Terrarum.controller!!.name else AppLoader.gamepad!!.name
blendNormal(batch) blendNormal(batch)

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.*
import net.torvald.terrarum.AppLoader.printdbg import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.blockproperties.Block import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.concurrent.ParallelUtils.sliceEvenly import net.torvald.terrarum.concurrent.ParallelUtils.sliceEvenly
import net.torvald.terrarum.concurrent.ThreadParallel import net.torvald.terrarum.concurrent.ThreadParallel
import net.torvald.terrarum.gameactors.ActorWBMovable import net.torvald.terrarum.gameactors.ActorWBMovable
@@ -408,6 +409,7 @@ object LightmapRenderer {
//private val ambientAccumulator = Color(0f,0f,0f,0f) //private val ambientAccumulator = Color(0f,0f,0f,0f)
private val lightLevelThis = Color(0f,0f,0f,0f) private val lightLevelThis = Color(0f,0f,0f,0f)
private var thisTerrain = 0 private var thisTerrain = 0
private var thisFluid = Fluid.NULL
private var thisWall = 0 private var thisWall = 0
private val thisTileLuminosity = Color(0f,0f,0f,0f) private val thisTileLuminosity = Color(0f,0f,0f,0f)
private val thisTileOpacity = Color(0f,0f,0f,0f) private val thisTileOpacity = Color(0f,0f,0f,0f)
@@ -428,9 +430,13 @@ object LightmapRenderer {
// this six fetch tasks take 2 ms ?! // this six fetch tasks take 2 ms ?!
lightLevelThis.set(colourNull) lightLevelThis.set(colourNull)
thisTerrain = world.getTileFromTerrain(x, y) ?: Block.STONE thisTerrain = world.getTileFromTerrain(x, y) ?: Block.STONE
thisFluid = world.getFluid(x, y).type
thisWall = world.getTileFromWall(x, y) ?: Block.STONE thisWall = world.getTileFromWall(x, y) ?: Block.STONE
thisTileLuminosity.set(BlockCodex[thisTerrain].luminosity) // already been div by four thisTileLuminosity.set(BlockCodex[thisTerrain].luminosity maxBlend BlockCodex[thisFluid].luminosity) // already been div by four
thisTileOpacity.set(BlockCodex[thisTerrain].opacity) // already been div by four
// TODO thisTileOpacity: take fluid amount into account
thisTileOpacity.set(BlockCodex[thisTerrain].opacity maxBlend BlockCodex[thisFluid].opacity) // already been div by four
thisTileOpacity2.set(thisTileOpacity); thisTileOpacity2.mul(1.41421356f) thisTileOpacity2.set(thisTileOpacity); thisTileOpacity2.mul(1.41421356f)
sunLight.set(world.globalLight); sunLight.mul(DIV_FLOAT) sunLight.set(world.globalLight); sunLight.mul(DIV_FLOAT)

Binary file not shown.

Binary file not shown.

Binary file not shown.