mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
new utility tiles: Sunstone and Daylight Capacitor
Former-commit-id: 1cd01c381d395a413baf50d851718205b2bfe1fd Former-commit-id: 0199c31f7e83ff6396128602985cfa3c13e07e63
This commit is contained in:
@@ -5,15 +5,21 @@
|
||||
* Arm behind the body seems unnatural
|
||||
|
||||
|
||||
### Phys ###
|
||||
### Physics ###
|
||||
|
||||
* Actor stick to wall and not get off
|
||||
* Actor with mass <2 behaves erratically
|
||||
|
||||
|
||||
# Resolved #
|
||||
|
||||
* Cannot fit into single-tile width pit
|
||||
Cause: Player/NPC looks slim enough to fit, but don't fit in the game
|
||||
Solution: Draw them wider, allow them to fit into the pit (Phys resolver will glitch?)
|
||||
__Solved__ — Player/NPC hitbox now have a width of 15 pixels.
|
||||
Solution: Player/NPC hitbox now have a width of 15 pixels.
|
||||
|
||||
* Actor stick to wall and not get off
|
||||
Cause: Unknown
|
||||
Solution: Changed collision detection method to CCD (continuous collision detection)
|
||||
|
||||
* Actor with mass <2 behaves erratically
|
||||
Details: Velocity becomes NaN when jumped
|
||||
Cause: Floating-point precision error?
|
||||
Solution: Changed every physics variable that uses Float to Double
|
||||
@@ -30,9 +30,9 @@ Any contribution in this project must be made sorely in English, so be sure to u
|
||||
### Contributing translations ###
|
||||
|
||||
* Writing text
|
||||
You will need to fiddle with .csv files in ./res/locales
|
||||
You will need to fiddle with .csv files in ./res/locales
|
||||
* Languagus with apparent grammatical gender
|
||||
Any gender discrimination should *not* exist in this game, so please choose vocabularies that is gender-neutral. If such behaviour is not possible in the target language, please use male gender, but try your best to avoid the situation.
|
||||
Any gender discrimination should *not* exist in this game, so please choose vocabularies that is gender-neutral. If such behaviour is not possible in the target language, please use male gender, but try your best to avoid the situation.
|
||||
|
||||
Note: Right-to-left languages (arabic, hebrew, etc.) are not supported.
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 347 KiB After Width: | Height: | Size: 347 KiB |
@@ -253,6 +253,8 @@ constructor() : BasicGameState() {
|
||||
notifier.render(gc, g)
|
||||
}
|
||||
|
||||
private fun getGradientColour(row: Int, phase: Int) = GRADIENT_IMAGE!!.getColor(phase, row)
|
||||
|
||||
private fun getGradientColour(row: Int): Color {
|
||||
val gradMapWidth = GRADIENT_IMAGE!!.width
|
||||
val phase = Math.round(
|
||||
@@ -260,7 +262,19 @@ constructor() : BasicGameState() {
|
||||
)
|
||||
|
||||
//update in every INTERNAL_FRAME frames
|
||||
return GRADIENT_IMAGE!!.getColor(phase, row)
|
||||
return getGradientColour(row, phase)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param time in seconds
|
||||
*/
|
||||
private fun getGradientColourByTime(row: Int, time: Int): Color {
|
||||
val gradMapWidth = GRADIENT_IMAGE!!.width
|
||||
val phase = Math.round(
|
||||
time.toFloat() / WorldTime.DAY_LENGTH.toFloat() * gradMapWidth
|
||||
)
|
||||
|
||||
return getGradientColour(row, phase)
|
||||
}
|
||||
|
||||
override fun keyPressed(key: Int, c: Char) {
|
||||
@@ -358,6 +372,7 @@ constructor() : BasicGameState() {
|
||||
|
||||
private val globalLightByTime: Int
|
||||
get() = getGradientColour(2).getRGB24().rgb24ExpandToRgb30()
|
||||
fun globalLightByTime(t: Int): Int = getGradientColourByTime(2, t).getRGB24().rgb24ExpandToRgb30()
|
||||
|
||||
fun Color.getRGB24(): Int = (this.redByte shl 16) or (this.greenByte shl 8) or (this.blueByte)
|
||||
/** Remap 8-bit value (0.0-1.0) to 10-bit value (0.0-4.0) by prepending two bits of zero for each R, G and B. */
|
||||
|
||||
@@ -5,8 +5,6 @@ import net.torvald.terrarum.gamecontroller.EnumKeyFunc
|
||||
import net.torvald.terrarum.gamecontroller.KeyMap
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import org.dyn4j.geometry.ChainedVector2
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import org.lwjgl.input.Controller
|
||||
import org.lwjgl.input.Controllers
|
||||
@@ -113,10 +111,23 @@ class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, Lan
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* This code directly controls VELOCITY for walking, called walkX and walkY.
|
||||
*
|
||||
* In theory, we must add ACCELERATION to the velocity, but unfortunately it's arduous task
|
||||
* with this simulation code base.
|
||||
*
|
||||
* Reason: we have naïve friction code that is not adaptive at all and to add proper walking code to
|
||||
* this code base, ACCELERATION must be changed (in other words, we must deal with JERK) accordingly
|
||||
* to the FRICTION.
|
||||
*
|
||||
* So I'm adding walkX/Y and getting the ActorWithBody.setNewNextHitbox to use the velocity value of
|
||||
* walkX/Y + velocity, which is stored in variable moveDelta.
|
||||
*
|
||||
* Be warned.
|
||||
*
|
||||
* @param left (even if the game is joypad controlled, you must give valid value)
|
||||
* *
|
||||
* @param absAxisVal (set AXIS_POSMAX if keyboard controlled)
|
||||
* @author minjaesong
|
||||
*/
|
||||
private fun walkHorizontal(left: Boolean, absAxisVal: Float) {
|
||||
readonly_totalX = //veloX +
|
||||
|
||||
@@ -107,6 +107,10 @@ object TileNameCode {
|
||||
val SANDSTONE_BLACK = TilePropCodex.idDamageToIndex(15, 4)
|
||||
val SANDSTONE_GREEN = TilePropCodex.idDamageToIndex(15, 5)
|
||||
|
||||
val LANTERN = TilePropCodex.idDamageToIndex(16, 0)
|
||||
val SUNSTONE = TilePropCodex.idDamageToIndex(16, 1)
|
||||
val DAYLIGHT_CAPACITOR = TilePropCodex.idDamageToIndex(16, 2)
|
||||
|
||||
val WATER_1 = TilePropCodex.idDamageToIndex(255, 0)
|
||||
val WATER_2 = TilePropCodex.idDamageToIndex(255, 1)
|
||||
val WATER_3 = TilePropCodex.idDamageToIndex(255, 2)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package net.torvald.terrarum.tileproperties
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gamemap.WorldTime
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-16.
|
||||
*/
|
||||
@@ -7,8 +10,7 @@ class TileProp {
|
||||
|
||||
var id: Int = 0
|
||||
|
||||
var damage: Int = 0
|
||||
var name: String = ""
|
||||
var nameKey: String = ""
|
||||
|
||||
/**
|
||||
* @param opacity Raw RGB value, without alpha
|
||||
@@ -29,7 +31,17 @@ class TileProp {
|
||||
/**
|
||||
* @param luminosity Raw RGB value, without alpha
|
||||
*/
|
||||
var luminosity: Int = 0
|
||||
private var realLum: Int = 0
|
||||
var luminosity: Int
|
||||
set(value) {
|
||||
realLum = value
|
||||
}
|
||||
get() = if (id == TileNameCode.SUNSTONE)
|
||||
Terrarum.game.map.globalLight
|
||||
else if (id == TileNameCode.DAYLIGHT_CAPACITOR)
|
||||
Terrarum.game.globalLightByTime(WorldTime.DAY_LENGTH / 2)
|
||||
else
|
||||
realLum
|
||||
|
||||
var drop: Int = 0
|
||||
var dropDamage: Int = 0
|
||||
|
||||
@@ -67,10 +67,9 @@ class TilePropCodex {
|
||||
}
|
||||
|
||||
private fun setProp(prop: TileProp, record: CSVRecord) {
|
||||
prop.name = record.get("name")
|
||||
prop.nameKey = record.get("name")
|
||||
|
||||
prop.id = intVal(record, "id")
|
||||
prop.damage = intVal(record, "dmg")
|
||||
prop.id = idDamageToIndex(intVal(record, "id"), intVal(record, "dmg"))
|
||||
|
||||
prop.opacity = intVal(record, "opacity")
|
||||
prop.strength = intVal(record, "strength")
|
||||
@@ -85,8 +84,8 @@ class TilePropCodex {
|
||||
prop.isWallable = boolVal(record, "wall")
|
||||
prop.isFallable = boolVal(record, "fall")
|
||||
|
||||
print(formatNum3(prop.id) + ":" + formatNum2(prop.damage))
|
||||
println("\t" + prop.name)
|
||||
print(formatNum3(intVal(record, "id")) + ":" + formatNum2(intVal(record, "dmg")))
|
||||
println("\t" + prop.nameKey)
|
||||
}
|
||||
|
||||
private fun intVal(rec: CSVRecord, s: String): Int {
|
||||
|
||||
@@ -84,6 +84,8 @@
|
||||
"15"; "4";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16"
|
||||
"15"; "5";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16"
|
||||
"16"; "0";"TILE_LANTERN_IRON_REGULAR"; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "267619480"; "16"; "0"; "0";"16"
|
||||
"16"; "1";"TILE_SUNSTONE" ; "33587232"; "0"; "N/A"; "0"; "1"; "0"; "0"; "16"; "1"; "0";"16"
|
||||
"16"; "2";"TILE_DAYLIGHT_CAPACITOR" ; "33587232"; "0"; "N/A"; "0"; "1"; "0"; "0"; "16"; "2"; "0";"16"
|
||||
"254"; "0";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16"
|
||||
"254"; "1";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16"
|
||||
"254"; "2";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16"
|
||||
@@ -123,6 +125,9 @@
|
||||
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
||||
# dsty: density. As we are putting water an 1000, it is identical to specific gravity. [g/l]
|
||||
|
||||
# Sunstone: Artificial sunlight, change colour over time in sync with sunlight
|
||||
# Sunlight capacitor: daylight at 11h of 22h day
|
||||
|
||||
# Defalut torch : L 70 a 51 b 59; real candlelight colour taken from properly configured camera.
|
||||
|
||||
# 16 colour palette : Old Apple Macintosh 16-colour palette
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 18.
|
Reference in New Issue
Block a user