Compare commits

...

65 Commits

Author SHA1 Message Date
minjaesong
81ebf7a8ef world code placeholder to match the code struct 2023-09-08 19:32:41 +09:00
minjaesong
d5a8d098bb teleporter: list loading on separate thread 2023-09-08 18:51:53 +09:00
minjaesong
cc55e563f0 ModLoader: load IME unconditionally when found 2023-09-08 15:31:11 +09:00
minjaesong
64ef30e445 shorter share code if allowed; flickering teleporter beams 2023-09-08 02:14:36 +09:00
minjaesong
fbc700508f season variable moved to worldtime 2023-09-07 17:21:34 +09:00
minjaesong
37492dc8a0 six ecological seasons for terrain tiles 2023-09-07 13:19:32 +09:00
minjaesong
b0e4bd31eb temporary setup for picking next weather 2023-09-06 22:33:42 +09:00
minjaesong
0b5e3d7b77 skybox: old-current weather turbidity blend 2023-09-06 21:07:39 +09:00
minjaesong
b47cc17afd choosing next weather as its own function 2023-09-06 19:30:08 +09:00
minjaesong
6c97a9d5ab cloud stage has more depth 2023-09-06 18:01:33 +09:00
minjaesong
7259ca616c modloader: locale autoloader 2023-09-06 02:15:04 +09:00
minjaesong
70b9cebbd0 working sledgehammer item to take down walls 2023-09-05 22:47:40 +09:00
minjaesong
274be20e25 new texture for the teleporter 2023-09-05 20:40:55 +09:00
minjaesong
c576d087b4 newborn clouds will fade-in 2023-09-05 14:24:02 +09:00
minjaesong
699cc4dd74 another failed experiment 2023-09-05 13:45:02 +09:00
minjaesong
8fa9ddeec1 portalPoint to the world 2023-09-05 01:40:20 +09:00
minjaesong
c4deba14da cloud rendering: gamma change 2023-09-05 01:04:09 +09:00
minjaesong
cf98c13111 fix: 'q' would close the ui when you're typing in something 2023-09-05 00:41:43 +09:00
minjaesong
d0e1555ad0 sprite update 2023-09-04 22:40:48 +09:00
minjaesong
50eac69e3e working invitation code for new character 2023-09-04 22:16:51 +09:00
minjaesong
c45cab388e working invitation code via portal 2023-09-04 21:48:28 +09:00
minjaesong
7b3ac9cd06 weatherbox is now owned by the world 2023-09-04 14:59:12 +09:00
minjaesong
08b1d93d54 fix: double typing on world portal ui 2023-09-04 14:04:19 +09:00
minjaesong
da7ecaa75b share code ui wall of text 2023-09-03 20:30:23 +09:00
minjaesong
65b610ce01 world portal share code 2023-09-03 17:06:02 +09:00
minjaesong
6a78cf6a41 reverting akima intp: derivatives are not being preserved at the sample points 2023-09-02 23:43:50 +09:00
minjaesong
1e98353b50 akima interpolation to the WeatherBox 2023-09-02 22:37:07 +09:00
minjaesong
38c91bd8ec weatherbox: nonlinearity to the intp to remove overshoot-to-minus 2023-09-02 17:18:47 +09:00
minjaesong
78075d779b each cloud now carry its own gamma value 2023-09-02 02:40:27 +09:00
minjaesong
721a24d9dc commenting out some debug prints 2023-09-02 00:24:38 +09:00
minjaesong
66a103bd3a weather sched progression wip 2023-09-01 23:56:48 +09:00
minjaesong
abee176ef4 fix: graph rules not drawing if ymax < 1 2023-09-01 16:30:09 +09:00
minjaesong
ae078024cb angular modulo for wind dir 2023-09-01 15:51:46 +09:00
minjaesong
96af39ab4a changing the way weatherbox gets updated 2023-09-01 00:50:24 +09:00
minjaesong
c75fa73bac scrolling weatherbox; new skybox clut 2023-08-31 22:32:55 +09:00
minjaesong
5eed921288 debugwin: drawing ingame weatherboxes 2023-08-31 17:03:27 +09:00
minjaesong
7f3f94e01a gui-theme: cell colour change 2023-08-31 12:20:31 +09:00
minjaesong
1fe0ca9e2e debug window: weather box drawing 2023-08-31 12:19:56 +09:00
minjaesong
7cc985b627 debug info: timer toggle is now Ctrl+T 2023-08-31 10:56:32 +09:00
minjaesong
d17d576e15 sunlight and clouds changes 2023-08-30 19:57:11 +09:00
minjaesong
ced7cf99fc more cloud textures 2023-08-30 17:54:34 +09:00
minjaesong
c290d5dee7 minor phys fix 2023-08-30 14:39:20 +09:00
minjaesong
d32d6b8d1c torch should flicker less erratic now 2023-08-30 12:39:56 +09:00
minjaesong
9d118aebb0 todo weather example 2023-08-29 15:39:24 +09:00
minjaesong
0646425b76 build: removing unused files, instruction update 2023-08-29 14:29:25 +09:00
minjaesong
a348bac397 . 2023-08-29 14:04:17 +09:00
minjaesong
a9bd032c32 yet another cloud colour changes 2023-08-28 14:48:14 +09:00
minjaesong
349488376d sunrise/sunset transition is now longer 2023-08-28 14:30:24 +09:00
minjaesong
ce8c53f740 clut for cloud colours 2023-08-28 03:28:27 +09:00
minjaesong
7845146718 cloud spawn: fixing my bad maths 2023-08-28 00:04:00 +09:00
minjaesong
3cce1c0b65 faster import process 2023-08-27 21:13:52 +09:00
minjaesong
2bbf92d056 build script update 2023-08-27 21:01:13 +09:00
minjaesong
3d5713cd31 new test sprite/display screencaps for imported avatars if available 2023-08-27 17:38:43 +09:00
minjaesong
f8b6493cdc temporarily disabling evening-mustard :p 2023-08-25 21:28:20 +09:00
minjaesong
b69689a6be higher alpha-gamma makes it look better 2023-08-25 21:27:17 +09:00
minjaesong
cc2c841f76 app version string for .plist 2023-08-25 21:26:51 +09:00
minjaesong
89846db5d3 fix: using wrong method for retrieving mouse coord 2023-08-25 18:46:24 +09:00
minjaesong
bfd926d7fe avatar import error handling 2023-08-25 17:38:15 +09:00
minjaesong
602d5e046b fix: newly created world did not get clouds 2023-08-25 16:50:41 +09:00
minjaesong
72029ed458 new world screen for loading imported players 2023-08-25 16:47:00 +09:00
minjaesong
a4672a131d some gui stuff for imported players 2023-08-25 16:04:12 +09:00
minjaesong
75fcb5be5b new import screen 2023-08-25 15:49:35 +09:00
minjaesong
eeee1ebdbc F4 to hide GUI 2023-08-25 09:11:56 +09:00
minjaesong
32e750eb6a generating version number on build 2023-08-25 08:54:32 +09:00
minjaesong
a2ced31f8f removing os files on making assets_release 2023-08-25 08:40:06 +09:00
219 changed files with 3461 additions and 1131 deletions

View File

@@ -87,6 +87,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/lib/regex-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/js-22.3.1-edit.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/graal-sdk-22.3.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/commons-math3-3.6.1.jar" path-in-jar="/" />
</root>
</artifact>
</component>

14
.idea/libraries/apache_commons_math3.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="apache.commons.math3" type="repository">
<properties maven-id="org.apache.commons:commons-math3:3.6.1" />
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/commons-math3-3.6.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/lib/commons-math3-3.6.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/commons-math3-3.6.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build Version Number" type="Application" factoryName="Application">
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="net.torvald.terrarum.PrebuildKt" />
<module name="TerrarumBuild" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -7,6 +7,7 @@
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<module name="TerrarumBuild" />
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Build Version Number" run_configuration_type="Application" />
<option name="BuildArtifacts" enabled="true">
<artifact name="ModuleComputers" />
<artifact name="TerrarumBuild" />

View File

@@ -7,6 +7,7 @@
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<module name="TerrarumBuild" />
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Build Version Number" run_configuration_type="Application" />
<option name="BuildArtifacts" enabled="true">
<artifact name="ModuleComputers" />
<artifact name="TerrarumBuild" />

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulecomputers.gameitems
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.utils.Disposable
@@ -118,7 +119,7 @@ class WearableWorldRadarUI(val device: VM) : UICanvas() {
device.update(delta)
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
batch.end()
batch.color = Color.WHITE

View File

@@ -50,7 +50,7 @@ internal class UIHomeComputer : UICanvas(
override fun updateUI(delta: Float) {
}
override fun renderUI(otherBatch: SpriteBatch, otherCamera: Camera) {
override fun renderUI(otherBatch: SpriteBatch, otherCamera: OrthographicCamera) {
otherBatch.end()
fbo.inAction(camera, batch) {

View File

@@ -25,5 +25,6 @@
<orderEntry type="library" name="jetbrains.kotlin.reflect" level="project" />
<orderEntry type="library" name="jetbrains.kotlin.test" level="project" />
<orderEntry type="library" name="io.github.classgraph" level="project" />
<orderEntry type="library" name="apache.commons.math3" level="project" />
</component>
</module>

Binary file not shown.

BIN
assets/graphics/fonts/code.tga LFS Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,5 @@
{
"ERROR_FILE_NOT_FOUND": "File not found.",
"GAME_32BIT_WARNING1": "It looks like youre running a 32-Bit version of Java.",
"GAME_32BIT_WARNING2": "Please download and install the latest 64-Bit Java at:",
"GAME_32BIT_WARNING3": "https://www.java.com/en/download/",

View File

@@ -7,6 +7,7 @@
"COPYRIGHT_GNU_GPL_3": "GNU GPL 3에 따라 배포됨",
"GAME_ACTION_MOVE_VERB" : "이동하기",
"GAME_ACTION_ZOOM" : "확대·축소",
"GAME_ACTION_ZOOM_OUT" : "화면 축소",
"MENU_IO_AUTOSAVE": "자동 저장",
"MENU_IO_CLEAR": "지우기",
"MENU_IO_IMPORT": "가져오기",
@@ -18,7 +19,7 @@
"MENU_LABEL_IME_TOGGLE": "입력기 켜고 끄기",
"MENU_LABEL_KEYBOARD_LAYOUT": "자판 배열",
"MENU_LABEL_PASTE": "붙여넣기",
"MENU_LABEL_PASTE_FROM_CLIPBOARD": "복사한 텍스트 붙여넣기",
"MENU_LABEL_PASTE_FROM_CLIPBOARD": "복사한 문구 붙여넣기",
"MENU_LABEL_PRESS_START_SYMBOL": ">을 누르세요",
"MENU_LABEL_RESET" : "재설정",
"MENU_LABEL_RESTART_REQUIRED": "재시작 필요",

View File

@@ -1,4 +1,5 @@
{
"ERROR_FILE_NOT_FOUND": "파일을 찾을 수 없습니다.",
"GAME_32BIT_WARNING1": "32비트 버전의 Java를 사용중인 것 같습니다.",
"GAME_32BIT_WARNING2": "아래 링크에서 최신 64비트 Java를 내려받아 설치해주세요.",
"GAME_32BIT_WARNING3": "https://www.java.com/ko/download/",

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,34 @@
{
"racename": "",
"racenameplural": "",
"baseheight": 90,
"basemass": 600.0,
"strength": 65535,
"strengthmult": [100,100,100,100,100,100,100],
"accel": 0.67,
"speed": 6.0,
"speedmult": [100,100,100,100,100,100,100],
"vertstride": 40,
"jumppower": 17.6,
"jumppowermult": [100,100,100,100,100,100,100],
"scale": 1.0,
"scalemult": [100,100,100,100,100,100,100],
"encumbrance": 2147483647,
"defence": 65535,
"reach": 226,
"toolsize": 40,
"intelligent": true,
"barehandactionminheight": 40,
"basebarehanddiggingsize": 16,
"__comments__": "This RAW is intended to test the theoretical maximum values for properties (strength, defence, etc.)"
}

Binary file not shown.

View File

@@ -2,6 +2,7 @@ id;classname
1;net.torvald.terrarum.modulebasegame.gameitems.PickaxeCopper
2;net.torvald.terrarum.modulebasegame.gameitems.PickaxeIron
3;net.torvald.terrarum.modulebasegame.gameitems.PickaxeSteel
4;net.torvald.terrarum.modulebasegame.gameitems.SledgehammerIron
5;net.torvald.terrarum.modulebasegame.gameitems.ItemTikiTorch
6;net.torvald.terrarum.modulebasegame.gameitems.ItemStorageChest
7;net.torvald.terrarum.modulebasegame.gameitems.WireGraphDebugger
@@ -9,6 +10,9 @@ id;classname
9;net.torvald.terrarum.modulebasegame.gameitems.WireCutterAll
10;net.torvald.terrarum.modulebasegame.gameitems.ItemTypewriter
11;net.torvald.terrarum.modulebasegame.gameitems.ItemWallCalendar
12;net.torvald.terrarum.modulebasegame.gameitems.SledgehammerCopper
13;net.torvald.terrarum.modulebasegame.gameitems.SledgehammerSteel
256;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorOak
257;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorEbony
1 id classname
2 1 net.torvald.terrarum.modulebasegame.gameitems.PickaxeCopper
3 2 net.torvald.terrarum.modulebasegame.gameitems.PickaxeIron
4 3 net.torvald.terrarum.modulebasegame.gameitems.PickaxeSteel
5 4 net.torvald.terrarum.modulebasegame.gameitems.SledgehammerIron
6 5 net.torvald.terrarum.modulebasegame.gameitems.ItemTikiTorch
7 6 net.torvald.terrarum.modulebasegame.gameitems.ItemStorageChest
8 7 net.torvald.terrarum.modulebasegame.gameitems.WireGraphDebugger
10 9 net.torvald.terrarum.modulebasegame.gameitems.WireCutterAll
11 10 net.torvald.terrarum.modulebasegame.gameitems.ItemTypewriter
12 11 net.torvald.terrarum.modulebasegame.gameitems.ItemWallCalendar
13 12 net.torvald.terrarum.modulebasegame.gameitems.SledgehammerCopper
14 13 net.torvald.terrarum.modulebasegame.gameitems.SledgehammerSteel
15 256 net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorOak
16 256 257 net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorOak net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorEbony
17 257 258 net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorEbony net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorBirch
18 258 259 net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorBirch net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorRosewood

Binary file not shown.

View File

@@ -9,6 +9,8 @@
"MENU_LABEL_MENU": "Menu",
"MENU_LABEL_PREV_SAVES": "Previous Saves",
"MENU_LABEL_RENAME": "Rename",
"MENU_LABEL_USE_CODE": "Use Code",
"MENU_MONITOR_CALI_TITLE": "Check Monitor",
"GAME_ACTION_CRAFT": "Craft",
"GAME_ACTION_GRAPPLE": "Grapple",
"GAME_ACTION_QUICKSEL": "Quick Select",

View File

@@ -5,6 +5,12 @@
"ITEM_CALENDAR": "Calendar",
"ITEM_LOGIC_SIGNAL_EMITTER": "Logic Signal Emitter",
"ITEM_PICK_COPPER": "Copper Pickaxe",
"ITEM_PICK_IRON": "Iron Pickaxe",
"ITEM_PICK_STEEL": "Steel Pickaxe",
"ITEM_SLEDGEHAMMER_COPPER": "Copper Sledgehammer",
"ITEM_SLEDGEHAMMER_IRON": "Iron Sledgehammer",
"ITEM_SLEDGEHAMMER_STEEL": "Steel Sledgehammer",
"ITEM_STORAGE_CHEST": "Storage Chest",
"ITEM_TIKI_TORCH": "Tiki Torch",
"ITEM_TYPEWRITER": "Typewriter",

View File

@@ -1,5 +1,12 @@
{
"CONTEXT_THIS_IS_A_WORLD_CURRENTLY_PLAYING": "This is a world currently playing.",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_1": "Copy the Avatar Code into the clipboard, then hit the Paste button below.",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_2": ""
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_1": "1. Place the Avatar file into the following directory:",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_2": "",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_3": "2. Enter the name of the file below, then press Import",
"CONTEXT_WORLD_CODE_SHARE_1": "Other people sharing the device can play on this",
"CONTEXT_WORLD_CODE_SHARE_2": "world when you are away.",
"CONTEXT_WORLD_CODE_SHARE_3": "",
"CONTEXT_WORLD_CODE_SHARE_4": "Share the code below so the other people can join!",
"ERROR_AVATAR_ALREADY_EXISTS": "The Avatar already exists.",
"ERROR_WORLD_NOT_FOUND": "World not found."
}

View File

@@ -9,6 +9,7 @@
"MENU_LABEL_MENU": "메뉴",
"MENU_LABEL_PREV_SAVES": "이전 세이브",
"MENU_LABEL_RENAME": "이름 바꾸기",
"MENU_LABEL_USE_CODE": "코드 사용",
"MENU_MONITOR_CALI_TITLE": "모니터 확인",
"GAME_ACTION_CRAFT": "제작하기",
"GAME_ACTION_GRAPPLE": "매달리기",

View File

@@ -5,6 +5,12 @@
"ITEM_CALENDAR": "달력",
"ITEM_LOGIC_SIGNAL_EMITTER": "신호발생기",
"ITEM_PICK_COPPER": "구리 곡괭이",
"ITEM_PICK_IRON": "철 곡괭이",
"ITEM_PICK_STEEL": "강철 곡괭이",
"ITEM_SLEDGEHAMMER_COPPER": "구리 해머",
"ITEM_SLEDGEHAMMER_IRON": "철 해머",
"ITEM_SLEDGEHAMMER_STEEL": "강철 해머",
"ITEM_STORAGE_CHEST": "보관상자",
"ITEM_TIKI_TORCH": "티키 토치",
"ITEM_TYPEWRITER": "타자기",

View File

@@ -1,5 +1,11 @@
{
"CONTEXT_THIS_IS_A_WORLD_CURRENTLY_PLAYING": "현재 플레이 중인 월드입니다.",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_1": "아바타 코드를 클립보드에 복사한 다음, 아래의 붙여넣기 버튼을 눌러주세요.",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_2": ""
"CONTEXT_THIS_IS_A_WORLD_CURRENTLY_PLAYING": "현재 플레이 중인 세계입니다.",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_1": "1. 아바타 파일을 다음 폴더에 넣어주세요",
"CONTEXT_IMPORT_AVATAR_INSTRUCTION_3": "2. 아바타 파일 이름을 아래에 입력하고 가져오기를 눌러주세요",
"CONTEXT_WORLD_CODE_SHARE_1": "자리를 비운 동안 같은 기기를 공유하는 다른 사람이 이 세계를",
"CONTEXT_WORLD_CODE_SHARE_2": "플레이할 수 있도록 합니다.",
"CONTEXT_WORLD_CODE_SHARE_3": "",
"CONTEXT_WORLD_CODE_SHARE_4": "아래의 코드를 공유해 다른 사람을 초대하세요!",
"ERROR_AVATAR_ALREADY_EXISTS": "이미 존재하는 아바타입니다.",
"ERROR_WORLD_NOT_FOUND": "세계를 찾을 수 없습니다."
}

View File

@@ -0,0 +1,48 @@
# complete file name is: SPRITESHEET + bodypart name + EXTENSION
SPRITESHEET=mods/basegame/sprites/test_werebeastf2/taimu_
EXTENSION=.tga
# defines frame size and origin point. Origin point is given as: (originx, 0)
CONFIG=SIZE 64,98;ORIGINX 40
! A skeleton also defines what body parts (images) be used.
! You can also write multiline text using reverse solidus; this is a feature of .properties
! skeleton joints are ordered: foremost-drawn object comes first, which means lowermost object IN THIS LIST
! are painted first, and any object that comes before it will paint over it. In other words, this list is
! first reversed then being iterated.
! Some keywords are considered special within the game, they are:
! HEADGEAR, HELD_ITEM, BOOT_L, BOOT_R, GAUNTLET_L, GAUNTLET_R and ARMOUR_* (star means any number starting from zero)
BODYPARTS=HEADGEAR 13,14;\
HEAD 13,14;\
ARM_REST_RIGHT 10,4;\
ARM_REST_LEFT 9,3;\
LEG_REST_RIGHT 15,6;\
LEG_REST_LEFT 8,6;\
TORSO_0 18,19;\
TORSO_1 18,19;\
TAIL_0 30,2;\
BUST_0 11,2;\
HELD_ITEM 0,0
SKELETON_STAND=HEADGEAR 0,78;\
ARM_REST_RIGHT -16,66;\
HELD_ITEM -11,33;\
HEAD 0,78;\
BUST_0 0,63;\
TORSO_0 0,54;\
TORSO_1 0,54;\
LEG_REST_RIGHT -5,41;\
LEG_REST_LEFT 3,41;\
ARM_REST_LEFT 8,66;\
TAIL_0 2,40
! When you move the arms/hands, make sure you move the HELD_ITEM as well
# RUNNING might need its own skeleton...
ANIM_RUN=DELAY 0.18;ROW 2;SKELETON SKELETON_STAND
ANIM_RUN_1=LEG_REST_RIGHT 2,2;LEG_REST_LEFT -2,0;TAIL_0 1,0;TORSO_1 0,-999
ANIM_RUN_2=ALL 0,2;LEG_REST_RIGHT 0,-2;LEG_REST_LEFT 0,2;TAIL_0 -1,0;TORSO_1 0,-999
ANIM_RUN_3=LEG_REST_RIGHT -2,0;LEG_REST_LEFT 2,2;TAIL_0 -1,0;TORSO_1 0,-999
ANIM_RUN_4=ALL 0,2;LEG_REST_RIGHT 0,2;LEG_REST_LEFT 0,-2;TAIL_0 1,0;TORSO_1 0,-999
ANIM_IDLE=DELAY 2;ROW 1;SKELETON SKELETON_STAND
ANIM_IDLE_1=TORSO_1 0,-999
ANIM_IDLE_2=TORSO_0 0,-999;ARM_REST_LEFT 0,1;ARM_REST_RIGHT 0,1;HELD_ITEM 0,1;BUST_0 0,1;HEAD 0,1

View File

@@ -0,0 +1,48 @@
# complete file name is: SPRITESHEET + bodypart name + EXTENSION
SPRITESHEET=mods/basegame/sprites/test_werebeastf2/taimuglow_
EXTENSION=.tga
# defines frame size and origin point. Origin point is given as: (originx, 0)
CONFIG=SIZE 64,98;ORIGINX 40
! A skeleton also defines what body parts (images) be used.
! You can also write multiline text using reverse solidus; this is a feature of .properties
! skeleton joints are ordered: foremost-drawn object comes first, which means lowermost object IN THIS LIST
! are painted first, and any object that comes before it will paint over it. In other words, this list is
! first reversed then being iterated.
! Some keywords are considered special within the game, they are:
! HEADGEAR, HELD_ITEM, BOOT_L, BOOT_R, GAUNTLET_L, GAUNTLET_R and ARMOUR_* (star means any number starting from zero)
BODYPARTS=HEADGEAR 13,14;\
HEAD 13,14;\
ARM_REST_RIGHT 10,4;\
ARM_REST_LEFT 9,3;\
LEG_REST_RIGHT 15,6;\
LEG_REST_LEFT 8,6;\
TORSO_0 18,19;\
TORSO_1 18,19;\
TAIL_0 30,2;\
BUST_0 11,2;\
HELD_ITEM 0,0
SKELETON_STAND=HEADGEAR 0,78;\
ARM_REST_RIGHT -16,66;\
HELD_ITEM -11,33;\
HEAD 0,78;\
BUST_0 0,63;\
TORSO_0 0,54;\
TORSO_1 0,54;\
LEG_REST_RIGHT -5,41;\
LEG_REST_LEFT 3,41;\
ARM_REST_LEFT 8,66;\
TAIL_0 2,40
! When you move the arms/hands, make sure you move the HELD_ITEM as well
# RUNNING might need its own skeleton...
ANIM_RUN=DELAY 0.18;ROW 2;SKELETON SKELETON_STAND
ANIM_RUN_1=LEG_REST_RIGHT 2,2;LEG_REST_LEFT -2,0;TAIL_0 1,0;TORSO_1 0,-999
ANIM_RUN_2=ALL 0,2;LEG_REST_RIGHT 0,-2;LEG_REST_LEFT 0,2;TAIL_0 -1,0;TORSO_1 0,-999
ANIM_RUN_3=LEG_REST_RIGHT -2,0;LEG_REST_LEFT 2,2;TAIL_0 -1,0;TORSO_1 0,-999
ANIM_RUN_4=ALL 0,2;LEG_REST_RIGHT 0,2;LEG_REST_LEFT 0,-2;TAIL_0 1,0;TORSO_1 0,-999
ANIM_IDLE=DELAY 2;ROW 1;SKELETON SKELETON_STAND
ANIM_IDLE_1=TORSO_1 0,-999
ANIM_IDLE_2=TORSO_0 0,-999;ARM_REST_LEFT 0,1;ARM_REST_RIGHT 0,1;HELD_ITEM 0,1;BUST_0 0,1;HEAD 0,1

Binary file not shown.

View File

@@ -1,22 +1,26 @@
{
"identifier": "generic01",
"skyboxGradColourMap": "generic_skybox.tga",
"daylightClut": "clut_daylight.tga",
"classification": "generic",
"cloudChance": 250,
"cloudGamma": [0.48, 1.8],
"cloudGammaVariance": [0.1, 0.1],
"windSpeed": 10.25,
"windSpeedVariance": 1.0,
"cloudChance": 125,
"cloudGamma": [0.7, 2.4],
"cloudGammaVariance": [0.143, 0.0],
"windSpeed": 0.35,
"windSpeedVariance": 0.4,
"windSpeedDamping": 0.5,
"clouds": {
"cumulonimbus": {
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.2,
"baseScale": 2.0, "scaleVariance": 0.3333333,
"altLow": 80, "altHigh": 120
"baseScale": 4.0, "scaleVariance": 0.3333333,
"altLow": 1080, "altHigh": 1120
},
"cumulus": {
"filename": "cloud_normal.png", "tw": 1024, "th": 512, "probability": 1.0,
"baseScale": 1.0, "scaleVariance": 0.6,
"altLow": 80, "altHigh": 800
"baseScale": 2.0, "scaleVariance": 0.6,
"altLow": 1080, "altHigh": 1800
}
}
},
"atmoTurbidity": 3.5,
"shaderVibrancy": [1.0, 1.0]
}

View File

@@ -0,0 +1,32 @@
{
"identifier": "generic02",
"skyboxGradColourMap": "generic_skybox.tga",
"daylightClut": "clut_daylight.tga",
"classification": "generic2",
"cloudChance": 800,
"cloudGamma": [0.8, 2.4],
"cloudGammaVariance": [0.125, 0.0],
"windSpeed": 0.35,
"windSpeedVariance": 0.4,
"windSpeedDamping": 0.5,
"clouds": {
"cumulonimbus": {
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.02,
"baseScale": 4.0, "scaleVariance": 0.3333333,
"altLow": 1080, "altHigh": 1120
},
"cumulus": {
"filename": "cloud_normal.png", "tw": 1024, "th": 512, "probability": 0.05,
"baseScale": 2.0, "scaleVariance": 0.6,
"altLow": 1080, "altHigh": 1800
},
"altocumulus": {
"filename": "cloud_normal.png", "tw": 1024, "th": 512, "probability": 1.0,
"baseScale": 1.0, "scaleVariance": 0.1,
"altLow": 2600, "altHigh": 3400
}
},
"atmoTurbidity": 3.5,
"shaderVibrancy": [1.0, 1.0],
"__comment__": "Make a texture for altocumulus so that this weather can be realised with less than 1000 sprites"
}

View File

@@ -1,27 +1,31 @@
{
"identifier": "overcast01",
"skyboxGradColourMap": "generic_skybox.tga",
"daylightClut": "clut_daylight.tga",
"classification": "overcast",
"cloudChance": 300,
"cloudGamma": [2.2, 2.0],
"cloudGammaVariance": [0.1, 0.1],
"cloudGamma": [2.0, 1.6],
"cloudGammaVariance": [0.0, 0.0],
"windSpeed": 10.45,
"windSpeedVariance": 1.0,
"windSpeedVariance": 0.5,
"windSpeedDamping": 0.5,
"clouds": {
"cumulus": {
"filename": "cloud_normal.png", "tw": 1024, "th": 512, "probability": 0.1,
"baseScale": 0.8, "scaleVariance": 0.6,
"altLow": 80, "altHigh": 800
"baseScale": 1.6, "scaleVariance": 0.6,
"altLow": 580, "altHigh": 1300
},
"cumulonimbus": {
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.4,
"baseScale": 2.0, "scaleVariance": 0.3333333,
"altLow": 90, "altHigh": 120
"baseScale": 4.0, "scaleVariance": 0.3333333,
"altLow": 1080, "altHigh":1800
},
"nimbostratus": {
"filename": "cloud_wide.png", "tw": 4096, "th": 1024, "probability": 1.0,
"baseScale": 4.0, "scaleVariance": 0.1,
"altLow": 100, "altHigh": 100
"baseScale": 8.0, "scaleVariance": 0.1,
"altLow": 1100, "altHigh": 1500
}
}
},
"atmoTurbidity": 9.5,
"shaderVibrancy": [0.93, 0.9]
}

Binary file not shown.

View File

@@ -6,6 +6,8 @@ APPIMAGETOOL="appimagetool-x86_64.AppImage"
SRCFILES="terrarumlinux_arm"
DESTDIR="TerrarumLinux.arm"
RUNTIME="runtime-linux-arm"
DESKTOPFILE="../out/build_autogen_linux.desktop"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -18,7 +20,7 @@ mkdir $DESTDIR
# Prepare an application
cp icns.png $DESTDIR/icns.png
cp $SRCFILES/Terrarum.desktop $DESTDIR/
cp $DESKTOPFILE $DESTDIR/
cp $SRCFILES/AppRun $DESTDIR/AppRun
chmod +x $DESTDIR/AppRun
@@ -30,7 +32,7 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/Terrarum
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/
mv $DESTDIR/assets_release $DESTDIR/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
cp "../out/$JARNAME" $DESTDIR/out/
# Pack everything to AppImage
ARCH=arm_aarch64 "./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }

View File

@@ -6,6 +6,8 @@ APPIMAGETOOL="appimagetool-x86_64.AppImage"
SRCFILES="terrarumlinux_x86"
DESTDIR="TerrarumLinux.x86"
RUNTIME="runtime-linux-x86"
DESKTOPFILE="../out/build_autogen_linux.desktop"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -18,7 +20,7 @@ mkdir $DESTDIR
# Prepare an application
cp icns.png $DESTDIR/icns.png
cp $SRCFILES/Terrarum.desktop $DESTDIR/
cp $DESKTOPFILE $DESTDIR/
cp $SRCFILES/AppRun $DESTDIR/AppRun
chmod +x $DESTDIR/AppRun
@@ -30,7 +32,7 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/Terrarum
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/
mv $DESTDIR/assets_release $DESTDIR/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
cp "../out/$JARNAME" $DESTDIR/out/
# Pack everything to AppImage
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }

View File

@@ -6,6 +6,8 @@ SRCFILES="terrarummac_arm"
APPDIR="./TerrarumMac.arm.app"
DESTDIR="out/$APPDIR"
RUNTIME="runtime-osx-arm"
PLISTFILE="../out/build_autogen_macos_Info.plist"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -21,9 +23,9 @@ mkdir $DESTDIR/Contents/Resources
# Prepare an application
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
cp $PLISTFILE $DESTDIR/Contents/Info.plist
# Copy over a Java runtime
mkdir $DESTDIR/Contents/MacOS/out
@@ -33,8 +35,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/out/
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
# zip everything
cd "out"
rm $APPDIR.zip
7z a -tzip $APPDIR.zip $APPDIR

View File

@@ -6,6 +6,8 @@ SRCFILES="terrarummac_x86"
APPDIR="./TerrarumMac.x86.app"
DESTDIR="out/$APPDIR"
RUNTIME="runtime-osx-x86"
PLISTFILE="../out/build_autogen_macos_Info.plist"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -21,9 +23,9 @@ mkdir $DESTDIR/Contents/Resources
# Prepare an application
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
cp $PLISTFILE $DESTDIR/Contents/Info.plist
# Copy over a Java runtime
mkdir $DESTDIR/Contents/MacOS/out
@@ -33,8 +35,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/out/
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
# zip everything
cd "out"
rm $APPDIR.zip
7z a -tzip $APPDIR.zip $APPDIR

View File

@@ -5,6 +5,8 @@ cd "${0%/*}"
SRCFILES="terrarumwindows_x86"
DESTDIR="TerrarumWindows.x86"
RUNTIME="runtime-windows-x86"
RCFILE="../out/build_autogen_windows.rc"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -21,8 +23,11 @@ then
echo 'Mingw32 not found; please install mingw64-cross-gcc (or similar) to your system' >&2; exit 1;
fi
x86_64-w64-mingw32-gcc -Os -s -o $DESTDIR/Terrarum.exe $SRCFILES/Terrarum.c || { echo 'Building EXE failed' >&2; exit 1; }
# TODO add icon to the exe (use x86_64-w64-mingw32-windres?)
# Compile .rc
x86_64-w64-mingw32-windres $RCFILE -O coff -o $RCFILE.res
# compile exe
x86_64-w64-mingw32-gcc -Os -s -o $DESTDIR/Terrarum.exe $SRCFILES/Terrarum.c $RCFILE.res || { echo 'Building EXE failed' >&2; exit 1; }
# Copy over a Java runtime
mkdir $DESTDIR/out
@@ -32,10 +37,10 @@ mv $DESTDIR/out/$RUNTIME/bin/java.exe $DESTDIR/out/$RUNTIME/bin/Terrarum.exe
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/
mv $DESTDIR/assets_release $DESTDIR/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
cp "../out/$JARNAME" $DESTDIR/out/
# Temporary solution: zip everything
rm "out/TerrarumWindows.x86.zip"
zip -r -9 -l "out/TerrarumWindows.x86.zip" $DESTDIR
# zip everything
rm "out/$DESTDIR.zip"
zip -r -9 -l "out/$DESTDIR.zip" $DESTDIR
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"

BIN
buildapp/icns.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -39,34 +39,20 @@ To build, **cd into the "(project root)/buildapp/", then execute the appropriate
The packaged application can be found on `(project root)/buildapp/out/`
#### OSX .app Packaging
```
Terrarum.*.app
+.icns /* 512x512 PNG */
+Contents
`Info.plist
+MacOS
`start_game_mac_*.sh * permission: +x */
```
`assets/TerrarumBuild.jar` is the artifact built using the TerrarumBuild.
`start_game_*` files are on the root directory of the project; use them to build executable apps.
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
Details: https://gist.github.com/jamieweavis/b4c394607641e1280d447deed5fc85fc
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
It might be possible to create .icns on Linux, haven't tried though. https://dentrassi.de/2014/02/25/creating-mac-os-x-icons-icns-on-linux/
#### Some Notes
### Windows .ico creation
0. Open up the icon (png) file using GIMP
1. Export As... -> *.ico, make sure to select either of 24 bpp (1 bit alpha) or 32 bpp (8 bit alpha)
- Windows EXE creation is not there yet. Maybe use one of [these?](https://sourceforge.net/projects/batch-compiler/)
### Notes to Terrarum Programmers

View File

@@ -24,5 +24,13 @@ rm $DESTDIR/mods/basegame/weathers/*.kra
rm -r $DESTDIR/mods/basegame/sounds
rm -r $DESTDIR/mods/dwarventech
for s in .directory .DS_Store Thumbs.db thumbs.db; do
rm $DESTDIR/$s
rm $DESTDIR/*/$s
rm $DESTDIR/*/*/$s
rm $DESTDIR/*/*/*/$s
rm $DESTDIR/*/*/*/*/$s
rm $DESTDIR/*/*/*/*/*/$s
rm $DESTDIR/*/*/*/*/*/*/$s
rm $DESTDIR/*/*/*/*/*/*/*/$s
done

View File

@@ -1,6 +0,0 @@
[Desktop Entry]
Name=Terrarum
Exec=AppRun
Icon=icns
Type=Application
Categories=Game;

View File

@@ -1,6 +0,0 @@
[Desktop Entry]
Name=Terrarum
Exec=AppRun
Icon=icns
Type=Application
Categories=Game;

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<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

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<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>

Binary file not shown.

Binary file not shown.

BIN
lib/commons-math3-3.6.1.jar LFS Normal file

Binary file not shown.

View File

@@ -41,7 +41,7 @@ public class Float16FrameBuffer extends FrameBuffer {
}
else {
FloatFrameBufferBuilder bufferBuilder = new FloatFrameBufferBuilder(width, height);
bufferBuilder.addFloatAttachment(GL30.GL_RGBA16F, GL30.GL_RGBA, GL30.GL_FLOAT, false); // FIXME sporadic black screen on GL_RGBA16F? or maybe it was Plasma bugging out?
bufferBuilder.addFloatAttachment(GL30.GL_RGBA16F, GL30.GL_RGBA, GL30.GL_FLOAT, false);
if (hasDepth) bufferBuilder.addBasicDepthRenderBuffer();
this.bufferBuilder = bufferBuilder;
}

View File

@@ -34,6 +34,10 @@ abstract class SpriteAnimation(@Transient val parentActor: ActorWithBody) : Disp
/**
* This class should not be serialised; save its Animation Description Language instead.
*
* Maximum rows: 64
*
* Maximum frames: unlimited
*/
class SheetSpriteAnimation(parentActor: ActorWithBody) : SpriteAnimation(parentActor) {

View File

@@ -26,6 +26,7 @@ import net.torvald.terrarum.gamecontroller.KeyToggler;
import net.torvald.terrarum.gamecontroller.TerrarumKeyboardEvent;
import net.torvald.terrarum.gameitems.GameItem;
import net.torvald.terrarum.gameworld.GameWorld;
import net.torvald.terrarum.imagefont.BigAlphNum;
import net.torvald.terrarum.imagefont.TinyAlphNum;
import net.torvald.terrarum.langpack.Lang;
import net.torvald.terrarum.modulebasegame.IngameRenderer;
@@ -198,6 +199,7 @@ public class App implements ApplicationListener {
/** Big interchar */
public static TerrarumSansBitmap fontUITitle;
public static TinyAlphNum fontSmallNumbers;
public static BigAlphNum fontBigNumbers;
/** A gamepad. Multiple gamepads may controll this single virtualised gamepad. */
public static TerrarumController gamepad = null;
@@ -828,6 +830,7 @@ public class App implements ApplicationListener {
fontGame.dispose();
fontGameFBO.dispose();
fontSmallNumbers.dispose();
fontBigNumbers.dispose();
ItemSlotImageFactory.INSTANCE.dispose();
logo.getTexture().dispose();
@@ -906,6 +909,7 @@ public class App implements ApplicationListener {
currentScreen.show();
currentScreen.resize(scr.getWidth(), scr.getHeight());
TerrarumGlobalState.INSTANCE.getHAS_KEYBOARD_INPUT_FOCUS().unset();
System.gc();
@@ -1007,6 +1011,7 @@ public class App implements ApplicationListener {
fontSmallNumbers = TinyAlphNum.INSTANCE;
fontBigNumbers = BigAlphNum.INSTANCE;
IME.invoke();
inputStrober = InputStrober.INSTANCE;
@@ -1185,6 +1190,8 @@ public class App implements ApplicationListener {
public static String configDir;
/** defaultDir + "/LoadOrder.txt" */
public static String loadOrderDir;
/** defaultDir + "/Imported" */
public static String importDir;
public static RunningEnvironment environment;
@@ -1224,6 +1231,7 @@ public class App implements ApplicationListener {
loadOrderDir = defaultDir + "/LoadOrder.txt";
recycledPlayersDir = defaultDir + "/Recycled/Players";
recycledWorldsDir = defaultDir + "/Recycled/Worlds";
importDir = defaultDir + "/Imports";
System.out.println(String.format("os.name = %s (with identifier %s)", OSName, operationSystem));
System.out.println(String.format("os.version = %s", OSVersion));
@@ -1239,6 +1247,7 @@ public class App implements ApplicationListener {
new File(worldsDir),
new File(recycledPlayersDir),
new File(recycledWorldsDir),
new File(importDir)
};
for (File it : dirs) {

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum
import com.badlogic.gdx.Input
import com.badlogic.gdx.utils.Disposable
import com.badlogic.gdx.utils.GdxRuntimeException
import net.torvald.terrarum.App.printdbg
@@ -9,6 +10,7 @@ import net.torvald.terrarum.gameactors.ActorID
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.PHYS_EPSILON_DIST
import net.torvald.terrarum.gameactors.BlockMarkerActor
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gamecontroller.TerrarumKeyboardEvent
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.gameworld.GameWorld
@@ -165,6 +167,9 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
override fun show() {
// the very basic show() implementation
for (k in Input.Keys.F1..Input.Keys.F12) {
KeyToggler.forceSet(k, false)
}
// add blockmarking_actor into the actorlist
(CommonResourcePool.get("blockmarking_actor") as BlockMarkerActor).let {

View File

@@ -2,11 +2,13 @@ package net.torvald.terrarum
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.utils.JsonValue
import net.torvald.terrarum.App.*
import net.torvald.terrarum.App.setToGameConfig
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.WireCodex
import net.torvald.terrarum.gamecontroller.IME
import net.torvald.terrarum.gameitems.GameItem
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.itemproperties.ItemCodex
@@ -15,6 +17,7 @@ import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.utils.CSVFetcher
import net.torvald.terrarum.utils.JsonFetcher
import net.torvald.terrarum.utils.forEachSiblings
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.csv.CSVFormat
import org.apache.commons.csv.CSVParser
@@ -211,6 +214,18 @@ object ModMgr {
GameRetextureLoader(moduleName)
}
// add locales if exists
if (hasFile(moduleName, "locales")) {
printdbg(this, "Trying to load Locales on ${moduleName}")
GameLanguageLoader(moduleName)
}
// add keylayouts if exists
if (hasFile(moduleName, "keylayout")) {
printdbg(this, "Trying to load Keyboard Layouts on ${moduleName}")
GameIMELoader(moduleName)
}
// run entry script in entry point
if (entryPoint.isNotBlank()) {
var newClass: Class<*>? = null
@@ -513,6 +528,56 @@ object ModMgr {
}
}
object GameIMELoader {
const val keebPath = "keylayout/"
@JvmStatic operator fun invoke(module: String) {
val FILE = getFile(module, keebPath)
FILE.listFiles { file, s -> s.endsWith(".${IME.KEYLAYOUT_EXTENSION}") }.sortedBy { it.name }.forEach {
printdbg(this, "Registering Low layer ${it.nameWithoutExtension.lowercase()}")
IME.registerLowLayer(it.nameWithoutExtension.lowercase(), IME.parseKeylayoutFile(it))
}
FILE.listFiles { file, s -> s.endsWith(".${IME.IME_EXTENSION}") }.sortedBy { it.name }.forEach {
printdbg(this, "Registering High layer ${it.nameWithoutExtension.lowercase()}")
IME.registerHighLayer(it.nameWithoutExtension.lowercase(), IME.parseImeFile(it))
}
val iconFile = getFile(module, keebPath + "icons.tga").let {
if (it.exists()) it else getFile(module, keebPath + "icons.png")
}
if (iconFile.exists()) {
val iconSheet = TextureRegionPack(iconFile.path, 20, 20)
val iconPixmap = Pixmap(Gdx.files.absolute(iconFile.path))
for (k in 0 until iconPixmap.height step 20) {
val langCode = StringBuilder()
for (c in 0 until 20) {
val x = c
var charnum = 0
for (b in 0 until 7) {
val y = k + b
if (iconPixmap.getPixel(x, y) and 255 != 0) {
charnum = charnum or (1 shl b)
}
}
if (charnum != 0) langCode.append(charnum.toChar())
}
if (langCode.isNotEmpty()) {
printdbg(this, "Icon order #${(k+1) / 20} - icons[\"$langCode\"] = iconSheet.get(1, ${k/20})")
IME.icons["$langCode"] = iconSheet.get(1, k / 20).also { it.flip(false, false) }
}
}
App.disposables.add(iconSheet)
iconPixmap.dispose()
}
}
}
object GameMaterialLoader {
const val matePath = "materials/"

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
import net.torvald.terrarum.ui.UICanvas
@@ -17,7 +18,7 @@ class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
override fun updateUI(delta: Float) {
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
}
override fun dispose() {

View File

@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.utils.OpenFile
import java.awt.Desktop
import java.io.File
@@ -90,7 +91,7 @@ class NoModuleDefaultTitlescreen(batch: FlippingSpriteBatch) : IngameInstance(ba
App.scr.hf - Gdx.input.y in pathButtonY - 12..pathButtonY + pathButtonH + 12)
if (mouseOnLink && Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) {
Desktop.getDesktop().open(pathFile)
OpenFile(pathFile)
}
fbatch.inUse {

View File

@@ -122,4 +122,6 @@ class Point2i() {
operator fun component1() = x
operator fun component2() = y
fun toVector() = Vector2(this.x.toDouble(), this.y.toDouble())
}

View File

@@ -0,0 +1,72 @@
package net.torvald.terrarum
import java.io.File
/**
* Created by minjaesong on 2023-08-25.
*/
private fun writeWindowsRC(major: Int, minor: Int, patch: Int) {
val s = """1 ICON "icns.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION $major,$minor,$patch,0
PRODUCTVERSION $major,$minor,$patch,0
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "FileDescription", "${TerrarumAppConfiguration.GAME_NAME}\0"
VALUE "FileVersion", "${App.getVERSION_STRING()}\0"
VALUE "LegalCopyright", "${TerrarumAppConfiguration.COPYRIGHT_DATE_NAME}\0"
VALUE "OriginalFilename", "${TerrarumAppConfiguration.GAME_NAME}.exe\0"
VALUE "ProductName", "${TerrarumAppConfiguration.GAME_NAME}\0"
VALUE "ProductVersion", "${App.getVERSION_STRING()}\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}"""
val f = File("./out/build_autogen_windows.rc")
f.delete()
f.writeText(s)
}
private fun writeOSXPlist(major: Int, minor: Int, patch: Int) {
val s = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>CFBundleExecutable</key><string>${TerrarumAppConfiguration.GAME_NAME}.sh</string>
<key>CFBundleDisplayName</key><string>${TerrarumAppConfiguration.GAME_NAME}</string>
<key>CFBundleName</key><string>${TerrarumAppConfiguration.GAME_NAME}</string>
<key>CFBundleIconFile</key><string>AppIcon.icns</string>
<key>CFBundleVersion</key><string>${App.getVERSION_STRING()}</string>
</dict></plist>"""
val f = File("./out/build_autogen_macos_Info.plist")
f.delete()
f.writeText(s)
}
private fun writeLinuxDesktop(major: Int, minor: Int, patch: Int) {
val s = """[Desktop Entry]
Name=${TerrarumAppConfiguration.GAME_NAME}
Exec=AppRun
Icon=icns
Type=Application
Categories=Game;"""
val f = File("./out/build_autogen_linux.desktop")
f.delete()
f.writeText(s)
}
fun main() {
val major = (App.VERSION_RAW ushr 48).toInt()
val minor = ((App.VERSION_RAW and 0xffff000000L) ushr 24).toInt()
val patch = (App.VERSION_RAW and 0xffffffL).toInt()
writeLinuxDesktop(major, minor, patch)
writeOSXPlist(major, minor, patch)
writeWindowsRC(major, minor, patch)
}

View File

@@ -7,7 +7,7 @@ internal interface RNGConsumer {
val RNG: HQRNG
fun loadFromSave(s0: Long, s1: Long) {
fun loadFromSave(ingame: IngameInstance, s0: Long, s1: Long) {
RNG.setSeed(s0, s1)
}

View File

@@ -167,8 +167,10 @@ class SavegameCollectionPair(private val player: SavegameCollection?, private va
// private var autoPlayer: DiskSkimmer? = null
// private var autoWorld: DiskSkimmer? = null
var isImported: Boolean = false; private set
/* removing auto/manual discrimination: on Local Asynchronous Multiplayer, if newer autosave is available, there is
* no choice but loading one to preserve the data; then why bother having two? */
* no choice but loading one to preserve the data; then why bother having two? */
private var playerDisk: DiskSkimmer? = null; private set
private var worldDisk: DiskSkimmer? = null; private set
@@ -221,6 +223,10 @@ class SavegameCollectionPair(private val player: SavegameCollection?, private va
2
else (player != null && world != null).toInt()
if (player != null) {
isImported = (player.loadable().getSaveOrigin() and VDSaveOrigin.IMPORTED != 0)
}
printdbg(this, "playerDisk = ${playerDisk?.diskFile?.path}")
printdbg(this, "worldDisk = ${worldDisk?.diskFile?.path}")
printdbg(this, "status = $status")
@@ -341,6 +347,22 @@ class SavegameCollectionPair(private val player: SavegameCollection?, private va
return if (status == 0) null
else DiskPair(playerDisk!!, worldDisk!!)
}
fun getImportedPlayer(): DiskSkimmer? {
return if (isImported) player!!.loadable() else null
}
fun getPlayerThumbnailPixmap(width: Int, height: Int, shrinkage: Double): Pixmap? {
return player?.loadable()?.getThumbnailPixmap(width, height, shrinkage)?.let {
if (it.isDisposed) null else it
}
}
fun getWorldThumbnailPixmap(width: Int, height: Int, shrinkage: Double): Pixmap? {
return world?.loadable()?.getThumbnailPixmap(width, height, shrinkage)?.let {
if (it.isDisposed) null else it
}
}
}
data class DiskPair(val player: DiskSkimmer, val world: DiskSkimmer) {

View File

@@ -813,8 +813,8 @@ fun AppUpdateListOfSavegames() {
// if multiple valid savegames with same UUID exist, only the most recent one is retained
if (!App.savegameWorlds.contains(worldUUID)) {
App.savegameWorlds[worldUUID] = collection
App.savegameWorldsName[worldUUID] = it.getDiskName(Common.CHARSET)
App.sortedSavegameWorlds.add(worldUUID)
App.savegameWorldsName[worldUUID] = it.getDiskName(Common.CHARSET)
}
}
@@ -848,8 +848,8 @@ fun AppUpdateListOfSavegames() {
// if multiple valid savegames with same UUID exist, only the most recent one is retained
if (!App.savegamePlayers.contains(playerUUID)) {
App.savegamePlayers[playerUUID] = collection
App.savegamePlayersName[playerUUID] = it.getDiskName(Common.CHARSET)
App.sortedPlayers.add(playerUUID)
App.savegamePlayersName[playerUUID] = it.getDiskName(Common.CHARSET)
}
}

View File

@@ -67,7 +67,7 @@ basegame
// Commit counts up to the Release 0.3.1: 2278
// Commit counts up to the Release 0.3.2: 2732
const val VERSION_TAG: String = "test002"
const val VERSION_TAG: String = "test003"
//////////////////////////////////////////////////////////
// CONFIGURATION FOR TILE MAKER //

View File

@@ -0,0 +1,25 @@
package net.torvald.terrarum
/**
* Created by minjaesong on 2023-09-05.
*/
object TerrarumGlobalState {
val HAS_KEYBOARD_INPUT_FOCUS = CountedBool()
}
class CountedBool {
private var counter = 0L
fun set() {
counter += 1
}
fun unset() {
if (counter >= 1) counter -= 1
}
val value: Boolean
get() = counter > 0
fun isOn() = value
fun isOff() = !value
}

View File

@@ -13,6 +13,7 @@ import net.torvald.terrarum.App.IS_DEVELOPMENT_BUILD
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.ui.BasicDebugInfoWindow
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.weather.WeatherMixer
/**
* Must be called by the App Loader
@@ -236,6 +237,13 @@ object TerrarumPostProcessor : Disposable {
else
shaderPostNoDither
val (vo, vg) = INGAME.world.weatherbox.let {
if (it.currentWeather.identifier == "titlescreen")
1f to 1f
else
it.currentVibrancy.x to it.currentVibrancy.y
}
App.getCurrentDitherTex().bind(1)
fbo.colorBufferTexture.bind(0)
@@ -245,6 +253,7 @@ object TerrarumPostProcessor : Disposable {
shader.setUniformi("rnd", rng.nextInt(8192), rng.nextInt(8192))
shader.setUniformi("u_pattern", 1)
shader.setUniformf("quant", shaderQuant[App.getConfigInt("displaycolourdepth")] ?: 255f)
shader.setUniformf("vibrancy", 1f, vo, vg, 1f)
shader.setUniformMatrix4fv("swizzler", swizzler, rng.nextInt(24), 16*4)
App.fullscreenQuad.render(shader, GL20.GL_TRIANGLES)

View File

@@ -35,7 +35,7 @@ class UIFakeGradOverlay : UICanvas() {
}
override fun updateUI(delta: Float) {}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
batch.end()
val dither = App.getConfigBoolean("fx_dither")
@@ -84,7 +84,7 @@ class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas
private val batchDrawCol = Color(-1)
override fun updateUI(delta: Float) {}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
batchDrawCol.a = openness
batch.color = batchDrawCol
if (App.getConfigBoolean("fx_backgroundblur")) {

View File

@@ -1,9 +1,6 @@
package net.torvald.terrarum
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.gameitems.GameItem
import net.torvald.terrarum.langpack.Lang
@@ -271,7 +268,7 @@ class UIItemInventoryCatBar(
}
}
override fun render(batch: SpriteBatch, camera: Camera) {
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
super.render(batch, camera)
// button

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.terrarum.gameitems.GameItem
@@ -53,7 +54,7 @@ class UIItemInventoryElemSimple(
private var highlightToMainCol = false
private var highlightToSubCol = false
override fun render(batch: SpriteBatch, camera: Camera) {
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch)
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.terrarum.gameitems.GameItem
@@ -78,7 +79,7 @@ class UIItemInventoryElemWide(
var textHighlightMouseUpCol = Toolkit.Theme.COL_MOUSE_UP
var textHighlightNormalCol = Color.WHITE
override fun render(batch: SpriteBatch, camera: Camera) {
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
blendNormalStraightAlpha(batch)
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted

View File

@@ -146,7 +146,10 @@ class BlockCodex {
}
try {
return blockProps[blockID]!!
return if (blockID.startsWith("wall@"))
blockProps[blockID.substring(5)]!!
else
blockProps[blockID]!!
}
catch (e: NullPointerException) {
throw NullPointerException("Blockprop with id $blockID does not exist.")

View File

@@ -13,7 +13,7 @@ import net.torvald.terrarum.weather.WeatherMixer
*/
object BlockPropUtil {
//var flickerFuncX: Second = 0f // saves current status (time) of func
val flickerFuncDomain: Second = 0.06f // time between two noise sample
val flickerFuncDomain: Second = 8f/64f // time between two noise sample
val flickerFuncRange = 0.036f // intensity [0, 1]
//var breathFuncX = 0f
@@ -50,7 +50,7 @@ object BlockPropUtil {
/**
* Using our own timer so that they flickers for same duration regardless of game's FPS
* Must be using ConsistentUpdateRate update governor
*/
internal fun dynamicLumFuncTickClock() {
@@ -80,7 +80,7 @@ object BlockPropUtil {
// FPS-time compensation
if (Gdx.graphics.framesPerSecond > 0) {
prop.rngBase0 += Gdx.graphics.deltaTime
prop.rngBase0 += App.UPDATE_RATE
}
// reset timer
@@ -108,7 +108,7 @@ object BlockPropUtil {
return when (prop.dynamicLuminosityFunction) {
1 -> getTorchFlicker(prop)
2 -> (INGAME.world).globalLight.cpy() // current global light
3 -> WeatherMixer.getGlobalLightOfTimeOfNoon().cpy() // daylight at noon
3 -> WeatherMixer.getGlobalLightOfTimeOfNoon(WeatherMixer.weatherDict["generic01"]!!).cpy() // daylight at noon
4 -> getSlowBreath(prop)
5 -> getPulsate(prop)
else -> prop.baseLumCol

View File

@@ -74,9 +74,9 @@ fun main() {
// println("$yp\t$theta")
val xyz = CIEXYZ(
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, (gammaPair * 2f + 1f) * HALF_PI, 0).toFloat(),
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, (gammaPair * 2f + 1f) * HALF_PI, 1).toFloat(),
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, (gammaPair * 2f + 1f) * HALF_PI, 2).toFloat()
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, HALF_PI, 0).toFloat(),
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, HALF_PI, 1).toFloat(),
ArHosekSkyModel.arhosek_tristim_skymodel_radiance(state, theta, HALF_PI, 2).toFloat()
)
val xyz2 = xyz.scaleToFit(elevationDeg)
val rgb = xyz2.toRGB().toColor()

View File

@@ -60,17 +60,27 @@ object Skybox : Disposable {
data class SkyboxRenderInfo(
val texture: Texture,
val uvs: FloatArray,
val turbidityPoint: Float,
val albedoPoint: Float,
val turbidityThisBlend: Float,
val albedoThisBlend: Float,
val turbidityOldBlend: Float,
val albedoOldBlend: Float,
)
fun getUV(elevationDeg: Double, turbidity: Double, albedo: Double): SkyboxRenderInfo {
val turb = turbidity.coerceIn(turbiditiesD.first(), turbiditiesD.last()).minus(1.0).times(turbDivisor)
val turbLo = turb.floorToInt()
val turbHi = min(turbCnt - 1, turbLo + 1)
val alb = albedo.coerceIn(albedos.first(), albedos.last()).times(5.0)
val albLo = alb.floorToInt()
val albHi = min(albedoCnt - 1, albLo + 1)
fun getUV(elevationDeg: Double, oldTurbidity: Double, oldAlbedo: Double, thisTurbidity: Double, thisAlbedo: Double): SkyboxRenderInfo {
val turb2 = thisTurbidity.coerceIn(turbiditiesD.first(), turbiditiesD.last()).minus(1.0).times(turbDivisor)
val turb2Lo = turb2.floorToInt()
val turb2Hi = min(turbCnt - 1, turb2Lo + 1)
val alb2 = thisAlbedo.coerceIn(albedos.first(), albedos.last()).times(5.0)
val alb2Lo = alb2.floorToInt()
val alb2Hi = min(albedoCnt - 1, alb2Lo + 1)
val turb1 = oldTurbidity.coerceIn(turbiditiesD.first(), turbiditiesD.last()).minus(1.0).times(turbDivisor)
val turb1Lo = turb1.floorToInt()
val turb1Hi = min(turbCnt - 1, turb1Lo + 1)
val alb1 = oldAlbedo.coerceIn(albedos.first(), albedos.last()).times(5.0)
val alb1Lo = alb1.floorToInt()
val alb1Hi = min(albedoCnt - 1, alb1Lo + 1)
val elev = elevationDeg.coerceIn(-elevMax, elevMax).plus(elevMax).div(elevations.last.toDouble()).div(albedoCnt * 2).times((elevCnt - 1.0) / elevCnt)
// A: morn, turbLow, albLow
@@ -82,14 +92,14 @@ object Skybox : Disposable {
// G: morn, turbHigh, albHigh
// H: noon, turbHigh, albHigh
val regionA = texStripRegions.get(albLo + albedoCnt * 0, turbLo)
val regionB = texStripRegions.get(albLo + albedoCnt * 1, turbLo)
val regionC = texStripRegions.get(albLo + albedoCnt * 0, turbHi)
val regionD = texStripRegions.get(albLo + albedoCnt * 1, turbHi)
val regionE = texStripRegions.get(albHi + albedoCnt * 0, turbLo)
val regionF = texStripRegions.get(albHi + albedoCnt * 1, turbLo)
val regionG = texStripRegions.get(albHi + albedoCnt * 0, turbHi)
val regionH = texStripRegions.get(albHi + albedoCnt * 1, turbHi)
val regionA = texStripRegions.get(alb1Lo, turb1Lo)
val regionB = texStripRegions.get(alb2Lo, turb2Lo)
val regionC = texStripRegions.get(alb1Lo, turb1Hi)
val regionD = texStripRegions.get(alb2Lo, turb2Hi)
val regionE = texStripRegions.get(alb1Hi, turb1Lo)
val regionF = texStripRegions.get(alb2Hi, turb2Lo)
val regionG = texStripRegions.get(alb1Hi, turb1Hi)
val regionH = texStripRegions.get(alb2Hi, turb2Hi)
// (0.5f / tex.width): because of the nature of bilinear interpolation, half pixels from the edges must be discarded
val uA = regionA.u + (0.5f / tex.width) + elev.toFloat()
val uB = regionB.u + (0.5f / tex.width) + elev.toFloat()
@@ -112,8 +122,10 @@ object Skybox : Disposable {
uG, regionG.v, uG, regionG.v2,
uH, regionH.v, uH, regionH.v2,
),
(turb - turbLo).toFloat(),
(alb - albLo).toFloat(),
(turb2 - turb2Lo).toFloat(),
(alb2 - alb2Lo).toFloat(),
(turb1 - turb1Lo).toFloat(),
(alb1 - alb1Lo).toFloat(),
)
}
@@ -152,7 +164,7 @@ object Skybox : Disposable {
val elevations = (0..150)
val elevMax = elevations.last / 2.0
val elevationsD = elevations.map { -elevMax + it } // -75, -74, -73, ..., 74, 75 // (specifically using whole number of angles because angle units any finer than 1.0 would make "hack" sunsut happen too fast)
val turbidities = (0..25) // 1, 1.2, 1.4, 1.6, ..., 6.0
val turbidities = (0..45) // 1, 1.2, 1.4, 1.6, ..., 10.0
val turbDivisor = 5.0
val turbiditiesD = turbidities.map { 1.0 + it / turbDivisor }
val albedos = arrayOf(0.0, 0.2, 0.4, 0.6, 0.8, 1.0)

View File

@@ -891,15 +891,15 @@ open class ActorWithBody : Actor {
// points to the EDGE of the tile in world dimension (don't use this directly to get tilewise coord!!)
val offendingTileWorldX = if (selfCollisionStatus in listOf(6, 12))
newHitbox.endX.div(TILE_SIZE).floorToDouble() * TILE_SIZE - PHYS_EPSILON_DIST
newHitbox.endX.div(TILE_SIZE).floorToDouble() * TILE_SIZE - PHYS_EPSILON_DIST // adding/subbing fixes a bug where player stops midair when L/R is held and moving down from the platform
else
newHitbox.startX.div(TILE_SIZE).ceilToDouble() * TILE_SIZE
newHitbox.startX.div(TILE_SIZE).ceilToDouble() * TILE_SIZE + PHYS_EPSILON_DIST // adding/subbing fixes a bug where player stops midair when L/R is held and moving down from the platform
// points to the EDGE of the tile in world dimension (don't use this directly to get tilewise coord!!)
val offendingTileWorldY = if (selfCollisionStatus in listOf(3, 6))
newHitbox.endY.div(TILE_SIZE).floorToDouble() * TILE_SIZE - PHYS_EPSILON_DIST
newHitbox.endY.div(TILE_SIZE).floorToDouble() * TILE_SIZE - PHYS_EPSILON_DIST // adding/subbing fixes a bug where player stops midair when L/R is held and moving down from the platform
else
newHitbox.startY.div(TILE_SIZE).ceilToDouble() * TILE_SIZE
newHitbox.startY.div(TILE_SIZE).ceilToDouble() * TILE_SIZE + PHYS_EPSILON_DIST // adding/subbing fixes a bug where player stops midair when L/R is held and moving down from the platform
val offendingHitboxPointX = if (selfCollisionStatus in listOf(6, 12))
newHitbox.endX
@@ -1108,6 +1108,7 @@ open class ActorWithBody : Actor {
}
private fun Hitbox.getWallDetection(option: Int): List<Double> {
val SOME_PIXEL = 1.0 // it really does NOT work if the value is not 1.0
val x1: Double
val x2: Double
val y1: Double
@@ -1116,23 +1117,23 @@ open class ActorWithBody : Actor {
COLLIDING_TOP -> {
x1 = this.startX
x2 = this.endX - PHYS_EPSILON_DIST
y1 = this.startY - A_PIXEL
y1 = this.startY - SOME_PIXEL
y2 = y1
}
COLLIDING_BOTTOM -> {
x1 = this.startX
x2 = this.endX - PHYS_EPSILON_DIST
y1 = this.endY - PHYS_EPSILON_DIST + A_PIXEL
y1 = this.endY - PHYS_EPSILON_DIST + SOME_PIXEL
y2 = y1
}
COLLIDING_LEFT -> {
x1 = this.startX - A_PIXEL
x1 = this.startX - SOME_PIXEL
x2 = x1
y1 = this.startY
y2 = this.endY - PHYS_EPSILON_DIST
}
COLLIDING_RIGHT -> {
x1 = this.endX - PHYS_EPSILON_DIST + A_PIXEL
x1 = this.endX - PHYS_EPSILON_DIST + SOME_PIXEL
x2 = x1
y1 = this.startY
y2 = this.endY - PHYS_EPSILON_DIST
@@ -1242,6 +1243,8 @@ open class ActorWithBody : Actor {
private fun isCollidingInternalStairs(pxStart: Int, pyStart: Int, pxEnd: Int, pyEnd: Int, feet: Boolean = false): Pair<Int, Int> {
if (world == null) return 0 to 0
val cornerSize = minOf((pyEnd - pyStart) / 3, (pxEnd - pyStart) / 3)
val ys = if (gravitation.y >= 0) pyEnd downTo pyStart else pyStart..pyEnd
val yheight = (ys.last - ys.first).absoluteValue
var stairHeight = 0
@@ -1260,7 +1263,19 @@ open class ActorWithBody : Actor {
val isFeetTileHeight = (ty == feetY)
var hasFloor = false
for (x in pxStart..pxEnd) {
// octagonal shape
val xs = /*if (y < cornerSize) {
val sub = cornerSize - y
(pxStart + sub)..(pxEnd - sub)
}
else if (y > pyEnd - cornerSize) {
val sub = y - (pyEnd - cornerSize)
(pxStart + sub)..(pxEnd - sub)
}
else*/
pxStart..pxEnd
for (x in xs) {
val tx = (x / TILE_SIZED).floorToInt() // round down toward negative infinity
val tile = world!!.getTileFromTerrain(tx, ty)

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.gameactors
import com.jme3.math.FastMath
import net.torvald.terrarum.Point2d
import net.torvald.terrarum.printStackTrace
import org.dyn4j.geometry.Vector2
@@ -190,6 +191,15 @@ class Hitbox {
companion object {
fun fromTwoPoints(x1: Double, y1: Double, x2: Double, y2: Double, nowarn: Boolean = false) =
Hitbox(x1, y1, x2 - x1, y2 - y1, nowarn)
fun lerp(fraction: Double, a: Hitbox, b: Hitbox): Hitbox {
return Hitbox(
FastMath.interpolateLinear(fraction, a.startX, b.startX),
FastMath.interpolateLinear(fraction, a.startY, b.startY),
FastMath.interpolateLinear(fraction, a.width, b.width),
FastMath.interpolateLinear(fraction, a.height, b.height)
)
}
}
operator fun minus(other: Hitbox): Vector2 {

View File

@@ -97,12 +97,12 @@ object IME {
File(KEYLAYOUT_DIR).listFiles { file, s -> s.endsWith(".$KEYLAYOUT_EXTENSION") }.sortedBy { it.name }.forEach {
printdbg(this, "Registering Low layer ${it.nameWithoutExtension.lowercase()}")
lowLayers[it.nameWithoutExtension.lowercase()] = parseKeylayoutFile(it)
registerLowLayer(it.nameWithoutExtension.lowercase(), parseKeylayoutFile(it))
}
File(KEYLAYOUT_DIR).listFiles { file, s -> s.endsWith(".$IME_EXTENSION") }.sortedBy { it.name }.forEach {
printdbg(this, "Registering High layer ${it.nameWithoutExtension.lowercase()}")
highLayers[it.nameWithoutExtension.lowercase()] = parseImeFile(it)
registerHighLayer(it.nameWithoutExtension.lowercase(), parseImeFile(it))
}
@@ -132,6 +132,14 @@ object IME {
iconPixmap.dispose()
}
fun registerLowLayer(name: String, layout: TerrarumKeyLayout) {
lowLayers[name] = layout
}
fun registerHighLayer(name: String, ime: TerrarumIME) {
highLayers[name] = ime
}
@JvmStatic fun invoke() {}
fun getLowLayerByName(name: String): TerrarumKeyLayout {
@@ -164,7 +172,7 @@ object IME {
else -> throw IllegalArgumentException("Unknown candidates mode: $this")
}
private fun parseKeylayoutFile(file: File): TerrarumKeyLayout {
fun parseKeylayoutFile(file: File): TerrarumKeyLayout {
val src = file.readText(Charsets.UTF_8)
val jsval = context.eval("js", "'use strict';Object.freeze($src)")
val name = jsval.getMember("n").asString()
@@ -200,7 +208,7 @@ object IME {
else -> throw IllegalArgumentException("Unknown operation mode: $this")
}
private fun parseImeFile(file: File): TerrarumIME {
fun parseImeFile(file: File): TerrarumIME {
val code = file.readText(Charsets.UTF_8)
val jsval = context.eval("js", "\"use strict\";(function(){$code})()")
val name = jsval.getMember("n").asString()

View File

@@ -14,6 +14,9 @@ import net.torvald.terrarum.itemproperties.ItemTable
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.utils.*
import net.torvald.terrarum.weather.WeatherMixer
import net.torvald.terrarum.weather.WeatherSchedule
import net.torvald.terrarum.weather.Weatherbox
import net.torvald.util.SortedArrayList
import org.dyn4j.geometry.Vector2
import java.util.*
@@ -84,6 +87,14 @@ open class GameWorld(
/** Tilewise spawn point */
var spawnY: Int = 0
var spawnPoint: Point2i
get() = Point2i(spawnX, spawnY)
set(value) {
spawnX = value.x
spawnY = value.y
}
var portalPoint: Point2i? = null
val wallDamages = HashArray<Float>()
val terrainDamages = HashArray<Float>()
val fluidTypes = HashedFluidType()
@@ -139,6 +150,34 @@ open class GameWorld(
@Deprecated("This value is only used for savegames; DO NOT USE THIS", ReplaceWith("INGAME.actorContainerActive", "net.torvald.terrarum.INGAME"))
internal val actors = ArrayList<ActorID>() // only filled up on save and load; DO NOT USE THIS
var weatherbox = Weatherbox()
init {
weatherbox.initWith(WeatherMixer.weatherDict["generic01"]!!, 3600L)
val currentWeather = weatherbox.currentWeather
// TEST FILL WITH RANDOM VALUES
(0..6).map { WeatherMixer.takeUniformRand(0f..1f) }.let {
weatherbox.windDir.pM2 = it[1]
weatherbox.windDir.pM1 = it[2]
weatherbox.windDir.p0 = it[3]
weatherbox.windDir.p1 = it[4]
weatherbox.windDir.p2 = it[5]
weatherbox.windDir.p3 = it[6]
}
(0..6).map { WeatherMixer.takeUniformRand(-1f..1f) }.let {
val pM3 = currentWeather.getRandomWindSpeed(it[1])
weatherbox.windSpeed.pM2 = currentWeather.getRandomWindSpeed(pM3, it[1])
weatherbox.windSpeed.pM1 = currentWeather.getRandomWindSpeed(weatherbox.windSpeed.pM2, it[2])
weatherbox.windSpeed.p0 = currentWeather.getRandomWindSpeed(weatherbox.windSpeed.pM1, it[3])
weatherbox.windSpeed.p1 = currentWeather.getRandomWindSpeed(weatherbox.windSpeed.p0, it[4])
weatherbox.windSpeed.p2 = currentWeather.getRandomWindSpeed(weatherbox.windSpeed.p1, it[5])
weatherbox.windSpeed.p3 = currentWeather.getRandomWindSpeed(weatherbox.windSpeed.p2, it[6])
}
// the savegame loader will overwrite whatever the initial value we have here
}
/**
* Create new world
*/

View File

@@ -1,6 +1,8 @@
package net.torvald.terrarum.gameworld
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.worldgenerator.HALF_PI
import kotlin.math.PI
import kotlin.math.cos
@@ -56,7 +58,8 @@ import kotlin.math.cos
*/
class WorldTime(initTime: Long = 0L) {
@Transient private val TWO_PI = Math.PI * 2.0
@Transient private val TWO_PI = 6.283185307179586
/** It is not recommended to directly modify the TIME_T. Use provided methods instead. */
var TIME_T = 0L // Epoch: Year 1 Spring 1st, 0h00:00 (Mondag) // 0001-01-01
@@ -122,23 +125,27 @@ class WorldTime(initTime: Long = 0L) {
inline val moonPhase: Double
get() = (TIME_T.plus(700000L) % LUNAR_CYCLE).toDouble() / LUNAR_CYCLE
fun getSolarElevationAt(ordinalDay: Int, second: Int): Double {
val TIME_T = DAY_LENGTH * ordinalDay + second
private fun kos(x: Double) = x.fmod(TWO_PI).let { x ->
if (x < PI) 1.0 - (2.0 * x) / PI
else (2.0 * x) / PI - 3.0
}
fun getSolarElevationAt(TIME_T: Long): Double {
val x = (TIME_T % YEAR_SECONDS).toDouble() / DAY_LENGTH + 15 // decimal days. One full day = 1.0
// 51.56 and 23.44 will make yearly min/max elevation to be 75deg
val d = -23.44 * cos(TWO_PI * x / YEAR_DAYS)
return -51.56 * cos(TWO_PI * x) + d
val d = -23.44 * kos(TWO_PI * x / YEAR_DAYS)
val p = -51.56 * kos(TWO_PI * x)
return d + p
}
fun getSolarElevationAt(ordinalDay: Int, second: Int): Double {
val TIME_T = DAY_LENGTH.toLong() * ordinalDay + second
return getSolarElevationAt(TIME_T)
}
val solarElevationDeg: Double
get() {
val x = (TIME_T % YEAR_SECONDS).toDouble() / DAY_LENGTH + 15 // decimal days. One full day = 1.0
// 51.56 and 23.44 will make yearly min/max elevation to be 75deg
val d = -23.44 * cos(TWO_PI * x / YEAR_DAYS)
val p = -51.56 * cos(TWO_PI * x)
return d + p
}
get() = getSolarElevationAt(TIME_T)
val solarElevationRad: Double
get() = Math.toRadians(solarElevationDeg)
@@ -148,6 +155,17 @@ class WorldTime(initTime: Long = 0L) {
return -23.44 * cos(TWO_PI * x / YEAR_DAYS)
}
/**
* Ecological season, defined as Prevernal, Vernal, Aestival, Serotinal, Autumnal and Hibernal.
*
* @return yearly progress of the six seasons, 0f (inclusve) to 6f (exclusive)
*/
val ecologicalSeason: Float
get() {
val drawTIME_T = TIME_T - (WorldTime.DAY_LENGTH * 10) // offset by -10 days
return (drawTIME_T fmod (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS).toLong()).toFloat() / (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS / 6)
}
@Transient private var realSecAcc: Double = 0.0
@Transient private val REAL_SEC_TO_GAME_SECS = 1.0 / GAME_MIN_TO_REAL_SEC // how slow is real-life clock (second-wise) relative to the ingame one

View File

@@ -0,0 +1,111 @@
package net.torvald.terrarum.imagefont
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.Batch
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.graphics.g2d.GlyphLayout
import net.torvald.terrarum.roundToFloat
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
* Created by minjaesong on 2023-09-03.
*/
object BigAlphNum : BitmapFont() {
internal const val W = 12
internal const val H = 16
internal val fontSheet = TextureRegionPack("./assets/graphics/fonts/code.tga", W, H)
private const val interchar = 1
init {
setOwnsTexture(true)
setUseIntegerPositions(true)
}
fun getWidth(str: String): Int {
var l = 0
for (char in str) {
if (!isColourCodeHigh(char) && !isColourCodeLow(char)) {
l += 1
}
}
return (W + interchar) * l
}
lateinit var colMain: Color
lateinit var colShadow: Color
override fun draw(batch: Batch, text: CharSequence, x: Float, y: Float): GlyphLayout? {
val originalColour = batch.color.cpy()
colMain = batch.color.cpy()
colShadow = colMain.cpy().mul(0.5f, 0.5f, 0.5f, 1f)
val x = x.roundToFloat()
val y = y.roundToFloat()
var charsPrinted = 0
text.forEachIndexed { index, c ->
if (isColourCodeHigh(c)) {
val cchigh = c
val cclow = text[index + 1]
val colour = getColour(cchigh, cclow)
colMain = colour
colShadow = colMain.cpy().mul(0.5f, 0.5f, 0.5f, 1f)
}
else if (c in 0.toChar()..255.toChar()) {
val ccode = c.code - 48
if (ccode in 0..47) {
batch.color = colShadow
batch.draw(fontSheet.get(ccode % 16, ccode / 16), x + charsPrinted * (W + interchar) + 1, y)
batch.draw(fontSheet.get(ccode % 16, ccode / 16), x + charsPrinted * (W + interchar), y + 1)
batch.draw(fontSheet.get(ccode % 16, ccode / 16), x + charsPrinted * (W + interchar) + 1, y + 1)
batch.color = colMain
batch.draw(fontSheet.get(ccode % 16, ccode / 16), x + charsPrinted * (W + interchar), y)
}
charsPrinted += 1
}
}
batch.color = originalColour
return null
}
override fun getLineHeight() = H.toFloat()
override fun getCapHeight() = getLineHeight()
override fun getXHeight() = getLineHeight()
private fun isColourCodeHigh(c: Char) = c.code in 0b110110_1111000000..0b110110_1111111111
private fun isColourCodeLow(c: Char) = c.code in 0b110111_0000000000..0b110111_1111111111
private fun getColour(charHigh: Char, charLow: Char): Color { // input: 0x10ARGB, out: RGBA8888
val codePoint = Character.toCodePoint(charHigh, charLow)
if (colourBuffer.containsKey(codePoint))
return colourBuffer[codePoint]!!
val a = codePoint.and(0xF000).ushr(12)
val r = codePoint.and(0x0F00).ushr(8)
val g = codePoint.and(0x00F0).ushr(4)
val b = codePoint.and(0x000F)
val col = Color(r.shl(28) or r.shl(24) or g.shl(20) or g.shl(16) or b.shl(12) or b.shl(8) or a.shl(4) or a)
colourBuffer[codePoint] = col
return col
}
private val colourBuffer = HashMap<Int, Color>()
}

View File

@@ -12,8 +12,8 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
*/
object TinyAlphNum : BitmapFont() {
internal val W = 7
internal val H = 13
internal const val W = 7
internal const val H = 13
internal val fontSheet = TextureRegionPack("./assets/graphics/fonts/7x13_Tamzen7x14b.tga", W, H)

View File

@@ -302,7 +302,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
IngameRenderer.setRenderedWorld(gameWorld)
WeatherMixer.internalReset()
WeatherMixer.internalReset(this)
}
override fun show() {

View File

@@ -391,8 +391,10 @@ object IngameRenderer : Disposable {
batch.shader = null
batch.color = Color.WHITE
uiContainer?.forEach {
it?.render(batch, camera)
if (!KeyToggler.isOn(Input.Keys.F4)) {
uiContainer?.forEach {
it?.render(batch, camera)
}
}
}

View File

@@ -4,7 +4,9 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import net.torvald.terrarum.*
import net.torvald.terrarum.App.*
import net.torvald.terrarum.Terrarum.getPlayerSaveFiledesc
@@ -12,8 +14,8 @@ import net.torvald.terrarum.Terrarum.getWorldSaveFiledesc
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
import net.torvald.terrarum.blockproperties.BlockPropUtil
import net.torvald.terrarum.blockstats.TileSurvey
import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.blockstats.TileSurvey
import net.torvald.terrarum.concurrent.ThreadExecutor
import net.torvald.terrarum.console.AVTracker
import net.torvald.terrarum.console.ActorsList
@@ -95,12 +97,24 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
companion object {
/** Sets camera position so that (0,0) would be top-left of the screen, (width, height) be bottom-right. */
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
camera.update()
batch.projectionMatrix = camera.combined
}
fun setCameraPosition(batch: SpriteBatch, shape: ShapeRenderer, camera: OrthographicCamera, newX: Float, newY: Float) {
camera.setToOrtho(false, App.scr.wf, App.scr.hf)
camera.update()
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
camera.update()
shape.projectionMatrix = camera.combined
camera.setToOrtho(true, App.scr.wf, App.scr.hf)
camera.update()
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
camera.update()
batch.projectionMatrix = camera.combined
}
fun getCanonicalTitle() = App.GAME_NAME +
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
if (App.IS_DEVELOPMENT_BUILD)
@@ -318,8 +332,8 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
else {
printdbg(this, "Ingame setting things up from the savegame")
RoguelikeRandomiser.loadFromSave(codices.world.randSeeds[0], codices.world.randSeeds[1])
WeatherMixer.loadFromSave(codices.world.randSeeds[2], codices.world.randSeeds[3])
RoguelikeRandomiser.loadFromSave(this, codices.world.randSeeds[0], codices.world.randSeeds[1])
WeatherMixer.loadFromSave(this, codices.world.randSeeds[2], codices.world.randSeeds[3])
// Terrarum.itemCodex.loadFromSave(codices.item)
// Terrarum.apocryphas = HashMap(codices.apocryphas)
@@ -376,7 +390,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
printdbg(this, "No mapping found")
printdbg(this, "Changing XY Position ${codices.player.hitbox.canonVec} -> (${world.spawnX * TILE_SIZED}, ${world.spawnY * TILE_SIZED})")
codices.player.setPosition(world.spawnX * TILE_SIZED, world.spawnY * TILE_SIZED)
codices.player.setPosition((world.portalPoint ?: world.spawnPoint).toVector() * TILE_SIZED)
}
}
@@ -410,10 +424,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
// go to spawn position
printdbg(this, "World Spawn position: (${world.spawnX}, ${world.spawnY})")
actorGamer.setPosition(
world.spawnX * TILE_SIZED,
world.spawnY * TILE_SIZED
)
actorGamer.setPosition(world.spawnPoint.toVector() * TILE_SIZED)
actorGamer.backupPlayerProps(isMultiplayer)
// make initial savefile
@@ -489,7 +500,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
actorGamer = player
forceAddActor(player)
WeatherMixer.internalReset()
WeatherMixer.internalReset(this)
UILoadGovernor.worldUUID = world.worldIndex
}

View File

@@ -36,6 +36,8 @@ import net.torvald.terrarum.serialise.ReadSimpleWorld
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.weather.WeatherMixer
import net.torvald.terrarum.weather.WeatherStateBox
import net.torvald.terrarum.weather.Weatherbox
import net.torvald.terrarum.worlddrawer.WorldCamera
import net.torvald.util.CircularArray
import java.io.IOException
@@ -82,7 +84,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
val xperc: Double = (x - xwstart) / xw
// return FastMath.interpolateLinear(xperc.toFloat(), cameraNodes[indexThis fmod cameraNodes.size], cameraNodes[(indexThis + 1) fmod cameraNodes.size]).toDouble()
return FastMath.interpolateCatmullRom(xperc.toFloat(),
return FastMath.interpolateCatmullRom(xperc.toFloat(), 1.0f, // somehow T=1 works really well thanks to my other smoothing technique
cameraNodes[(indexThis - 1) fmod cameraNodes.size],
cameraNodes[(indexThis - 0) fmod cameraNodes.size],
cameraNodes[(indexThis + 1) fmod cameraNodes.size],
@@ -175,6 +177,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
printdbg(this, "Demo world not found, using empty world")
}
this.world = demoWorld
// set initial time to summer
demoWorld.worldTime.addTime(WorldTime.DAY_LENGTH * 32)
@@ -210,8 +213,8 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
IngameRenderer.setRenderedWorld(demoWorld)
WeatherMixer.internalReset()
WeatherMixer.titleScreenInitWeather()
WeatherMixer.internalReset(this)
WeatherMixer.titleScreenInitWeather(demoWorld.weatherbox)
// load a half-gradient texture that would be used throughout the titlescreen and its sub UIs
@@ -258,6 +261,10 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
override fun show() {
printdbg(this, "show() called")
for (k in Input.Keys.F1..Input.Keys.F12) {
KeyToggler.forceSet(k, false)
}
initViewPort(App.scr.width, App.scr.height)
@@ -505,7 +512,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
fun setCameraPosition(newX: Float, newY: Float) {
TerrarumIngame.setCameraPosition(batch, camera, newX, newY)
TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, newX, newY)
}

View File

@@ -150,6 +150,13 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
protected constructor() : super(RenderOrder.BEHIND, PhysProperties.IMMOBILE, null)
protected constructor(renderOrder: RenderOrder, physProp: PhysProperties, id: ActorID?) : super(renderOrder, physProp, id)
/**
* Callend whenever the fixture was spawned successfully.
*
* @param tx bottom-centre tilewise point of the spawned fixture
* @param ty bottom-centre tilewise point of the spawned fixture
*/
open fun onSpawn(tx: Int, ty: Int) {}
/**
* Making the sprite: do not address the CommonResourcePool directly; just do it like this snippet:
@@ -278,6 +285,8 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
actorThatInstalledThisFixture = installersUUID
onSpawn(posX0, posY0)
return true
}

Some files were not shown because too many files have changed in this diff Show More