Compare commits

..

885 Commits

Author SHA1 Message Date
minjaesong
0823bccd01 idea for deterministic save format? 2021-02-25 17:34:19 +09:00
minjaesong
e4c7ed581c fixing bug where the crafting table (or something) would placed and ui opened at the same time 2021-02-25 14:31:36 +09:00
minjaesong
2a72cc03bb fixing loadscreen visual 2021-02-25 11:23:07 +09:00
minjaesong
795f0ab853 walls now work 2021-02-25 11:11:47 +09:00
minjaesong
5f16f71b0a fixing random terragen crash? (was it block change event too big?) 2021-02-25 10:15:37 +09:00
minjaesong
ed0bec0ee8 item is useable (wall is not!); tile breakage works confirmed 2021-02-24 16:46:37 +09:00
minjaesong
b6a688c484 render is fixed (tile breakage not tested as loading items are still wip); air tile no longer has tilenum of 0 2021-02-24 11:04:11 +09:00
minjaesong
36387753b1 game compiles but: render is wrong; can't have any wall items 2021-02-20 16:53:22 +09:00
minjaesong
463e59087c something's not right with tile numbering 2021-02-20 15:10:47 +09:00
minjaesong
295dd8b8d6 wippie 2021-02-15 16:25:47 +09:00
minjaesong
0292115f89 wipwip 2021-02-14 10:07:08 +09:00
minjaesong
8ea551306c wire format suggestion 2021-02-12 21:57:36 +09:00
minjaesong
aae4952117 wires texture 2021-02-12 17:47:59 +09:00
minjaesong
6e63ab7fdc savegame format upd? 2021-02-12 14:14:09 +09:00
minjaesong
46b56b8fd0 more TODO 2021-02-11 23:33:01 +09:00
minjaesong
689fac7f27 base32: + to L 2021-02-11 21:27:38 +09:00
minjaesong
9eb757b7b9 wip 2 2021-02-11 20:45:38 +09:00
minjaesong
8fdc11288c the-flattening wip 2021-02-10 17:48:01 +09:00
minjaesong
73acaea025 65536 Blocks!!! 2021-02-09 17:53:33 +09:00
minjaesong
d9fc24ba26 1 million virtual tiles!!! 2021-02-09 17:27:14 +09:00
minjaesong
cdcf945e43 inventoryui: adjusting inventory gap magic number so that inventory look pretty on 720p 2020-12-26 18:20:07 +09:00
minjaesong
f2c97c890d bfg file removal 2020-12-14 19:01:24 +09:00
minjaesong
5685243443 light whitewash version 1 2020-12-01 17:50:47 +09:00
minjaesong
f77e65ac97 light whitewash impl 2020-12-01 16:49:46 +09:00
minjaesong
98ad0bfc6c see commit below 2020-11-29 16:42:01 +09:00
CuriousTorvald
807d67862c for gods sake don't casually usegl30=true
https://stackoverflow.com/questions/46753218/libgdx-should-i-use-gl30
2020-11-28 19:32:50 +09:00
minjaesong
bed6f74462 screenshots will take unique name 2020-11-25 13:39:17 +09:00
minjaesong
79114fcbd0 setting minimum res to be 1080x720 2020-11-24 10:12:32 +09:00
minjaesong
5d46402b27 finaly fixing 720p bug (issue #36) 2020-11-21 22:04:59 +09:00
minjaesong
e97a74483f trying to fix the '720p' bug but faild :/ 2020-11-21 17:56:22 +09:00
minjaesong
b8a7dee7ac config: user-configurable control entries now have config- prefix 2020-11-21 11:24:15 +09:00
minjaesong
44c11cef76 multithread light: forget about it 2020-11-20 14:08:18 +09:00
minjaesong
ab780fd246 code cleanup 2020-11-11 11:04:59 +09:00
minjaesong
4db5bc1623 guess some quality can be sacrificed 2020-11-10 18:49:24 +09:00
minjaesong
8548e415d2 it works yay :) 2020-11-10 16:21:08 +09:00
minjaesong
3ad80d1687 y u no work :( 2020-11-10 11:54:52 +09:00
minjaesong
b908cee2fe round 4 wip but not working :( 2020-11-10 00:51:46 +09:00
minjaesong
65f536db3c one diag done, one more to go 2020-11-09 23:13:20 +09:00
minjaesong
fdee65ad0d using internal coord only; diagonal round todo 2020-10-25 23:47:39 +09:00
minjaesong
9280a1e4a1 new lighting kinda works 2020-10-25 19:10:48 +09:00
minjaesong
4a0e6393d0 variable renaming 2020-10-25 11:37:05 +09:00
minjaesong
b2da7144e0 new lighting idea 2020-10-23 11:50:38 +09:00
minjaesong
0c48b9dce8 using kotlin's newfangled 'x in xs.indices' instead of 'x in 0 until xs.size' 2020-10-21 17:42:58 +09:00
minjaesong
2437fed1ea UnsafeHelper.getArrayOffset to return long 2020-10-21 17:03:28 +09:00
minjaesong
2930336718 trying to fix the threadexecutor, at least it will throw error if a job failed 2020-10-21 11:06:35 +09:00
minjaesong
d5df9df00d illegalstateexception -> nullpointerexception 2020-10-11 13:05:57 +09:00
minjaesong
4b2d547663 font update 2020-10-06 16:32:41 +09:00
minjaesong
634de74d51 test commit please ignore 2020-09-28 09:27:34 +09:00
minjaesong
8929093432 add: inventory minimap 2020-09-18 11:09:33 +09:00
minjaesong
0bf5baa7e0 add: inventory esc menu 2020-09-17 17:00:52 +09:00
minjaesong
24b7331af3 Merge branch 'inventory-ui-transition-container' into master 2020-09-17 11:24:15 +09:00
minjaesong
f2902b38b2 fix: inventory cells not tangible 2020-09-17 11:22:03 +09:00
minjaesong
bd7a66728b transition works as intended but ui is not tangible 2020-09-14 15:19:34 +09:00
minjaesong
1aadde9e9f fix: inventory panels and their indices are mutually inversed 2020-09-14 14:04:46 +09:00
minjaesong
f9883f2516 q&d hack for ui opacity control using a shader 2020-09-12 11:24:32 +09:00
minjaesong
9b079d0467 index is reversed, transparency not working 2020-09-09 16:58:35 +09:00
minjaesong
534309439c UI is now rendered in correct pos 2020-09-09 16:05:56 +09:00
minjaesong
560a38569e UI visible and render is offsetted but update is ok 2020-09-09 15:38:21 +09:00
minjaesong
28369f8eeb warning msg for not on debug mode 2020-09-09 09:22:24 +09:00
minjaesong
7a58cf9edb inventory ui transition wip 2020-08-30 16:09:42 +09:00
minjaesong
dd1989320d less fancy inventory transition WIP 2020-08-22 18:23:17 +09:00
minjaesong
ba424accf2 lfs: tracking .kra files 2020-08-22 16:47:20 +09:00
minjaesong
0ce9e412a8 adding title menu element for mod options 2020-08-22 16:44:37 +09:00
minjaesong
1e0161e005 collision code for staircasing 2020-08-04 12:23:46 +09:00
minjaesong
f8d8fccef7 replacing all nonstaircasing collistion function usage into staircasing one 2020-07-24 14:41:54 +09:00
minjaesong
8623e4d60e added a todo message 2020-07-22 22:40:12 +09:00
minjaesong
f88a8976d2 phys: wip staircasing modification is still compatible with old code 2020-07-20 21:24:22 +09:00
minjaesong
173bdb3abf phys: making colliding side indices more sensible 2020-07-17 22:50:24 +09:00
minjaesong
c0db310a66 phys arguments are now single PhysProperties object 2020-07-15 21:58:44 +09:00
minjaesong
d89e0d30da new tonemapping lut using some random fibseq 2020-07-12 10:29:39 +09:00
minjaesong
671882014e new properties in apploader: aspectRatio 2020-06-21 13:56:50 +09:00
minjaesong
5b05a84684 biome in worldgen 2020-06-12 15:21:55 +09:00
minjaesong
38d5b17eeb default screen size to be exact 3:2 again (and obs-linux compatible) 2020-05-13 22:33:32 +09:00
minjaesong
043b3bee13 terragen: making sky-to-ground ratio to be constant 2020-05-03 10:43:31 +09:00
minjaesong
1ea7b9f1f6 more hangul improvements 2020-05-01 17:13:46 +09:00
minjaesong
961e375234 implementing working multithreading Terragen to the game 2020-04-29 11:26:59 +09:00
minjaesong
226c8342cb more testing on skydome / font change 2020-04-29 08:48:06 +09:00
minjaesong
826a13ff57 both idea works 2020-04-29 08:47:27 +09:00
minjaesong
1e7706662b more testing on resolving noisy artefact in worldgen 2020-04-29 08:15:40 +09:00
minjaesong
4f146dfc94 using Coroutines instead of Threadpool but the artefact is still there :( 2020-04-27 03:36:34 +09:00
minjaesong
afecee7fb4 reverting Unsafe usage of worldgennoisesandbox 2020-04-27 03:05:19 +09:00
minjaesong
261b545974 major hangul font update 2020-04-23 01:04:58 +09:00
minjaesong
6573dfa091 Hosek skylight model translated from C to Kotlin 2020-04-20 04:47:40 +09:00
minjaesong
8b3911fef0 adding the missing pdf file 2020-04-19 01:21:03 +09:00
minjaesong
d1aedb9a3d updating LibGDX to 1.9.10 2020-04-19 01:06:25 +09:00
minjaesong
c497648250 minor improvement on rotund r 2020-04-14 07:25:47 +09:00
minjaesong
d50faf9201 font support for LatinExt-D 2020-04-14 06:31:05 +09:00
minjaesong
a61ff82ddd comment 2020-04-13 05:03:53 +09:00
minjaesong
0200fa8803 simplified the tiling shader a bit 2020-04-13 02:13:24 +09:00
minjaesong
07b9e76090 Reducing hierarchy by merging ActorWithBody with ActorWBMovable 2020-03-20 19:30:17 +09:00
minjaesong
5cafe16f20 closing issue #34, it was just hitbox not properly being updated 2020-03-10 23:34:36 +09:00
minjaesong
7345a1015f fixing bug where the hitbox won't change when actor is rescaled, wip issue #34 2020-03-10 06:52:40 +09:00
minjaesong
48b431f4b7 Fixing bad quickslot behaviour where it would unequip things when the selection changed 2020-03-09 04:01:03 +09:00
minjaesong
8894be303a some code pruning 2020-03-07 03:39:26 +09:00
minjaesong
0b57a995a5 Tentatively fixed the issue #35
if it's truly been fixed, the culprit was the mixed use of lx/ly and worldx/worldy
2020-03-07 02:39:01 +09:00
minjaesong
4c77ccb548 Pre-calculation. Plagued with segfaults. Feel free to roll back. 2020-03-06 21:52:06 +09:00
minjaesong
1ab12ffa24 more functions 2020-03-06 21:51:06 +09:00
minjaesong
e77c52a86f commenting out the assert code that is called ~50 000 times per frame 2020-03-06 01:54:18 +09:00
minjaesong
6d420691cb fixing bug where blocks cant be placed if mouse is over quickslot and watch 2020-03-06 01:30:33 +09:00
minjaesong
418353c652 stupid idea that didnt work 2020-03-04 10:32:05 +09:00
minjaesong
82bb7ddd0d see issue #31 2020-03-01 01:03:25 +09:00
minjaesong
6662d7f96c fixing unlit torch bug 2020-02-29 20:28:55 +09:00
minjaesong
1a6817aa49 gitignore: linux temp files 2020-02-28 17:47:14 +09:00
minjaesong
bac2190104 back to octagonal lightspreading and one more failed test 2020-02-28 05:39:46 +09:00
minjaesong
c4521b9fd9 more comments 2020-02-28 05:14:13 +09:00
minjaesong
c406cefd18 removing temporary-zoom snippet 2020-02-27 18:18:55 +09:00
minjaesong
1524919ae0 determining array base offset: replaced trick code with proper code 2020-02-27 17:54:35 +09:00
minjaesong
e235b81041 middle click to open pie menu 2020-02-27 05:41:57 +09:00
minjaesong
89c99e19c0 TEST: 5-pass performs better than 2-split idea 2020-02-25 00:05:54 +09:00
minjaesong
ad903952cc lightsource randomiser hash will be same even when x < 0 2020-02-24 14:46:37 +09:00
minjaesong
0d8d6ca9fa using proper hashing function 2020-02-24 14:45:12 +09:00
minjaesong
73775d9148 setting default res to 1108:740, an OBS-friendly number 2020-02-24 01:23:24 +09:00
minjaesong
73c827b77f randomised torch flicker 2020-02-24 01:00:11 +09:00
minjaesong
6c7fe9cf2b amending last commit 2020-02-23 15:57:33 +09:00
minjaesong
0176c95539 another attempt 2020-02-23 03:35:50 +09:00
minjaesong
a96df1041b fixing bad code regarding lightsource detection
...I'm stupid
2020-02-22 22:43:33 +09:00
minjaesong
fc99ee72c3 memoised dynamic luminosity 2020-02-22 15:47:34 +09:00
minjaesong
d97283e76c half-assed but working radiator with no directional quirks 2020-02-22 06:07:24 +09:00
minjaesong
13f44f3861 comment 2020-02-22 00:15:55 +09:00
minjaesong
4da45860b8 radiosity: nice try but works half-assed and is slower
better optimise the old method, there's lots of overlaps there
2020-02-21 21:28:55 +09:00
minjaesong
3210cad23d quick idea 2020-02-21 05:07:34 +09:00
minjaesong
947224c290 new lightmap: nice try but didn't work 2020-02-21 03:40:37 +09:00
minjaesong
9d51f419f5 make quickslots work with dynamic items 2020-02-13 15:08:59 +09:00
minjaesong
d29fed8da3 global framerate limit
should help with some edge cases that occur when GPU is overloaded
2020-02-11 02:46:15 +09:00
CuriousTorvald
5dee9f8548 Create energy_flow.gv 2020-01-19 18:09:00 +09:00
minjaesong
697424efc4 re-draw floater gui texture 2020-01-05 21:44:44 +09:00
minjaesong
f36209e3bf testing borders on inventory cells 2019-12-29 00:27:20 +09:00
minjaesong
24c6e8b385 test commit 2019-12-23 18:46:10 +09:00
minjaesong
b5482ed07c small remedy for KDE Plasma 2019-12-23 04:48:30 +09:00
minjaesong
95e47066ca re-impl skybox vertical parallax 2019-12-22 22:24:16 +09:00
minjaesong
8d5fba9492 making dithering work on skybox drawing 2019-12-15 12:39:20 +09:00
minjaesong
90495b6137 wip2 2019-12-10 18:04:37 +09:00
minjaesong
01783387ad new skybox drawing wip 2019-12-10 15:24:05 +09:00
minjaesong
75dad8a78c what fucking linux crashes if i reduce the screen size?
This reverts commit 8180f81f38.
2019-12-06 20:41:32 +09:00
minjaesong
653fc23115 Revert "setting default height to be 720"
This reverts commit 8180f81f38.
2019-12-06 19:37:29 +09:00
minjaesong
8180f81f38 setting default height to be 720
streaming-friendly
2019-12-05 14:16:55 +09:00
minjaesong
d3bf27e8db lightmaprenderer: removing minOf() 2019-12-05 10:34:52 +09:00
minjaesong
e4aa4d2b87 lightmaprenderer: exporting LUT to its own class 2019-12-05 10:27:54 +09:00
minjaesong
fbe941bb39 updated Terragen.kt 2019-12-04 15:38:32 +09:00
minjaesong
25c585e4c1 worldgenloadscreen now makes transition 2019-11-27 17:31:29 +09:00
minjaesong
5255392bc0 hypothetical multithreading on terragen 2019-11-27 16:59:24 +09:00
minjaesong
a66dc344b3 load screen actually draws the world
transition still not working
2019-11-27 16:42:49 +09:00
minjaesong
c13aebd3ba at least message shows on loadscreen
does the transition works?
2019-11-27 15:53:09 +09:00
minjaesong
f715ba9a6e worldgen preview loadscreen (NOT WORKING) 2019-11-20 15:24:45 +09:00
minjaesong
deb8b43a81 renderToPreview() 2019-11-18 12:52:28 +09:00
minjaesong
899bb00aac minor edits 2019-11-18 12:26:43 +09:00
minjaesong
d8317e4226 Various Loadscreens WIP 2019-11-18 01:20:17 +09:00
minjaesong
e71c56cf0d fixed worldgen and threadexecutor so that they will actually wait for the thread termination 2019-11-16 02:41:25 +09:00
minjaesong
7939ff3690 Update WorldgenLoadScreen.kt, Terragen.kt, and WorldgenNoiseSandbox.kt 2019-11-10 22:35:22 +09:00
minjaesong
0fd4f957c2 wip fixing multithreaded noisy image bug
decided to remove my own thread pool impl to reduce the scope of attack
2019-11-08 01:34:39 +09:00
minjaesong
ea4c0c1697 Update ui_config_keymap_keycap.tga 2019-11-07 19:32:41 +09:00
minjaesong
96158c5a90 using new terragen on main game -- noisy tiles are real issue 2019-10-30 15:13:38 +09:00
minjaesong
288afba105 added missing code pieces 2019-10-24 20:56:56 +09:00
minjaesong
0f335cd312 uiitem keymap keycap wip 2019-10-17 14:46:20 +09:00
minjaesong
08efc934a9 uiitem toggle button impl 2019-10-17 10:59:47 +09:00
minjaesong
7f4e6aad15 toggler graphics update 2019-10-17 02:02:18 +09:00
minjaesong
b08a34c67e Added uiitem-toggler assets 2019-10-16 18:43:16 +09:00
minjaesong
7dafc508e5 issue #28 2019-10-14 20:55:53 +09:00
minjaesong
4a1ef21155 adding missing texture 2019-10-14 19:32:24 +09:00
minjaesong
4eb1940d13 motherfucking git 2019-10-14 15:40:01 +09:00
minjaesong
1190974901 key config ui mockup 2019-10-09 00:21:12 +09:00
minjaesong
b6fe91ad19 var jump just pressed 2019-10-06 14:50:16 +09:00
minjaesong
951a65cb4f corrcet case for font sheet name 2019-10-04 17:04:00 +09:00
minjaesong
15a6324ef4 wall-kick-jump WIP 2019-10-02 15:24:05 +09:00
minjaesong
c14453cb35 slight edit on kana font sheet 2019-09-30 15:08:25 +09:00
minjaesong
71109602e7 different hardware testing results update 2019-09-20 18:30:45 +09:00
minjaesong
2980d3eb94 improved shader compatibility with intel builtin gpu
apparently you can't use 1f for float, always use 1.0
2019-09-20 14:15:26 +09:00
minjaesong
aaae4f71d8 commit 2019-09-19 18:10:54 +09:00
minjaesong
7ec1fbc1bf update gitignore, new worldgen wip 2019-09-15 08:12:04 +09:00
minjaesong
c315022d80 worldgentest: soil layer 2019-08-29 23:10:23 +09:00
minjaesong
7ab15fe966 noise test to simulate the actual worldgen 2019-08-28 22:24:53 +09:00
minjaesong
11a30d3c2a displays time on main window 2019-08-27 16:17:26 +09:00
minjaesong
a29a47e009 removing redundant properties 2019-08-27 01:30:46 +09:00
minjaesong
79fb81f757 some minor touches 2019-08-26 16:47:30 +09:00
minjaesong
2a2e63e10a terraingen candidate 1 2019-08-25 23:35:51 +09:00
minjaesong
668c10f736 terrain gen adjustments wip 2019-08-25 19:54:55 +09:00
minjaesong
0af5002638 cavegen candidate 1 2019-08-25 19:29:10 +09:00
minjaesong
004a9af098 cavegen candidate 0 2019-08-25 18:53:01 +09:00
minjaesong
e449d34e3a new cavegen is finally doing something 2019-08-25 14:14:25 +09:00
minjaesong
12498184f5 fixed minor anomalies 2019-08-21 15:12:19 +09:00
minjaesong
f78c465aef inventory ui will get taller if screen is taller 2019-08-19 03:44:15 +09:00
minjaesong
9e775d9d57 fixd a bug where HUD will draw on top of console window 2019-08-19 02:05:00 +09:00
minjaesong
89746c3b6e actual health message on appload 2019-08-18 05:01:56 +09:00
minjaesong
60bb495782 terrain glow tex drawing 2019-08-15 19:42:16 +09:00
minjaesong
86f48c2fe3 terrain glow tex composing 2019-08-15 19:03:16 +09:00
minjaesong
ebe78dafea shitty implementaion of "air jumping" 2019-08-15 00:20:42 +09:00
minjaesong
0d04f97647 health message on splash 2019-08-14 01:45:00 +09:00
Minjae Song
018160b541 fix func name conflict 2019-08-13 15:50:31 +09:00
minjaesong
9b470bb3bb lightmap fix fox edge case when CameraX < 0 2019-08-13 14:47:23 +09:00
minjaesong
f62f751243 some random stuffs? 2019-08-12 03:59:39 +09:00
minjaesong
f39c4e9178 light calc area shrinks when zoomed in 2019-08-12 03:59:27 +09:00
minjaesong
e8b2b04c62 no stuttering zoom (inefficient) 2019-08-12 03:04:16 +09:00
minjaesong
d8d095c0a2 zooming properly with z key (with some async artefacts) 2019-08-11 21:33:12 +09:00
minjaesong
b63bf88cd7 uis won't open or close when console is up 2019-08-11 20:42:59 +09:00
minjaesong
419773550a screen zooming, temporarily toggle with Z key 2019-08-11 05:42:04 +09:00
minjaesong
08c18caa25 inventory lister's category setting must be held by its parent 2019-08-06 02:28:07 +09:00
minjaesong
0f283f2aaa inventory ui: number of cells can be given on creation 2019-08-05 05:20:09 +09:00
minjaesong
5f4305283d inventorydynamiclist to have more options; fixed wrong shade values for trees; commonresourcepool to check dupes 2019-08-05 04:58:33 +09:00
minjaesong
63b1fcb870 special symbols to use shortcuts instead of literals 2019-08-05 04:19:00 +09:00
minjaesong
bed655448d adjusted ui's y pos so that there's even gaps between catbar and control helper 2019-08-05 03:51:38 +09:00
minjaesong
864b6cd5a0 tree impl test; falling blocks won't destroy transparent blocks 2019-07-31 01:38:27 +09:00
minjaesong
155c38536f correct impl for RNG of joise lib 2019-07-27 14:45:19 +09:00
minjaesong
1691fc41e5 texture for tree trunk 2019-07-27 00:36:53 +09:00
minjaesong
fc35188bde some tiny little optimisations on tiling shader 2019-07-26 16:45:24 +09:00
minjaesong
f1d92744c0 grass tex revert to smooth 2019-07-26 03:28:57 +09:00
minjaesong
7ae5a8c132 minor fixes 2019-07-21 20:40:45 +09:00
minjaesong
dfd43f52d5 ingame computer wip; gamepad deadzone disp on f3 2019-07-19 23:19:25 +09:00
minjaesong
f2ee058e7c newly written circulararray 2019-07-14 03:55:27 +09:00
minjaesong
5f3801eb48 colourmap and assets 2019-07-12 02:26:20 +09:00
minjaesong
24a16426ed fixed MDA scroll behaviour 2019-07-10 20:49:20 +09:00
minjaesong
514ea680aa fix wrong assert usage; addOneArgFun for Lua globals works 2019-07-10 16:20:45 +09:00
minjaesong
2c560a6f36 new iteration of the ingame computer -- display adapter 2019-07-09 22:26:28 +09:00
minjaesong
e4974025a0 some UIs can be closed with ESC key 2019-07-08 21:50:35 +09:00
minjaesong
f95ea1ab0f fixture ui almost working 2019-07-08 19:41:35 +09:00
minjaesong
e8ba837b09 trying to make fixtures with UIs working, was not successful 2019-07-08 04:05:04 +09:00
minjaesong
84e4c82b60 throwing in a pr-tree onto the project 2019-07-07 22:13:37 +09:00
minjaesong
b66ca70d6c test impl of "collision interpolator'; new number font for itemslots 2019-07-07 20:53:20 +09:00
minjaesong
01e475814b blocks csv fixed wrong opacity value 2019-07-06 20:44:15 +09:00
minjaesong
184eda38fd comment 2019-07-03 04:12:56 +09:00
minjaesong
ae8d7a67f2 issue #26 resolved (someone is hoolding stale ingame context) 2019-07-03 03:59:37 +09:00
minjaesong
42dbaaa242 backend stuffs in the Terrarum moved to the AppLoader 2019-07-02 05:10:32 +09:00
minjaesong
4c23cde4a9 no more context fuckups on apploader 2019-07-02 04:59:24 +09:00
minjaesong
eb4bdbacde new tiny numbers font 2019-06-26 19:32:27 +09:00
minjaesong
2455ab9983 fallable sim to properly work on multiple fallable "stacks" 2019-06-26 02:00:41 +09:00
minjaesong
a45b68b8d5 fallable blocks actually falls 2019-06-25 23:30:22 +09:00
minjaesong
04ea9aec42 more cleanup regarding fireRecalculateEvent 2019-06-25 22:48:38 +09:00
minjaesong
ed58e72724 refactoring the call order of the renderers' init code invocation 2019-06-25 22:26:16 +09:00
minjaesong
d2e886aec2 q&d hack to circumvent the dangling pointer issue #26 2019-06-25 15:22:24 +09:00
minjaesong
44405111eb issue #26: the reason was the dangling pointer? 2019-06-23 02:20:01 +09:00
minjaesong
41b68aa132 BlockLayer temporarily use DirectByteBuffer (averting the issue #26) 2019-06-23 01:43:56 +09:00
minjaesong
64bbe6b53b sorta working unsafesvecarray; and then issue #26 is fucking shit up 2019-06-22 04:16:03 +09:00
minjaesong
b45caebda0 it turns out the test-entering is broken; will fix later idk; Threadparallel.startAllWaitForDie seems to work as intended 2019-06-21 16:05:02 +09:00
minjaesong
306f45e7ee the placeholder "nullworld" is now singleton 2019-06-11 23:52:17 +09:00
minjaesong
c41e60d29f fixture spawns with correct tex pos and hitbox; unsure if issue #26 is fixed tho 2019-06-11 23:46:52 +09:00
minjaesong
23b103892e blockprop: fall is now grav 2019-06-11 20:55:28 +09:00
minjaesong
196ae40bbb it's still a progress right? 2019-06-10 17:38:06 +09:00
minjaesong
fd9d36c7ac new block: scaffolding (does not fall yet) 2019-06-10 01:40:10 +09:00
minjaesong
6e0fe95e76 intbox debugger is back 2019-06-09 01:26:14 +09:00
minjaesong
48b4a4455b unsafe array on lightmaprenderer: could this be possible? 2019-06-08 04:14:13 +09:00
minjaesong
30ae587554 no more access violation from freeing already freed memory 2019-06-08 03:29:38 +09:00
minjaesong
15cb42e26b 80 fps with unsafe access 2019-06-08 03:00:47 +09:00
minjaesong
5f11bb8cf9 just a fixme tag 2019-06-07 22:16:38 +09:00
minjaesong
25fd843ef2 apparently I'm fucking dumb 2019-06-07 10:37:04 +09:00
minjaesong
9445c615e6 i discovered something to be looked at 2019-06-07 10:23:22 +09:00
Minjae Song
772ce19eab weather to not use expensive math; colormap now also holds cvec 2019-06-05 21:22:27 +09:00
Minjae Song
b0c6ce29a8 mod metadata: changed versioning scheme 2019-06-05 21:22:27 +09:00
minjaesong
aad88710ed light parallel failed attempt 2019-06-05 21:04:01 +09:00
minjaesong
0216e814a6 debugwindow: correct ui count 2019-06-01 04:47:20 +09:00
minjaesong
f8e26f82c6 lightmap is now array of array because debug-ability > slight framerate drop 2019-06-01 04:06:36 +09:00
minjaesong
af001ad394 cvec: java to kotlin 2019-06-01 03:49:14 +09:00
minjaesong
c632818e03 migration wip java 9 modularise 2019-06-01 03:25:20 +09:00
minjaesong
a1cde8ef9b fixed using wrong type of exception 2019-06-01 02:06:07 +09:00
minjaesong
ec8b57abd1 fixtures won't spawn when there's block or other fixtures 2019-05-31 22:57:20 +09:00
minjaesong
874834b2d1 fixing "roundworld anomaly": some actors won't render 2019-05-31 04:10:00 +09:00
minjaesong
a595dc2665 wip debugging "roundworld anomaly" 2019-05-30 23:35:01 +09:00
minjaesong
2b35e547da contracted itemcount string 2019-05-30 21:36:02 +09:00
minjaesong
c8df0fc9fd font: hangul update 2019-05-30 14:10:09 +09:00
minjaesong
ef72075fd6 tiki torch correctly spawns; gotta check for collision 2019-05-29 23:20:39 +09:00
minjaesong
c00a8235e1 added definition for fixture null blockbox 2019-05-28 23:57:51 +09:00
minjaesong
ad4bfd9e01 tiki torch spawns but is not centred 2019-05-28 22:46:10 +09:00
minjaesong
84a35abb37 no secondary click; tiki torch kinda spawns? 2019-05-26 22:55:50 +09:00
minjaesong
3f692da03c disposable singletons to an array in loader; single float for both notification and tooltip 2019-05-24 20:38:35 +09:00
Minjae Song
d08aae5db0 stupid gimp 2019-05-22 12:57:20 +09:00
Minjae Song
ad6d52b13c tileable message float ui 2019-05-22 12:51:01 +09:00
minjaesong
4c4d268b95 cherrypicked from the branch test-cvec-for-light 2019-05-21 17:50:54 +09:00
minjaesong
b52dd12807 furred npc test might delete later 2019-05-20 12:07:01 +09:00
minjaesong
3106657f44 font: new redesigned hangul 2019-05-14 13:16:10 +09:00
minjaesong
9a9bb37835 font: hangul redraw wip -- less "laundry line" 2019-05-12 23:52:27 +09:00
minjaesong
2b2e0e3327 font: hangul redraw wip 2019-05-12 17:09:46 +09:00
minjaesong
0f3a6143cf gradle script fix typo and add assertion jvm option 2019-05-12 01:03:35 +09:00
minjaesong
b217a023d2 comment 2019-05-08 21:23:42 +09:00
minjaesong
0ccfb0e709 blocksdrawer now draws wire 2019-05-04 18:19:08 +09:00
minjaesong
dfe183f597 adding missing resources/moving zip files to lfs 2019-05-04 04:11:33 +09:00
minjaesong
e064d6b8f1 block functions now share one centralised core function 2019-05-04 03:29:59 +09:00
minjaesong
65e01b1eb0 debug info for upcoming wires 2019-05-02 00:56:25 +09:00
minjaesong
5816e678bf fixed a long bug where item would be used twice but discounted by only one on single click 2019-05-01 23:26:01 +09:00
minjaesong
839b7e7762 more comments 2019-04-30 03:06:19 +09:00
minjaesong
7d216acd52 sortedarraylist update; physball breaks the actor render dunno why 2019-04-30 02:52:09 +09:00
minjaesong
5a95f1c21a actually using (and rediscovering) the kdtree 2019-04-18 23:42:54 +09:00
minjaesong
62b687c86b gamepad keyboard mockup 2019-04-15 12:26:54 +09:00
minjaesong
bda58ecebd controller getaxisraw, calibration on startup 2019-04-09 23:42:10 +09:00
minjaesong
a5d33da1c9 fixed: noclipped player won't move up and down when gamepad is plugged in 2019-04-06 03:58:02 +09:00
minjaesong
968a1a0888 weponmeleecore 2019-03-19 13:35:58 +09:00
minjaesong
57ebbcb421 moduleinfo won't contain bad modules 2019-03-17 13:49:20 +09:00
minjaesong
ee732dbcf9 inventory UI won't rebuild when pie menu is in operation 2019-03-16 03:44:03 +09:00
minjaesong
08aa0e8f34 always sorting arraylist; more wire stuffs 2019-03-12 22:27:26 +09:00
minjaesong
0563ef0940 colour-changing durability and encumbrance bar 2019-03-12 02:29:58 +09:00
minjaesong
58a91ed10b can retrieve item image for dynamic items 2019-03-12 01:42:07 +09:00
minjaesong
1ac735805d not reading material csv issue fixed 2019-03-12 00:47:06 +09:00
minjaesong
7f53be48d1 my CSV was malformed :( 2019-03-11 19:36:42 +09:00
minjaesong
03df390e38 distinguishable item placeholder image 2019-03-11 00:20:08 +09:00
minjaesong
d7846bf332 autofill inventory with "available" blocks (has texture) 2019-03-10 23:42:48 +09:00
minjaesong
1bf9228e75 reading material from the module; pixaxes use it
But "dynamic item" created from the pickaxe class is not right
2019-03-10 23:38:11 +09:00
minjaesong
b495c010f4 a piece of wire is considered as a tool for inventory (for now) 2019-03-10 18:13:29 +09:00
minjaesong
833d8814a7 game item to load its own image if needed; common resource pool to assist that 2019-03-10 17:46:48 +09:00
minjaesong
d895da9e96 removing lwjgl patch 2019-03-10 00:31:16 +09:00
minjaesong
5822cb50b2 minimap: only update and render when needed 2019-03-10 00:28:47 +09:00
minjaesong
cd97b5c4ab rudimentary minimap draw only 2019-03-08 18:49:38 +09:00
minjaesong
a1022a3db1 minor comment update 2019-03-05 23:39:36 +09:00
minjaesong
7359519982 ingamerenderer: things won't update when the game is paused (e.g. UI open) 2019-03-05 17:45:41 +09:00
minjaesong
aaa745ff94 minimap test: zoom and pan of the image 2019-03-04 18:33:39 +09:00
Minjae Song
d979332cbf requesting xinput will always fail on non-windows 2019-03-04 04:55:12 +09:00
minjaesong
9382054060 some more blocks 2019-03-04 02:48:49 +09:00
minjaesong
a05e2fc695 createtileatlas: fixing a mistake where non-47 blocks won't be rendered to atlas 2019-03-03 21:53:56 +09:00
minjaesong
01e5f75bf4 did my best to draw fluids. The thing is, tiles suck at this and I need polygon-based render for fluids 2019-03-03 12:18:04 +09:00
minjaesong
deb82d54b0 codes to produce fluid atlas 2019-03-03 00:25:42 +09:00
minjaesong
648be6d041 brighter corners on the tile mask 2019-03-02 22:48:24 +09:00
minjaesong
b5ad28f22a fluid masks tga 2019-03-02 20:20:00 +09:00
minjaesong
7c3759e6d1 new blocksdrawer: works well with masktype 0 and 2 2019-03-02 00:57:26 +09:00
minjaesong
424c7ce17f blocksdrawer: now generates terrain and wall item image 2019-03-01 23:25:23 +09:00
minjaesong
65cc484475 enough resources to test impl the thing 2019-03-01 03:22:46 +09:00
minjaesong
8e23138881 I put wrong colour on the terrain mask type3 2019-03-01 02:20:14 +09:00
minjaesong
6c8bb1f8fa test impl of the new block atlas maker 2019-03-01 01:20:07 +09:00
minjaesong
4bf2726cd8 dynamic shape: added metadata doc
sililar to the one used in the game's font
2019-02-28 21:57:56 +09:00
minjaesong
5de290aef9 block masks and docs according to the new dynamic whatever 2019-02-28 00:15:17 +09:00
minjaesong
3979eba65b completely new terrain masks to cover 256 possible surroundings 2019-02-27 06:28:48 +09:00
minjaesong
3058f0c277 terrain mask PSDs 2019-02-26 17:26:19 +09:00
minjaesong
a76603905b WriteWorldInfo: actually working thumbnail export 2019-02-25 02:07:39 +09:00
minjaesong
a193bb7de0 prettier text print on Notification 2019-02-24 05:06:54 +09:00
minjaesong
8432ad1377 lang updater 2019-02-24 00:27:50 +09:00
minjaesong
8cc9b98a12 more tests with gson (de)serialiser 2019-02-23 17:40:13 +09:00
minjaesong
73dfab206e seemingly working savewriter with fixed TEVD 2019-02-23 05:03:20 +09:00
minjaesong
58f017e264 some random idea 2019-02-22 15:24:56 +09:00
minjaesong
955f36dad5 HasAssembledSprite saves path instead of FileHandle (easier gson-ing) 2019-02-22 15:19:39 +09:00
minjaesong
d0e2b20fc3 inventory: saving ID only, most things still work 2019-02-22 05:22:09 +09:00
minjaesong
0fee72c5d3 gson test in progress 2019-02-22 04:50:43 +09:00
minjaesong
d23c3ed389 temp minimap placeholder 2019-02-21 03:54:09 +09:00
minjaesong
c107365e6f world: ZIP compression is the reference now 2019-02-21 00:25:23 +09:00
minjaesong
d38fb0c15d gamepad button label; gamepad calibrate on startup 2019-02-21 00:12:12 +09:00
minjaesong
83e1239434 lightmap drawing won't use spritebatch 2019-02-20 23:14:28 +09:00
minjaesong
1906cff519 payloadutil and unhelpful commit message 2019-02-20 22:43:35 +09:00
minjaesong
c9ac844e75 actorwbmovable: alias vars are latched to its update; sprite that's out of screen won't render 2019-02-20 15:38:18 +09:00
minjaesong
0984b65d65 inventory equip slot icon 2019-02-20 01:34:47 +09:00
minjaesong
4de53b7321 buildingmaker: can hide/show selection overlay 2019-02-18 16:57:28 +09:00
minjaesong
7f1e48304b buildingmaker block marking 2019-02-18 16:36:21 +09:00
minjaesong
ce010c1aa5 doc update for UICanvas and UIItem 2019-02-17 19:42:00 +09:00
minjaesong
baeba1552a fully working blockchooser 2019-02-17 03:52:27 +09:00
minjaesong
3c1b4c8a64 working pen menu 2019-02-16 22:48:27 +09:00
minjaesong
49f8b8d1c8 terrain quarried stone fix 2019-02-16 19:56:12 +09:00
minjaesong
48c672b7cd penmenu with icons (render only) 2019-02-16 17:52:18 +09:00
minjaesong
a3ef1b435d buildingmaker penmenu; resolving mouse click clash between world and UIs 2019-02-16 17:11:36 +09:00
minjaesong
e06e9ef733 new basicinfo ui; each module should be dispose()-able 2019-02-16 01:32:17 +09:00
minjaesong
6b44e01939 buildingmaker palette close and open again 2019-02-14 22:33:54 +09:00
minjaesong
d020bedba1 fixing list UI's colours; buildingmaker palette wip 2019-02-14 15:55:31 +09:00
minjaesong
880b5e70b5 PUA: LR buttons are now xbox shaped, added xbox one's View and Menu buttons 2019-02-13 17:53:40 +09:00
minjaesong
7c3acf6e84 block placing is now primary-use (left click/main trigger/screen tap) 2019-02-12 01:30:31 +09:00
minjaesong
07b801ace5 inventory wallet view 2019-02-11 18:02:52 +09:00
minjaesong
97d0b9de64 set environment as console if gamepad is detected 2019-02-11 14:54:57 +09:00
minjaesong
fb0357b5d6 pov for gdxcontrolleradapter (untested) 2019-02-10 03:48:39 +09:00
minjaesong
1730ebd0d7 making xinput to actually work (tested with xbone gamepad) 2019-02-09 18:33:54 +09:00
minjaesong
d891afa1cd noop mask doc 2019-02-08 23:50:04 +09:00
minjaesong
baccf5f0b5 making gamepad work again 2019-02-08 18:57:47 +09:00
minjaesong
1b837bfade bgBG: one dark pixel fixed 2019-02-08 09:56:30 +09:00
minjaesong
0f9e13d499 better and random-coloured grass 2019-02-08 09:27:13 +09:00
minjaesong
1c874f92c2 light: skipping some of the update round wasn't a good idea 2019-02-07 18:04:34 +09:00
minjaesong
833f1a83e6 Font fixed, clearing issue #19 #23 2019-02-07 17:31:55 +09:00
minjaesong
091c8cef48 re-impl of once-scrapped "No-op Mask", and it works 2019-02-06 23:31:21 +09:00
minjaesong
36c6cb78ba inventory screen doesn't need two char info display 2019-02-06 11:05:58 +09:00
minjaesong
88a1beb271 player info cell, INVENTORY UI LEAKS MEMORY 2019-02-06 05:18:00 +09:00
minjaesong
f63e6ed37c lang update (+delete world, worlds: ) 2019-02-06 05:17:02 +09:00
minjaesong
bbb2dab710 Lightmap: i'm only doing round 2-4-2 and it works?! 2019-02-04 22:59:42 +09:00
minjaesong
5d12dad974 removing maxBlend function; only use maxAndAssign from now on 2019-02-04 18:47:16 +09:00
minjaesong
efafb3c2b9 disabling clamp() on Gdx.color makes it 1+ms faster? 2019-02-04 17:49:43 +09:00
minjaesong
820d314e6a blockprop opacity to be actually cached 2019-02-04 17:17:48 +09:00
minjaesong
d13c74dc0c histogram to display UV values 2019-02-04 05:23:07 +09:00
minjaesong
9781cd961a quicker camera on buildingmaker 2019-02-04 01:37:31 +09:00
minjaesong
072f6564fe fixing mouseUp on NSMenu; making pen on buildingmaker work 2019-02-03 23:53:46 +09:00
minjaesong
8da8fdb863 F3 moved to PostProcessor; palette UI for buildingmaker 2019-02-03 17:01:27 +09:00
minjaesong
c476ca0d99 #12 event for world block change -- mainly meant for fixture updating itself 2019-02-02 01:58:49 +09:00
minjaesong
1e4e4d2b94 blocksdrawer use offsetted time_t 2019-02-02 01:08:14 +09:00
minjaesong
2162c755ce closing #22 2019-02-01 22:45:34 +09:00
minjaesong
91e0a2ad86 application icons 2019-02-01 20:15:19 +09:00
minjaesong
f712c143d0 #21, also making seasonal grasses easier on PSD 2019-02-01 18:47:02 +09:00
minjaesong
2610f44697 wall block item to use its own texture (for real) 2019-02-01 17:28:08 +09:00
minjaesong
e2dec79ca5 terrain texture change by all seasons 2019-02-01 15:59:54 +09:00
minjaesong
29fbad889b fixed notificator UI 2019-01-31 20:54:25 +09:00
minjaesong
6d19347dfb nsmenu to invoke class with defined args; working settime on buildingmaker 2019-01-31 18:01:33 +09:00
minjaesong
1610b63672 making sure unused screen be disposed, and not breaking the app 2019-01-31 13:29:40 +09:00
minjaesong
7a5b1df81c fix memory leak from my ididcy; relationship w #19 needs investigation 2019-01-31 05:02:44 +09:00
minjaesong
dd44ae1eea language is moved inside of options 2019-01-31 03:27:03 +09:00
minjaesong
b3e323965f adjusting disposing behavs so that we can go back and forth the ingame and titlescr 2019-01-31 00:12:38 +09:00
minjaesong
1475fa08dc inventory gamemenu visual only 2019-01-29 23:37:38 +09:00
minjaesong
aef07149b4 3 screens impl of inventory UI wip 2019-01-29 20:24:11 +09:00
minjaesong
7f7c31d27f nice try, but it crashes the gpu AND I get <1 fps :( 2019-01-29 17:35:56 +09:00
minjaesong
882cd86dd4 wrong colour fixed -- Gdx.Color.toIntBits() returns ABGR, GLSL expects RGBA 2019-01-29 03:04:01 +09:00
minjaesong
b842780761 gpu rendered light wip 2019-01-29 02:21:22 +09:00
minjaesong
45fa56cb23 inventory ui won't always draw item count 2019-01-28 19:22:47 +09:00
minjaesong
1ffa71215a amount of fluid affects the light absorption 2019-01-27 16:58:29 +09:00
minjaesong
89ecdbc608 nuked fluidcodex 2019-01-27 05:09:52 +09:00
minjaesong
50d883260c so not making new objs frequently does make it bit faster... 2019-01-27 02:09:20 +09:00
minjaesong
02f9a5e127 light calc takes fluid into account 2019-01-27 00:30:56 +09:00
minjaesong
55cfae831a new watch design consistent with existing UI 2019-01-24 23:46:24 +09:00
minjaesong
4ddf037626 new TV-safe watch UI 2019-01-24 02:32:28 +09:00
minjaesong
a2af6bc84d gapbox toggle with F11 2019-01-23 12:45:40 +09:00
minjaesong
05094b6938 less intrusive gapbox colours 2019-01-23 03:52:28 +09:00
minjaesong
200ff94ff8 F12 for screenshot; it's high time to care about TVs
(besides, the EBU gap is also a good guideline for placing UIs on edge)
2019-01-23 03:46:46 +09:00
minjaesong
78cf9298e1 equipped items are drawn into their respective slot 2019-01-23 00:50:20 +09:00
minjaesong
12b42799e1 greater number of inventory cells 2019-01-23 00:09:31 +09:00
minjaesong
6d638e1269 small number font moved to apploader 2019-01-22 23:05:29 +09:00
minjaesong
a28e325f45 glsl works differently on my macbook? 2019-01-22 22:23:30 +09:00
minjaesong
ac9547c720 adding demoworld.gz 2019-01-22 21:34:00 +09:00
minjaesong
43b349d5ca adding gradle-wrapper.jar 2019-01-22 21:27:56 +09:00
minjaesong
ea1fd31c24 initial screen size is read from the config 2019-01-22 20:56:16 +09:00
minjaesong
07373e13d2 smoothDelta is now come from Gdx's LwjglGraphics instead of AppLoader 2019-01-22 13:16:21 +09:00
minjaesong
a59a1d5c2f test impl kalman delta on gdx 2019-01-22 06:30:11 +09:00
minjaesong
86fdeaf096 copyright update 2019-01-22 05:57:38 +09:00
minjaesong
e5fec2c22c implementing the iconic 'lag behind' camera the right way 2019-01-22 05:46:26 +09:00
minjaesong
a6921fe924 game actually reads fps setting from config 2019-01-22 05:29:03 +09:00
minjaesong
b18365dd95 some classes in sprite assembler is now internal 2019-01-22 03:51:18 +09:00
minjaesong
20e8b9eee0 ingame will only render visible actor 2019-01-22 03:50:35 +09:00
minjaesong
6d0616a7bd instead of dealing with delta, we'll just update multiple times, THIS TIME IN CORRECT WAY
(because it really works :p)
2019-01-22 02:59:22 +09:00
minjaesong
5260dc437c the entire game will use new smooth delta 2019-01-21 05:22:49 +09:00
minjaesong
f1499e3e48 forgot to comment out the debug print 2019-01-21 01:44:19 +09:00
minjaesong
34a9d39516 I'll settle with 'Kalman filter with adaptive reset' 2019-01-20 22:50:22 +09:00
minjaesong
b488fe7083 smooth delta uses framerate-averaged instead of raw delta; stupid but works :\ 2019-01-20 21:46:11 +09:00
minjaesong
38c847443c trying to get smooth delta (because fuck you GDX) 2019-01-20 20:13:56 +09:00
minjaesong
b4d97fc42e issue #16: jump height is "close enough", friction and walk/stop needs fix 2019-01-20 07:03:23 +09:00
minjaesong
fc26f9af52 the simplest case of noclip=true 2019-01-20 06:43:59 +09:00
minjaesong
677cbd934a reverting changes on ActorWBMovable: gotta make new branch 2019-01-20 06:39:01 +09:00
minjaesong
5786b843e4 removing default batch on blendxxx() funs 2019-01-20 03:09:23 +09:00
minjaesong
9ca078687f issue #16: walking fixed, jump not 2019-01-19 16:44:59 +09:00
minjaesong
971f7d4a40 on-the-fly sprite assembly WIP 2019-01-19 04:34:50 +09:00
minjaesong
4c89c1d4c5 spriteassembler: oob bodyparts will clip, as they should be
...to hide unwanted bodyparts in the skeleton
2019-01-18 18:59:05 +09:00
minjaesong
42812b8186 parallel light always does this random noise 2019-01-18 04:24:14 +09:00
minjaesong
ff0dade5c8 f 2019-01-18 03:14:37 +09:00
minjaesong
a379c7dea8 light: seems like the problem is the ram access time 2019-01-17 21:08:50 +09:00
minjaesong
b594c3b053 still working on light, no improvements perf-wise 2019-01-17 18:28:43 +09:00
minjaesong
0397c47aad light: lantern lookup should be faster 2019-01-17 16:06:00 +09:00
minjaesong
b8bf1d2412 all my confusions were derived from not wiping old map; fixed things accordingly 2019-01-17 15:12:52 +09:00
minjaesong
fdd89b1b76 light: slightly improved performance with careful skipping
(hopefully...)
2019-01-17 06:52:04 +09:00
minjaesong
e40bdfe066 added some features and comments for coding convenience 2019-01-17 05:32:52 +09:00
minjaesong
170a73bbd8 ui itemlist scrolls with wheel 2019-01-16 01:37:44 +09:00
minjaesong
e844d12aa5 lol 2019-01-16 01:23:23 +09:00
minjaesong
a297fc3dfe taking screenshot 2019-01-15 16:10:40 +09:00
minjaesong
797b81d64b fixing a new GDX version colouring bug 2019-01-15 06:05:43 +09:00
minjaesong
a64da6454b See Github issue #15 2019-01-15 05:50:36 +09:00
minjaesong
7cd2b55b97 adding test code to export fboRGB 2019-01-15 03:02:40 +09:00
minjaesong
8c4793bea5 a setup to mitigate directional artefacts in light 2019-01-15 01:18:54 +09:00
minjaesong
a7ec3e77b1 map data format adds world generator version and fluids 2019-01-14 23:15:01 +09:00
minjaesong
edda3b9ff9 width fixes in UI 2019-01-14 02:46:23 +09:00
minjaesong
eb404b7723 trying to work on issue #15 and I'm stumped 2019-01-13 23:51:04 +09:00
minjaesong
e926b0175f Gzipping PSDs; every art must be alpha premultiplied; added converter batch 2019-01-13 21:23:01 +09:00
minjaesong
4cec6fac69 copyright update 2019-01-13 04:42:40 +09:00
minjaesong
865ac11051 grey box issue fixed (github issue #13) 2019-01-13 04:06:53 +09:00
minjaesong
0be6678c34 UI: quickslot register; IngameController: quickslot selection using wheel
This closes github issue #14
2019-01-13 03:02:57 +09:00
minjaesong
d9c7d3c681 quickslot selections are controlled by the ingame rather than the 'bar UI' 2019-01-13 02:17:49 +09:00
minjaesong
822b9bf4fd fixed various quirks and removed dirty hacks on quickslot bar/pie 2019-01-12 22:56:48 +09:00
minjaesong
7900628d9e fixed wrong coords 2019-01-12 00:59:15 +09:00
minjaesong
2f335e5c5f lightmap edge-case fixed
when camera.x is in -15..-1, all thing shifts to left
2019-01-11 04:44:52 +09:00
minjaesong
90cbf85047 TerrarumSansBitmap update 2019-01-11 03:07:10 +09:00
minjaesong
f6ebb14861 tooltip positioning should work again 2019-01-11 03:06:45 +09:00
minjaesong
ba9236d11e csv sort by ID (hacky?) 2019-01-09 15:15:26 +09:00
minjaesong
808797760d circular array is fixed and tested 2019-01-09 05:43:56 +09:00
minjaesong
adf45b1f68 prolonged alpha blending issue seemingly fixed?
at least it's partially fixed...
2019-01-07 17:34:47 +09:00
minjaesong
5fefb38383 sprite tool exports "formatted" TGA
meaning if alpha is zero, RGB is also zero
2019-01-07 17:11:43 +09:00
minjaesong
df2973b713 gradle tasks for two new apps 2019-01-07 14:19:15 +09:00
minjaesong
6e5d2cf7ed sprite assembler can produce intended output 2019-01-07 05:01:28 +09:00
minjaesong
25fc4ecc0b ALL kwd in transform implemented 2019-01-07 04:24:13 +09:00
minjaesong
45f07c88b2 first successful sprite assembly
ALL kwd still not implemented
2019-01-07 04:13:38 +09:00
minjaesong
77d91ab8a5 screw AWT, we'll use GDX for sprite preview 2019-01-07 00:35:20 +09:00
minjaesong
d366959f9a TODO added: when the transform joint is "ALL" 2019-01-06 22:45:51 +09:00
minjaesong
d6075b4334 adproperties now has transforms list; assembler can make transformed skeleton
new fun: LinearSearch(By)
2019-01-06 22:43:50 +09:00
minjaesong
7978d8b8e0 updated the psd with the actual assembly 2019-01-06 19:28:06 +09:00
minjaesong
843fcb4c27 animation metadata now contains discovered frame count
...in hacky way
2019-01-06 15:13:17 +09:00
minjaesong
5d75d46780 ADProperties now properly stores parsed mumbojumbo 2019-01-06 04:19:21 +09:00
minjaesong
0fd0ba6b53 fixed a bug properties view won't show scroll bars 2019-01-06 03:25:40 +09:00
minjaesong
55a43d818b adproperties now hold filename-related info 2019-01-06 02:57:49 +09:00
minjaesong
962948c9f8 sprite assembler app can read and disp ADL
garbage code not properly handled
2019-01-06 02:06:51 +09:00
minjaesong
9b0ea53c2d sprite assembler test assets 2019-01-06 00:30:43 +09:00
minjaesong
73af014ea4 joints in skeleton are ordered according to drawing order, PSD also updated 2019-01-05 16:53:21 +09:00
minjaesong
d0fef35eb7 TIL you can go multiline on Java .properties 2019-01-05 16:33:40 +09:00
minjaesong
e9a8c75fa1 skeleton datasets from sprite_joints.psd 2019-01-05 16:23:19 +09:00
minjaesong
4b725a56d7 testing how joints of sprites should look like
humanoid only
2019-01-05 04:53:22 +09:00
minjaesong
576e2160ad parsing ADL
a road to auto-gen'd spriteanimation spritesheet
2019-01-05 02:19:56 +09:00
minjaesong
73da060d5c forgot to update tga file 2019-01-04 21:19:11 +09:00
minjaesong
9bcf8fa478 somewhat successful walk/idle anim impl 2019-01-04 17:44:22 +09:00
minjaesong
a8cb95ed74 write to the actual file 2019-01-03 13:02:54 +09:00
Minjae Song
fcc0403c93 new csv and it asks number of lines to init 2019-01-02 22:41:20 +09:00
Minjae Song
aab258b0c8 csv reader can read file, stringify (not real save) and read the save itself wrote 2019-01-02 22:25:44 +09:00
Minjae Song
686e521a7a csv editor read file with imperfections 2019-01-02 22:03:52 +09:00
Minjae Song
5ef871f920 CSV editor: test export of spreadsheet
Seems working?
2019-01-02 10:55:32 +09:00
Minjae Song
ccd67b2625 watch is semitransparent when EL is off 2019-01-01 22:29:18 +09:00
Minjae Song
546ddfdb19 csv editor wip 2019-01-01 21:00:33 +09:00
Minjae Song
977a79e666 New year's first commit
is just a comment
2019-01-01 00:10:37 +09:00
Minjae Song
8a0a264a19 slow descend of the platform fixed 2018-12-31 21:34:50 +09:00
Minjae Song
1263360d06 more screwing around and commenting 2018-12-31 00:50:44 +09:00
Minjae Song
738d5e669a platform sorta works as intended 2018-12-31 00:00:47 +09:00
Minjae Song
fdae5bce06 removing useless list "affectingTiles" 2018-12-30 23:41:57 +09:00
Minjae Song
ba53720b80 platform going down with Down button on keeb 2018-12-30 20:17:28 +09:00
Minjae Song
bd12cdeab6 jumping up to the platform working 2018-12-30 20:02:24 +09:00
Minjae Song
a0b773aef2 WIP platforms, at least "should I collide with this?" is one single function 2018-12-30 19:50:22 +09:00
Minjae Song
3765678735 removed FLUID prop from the blocks 2018-12-29 21:04:27 +09:00
Minjae Song
59531ea1ba WIP removing fluid marker block
see "work_files/todo_platforms.png"
2018-12-29 17:04:46 +09:00
Minjae Song
f417ce00dc detailed impl of fixtures WIP 2018-12-29 04:11:26 +09:00
Minjae Song
1afd50cf2d Summary
Description
2018-12-26 19:26:08 +09:00
Minjae Song
1163f51c6b reduced boot time by not using proper wall tex; darker wall draw 2018-12-25 16:28:38 +09:00
Minjae Song
288fa46418 still cleaning up
Making wall item textures takes SO long
2018-12-25 15:39:01 +09:00
Minjae Song
a899462333 have been forgetting to update fullscreenquad on resize :\ 2018-12-25 05:34:59 +09:00
Minjae Song
934b252314 when it's not dev build, title bar shows less info
they take some processing time
2018-12-25 01:58:18 +09:00
Minjae Song
46284be77d moved things a lot just so that splash screen shows up WHILE things load 2018-12-25 01:39:22 +09:00
Minjae Song
3546213f34 Added JoiseDoc 2018-12-24 22:49:08 +09:00
Minjae Song
ba3e323572 simplified fluid render 2018-12-23 02:13:41 +09:00
Minjae Song
2c1f7eec23 new version number
eheheheh
2018-12-22 02:10:33 +09:00
Minjae Song
e5ea32ba56 rendering scheme of the world changed, fluids draw as intended
But my idea wasn't very stellar, *sigh*
2018-12-22 02:08:08 +09:00
Minjae Song
92d3c578a9 prep for fluid exclusive render 2018-12-19 22:23:50 +09:00
Minjae Song
597e1acee4 fluidmap won't have errenous behaviour at the world edge; tga alpha fix 2018-12-19 01:53:09 +09:00
Minjae Song
23d557b6b2 water flow works
turns out, var.coerceIn() returns value and does not modify the var
2018-12-18 01:48:38 +09:00
Minjae Song
62319ba4d2 fluid multiplies themselves ?! 2018-12-17 22:39:19 +09:00
Minjae Song
8db2405232 test: tiles tex blend according to seasons 2018-12-17 04:30:08 +09:00
Minjae Song
246119a5de duh 2018-12-16 16:17:05 +09:00
Minjae Song
a7d12b2b54 rename TARGET_FPS to PHYS_TIME_FRAME; shader to use multiple atlas tex; and things 2018-12-16 15:30:25 +09:00
Minjae Song
cd752bc763 at least this fluid sim passes collection assertion codes 2018-12-16 02:55:12 +09:00
Minjae Song
8e6fcf0b8a bugs on fluid sim, Type is NULL but fill isn't 0/new temporary fluid draw 2018-12-16 02:10:04 +09:00
Minjae Song
4aa9ad6b14 blockingthreadpool test done
not very effective
2018-12-15 14:43:55 +09:00
Minjae Song
5fa93ed43d noise generator: automated test and reporting 2018-12-14 23:19:40 +09:00
Minjae Song
513c5a17eb new thread pooling strategy and test program WIP 2018-12-14 22:53:25 +09:00
Minjae Song
6f49dcff4b Update ThreadParallel.kt 2018-12-14 15:06:55 +09:00
Minjae Song
cc67f69fff working very crude fluid sim 2018-12-14 00:52:10 +09:00
Minjae Song
6e3a739480 implementing water sim but not actually working 2018-12-13 04:45:09 +09:00
Minjae Song
7a06b2cc90 preparing fluid updater: debug water bucket 2018-12-12 23:29:30 +09:00
Minjae Song
a53f9b8aad perhaps missed this from before? 2018-12-12 20:47:06 +09:00
Minjae Song
95245c8945 replacing water/lava tiles with one fluid marker
actual fluid not implemented
2018-12-12 20:32:13 +09:00
Minjae Song
6e4cea28e7 see page 9 2018-12-12 18:49:18 +09:00
Minjae Song
5382c8cece fluid layer data and fluid sim specifications
See added note FLUID_SIMULATION
2018-12-12 18:39:14 +09:00
Minjae Song
5e4f3b67c2 adjusted items ID range for more static items 2018-12-12 03:00:49 +09:00
Minjae Song
bfea5c9936 support for screen-overlay actors; buildingmaker has light now 2018-12-12 02:52:33 +09:00
Minjae Song
c7d7ae03c0 nonprivate lateinits are bitch 2018-12-11 16:39:27 +09:00
Minjae Song
e0f72aafad Summary 2018-12-11 16:14:11 +09:00
Minjae Song
14d720fe53 Merge remote-tracking branch 'origin/master' 2018-12-11 16:08:41 +09:00
Minjae Song
55ba2d03ab matching blendglow's version with others 2018-12-11 11:06:03 +09:00
Minjae Song
0e7edd52f7 things "look" good enough, should stop here and work on the main game 2018-12-11 04:02:23 +09:00
Minjae Song
6e2809404a fix: textbuttonlist selector appearance bug, nsmenu not closing its child 2018-12-11 02:22:31 +09:00
Minjae Song
7fb403c4bc other commit didn't work, duh; this SHOULD fix shit
the other commit: "prev commit didn't work" at 2018-12-09 (1f785a376b)
2018-12-10 20:35:54 +09:00
Minjae Song
3d68ae2f01 yaml: adding generic parse-as-invokable 2018-12-10 04:15:57 +09:00
Minjae Song
06c6c68dba nsmenu working submenu navigation; new graphics bug discovered 2018-12-10 03:33:08 +09:00
Minjae Song
b44699ae04 UINSMenu is made to show how to code 'UI dragging' 2018-12-09 20:00:52 +09:00
Minjae Song
0c20ed3418 NSMenu WIP 2018-12-09 17:51:17 +09:00
Minjae Song
1f785a376b prev commit didn't work 2018-12-09 17:31:17 +09:00
Minjae Song
eb1a3dcd14 textbuttonlist fixed incorrect vertical placement 2018-12-09 17:24:26 +09:00
Minjae Song
32ecdc4b4d 'the entire screen is shifted!' bug fixed 2018-12-09 13:38:25 +09:00
minjaesong
c8613c5254 NSMenu WIP, but also caught a source of the old bug 2018-12-09 04:40:46 +09:00
minjaesong
d0e0f8dd8d moved white box tex to AppLoader; textButton now has alignment option 2018-12-09 04:36:53 +09:00
minjaesong
59c6876849 making Yaml and BFS of QNDTree work 2018-12-09 01:52:57 +09:00
minjaesong
11f7fa5c9a WIP new UI elem 2018-12-08 23:26:01 +09:00
minjaesong
20dfc95d0d replaced a hack that starts random game on title screen 2018-12-08 18:30:10 +09:00
minjaesong
91ade00bbb bringing back onscreen debug info 2018-12-08 05:05:42 +09:00
minjaesong
dffb3f95a2 Memory leak alleviated FUCK YEAH? 2018-12-08 04:26:01 +09:00
minjaesong
7570c9674b Update LightmapRendererNew.kt 2018-12-07 06:15:41 +09:00
minjaesong
1eca234d68 why they are keep resurrecting 2018-12-03 22:37:51 +09:00
minjaesong
ed62176d2d Update .gitignore 2018-12-03 11:05:35 +09:00
minjaesong
ea490435eb exit now gracefully calls gdx.app.exit 2018-12-03 00:34:31 +09:00
minjaesong
0902dac646 removing kotlin-stdlib.jar again duuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuh 2018-12-03 00:25:01 +09:00
minjaesong
84d42611fe Merge branch 'gradle-migration-1' 2018-12-02 23:01:25 +09:00
minjaesong
9282aecd0f removing unused and failed opus impl attempts 2018-12-02 22:45:08 +09:00
minjaesong
158df1cac0 gradle migration 1 2018-12-02 19:31:38 +09:00
minjaesong
3ae6ea5e71 Update .gitignore 2018-12-02 19:28:38 +09:00
minjaesong
26f7eba339 Update .gitignore 2018-12-02 19:19:17 +09:00
minjaesong
c9c9015fd1 minor edits 2018-12-02 17:34:01 +09:00
minjaesong
24b03403f7 minor edits 2018-12-02 17:34:01 +09:00
minjaesong
fe155a1c7d rem external_resource_packs.zip 2018-11-22 19:14:49 +09:00
minjaesong
54087db2e8 rem external_resource_packs.zip 2018-11-22 19:14:49 +09:00
minjaesong
0a2c1d552a rem workspace.xml 2018-11-22 19:09:48 +09:00
minjaesong
101a65a337 rem workspace.xml 2018-11-22 19:09:48 +09:00
minjaesong
0ce441b218 fixing one of the new bugs: block duplication artefact on render 2018-11-20 22:16:20 +09:00
minjaesong
0e6eaf2db9 fixing one of the new bugs: block duplication artefact on render 2018-11-20 22:16:20 +09:00
minjaesong
eb9b7fba8a physics anomaly at x 0..33? are fixed, other issues (re)introduced
See ActorWBMovable@Line1238
2018-11-20 06:08:21 +09:00
minjaesong
9e327c091c physics anomaly at x 0..33? are fixed, other issues (re)introduced
See ActorWBMovable@Line1238
2018-11-20 06:08:21 +09:00
minjaesong
795ba4a511 Reverting GDX to nightly-20170610
Due to the some fuck rendering issue on certain graphics processors (maybe?)
2018-11-20 04:27:14 +09:00
minjaesong
e5f5c71e56 Reverting GDX to nightly-20170610
Due to the some fuck rendering issue on certain graphics processors (maybe?)
2018-11-20 04:27:14 +09:00
minjaesong
0973d5e9ff commiting minor changes cause I need to track down some bugs
- Text on small font goes dark gradually (?)
2018-11-20 04:10:13 +09:00
minjaesong
133c37456f commiting minor changes cause I need to track down some bugs
- Text on small font goes dark gradually (?)
2018-11-20 04:10:13 +09:00
minjaesong
d7b8acf1c4 1dim-ised lightmap 2018-11-16 22:44:54 +09:00
minjaesong
6c998b616b 1dim-ised lightmap 2018-11-16 22:44:54 +09:00
minjaesong
d2e6b432a7 lightbufferastex is now properly disposed of
should help with my mem leak probs
2018-11-16 20:42:30 +09:00
minjaesong
c8209b49f3 lightbufferastex is now properly disposed of
should help with my mem leak probs
2018-11-16 20:42:30 +09:00
minjaesong
d8eb92389b change in ingame config: useamericanunit -> temperatureunit 2018-11-16 20:37:44 +09:00
minjaesong
7b3ad18e85 change in ingame config: useamericanunit -> temperatureunit 2018-11-16 20:37:44 +09:00
minjaesong
1157497e3b reconfiguring docs and libs
- Targeting Java 10
- Gdx nightly 20181111 (1.9.9)
2018-11-11 20:13:31 +09:00
minjaesong
2b16d05b52 reconfiguring docs and libs
- Targeting Java 10
- Gdx nightly 20181111 (1.9.9)
2018-11-11 20:13:31 +09:00
minjaesong
10ee5f0f0f drawing of the tile breakage 2018-11-10 21:09:02 +09:00
minjaesong
fa675f1658 drawing of the tile breakage 2018-11-10 21:09:02 +09:00
minjaesong
688294120c Can setTitle() cause memleak (right before test commit) 2018-11-08 22:42:27 +09:00
minjaesong
83bd81853f Can setTitle() cause memleak (right before test commit) 2018-11-08 22:42:27 +09:00
minjaesong
97f8a546b6 starting day of the game is now Spring 1st 2018-11-06 23:49:22 +09:00
minjaesong
84d102a3fb starting day of the game is now Spring 1st 2018-11-06 23:49:22 +09:00
minjaesong
65f49e11b2 a new watchface to support seasons instead of months 2018-11-06 23:40:36 +09:00
minjaesong
71f387ed94 a new watchface to support seasons instead of months 2018-11-06 23:40:36 +09:00
minjaesong
9b087f0ae5 fixed a NaN bug caused by a zero-width/height hitbox
Also inventory is widened to 10x7 of prev 9x7
2018-11-06 04:02:33 +09:00
minjaesong
61c5460701 fixed a NaN bug caused by a zero-width/height hitbox
Also inventory is widened to 10x7 of prev 9x7
2018-11-06 04:02:33 +09:00
minjaesong
cb78f3dbab new ingame calendar impl
for some reason it runs slower that it should do
2018-10-30 22:47:41 +09:00
minjaesong
377b1dfb4b new ingame calendar impl
for some reason it runs slower that it should do
2018-10-30 22:47:41 +09:00
minjaesong
dd36d3cb5f new RNG for everything; Joise update 2018-10-27 00:03:06 +09:00
minjaesong
3d1581d0e4 new RNG for everything; Joise update 2018-10-27 00:03:06 +09:00
minjaesong
0c289b870f read world info 2018-10-09 23:49:14 +09:00
minjaesong
22bbc8816c read world info 2018-10-09 23:49:14 +09:00
minjaesong
d435ec4ebb writeworldinfo tested to be working 2018-10-08 18:15:05 +09:00
minjaesong
d68ffb3973 writeworldinfo tested to be working 2018-10-08 18:15:05 +09:00
Minjae Song
783313a4ae worldinfo writer 2018-10-08 01:16:29 +09:00
Minjae Song
5005b25051 worldinfo writer 2018-10-08 01:16:29 +09:00
Minjae Song
26b81e23bb new outputstream for bytearray64 2018-10-06 01:16:26 +09:00
Minjae Song
7748f5d222 new outputstream for bytearray64 2018-10-06 01:16:26 +09:00
minjaesong
d71744b240 testing the GDX's LZMA de/compressor 2018-10-06 00:49:06 +09:00
minjaesong
756e8fdfd2 testing the GDX's LZMA de/compressor 2018-10-06 00:49:06 +09:00
minjaesong
83fd44df4c abolished a need to pass world as parametre
+ simply changing the single variable (ingame.world) will update all the renderer's behaviour
+ somehow my git changelogs are exploding
2018-10-05 23:40:03 +09:00
minjaesong
0cb64ece86 abolished a need to pass world as parametre
+ simply changing the single variable (ingame.world) will update all the renderer's behaviour
+ somehow my git changelogs are exploding
2018-10-05 23:40:03 +09:00
minjaesong
5641910036 layer seems load, need to write better test-able code 2018-10-05 22:13:55 +09:00
minjaesong
37153be10a layer seems load, need to write better test-able code 2018-10-05 22:13:55 +09:00
minjaesong
4d538cae89 layer write should write proper zlib 2018-10-05 01:23:18 +09:00
minjaesong
5b4e458878 layer write should write proper zlib 2018-10-05 01:23:18 +09:00
minjaesong
1d67a9a9ce it's not zipping correctly; some fixes on readlayer 2018-10-05 01:11:12 +09:00
minjaesong
4643c71269 it's not zipping correctly; some fixes on readlayer 2018-10-05 01:11:12 +09:00
minjaesong
374070e9b9 layer export: tested output seems legit but can't confirm 2018-10-04 23:46:24 +09:00
minjaesong
5b1f9874f4 layer export: tested output seems legit but can't confirm 2018-10-04 23:46:24 +09:00
minjaesong
071dc85b94 GameWorld: adding "worldIndex"; more save/load stuffs 2018-10-03 23:15:24 +09:00
minjaesong
6a218c2632 GameWorld: adding "worldIndex"; more save/load stuffs 2018-10-03 23:15:24 +09:00
minjaesong
b380fa7ce7 new map data format and its read/writer
!! UNTESTED !! UNTESTED !! UNTESTED !!
2018-10-03 19:20:11 +09:00
minjaesong
2b6902b28f new map data format and its read/writer
!! UNTESTED !! UNTESTED !! UNTESTED !!
2018-10-03 19:20:11 +09:00
minjaesong
60752ad4c1 decided not to GZip the CSVs; hack it away! 2018-10-02 21:13:02 +09:00
minjaesong
e9baecf93f decided not to GZip the CSVs; hack it away! 2018-10-02 21:13:02 +09:00
minjaesong
89657167e9 newer map data format 2018-10-02 21:10:02 +09:00
minjaesong
2b3252beff newer map data format 2018-10-02 21:10:02 +09:00
minjaesong
52c116bad5 the event works; ingame works; but starts as "bugged noclip" 2018-10-02 00:12:04 +09:00
minjaesong
82a71dae66 the event works; ingame works; but starts as "bugged noclip" 2018-10-02 00:12:04 +09:00
minjaesong
f365156799 World Click events
let's hope it works w/o tests as I can't get to the Ingame now
2018-10-01 23:51:04 +09:00
minjaesong
76ab620247 World Click events
let's hope it works w/o tests as I can't get to the Ingame now
2018-10-01 23:51:04 +09:00
minjaesong
6a1146f67b player is now nullable; wtf is calling Ingame 5 times? 2018-09-17 01:46:50 +09:00
minjaesong
d95eaf5be0 player is now nullable; wtf is calling Ingame 5 times? 2018-09-17 01:46:50 +09:00
minjaesong
ef8285dd97 serialised RNG; font update 2018-09-16 03:32:12 +09:00
minjaesong
5049400b3b serialised RNG; font update 2018-09-16 03:32:12 +09:00
minjaesong
07724942b0 title remocon: menu UI with no child should be displayed now 2018-09-15 01:08:10 +09:00
minjaesong
930598b5de title remocon: menu UI with no child should be displayed now 2018-09-15 01:08:10 +09:00
minjaesong
3309998060 font update; ui remocon fix; save doc elaboration
UI RemoCon fix: RemoCon will no longer widen to the screen width when being used
2018-09-14 01:14:13 +09:00
minjaesong
82a39d6605 font update; ui remocon fix; save doc elaboration
UI RemoCon fix: RemoCon will no longer widen to the screen width when being used
2018-09-14 01:14:13 +09:00
minjaesong
16854a4be5 more remoCon thingies 2018-08-30 21:30:39 +09:00
minjaesong
e9de8d556c more remoCon thingies 2018-08-30 21:30:39 +09:00
minjaesong
6c4c0214a1 UI Remote Controller reworked (now 90% less stupidity) 2018-08-30 17:24:53 +09:00
minjaesong
6070461da9 UI Remote Controller reworked (now 90% less stupidity) 2018-08-30 17:24:53 +09:00
minjaesong
e7a1a8ca85 font updates; PBS 2018-08-23 21:06:08 +09:00
minjaesong
45bcb7a3b5 font updates; PBS 2018-08-23 21:06:08 +09:00
minjaesong
3b6c6e1605 partially working sky model 2018-08-05 21:57:39 +09:00
minjaesong
0e127f04fa partially working sky model 2018-08-05 21:57:39 +09:00
minjaesong
6ed012f0c1 dump (another useless message) 2018-08-05 21:57:18 +09:00
minjaesong
5d08bc6799 dump (another useless message) 2018-08-05 21:57:18 +09:00
minjaesong
0d05a40f8f ENVIRON guide update straight from my observation 2018-07-21 19:58:56 +09:00
minjaesong
279ea0a9ad ENVIRON guide update straight from my observation 2018-07-21 19:58:56 +09:00
minjaesong
98d9cc49c1 reducing down HistoricalFigure to nothing
It doesn't seem like a good idea
2018-07-03 22:45:00 +09:00
minjaesong
a0cf55642c reducing down HistoricalFigure to nothing
It doesn't seem like a good idea
2018-07-03 22:45:00 +09:00
minjaesong
a702aac12f removing branching on tiling shader, improving performance
Now tga export needs extra care, but boy that 5 FPS improvement
2018-07-03 22:17:34 +09:00
minjaesong
cca58143d8 removing branching on tiling shader, improving performance
Now tga export needs extra care, but boy that 5 FPS improvement
2018-07-03 22:17:34 +09:00
minjaesong
7f332db2b3 making debugwindow to appear again 2018-07-03 14:33:20 +09:00
minjaesong
36c5e2de34 making debugwindow to appear again 2018-07-03 14:33:20 +09:00
minjaesong
86894b60dc intro screen flipped correctly, build passes 2018-07-03 14:28:30 +09:00
minjaesong
f544a5f929 intro screen flipped correctly, build passes 2018-07-03 14:28:30 +09:00
minjaesong
3184e33461 PostProcessor working: nested FBO won't work, use FrameBufferManager 2018-07-03 13:48:34 +09:00
minjaesong
8377fe2156 PostProcessor working: nested FBO won't work, use FrameBufferManager 2018-07-03 13:48:34 +09:00
minjaesong
1250bb49c4 title screen using IngameRenderer 2018-07-01 01:38:07 +09:00
minjaesong
702cddcc5c title screen using IngameRenderer 2018-07-01 01:38:07 +09:00
minjaesong
cf04b7d22a IngameRenderer: damned thing finally works somewhat 2018-06-30 16:47:22 +09:00
minjaesong
ab27522eae IngameRenderer: damned thing finally works somewhat 2018-06-30 16:47:22 +09:00
minjaesong
54a38407e2 still broken, still renders
because im going to break it once again
See my comment in PostProcessor.kt
2018-06-28 21:31:39 +09:00
minjaesong
ce10b69aaa still broken, still renders
because im going to break it once again
See my comment in PostProcessor.kt
2018-06-28 21:31:39 +09:00
minjaesong
11aa7f5cb1 trying to optimise the rendering, this is BEFORE job 2018-06-26 09:10:05 +09:00
minjaesong
673008ecfc trying to optimise the rendering, this is BEFORE job 2018-06-26 09:10:05 +09:00
minjaesong
a6ea2b4e18 still wip modularisation, game somehow boots 2018-06-21 17:33:22 +09:00
minjaesong
ac09fa50e2 still wip modularisation, game somehow boots 2018-06-21 17:33:22 +09:00
minjaesong
f0a6f8b9c2 scrollable inventory with up/down UI button 2018-05-09 19:41:04 +09:00
minjaesong
391cbcff34 scrollable inventory with up/down UI button 2018-05-09 19:41:04 +09:00
minjaesong
f0907d9737 ModMgr: I can load class by name; dropped Groovy script support, coding must go to JAR 2018-05-09 05:34:39 +09:00
minjaesong
0e6682083d ModMgr: I can load class by name; dropped Groovy script support, coding must go to JAR 2018-05-09 05:34:39 +09:00
minjaesong
d70aabc1b4 computery stuff and new set of wires 2018-03-04 19:15:43 +09:00
minjaesong
b3a0a1858e computery stuff and new set of wires 2018-03-04 19:15:43 +09:00
minjaesong
dde69d2e7e colourutil update 2018-02-16 10:49:13 +09:00
minjaesong
38464dc20f colourutil update 2018-02-16 10:49:13 +09:00
minjaesong
e565a9f173 adopting Java 9/Kotlin 1.2 2018-02-10 21:40:17 +09:00
minjaesong
e94ebf9949 adopting Java 9/Kotlin 1.2 2018-02-10 21:40:17 +09:00
minjaesong
f8568899d9 rain megaparticle experiment 2017-12-18 20:45:32 +09:00
minjaesong
f5fba1e273 rain megaparticle experiment 2017-12-18 20:45:32 +09:00
minjaesong
3936d381d2 196 dithering instead of 625 2017-12-10 14:33:12 +09:00
minjaesong
70504509b9 196 dithering instead of 625 2017-12-10 14:33:12 +09:00
minjaesong
fc5273b00e cheat detected notification 2017-12-10 14:32:32 +09:00
minjaesong
119ca8ce1e cheat detected notification 2017-12-10 14:32:32 +09:00
minjaesong
02c4a3148b language vars are fully moved to apploader 2017-11-25 22:29:59 +09:00
minjaesong
9ddff94070 language vars are fully moved to apploader 2017-11-25 22:29:59 +09:00
minjaesong
b33309c784 tooltip UI; tooltip in the inventory 2017-11-25 17:56:57 +09:00
minjaesong
dddf005d3d tooltip UI; tooltip in the inventory 2017-11-25 17:56:57 +09:00
minjaesong
40216b1ac9 inventory grid mode buttons working highlight 2017-11-07 23:29:07 +09:00
minjaesong
753f2ebad4 inventory grid mode buttons working highlight 2017-11-07 23:29:07 +09:00
minjaesong
6e589d5324 map & save button for inventory 2017-11-03 22:48:13 +09:00
minjaesong
6fe9ce9da2 map & save button for inventory 2017-11-03 22:48:13 +09:00
minjaesong
f1359386b9 postprocessor for 3dlut colcorr; dithering should be managed in "dirty" way
dirty way: loads dithered/passthru shader according to the game's config (boolean fxdither)
2017-11-02 17:47:52 +09:00
minjaesong
9aa4919bab postprocessor for 3dlut colcorr; dithering should be managed in "dirty" way
dirty way: loads dithered/passthru shader according to the game's config (boolean fxdither)
2017-11-02 17:47:52 +09:00
minjaesong
bb8fc25d14 hacked the titlescreen to fix resize-related UI shit 2017-11-01 15:46:09 +09:00
minjaesong
ce8f6bda75 hacked the titlescreen to fix resize-related UI shit 2017-11-01 15:46:09 +09:00
minjaesong
b2e0913ff5 encumbrance meter for new inventory 2017-10-30 04:28:27 +09:00
minjaesong
56affcd6b4 encumbrance meter for new inventory 2017-10-30 04:28:27 +09:00
minjaesong
132664d3bd black background for inventory 2017-10-29 13:26:34 +09:00
minjaesong
a1a5990490 black background for inventory 2017-10-29 13:26:34 +09:00
minjaesong
341d5e696c working "equipped" view with unequip 2017-10-28 15:07:58 +09:00
minjaesong
d0dea693a7 working "equipped" view with unequip 2017-10-28 15:07:58 +09:00
minjaesong
4e69f21c8b "equipped" indicator on item grid 2017-10-25 05:53:39 +09:00
minjaesong
8aeed037c8 "equipped" indicator on item grid 2017-10-25 05:53:39 +09:00
minjaesong
977df44316 fixed uiItem stupidity with uiCanvas; it activated even if its parent is invisible 2017-10-24 07:25:05 +09:00
minjaesong
a3f9373253 fixed uiItem stupidity with uiCanvas; it activated even if its parent is invisible 2017-10-24 07:25:05 +09:00
minjaesong
d1f3a491f1 catbar and grid: updates and renders as intended 2017-10-24 00:21:13 +09:00
minjaesong
f1c4eb4015 catbar and grid: updates and renders as intended 2017-10-24 00:21:13 +09:00
minjaesong
07c1714751 at least some of the new UIs are working 2017-10-23 03:44:45 +09:00
minjaesong
faec65eb81 at least some of the new UIs are working 2017-10-23 03:44:45 +09:00
minjaesong
dee7e5b522 new inventory design: is it good?
See work_files/inventory_nouveau_2.psd
2017-10-22 02:03:23 +09:00
minjaesong
7379c4d979 new inventory design: is it good?
See work_files/inventory_nouveau_2.psd
2017-10-22 02:03:23 +09:00
minjaesong
0004240c52 somehow fixed a consolewin bug
- It would read a key even if it's closed
2017-10-18 03:52:11 +09:00
minjaesong
0959873826 somehow fixed a consolewin bug
- It would read a key even if it's closed
2017-10-18 03:52:11 +09:00
minjaesong
06db25fb1a lightmap draw shift fixed; game will properly resize 2017-10-16 22:47:16 +09:00
minjaesong
9cf694b5d7 lightmap draw shift fixed; game will properly resize 2017-10-16 22:47:16 +09:00
minjaesong
a66fcd2328 renderFront is fixed 2017-10-14 02:48:52 +09:00
minjaesong
676be82f7f renderFront is fixed 2017-10-14 02:48:52 +09:00
minjaesong
fc3fce2f82 sprite shift re-fixed with a correct method 2017-10-14 02:13:06 +09:00
minjaesong
d225ed9e5f sprite shift re-fixed with a correct method 2017-10-14 02:13:06 +09:00
minjaesong
367304d0bb player sprites now aligned to hitbox && drawn at centre of the screen 2017-10-13 00:36:03 +09:00
minjaesong
162ce046fb player sprites now aligned to hitbox && drawn at centre of the screen 2017-10-13 00:36:03 +09:00
minjaesong
681dd84cb3 Houston, we have a render (again) 2017-10-07 22:21:37 +09:00
minjaesong
969b3e0b81 Houston, we have a render (again) 2017-10-07 22:21:37 +09:00
minjaesong
f1b4252731 Feature idea I had around for months 2017-09-22 00:22:35 +09:00
minjaesong
40af1768a2 Feature idea I had around for months 2017-09-22 00:22:35 +09:00
minjaesong
b16de87dd5 Rectified heretic YY-MM-DD to standard YYYY-MM-DD 2017-09-20 14:36:40 +09:00
minjaesong
3726f34f11 Rectified heretic YY-MM-DD to standard YYYY-MM-DD 2017-09-20 14:36:40 +09:00
minjaesong
5ebb83f1ed Scientifically correct moondial
Flipped crescents are my mistake 😄
2017-09-19 14:43:06 +09:00
minjaesong
31c9b85d6d Scientifically correct moondial
Flipped crescents are my mistake 😄
2017-09-19 14:43:06 +09:00
minjaesong
0e9a96420d we've got something
- except actor's RGB won't draw; only the glow does
2017-09-18 02:32:47 +09:00
minjaesong
05a45feeff we've got something
- except actor's RGB won't draw; only the glow does
2017-09-18 02:32:47 +09:00
minjaesong
10fb2741f1 fixed camera not putting actor at the centre of the screen
- Actually may not be fixed, but it does not cause render bugs at least!
2017-09-17 23:42:13 +09:00
minjaesong
108a44d970 fixed camera not putting actor at the centre of the screen
- Actually may not be fixed, but it does not cause render bugs at least!
2017-09-17 23:42:13 +09:00
minjaesong
c086722f35 module UI now has margin; game update will drop consecutive updates if its try count is exhausted (reduced lag after window move/resize) 2017-09-15 01:40:12 +09:00
minjaesong
edb1ea384f module UI now has margin; game update will drop consecutive updates if its try count is exhausted (reduced lag after window move/resize) 2017-09-15 01:40:12 +09:00
minjaesong
d00c58ba80 Ingame: great, nothing renders :( 2017-09-15 00:40:11 +09:00
minjaesong
3cc2393841 Ingame: great, nothing renders :( 2017-09-15 00:40:11 +09:00
minjaesong
f82eab9871 simple hack for out-of-place render of terrain and lightmap
- Just made them not have negative value
2017-09-14 02:13:37 +09:00
minjaesong
5b96739cea simple hack for out-of-place render of terrain and lightmap
- Just made them not have negative value
2017-09-14 02:13:37 +09:00
minjaesong
efe2e44957 Guess it's fully working for titlescreen 2017-09-13 18:10:03 +09:00
minjaesong
e3a5516c55 Guess it's fully working for titlescreen 2017-09-13 18:10:03 +09:00
minjaesong
a048381cce NOT using a trick in issue #5 was the key, also closes issue #8 2017-09-13 01:06:01 +09:00
minjaesong
966a96b290 NOT using a trick in issue #5 was the key, also closes issue #8 2017-09-13 01:06:01 +09:00
minjaesong
85c5b2868d almost works but dae fucking jitter again 2017-09-12 23:52:16 +09:00
minjaesong
7041f7e37b almost works but dae fucking jitter again 2017-09-12 23:52:16 +09:00
minjaesong
d5450cd128 Light fuck: At least I've figured out what the fuck was wrong with. 2017-09-12 21:29:45 +09:00
minjaesong
02e0c1365b Light fuck: At least I've figured out what the fuck was wrong with. 2017-09-12 21:29:45 +09:00
minjaesong
9ed0046417 at least now I know which part is to be patched... 2017-09-09 02:45:58 +09:00
minjaesong
ade53831a8 at least now I know which part is to be patched... 2017-09-09 02:45:58 +09:00
minjaesong
bbcca225dd terrain AND wall renders 2017-09-01 01:05:21 +09:00
minjaesong
bc27d7b84f terrain AND wall renders 2017-09-01 01:05:21 +09:00
minjaesong
959019f9b3 now I can't even tell if it's working as intended or not 2017-08-30 22:16:10 +09:00
minjaesong
390ac37b8d now I can't even tell if it's working as intended or not 2017-08-30 22:16:10 +09:00
minjaesong
d8fe375c0c new blocks drawer WIP 2017-08-29 21:06:30 +09:00
minjaesong
5f9b46ec63 new blocks drawer WIP 2017-08-29 21:06:30 +09:00
minjaesong
0ab914a815 terrain atlas: added black patch 2017-08-28 20:37:39 +09:00
minjaesong
d2508d0ccd terrain atlas: added black patch 2017-08-28 20:37:39 +09:00
minjaesong
827bd23d6f camera moving works 2017-08-28 02:27:53 +09:00
minjaesong
d908473fa9 camera moving works 2017-08-28 02:27:53 +09:00
minjaesong
adbd569a5b Tiling shader -- FIXME: cameraTranslation not working as it should 2017-08-27 23:55:54 +09:00
minjaesong
32ff5545d1 Tiling shader -- FIXME: cameraTranslation not working as it should 2017-08-27 23:55:54 +09:00
minjaesong
62c1f34b88 fucking finally... (needs cleanup) 2017-08-27 23:47:30 +09:00
minjaesong
29367b9e6f fucking finally... (needs cleanup) 2017-08-27 23:47:30 +09:00
minjaesong
3ffbb8bef6 tiling using shader, sorta works 2017-08-26 23:48:07 +09:00
minjaesong
06ec6c875c tiling using shader, sorta works 2017-08-26 23:48:07 +09:00
minjaesong
e7c4a7b1e8 trying to tile by shader 2017-08-25 19:37:12 +09:00
minjaesong
63ed1f6ba0 trying to tile by shader 2017-08-25 19:37:12 +09:00
minjaesong
13ff4ddebb some sort of error screen impl 2017-08-20 22:10:47 +09:00
minjaesong
7a442f26fa some sort of error screen impl 2017-08-20 22:10:47 +09:00
minjaesong
2248674c98 better dithering 2017-08-07 01:09:04 +09:00
minjaesong
99d8b5b7f2 better dithering 2017-08-07 01:09:04 +09:00
minjaesong
aa238eb65c load app using apploader -- no more black screen on app load 2017-08-01 23:55:48 +09:00
minjaesong
4c973a3502 load app using apploader -- no more black screen on app load 2017-08-01 23:55:48 +09:00
minjaesong
5c2b1e7586 RemoCons fully working; also fixed my stupidity 2017-07-26 17:03:22 +09:00
minjaesong
65aa6a9a47 RemoCons fully working; also fixed my stupidity 2017-07-26 17:03:22 +09:00
minjaesong
5990da1d26 UIs wont FOR SURE update (more like, process events) anymore when they are not visible 2017-07-25 18:34:23 +09:00
minjaesong
093dc6dfa1 UIs wont FOR SURE update (more like, process events) anymore when they are not visible 2017-07-25 18:34:23 +09:00
minjaesong
3d622835c7 UI: sub-UIs work? 2017-07-25 17:21:02 +09:00
minjaesong
46b4dd7532 UI: sub-UIs work? 2017-07-25 17:21:02 +09:00
minjaesong
30b43eaab5 fixed quickbar and piemenu texture 2017-07-23 19:55:06 +09:00
minjaesong
2ddb2af0e4 fixed quickbar and piemenu texture 2017-07-23 19:55:06 +09:00
minjaesong
ca6b74199d more compatible shader 2017-07-23 18:23:53 +09:00
minjaesong
70a53c895d more compatible shader 2017-07-23 18:23:53 +09:00
minjaesong
a3a5b7ff57 leak patched I guess 2017-07-23 17:38:57 +09:00
minjaesong
3335aaba12 leak patched I guess 2017-07-23 17:38:57 +09:00
minjaesong
b50768f2b8 titlescreen: camera follows terraini undulation 2017-07-22 18:27:58 +09:00
minjaesong
3a0c2d8101 titlescreen: camera follows terraini undulation 2017-07-22 18:27:58 +09:00
minjaesong
d09e35326f title screen renders well 2017-07-21 20:28:12 +09:00
minjaesong
2108f1a44c title screen renders well 2017-07-21 20:28:12 +09:00
minjaesong
f1391bea6f generalised things so that they would work outside of ingame.world; title screen wip 2017-07-21 19:59:51 +09:00
minjaesong
c67c79ed85 generalised things so that they would work outside of ingame.world; title screen wip 2017-07-21 19:59:51 +09:00
minjaesong
cb8d3fd8b9 action listener on textbutton list 2017-07-20 22:25:40 +09:00
minjaesong
78b09b2790 action listener on textbutton list 2017-07-20 22:25:40 +09:00
minjaesong
48b8923434 parallax (sky looks bluer when you go up) 2017-07-20 18:39:05 +09:00
minjaesong
6f2c1e578e parallax (sky looks bluer when you go up) 2017-07-20 18:39:05 +09:00
minjaesong
15dbd16766 limitedly successful attempt to create a title screen 2017-07-20 00:36:41 +09:00
minjaesong
5d86f054e8 limitedly successful attempt to create a title screen 2017-07-20 00:36:41 +09:00
minjaesong
3a1379e376 Ingame's Player is now mandatory; player spawn on right position 2017-07-18 00:19:55 +09:00
minjaesong
b6f92d87cc Ingame's Player is now mandatory; player spawn on right position 2017-07-18 00:19:55 +09:00
minjaesong
a3d7e42a22 Inventory UI: items page button 2017-07-17 14:37:10 +09:00
minjaesong
fe0f87e428 Inventory UI: items page button 2017-07-17 14:37:10 +09:00
minjaesong
2423c7540b some bayer matrix things and my discoveries 2017-07-17 12:22:15 +09:00
minjaesong
6476fe88bb some bayer matrix things and my discoveries 2017-07-17 12:22:15 +09:00
minjaesong
485cbe1206 simplified a structure of UIs a bit 2017-07-16 23:15:32 +09:00
minjaesong
d6f2f4158c simplified a structure of UIs a bit 2017-07-16 23:15:32 +09:00
minjaesong
942971f456 dithered skybox 2017-07-16 05:03:04 +09:00
minjaesong
bf47b82445 dithered skybox 2017-07-16 05:03:04 +09:00
minjaesong
9f56ca2e99 bayer-dithering shader revisited 2017-07-15 18:35:57 +09:00
minjaesong
3505b2dd6a bayer-dithering shader revisited 2017-07-15 18:35:57 +09:00
minjaesong
1f0608b768 camera clamping, UI resize 2017-07-15 02:02:30 +09:00
minjaesong
f7867c1a6b camera clamping, UI resize 2017-07-15 02:02:30 +09:00
minjaesong
dfa2a0a86d wall render bug fixed
- wall wouldn't render if transparent-yet-sold tiles like glass is placed on top of it
2017-07-15 00:02:00 +09:00
minjaesong
75795677be wall render bug fixed
- wall wouldn't render if transparent-yet-sold tiles like glass is placed on top of it
2017-07-15 00:02:00 +09:00
minjaesong
75cd080023 load screen adj, faster gravity response for standard 2017-07-14 18:48:48 +09:00
minjaesong
1a10a9b33f load screen adj, faster gravity response for standard 2017-07-14 18:48:48 +09:00
minjaesong
8675fa927e Rudimentary load screen works (only with Ingame screen) 2017-07-13 19:10:11 +09:00
minjaesong
0288fa58d9 Rudimentary load screen works (only with Ingame screen) 2017-07-13 19:10:11 +09:00
minjaesong
d5c1c9e400 GenuineSonic 2017-07-13 18:07:12 +09:00
minjaesong
7742d5b0d4 GenuineSonic 2017-07-13 18:07:12 +09:00
minjaesong
2a5cb3ee38 disposable UI; loading screen mockup (i heard like loading screen -- sonic 06) 2017-07-13 17:53:40 +09:00
minjaesong
c2fe538b78 disposable UI; loading screen mockup (i heard like loading screen -- sonic 06) 2017-07-13 17:53:40 +09:00
minjaesong
fb899dae2d load screen render, fixed some init code of the app 2017-07-13 03:59:26 +09:00
minjaesong
c87e51d426 load screen render, fixed some init code of the app 2017-07-13 03:59:26 +09:00
minjaesong
149d17ed13 how changing the screen should be done 2017-07-13 01:34:09 +09:00
minjaesong
a4fe26adf8 how changing the screen should be done 2017-07-13 01:34:09 +09:00
minjaesong
50c32574e0 lightmap downsample works, sampling bug fixed with Filter.NEAREST, now having shrinkage issue 2017-07-12 14:33:59 +09:00
minjaesong
ed5997d5b4 lightmap downsample works, sampling bug fixed with Filter.NEAREST, now having shrinkage issue 2017-07-12 14:33:59 +09:00
minjaesong
ecf9387d01 working UV simulation using alpha channel 2017-07-12 02:35:36 +09:00
minjaesong
448c5f0fca working UV simulation using alpha channel 2017-07-12 02:35:36 +09:00
minjaesong
eba6b3801d working world-glow blend 2017-07-11 13:34:14 +09:00
minjaesong
ca83322df9 working world-glow blend 2017-07-11 13:34:14 +09:00
minjaesong
56cca83028 prep for draw glow 2017-07-09 20:29:35 +09:00
minjaesong
63a33ae0cf prep for draw glow 2017-07-09 20:29:35 +09:00
minjaesong
28d7b44821 diching RGB10; colors are now fully vec3 2017-07-09 02:21:24 +09:00
minjaesong
dfcc57eb68 diching RGB10; colors are now fully vec3 2017-07-09 02:21:24 +09:00
minjaesong
43fee8aa9d float lightmap seems it does have little boost on fps 2017-07-09 00:51:25 +09:00
minjaesong
d0b8f811c8 float lightmap seems it does have little boost on fps 2017-07-09 00:51:25 +09:00
minjaesong
fe8ca3bbd8 failed attempt at multithreading 2017-07-08 22:34:45 +09:00
minjaesong
482cb5ff21 failed attempt at multithreading 2017-07-08 22:34:45 +09:00
minjaesong
b91ba9fc08 asynch update and render (aka frameskip) 2017-07-08 20:38:05 +09:00
minjaesong
383a2f7259 asynch update and render (aka frameskip) 2017-07-08 20:38:05 +09:00
minjaesong
4120fa102d former bug fixed; now we have ceiling-stair-clip bug 2017-07-07 02:11:24 +09:00
minjaesong
eba5d5e709 former bug fixed; now we have ceiling-stair-clip bug 2017-07-07 02:11:24 +09:00
minjaesong
f732c3ca2b improved collision displacer: no more clip-to-climb-up-rightside-only thingy 2017-07-07 00:01:20 +09:00
minjaesong
40b9897a23 improved collision displacer: no more clip-to-climb-up-rightside-only thingy 2017-07-07 00:01:20 +09:00
minjaesong
e1642ae351 new collision displacer: got one-block-ceiling-passthru bug, but otherwise tolerable 2017-07-06 16:35:58 +09:00
minjaesong
1059031443 new collision displacer: got one-block-ceiling-passthru bug, but otherwise tolerable 2017-07-06 16:35:58 +09:00
minjaesong
f39ff87ee9 4096 shader finally works... perhaps it needs bayer matrix? 2017-07-05 18:30:53 +09:00
minjaesong
539b06aec2 4096 shader finally works... perhaps it needs bayer matrix? 2017-07-05 18:30:53 +09:00
minjaesong
2d5761d66c downsampling sorta works, ONLY WHEN (width or height % 4) is 0 or 1 2017-07-05 16:03:50 +09:00
minjaesong
0f20f01e66 downsampling sorta works, ONLY WHEN (width or height % 4) is 0 or 1 2017-07-05 16:03:50 +09:00
minjaesong
e54822a7e4 control scheme update 2017-07-05 12:49:26 +09:00
minjaesong
6998b652e1 control scheme update 2017-07-05 12:49:26 +09:00
minjaesong
60a3c6518f Ladies and Gents, we have shader-powered smooth lighting! 2017-07-05 02:20:10 +09:00
minjaesong
4d04aadc58 Ladies and Gents, we have shader-powered smooth lighting! 2017-07-05 02:20:10 +09:00
minjaesong
3af196004e shader seems working!; it's messed up by all the test codes but I commit anyway 2017-07-05 02:05:03 +09:00
minjaesong
f5d229105c shader seems working!; it's messed up by all the test codes but I commit anyway 2017-07-05 02:05:03 +09:00
minjaesong
cf2932a519 blur shader works 2017-07-04 23:30:48 +09:00
minjaesong
c29f663a0e blur shader works 2017-07-04 23:30:48 +09:00
minjaesong
75d449cc10 shader does work at least... 2017-07-04 22:04:07 +09:00
minjaesong
3e64d8447c shader does work at least... 2017-07-04 22:04:07 +09:00
minjaesong
14a745b18d killed old zoom so that framebuffer would render without hack 2017-07-04 20:11:54 +09:00
minjaesong
ecc883f9ca killed old zoom so that framebuffer would render without hack 2017-07-04 20:11:54 +09:00
minjaesong
db2fd0c8e4 needs more shader (for smoothing out lightmap render) 2017-07-04 14:58:18 +09:00
minjaesong
4a6f88ea29 needs more shader (for smoothing out lightmap render) 2017-07-04 14:58:18 +09:00
minjaesong
9027f85d1d barely managed to fix inventory UI 2017-07-04 01:27:18 +09:00
minjaesong
b2a8fe5bd7 barely managed to fix inventory UI 2017-07-04 01:27:18 +09:00
minjaesong
6057bd9c22 dunno why but setting camera position to negative works... 2017-07-03 23:42:59 +09:00
minjaesong
70849582ee dunno why but setting camera position to negative works... 2017-07-03 23:42:59 +09:00
minjaesong
7e417ed8c7 putting ore vein prototype on main sheet; also a commit before fuck-up 2017-07-03 19:26:00 +09:00
minjaesong
8774506690 putting ore vein prototype on main sheet; also a commit before fuck-up 2017-07-03 19:26:00 +09:00
minjaesong
04db52ca3a fixed bug: things go dark as inventory is opened
Not cloning the color when MULing was the culprit
2017-07-03 02:55:33 +09:00
minjaesong
5c24f57d03 fixed bug: things go dark as inventory is opened
Not cloning the color when MULing was the culprit
2017-07-03 02:55:33 +09:00
minjaesong
65ef9c2787 fixed bad color rendering on blocksdrawer and lightmaprenderer 2017-07-02 21:53:50 +09:00
minjaesong
bbc68110d9 fixed bad color rendering on blocksdrawer and lightmaprenderer 2017-07-02 21:53:50 +09:00
minjaesong
a91cbb8924 debugger's got its colour codes back 2017-07-02 15:28:45 +09:00
minjaesong
bea125b66d debugger's got its colour codes back 2017-07-02 15:28:45 +09:00
minjaesong
cc6a2d6898 proper sprite flip draw 2017-07-02 00:45:57 +09:00
minjaesong
ad9d8de86f proper sprite flip draw 2017-07-02 00:45:57 +09:00
minjaesong
cbcd32e132 keyboard control ported to GDX (at least as much as I can right now) 2017-07-01 18:31:00 +09:00
minjaesong
d680656f64 keyboard control ported to GDX (at least as much as I can right now) 2017-07-01 18:31:00 +09:00
minjaesong
f2a2966d6c ore veins 2017-06-30 02:06:53 +09:00
minjaesong
bb01ae0fa0 ore veins 2017-06-30 02:06:53 +09:00
minjaesong
b97f5162a5 blocks camera and framebuffer seems working 2017-06-30 01:50:06 +09:00
minjaesong
c233eeabbf blocks camera and framebuffer seems working 2017-06-30 01:50:06 +09:00
minjaesong
f0e73cda1d can see camera working but not the actor gravity 2017-06-28 22:15:42 +09:00
minjaesong
299dec1476 can see camera working but not the actor gravity 2017-06-28 22:15:42 +09:00
128 changed files with 1481 additions and 2011 deletions

3
.gitattributes vendored
View File

@@ -5,4 +5,5 @@
*.opus filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.kra filter=lfs diff=lfs merge=lfs -text
*.kra filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text

View File

@@ -1,6 +1,6 @@
*Terrarum*
Copyright (C) 2013-2020 Minjaesong (Torvald)
Copyright (C) 2013-2021 Minjae Song ("CuriousTorvald")
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*Terrarum Sans Bitmap*
Copyright (c) 2017-2019 Minjae Song (Torvald) and the contributors
Copyright (c) 2017-2020 Minjae Song ("CuriousTorvald") and the contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -113,7 +113,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kotlin translated and modified code Copyright (C) 2016 Minjaesong (Torvald)
Kotlin translated and modified code Copyright (C) 2016 Minjae Song ("CuriousTorvald")
----

View File

@@ -1,17 +1,42 @@
## Prefix-ID Referencing
Every blocks and items have Prefix-ID Referencing scheme, which is defined as follows:
```<Prefix>@<Modname>:<Integer ID>```
where Prefix is predefined (see below), Integer ID is arbitrarily chosen within a domain.
### Prefixes
|Name|Description|
|----|-----------|
|wall|Wall, only used by the Inventory to differentiate walls from blocks (therefore wall shares same "ID Space" with blocks/fluids/wires)|
|item|Item (Static), uses different "ID Space" with blocks/walls/fluids/wires|
Notes:
- BlockCodex and ItemCodex will not store prefix part of the ID, as blocks and walls are identical in properties
- Wires and Fluids use the same "ID Space" as the tiles; they just happened to exclusive to their own layers.
This simplifies many things e.g. only one TileID-to-AtlasTileNumber map is needed and the renderer will
greatly benefit from it.
### Predefined Modnames
|Name|Description|
|----|-----------|
|dyn|Dynamic Item|
|actor|Actor As an Item. Integer ID is identical to the actor's Reference ID|
|virt|Virtual Tile Number|
### Integer ID Domains
|Range|Description|
|-----|-----------|
|0..4095|Tiles (4096 possible)|
|4096..8191|Walls (4096 possible)|
|8192..8447|Wires (256 possible)|
|8448..0x0F_FFFF|Items (static) (1M possible)|
|0x10_0000..0x0FFF_FFFF|Items (dynamic\*) (267M possible)|
|0x1000_0000..0x7FFF_FFFF|Actors (1879M possible)|
|-1..-65536|Virtual Tiles|
|-2147483648..-65537 (all negative numbers)|Faction (2147M possible)|
|1..2147483647|Integer ID for dynamic items|
|0x1000_0000..0x7FFF_FFFF|Reference ID for Actors (1879M possible)|
|1..2147483647|Integer ID for virtual tiles|
* dynamic items have own properties that will persist through savegame.
Actors range in-depth
Actor range in-depth
|Range|Description|
|-----|-----------|

Binary file not shown.

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

Binary file not shown.

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

BIN
assets/mods/basegame/blocks/0.tga LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,5 @@
"id";"drop";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"plat";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs"
"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
"1";"1";"BLOCK_MIASMA";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
"16";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
@@ -107,8 +106,8 @@
"4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A"
"4094";"0";"ACTORBLOCK_NO_PASS_RIGHT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A"
"4095";"0";"ACTORBLOCK_NO_PASS_LEFT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A"
"4096";"0";"BLOCK_WATER";"0.1016";"0.0744";"0.0508";"0.0826";"100";"1000";"WATR";"0";"0";"0";"0";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"005599A6";"16"
"4097";"0";"BLOCK_LAVA";"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK";"0";"0";"0";"0";"0";"0";"16";"0.7664";"0.2032";"0.0000";"0.0000";"FF4600E6";"32"
"65536";"0";"BLOCK_WATER";"0.1016";"0.0744";"0.0508";"0.0826";"100";"1000";"WATR";"0";"0";"0";"0";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"005599A6";"16"
"65537";"0";"BLOCK_LAVA";"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK";"0";"0";"0";"0";"0";"0";"16";"0.7664";"0.2032";"0.0000";"0.0000";"FF4600E6";"32"
"-1";"0";"BLOCK_NULL";"4.0000";"4.0000";"4.0000";"4.0000";"-1";"2600";"NULL";"0";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A"
1 id drop name shdr shdg shdb shduv str dsty mate solid plat wall grav dlfn fv fr lumr lumg lumb lumuv colour vscs
2 0 0 BLOCK_AIR 0.0312 0.0312 0.0312 0.0312 1 1 NULL 0 0 1 N/A 0 0 4 0.0000 0.0000 0.0000 0.0000 N/A N/A
1 1 BLOCK_MIASMA 0.0312 0.0312 0.0312 0.0312 1 1 NULL 0 0 1 N/A 0 0 4 0.0000 0.0000 0.0000 0.0000 N/A N/A
3 16 17 BLOCK_STONE 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 0 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A
4 17 17 BLOCK_STONE_QUARRIED 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 0 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A
5 18 18 BLOCK_STONE_TILE_WHITE 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 0 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A
106 4093 0 ACTORBLOCK_ALLOW_MOVE_DOWN 0.0312 0.0312 0.0312 0.0312 1 1 NULL 0 1 0 N/A 0 0 0 0.0 0.0 0.0 0.0 N/A N/A
107 4094 0 ACTORBLOCK_NO_PASS_RIGHT 0.0312 0.0312 0.0312 0.0312 1 1 NULL 0 0 0 N/A 0 0 0 0.0 0.0 0.0 0.0 N/A N/A
108 4095 0 ACTORBLOCK_NO_PASS_LEFT 0.0312 0.0312 0.0312 0.0312 1 1 NULL 0 0 0 N/A 0 0 0 0.0 0.0 0.0 0.0 N/A N/A
109 4096 65536 0 BLOCK_WATER 0.1016 0.0744 0.0508 0.0826 100 1000 WATR 0 0 0 0 0 0 16 0.0000 0.0000 0.0000 0.0000 005599A6 16
110 4097 65537 0 BLOCK_LAVA 0.9696 0.9696 0.9696 0.9696 100 2600 ROCK 0 0 0 0 0 0 16 0.7664 0.2032 0.0000 0.0000 FF4600E6 32
111 -1 0 BLOCK_NULL 4.0000 4.0000 4.0000 4.0000 -1 2600 NULL 0 0 1 N/A 0 0 16 0.0000 0.0000 0.0000 0.0000 N/A N/A
112 ## Notes ##
113 # Every block must have a shade value that is at least as dark as the air block's

View File

@@ -0,0 +1,12 @@
"id";"drop";"name";"accept";"inputcount";"inputtype";"outputtype"
"8192";"8192";"WIRE_RED";"digital_bit";"N/A";"N/A";"N/A"
"8193";"8193";"WIRE_GREEN";"digital_bit";"N/A";"N/A";"N/A"
"8194";"8194";"WIRE_BLUE";"digital_bit";"N/A";"N/A";"N/A"
"8195";"8195";"WIRE_BUNDLE";"digital_3bits";"N/A";"N/A";"N/A"
"bundlemaker";"bundlemaker";"WIRE_BUNDLEMAKER";"N/A";3;"digital_bit";"digital_3bits"
# accept: which wiretype (defined elsewhere) the wires acceps. Use comma to separate multiple. N/A for electronic components (aka "not wires")
# inputcount: how many sides are input (outputcount is deduced from the inputcount). N/A for wires
# inputtype: which wiretype it accepts. N/A for wires
# outputtype: which wiretype it emits. N/A for wires
Can't render this file because it contains an unexpected character in line 9 and column 131.

View File

@@ -1,7 +1,7 @@
"id";"classname"
"8448";"net.torvald.terrarum.modulebasegame.gameitems.PickaxeCopper"
"8449";"net.torvald.terrarum.modulebasegame.gameitems.PickaxeIron"
"8450";"net.torvald.terrarum.modulebasegame.gameitems.PickaxeSteel"
"8466";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire"
"8467";"net.torvald.terrarum.modulebasegame.gameitems.TikiTorchTester"
"8468";"net.torvald.terrarum.modulebasegame.gameitems.ItemCraftingTable"
"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.WirePieceSignalWire"
"5";"net.torvald.terrarum.modulebasegame.gameitems.TikiTorchTester"
"6";"net.torvald.terrarum.modulebasegame.gameitems.ItemCraftingTable"
1 id classname
2 8448 1 net.torvald.terrarum.modulebasegame.gameitems.PickaxeCopper
3 8449 2 net.torvald.terrarum.modulebasegame.gameitems.PickaxeIron
4 8450 3 net.torvald.terrarum.modulebasegame.gameitems.PickaxeSteel
5 8466 4 net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire
6 8467 5 net.torvald.terrarum.modulebasegame.gameitems.TikiTorchTester
7 8468 6 net.torvald.terrarum.modulebasegame.gameitems.ItemCraftingTable

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -1,4 +1,4 @@
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif

View File

@@ -2,7 +2,7 @@
*/
#version 130
#version 120
#ifdef GL_ES
precision mediump float;
#endif
@@ -76,7 +76,7 @@ void main() {
int tile = getTileFromColor(tileFromMap);
int breakage = getBreakageFromColor(tileFromMap);
ivec2 tileXY = getTileXY(tile);
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the atlas
ivec2 breakageXY = getTileXY(breakage + 5); // +5 is hard-coded constant that depends on the contents of the atlas
// calculate the UV coord value for texture sampling //

View File

@@ -1,32 +1,32 @@
{
"displayfps": 0,
"usevsync": false,
"screenwidth": 1110,
"screenheight": 740,
"screenwidth": 1280,
"screenheight": 720,
"language": "enUS",
"notificationshowuptime": 4000,
"multithread": true,
"multithreadedlight": false,
"showhealthmessageonstartup": true,
"usexinput": true,
"gamepadkeyn": 3,
"gamepadkeyw": 2,
"gamepadkeys": 0,
"gamepadkeye": 1,
"gamepadlup": 4,
"gamepadrup": 5,
"gamepadselect": 6,
"gamepadstart": 7,
"gamepadltrigger": 8,
"gamepadrtrigger": 9,
"gamepadlthumb": 10,
"gamepadrthumb": 11,
"gamepadaxislx": 1,
"gamepadaxisly": 0,
"gamepadaxisrx": 3,
"gamepadaxisry": 2,
"gamepadtriggeraxis": 4,
"gamepadtriggeraxis2": 5,
"config_gamepadkeyn": 3,
"config_gamepadkeyw": 2,
"config_gamepadkeys": 0,
"config_gamepadkeye": 1,
"config_gamepadlup": 4,
"config_gamepadrup": 5,
"config_gamepadselect": 6,
"config_gamepadstart": 7,
"config_gamepadltrigger": 8,
"config_gamepadrtrigger": 9,
"config_gamepadlthumb": 10,
"config_gamepadrthumb": 11,
"config_gamepadaxislx": 1,
"config_gamepadaxisly": 0,
"config_gamepadaxisrx": 3,
"config_gamepadaxisry": 2,
"config_gamepadtriggeraxis": 4,
"config_gamepadtriggeraxis2": 5,
"gamepadaxiszeropoints": [
-0.011,
-0.022,
@@ -34,24 +34,24 @@
-0.044
],
"gamepadlabelstyle": "msxbone",
"keyup":34,
"keyleft":46,
"keydown":47,
"keyright":48,
"keyinventory":45,
"keyinteract":44,
"keymovementaux": 29,
"keyclose": 31,
"keyzoom": 54,
"keygamemenu": 61,
"keyquicksel": 59,
"keyquickselalt": [
"config_keyup":34,
"config_keyleft":46,
"config_keydown":47,
"config_keyright":48,
"config_keyinventory":45,
"config_keyinteract":44,
"config_keymovementaux": 29,
"config_keyclose": 31,
"config_keyzoom": 54,
"config_keygamemenu": 61,
"config_keyquicksel": 59,
"config_keyquickselalt": [
67,
129,
73
],
"keyjump": 62,
"keyquickslots": [
"config_keyjump": 62,
"config_keyquickslots": [
8,
9,
10,
@@ -63,8 +63,8 @@
16,
7
],
"mouseprimary": 0,
"mousesecondary": 1,
"config_mouseprimary": 0,
"config_mousesecondary": 1,
"pcgamepadenv": "console",
"maxparticles": 768,
"temperatureunit": 1,

View File

@@ -11,6 +11,9 @@ import sun.misc.Unsafe
*/
internal object UnsafeHelper {
var unsafeAllocatedSize = 0L
internal set
val unsafe: Unsafe
init {
@@ -57,6 +60,10 @@ internal object UnsafeHelper {
* Use of hashCode() is forbidden, use the pointer instead.
*/
internal class UnsafePtr(pointer: Long, allocSize: Long) {
init {
UnsafeHelper.unsafeAllocatedSize += allocSize
}
var destroyed = false
private set
@@ -67,8 +74,10 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
private set
fun realloc(newSize: Long) {
UnsafeHelper.unsafeAllocatedSize -= size
ptr = UnsafeHelper.unsafe.reallocateMemory(ptr, newSize)
size = newSize
UnsafeHelper.unsafeAllocatedSize += size
}
fun destroy() {
@@ -79,16 +88,17 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
printStackTrace(this)
destroyed = true
UnsafeHelper.unsafeAllocatedSize -= size
}
}
private inline fun checkNullPtr(index: Long) { // ignore what IDEA says and do inline this
// commenting out because of the suspected (or minor?) performance impact.
// You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit")
// appear (e.g. getting garbage values when it fucking shouldn't)
assert(!destroyed) { throw NullPointerException("The pointer is already destroyed ($this)") }
//// commenting out because of the suspected (or minor?) performance impact.
//// You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit")
//// appear (e.g. getting garbage values when it fucking shouldn't)
// OOB Check: debugging purposes only -- comment out for the production
//assert(!destroyed) { throw NullPointerException("The pointer is already destroyed ($this)") }
//if (index !in 0 until size) throw IndexOutOfBoundsException("Index: $index; alloc size: $size")
}

View File

@@ -12,9 +12,8 @@ import net.torvald.UnsafeHelper
*/
internal class UnsafeCvecArray(val width: Int, val height: Int) {
val TOTAL_SIZE_IN_BYTES = 16L * width * height
val array = UnsafeHelper.allocate(TOTAL_SIZE_IN_BYTES)
private val TOTAL_SIZE_IN_BYTES = 16L * (width + 1) * (height + 1)
private val array = UnsafeHelper.allocate(TOTAL_SIZE_IN_BYTES)
private inline fun toAddr(x: Int, y: Int) = 16L * (y * width + x)

View File

@@ -20,7 +20,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.torvald.gdx.graphics.PixmapIO2;
import net.torvald.getcpuname.GetCpuName;
import net.torvald.terrarum.concurrent.ThreadParallel;
import net.torvald.terrarum.concurrent.ThreadExecutor;
import net.torvald.terrarum.controller.GdxControllerAdapter;
import net.torvald.terrarum.controller.TerrarumController;
import net.torvald.terrarum.controller.XinputControllerAdapter;
@@ -33,6 +33,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame;
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
import net.torvald.terrarum.utils.JsonFetcher;
import net.torvald.terrarum.utils.JsonWriter;
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
import net.torvald.util.ArrayListMap;
@@ -136,7 +137,7 @@ public class AppLoader implements ApplicationListener {
public static String renderer = "(a super-fancy virtual photoradiator)";
public static String rendererVendor = "(aperture science psychovisualcomputation laboratory)";
public static int THREADS = ThreadParallel.INSTANCE.getThreadCount();
public static int THREAD_COUNT = ThreadExecutor.INSTANCE.getThreadCount();
public static boolean MULTITHREAD;
public static final boolean is32BitJVM = !System.getProperty("sun.arch.data.model").contains("64");
@@ -208,8 +209,8 @@ public class AppLoader implements ApplicationListener {
public static ArrayListMap debugTimers = new ArrayListMap<String, Long>();
public static final int defaultW = 1116;
public static final int defaultH = 744;
public static final int defaultW = 1280;
public static final int defaultH = 720;
public static final int minimumW = 1080;
public static final int minimumH = 720;
@@ -315,13 +316,15 @@ public class AppLoader implements ApplicationListener {
ShaderProgram.pedantic = false;
LwjglApplicationConfiguration appConfig = new LwjglApplicationConfiguration();
appConfig.useGL30 = true; // utilising some GL trickeries, need this to be TRUE
appConfig.useGL30 = false; // https://stackoverflow.com/questions/46753218/libgdx-should-i-use-gl30
appConfig.vSyncEnabled = getConfigBoolean("usevsync");
appConfig.resizable = false;//true;
//appConfig.width = 1110; // photographic ratio (1.5:1)
//appConfig.height = 740; // photographic ratio (1.5:1)
appConfig.width = getConfigInt("screenwidth");
if (appConfig.width % 2 == 1) appConfig.width -= 1;
if (appConfig.width < minimumW) appConfig.width = minimumW;
appConfig.height = getConfigInt("screenheight");
if (appConfig.height % 2 == 1) appConfig.height -= 1;
if (appConfig.height < minimumH) appConfig.height = minimumH;
appConfig.backgroundFPS = Math.min(GLOBAL_FRAMERATE_LIMIT, getConfigInt("displayfps"));
appConfig.foregroundFPS = Math.min(GLOBAL_FRAMERATE_LIMIT, getConfigInt("displayfps"));
appConfig.title = GAME_NAME;
@@ -350,7 +353,7 @@ public class AppLoader implements ApplicationListener {
System.err.println("Game not started using DEBUG MODE -- current build of the game will display black screen without debug mode");
}
// set some more configuration vars
MULTITHREAD = ThreadParallel.INSTANCE.getThreadCount() >= 3 && getConfigBoolean("multithread");
MULTITHREAD = THREAD_COUNT >= 3 && getConfigBoolean("multithread");
new LwjglApplication(new AppLoader(appConfig), appConfig);
}
@@ -492,6 +495,10 @@ public class AppLoader implements ApplicationListener {
// make loading list
CommonResourcePool.INSTANCE.loadAll();
// create tile atlas
printdbg(this, "Making terrain textures...");
CreateTileAtlas.INSTANCE.invoke(false);
}
@Override
@@ -555,11 +562,14 @@ public class AppLoader implements ApplicationListener {
try {
Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, appConfig.width, appConfig.height);
PixmapIO2.writeTGA(Gdx.files.absolute(defaultDir + "/Screenshot.tga"), p, true);
PixmapIO2.writeTGA(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".tga"), p, true);
p.dispose();
Terrarum.INSTANCE.getIngame().sendNotification("Screenshot taken");
}
catch (Throwable e) {
e.printStackTrace();
Terrarum.INSTANCE.getIngame().sendNotification("Failed to take screenshot: "+e.getMessage());
}
}
@@ -654,9 +664,6 @@ public class AppLoader implements ApplicationListener {
screenW = width;
screenH = height;
if (screenW % 2 == 1) screenW -= 1;
if (screenH % 2 == 1) screenH -= 1;
if (currenScreen != null) currenScreen.resize(screenW, screenH);
@@ -790,7 +797,7 @@ public class AppLoader implements ApplicationListener {
currenScreen = screen;
currenScreen.show();
currenScreen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
currenScreen.resize(appConfig.width, appConfig.height);
System.gc();
@@ -1121,6 +1128,21 @@ public class AppLoader implements ApplicationListener {
return ((float[]) cfg);
}
public static String[] getConfigStringArray(String key) {
Object cfg = getConfigMaster(key);
if (cfg instanceof JsonArray) {
JsonArray jsonArray = ((JsonArray) cfg).getAsJsonArray();
//return IntArray(jsonArray.size(), { i -> jsonArray[i].asInt })
String[] intArray = new String[jsonArray.size()];
for (int i = 0; i < jsonArray.size(); i++) {
intArray[i] = jsonArray.get(i).getAsString();
}
return intArray;
}
else
return ((String[]) cfg);
}
/**
* Get config from config file. If the entry does not exist, get from defaults; if the entry is not in the default, NullPointerException will be thrown
*/
@@ -1236,4 +1258,4 @@ public class AppLoader implements ApplicationListener {
public static long getTIME_T() {
return System.currentTimeMillis() / 1000L;
}
}
}

View File

@@ -29,68 +29,68 @@ object DefaultConfig {
jsonObject.addProperty("showhealthmessageonstartup", true)
// control-gamepad
// "config_key", "config_mouse", "config_gamepad" are keyword recognised by control setup UI
jsonObject.addProperty("usexinput", true) // when FALSE, LT+RT input on xbox controller is impossible
jsonObject.addProperty("gamepadkeyn", 3)
jsonObject.addProperty("gamepadkeyw", 2)
jsonObject.addProperty("gamepadkeys", 0)
jsonObject.addProperty("gamepadkeye", 1) // xbox indices
jsonObject.addProperty("config_gamepadkeyn", 3)
jsonObject.addProperty("config_gamepadkeyw", 2)
jsonObject.addProperty("config_gamepadkeys", 0)
jsonObject.addProperty("config_gamepadkeye", 1) // xbox indices
jsonObject.addProperty("gamepadlup", 4)
jsonObject.addProperty("gamepadrup", 5)
jsonObject.addProperty("gamepadselect", 6)
jsonObject.addProperty("gamepadstart", 7)
jsonObject.addProperty("config_gamepadlup", 4)
jsonObject.addProperty("config_gamepadrup", 5)
jsonObject.addProperty("config_gamepadselect", 6)
jsonObject.addProperty("config_gamepadstart", 7)
jsonObject.addProperty("gamepadltrigger", 8)
jsonObject.addProperty("gamepadrtrigger", 9)
jsonObject.addProperty("gamepadlthumb", 10)
jsonObject.addProperty("gamepadrthumb", 11)
jsonObject.addProperty("config_gamepadltrigger", 8)
jsonObject.addProperty("config_gamepadrtrigger", 9)
jsonObject.addProperty("config_gamepadlthumb", 10)
jsonObject.addProperty("config_gamepadrthumb", 11)
jsonObject.addProperty("gamepadaxislx", 1)
jsonObject.addProperty("gamepadaxisly", 0)
jsonObject.addProperty("gamepadaxisrx", 3)
jsonObject.addProperty("gamepadaxisry", 2) // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck?
jsonObject.addProperty("gamepadtriggeraxis", 4) // positive: LT, negative: RT (xbox pad)
jsonObject.addProperty("gamepadtriggeraxis2", 5) // just in case... (RT)
jsonObject.addProperty("config_gamepadaxislx", 1)
jsonObject.addProperty("config_gamepadaxisly", 0)
jsonObject.addProperty("config_gamepadaxisrx", 3)
jsonObject.addProperty("config_gamepadaxisry", 2) // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck?
jsonObject.addProperty("config_gamepadtriggeraxis", 4) // positive: LT, negative: RT (xbox pad)
jsonObject.addProperty("config_gamepadtriggeraxis2", 5) // just in case... (RT)
val axesZeroPoints = JsonArray(); axesZeroPoints.add(-0.011f); axesZeroPoints.add(-0.022f); axesZeroPoints.add(-0.033f); axesZeroPoints.add(-0.044f)
jsonObject.add("gamepadaxiszeropoints", axesZeroPoints) // to accomodate shifted zero point of analog stick
jsonObject.addProperty("gamepadlabelstyle", "msxbone") // "nwii", "logitech", "sonyps", "msxb360", "msxbone"
// control-keyboard (GDX key codes)
jsonObject.addProperty("keyup", Input.Keys.E)
jsonObject.addProperty("keyleft", Input.Keys.S)
jsonObject.addProperty("keydown", Input.Keys.D)
jsonObject.addProperty("keyright", Input.Keys.F) // ESDF Masterrace
jsonObject.addProperty("config_keyup", Input.Keys.E)
jsonObject.addProperty("config_keyleft", Input.Keys.S)
jsonObject.addProperty("config_keydown", Input.Keys.D)
jsonObject.addProperty("config_keyright", Input.Keys.F) // ESDF Masterrace
jsonObject.addProperty("keymovementaux", Input.Keys.A) // movement-auxiliary, or hookshot
jsonObject.addProperty("keyinventory", Input.Keys.Q)
jsonObject.addProperty("keyinteract", Input.Keys.R)
jsonObject.addProperty("keyclose", Input.Keys.C) // this or hard-coded ESC
jsonObject.addProperty("keyzoom", Input.Keys.Z)
jsonObject.addProperty("config_keymovementaux", Input.Keys.A) // movement-auxiliary, or hookshot
jsonObject.addProperty("config_keyinventory", Input.Keys.Q)
jsonObject.addProperty("config_keyinteract", Input.Keys.R)
jsonObject.addProperty("config_keyclose", Input.Keys.C) // this or hard-coded ESC
jsonObject.addProperty("config_keyzoom", Input.Keys.Z)
jsonObject.addProperty("keygamemenu", Input.Keys.TAB)
jsonObject.addProperty("keyquicksel", Input.Keys.SHIFT_LEFT) // pie menu is now LShift because GDX does not read CapsLock
jsonObject.addProperty("config_keygamemenu", Input.Keys.TAB)
jsonObject.addProperty("config_keyquicksel", Input.Keys.SHIFT_LEFT) // pie menu is now LShift because GDX does not read CapsLock
val keyquickselalt = JsonArray(); keyquickselalt.add(Input.Keys.BACKSPACE); keyquickselalt.add(Input.Keys.CONTROL_LEFT); keyquickselalt.add(Input.Keys.BACKSLASH)
// Colemak, Workman and some typers use CapsLock as Backspace, Apple-JIS and HHKB has Control in place of CapsLock and often re-assigned to Command
// so these keys are treated as the same.
// FOR ~~FUCKS~~ERGONOMICS' SAKE DON'T USE CTRL AND ALT AS A KEY!
jsonObject.add("keyquickselalt", keyquickselalt)
jsonObject.addProperty("mousequicksel", Input.Buttons.MIDDLE) // middle click to open pie menu
jsonObject.add("config_keyquickselalt", keyquickselalt)
jsonObject.addProperty("config_mousequicksel", Input.Buttons.MIDDLE) // middle click to open pie menu
jsonObject.addProperty("keyjump", Input.Keys.SPACE)
jsonObject.addProperty("config_keyjump", Input.Keys.SPACE)
val keyquickslots = JsonArray(); for (i in Input.Keys.NUM_1..Input.Keys.NUM_9) keyquickslots.add(i); keyquickslots.add(Input.Keys.NUM_0) // NUM_1 to NUM_0
jsonObject.add("keyquickslots", keyquickslots)
jsonObject.add("config_keyquickslots", keyquickslots)
jsonObject.addProperty("mouseprimary", Input.Buttons.LEFT) // left mouse
jsonObject.addProperty("mousesecondary", Input.Buttons.RIGHT) // right mouse
jsonObject.addProperty("config_mouseprimary", Input.Buttons.LEFT) // left mouse
jsonObject.addProperty("config_mousesecondary", Input.Buttons.RIGHT) // right mouse
jsonObject.addProperty("pcgamepadenv", "console")
@@ -111,7 +111,7 @@ object DefaultConfig {
// settings regarding debugger
val buildingMakerFavs = JsonArray()
intArrayOf(
arrayOf(
Block.GLASS_CRUDE,
Block.PLANK_NORMAL,
Block.PLANK_BIRCH,
@@ -120,9 +120,10 @@ object DefaultConfig {
Block.STONE_TILE_WHITE,
Block.TORCH,
Block.PLANK_NORMAL + BlockCodex.MAX_TERRAIN_TILES,
Block.PLANK_BIRCH + BlockCodex.MAX_TERRAIN_TILES,
Block.GLASS_CRUDE + BlockCodex.MAX_TERRAIN_TILES).forEach {
"wall@" + Block.PLANK_NORMAL,
"wall@" + Block.PLANK_BIRCH,
"wall@" + Block.GLASS_CRUDE
).forEach {
buildingMakerFavs.add(it)
}
jsonObject.add("buildingmakerfavs", buildingMakerFavs)

View File

@@ -1172,8 +1172,8 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
ThreadParallel.map(
i,
ThreadActorUpdate(
actors.div(Terrarum.THREADS).times(i).roundInt(),
actors.div(Terrarum.THREADS).times(i.plus(1)).roundInt() - 1
actors.div(Terrarum.THREADS).times(i).roundToInt(),
actors.div(Terrarum.THREADS).times(i.plus(1)).roundToInt() - 1
),
"ActorUpdate"
)

View File

@@ -13,6 +13,7 @@ class GdxColorMap {
constructor(imageFile: FileHandle) {
AppLoader.printdbg(this, "Loading colormap from ${imageFile.name()}")
printStackTrace(this)
val pixmap = Pixmap(imageFile)
width = pixmap.width

View File

@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.utils.Queue
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.realestate.LandUtil
@@ -141,17 +142,17 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
*
* Queueing schema is used to make sure things are synchronised.
*/
open fun queueTerrainChangedEvent(old: Int, new: Int, position: Long) {
open fun queueTerrainChangedEvent(old: ItemID, new: ItemID, position: Long) {
val (x, y) = LandUtil.resolveBlockAddr(world, position)
terrainChangeQueue.addFirst(BlockChangeQueueItem(old, new, x, y))
terrainChangeQueue.addLast(BlockChangeQueueItem(old, new, x, y))
}
/**
* Wall version of terrainChanged() event
*/
open fun queueWallChangedEvent(old: Int, new: Int, position: Long) {
open fun queueWallChangedEvent(old: ItemID, new: ItemID, position: Long) {
val (x, y) = LandUtil.resolveBlockAddr(world, position)
wallChangeQueue.addFirst(BlockChangeQueueItem(old, new, x, y))
wallChangeQueue.addLast(BlockChangeQueueItem(old, new, x, y))
}
/**
@@ -160,9 +161,9 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
* @param old previous settings of conduits in bit set format.
* @param new current settings of conduits in bit set format.
*/
open fun queueWireChangedEvent(old: Int, new: Int, position: Long) {
open fun queueWireChangedEvent(old: ItemID, new: ItemID, position: Long) {
val (x, y) = LandUtil.resolveBlockAddr(world, position)
wireChangeQueue.addFirst(BlockChangeQueueItem(old, new, x, y))
wireChangeQueue.addLast(BlockChangeQueueItem(old, new, x, y))
}
@@ -252,7 +253,11 @@ open class IngameInstance(val batch: SpriteBatch) : Screen {
data class BlockChangeQueueItem(val old: Int, val new: Int, val posX: Int, val posY: Int)
data class BlockChangeQueueItem(val old: ItemID, val new: ItemID, val posX: Int, val posY: Int)
open fun sendNotification(messages: Array<String>) {}
open fun sendNotification(messages: List<String>) {}
open fun sendNotification(singleMessage: String) {}
}
inline fun Lock.lock(body: () -> Unit) {

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.ScreenAdapter
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.utils.Disposable
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.util.CircularArray
open class LoadScreenBase : ScreenAdapter(), Disposable {
@@ -63,6 +64,8 @@ open class LoadScreenBase : ScreenAdapter(), Disposable {
}
override fun render(delta: Float) {
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
if (screenToLoad?.gameInitialised ?: false) {
doContextChange = true
}

View File

@@ -178,16 +178,19 @@ object ModMgr {
}
/** Get a common file (literal file or directory) from all the installed mods. Files are guaranteed to exist. If a mod does not
* contain the file, the mod will be skipped. */
fun getFilesFromEveryMod(path: String): List<File> {
* contain the file, the mod will be skipped.
*
* @return List of pairs<modname, file>
*/
fun getFilesFromEveryMod(path: String): List<Pair<String, File>> {
val path = path.sanitisePath()
val moduleNames = moduleInfo.keys.toList()
val filesList = ArrayList<File>()
val filesList = ArrayList<Pair<String, File>>()
moduleNames.forEach {
val file = File(getPath(it, path))
if (file.exists()) filesList.add(file)
if (file.exists()) filesList.add(it to file)
}
return filesList.toList()
@@ -196,16 +199,18 @@ object ModMgr {
/** Get a common file (literal file or directory) from all the installed mods. Files are guaranteed to exist. If a mod does not
* contain the file, the mod will be skipped.
*
* Returning files are read-only. */
fun getGdxFilesFromEveryMod(path: String): List<FileHandle> {
* Returning files are read-only.
* @return List of pairs<modname, filehandle>
*/
fun getGdxFilesFromEveryMod(path: String): List<Pair<String, FileHandle>> {
val path = path.sanitisePath()
val moduleNames = moduleInfo.keys.toList()
val filesList = ArrayList<FileHandle>()
val filesList = ArrayList<Pair<String, FileHandle>>()
moduleNames.forEach {
val file = Gdx.files.internal(getPath(it, path))
if (file.exists()) filesList.add(file)
if (file.exists()) filesList.add(it to file)
}
return filesList.toList()
@@ -230,16 +235,17 @@ object ModMgr {
@JvmStatic operator fun invoke(module: String) {
val csv = CSVFetcher.readFromModule(module, itemPath + "itemid.csv")
csv.forEach {
val className = it["classname"].toString()
val itemID = it["id"].toInt()
val className: String = it["classname"].toString()
val internalID: Int = it["id"].toInt()
val itemName: String = "item@$module:$internalID"
printdbg(this, "Reading item #$itemID with className $className")
printdbg(this, "Reading item ${itemName} <<- internal #$internalID with className $className")
val loadedClass = Class.forName(className)
val loadedClassConstructor = loadedClass.getConstructor(ItemID::class.java)
val loadedClassInstance = loadedClassConstructor.newInstance(itemID)
val loadedClassInstance = loadedClassConstructor.newInstance(itemName)
ItemCodex[itemID] = loadedClassInstance as GameItem
ItemCodex[itemName] = loadedClassInstance as GameItem
}
}
}

View File

@@ -36,6 +36,7 @@ object PostProcessor : Disposable {
private val defaultResCol = Color(0x66ffff66)
private val safeAreaCol = Color(0xffffff66.toInt())
private val safeAreaCol2 = Color(0xffffff44.toInt())
private val currentResCol = Color(0xff00ff44.toInt())
private val debugUI = BasicDebugInfoWindow()
@@ -192,7 +193,14 @@ object PostProcessor : Disposable {
AppLoader.fontSmallNumbers.draw(
batch, defaultResStr,
(AppLoader.screenW - AppLoader.minimumW).div(2).toFloat(),
(AppLoader.screenH - AppLoader.minimumH).div(2).minus(10).toFloat()
(AppLoader.screenH - AppLoader.minimumH).div(2).toFloat()
)
batch.color = currentResCol
AppLoader.fontSmallNumbers.draw(
batch, currentResStr,
AppLoader.screenW - 80f,
0f
)
}
}
@@ -206,6 +214,7 @@ object PostProcessor : Disposable {
}
private val defaultResStr = "${AppLoader.minimumW}x${AppLoader.minimumH}"
private val currentResStr = "${AppLoader.screenW}x${AppLoader.screenH}"
private val safeAreaStr = "TV Safe Area"
private val versionStr = "Version ${AppLoader.getVERSION_STRING()}"
private val thisIsDebugStr = "${AppLoader.GAME_NAME} Develoment Build $versionStr"

View File

@@ -6,19 +6,22 @@ package net.torvald.terrarum
*/
object ReferencingRanges {
val TILES = 0..4095
val WALLS = 4096..8191
val WIRES = 8192..8447
val ITEMS_STATIC = 8448..0x0F_FFFF
val ITEMS_DYNAMIC = 0x10_0000..0x0FFF_FFFF
val ACTORS = 0x1000_0000..0x7FFF_FFFF
val TILES = 0..65535 // 65 536 blocks
val WALLS = 65536..131071 // 65 536 walls
val WIRES = 131072..135167 // 4 096 wires
val ITEMS_STATIC = 135168..0x0F_FFFF // 913 408 items
val ITEMS_DYNAMIC = 0x10_0000..0x0FFF_FFFF // 267 386 880 pseudo-items
val ACTORS = 0x1000_0000..0x7FFF_FFFF // too much actors
// Actor IDs are assigned in 256 groups, single actor can have 256 sub-actors
val ACTORS_BEHIND = 0x1000_0000..0x1FFF_FFFF // Rendered behind (e.g. tapestries)
val ACTORS_MIDDLE = 0x2000_0000..0x4FFF_FFFF // Regular actors (e.g. almost all of them)
val ACTORS_MIDTOP = 0x5000_0000..0x5FFF_FFFF // Special (e.g. weapon swung, bullets, dropped item, particles)
val ACTORS_FRONT = 0x6000_0000..0x6FFF_FFFF // Rendered front (e.g. fake tile)
val ACTORS_OVERLAY = 0x7000_0000..0x7FFF_FFFF // Rendered as screen overlay, not affected by light nor environment overlays
val VIRTUAL_TILES = -2 downTo -65536 // index of -1 breaks things for some reason :(
val VIRTUAL_TILES = -2 downTo -1048576 // index of -1 breaks things for some reason :(
val PREFIX_DYNAMICITEM = "dyn:"
val PREFIX_ACTORITEM = "actor:"
}

View File

@@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.jme3.math.FastMath
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.util.CircularArray
/**
@@ -70,6 +71,8 @@ object SanicLoadScreen : LoadScreenBase() {
private var messageForegroundColour = Color.WHITE
override fun render(delta: Float) {
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
val delta = Gdx.graphics.rawDeltaTime
glideDispY = AppLoader.screenH - 100f - AppLoader.fontGame.lineHeight

View File

@@ -11,6 +11,7 @@ import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.utils.Disposable
import com.jme3.math.FastMath
import net.torvald.UnsafeHelper
import net.torvald.random.HQRNG
import net.torvald.terrarum.AppLoader.*
import net.torvald.terrarum.gameactors.Actor
@@ -24,6 +25,8 @@ import net.torvald.util.CircularArray
import java.io.File
import java.io.PrintStream
import kotlin.math.absoluteValue
import kotlin.math.round
import kotlin.math.roundToInt
@@ -97,12 +100,16 @@ object Terrarum : Disposable {
}
val memNativeHeap: Int
get() {
nativeHeapCircularArray.appendHead((Gdx.app.javaHeap shr 20).toInt())
nativeHeapCircularArray.appendHead((Gdx.app.nativeHeap shr 20).toInt())
var acc = 0
nativeHeapCircularArray.forEach { acc = maxOf(acc, it) }
return acc
}
val memUnsafe: Int
get() {
return (UnsafeHelper.unsafeAllocatedSize shr 20).toInt()
}
val memXmx: Int
get() = (Runtime.getRuntime().maxMemory() shr 20).toInt()
val updateRateStr: String
@@ -333,10 +340,6 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
batch?.projectionMatrix = camera?.combined
}
fun Float.round(): Float {
return Math.round(this).toFloat()
}
// ShapeRenderer alternative for rects
fun SpriteBatch.fillRect(x: Float, y: Float, w: Float, h: Float) {
@@ -506,11 +509,10 @@ fun Float.floor() = FastMath.floor(this).toFloat()
fun Double.ceilInt() = Math.ceil(this).toInt()
fun Float.ceil(): Float = FastMath.ceil(this).toFloat()
fun Float.ceilInt() = FastMath.ceil(this)
fun Float.round(): Float = round(this)
fun Double.round() = Math.round(this).toDouble()
fun Double.floor() = Math.floor(this)
fun Double.ceil() = this.floor() + 1.0
@Deprecated("Use kotlin.roundToInt") fun Double.roundInt(): Int = Math.round(this).toInt()
@Deprecated("Use kotlin.roundToInt") fun Float.roundInt(): Int = Math.round(this)
fun Double.abs() = Math.abs(this)
fun Double.sqr() = this * this
fun Float.sqr() = this * this

View File

@@ -12,7 +12,7 @@ public class TerrarumAppConfiguration {
//////////////////////////////////////
public static final String GAME_NAME = "Terrarum";
public static final String COPYRIGHT_DATE_NAME = "Copyright 2013-2020 Torvald (minjaesong)";
public static final String COPYRIGHT_DATE_NAME = "Copyright 2013-2021 Torvald (minjaesong)";
/**
* <p>

View File

@@ -292,6 +292,8 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
override fun resize(width: Int, height: Int) {
printdbg(this, "resize() called")
printdbg(this, "called by:")
printStackTrace(this)
// Set up viewport when window is resized
initViewPort(AppLoader.screenW, AppLoader.screenH)

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
import net.torvald.terrarum.ui.UIItem
import net.torvald.terrarum.ui.UIItemImageButton
import net.torvald.terrarum.ui.UIUtils
import kotlin.math.roundToInt
/**
* Created by minjaesong on 2017-10-20.
@@ -45,7 +46,7 @@ class UIItemInventoryCatBar(
init {
// place sub UIs: Image Buttons
mainButtons = Array(catArrangement.size) { index ->
val iconPosX = ((buttonGapSize / 2) + index * (catIcons.tileW + buttonGapSize)).roundInt()
val iconPosX = ((buttonGapSize / 2) + index * (catIcons.tileW + buttonGapSize)).roundToInt()
val iconPosY = 0
UIItemImageButton(
@@ -75,9 +76,9 @@ class UIItemInventoryCatBar(
sideButtons = Array(iconIndex.size) { index ->
val iconPosX = if (index < 2)
(relativeStartX + sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundInt()
(relativeStartX + sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
else
(relativeStartX + width + 2 * sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundInt()
(relativeStartX + width + 2 * sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundToInt()
val iconPosY = 0
UIItemImageButton(

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText
@@ -105,7 +106,7 @@ class UIItemInventoryElem(
// this one-liner sets color
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
// draw name of the item
if (AppLoader.IS_DEVELOPMENT_BUILD) {
if (INVEN_DEBUG_MODE) {
AppLoader.fontGame.draw(batch,
// print static id, dynamic id, and count
"${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""),

View File

@@ -5,128 +5,128 @@ package net.torvald.terrarum.blockproperties
*/
object Block {
const val AIR = 0 // hard coded; this is the standard
const val AIR = "basegame:0" // hard coded; this is the standard
const val STONE = 16
const val STONE_QUARRIED = 17
const val STONE_TILE_WHITE = 18
const val STONE_BRICKS = 19
const val STONE = "basegame:16"
const val STONE_QUARRIED = "basegame:17"
const val STONE_TILE_WHITE = "basegame:18"
const val STONE_BRICKS = "basegame:19"
const val DIRT = 32
const val GRASS = 33
const val GRASSWALL = 34
const val DIRT = "basegame:32"
const val GRASS = "basegame:33"
const val GRASSWALL = "basegame:34"
const val PLANK_NORMAL = 48
const val PLANK_EBONY = 49
const val PLANK_BIRCH = 50
const val PLANK_BLOODROSE = 51
const val PLANK_NORMAL = "basegame:48"
const val PLANK_EBONY = "basegame:49"
const val PLANK_BIRCH = "basegame:50"
const val PLANK_BLOODROSE = "basegame:51"
const val TRUNK_NORMAL = 64
const val TRUNK_EBONY = 65
const val TRUNK_BIRCH = 66
const val TRUNK_BLOODROSE = 67
const val TRUNK_NORMAL = "basegame:64"
const val TRUNK_EBONY = "basegame:65"
const val TRUNK_BIRCH = "basegame:66"
const val TRUNK_BLOODROSE = "basegame:67"
const val SAND = 80
const val SAND_WHITE = 81
const val SAND_RED = 82
const val SAND_DESERT = 83
const val SAND_BLACK = 84
const val SAND_GREEN = 85
const val SAND = "basegame:80"
const val SAND_WHITE = "basegame:81"
const val SAND_RED = "basegame:82"
const val SAND_DESERT = "basegame:83"
const val SAND_BLACK = "basegame:84"
const val SAND_GREEN = "basegame:85"
const val GRAVEL = 96
const val GRAVEL_GREY = 97
const val GRAVEL = "basegame:96"
const val GRAVEL_GREY = "basegame:97"
const val ORE_COPPER = 112
const val ORE_IRON = 113
const val ORE_GOLD = 114
const val ORE_SILVER = 115
const val ORE_ILMENITE = 116
const val ORE_AURICHALCUM = 117
const val ORE_COPPER = "basegame:112"
const val ORE_IRON = "basegame:113"
const val ORE_GOLD = "basegame:114"
const val ORE_SILVER = "basegame:115"
const val ORE_ILMENITE = "basegame:116"
const val ORE_AURICHALCUM = "basegame:117"
const val RAW_RUBY = 128
const val RAW_EMERALD = 129
const val RAW_SAPPHIRE = 130
const val RAW_TOPAZ = 131
const val RAW_DIAMOND = 132
const val RAW_AMETHYST = 133
const val RAW_RUBY = "basegame:128"
const val RAW_EMERALD = "basegame:129"
const val RAW_SAPPHIRE = "basegame:130"
const val RAW_TOPAZ = "basegame:131"
const val RAW_DIAMOND = "basegame:132"
const val RAW_AMETHYST = "basegame:133"
const val SNOW = 144
const val ICE_FRAGILE = 145
const val ICE_NATURAL = 146
const val ICE_MAGICAL = 147
const val SNOW = "basegame:144"
const val ICE_FRAGILE = "basegame:145"
const val ICE_NATURAL = "basegame:146"
const val ICE_MAGICAL = "basegame:147"
const val GLASS_CRUDE = 148
const val GLASS_CLEAN = 149
const val GLASS_CRUDE = "basegame:148"
const val GLASS_CLEAN = "basegame:149"
const val PLATFORM_STONE = 160
const val PLATFORM_WOODEN = 161
const val PLATFORM_EBONY = 162
const val PLATFORM_BIRCH = 163
const val PLATFORM_BLOODROSE = 164
const val PLATFORM_STONE = "basegame:160"
const val PLATFORM_WOODEN = "basegame:161"
const val PLATFORM_EBONY = "basegame:162"
const val PLATFORM_BIRCH = "basegame:163"
const val PLATFORM_BLOODROSE = "basegame:164"
const val TORCH = 176
const val TORCH_FROST = 177
const val TORCH = "basegame:176"
const val TORCH_FROST = "basegame:177"
const val TORCH_OFF = 192
const val TORCH_FROST_OFF = 193
const val TORCH_OFF = "basegame:192"
const val TORCH_FROST_OFF = "basegame:193"
const val ILLUMINATOR_WHITE = 208
const val ILLUMINATOR_YELLOW = 209
const val ILLUMINATOR_ORANGE = 210
const val ILLUMINATOR_RED = 211
const val ILLUMINATOR_FUCHSIA = 212
const val ILLUMINATOR_PURPLE = 213
const val ILLUMINATOR_BLUE = 214
const val ILLUMINATOR_CYAN = 215
const val ILLUMINATOR_GREEN = 216
const val ILLUMINATOR_GREEN_DARK = 217
const val ILLUMINATOR_BROWN = 218
const val ILLUMINATOR_TAN = 219
const val ILLUMINATOR_GREY_LIGHT = 220
const val ILLUMINATOR_GREY_MED = 221
const val ILLUMINATOR_GREY_DARK = 222
const val ILLUMINATOR_BLACK = 223
const val ILLUMINATOR_WHITE = "basegame:208"
const val ILLUMINATOR_YELLOW = "basegame:209"
const val ILLUMINATOR_ORANGE = "basegame:210"
const val ILLUMINATOR_RED = "basegame:211"
const val ILLUMINATOR_FUCHSIA = "basegame:212"
const val ILLUMINATOR_PURPLE = "basegame:213"
const val ILLUMINATOR_BLUE = "basegame:214"
const val ILLUMINATOR_CYAN = "basegame:215"
const val ILLUMINATOR_GREEN = "basegame:216"
const val ILLUMINATOR_GREEN_DARK = "basegame:217"
const val ILLUMINATOR_BROWN = "basegame:218"
const val ILLUMINATOR_TAN = "basegame:219"
const val ILLUMINATOR_GREY_LIGHT = "basegame:220"
const val ILLUMINATOR_GREY_MED = "basegame:221"
const val ILLUMINATOR_GREY_DARK = "basegame:222"
const val ILLUMINATOR_BLACK = "basegame:223"
const val ILLUMINATOR_WHITE_OFF = 224
const val ILLUMINATOR_YELLOW_OFF = 225
const val ILLUMINATOR_ORANGE_OFF = 226
const val ILLUMINATOR_RED_OFF = 227
const val ILLUMINATOR_FUCHSIA_OFF = 228
const val ILLUMINATOR_PURPLE_OFF = 229
const val ILLUMINATOR_BLUE_OFF = 230
const val ILLUMINATOR_CYAN_OFF = 231
const val ILLUMINATOR_GREEN_OFF = 232
const val ILLUMINATOR_GREEN_DARK_OFF = 233
const val ILLUMINATOR_BROWN_OFF = 234
const val ILLUMINATOR_TAN_OFF = 235
const val ILLUMINATOR_GREY_LIGHT_OFF = 236
const val ILLUMINATOR_GREY_MED_OFF = 237
const val ILLUMINATOR_GREY_DARK_OFF = 238
const val ILLUMINATOR_BLACK_OFF = 239
const val ILLUMINATOR_WHITE_OFF = "basegame:224"
const val ILLUMINATOR_YELLOW_OFF = "basegame:225"
const val ILLUMINATOR_ORANGE_OFF = "basegame:226"
const val ILLUMINATOR_RED_OFF = "basegame:227"
const val ILLUMINATOR_FUCHSIA_OFF = "basegame:228"
const val ILLUMINATOR_PURPLE_OFF = "basegame:229"
const val ILLUMINATOR_BLUE_OFF = "basegame:230"
const val ILLUMINATOR_CYAN_OFF = "basegame:231"
const val ILLUMINATOR_GREEN_OFF = "basegame:232"
const val ILLUMINATOR_GREEN_DARK_OFF = "basegame:233"
const val ILLUMINATOR_BROWN_OFF = "basegame:234"
const val ILLUMINATOR_TAN_OFF = "basegame:235"
const val ILLUMINATOR_GREY_LIGHT_OFF = "basegame:236"
const val ILLUMINATOR_GREY_MED_OFF = "basegame:237"
const val ILLUMINATOR_GREY_DARK_OFF = "basegame:238"
const val ILLUMINATOR_BLACK_OFF = "basegame:239"
const val SANDSTONE = 240
const val SANDSTONE_WHITE = 241
const val SANDSTONE_RED = 242
const val SANDSTONE_DESERT = 243
const val SANDSTONE_BLACK = 244
const val SANDSTONE_GREEN = 245
const val SANDSTONE = "basegame:240"
const val SANDSTONE_WHITE = "basegame:241"
const val SANDSTONE_RED = "basegame:242"
const val SANDSTONE_DESERT = "basegame:243"
const val SANDSTONE_BLACK = "basegame:244"
const val SANDSTONE_GREEN = "basegame:245"
const val LANTERN = 256
const val SUNSTONE = 257
const val DAYLIGHT_CAPACITOR = 258
const val LANTERN = "basegame:256"
const val SUNSTONE = "basegame:257"
const val DAYLIGHT_CAPACITOR = "basegame:258"
const val ACTORBLOCK_NO_COLLISION = 4091
const val ACTORBLOCK_FULL_COLLISION = 4092
const val ACTORBLOCK_ALLOW_MOVE_DOWN = 4093
const val ACTORBLOCK_NO_PASS_RIGHT = 4094
const val ACTORBLOCK_NO_PASS_LEFT = 4095
const val ACTORBLOCK_NO_COLLISION = "basegame:4091"
const val ACTORBLOCK_FULL_COLLISION = "basegame:4092"
const val ACTORBLOCK_ALLOW_MOVE_DOWN = "basegame:4093"
const val ACTORBLOCK_NO_PASS_RIGHT = "basegame:4094"
const val ACTORBLOCK_NO_PASS_LEFT = "basegame:4095"
const val LAVA = 4094
const val WATER = 4095
const val LAVA = "basegame:4094"
const val WATER = "basegame:4095"
const val NULL = -1
const val NULL = "basegame:-1"
val actorblocks = listOf(
ACTORBLOCK_NO_COLLISION,

View File

@@ -5,6 +5,7 @@ import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.AppLoader.printmsg
import net.torvald.terrarum.ReferencingRanges
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.FluidType
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.utils.CSVFetcher
@@ -18,12 +19,12 @@ import java.io.IOException
*/
object BlockCodex {
private var blockProps = HashMap<Int, BlockProp>()
private var blockProps = HashMap<ItemID, BlockProp>()
val dynamicLights = SortedArrayList<Int>() // does not include virtual ones
val dynamicLights = SortedArrayList<ItemID>() // does not include virtual ones
/** 4096 */
val MAX_TERRAIN_TILES = GameWorld.TILES_SUPPORTED
/** 65536 */
//val MAX_TERRAIN_TILES = GameWorld.TILES_SUPPORTED
private val nullProp = BlockProp()
@@ -32,12 +33,17 @@ object BlockCodex {
// fake props for "randomised" dynamic lights
const val DYNAMIC_RANDOM_CASES = 64
var virtualPropsCount = 0
private set
/** always points to the HIGHEST prop ID. <Original ID, Virtual ID> */
val dynamicToVirtualPropMapping = ArrayList<Pair<Int, Int>>()
/** for random access dont iterate over this */
val dynamicToVirtualMap = hashMapOf<Int, Int>()
private var virtualTileCursor = 1
/**
* One-to-Many
*/
val tileToVirtual = HashMap<ItemID, List<ItemID>>()
/**
* Many-to-One
*/
val virtualToTile = HashMap<ItemID, ItemID>()
/**
* Later entry (possible from other modules) will replace older ones
@@ -56,27 +62,28 @@ object BlockCodex {
setProp(blockProps[intVal(it, "id")], it)
}*/
val id = intVal(it, "id")
setProp(id, it)
setProp(module, intVal(it, "id"), it)
val tileId = "$module:${intVal(it, "id")}"
// register tiles with dynamic light
if ((blockProps[id]?.dynamicLuminosityFunction ?: 0) != 0) {
dynamicLights.add(id)
if ((blockProps[tileId]?.dynamicLuminosityFunction ?: 0) != 0) {
dynamicLights.add(tileId)
// add virtual props for dynamic lights
val virtualIDMax = ReferencingRanges.VIRTUAL_TILES.first - virtualPropsCount
dynamicToVirtualPropMapping.add(id to virtualIDMax)
dynamicToVirtualMap[id] = virtualIDMax
repeat(DYNAMIC_RANDOM_CASES) { i ->
setProp(virtualIDMax - i, it)
printdbg(this, "Block ID $id -> Virtual ID ${virtualIDMax - i}, baseLum: ${blockProps[virtualIDMax - i]?.baseLumCol}")
val virtualChunk = ArrayList<ItemID>()
repeat(DYNAMIC_RANDOM_CASES) { _ ->
val virtualID = "virt:$virtualTileCursor"
virtualPropsCount += 1
virtualToTile[virtualID] = tileId
virtualChunk.add(virtualID)
setProp("virt", virtualTileCursor, it)
printdbg(this, "Block ID $tileId -> Virtual ID $virtualID, baseLum: ${blockProps[virtualID]?.baseLumCol}")
virtualTileCursor += 1
}
tileToVirtual[tileId] = virtualChunk.sorted().toList()
}
if (id > highestNumber)
highestNumber = id
}
}
catch (e: IOException) {
@@ -84,6 +91,8 @@ object BlockCodex {
}
}
fun getAll() = blockProps.values
/*fun get(index: Int): BlockProp {
try {
return blockProps[index]
@@ -97,7 +106,7 @@ object BlockCodex {
}
}*/
operator fun get(rawIndex: Int?): BlockProp {
/*operator fun get(rawIndex: Int?): BlockProp {
if (rawIndex == null || rawIndex == Block.NULL) {
return nullProp
}
@@ -108,45 +117,59 @@ object BlockCodex {
catch (e: NullPointerException) {
throw NullPointerException("Blockprop with raw id $rawIndex does not exist.")
}
}
operator fun get(fluidType: FluidType?): BlockProp {
if (fluidType == null || fluidType.value == 0) {
return blockProps[Block.AIR]!!
}*/
operator fun get(blockID: ItemID?): BlockProp {
if (blockID == null || blockID == "basegame:"+Block.NULL) {
return nullProp
}
try {
return blockProps[fluidType.abs() + GameWorld.TILES_SUPPORTED - 1]!!
return blockProps[blockID]!!
}
catch (e: NullPointerException) {
throw NullPointerException("Blockprop with raw id $fluidType does not exist.")
throw NullPointerException("Blockprop with id $blockID does not exist.")
}
}
fun getOrNull(rawIndex: Int?): BlockProp? {//<O>
return blockProps[rawIndex]
operator fun get(fluidType: FluidType?): BlockProp {
// TODO fluid from other mods
if (fluidType == null || fluidType.value == 0) {
return blockProps["basegame:"+Block.AIR]!!
}
try {
return blockProps["basegame:${fluidType.abs() + GameWorld.TILES_SUPPORTED - 1}"]!!
}
catch (e: NullPointerException) {
throw NullPointerException("Blockprop with id $fluidType does not exist.")
}
}
private fun setProp(key: Int, record: CSVRecord) {
fun getOrNull(blockID: ItemID?): BlockProp? {//<O>
return blockProps[blockID]
}
private fun setProp(modname: String, key: Int, record: CSVRecord) {
val prop = BlockProp()
prop.nameKey = record.get("name")
prop.id = if (key == -1) 0 else intVal(record, "id")
prop.drop = intVal(record, "drop")
prop.id = "$modname:$key"
prop.drop = "$modname:${intVal(record, "drop")}"
prop.shadeColR = floatVal(record, "shdr") / LightmapRenderer.MUL_FLOAT
prop.shadeColG = floatVal(record, "shdg") / LightmapRenderer.MUL_FLOAT
prop.shadeColB = floatVal(record, "shdb") / LightmapRenderer.MUL_FLOAT
prop.shadeColA = floatVal(record, "shduv") / LightmapRenderer.MUL_FLOAT
prop.shadeColR = floatVal(record, "shdr")
prop.shadeColG = floatVal(record, "shdg")
prop.shadeColB = floatVal(record, "shdb")
prop.shadeColA = floatVal(record, "shduv")
prop.opacity = Cvec(prop.shadeColR, prop.shadeColG, prop.shadeColB, prop.shadeColA)
prop.strength = intVal(record, "str")
prop.density = intVal(record, "dsty")
prop.baseLumColR = floatVal(record, "lumr") / LightmapRenderer.MUL_FLOAT
prop.baseLumColG = floatVal(record, "lumg") / LightmapRenderer.MUL_FLOAT
prop.baseLumColB = floatVal(record, "lumb") / LightmapRenderer.MUL_FLOAT
prop.baseLumColA = floatVal(record, "lumuv") / LightmapRenderer.MUL_FLOAT
prop.baseLumColR = floatVal(record, "lumr")
prop.baseLumColG = floatVal(record, "lumg")
prop.baseLumColB = floatVal(record, "lumb")
prop.baseLumColA = floatVal(record, "lumuv")
prop.baseLumCol.set(prop.baseLumColR, prop.baseLumColG, prop.baseLumColB, prop.baseLumColA)
prop.friction = intVal(record, "fr")
@@ -163,9 +186,9 @@ object BlockCodex {
prop.dynamicLuminosityFunction = intVal(record, "dlfn")
blockProps[key] = prop
blockProps[prop.id] = prop
printmsg(this, "${intVal(record, "id")}\t" + prop.nameKey)
printmsg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}\tsolid:${prop.isSolid}")
}
}

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.blockproperties
import net.torvald.gdx.graphics.Cvec
import net.torvald.random.XXHash32
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.serialise.toLittle
@@ -10,7 +11,7 @@ import net.torvald.terrarum.serialise.toLittle
*/
class BlockProp {
var id: Int = 0
var id: ItemID = ""
var nameKey: String = ""
@@ -62,14 +63,14 @@ class BlockProp {
baseLumCol
} else {
val offset = XXHash32.hash(((x and 0xFFFF).shl(16) or (y and 0xFFFF)).toLittle(), 10000).fmod(BlockCodex.DYNAMIC_RANDOM_CASES)
BlockCodex[BlockCodex.dynamicToVirtualMap[id]!! - offset]._lumCol
BlockCodex[BlockCodex.tileToVirtual[id]!![offset]]._lumCol
}
fun getLumCol(x: Int, y: Int, channel: Int): Float = if (dynamicLuminosityFunction == 0) {
baseLumCol.getElem(channel)
} else {
val offset = XXHash32.hash(((x and 0xFFFF).shl(16) or (y and 0xFFFF)).toLittle(), 10000).fmod(BlockCodex.DYNAMIC_RANDOM_CASES)
BlockCodex[BlockCodex.dynamicToVirtualMap[id]!! - offset]._lumCol.getElem(channel)
BlockCodex[BlockCodex.tileToVirtual[id]!![offset]]._lumCol.getElem(channel)
}
/**
@@ -80,7 +81,7 @@ class BlockProp {
//fun getLum(channel: Int) = lumCol.getElem(channel)
var drop: Int = 0
var drop: ItemID = ""
var maxSupport: Int = -1 // couldn't use NULL at all...

View File

@@ -71,36 +71,34 @@ object BlockPropUtil {
catch (skip: NullPointerException) {}
}*/
// update randomised virtual props instead
for (keyMax in BlockCodex.dynamicToVirtualPropMapping) {
repeat(BlockCodex.DYNAMIC_RANDOM_CASES) {
val prop = BlockCodex[keyMax.second - it]
val domain = when (prop.dynamicLuminosityFunction) {
1 -> flickerFuncDomain
4 -> breathCycleDuration
5 -> pulsateCycleDuration
else -> 0f
}
// FPS-time compensation
if (Gdx.graphics.framesPerSecond > 0) {
prop.rngBase0 += Gdx.graphics.rawDeltaTime
}
// reset timer
if (prop.rngBase0 > domain) {
prop.rngBase0 -= domain
// flicker related
prop.rngBase1 = prop.rngBase2
prop.rngBase2 = getNewRandom()
}
prop._lumCol.set(getDynamicLumFunc(prop))
//prop.lumColR = prop.lumCol.r
//prop.lumColG = prop.lumCol.g
//prop.lumColB = prop.lumCol.b
//prop.lumColA = prop.lumCol.a
for (key in BlockCodex.tileToVirtual.values.flatten()) {
val prop = BlockCodex[key]
val domain = when (prop.dynamicLuminosityFunction) {
1 -> flickerFuncDomain
4 -> breathCycleDuration
5 -> pulsateCycleDuration
else -> 0f
}
// FPS-time compensation
if (Gdx.graphics.framesPerSecond > 0) {
prop.rngBase0 += Gdx.graphics.rawDeltaTime
}
// reset timer
if (prop.rngBase0 > domain) {
prop.rngBase0 -= domain
// flicker related
prop.rngBase1 = prop.rngBase2
prop.rngBase2 = getNewRandom()
}
prop._lumCol.set(getDynamicLumFunc(prop))
//prop.lumColR = prop.lumCol.r
//prop.lumColG = prop.lumCol.g
//prop.lumColB = prop.lumCol.b
//prop.lumColA = prop.lumCol.a
}
}
@@ -111,8 +109,8 @@ object BlockPropUtil {
private fun getDynamicLumFunc(prop: BlockProp): Cvec {
return when (prop.dynamicLuminosityFunction) {
1 -> getTorchFlicker(prop)
2 -> (Terrarum.ingame!!.world).globalLight.cpy().mul(LightmapRenderer.DIV_FLOAT) // current global light
3 -> WeatherMixer.getGlobalLightOfTime(Terrarum.ingame!!.world, WorldTime.DAY_LENGTH / 2).cpy().mul(LightmapRenderer.DIV_FLOAT) // daylight at noon
2 -> (Terrarum.ingame!!.world).globalLight.cpy() // current global light
3 -> WeatherMixer.getGlobalLightOfTime(Terrarum.ingame!!.world, WorldTime.DAY_LENGTH / 2).cpy() // daylight at noon
4 -> getSlowBreath(prop)
5 -> getPulsate(prop)
else -> prop.baseLumCol

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.blockstats
import com.jme3.math.FastMath
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.worlddrawer.BlocksDrawer
@@ -14,7 +15,7 @@ import java.util.*
*/
object BlockStats {
private val tilestat = ShortArray(GameWorld.TILES_SUPPORTED)
private val tilestat = HashMap<ItemID, Int>()
private val TSIZE = CreateTileAtlas.TILE_SIZE
@@ -22,7 +23,7 @@ object BlockStats {
* Update tile stats from tiles on screen
*/
fun update() {
Arrays.fill(tilestat, 0.toShort())
tilestat.clear()
// Get stats on no-zoomed screen area. In other words, will behave as if screen zoom were 1.0
// no matter how the screen is zoomed.
@@ -47,29 +48,14 @@ object BlockStats {
for (x in for_x_start..for_x_end - 1) {
val tileWall = map.getTileFromWall(x, y)
val tileTerrain = map.getTileFromTerrain(x, y)
++tilestat[tileWall ?: 0]
++tilestat[tileTerrain ?: 0]
tilestat[tileWall] = 1 + (tilestat[tileWall] ?: 0)
tilestat[tileTerrain] = 1 + (tilestat[tileTerrain] ?: 0)
}
}
}
fun getCount(vararg tile: Byte): Int {
var sum = 0
for (i in tile.indices) {
val newArgs = java.lang.Byte.toUnsignedInt(tile[i])
sum += java.lang.Short.toUnsignedInt(tilestat[newArgs])
}
return sum
fun getCount(vararg tiles: ItemID): Int {
return tiles.fold(0) { acc, key -> acc + (tilestat[key] ?: 0) }
}
fun getCount(vararg tile: Int): Int {
var sum = 0
for (i in tile.indices) {
sum += java.lang.Short.toUnsignedInt(tilestat[tile[i]])
}
return sum
}
}

View File

@@ -1,6 +1,5 @@
package net.torvald.terrarum.blockstats
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.utils.Disposable
@@ -60,7 +59,7 @@ object MinimapComposer : Disposable {
private val liveTilesMeta = Array(TILES_IN_X * TILES_IN_Y) { LiveTileMeta(revalidate = true) }
private val updaterQueue = Queue<Runnable>(TILES_IN_X * TILES_IN_Y * 2)
private var currentThreads = Array(maxOf(1, AppLoader.THREADS.times(2).div(3))) {
private var currentThreads = Array(maxOf(1, AppLoader.THREAD_COUNT.times(2).div(3))) {
Thread()
}
@@ -135,10 +134,10 @@ object MinimapComposer : Disposable {
for (y in topLeftY until topLeftY + LIVETILE_SIZE) {
for (x in if (tileSlotIndexY >= TILES_IN_X / 2) (topLeftX + LIVETILE_SIZE - 1) downTo topLeftX else topLeftX until topLeftX + LIVETILE_SIZE) {
val tileTerr = world.getTileFromTerrain(x, y) ?: throw Error("OoB: $x, $y")
val wallTerr = world.getTileFromWall(x, y) ?: Block.AIR
val colTerr = CreateTileAtlas.terrainTileColourMap.get(tileTerr % 16, tileTerr / 16)
val colWall = CreateTileAtlas.terrainTileColourMap.get(wallTerr % 16, wallTerr / 16).mul(BlocksDrawer.wallOverlayColour)
val tileTerr = world.getTileFromTerrain(x, y)
val wallTerr = world.getTileFromWall(x, y)
val colTerr = CreateTileAtlas.terrainTileColourMap.get(tileTerr)!!.toGdxColor()
val colWall = CreateTileAtlas.terrainTileColourMap.get(wallTerr)!!.toGdxColor().mul(CreateTileAtlas.wallOverlayColour)
val outCol = if (colTerr.a > 0.1f) colTerr else colWall

View File

@@ -0,0 +1,137 @@
package net.torvald.terrarum.concurrent
import java.util.concurrent.*
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
typealias RunnableFun = () -> Unit
/** Int: index of the processing core */
typealias ThreadableFun = (Int) -> Unit
object ThreadExecutor {
val threadCount = Runtime.getRuntime().availableProcessors() // not using (logicalCores + 1) method; it's often better idea to reserve one extra thread for other jobs in the app
private lateinit var executor: ExecutorService// = Executors.newFixedThreadPool(threadCount)
val futures = ArrayList<Future<*>>()
private var isOpen = true
var allFinished = true
private set
private fun checkShutdown() {
try {
if (executor.isTerminated)
throw IllegalStateException("Executor terminated, renew the executor service.")
if (!isOpen || executor.isShutdown)
throw IllegalStateException("Pool is closed, come back when all the threads are terminated.")
}
catch (e: UninitializedPropertyAccessException) {}
}
fun renew() {
try {
if (!executor.isTerminated && !executor.isShutdown) throw IllegalStateException("Pool is still running")
}
catch (_: UninitializedPropertyAccessException) {}
executor = Executors.newFixedThreadPool(threadCount)
futures.clear()
isOpen = true
allFinished = false
}
/*fun invokeAll(ts: List<Callable<Unit>>) {
checkShutdown()
executor.invokeAll(ts)
}*/
fun submit(t: Callable<Unit>) {
checkShutdown()
futures.add(executor.submit(t))
}
fun submitAll(ts: List<Callable<Unit>>) {
checkShutdown()
ts.forEach { futures.add(executor.submit(it)) }
}
// https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
fun join() {
//println("ThreadExecutor.join")
isOpen = false
futures.forEach {
try {
it.get()
}
catch (e: ExecutionException) {
throw e
}
}
executor.shutdown() // thread status of completed ones will be WAIT instead of TERMINATED without this line...
executor.awaitTermination(24L, TimeUnit.HOURS)
allFinished = true
}
}
/**
* Shallow flat of the array
*/
fun <T> Array<out Iterable<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
/**
* Shallow flat of the iterable
*/
fun <T> Iterable<out Iterable<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
/**
* Shallow flat of the array
*/
fun <T> Array<out Array<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
fun <T> Iterable<T>.sliceEvenly(slices: Int): List<List<T>> = this.toList().sliceEvenly(slices)
fun <T> List<T>.sliceEvenly(slices: Int): List<List<T>> {
return (0 until slices).map {
this.subList(
this.size.toFloat().div(slices).times(it).roundToInt(),
this.size.toFloat().div(slices).times(it + 1).roundToInt()
)
}
}
fun <T> Array<T>.sliceEvenly(slices: Int): List<Array<T>> {
return (0 until slices).map {
this.sliceArray(
this.size.toFloat().div(slices).times(it).roundToInt() until
this.size.toFloat().div(slices).times(it + 1).roundToInt()
)
}
}
fun IntProgression.sliceEvenly(slices: Int): List<IntProgression> {
if (this.step.absoluteValue != 1) throw UnsupportedOperationException("Sorry, step != +1/-1")
val size = (this.last - this.first).absoluteValue + (this.step.toFloat()).absoluteValue
// println(size)
return if (this.first < this.last) (0 until slices).map {
this.first + size.div(slices).times(it).roundToInt() ..
this.first + size.div(slices).times(it + 1).roundToInt() - 1
}
else (0 until slices).map {
this.first - size.div(slices).times(it).roundToInt() downTo
this.first - size.div(slices).times(it + 1).roundToInt() + 1
}
}

View File

@@ -1,284 +0,0 @@
package net.torvald.terrarum.concurrent
import java.util.concurrent.*
import kotlin.math.absoluteValue
typealias RunnableFun = () -> Unit
/** Int: index of the processing core */
typealias ThreadableFun = (Int) -> Unit
object ThreadExecutor {
val threadCount = Runtime.getRuntime().availableProcessors() // not using (logicalCores + 1) method; it's often better idea to reserve one extra thread for other jobs in the app
private lateinit var executor: ExecutorService// = Executors.newFixedThreadPool(threadCount)
val futures = ArrayList<Future<*>>()
private var isOpen = true
private fun checkShutdown() {
try {
if (executor.isTerminated)
throw IllegalStateException("Executor terminated, renew the executor service.")
if (!isOpen || executor.isShutdown)
throw IllegalStateException("Pool is closed, come back when all the threads are terminated.")
}
catch (e: UninitializedPropertyAccessException) {}
}
fun renew() {
try {
if (!executor.isTerminated && !executor.isShutdown) throw IllegalStateException("Pool is still running")
}
catch (_: UninitializedPropertyAccessException) {}
executor = Executors.newFixedThreadPool(threadCount)
futures.clear()
isOpen = true
}
/*fun invokeAll(ts: List<Callable<Unit>>) {
checkShutdown()
executor.invokeAll(ts)
}*/
fun submit(t: Callable<Unit>) {
checkShutdown()
val fut = executor.submit(t)
futures.add(fut)
}
/*fun submit(f: RunnableFun) {
checkShutdown()
val fut = executor.submit { f() }
futures.add(fut)
}*/
// https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
fun join() {
println("ThreadExecutor.join")
isOpen = false
futures.forEach {
try {
it.get()
}
catch (e: ExecutionException) {
throw e
}
}
executor.shutdown() // thread status of completed ones will be WAIT instead of TERMINATED without this line...
executor.awaitTermination(24L, TimeUnit.HOURS)
}
}
/**
* Created by minjaesong on 2016-05-25.
*/
@Deprecated("Hooey implementation", ReplaceWith("ThreadExecutor", "net.torvald.terrarum.concurrent.ThreadExecutor"))
object ThreadParallel {
val threadCount = Runtime.getRuntime().availableProcessors() // not using (logicalCores + 1) method; it's often better idea to reserve one extra thread for other jobs in the app
private val pool: Array<Thread?> = Array(threadCount) { null }
/**
* Map Runnable object to certain index of the thread pool.
* @param index of the runnable
* @param runnable
* @param prefix Will name each thread like "Foo-1", "Foo-2", etc.
*/
fun map(index: Int, prefix: String, runnable: Runnable) {
pool[index] = Thread(runnable, "$prefix-$index")
}
/**
* @param runFunc A function that takes an int input (the index), and returns nothing
*/
fun map(index: Int, prefix: String, runFunc: ThreadableFun) {
val runnable = object : Runnable {
override fun run() {
runFunc(index)
}
}
map(index, prefix, runnable)
}
/**
* Start all thread in the pool. If the thread in the pool is NULL, it will simply ignored.
*/
fun startAll() {
pool.forEach { it?.start() }
}
/**
* Start all thread in the pool and wait for them to all die. If the thread in the pool is NULL, it will simply ignored.
*/
fun startAllWaitForDie() {
// ThreadParallelTester says this function actually works as intended...
pool.forEach { it?.start() }
pool.forEach { it?.join() }
}
/**
* Primitive locking
*/
fun allFinished(): Boolean {
pool.forEach { if (it != null && it.state != Thread.State.TERMINATED) return false }
return true
}
}
/**
* A thread pool that will hold the execution until all the tasks are completed.
*
* Tasks are not guaranteed to be done orderly; but the first task in the list will be executed first.
*/
@Deprecated("Experimental.", ReplaceWith("ThreadParallel", "net.torvald.terrarum.concurrent.ThreadParallel"))
object BlockingThreadPool {
val threadCount = Runtime.getRuntime().availableProcessors() + 1 // modify this to your taste
private val pool: Array<Thread?> = Array(threadCount, { null })
private var tasks: List<RunnableFun> = ArrayList<RunnableFun>()
@Volatile private var dispatchedTasks = 0
private var threadPrefix = ""
/** @return false on failure (likely the previous jobs not finished), true on success */
fun map(prefix: String, tasks: List<RunnableFun>) = setTasks(tasks, prefix)
/** @return false on failure (likely the previous jobs not finished), true on success */
fun setTasks(tasks: List<RunnableFun>, prefix: String): Boolean {
if (!allFinished())
return false
this.tasks = tasks
dispatchedTasks = 0
threadPrefix = prefix
return true
}
private fun dequeueTask(): RunnableFun {
dispatchedTasks += 1
return tasks[dispatchedTasks - 1]
}
fun startAllWaitForDie() {
while (dispatchedTasks <= tasks.lastIndex) {
// marble rolling down the slanted channel-track of threads, if a channel is empty (a task assigned
// to the thread is dead) the marble will roll into the channel, and the marble is a task #MarbleMachineX
for (i in 0 until threadCount) {
// but unlike the marble machine, marble don't actually roll down, we can just pick up any number
// of marbles and put it into an empty channel whenever we encounter one
// SO WHAT WE DO is first fill any empty channels:
if (dispatchedTasks <= tasks.lastIndex && // because cache invalidation damnit
(pool[i] == null || pool[i]!!.state == Thread.State.TERMINATED)) {
pool[i] = Thread(dequeueTask().makeRunnable(), "$threadPrefix-$dispatchedTasks") // thread name index is one-based
pool[i]!!.start()
}
// then, sleep this very thread, wake if any of the thread in the pool is terminated,
// and GOTO loop_start; if we don't sleep, this function will be busy-waiting
}
}
}
fun allFinished(): Boolean {
pool.forEach { if (it != null && it.state != Thread.State.TERMINATED) return false }
return true
}
private fun RunnableFun.makeRunnable() = Runnable {
this.invoke()
}
}
fun <T, R> Iterable<T>.parallelMap(transform: (T) -> R): List<R> {
val tasks = this.sliceEvenly(ThreadParallel.threadCount)
val destination = Array(ThreadParallel.threadCount) { ArrayList<R>() }
tasks.forEachIndexed { index, list ->
ThreadParallel.map(index, "ParallelUtils.parallelMap@${this.javaClass.canonicalName}") {
for (item in list)
destination[index].add(transform(item as T))
}
}
ThreadParallel.startAllWaitForDie()
return destination.flatten()
}
/**
* Shallow flat of the array
*/
fun <T> Array<out Iterable<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
/**
* Shallow flat of the iterable
*/
fun <T> Iterable<out Iterable<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
/**
* Shallow flat of the array
*/
fun <T> Array<out Array<T>>.flatten(): List<T> {
val al = ArrayList<T>()
this.forEach { it.forEach { al.add(it) } }
return al
}
fun <T> Iterable<T>.sliceEvenly(slices: Int): List<List<T>> = this.toList().sliceEvenly(slices)
fun <T> List<T>.sliceEvenly(slices: Int): List<List<T>> {
return (0 until slices).map {
this.subList(
this.size.toFloat().div(slices).times(it).roundInt(),
this.size.toFloat().div(slices).times(it + 1).roundInt()
)
}
}
fun <T> Array<T>.sliceEvenly(slices: Int): List<Array<T>> {
return (0 until slices).map {
this.sliceArray(
this.size.toFloat().div(slices).times(it).roundInt() until
this.size.toFloat().div(slices).times(it + 1).roundInt()
)
}
}
fun IntProgression.sliceEvenly(slices: Int): List<IntProgression> {
if (this.step.absoluteValue != 1) throw UnsupportedOperationException("Sorry, step != +1/-1")
val size = (this.last - this.first).absoluteValue + (this.step.toFloat()).absoluteValue
// println(size)
return if (this.first < this.last) (0 until slices).map {
this.first + size.div(slices).times(it).roundInt() ..
this.first + size.div(slices).times(it + 1).roundInt() - 1
}
else (0 until slices).map {
this.first - size.div(slices).times(it).roundInt() downTo
this.first - size.div(slices).times(it + 1).roundInt() + 1
}
}
fun IntProgression.mapToThreadPoolDirectly(prefix: String, worker: (IntProgression) -> Unit) {
this.sliceEvenly(ThreadParallel.threadCount).forEachIndexed { index, intProgression ->
val workerFun: ThreadableFun = {
worker(intProgression)
}
ThreadParallel.map(index, prefix, workerFun)
}
}
private inline fun Float.roundInt(): Int = Math.round(this)

View File

@@ -26,7 +26,7 @@ internal object SetGlobalLightOverride : ConsoleCommand {
Echo("Wrong number input.")
}
catch (e1: IllegalArgumentException) {
Echo("Range: 0-" + LightmapRenderer.CHANNEL_MAX + " per channel")
Echo("Range: 0.0-1.0+ per channel")
}
}

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
@@ -20,6 +21,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.dyn4j.geometry.Vector2
import java.util.*
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
import kotlin.math.sign
@@ -1230,7 +1232,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
*
* Very straightforward for the actual solid tiles, not so much for the platforms
*/
private fun shouldICollideWithThis(tile: Int) =
private fun shouldICollideWithThis(tile: ItemID) =
// regular solid block
(BlockCodex[tile].isSolid)
@@ -1239,7 +1241,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
*
* Just like "shouldICollideWithThis" but it's intended to work with feet tiles
*/
private fun shouldICollideWithThisFeet(tile: Int) =
private fun shouldICollideWithThisFeet(tile: ItemID) =
// regular solid block
(BlockCodex[tile].isSolid) ||
// platforms, moving downward AND not "going down"
@@ -1257,28 +1259,28 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
if (world == null) return 0
var contactAreaCounter = 0
for (i in 0..(if (side % 2 == 0) hitbox.width else hitbox.height).roundInt() - 1) {
for (i in 0..(if (side % 2 == 0) hitbox.width else hitbox.height).roundToInt() - 1) {
// set tile positions
val tileX: Int
val tileY: Int
if (side == COLLIDING_LEFT) {
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundInt()
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundToInt()
+ i + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxEnd.y.roundInt() + translateY)
tileY = div16TruncateToMapHeight(hitbox.hitboxEnd.y.roundToInt() + translateY)
}
else if (side == COLLIDING_TOP) {
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundInt()
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundToInt()
+ i + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundInt() + translateY)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundToInt() + translateY)
}
else if (side == COLLIDING_RIGHT) {
tileX = div16TruncateToMapWidth(hitbox.hitboxEnd.x.roundInt() + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundInt()
tileX = div16TruncateToMapWidth(hitbox.hitboxEnd.x.roundToInt() + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundToInt()
+ i + translateY)
}
else if (side == COLLIDING_LEFT) {
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundInt() + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundInt()
tileX = div16TruncateToMapWidth(hitbox.hitboxStart.x.roundToInt() + translateX)
tileY = div16TruncateToMapHeight(hitbox.hitboxStart.y.roundToInt()
+ i + translateY)
}
else {
@@ -1294,7 +1296,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
return contactAreaCounter
}
private fun getTileFriction(tile: Int) =
private fun getTileFriction(tile: ItemID) =
if (physProp.immobileBody && tile == Block.AIR)
BlockCodex[Block.AIR].friction.frictionToMult().div(500)
.times(if (!grounded) elasticity else 1.0)
@@ -1704,11 +1706,11 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
}
private fun forEachOccupyingTileNum(consumer: (Int?) -> Unit) {
private fun forEachOccupyingTileNum(consumer: (ItemID?) -> Unit) {
if (world == null) return
val tiles = ArrayList<Int?>()
val tiles = ArrayList<ItemID?>()
for (y in hIntTilewiseHitbox.startY.toInt()..hIntTilewiseHitbox.endY.toInt()) {
for (x in hIntTilewiseHitbox.startX.toInt()..hIntTilewiseHitbox.endX.toInt()) {
tiles.add(world!!.getTileFromTerrain(x, y))
@@ -1769,11 +1771,11 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
return tilePosList.forEach(consumer)
}
private fun forEachFeetTileNum(consumer: (Int?) -> Unit) {
private fun forEachFeetTileNum(consumer: (ItemID?) -> Unit) {
if (world == null) return
val tiles = ArrayList<Int?>()
val tiles = ArrayList<ItemID?>()
// offset 1 pixel to the down so that friction would work
val y = hitbox.endY.plus(1.0).div(TILE_SIZE).floorInt()

View File

@@ -46,6 +46,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
}
}
private var worldPrimaryClickLatched = false
fun update(delta: Float) {
///////////////////
@@ -61,13 +63,18 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
// also, some UIs should NOT affect item usage (e.g. quickslot) and ingame's uiOpened property is doing
// the very job.
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !worldPrimaryClickLatched) {
terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE)
worldPrimaryClickLatched = true
}
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary")) {
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary")) {
ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE)
}*/
if (!Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
worldPrimaryClickLatched = false
}
}
@@ -93,14 +100,14 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
terrarumIngame.actorNowPlaying?.keyDown(keycode)
// quickslot by number keys
val quickslotKeys = AppLoader.getConfigIntArray("keyquickslots")
val quickslotKeys = AppLoader.getConfigIntArray("config_keyquickslots")
if (keycode in quickslotKeys) {
terrarumIngame.actorNowPlaying?.actorValue?.set(AVKey.__PLAYER_QUICKSLOTSEL, quickslotKeys.indexOf(keycode))
}
// pie menu
if (AppLoader.getConfigIntArray("keyquickselalt").contains(keycode)
|| keycode == AppLoader.getConfigInt("keyquicksel")) {
if (AppLoader.getConfigIntArray("config_keyquickselalt").contains(keycode)
|| keycode == AppLoader.getConfigInt("config_keyquicksel")) {
terrarumIngame.uiPieMenu.setAsOpen()
terrarumIngame.uiQuickBar.setAsClose()
}
@@ -117,7 +124,6 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
// screenshot key
if (keycode == Input.Keys.F12 && !f12Down) {
AppLoader.requestScreenshot()
terrarumIngame.sendNotification("Screenshot taken")
f12Down = true
println("Screenshot taken.")
}
@@ -126,8 +132,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
}
override fun keyUp(keycode: Int): Boolean {
if (AppLoader.getConfigIntArray("keyquickselalt").contains(keycode)
|| keycode == AppLoader.getConfigInt("keyquicksel")) {
if (AppLoader.getConfigIntArray("config_keyquickselalt").contains(keycode)
|| keycode == AppLoader.getConfigInt("config_keyquicksel")) {
terrarumIngame.uiPieMenu.setAsClose()
terrarumIngame.uiQuickBar.setAsOpen()
}
@@ -159,18 +165,18 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
if (terrarumIngame.uiContainer.map { if ((it.isOpening || it.isOpened) && it.mouseUp) 1 else 0 }.sum() == 0) { // no UI on the mouse, right?
if (
button == AppLoader.getConfigInt("mouseprimary") ||
button == AppLoader.getConfigInt("mousesecondary")) {
button == AppLoader.getConfigInt("config_mouseprimary") ||
button == AppLoader.getConfigInt("config_mousesecondary")) {
terrarumIngame.worldPrimaryClickEnd(AppLoader.UPDATE_RATE)
}
/*if (button == AppLoader.getConfigInt("mousesecondary")) {
/*if (button == AppLoader.getConfigInt("config_mousesecondary")) {
ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE)
}*/
}
}
// pie menu
if (button == AppLoader.getConfigInt("mousequicksel")) {
if (button == AppLoader.getConfigInt("config_mousequicksel")) {
terrarumIngame.uiPieMenu.setAsClose()
terrarumIngame.uiQuickBar.setAsOpen()
}
@@ -204,7 +210,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
terrarumIngame.uiContainer.forEach { it.touchDown(screenX, screenY, pointer, button) }
// pie menu
if (button == AppLoader.getConfigInt("mousequicksel")) {
if (button == AppLoader.getConfigInt("config_mousequicksel")) {
terrarumIngame.uiPieMenu.setAsOpen()
terrarumIngame.uiQuickBar.setAsClose()
}

View File

@@ -4,14 +4,14 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.random.HQRNG
import net.torvald.terrarum.ItemValue
import net.torvald.terrarum.ReferencingRanges.PREFIX_DYNAMICITEM
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.itemproperties.ItemCodex.ITEM_DYNAMIC
import net.torvald.terrarum.itemproperties.Material
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
typealias ItemID = Int
typealias ItemID = String
/**
* Instances of the GameItem (e.g. net.torvald.terrarum.modulebasegame.gameitems.PickaxeCopper) are preferably referenced
@@ -40,7 +40,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
abstract val originalName: String
var newName: String = "I AM VITTUN PLACEHOLDER"
var newName: String = "I AM VITUN PLACEHOLDER"
private set
var name: String
@@ -208,7 +208,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
}
override fun hashCode(): Int {
return dynamicID
return dynamicID.hashCode()
}
override fun equals(other: Any?): Boolean {
@@ -222,7 +222,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
nameColour = Color.WHITE
}
override fun compareTo(other: GameItem): Int = (this.dynamicID - other.dynamicID).sign()
override fun compareTo(other: GameItem): Int = (this.dynamicID.substring(4).toInt() - other.dynamicID.substring(4).toInt()).sign()
fun Int.sign(): Int = if (this > 0) 1 else if (this < 0) -1 else 0
@@ -295,7 +295,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
fun generateUniqueDynamicID(inventory: ActorInventory): GameItem {
dynamicID = Companion.generateUniqueDynamicID(inventory)
dynamicID = "$PREFIX_DYNAMICITEM${Companion.generateUniqueDynamicID(inventory)}"
ItemCodex.registerNewDynamicItem(dynamicID, this)
return this
}
@@ -307,8 +307,8 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
fun generateUniqueDynamicID(inventory: ActorInventory): Int {
var ret: Int
do {
ret = ITEM_DYNAMIC.pickRandom()
} while (inventory.contains(ret))
ret = (1..2147483647).pickRandom()
} while (inventory.contains("$PREFIX_DYNAMICITEM$ret"))
return ret
}

View File

@@ -9,10 +9,12 @@ import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.modulebasegame.gameworld.WorldSimulator
import net.torvald.terrarum.printStackTrace
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.serialise.ReadLayerDataZip
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.util.SortedArrayList
import org.dyn4j.geometry.Vector2
import kotlin.math.absoluteValue
@@ -79,7 +81,7 @@ open class GameWorld : Disposable {
/**
* Used by the renderer. When wirings are updated, `wirings` and this properties must be synchronised.
*/
private val wiringBlocks: HashMap<BlockAddress, Int>
private val wiringBlocks: HashMap<BlockAddress, ItemID>
//public World physWorld = new World( new Vec2(0, -Terrarum.game.gravitationalAccel) );
//physics
@@ -100,7 +102,14 @@ open class GameWorld : Disposable {
open var TIME_T: Long = 0L
open var dayLength: Int = 86400
@TEMzPayload("TMaP", TEMzPayload.EXTERNAL_JSON)
val tileNumberToNameMap: HashMap<Int, ItemID>
// does not go to the savefile
val tileNameToNumberMap: HashMap<ItemID, Int>
/**
* Create new world
*/
constructor(worldIndex: Int, width: Int, height: Int, creationTIME_T: Long, lastPlayTIME_T: Long, totalPlayTime: Int) {
if (width <= 0 || height <= 0) throw IllegalArgumentException("Non-positive width/height: ($width, $height)")
@@ -133,8 +142,24 @@ open class GameWorld : Disposable {
creationTime = creationTIME_T
lastPlayTime = lastPlayTIME_T
this.totalPlayTime = totalPlayTime
tileNumberToNameMap = HashMap<Int, ItemID>()
tileNameToNumberMap = HashMap<ItemID, Int>()
CreateTileAtlas.tags.forEach {
printdbg(this, "tileNumber ${it.value.tileNumber} <-> tileName ${it.key}")
tileNumberToNameMap[it.value.tileNumber] = it.key
tileNameToNumberMap[it.key] = it.value.tileNumber
}
// AN EXCEPTIONAL TERM: tilenum 0 is always redirected to Air tile, even if the tilenum for actual Air tile is not zero
tileNumberToNameMap[0] = Block.AIR
}
/**
* Load existing world
*/
internal constructor(worldIndex: Int, layerData: ReadLayerDataZip.LayerData, creationTIME_T: Long, lastPlayTIME_T: Long, totalPlayTime: Int) {
this.worldIndex = worldIndex
@@ -160,6 +185,28 @@ open class GameWorld : Disposable {
creationTime = creationTIME_T
lastPlayTime = lastPlayTIME_T
this.totalPlayTime = totalPlayTime
// before the renaming, update the name maps
tileNumberToNameMap = HashMap<Int, ItemID>()
tileNameToNumberMap = HashMap<ItemID, Int>()
CreateTileAtlas.tags.forEach {
tileNumberToNameMap[it.value.tileNumber] = it.key
tileNameToNumberMap[it.key] = it.value.tileNumber
}
// perform renaming of tile layers
val oldTileNumberToNameMap = layerData.tileNumberToNameMap
for (y in 0 until layerTerrain.height) {
for (x in 0 until layerTerrain.width) {
layerTerrain.unsafeSetTile(x, y, tileNameToNumberMap[oldTileNumberToNameMap[layerTerrain.unsafeGetTile(x, y)]]!!)
layerWall.unsafeSetTile(x, y, tileNameToNumberMap[oldTileNumberToNameMap[layerWall.unsafeGetTile(x, y)]]!!)
// TODO rename fluid map
// TODO rename wire map
}
}
// AN EXCEPTIONAL TERM: tilenum 0 is always redirected to Air tile, even if the tilenum for actual Air tile is not zero
tileNumberToNameMap[0] = Block.AIR
}
/**
@@ -172,12 +219,41 @@ open class GameWorld : Disposable {
fun coerceXY(x: Int, y: Int) = (x fmod width) to (y.coerceIn(0, height - 1))
fun getTileFromWall(rawX: Int, rawY: Int): Int {
/**
* @return ItemID, WITHOUT wall tag
*/
fun getTileFromWall(rawX: Int, rawY: Int): ItemID {
val (x, y) = coerceXY(rawX, rawY)
return tileNumberToNameMap[layerWall.unsafeGetTile(x, y)]!!
}
/**
* @return ItemID
*/
fun getTileFromTerrain(rawX: Int, rawY: Int): ItemID {
val (x, y) = coerceXY(rawX, rawY)
try {
return tileNumberToNameMap[layerTerrain.unsafeGetTile(x, y)]!!
}
catch (e: NullPointerException) {
System.err.println("NPE for tilenum ${layerTerrain.unsafeGetTile(x, y)}")
throw e
}
}
/**
* @return Int
*/
fun getTileNumFromWall(rawX: Int, rawY: Int): Int {
val (x, y) = coerceXY(rawX, rawY)
return layerWall.unsafeGetTile(x, y)
}
fun getTileFromTerrain(rawX: Int, rawY: Int): Int {
/**
* @return Int
*/
fun getTileNumFromTerrain(rawX: Int, rawY: Int): Int {
val (x, y) = coerceXY(rawX, rawY)
return layerTerrain.unsafeGetTile(x, y)
}
@@ -191,17 +267,18 @@ open class GameWorld : Disposable {
* *
* @param y
* *
* @param tilenum Item id of the wall block. Less-than-4096-value is permitted.
* @param itemID Tile as in ItemID, with tag removed!
*/
fun setTileWall(x: Int, y: Int, tilenum: Int) {
fun setTileWall(x: Int, y: Int, itemID: ItemID, bypassEvent: Boolean) {
val (x, y) = coerceXY(x, y)
val tilenum = tilenum % TILES_SUPPORTED // does work without this, but to be safe...
val tilenum = tileNameToNumberMap[itemID]!!
val oldWall = getTileFromWall(x, y)
layerWall.unsafeSetTile(x, y, tilenum)
wallDamages.remove(LandUtil.getBlockAddr(this, x, y))
Terrarum.ingame?.queueWallChangedEvent(oldWall, tilenum, LandUtil.getBlockAddr(this, x, y))
if (!bypassEvent)
Terrarum.ingame?.queueWallChangedEvent(oldWall, itemID, LandUtil.getBlockAddr(this, x, y))
}
/**
@@ -213,23 +290,25 @@ open class GameWorld : Disposable {
* *
* @param y
* *
* @param tilenum Item id of the terrain block, <4096
* @param itemID Tile as in ItemID, with tag removed!
*/
fun setTileTerrain(x: Int, y: Int, tilenum: Int) {
fun setTileTerrain(x: Int, y: Int, itemID: ItemID, bypassEvent: Boolean) {
val (x, y) = coerceXY(x, y)
val tilenum = tileNameToNumberMap[itemID]!!
val oldTerrain = getTileFromTerrain(x, y)
layerTerrain.unsafeSetTile(x, y, tilenum)
val blockAddr = LandUtil.getBlockAddr(this, x, y)
terrainDamages.remove(blockAddr)
if (BlockCodex[tilenum].isSolid) {
if (BlockCodex[itemID].isSolid) {
fluidFills.remove(blockAddr)
fluidTypes.remove(blockAddr)
}
// fluid tiles-item should be modified so that they will also place fluid onto their respective map
Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, tilenum, LandUtil.getBlockAddr(this, x, y))
if (!bypassEvent)
Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, itemID, LandUtil.getBlockAddr(this, x, y))
}
/*fun setTileWire(x: Int, y: Int, tile: Byte) {
@@ -241,8 +320,9 @@ open class GameWorld : Disposable {
Terrarum.ingame?.queueWireChangedEvent(oldWire, tile.toUint(), LandUtil.getBlockAddr(this, x, y))
}*/
fun getWiringBlocks(x: Int, y: Int): Int {
return wiringBlocks.getOrDefault(LandUtil.getBlockAddr(this, x, y), 0)
fun getWiringBlocks(x: Int, y: Int): ItemID {
return Block.AIR // TODO
//return wiringBlocks.getOrDefault(LandUtil.getBlockAddr(this, x, y), Block.AIR)
}
fun getAllConduitsFrom(x: Int, y: Int): SortedArrayList<WiringNode>? {
@@ -258,7 +338,9 @@ open class GameWorld : Disposable {
}
fun addNewConduitTo(x: Int, y: Int, node: WiringNode) {
val blockAddr = LandUtil.getBlockAddr(this, x, y)
// TODO needs new conduit storage scheme
/*val blockAddr = LandUtil.getBlockAddr(this, x, y)
// check for existing type of conduit
// if there's no duplicate...
@@ -270,10 +352,10 @@ open class GameWorld : Disposable {
}
else {
TODO("need overwriting policy for existing conduit node")
}
}*/
}
fun getTileFrom(mode: Int, x: Int, y: Int): Int? {
fun getTileFrom(mode: Int, x: Int, y: Int): ItemID {
if (mode == TERRAIN) {
return getTileFromTerrain(x, y)
}
@@ -287,8 +369,8 @@ open class GameWorld : Disposable {
throw IllegalArgumentException("illegal mode input: " + mode.toString())
}
fun terrainIterator(): Iterator<Int> {
return object : Iterator<Int> {
fun terrainIterator(): Iterator<ItemID> {
return object : Iterator<ItemID> {
private var iteratorCount = 0
@@ -296,7 +378,7 @@ open class GameWorld : Disposable {
return iteratorCount < width * height
}
override fun next(): Int {
override fun next(): ItemID {
val y = iteratorCount / width
val x = iteratorCount % width
// advance counter
@@ -308,15 +390,15 @@ open class GameWorld : Disposable {
}
}
fun wallIterator(): Iterator<Int> {
return object : Iterator<Int> {
fun wallIterator(): Iterator<ItemID> {
return object : Iterator<ItemID> {
private var iteratorCount = 0
override fun hasNext(): Boolean =
iteratorCount < width * height
override fun next(): Int {
override fun next(): ItemID {
val y = iteratorCount / width
val x = iteratorCount % width
// advance counter
@@ -351,7 +433,7 @@ open class GameWorld : Disposable {
// remove tile from the world
if (terrainDamages[addr] ?: 0f >= BlockCodex[getTileFromTerrain(x, y)].strength) {
setTileTerrain(x, y, 0)
setTileTerrain(x, y, Block.AIR, false)
terrainDamages.remove(addr)
return true
}
@@ -380,7 +462,7 @@ open class GameWorld : Disposable {
// remove tile from the world
if (wallDamages[addr]!! >= BlockCodex[getTileFromWall(x, y)].strength) {
setTileWall(x, y, 0)
setTileWall(x, y, Block.AIR, false)
wallDamages.remove(addr)
return true
}

View File

@@ -5,7 +5,11 @@ import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.CommonResourcePool
import net.torvald.terrarum.ReferencingRanges
import net.torvald.terrarum.ReferencingRanges.PREFIX_ACTORITEM
import net.torvald.terrarum.ReferencingRanges.PREFIX_DYNAMICITEM
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.gameitem.ItemID
@@ -13,6 +17,8 @@ import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.CanBeAnItem
import net.torvald.terrarum.worlddrawer.BlocksDrawer
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.ITEM_ATLAS_TILES_X
import java.util.*
/**
@@ -24,219 +30,19 @@ object ItemCodex {
* <ItemID or RefID for Actor, TheItem>
* Will return corresponding Actor if ID >= ACTORID_MIN
*/
val itemCodex = HashMap<ItemID, GameItem>()
private val itemCodex = HashMap<ItemID, GameItem>()
val dynamicItemDescription = HashMap<ItemID, GameItem>()
val dynamicToStaticTable = HashMap<ItemID, ItemID>()
val ITEM_TILES = ReferencingRanges.TILES
val ITEM_WALLS = ReferencingRanges.WALLS
val ITEM_WIRES = ReferencingRanges.WIRES
val ITEM_STATIC = ReferencingRanges.ITEMS_STATIC
val ITEM_DYNAMIC = ReferencingRanges.ITEMS_DYNAMIC
val ACTORID_MIN = ReferencingRanges.ACTORS.first
private val itemImagePlaceholder: TextureRegion
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_24") // copper pickaxe
// TODO: when generalised, there's no guarantee that blocks will be used as an item. Write customised item prop loader and init it on the Ingame
init {
//val ingame = Terrarum.ingame!! as Ingame // WARNING you can't put this here, ExceptionInInitializerError
/*println("[ItemCodex] recording item ID ")
// blocks.csvs are loaded by ModMgr beforehand
// block items (blocks and walls are the same thing basically)
for (i in ITEM_TILES + ITEM_WALLS) {
itemCodex[i] = object : GameItem() {
override val originalID = i
override var dynamicID = i
override val isUnique: Boolean = false
override var baseMass: Double = BlockCodex[i].density / 1000.0
override var baseToolSize: Double? = null
override var equipPosition = EquipPosition.HAND_GRIP
override val originalName = BlockCodex[i % ITEM_WALLS.first].nameKey
override var stackable = true
override var inventoryCategory = if (i in ITEM_TILES) Category.BLOCK else Category.WALL
override var isDynamic = false
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
init {
print("$originalID ")
}
override fun startPrimaryUse(delta: Float): Boolean {
return false
// TODO base punch attack
}
override fun startSecondaryUse(delta: Float): Boolean {
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
// check for collision with actors (BLOCK only)
if (this.inventoryCategory == Category.BLOCK) {
ingame.actorContainerActive.forEach {
if (it is ActorWBMovable && it.hIntTilewiseHitbox.intersects(mousePoint))
return false
}
}
// return false if the tile is already there
if (this.inventoryCategory == Category.BLOCK &&
this.dynamicID == ingame.world.getTileFromTerrain(Terrarum.mouseTileX, Terrarum.mouseTileY) ||
this.inventoryCategory == Category.WALL &&
this.dynamicID - ITEM_WALLS.start == ingame.world.getTileFromWall(Terrarum.mouseTileX, Terrarum.mouseTileY) ||
this.inventoryCategory == Category.WIRE &&
this.dynamicID - ITEM_WIRES.start == ingame.world.getTileFromWire(Terrarum.mouseTileX, Terrarum.mouseTileY)
)
return false
// filter passed, do the job
// FIXME this is only useful for Player
if (i in ITEM_TILES) {
ingame.world.setTileTerrain(
Terrarum.mouseTileX,
Terrarum.mouseTileY,
i
)
}
else {
ingame.world.setTileWall(
Terrarum.mouseTileX,
Terrarum.mouseTileY,
i
)
}
return true
}
}
}*/
// test copper pickaxe
/*itemCodex[ITEM_STATIC.first] = object : GameItem() {
override val originalID = ITEM_STATIC.first
override var dynamicID = originalID
override val isUnique = false
override val originalName = ""
override var baseMass = 10.0
override var baseToolSize: Double? = 10.0
override var stackable = true
override var maxDurability = 147//606
override var durability = maxDurability.toFloat()
override var equipPosition = EquipPosition.HAND_GRIP
override var inventoryCategory = Category.TOOL
override val isDynamic = true
override val material = Material(0,0,0,0,0,0,0,0,1,0.0)
init {
itemProperties[IVKey.ITEMTYPE] = IVKey.ItemType.PICK
name = "Stone pickaxe"
}
override fun startPrimaryUse(delta: Float): Boolean {
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
val actorvalue = ingame.actorNowPlaying.actorValue
using = true
// linear search filter (check for intersection with tilewise mouse point and tilewise hitbox)
// return false if hitting actors
ingame.actorContainerActive.forEach {
if (it is ActorWBMovable && it.hIntTilewiseHitbox.intersects(mousePoint))
return false
}
// return false if there's no tile
if (Block.AIR == ingame.world.getTileFromTerrain(Terrarum.mouseTileX, Terrarum.mouseTileY))
return false
// filter passed, do the job
val swingDmgToFrameDmg = delta.toDouble() / actorvalue.getAsDouble(AVKey.ACTION_INTERVAL)!!
ingame.world.inflictTerrainDamage(
Terrarum.mouseTileX,
Terrarum.mouseTileY,
Calculate.pickaxePower(ingame.actorNowPlaying, material) * swingDmgToFrameDmg
)
return true
}
override fun endPrimaryUse(delta: Float): Boolean {
using = false
// reset action timer to zero
ingame.actorNowPlaying.actorValue[AVKey.__ACTION_TIMER] = 0.0
return true
}
}*/
// test water bucket
itemCodex[9000] = object : GameItem(9000) {
override val isUnique: Boolean = true
override val originalName: String = "Infinite Water Bucket"
override var baseMass: Double = 1000.0
override var baseToolSize: Double? = null
override var inventoryCategory: String = "tool"
override var stackable: Boolean = false
override val isDynamic: Boolean = false
override val material: Material = Material()
init {
equipPosition = EquipPosition.HAND_GRIP
}
override fun startPrimaryUse(delta: Float): Boolean {
val ingame = Terrarum.ingame!! as TerrarumIngame // must be in here
ingame.world.setFluid(Terrarum.mouseTileX, Terrarum.mouseTileY, Fluid.WATER, 4f)
return true
}
}
// test lava bucket
itemCodex[9001] = object : GameItem(9001) {
override val isUnique: Boolean = true
override val originalName: String = "Infinite Lava Bucket"
override var baseMass: Double = 1000.0
override var baseToolSize: Double? = null
override var inventoryCategory: String = "tool"
override var stackable: Boolean = false
override val isDynamic: Boolean = false
override val material: Material = Material()
init {
equipPosition = EquipPosition.HAND_GRIP
}
override fun startPrimaryUse(delta: Float): Boolean {
val ingame = Terrarum.ingame!! as TerrarumIngame // must be in here
ingame.world.setFluid(Terrarum.mouseTileX, Terrarum.mouseTileY, Fluid.LAVA, 4f)
return true
}
}
// read from save (if applicable) and fill dynamicItemDescription
println()
}
fun registerNewDynamicItem(dynamicID: Int, item: GameItem) {
/**
* @param: dynamicID string of "dyn:<random id>"
*/
fun registerNewDynamicItem(dynamicID: ItemID, item: GameItem) {
if (AppLoader.IS_DEVELOPMENT_BUILD) {
printdbg(this, "Registering new dynamic item $dynamicID (from ${item.originalID})")
}
@@ -251,18 +57,17 @@ object ItemCodex {
operator fun get(code: ItemID?): GameItem? {
if (code == null) return null
if (code <= ITEM_STATIC.endInclusive) // generic item
return itemCodex[code]!!.clone() // from CSV
else if (code <= ITEM_DYNAMIC.endInclusive) {
if (code.startsWith(PREFIX_DYNAMICITEM))
return dynamicItemDescription[code]!!
}
else {
val a = (Terrarum.ingame!! as TerrarumIngame).getActorByID(code) // actor item
else if (code.startsWith(PREFIX_ACTORITEM)) {
val a = (Terrarum.ingame!! as TerrarumIngame).getActorByID(code.substring(6).toInt()) // actor item
if (a is CanBeAnItem) return a.itemData
return null
//throw IllegalArgumentException("Attempted to get item data of actor that cannot be an item. ($a)")
}
else // generic item
return itemCodex[code]?.clone() // from CSV
}
fun dynamicToStaticID(dynamicID: ItemID) = dynamicToStaticTable[dynamicID]!!
@@ -270,6 +75,10 @@ object ItemCodex {
/**
* Mainly used by GameItemLoader
*/
fun set(modname: String, code: Int, item: GameItem) {
itemCodex["$modname:$code"] = item
}
operator fun set(code: ItemID, item: GameItem) {
itemCodex[code] = item
}
@@ -280,31 +89,35 @@ object ItemCodex {
return getItemImage(item.originalID)
}
fun getItemImage(itemOriginalID: Int): TextureRegion {
fun getItemImage(itemID: ItemID?): TextureRegion? {
if (itemID == null) return null
// dynamic item
if (itemOriginalID in ITEM_DYNAMIC) {
return getItemImage(dynamicToStaticID(itemOriginalID))
if (itemID.startsWith(PREFIX_DYNAMICITEM)) {
return getItemImage(dynamicToStaticID(itemID))
}
// item
else if (itemID.startsWith("item@")) {
return itemCodex[itemID]?.itemImage
}
// TODO: wires
// wall
else if (itemID.startsWith("wall@")) {
val itemSheetNumber = CreateTileAtlas.tileIDtoItemSheetNumber(itemID.substring(5))
return BlocksDrawer.tileItemWall.get(
itemSheetNumber % ITEM_ATLAS_TILES_X,
itemSheetNumber / ITEM_ATLAS_TILES_X
)
}
// terrain
else if (itemOriginalID in ITEM_TILES) {
else {
val itemSheetNumber = CreateTileAtlas.tileIDtoItemSheetNumber(itemID)
return BlocksDrawer.tileItemTerrain.get(
itemOriginalID % 16,
itemOriginalID / 16
itemSheetNumber % ITEM_ATLAS_TILES_X,
itemSheetNumber / ITEM_ATLAS_TILES_X
)
}
// wall
else if (itemOriginalID in ITEM_WALLS) {
return BlocksDrawer.tileItemWall.get(
(itemOriginalID.minus(ITEM_WALLS.first) % 16),
(itemOriginalID.minus(ITEM_WALLS.first) / 16)
)
}
// wire
/*else if (itemOriginalID in ITEM_WIRES) {
return BlocksDrawer.tilesWire.get((itemOriginalID % 16) * 16, itemOriginalID / 16)
}*/
else
return itemCodex[itemOriginalID]?.itemImage ?: itemImagePlaceholder
}
fun hasItem(itemID: Int): Boolean = dynamicItemDescription.containsKey(itemID)

View File

@@ -16,6 +16,8 @@ import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
import net.torvald.terrarum.modulebasegame.ui.Notification
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerBlockChooser
import net.torvald.terrarum.modulebasegame.ui.UIBuildingMakerPenMenu
import net.torvald.terrarum.modulebasegame.ui.UIPaletteSelector
import net.torvald.terrarum.modulebasegame.weather.WeatherMixer
import net.torvald.terrarum.realestate.LandUtil
@@ -27,7 +29,6 @@ import net.torvald.terrarum.serialise.toLittleShort
import net.torvald.terrarum.serialise.toULittle48
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UINSMenu
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
import net.torvald.terrarum.worlddrawer.WorldCamera
import java.io.File
import java.io.FileOutputStream
@@ -83,19 +84,19 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
println("[BuildingMaker] Generating builder world...")
for (y in 0 until gameWorld.height) {
gameWorld.setTileWall(0, y, Block.ILLUMINATOR_RED)
gameWorld.setTileWall(gameWorld.width - 1, y, Block.ILLUMINATOR_RED)
gameWorld.setTileTerrain(0, y, Block.ILLUMINATOR_RED_OFF)
gameWorld.setTileTerrain(gameWorld.width - 1, y, Block.ILLUMINATOR_RED_OFF)
gameWorld.setTileWall(0, y, Block.ILLUMINATOR_RED, true)
gameWorld.setTileWall(gameWorld.width - 1, y, Block.ILLUMINATOR_RED, true)
gameWorld.setTileTerrain(0, y, Block.ILLUMINATOR_RED_OFF, true)
gameWorld.setTileTerrain(gameWorld.width - 1, y, Block.ILLUMINATOR_RED_OFF, true)
}
for (y in 150 until gameWorld.height) {
for (x in 1 until gameWorld.width - 1) {
// wall layer
gameWorld.setTileWall(x, y, Block.DIRT)
gameWorld.setTileWall(x, y, Block.DIRT, true)
// terrain layer
gameWorld.setTileTerrain(x, y, if (y == 150) Block.GRASS else Block.DIRT)
gameWorld.setTileTerrain(x, y, if (y == 150) Block.GRASS else Block.DIRT, true)
}
}
@@ -367,13 +368,13 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
// make pen work HERE
// when LEFT mouse is down
if (!tappedOnUI && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) && !mouseOnUI) {
if (!tappedOnUI && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !mouseOnUI) {
makePenWork(Terrarum.mouseTileX, Terrarum.mouseTileY)
// TODO drag support using bresenham's algo
// for some reason it just doesn't work...
}
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary"))) {
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary"))) {
// open pen menu
// position the menu to where the cursor is
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
@@ -423,22 +424,22 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
when (currentPenMode) {
// test paint terrain layer
PENMODE_PENCIL -> {
if (palSelection < BlockCodex.MAX_TERRAIN_TILES)
world.setTileTerrain(x, y, palSelection)
else if (palSelection < 2 * BlockCodex.MAX_TERRAIN_TILES)
world.setTileWall(x, y, palSelection - BlockCodex.MAX_TERRAIN_TILES)
if (palSelection.startsWith("wall@"))
world.setTileWall(x, y, palSelection.substring(5), true)
else
world.setTileTerrain(x, y, palSelection, true)
}
PENMODE_PENCIL_ERASE -> {
if (currentPenTarget and PENTARGET_WALL != 0)
world.setTileWall(x, y, Block.AIR)
world.setTileWall(x, y, Block.AIR, true)
else
world.setTileTerrain(x, y, Block.AIR)
world.setTileTerrain(x, y, Block.AIR, true)
}
PENMODE_EYEDROPPER -> {
uiPaletteSelector.fore = if (world.getTileFromTerrain(x, y) == Block.AIR)
world.getTileFromWall(x, y)!! + BlockCodex.MAX_TERRAIN_TILES
"wall@"+world.getTileFromWall(x, y)
else
world.getTileFromTerrain(x, y)!!
world.getTileFromTerrain(x, y)
}
PENMODE_MARQUEE -> {
addBlockMarker(x, y)
@@ -454,7 +455,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
return selection.last() - selection.first()
}
private fun serialiseSelection(outfile: File) {
/*private fun serialiseSelection(outfile: File) {
// save format: sparse list encoded in following binary format:
/*
Header: TEaT0bLD -- magic: Terrarum Attachment
@@ -497,7 +498,7 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
}
fos.write(FILE_FOOTER)
fos.close()
}
}*/
}
class BuildingMakerController(val screen: BuildingMaker) : InputAdapter() {

View File

@@ -6,6 +6,7 @@ import net.torvald.terrarum.CommonResourcePool
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.ModuleEntryPoint
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.itemproperties.MaterialCodex
@@ -52,35 +53,14 @@ class EntryPoint : ModuleEntryPoint() {
// blocks.csvs are loaded by ModMgr beforehand
// block items (blocks and walls are the same thing basically)
for (i in ItemCodex.ITEM_TILES + ItemCodex.ITEM_WALLS) {
val blockProp = BlockCodex.getOrNull(i % ItemCodex.ITEM_WALLS.first)
for (tile in BlockCodex.getAll()) {
ItemCodex[tile.id] = makeNewItemObj(tile, false)
if (blockProp != null) {
ItemCodex.itemCodex[i] = object : GameItem(i) {
override val isUnique: Boolean = false
override var baseMass: Double = blockProp.density / 1000.0
override var baseToolSize: Double? = null
override val originalName = blockProp.nameKey
override var stackable = true
override var inventoryCategory = if (i in ItemCodex.ITEM_TILES) Category.BLOCK else Category.WALL
override var isDynamic = false
override val material = MaterialCodex.getOrDefault(blockProp.material)
if (IS_DEVELOPMENT_BUILD) print(tile.id+" ")
init {
equipPosition = EquipPosition.HAND_GRIP
if (IS_DEVELOPMENT_BUILD)
print("$originalID ")
}
override fun startPrimaryUse(delta: Float): Boolean {
return BlockBase.blockStartPrimaryUse(this, i, delta)
}
override fun effectWhenEquipped(delta: Float) {
BlockBase.blockEffectWhenEquipped(delta)
}
}
if (BlockCodex[tile.id].isWallable) {
ItemCodex["wall@" + tile.id] = makeNewItemObj(tile, true)
if (IS_DEVELOPMENT_BUILD) print("wall@" + tile.id + " ")
}
}
@@ -89,6 +69,32 @@ class EntryPoint : ModuleEntryPoint() {
println("[Basegame.EntryPoint] Welcome back!")
}
private fun makeNewItemObj(tile: BlockProp, isWall: Boolean) = object : GameItem(
if (isWall) "wall@"+tile.id else tile.id
) {
override val isUnique: Boolean = false
override var baseMass: Double = tile.density / 1000.0
override var baseToolSize: Double? = null
override val originalName = tile.nameKey
override var stackable = true
override var inventoryCategory = if (isWall) Category.WALL else Category.BLOCK
override var isDynamic = false
override val material = MaterialCodex.getOrDefault(tile.material)
init {
equipPosition = EquipPosition.HAND_GRIP
}
override fun startPrimaryUse(delta: Float): Boolean {
return BlockBase.blockStartPrimaryUse(this, dynamicID, delta)
}
override fun effectWhenEquipped(delta: Float) {
BlockBase.blockEffectWhenEquipped(delta)
}
}
override fun dispose() {
WatchFont.dispose()
}

View File

@@ -51,10 +51,10 @@ object IngameRenderer : Disposable {
val shaderAtoGrey: ShaderProgram
val shaderPassthru = SpriteBatch.createDefaultShader()
private val width = AppLoader.screenW
private val height = AppLoader.screenH
private val widthf = width.toFloat()
private val heightf = height.toFloat()
private val WIDTH = AppLoader.screenW
private val HEIGHT = AppLoader.screenH
private val WIDTHF = WIDTH.toFloat()
private val HEIGHTF = HEIGHT.toFloat()
private var initDone = false
@@ -586,13 +586,13 @@ object IngameRenderer : Disposable {
private fun invokeInit() {
if (!initDone) {
batch = SpriteBatch()
camera = OrthographicCamera(widthf, heightf)
camera = OrthographicCamera(WIDTHF, HEIGHTF)
camera.setToOrtho(true, widthf, heightf)
camera.setToOrtho(true, WIDTHF, HEIGHTF)
camera.update()
Gdx.gl20.glViewport(0, 0, width, height)
Gdx.gl20.glViewport(0, 0, WIDTH, HEIGHT)
resize(width, height)
resize(WIDTH, HEIGHT)
initDone = true
}

View File

@@ -5,12 +5,13 @@ import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.EMDASH
import net.torvald.UnsafeHelper
import net.torvald.terrarum.*
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.blockproperties.BlockPropUtil
import net.torvald.terrarum.blockstats.BlockStats
import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.concurrent.ThreadParallel
import net.torvald.terrarum.concurrent.ThreadExecutor
import net.torvald.terrarum.console.Authenticator
import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameactors.ActorWithBody
@@ -37,6 +38,7 @@ import net.torvald.terrarum.worlddrawer.WorldCamera
import net.torvald.util.CircularArray
import java.util.*
import java.util.concurrent.locks.ReentrantLock
import kotlin.math.roundToInt
/**
@@ -90,7 +92,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
if (AppLoader.IS_DEVELOPMENT_BUILD)
" (ΔF${Terrarum.updateRateStr})" +
" $EMDASH M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / X${Terrarum.memXmx}M"
" $EMDASH M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / U${Terrarum.memUnsafe}M / X${Terrarum.memXmx}M"
else
""
}
@@ -313,8 +315,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// >- queue up game UIs that should pause the world -<
uiInventoryPlayer = UIInventoryFull(actorNowPlaying!!,
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory"),
toggleButtonLiteral = AppLoader.getConfigInt("gamepadstart")
toggleKeyLiteral = AppLoader.getConfigInt("config_keyinventory"),
toggleButtonLiteral = AppLoader.getConfigInt("config_gamepadstart")
)
uiInventoryPlayer.setPosition(0, 0)
@@ -397,6 +399,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}// END enter
override fun worldPrimaryClickStart(delta: Float) {
//println("[Ingame] worldPrimaryClickStart $delta")
// bring up the UIs of the fixtures (e.g. crafting menu from a crafting table)
var uiOpened = false
@@ -658,15 +662,15 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
/** Send message to notifier UI and toggle the UI as opened. */
fun sendNotification(messages: Array<String>) {
override fun sendNotification(messages: Array<String>) {
(notifier as Notification).sendNotification(messages.toList())
}
fun sendNotification(messages: List<String>) {
override fun sendNotification(messages: List<String>) {
(notifier as Notification).sendNotification(messages)
}
fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
override fun sendNotification(singleMessage: String) = sendNotification(listOf(singleMessage))
fun wakeDormantActors() {
var actorContainerSize = actorContainerInactive.size
@@ -719,19 +723,20 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
*/
fun updateActors(delta: Float) {
if (false) { // don't multithread this for now, it's SLOWER //if (Terrarum.MULTITHREAD && actorContainerActive.size > Terrarum.THREADS) {
ThreadExecutor.renew()
val actors = actorContainerActive.size.toFloat()
// set up indices
for (i in 0..AppLoader.THREADS - 1) {
ThreadParallel.map(
i, "ActorUpdate",
for (i in 0..AppLoader.THREAD_COUNT - 1) {
ThreadExecutor.submit(
ThreadActorUpdate(
actors.div(AppLoader.THREADS).times(i).roundInt(),
actors.div(AppLoader.THREADS).times(i + 1).roundInt() - 1
actors.div(AppLoader.THREAD_COUNT).times(i).roundToInt(),
actors.div(AppLoader.THREAD_COUNT).times(i + 1).roundToInt() - 1
)
)
}
ThreadParallel.startAll()
ThreadExecutor.join()
actorNowPlaying?.update(delta)
}

View File

@@ -1,11 +1,14 @@
package net.torvald.terrarum.modulebasegame
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.ScreenAdapter
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import net.torvald.terrarum.*
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.util.CircularArray
import kotlin.math.roundToInt
@@ -29,7 +32,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
companion object {
private const val WIDTH_RATIO = 0.7
private const val PREVIEW_UPDATE_RATE = 1 / 5f
private const val PREVIEW_UPDATE_RATE = AppLoader.UPDATE_RATE
private val COL_TERR = Color.WHITE
private val COL_WALLED = Color(.5f, .5f, .5f, 1f)
@@ -57,8 +60,6 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
}
override fun render(delta: Float) {
//println("WorldgenLoadScreenRender")
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
previewRenderCounter += delta
@@ -94,7 +95,9 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
val wx = (world.width.toFloat() / previewWidth * x).roundToInt()
val wy = (world.height.toFloat() / previewHeight * y).roundToInt()
val outCol = if (world.getTileFromTerrain(wx, wy) > 15) COL_TERR else if (world.getTileFromWall(wx, wy) > 15) COL_WALLED else COL_AIR
val outCol = if (BlockCodex[world.getTileFromTerrain(wx, wy)].isSolid) COL_TERR
else if (BlockCodex[world.getTileFromWall(wx, wy)].isSolid) COL_WALLED
else COL_AIR
previewPixmap.setColor(outCol)
previewPixmap.drawPixel(x, previewHeight - 1 - y) // this flips Y
@@ -103,9 +106,6 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
}
override fun addMessage(msg: String) {
super.addMessage(msg)
}
override fun dispose() {
if (!previewPixmap.isDisposed)

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.modulebasegame.console
import net.torvald.gdx.graphics.Cvec
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.console.ConsoleCommand
@@ -7,6 +8,7 @@ import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.console.EchoError
import net.torvald.terrarum.utils.RasterWriter
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.toRGBA
import java.io.File
import java.io.IOException
@@ -31,7 +33,8 @@ internal object ExportMap : ConsoleCommand {
var mapDataPointer = 0
for (tile in world.terrainIterator()) {
val colArray = CreateTileAtlas.terrainTileColourMap.getRaw(tile % 16, tile / 16).toByteArray()
val tileNumber = CreateTileAtlas.tileIDtoItemSheetNumber(tile)
val colArray = CreateTileAtlas.terrainTileColourMap.get(tileNumber)!!.toByteArray()
for (i in 0..2) {
mapData[mapDataPointer + i] = colArray[i]
@@ -71,11 +74,13 @@ internal object ExportMap : ConsoleCommand {
/***
* R-G-B-A order for RGBA input value
*/
private fun Cvec.toByteArray() = this.toRGBA().toByteArray()
private fun Int.toByteArray() = byteArrayOf(
this.shr(24).and(0xff).toByte(),
this.shr(16).and(0xff).toByte(),
this.shr(8).and(0xff).toByte(),
this.and(0xff).toByte()
this.ushr(24).and(255).toByte(),
this.ushr(16).and(255).toByte(),
this.ushr(8).and(255).toByte(),
this.and(255).toByte()
)
override fun printUsage() {

View File

@@ -4,6 +4,7 @@ import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.console.EchoError
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
@@ -22,10 +23,10 @@ internal object Inventory : ConsoleCommand {
else {
when (args[1]) {
"list" -> listInventory()
"add" -> if (args.size > 3) addItem(args[2].toInt(), args[3].toInt())
else addItem(args[2].toInt())
"add" -> if (args.size > 3) addItem(args[2], args[3].toInt())
else addItem(args[2])
"target" -> setTarget(args[2].toInt())
"equip" -> equipItem(args[2].toInt())
"equip" -> equipItem(args[2])
else -> printUsage()
}
}
@@ -57,13 +58,13 @@ internal object Inventory : ConsoleCommand {
}
}
private fun addItem(refId: Int, amount: Int = 1) {
private fun addItem(refId: ItemID, amount: Int = 1) {
if (target != null) {
target!!.addItem(ItemCodex[refId]!!, amount)
}
}
private fun equipItem(refId: Int) {
private fun equipItem(refId: ItemID) {
if (target != null) {
val item = ItemCodex[refId]!!
target!!.equipItem(item)

View File

@@ -68,16 +68,16 @@ open class ActorHumanoid(
override var color: Cvec
get() = Cvec(
(actorValue.getAsFloat(AVKey.LUMR) ?: 0f) / LightmapRenderer.MUL_FLOAT,
(actorValue.getAsFloat(AVKey.LUMG) ?: 0f) / LightmapRenderer.MUL_FLOAT,
(actorValue.getAsFloat(AVKey.LUMB) ?: 0f) / LightmapRenderer.MUL_FLOAT,
(actorValue.getAsFloat(AVKey.LUMA) ?: 0f) / LightmapRenderer.MUL_FLOAT
(actorValue.getAsFloat(AVKey.LUMR) ?: 0f),
(actorValue.getAsFloat(AVKey.LUMG) ?: 0f),
(actorValue.getAsFloat(AVKey.LUMB) ?: 0f),
(actorValue.getAsFloat(AVKey.LUMA) ?: 0f)
)
set(value) {
actorValue[AVKey.LUMR] = value.r * LightmapRenderer.MUL_FLOAT
actorValue[AVKey.LUMG] = value.g * LightmapRenderer.MUL_FLOAT
actorValue[AVKey.LUMB] = value.b * LightmapRenderer.MUL_FLOAT
actorValue[AVKey.LUMA] = value.a * LightmapRenderer.MUL_FLOAT
actorValue[AVKey.LUMR] = value.r
actorValue[AVKey.LUMG] = value.g
actorValue[AVKey.LUMB] = value.b
actorValue[AVKey.LUMA] = value.a
}
/**
@@ -168,7 +168,7 @@ open class ActorHumanoid(
private var jumpJustPressedLatched = false
@Transient private val nullItem = object : GameItem(0) {
@Transient private val nullItem = object : GameItem("item@basegame:0") {
override val isUnique: Boolean = false
override var baseMass: Double = 0.0
override var baseToolSize: Double? = null
@@ -231,22 +231,22 @@ open class ActorHumanoid(
private fun updateGamerControlBox() {
if (isGamer) {
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyup"))
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyleft"))
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keydown"))
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyright"))
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump"))
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyup"))
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyleft"))
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keydown"))
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyright"))
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump"))
val gamepad = AppLoader.gamepad
if (gamepad != null) {
axisX = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxislx"))
axisY = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisly"))
axisRX = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisrx"))
axisRY = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisry"))
axisX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxislx"))
axisY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisly"))
axisRX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisrx"))
axisRY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisry"))
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) ||
gamepad.getButton(AppLoader.getConfigInt("gamepadltrigger"))
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump")) ||
gamepad.getButton(AppLoader.getConfigInt("config_gamepadltrigger"))
}
if (isJumpJustDown && jumpJustPressedLatched) {
@@ -315,11 +315,11 @@ open class ActorHumanoid(
// ↑F, ↓S
if (isRightDown && !isLeftDown) {
walkHorizontal(false, AXIS_KEYBOARD)
prevHMoveKey = AppLoader.getConfigInt("keyright")
prevHMoveKey = AppLoader.getConfigInt("config_keyright")
} // ↓F, ↑S
else if (isLeftDown && !isRightDown) {
walkHorizontal(true, AXIS_KEYBOARD)
prevHMoveKey = AppLoader.getConfigInt("keyleft")
prevHMoveKey = AppLoader.getConfigInt("config_keyleft")
} // ↓F, ↓S
/*else if (isLeftDown && isRightDown) {
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
@@ -343,11 +343,11 @@ open class ActorHumanoid(
// ↑E, ↓D
if (isDownDown && !isUpDown) {
walkVertical(false, AXIS_KEYBOARD)
prevVMoveKey = AppLoader.getConfigInt("keydown")
prevVMoveKey = AppLoader.getConfigInt("config_keydown")
} // ↓E, ↑D
else if (isUpDown && !isDownDown) {
walkVertical(true, AXIS_KEYBOARD)
prevVMoveKey = AppLoader.getConfigInt("keyup")
prevVMoveKey = AppLoader.getConfigInt("config_keyup")
} // ↓E, ↓D
/*else if (isUpDown && isDownDown) {
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {

View File

@@ -7,12 +7,11 @@ import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.itemproperties.ItemCodex.ITEM_DYNAMIC
import net.torvald.terrarum.itemproperties.ItemCodex.ITEM_WALLS
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.lock
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar
import java.math.BigInteger
import java.util.*
import java.util.concurrent.locks.ReentrantLock
@@ -41,23 +40,20 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
val itemList = ArrayList<InventoryPair>()
val quickSlot = Array<ItemID?>(UIQuickslotBar.SLOT_COUNT) { null } // 0: Slot 1, 9: Slot 10
var wallet = 0 // unified currency for whole civs; Dwarf Fortress approach seems too complicated
var wallet = BigInteger("0") // unified currency for whole civs; Dwarf Fortress approach seems too complicated
init {
}
fun add(itemID: ItemID, count: Int = 1) = add(ItemCodex[itemID]!!, count)
fun add(itemID: ItemID, count: Int = 1) {
if (ItemCodex[itemID] == null)
throw NullPointerException("Item not found: $itemID")
else
add(ItemCodex[itemID]!!, count)
}
fun add(item: GameItem, count: Int = 1) {
println("[ActorInventory] add $item, $count")
// not wall-able walls
if (item.inventoryCategory == GameItem.Category.WALL &&
!BlockCodex[item.dynamicID - ITEM_WALLS.start].isWallable) {
throw IllegalArgumentException("Wall ID ${item.dynamicID - ITEM_WALLS.start} is not wall-able.")
}
println("[ActorInventory] add-by-elem $item, $count")
// other invalid values
if (count == 0)
@@ -65,12 +61,12 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
if (count < 0)
throw IllegalArgumentException("Item count is negative number. If you intended removing items, use remove()\n" +
"These commands are NOT INTERCHANGEABLE; they handle things differently according to the context.")
if (item.originalID == Terrarum.PLAYER_REF_ID || item.originalID == 0x51621D) // do not delete this magic
if (item.originalID == "actor:${Terrarum.PLAYER_REF_ID}" || item.originalID == ("actor:${0x51621D}")) // do not delete this magic
throw IllegalArgumentException("Attempted to put human player into the inventory.")
if (((Terrarum.ingame as? TerrarumIngame)?.gameFullyLoaded ?: false) &&
(item.originalID == (Terrarum.ingame as? TerrarumIngame)?.actorNowPlaying?.referenceID))
(item.originalID == "actor:${(Terrarum.ingame as? TerrarumIngame)?.actorNowPlaying?.referenceID}"))
throw IllegalArgumentException("Attempted to put active player into the inventory.")
if ((!item.stackable || item.dynamicID in ITEM_DYNAMIC) && count > 1)
if ((!item.stackable || item.dynamicID.startsWith("dyn:")) && count > 1)
throw IllegalArgumentException("Attempting to adding stack of item but the item is not stackable; item: $item, count: $count")

View File

@@ -14,15 +14,15 @@ import net.torvald.terrarum.itemproperties.ItemCodex
open class DroppedItem(private val item: GameItem) : ActorWithBody(RenderOrder.MIDTOP, PhysProperties.PHYSICS_OBJECT) {
init {
if (item.dynamicID >= ItemCodex.ACTORID_MIN)
if (item.dynamicID.startsWith("actor@"))
throw RuntimeException("Attempted to create DroppedItem actor of a real actor; the real actor must be dropped instead.")
isVisible = true
avBaseMass = if (item.dynamicID < BlockCodex.MAX_TERRAIN_TILES)
BlockCodex[item.dynamicID].density / 1000.0
else
avBaseMass = if (item.dynamicID.startsWith("item@"))
ItemCodex[item.dynamicID]!!.mass
else
BlockCodex[item.dynamicID].density / 1000.0 // block and wall
actorValue[AVKey.SCALE] = ItemCodex[item.dynamicID]!!.scale
}

View File

@@ -7,6 +7,7 @@ import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gameactors.PhysProperties
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.ui.UICanvas
@@ -77,10 +78,10 @@ open class FixtureBase(
// if the collision type is allow_move_down, only the top surface tile should be "the platform"
// lower part must not have such property (think of the table!)
// TODO does this ACTUALLY work ?!
world.setTileTerrain(x, y, if (y == posY) BlockBox.ALLOW_MOVE_DOWN else BlockBox.NO_COLLISION)
world.setTileTerrain(x, y, if (y == posY) BlockBox.ALLOW_MOVE_DOWN else BlockBox.NO_COLLISION, false)
}
else
world.setTileTerrain(x, y, blockBox.collisionType)
world.setTileTerrain(x, y, blockBox.collisionType, false)
}
}
@@ -115,7 +116,7 @@ open class FixtureBase(
// remove filler block
for (x in posX until posX + blockBox.width) {
for (y in posY until posY + blockBox.height) {
world.setTileTerrain(x, y, Block.AIR)
world.setTileTerrain(x, y, Block.AIR, false)
}
}
@@ -156,7 +157,7 @@ open class FixtureBase(
for (x in posX until posX + blockBox.width) {
for (y in posY until posY + blockBox.height) {
if (world.getTileFromTerrain(x, y) == blockBox.collisionType) {
world.setTileTerrain(x, y, Block.AIR)
world.setTileTerrain(x, y, Block.AIR, false)
}
}
}
@@ -201,7 +202,7 @@ inline class BlockBoxProps(val flags: Int) {
* @param width Width of the block box, tile-wise
* @param height Height of the block box, tile-wise
*/
data class BlockBox(val collisionType: Int, val width: Int, val height: Int) {
data class BlockBox(val collisionType: ItemID, val width: Int, val height: Int) {
/*fun redefine(collisionType: Int, width: Int, height: Int) {
redefine(collisionType)

View File

@@ -27,7 +27,7 @@ open class HumanoidNPC(
}
// we're having GameItem data so that this class could be somewhat universal
override var itemData: GameItem = object : GameItem(referenceID) {//GameItem(referenceID ?: forceAssignRefID!!) {
override var itemData: GameItem = object : GameItem("actor:"+referenceID) {//GameItem(referenceID ?: forceAssignRefID!!) {
override val isUnique = true
override var baseMass: Double
get() = actorValue.getAsDouble(AVKey.BASEMASS)!!

View File

@@ -77,20 +77,22 @@ object PlayerBuilderSigrid {
CreateTileAtlas.tags.forEach { t, _ ->
inventory.add(t, 9995)
if (BlockCodex[t].isWallable) {
inventory.add(t + 4096, 9995)
try {
inventory.add("wall@"+t, 9995) // this code will try to add nonexisting wall items, do not get surprised with NPEs
}
catch (e: Throwable) {
System.err.println("[PlayerBuilder] $e")
}
}
// item ids are defined in <module>/items/itemid.csv
inventory.add(8448, 16) // copper pick
inventory.add(8449) // iron pick
inventory.add(8450) // steel pick
inventory.add(8466, 9995) // wire piece
inventory.add(8467, 385930603) // test tiki torch
inventory.add(8468, 95) // crafting table
inventory.add(9000) // TEST water bucket
inventory.add(9001) // TEST lava bucket
inventory.add("item@basegame:1", 16) // copper pick
inventory.add("item@basegame:2") // iron pick
inventory.add("item@basegame:3") // steel pick
inventory.add("item@basegame:4", 9995) // wire piece
inventory.add("item@basegame:5", 385930603) // test tiki torch
inventory.add("item@basegame:6", 95) // crafting table
}
}

View File

@@ -77,12 +77,12 @@ interface Pocketed {
}
fun equipped(itemID: ItemID) = equipped(ItemCodex[itemID]!!)
fun addItem(itemID: Int, count: Int = 1) = inventory.add(ItemCodex[itemID]!!, count)
fun addItem(itemID: ItemID, count: Int = 1) = inventory.add(ItemCodex[itemID]!!, count)
fun addItem(item: GameItem, count: Int = 1) = inventory.add(item, count)
fun removeItem(itemID: Int, count: Int = 1) = inventory.remove(ItemCodex[itemID]!!, count)
fun removeItem(itemID: ItemID, count: Int = 1) = inventory.remove(ItemCodex[itemID]!!, count)
fun removeItem(item: GameItem, count: Int = 1) = inventory.remove(item, count)
fun hasItem(item: GameItem) = inventory.contains(item.dynamicID)
fun hasItem(id: Int) = inventory.contains(id)
fun hasItem(id: ItemID) = inventory.contains(id)
}

View File

@@ -3,12 +3,13 @@ package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.itemproperties.ItemCodex
import java.util.concurrent.Callable
/**
* Created by minjaesong on 2016-05-25.
*/
class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Runnable {
override fun run() {
class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Callable<Unit> {
override fun call() {
for (i in startIndex..endIndex) {
val it = Terrarum.ingame!!.actorContainerActive[i]
it.update(AppLoader.UPDATE_RATE)

View File

@@ -5,6 +5,7 @@ import net.torvald.terrarum.Point2i
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gameitem.GameItem
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.TerrarumIngame
@@ -20,7 +21,7 @@ object BlockBase {
* @param dontEncaseActors when set to true, blocks won't be placed where Actors are. You will want to set it false
* for wire items, otherwise you want it to be true.
*/
fun blockStartPrimaryUse(gameItem: GameItem, itemID: Int, delta: Float): Boolean {
fun blockStartPrimaryUse(gameItem: GameItem, itemID: ItemID, delta: Float): Boolean {
val ingame = Terrarum.ingame!! as TerrarumIngame
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
val mouseTile = Point2i(Terrarum.mouseTileX, Terrarum.mouseTileY)
@@ -45,24 +46,26 @@ object BlockBase {
if (gameItem.inventoryCategory == GameItem.Category.BLOCK &&
gameItem.dynamicID == ingame.world.getTileFromTerrain(mouseTile.x, mouseTile.y) ||
gameItem.inventoryCategory == GameItem.Category.WALL &&
gameItem.dynamicID - ItemCodex.ITEM_WALLS.start == ingame.world.getTileFromWall(mouseTile.x, mouseTile.y)
)
gameItem.dynamicID == ingame.world.getTileFromWall(mouseTile.x, mouseTile.y)
)
return false
// filter passed, do the job
// FIXME this is only useful for Player
if (itemID in ItemCodex.ITEM_TILES) {
ingame.world.setTileTerrain(
mouseTile.x,
mouseTile.y,
itemID
)
}
else {
if (itemID.startsWith("wall@")) {
ingame.world.setTileWall(
mouseTile.x,
mouseTile.y,
itemID
itemID.substring(5),
false
)
}
else {
ingame.world.setTileTerrain(
mouseTile.x,
mouseTile.y,
itemID,
false
)
}
@@ -74,7 +77,8 @@ object BlockBase {
}
fun wireStartPrimaryUse(gameItem: GameItem, wireTypeBit: Int, delta: Float): Boolean {
val ingame = Terrarum.ingame!! as TerrarumIngame
return false // TODO need new wire storing format
/*val ingame = Terrarum.ingame!! as TerrarumIngame
val mouseTile = Point2i(Terrarum.mouseTileX, Terrarum.mouseTileY)
// return false if the tile is already there
@@ -93,7 +97,7 @@ object BlockBase {
)
)
return true
return true*/
}
fun wireEffectWhenEquipped(typebit: Int, delta: Float) {

View File

@@ -7,12 +7,14 @@ import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.FluidType
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
import org.khelekore.prtree.*
import kotlin.math.roundToInt
/**
* Created by minjaesong on 2016-08-03.
@@ -77,8 +79,8 @@ object WorldSimulator {
//printdbg(this, "============================")
if (player != null) {
updateXFrom = player.hitbox.centeredX.div(CreateTileAtlas.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundInt()
updateYFrom = player.hitbox.centeredY.div(CreateTileAtlas.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundInt()
updateXFrom = player.hitbox.centeredX.div(CreateTileAtlas.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundToInt()
updateYFrom = player.hitbox.centeredY.div(CreateTileAtlas.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundToInt()
updateXTo = updateXFrom + DOUBLE_RADIUS
updateYTo = updateYFrom + DOUBLE_RADIUS
}
@@ -206,8 +208,8 @@ object WorldSimulator {
// process the gradual falling of the selected "stack"
if (!fallableStackProcessed && fallDownCounter != 0 && isFallable) {
// replace blocks
world.setTileTerrain(x, y, Block.AIR)
world.setTileTerrain(x, y + fallDownCounter, currentTile)
world.setTileTerrain(x, y, Block.AIR, true)
world.setTileTerrain(x, y + fallDownCounter, currentTile, true)
fallableStackProcessed = true
}
@@ -415,7 +417,7 @@ object WorldSimulator {
}
fun Int.isFallable() = BlockCodex[this].maxSupport
fun ItemID.isFallable() = BlockCodex[this].maxSupport
private val actorMBRConverter = object : MBRConverter<ActorWithBody> {
@@ -436,14 +438,12 @@ object WorldSimulator {
}
// simple euclidean norm, squared
private val actorDistanceCalculator = object : DistanceCalculator<ActorWithBody> {
override fun distanceTo(t: ActorWithBody, p: PointND): Double {
val dist1 = (p.getOrd(0) - t.hitbox.centeredX).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
// ROUNDWORLD implementation
val dist2 = (p.getOrd(0) - (t.hitbox.centeredX - world.width * TILE_SIZE)).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
val dist3 = (p.getOrd(0) - (t.hitbox.centeredX + world.width * TILE_SIZE)).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
private val actorDistanceCalculator = DistanceCalculator<ActorWithBody> { t: ActorWithBody, p: PointND ->
val dist1 = (p.getOrd(0) - t.hitbox.centeredX).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
// ROUNDWORLD implementation
val dist2 = (p.getOrd(0) - (t.hitbox.centeredX - world.width * TILE_SIZE)).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
val dist3 = (p.getOrd(0) - (t.hitbox.centeredX + world.width * TILE_SIZE)).sqr() + (p.getOrd(1) - t.hitbox.centeredY).sqr()
return minOf(dist1, minOf(dist2, dist3))
}
minOf(dist1, minOf(dist2, dist3))
}
}

View File

@@ -38,7 +38,7 @@ class UIBasicInfo(private val player: ActorHumanoid?) : UICanvas() {
ELuptimer += delta
}
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
ELuptimer = 0f
ELon = true
}

View File

@@ -1,4 +1,4 @@
package net.torvald.terrarum.modulebasegame
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Camera
@@ -6,13 +6,16 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.fillRect
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.BuildingMaker
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_WHITE
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemImageButton
import net.torvald.terrarum.ui.UIItemTextButtonList
import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_BACKGROUNDCOL
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import kotlin.math.roundToInt
/**
@@ -28,27 +31,18 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
const val MENUBAR_SIZE = 72
const val SCROLLBAR_SIZE = 24
const val WIDTH = TILES_X*TILESREGION_SIZE + SCROLLBAR_SIZE + MENUBAR_SIZE
const val HEIGHT = TILES_Y*TILESREGION_SIZE
const val WIDTH = TILES_X * TILESREGION_SIZE + SCROLLBAR_SIZE + MENUBAR_SIZE
const val HEIGHT = TILES_Y * TILESREGION_SIZE
}
override var width = WIDTH
override var height = HEIGHT
override var openCloseTime = 0f
private val palette = Array<UIItemImageButton>(TILES_X * TILES_Y) {
// initialise with terrain blocks
UIItemImageButton(
this, ItemCodex.getItemImage(it),
initialX = MENUBAR_SIZE + (it % 16) * TILESREGION_SIZE,
initialY = (it / 16) * TILESREGION_SIZE,
highlightable = false,
width = TILESREGION_SIZE,
height = TILESREGION_SIZE,
highlightCol = Color.WHITE,
activeCol = Color.WHITE
)
}
val palette = ArrayList<UIItemImageButton>()
// TODO scrolling of the palette, as the old method flat out won't work with The Flattening
private val tabs = UIItemTextButtonList(
this, arrayOf("Terrain", "Wall", "Wire"),
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
@@ -61,12 +55,25 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
)
init {
palette.forEachIndexed { index, it ->
uiItems.add(it)
it.clickOnceListener = { _, _, _ ->
parent.setPencilColour(paletteScroll * 16 + index)
BlockCodex.getAll().forEachIndexed { index, prop ->
val paletteItem = UIItemImageButton(
this, ItemCodex.getItemImage(prop.id)!!,
initialX = MENUBAR_SIZE + (index % 16) * TILESREGION_SIZE,
initialY = (index / 16) * TILESREGION_SIZE,
highlightable = false,
width = TILESREGION_SIZE,
height = TILESREGION_SIZE,
highlightCol = Color.WHITE,
activeCol = Color.WHITE
)
paletteItem.clickOnceListener = { _, _, _ ->
parent.setPencilColour(prop.id)
}
uiItems.add(paletteItem)
palette.add(paletteItem)
}
}
@@ -81,7 +88,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
}
// respond to click
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
// scroll bar
if (relativeMouseX in width - SCROLLBAR_SIZE until width && relativeMouseY in 0 until height) {
mouseOnScroll = true
@@ -118,9 +125,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
}
private fun rebuildPalette() {
palette.forEachIndexed { index, it ->
it.image = ItemCodex.getItemImage(paletteScroll * 16 + index)
}
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {

View File

@@ -1,4 +1,4 @@
package net.torvald.terrarum.modulebasegame
package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
@@ -7,11 +7,12 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.*
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory
import net.torvald.terrarum.modulebasegame.BuildingMaker
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemImageButton
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.dyn4j.geometry.Vector2
import kotlin.math.roundToInt
/**
* Created by minjaesong on 2019-02-16.
@@ -57,8 +58,8 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
backgroundCol = Color(0),
highlightBackCol = Color(0),
activeBackCol = Color(0),
initialX = newvec.x.roundInt(),
initialY = newvec.y.roundInt(),
initialX = newvec.x.roundToInt(),
initialY = newvec.y.roundToInt(),
width = ICON_SIZE, height = ICON_SIZE,
highlightable = false
)
@@ -98,7 +99,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
uiItems.add(button)
button.clickOnceListener = { _, _, b ->
if (b == AppLoader.getConfigInt("mouseprimary")) {
if (b == AppLoader.getConfigInt("config_mouseprimary")) {
toolButtonsJob[index].invoke()
closeGracefully()
}
@@ -132,7 +133,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
}
// primary click
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
// close by clicking close button or out-of-boud
if (mouseVec.distanceSquared(RADIUS, RADIUS) !in CLOSE_BUTTON_RADIUS.sqr()..RADIUSF.sqr()) {
closeGracefully()
@@ -152,17 +153,17 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
// draw blocks slot
batch.color = blockCellCol
val slotConfig = AppLoader.getConfigIntArray("buildingmakerfavs")
val slotConfig = AppLoader.getConfigStringArray("buildingmakerfavs")
for (i in 0 until PALETTE_SIZE) {
val x = blockCellPos[i].x.roundInt().toFloat()
val y = blockCellPos[i].y.roundInt().toFloat()
val x = blockCellPos[i].x.roundToInt().toFloat()
val y = blockCellPos[i].y.roundToInt().toFloat()
batch.color = blockCellCol
repeat((i == mouseOnBlocksSlot).toInt() + 1) { batch.fillCircle(x - BLOCK_BACK_RADIUS, y - BLOCK_BACK_RADIUS, BLOCK_BACK_SIZE.toFloat(), BLOCK_BACK_SIZE.toFloat()) }
batch.color = Color.WHITE
batch.draw(ItemCodex.getItemImage(slotConfig[i]), x - 16, y - 16, 32f, 32f)
// update as well while looping
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
parent.setPencilColour(slotConfig[i])
closeGracefully()
}

View File

@@ -157,10 +157,10 @@ package net.torvald.terrarum.modulebasegame.ui
private var isEncumbered = false
private val seekLeft: Int; get() = AppLoader.getConfigInt("keyleft") // getter used to support in-game keybind changing
private val seekRight: Int; get() = AppLoader.getConfigInt("keyright") // getter used to support in-game keybind changing
private val seekUp: Int; get() = AppLoader.getConfigInt("keyup") // getter used to support in-game keybind changing
private val seekDown: Int; get() = AppLoader.getConfigInt("keydown") // getter used to support in-game keybind changing
private val seekLeft: Int; get() = AppLoader.getConfigInt("config_keyleft") // getter used to support in-game keybind changing
private val seekRight: Int; get() = AppLoader.getConfigInt("config_keyright") // getter used to support in-game keybind changing
private val seekUp: Int; get() = AppLoader.getConfigInt("config_keyup") // getter used to support in-game keybind changing
private val seekDown: Int; get() = AppLoader.getConfigInt("config_keydown") // getter used to support in-game keybind changing
init {

View File

@@ -7,6 +7,7 @@ import net.torvald.terrarum.*
import net.torvald.terrarum.gameactors.ActorWithBody
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
import net.torvald.terrarum.ui.UICanvas
import kotlin.math.roundToInt
@@ -122,7 +123,7 @@ internal class UIInventoryCells(
)
// debug text
batch.color = Color.LIGHT_GRAY
if (AppLoader.IS_DEVELOPMENT_BUILD) {
if (INVEN_DEBUG_MODE) {
AppLoader.fontSmallNumbers.draw(batch,
"${full.actor.inventory.capacity}/${full.actor.inventory.maxCapacity}",
encumbBarTextXPos,

View File

@@ -33,10 +33,10 @@ class UIInventoryFull(
override var height: Int = AppLoader.screenH
override var openCloseTime: Second = 0.0f
val REQUIRED_MARGIN = 166 // hard-coded value. Don't know the details
val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
val CELLS_HOR = 10
val CELLS_VRT = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryDynamicList.listGap) / // 134 is another magic number
val CELLS_VRT: Int; get() = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryDynamicList.listGap) / // 134 is another magic number
(UIItemInventoryElemSimple.height + UIItemInventoryDynamicList.listGap)
private val itemListToEquipViewGap = UIItemInventoryDynamicList.listGap // used to be 24; figured out that the extra gap does nothig
@@ -46,9 +46,9 @@ class UIInventoryFull(
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryDynamicList.Companion.listGap
val INVENTORY_CELLS_UI_HEIGHT = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryDynamicList.listGap
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryDynamicList.listGap
val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.screenW - internalWidth) / 2
val INVENTORY_CELLS_OFFSET_Y = 107 + (AppLoader.screenH - internalHeight) / 2
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenH - internalHeight) / 2
init {
handler.allowESCtoClose = true
@@ -253,5 +253,9 @@ class UIInventoryFull(
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
}
companion object {
const val INVEN_DEBUG_MODE = false
}
}

View File

@@ -42,7 +42,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
// update map panning
// if left click is down and cursor is in the map area
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) &&
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) &&
Terrarum.mouseScreenY in full.INVENTORY_CELLS_OFFSET_Y..full.INVENTORY_CELLS_OFFSET_Y + full.INVENTORY_CELLS_UI_HEIGHT) {
minimapPanX += Terrarum.mouseDeltaX * 2f / minimapZoom
minimapPanY += Terrarum.mouseDeltaY * 2f / minimapZoom

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK_ACTIVE
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
import net.torvald.terrarum.ui.UIItem
import net.torvald.terrarum.ui.UIItemImageButton
import net.torvald.terrarum.ui.UIItemTextButton.Companion.defaultActiveCol
@@ -309,7 +310,7 @@ class UIItemInventoryDynamicList(
// set tooltip accordingly
if (isCompactMode && it.item != null && it.mouseUp && !tooltipSet) {
(Terrarum.ingame as? TerrarumIngame)?.setTooltipMessage(
if (AppLoader.IS_DEVELOPMENT_BUILD) {
if (INVEN_DEBUG_MODE) {
it.item?.name + "/Mat: ${it.item?.material?.identifier}"
}
else {

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.fillRect
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.itemproperties.ItemCodex
import net.torvald.terrarum.modulebasegame.BuildingMaker
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK
@@ -31,8 +32,8 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
fun mouseOnTitleBar() =
relativeMouseX in 0 until width && relativeMouseY in 0 until LINE_HEIGHT
var fore = Block.STONE_BRICKS
var back = Block.GLASS_CRUDE
var fore: ItemID = Block.STONE_BRICKS
var back: ItemID = Block.GLASS_CRUDE
private val titleText = "Pal."
@@ -102,10 +103,9 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
}
fun swapForeAndBack() {
// xor used, because why not?
fore = fore xor back
back = back xor fore
fore = fore xor back
val t = fore
fore = back
back = t
}
override fun doOpening(delta: Float) {

View File

@@ -16,7 +16,7 @@ import net.torvald.terrarum.ui.UICanvas
* Created by minjaesong on 2019-08-11.
*/
class UIScreenZoom : UICanvas(
AppLoader.getConfigInt("keyzoom")
AppLoader.getConfigInt("config_keyzoom")
) {
val zoomText = "${keyToIcon(handler.toggleKeyLiteral!!)} $EMDASH Zoom Out"

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
import net.torvald.terrarum.modulebasegame.imagefont.WatchFont
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import kotlin.math.roundToInt
/**
* Created by minjaesong on 2017-06-11.
@@ -46,7 +47,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
ELuptimer += delta
}
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
ELuptimer = 0f
ELon = true
}
@@ -88,7 +89,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
// moon dial
val moonPhase = (worldTime.moonPhase * moonDialCount).roundInt() % moonDialCount
val moonPhase = (worldTime.moonPhase * moonDialCount).roundToInt() % moonDialCount
batch.color = lcdLitCol
batch.draw(moonDial.get(moonPhase, 0), 6f, 3f)
}

View File

@@ -16,7 +16,6 @@ import net.torvald.terrarum.modulebasegame.RNGConsumer
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.ParticleMegaRain
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
import net.torvald.terrarum.modulebasegame.worldgenerator.WorldGenerator
import net.torvald.terrarum.utils.JsonFetcher
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
import net.torvald.terrarum.worlddrawer.WorldCamera

View File

@@ -86,17 +86,17 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
when (control) {
0 -> { // woodlands
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
world.setTileTerrain(x, y, Block.GRASS)
world.setTileTerrain(x, y, Block.GRASS, true)
}
}
1 -> { // shrublands
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
world.setTileTerrain(x, y, Block.GRASS)
world.setTileTerrain(x, y, Block.GRASS, true)
}
}
2, 3 -> { // plains
if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) {
world.setTileTerrain(x, y, Block.GRASS)
world.setTileTerrain(x, y, Block.GRASS, true)
}
}
/*3 -> { // sands
@@ -109,8 +109,8 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
}*/
4 -> { // rockylands
if (tileThis == Block.DIRT) {
world.setTileTerrain(x, y, Block.STONE)
world.setTileWall(x, y, Block.STONE)
world.setTileTerrain(x, y, Block.STONE, true)
world.setTileWall(x, y, Block.STONE, true)
}
}
}

View File

@@ -1,8 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
/**
* Created by minjaesong on 2016-03-31.
*/
interface NoiseFilter {
fun getGrad(func_argX: Int, start: Double, end: Double): Double
}

View File

@@ -1,46 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
import com.jme3.math.FastMath
/**
* Double Quadratic polynomial
* (16/9) * (start-end)/height^2 * (x-height)^2 + end
* 16/9: terrain is formed from 1/4 of height.
* 1 - (1/4) = 3/4, reverse it and square it.
* That makes 16/9.
* Shape:
* cavity -
* small
* -
* -
* --
* ----
* cavity --------
* large ----------------
* @param func_argX
* *
* @param start
* *
* @param end
* *
* @return
* Created by minjaesong on 2016-03-31.
*/
object NoiseFilterCubic : NoiseFilter {
override fun getGrad(func_argX: Int, start: Double, end: Double): Double {
val graph_gradient = -FastMath.pow(FastMath.pow((1 - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat(), 3f), -1f) * // 1/4 -> 3/4 -> 9/16 -> 16/9
(start - end) / FastMath.pow(WorldGenerator.HEIGHT.toFloat(), 3f) *
FastMath.pow((func_argX - WorldGenerator.HEIGHT).toFloat(), 3f) + end
if (func_argX < WorldGenerator.TERRAIN_AVERAGE_HEIGHT) {
return start
} else if (func_argX >= WorldGenerator.HEIGHT) {
return end
} else {
return graph_gradient
}
}
}

View File

@@ -1,46 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
import com.jme3.math.FastMath
/**
* Quadratic polynomial
* -(16/9) * (start-end)/height^2 * (x - 0.25 * height)^2 + start
* 16/9: terrain is formed from 1/4 of height.
* 1 - (1/4) = 3/4, reverse it and square it.
* That makes 16/9.
* Shape:
* cavity _
* small
* _
* _
* __
* ____
* cavity ________
* large ________________
* @param func_argX
* *
* @param start
* *
* @param end
* *
* @return
* Created by minjaesong on 2016-03-31.
*/
object NoiseFilterMinusQuadratic : NoiseFilter {
override fun getGrad(func_argX: Int, start: Double, end: Double): Double {
val graph_gradient = -FastMath.pow(FastMath.sqr((1 - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat()), -1f) * // 1/4 -> 3/4 -> 9/16 -> 16/9
(start - end) / FastMath.sqr(WorldGenerator.HEIGHT.toFloat()) *
FastMath.sqr((func_argX - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat()) + start
if (func_argX < WorldGenerator.TERRAIN_AVERAGE_HEIGHT) {
return start
} else if (func_argX >= WorldGenerator.HEIGHT) {
return end
} else {
return graph_gradient
}
}
}

View File

@@ -1,47 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
import com.jme3.math.FastMath
/**
* Quadratic polynomial
* (16/9) * (start-end)/height^2 * (x-height)^2 + end
* 16/9: terrain is formed from 1/4 of height.
* 1 - (1/4) = 3/4, reverse it and square it.
* That makes 16/9.
* Shape:
* cavity -
* small
* -
* -
* --
* ----
* cavity --------
* large ----------------
* @param func_argX
* *
* @param start
* *
* @param end
* *
* @return
*
* Created by minjaesong on 2016-03-31.
*/
object NoiseFilterQuadratic : NoiseFilter {
override fun getGrad(func_argX: Int, start: Double, end: Double): Double {
val graph_gradient = FastMath.pow(FastMath.sqr((1 - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat()), -1f) * // 1/4 -> 3/4 -> 9/16 -> 16/9
(start - end) / FastMath.sqr(WorldGenerator.HEIGHT.toFloat()) *
FastMath.sqr((func_argX - WorldGenerator.HEIGHT).toFloat()) + end
if (func_argX < WorldGenerator.TERRAIN_AVERAGE_HEIGHT) {
return start
} else if (func_argX >= WorldGenerator.HEIGHT) {
return end
} else {
return graph_gradient
}
}
}

View File

@@ -1,20 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
import com.jme3.math.FastMath
/**
* Created by minjaesong on 2016-03-31.
*/
object NoiseFilterSqrt : NoiseFilter {
override fun getGrad(func_argX: Int, start: Double, end: Double): Double {
val graph_gradient = (end - start) / FastMath.sqrt((WorldGenerator.HEIGHT - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat()) * FastMath.sqrt((func_argX - WorldGenerator.TERRAIN_AVERAGE_HEIGHT).toFloat()) + start
if (func_argX < WorldGenerator.TERRAIN_AVERAGE_HEIGHT) {
return start
} else if (func_argX >= WorldGenerator.HEIGHT) {
return end
} else {
return graph_gradient
}
}
}

View File

@@ -1,10 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
/**
* Created by minjaesong on 2016-03-31.
*/
object NoiseFilterUniform : NoiseFilter {
override fun getGrad(func_argX: Int, start: Double, end: Double): Double {
return 1.0
}
}

View File

@@ -28,8 +28,8 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
(0 until world.width).sliceEvenly(genSlices).mapIndexed { i, xs ->
ThreadExecutor.submit {
val localJoise = getGenerator(seed, params as TerragenParams)
val localLock = java.lang.Object() // in an attempt to fix the "premature exit" issue of a thread run
synchronized(localLock) { // also see: https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
//val localLock = java.lang.Object() // in an attempt to fix the "premature exit" issue of a thread run
//synchronized(localLock) { // also see: https://stackoverflow.com/questions/28818494/threads-stopping-prematurely-for-certain-values
for (x in xs) {
for (y in 0 until world.height) {
val sampleTheta = (x.toDouble() / world.width) * TWO_PI
@@ -43,7 +43,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
draw(x, y, noise, world)
}
}
}
//}
}
}
@@ -69,10 +69,10 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
val cave = if (noiseValue[1] < 0.5) 0 else 1
val wallBlock = groundDepthBlock[terr]
val terrBlock = wallBlock * cave // AIR is always zero, this is the standard
val terrBlock = if (cave == 0) Block.AIR else wallBlock //wallBlock * cave // AIR is always zero, this is the standard
world.setTileTerrain(x, y, terrBlock)
world.setTileWall(x, y, wallBlock)
world.setTileTerrain(x, y, terrBlock, true)
world.setTileWall(x, y, wallBlock, true)
}

View File

@@ -1,71 +0,0 @@
package net.torvald.terrarum.modulebasegame.worldgenerator
import net.torvald.terrarum.AppLoader
/**
* Created by minjaesong on 2016-06-13.
*/
class ThreadProcessNoiseLayers(val startIndex: Int, val endIndex: Int,
val noiseRecords: Array<WorldGenerator.TaggedJoise>) : Runnable {
override fun run() {
for (record in noiseRecords) {
println("[mapgenerator] ${record.message}...")
AppLoader.getLoadScreen().addMessage("${record.message}...")
for (y in startIndex..endIndex) {
for (x in 0..WorldGenerator.WIDTH - 1) {
// straight-line sampling
/*val noise: Float = record.noiseModule.get(
x.toDouble() / 48.0, // 48: Fixed value
y.toDouble() / 48.0
).toFloat()*/
// circular sampling
// Mapping function:
// World(x, y) -> Joise(sin x, y, cos x)
val sampleDensity = 48.0 / 2 // 48.0: magic number from old code
val sampleTheta = (x.toDouble() / WorldGenerator.WIDTH) * WorldGenerator.TWO_PI
val sampleOffset = (WorldGenerator.WIDTH / sampleDensity) / 8.0
val sampleX = Math.sin(sampleTheta) * sampleOffset + sampleOffset // plus sampleOffset to make only
val sampleZ = Math.cos(sampleTheta) * sampleOffset + sampleOffset // positive points are to be sampled
val sampleY = y / sampleDensity
val noise: Double = record.noiseModule.get(sampleX, sampleY, sampleZ)
val fromTerr = record.replaceFromTerrain
val fromWall = record.replaceFromWall
val to: Int = when (record.replaceTo) {
// replace to designated tile
is Int -> record.replaceTo as Int
// replace to randomly selected tile from given array of tile IDs
is IntArray -> (record.replaceTo as IntArray)[WorldGenerator.random.nextInt((record.replaceTo as IntArray).size)]
else -> throw IllegalArgumentException("[mapgenerator] Unknown replaceTo tile type '${record.replaceTo.javaClass.canonicalName}': Only 'kotlin.Int' and 'kotlin.IntArray' is valid.")
}
// replace to ALL? this is bullshit
if (to == WorldGenerator.TILE_MACRO_ALL) throw IllegalArgumentException("[mapgenerator] Invalid replaceTo: TILE_MACRO_ALL")
// filtered threshold
val threshold = record.filter.getGrad(y, record.filterArg1, record.filterArg2)
if (noise > threshold * record.scarcity) {
if (fromTerr is IntArray) {
for (i in 0..fromTerr.size - 1) {
val fromTerrVariable = fromTerr[i]
if ((WorldGenerator.world.getTileFromTerrain(x, y) == fromTerrVariable || fromTerrVariable == WorldGenerator.TILE_MACRO_ALL)
&& (WorldGenerator.world.getTileFromWall(x, y) == fromWall || fromWall == WorldGenerator.TILE_MACRO_ALL)) {
WorldGenerator.world.setTileTerrain(x, y, to)
}
}
}
else if ((WorldGenerator.world.getTileFromTerrain(x, y) == fromTerr || fromTerr == WorldGenerator.TILE_MACRO_ALL)
&& (WorldGenerator.world.getTileFromWall(x, y) == fromWall || fromWall == WorldGenerator.TILE_MACRO_ALL)) {
WorldGenerator.world.setTileTerrain(x, y, to)
}
}
}
}
}
}
}

View File

@@ -10,8 +10,8 @@ import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.concurrent.ThreadParallel
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.roundInt
import java.util.*
import kotlin.math.roundToInt
@Deprecated("Old non-thread-safe version", ReplaceWith("Terragen", "net.torvald.terrarum.modulebasegame.worldgenerator"))
object WorldGenerator {
@@ -776,12 +776,12 @@ object WorldGenerator {
private fun processNoiseLayers(noiseRecords: Array<TaggedJoise>) {
if (AppLoader.MULTITHREAD) {
// set up indices
for (i in 0 until AppLoader.THREADS) {
for (i in 0 until AppLoader.THREAD_COUNT) {
ThreadParallel.map(
i, "SampleJoiseMap",
ThreadProcessNoiseLayers(
HEIGHT.toFloat().div(AppLoader.THREADS).times(i).roundInt(),
HEIGHT.toFloat().div(AppLoader.THREADS).times(i.plus(1)).roundInt() - 1,
HEIGHT.toFloat().div(AppLoader.THREAD_COUNT).times(i).roundToInt(),
HEIGHT.toFloat().div(AppLoader.THREAD_COUNT).times(i.plus(1)).roundToInt() - 1,
noiseRecords
)
)

View File

@@ -13,7 +13,8 @@ import java.util.concurrent.Callable
object Worldgen {
private lateinit var world: GameWorld
private lateinit var params: WorldgenParams
lateinit var params: WorldgenParams
private set
private val threadLock = java.lang.Object()

View File

@@ -366,7 +366,7 @@ class LuaComputerVM(val display: MDA) {
if (sine > 0.79) sine = 0.79
else if (sine < -0.79) sine = -0.79
audioData.put(
(0.5 + 0.5 * sine).times(0xFF).roundInt().toByte()
(0.5 + 0.5 * sine).times(0xFF).roundToInt().toByte()
)
}
}
@@ -377,7 +377,7 @@ class LuaComputerVM(val display: MDA) {
sine += Math.sin(Math.PI * 2 * (2*k - 1) * chopSize * x) / (2*k - 1)
}
audioData.put(
(0.5 + 0.5 * sine).times(0xFF).roundInt().toByte()
(0.5 + 0.5 * sine).times(0xFF).roundToInt().toByte()
)
}
}*/

View File

@@ -509,7 +509,7 @@ class TerrarumComputerOldOld(peripheralSlots: Int) {
if (sine > 0.79) sine = 0.79
else if (sine < -0.79) sine = -0.79
audioData.put(
(0.5 + 0.5 * sine).times(0xFF).roundInt().toByte()
(0.5 + 0.5 * sine).times(0xFF).roundToInt().toByte()
)
}
}
@@ -520,7 +520,7 @@ class TerrarumComputerOldOld(peripheralSlots: Int) {
sine += Math.sin(Math.PI * 2 * (2*k - 1) * chopSize * x) / (2*k - 1)
}
audioData.put(
(0.5 + 0.5 * sine).times(0xFF).roundInt().toByte()
(0.5 + 0.5 * sine).times(0xFF).roundToInt().toByte()
)
}
}*/

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.serialise
import com.badlogic.gdx.utils.compression.Lzma
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.BlockLayer
import net.torvald.terrarum.gameworld.FluidType
@@ -151,6 +152,7 @@ internal object ReadLayerDataLzma {
val wallDamages = HashMap<BlockAddress, Float>()
val fluidTypes = HashMap<BlockAddress, FluidType>()
val fluidFills = HashMap<BlockAddress, Float>()
val tileNumToName = HashMap<Int, ItemID>()
// parse terrain damages
for (c in payloadBytes["TdMG"]!!.indices step 10) {
@@ -176,6 +178,8 @@ internal object ReadLayerDataLzma {
// TODO parse fluid(Types|Fills)
// TODO parse tileNumToName
return ReadLayerDataZip.LayerData(
BlockLayer(width, height, payloadBytes["WALL"]!!),
@@ -183,7 +187,7 @@ internal object ReadLayerDataLzma {
spawnPoint.first, spawnPoint.second,
wallDamages, terrainDamages, fluidTypes, fluidFills
wallDamages, terrainDamages, fluidTypes, fluidFills, tileNumToName
)
}

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