Compare commits

..

9 Commits

Author SHA1 Message Date
minjaesong
ed7ca5c1a8 build script for linux-arm (untested) 2023-05-16 22:23:33 +09:00
minjaesong
aad258c054 more prominent torch flickering 2023-05-16 22:22:40 +09:00
minjaesong
79e7ef4da0 .icns and .jar to git-lfs 2023-05-16 13:48:27 +09:00
minjaesong
c74cfa6eb9 fix: lightbox would not load from save due to API change? idk but now savegame and avatar is incompatible 2023-05-16 01:05:31 +09:00
minjaesong
28c45b5756 fix: lowland and mountain clamping on Terragen, which was an issue persisting like 5 yrs 2023-05-16 00:43:51 +09:00
minjaesong
3911f86446 keyboard control panel renaming IME to Toggle IME 2023-05-15 19:42:29 +09:00
minjaesong
dfa1c7d73c more text on the config gui 2023-05-15 19:18:36 +09:00
minjaesong
1b0f233fcb mac app building with icons 2023-05-15 17:59:02 +09:00
minjaesong
ac3975e52f whyyyy 2023-05-15 16:18:59 +09:00
24 changed files with 75 additions and 56 deletions

2
.gitattributes vendored
View File

@@ -7,3 +7,5 @@
*.zip filter=lfs diff=lfs merge=lfs -text
*.kra filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.icns filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
out/*
bin/*
build/*
assets_release/*
.gradle/*
TerrarumBuild.jar
buildapp/out/Terrarum*

View File

@@ -22,5 +22,8 @@
"MENU_OPTIONS_PARTICLES": "Particles",
"MENU_IO_IMPORT": "Import",
"APP_NOMODULE_1": "No Module is currently loaded.",
"APP_NOMODULE_2": "Please configure your Load Order and restart:"
"APP_NOMODULE_2": "Please configure your Load Order and restart:",
"MENU_LABEL_KEYCONFIG_HELP1": "Click On the Keycap to Assign Actions",
"MENU_LABEL_IME_TOGGLE": "Toggle IME",
"MENU_LABEL_PASTE_FROM_CLIPBOARD": "Paste from Cliboard"
}

View File

@@ -21,5 +21,8 @@
"MENU_OPTIONS_PARTICLES": "입자 수",
"MENU_IO_IMPORT": "가져오기",
"APP_NOMODULE_1": "현재 불러와진 모듈이 없습니다.",
"APP_NOMODULE_2": "다음의 파일에서 불러오기 순서를 설정하고 게임을 재시작하십시오."
"APP_NOMODULE_2": "다음의 파일에서 불러오기 순서를 설정하고 게임을 재시작하십시오.",
"MENU_LABEL_KEYCONFIG_HELP1": "키캡을 클릭해 컨트롤을 배정하십시오",
"MENU_LABEL_IME_TOGGLE": "입력기 켜고 끄기",
"MENU_LABEL_PASTE_FROM_CLIPBOARD": "복사한 텍스트 붙여넣기"
}

BIN
buildapp/AppIcon.icns Normal file

Binary file not shown.

View File

@@ -31,7 +31,7 @@ mv $DESTDIR/assets_release $DESTDIR/assets
cp -r "../out/TerrarumBuild.jar" $DESTDIR/assets/
# Pack everything to AppImage
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
ARCH=arm_aarch64 "./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
chmod +x "out/$DESTDIR.AppImage"
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"

View File

@@ -16,9 +16,10 @@ rm -rf $DESTDIR || true
mkdir $DESTDIR
mkdir $DESTDIR/Contents
mkdir $DESTDIR/Contents/MacOS
mkdir $DESTDIR/Contents/Resources
# Prepare an application
cp icns.png $DESTDIR/.icns
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
cp $SRCFILES/Info.plist $DESTDIR/Contents/
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
@@ -30,5 +31,5 @@ cp -r "../out/$RUNTIME" $DESTDIR/Contents/MacOS/
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
cp -r "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/assets/
zip -r -9 -l $DESTDIR.zip $DESTDIR
echo "Build successful: $DESTDIR"

View File

@@ -16,9 +16,10 @@ rm -rf $DESTDIR || true
mkdir $DESTDIR
mkdir $DESTDIR/Contents
mkdir $DESTDIR/Contents/MacOS
mkdir $DESTDIR/Contents/Resources
# Prepare an application
cp icns.png $DESTDIR/.icns
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
cp $SRCFILES/Info.plist $DESTDIR/Contents/
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
@@ -30,5 +31,5 @@ cp -r "../out/$RUNTIME" $DESTDIR/Contents/MacOS/
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
cp -r "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/assets/
zip -r -9 -l $DESTDIR.zip $DESTDIR
echo "Build successful: $DESTDIR"

Binary file not shown.

View File

@@ -56,6 +56,14 @@ Terrarum.*.app
Hide the `.jar` within the subdirectory; users will think this file is the main executable and will try to execute it using whatever JVM they may (or may not) have.
### OSX .icns creation
0. Do this on a real macOS
1. Create a folder `icon.iconset`, then cp the .png file as `icon_512x512.png`
2. On Terminal, `iconutil -c icns icon.iconset`
https://gist.github.com/jamieweavis/b4c394607641e1280d447deed5fc85fc
#### Some Notes
- Windows EXE creation is not there yet. Maybe use one of [these?](https://sourceforge.net/projects/batch-compiler/)

View File

@@ -4,4 +4,5 @@
<key>CFBundleExecutable</key><string>Terrarum.sh</string>
<key>CFBundleDisplayName</key><string>Terrarum</string>
<key>CFBundleName</key><string>Terrarum</string>
<key>CFBundleIconFile</key><string>AppIcon.icns</string>
</dict></plist>

View File

@@ -4,4 +4,5 @@
<key>CFBundleExecutable</key><string>Terrarum.sh</string>
<key>CFBundleDisplayName</key><string>Terrarum</string>
<key>CFBundleName</key><string>Terrarum</string>
<key>CFBundleIconFile</key><string>AppIcon.icns</string>
</dict></plist>

View File

@@ -13,8 +13,8 @@ import net.torvald.terrarum.weather.WeatherMixer
*/
object BlockPropUtil {
//var flickerFuncX: Second = 0f // saves current status (time) of func
val flickerFuncDomain: Second = 0.08f // time between two noise sample
val flickerFuncRange = 0.022f // intensity [0, 1]
val flickerFuncDomain: Second = 0.06f // time between two noise sample
val flickerFuncRange = 0.036f // intensity [0, 1]
//var breathFuncX = 0f
val breathRange = 0.02f

View File

@@ -50,7 +50,7 @@ open class ActorWithBody : Actor {
*
* NOTE: MUST NOT SERIALISE (use `@Transient`)
*/
open var lightBoxList: List<Lightbox> = emptyList()
open var lightBoxList: ArrayList<Lightbox> = arrayListOf() // must use ArrayList: has no-arg constructor
/**
* Arguments:
@@ -60,7 +60,7 @@ open class ActorWithBody : Actor {
*
* NOTE: MUST NOT SERIALISE (use `@Transient`)
*/
open var shadeBoxList: List<Lightbox> = emptyList()
open var shadeBoxList: ArrayList<Lightbox> = arrayListOf() // must use ArrayList: has no-arg constructor
// end of Luminous
protected constructor() : super()

View File

@@ -99,9 +99,9 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
* Hitbox(x-offset, y-offset, width, height)
* (Use ArrayList for normal circumstances)
*/
@Transient override var lightBoxList: List<Lightbox> = listOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), Cvec(0)))
@Transient override var lightBoxList: ArrayList<Lightbox> = arrayListOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), Cvec(0)))
// the actual values are update on the update()
@Transient override var shadeBoxList: List<Lightbox> = listOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), Cvec(0)))
@Transient override var shadeBoxList: ArrayList<Lightbox> = arrayListOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), Cvec(0)))
// the actual values are update on the update()
@Transient val BASE_DENSITY = 980.0

View File

@@ -39,9 +39,9 @@ open class DroppedItem : ActorWithBody {
private val randKey1 = (Math.random() * 256).toInt()
private val randKey2 = (Math.random() * 256).toInt()
override var lightBoxList = listOf(Lightbox(this.hitbox.clone().setPosition(0.0, 0.0), Cvec(0)))
override var lightBoxList = arrayListOf(Lightbox(this.hitbox.clone().setPosition(0.0, 0.0), Cvec(0)))
// the Cvec will be calculated dynamically on Update
override var shadeBoxList = listOf(Lightbox(this.hitbox.clone().setPosition(0.0, 0.0), Cvec(0)))
override var shadeBoxList = arrayListOf(Lightbox(this.hitbox.clone().setPosition(0.0, 0.0), Cvec(0)))
// the Cvec will be calculated dynamically on Update
/**

View File

@@ -43,9 +43,9 @@ open class FixtureSwingingDoorBase : FixtureBase {
private var pixelwiseHitboxHeight = TILE_SIZE * tilewiseHitboxHeight
private var tilewiseDistToAxis = tw - twClosed
@Transient override var lightBoxList = listOf(Lightbox(Hitbox(TILE_SIZED * tilewiseDistToAxis, 0.0, TILE_SIZED * twClosed, TILE_SIZED * th), Cvec(0)))
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(TILE_SIZED * tilewiseDistToAxis, 0.0, TILE_SIZED * twClosed, TILE_SIZED * th), Cvec(0)))
// the Cvec will be calculated dynamically on Update
@Transient override var shadeBoxList = listOf(Lightbox(Hitbox(TILE_SIZED * tilewiseDistToAxis, 0.0, TILE_SIZED * twClosed, TILE_SIZED * th), Cvec(0)))
@Transient override var shadeBoxList = arrayListOf(Lightbox(Hitbox(TILE_SIZED * tilewiseDistToAxis, 0.0, TILE_SIZED * twClosed, TILE_SIZED * th), Cvec(0)))
// the Cvec will be calculated dynamically on Update
protected var doorState = 0 // -1: open toward left, 0: closed, 1: open toward right

View File

@@ -23,7 +23,7 @@ internal class FixtureTikiTorch : FixtureBase {
private val rndHash1 = (Math.random() * 256).toInt()
private val rndHash2 = (Math.random() * 256).toInt()
@Transient override var lightBoxList = listOf(Lightbox(Hitbox(6.0, 5.0, 4.0, 3.0), BlockCodex[Block.TORCH].getLumCol(rndHash1, rndHash2)))
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(6.0, 5.0, 4.0, 3.0), BlockCodex[Block.TORCH].getLumCol(rndHash1, rndHash2)))
constructor() : super(
BlockBox(BlockBox.NO_COLLISION, 1, 2),

View File

@@ -39,7 +39,7 @@ open class ProjectileSimple : ActorWithBody, Projectile {
* Hitbox(x-offset, y-offset, width, height)
* (Use ArrayList for normal circumstances)
*/
@Transient override var lightBoxList = listOf(Lightbox(Hitbox(-4.0, -4.0, 8.0, 8.0), color)) // lightbox sized 8x8 centered to the bullet
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(-4.0, -4.0, 8.0, 8.0), color)) // lightbox sized 8x8 centered to the bullet
private val lifetimeMax = 2500

View File

@@ -177,9 +177,19 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
App.fontGame.draw(batch, txt2, selDrawX + halfselw + (halfselw - tw2) / 2, y1)
// title
// TODO only when text input using gamepad is supported, and even then, use text spinner
// val title = Lang["MENU_LABEL_IME"]
// App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
// todo show "Keyboard"/"Gamepad" accordingly
val title = Lang["MENU_CONTROLS_KEYBOARD"]
batch.color = Color.WHITE
App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
// button help for string input UI
val help1 = "${Lang["MENU_LABEL_IME_TOGGLE"]}"
App.fontGame.draw(batch, help1, drawX + 10f, height - 40f - 28f)
val help2 = "${Lang["MENU_LABEL_PASTE_FROM_CLIPBOARD"]}"
App.fontGame.draw(batch, help2, drawX + keyboardTestPanel.width - 4f - App.fontGame.getWidth(help2), height - 40f + 30f)
batch.color = Color.WHITE
uiItems.forEach { it.render(batch, camera) }

View File

@@ -197,18 +197,20 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
uiItems.forEach { it.render(batch, camera) }
buttonReset.render(batch, camera)
// title
// todo show "Keyboard"/"Gamepad" accordingly
batch.color = Color.WHITE
val title = Lang["MENU_CONTROLS_KEYBOARD"]
App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
val desc = Lang["MENU_LABEL_KEYCONFIG_HELP1"]
App.fontGame.draw(batch, desc, drawX.toFloat() + (width - App.fontGame.getWidth(desc)) / 2, drawY + 360f)
// action palette
batch.color = Color.WHITE
if (keycapClicked >= 0 && controlSelected < 0) {
controlPalette.render(batch, camera)
}
// title
// TODO display window "title" using text spinner ONLY WHEN gamepad config is also supported
// val title = Lang["MENU_OPTIONS_CONTROLS"]
// batch.color = Color.WHITE
// App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
}
fun setControlOf(key: Int, control: Int) {
@@ -423,7 +425,7 @@ class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: I
App.fontGame.draw(batch, Lang["GAME_ACTION_QUICKSEL"], col0 + 40, row4)
App.fontGame.draw(batch, Lang["GAME_ACTION_ZOOM"], col1 + 40, row1)
App.fontGame.draw(batch, Lang["MENU_LABEL_IME"], col1 + 40, row2)
App.fontGame.draw(batch, Lang["MENU_LABEL_IME_TOGGLE"], col1 + 40, row2)
App.fontGame.draw(batch, Lang["MENU_LABEL_MENU"], col1 + 40, row3)
}

View File

@@ -157,13 +157,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
lowlandShapeFractal.setFrequency(0.25)
lowlandShapeFractal.seed = seed shake lowlandMagic
val lowlandAutoCorrect = ModuleAutoCorrect()
lowlandAutoCorrect.setSource(lowlandShapeFractal)
lowlandAutoCorrect.setLow(0.0)
lowlandAutoCorrect.setHigh(1.0)
val lowlandScale = ModuleScaleOffset()
lowlandScale.setScale(0.125)
lowlandScale.setSource(lowlandShapeFractal)
lowlandScale.setScale(0.22)
lowlandScale.setOffset(params.lowlandScaleOffset) // TODO linearly alters the height
val lowlandYScale = ModuleScaleDomain()
@@ -184,14 +180,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
highlandShapeFractal.setFrequency(2.0)
highlandShapeFractal.seed = seed shake highlandMagic
val highlandAutocorrect = ModuleAutoCorrect()
highlandAutocorrect.setSource(highlandShapeFractal)
highlandAutocorrect.setLow(-1.0)
highlandAutocorrect.setHigh(1.0)
val highlandScale = ModuleScaleOffset()
highlandScale.setSource(highlandAutocorrect)
highlandScale.setScale(0.25)
highlandScale.setSource(highlandShapeFractal)
highlandScale.setScale(0.5)
highlandScale.setOffset(params.highlandScaleOffset) // TODO linearly alters the height
val highlandYScale = ModuleScaleDomain()
@@ -211,14 +202,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
mountainShapeFractal.setFrequency(1.0)
mountainShapeFractal.seed = seed shake mountainMagic
val mountainAutocorrect = ModuleAutoCorrect()
mountainAutocorrect.setSource(mountainShapeFractal)
mountainAutocorrect.setLow(-1.0)
mountainAutocorrect.setHigh(1.0)
val mountainScale = ModuleScaleOffset()
mountainScale.setSource(mountainAutocorrect)
mountainScale.setScale(0.45)
mountainScale.setSource(mountainShapeFractal)
mountainScale.setScale(1.0)
mountainScale.setOffset(params.mountainScaleOffset) // TODO linearly alters the height
val mountainYScale = ModuleScaleDomain()
@@ -239,7 +225,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
terrainTypeFractal.setFrequency(0.125)
terrainTypeFractal.seed = seed shake selectionMagic
val terrainAutocorrect = ModuleAutoCorrect()
val terrainAutocorrect = ModuleAutoCorrect() // absolutely required
terrainAutocorrect.setSource(terrainTypeFractal)
terrainAutocorrect.setLow(0.0)
terrainAutocorrect.setHigh(1.0)

View File

@@ -588,7 +588,7 @@ Igloo
Image
Ion
Iron
Islam
Isles
Issue
Item
Ivory

View File

@@ -113,8 +113,8 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
// appear (e.g. getting garbage values when it fucking shouldn't)
// using ifs instead of assertions: inactive assert statements still slows down the app
if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
if (index !in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
// if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
// if (index !in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
}
operator fun get(index: Long): Byte {