6144 Commits

Author SHA1 Message Date
Tamás Bálint Misius
afe4a26299
Make SRT work with event.AFTERSIMDRAW
AFTERSIMDRAW can be composited on the main thread on top of the frame that got rendered in parallel, so there is no reason to have it hinder SRT. This cannot be done with BEFORESIMDRAW, which is applied to the frame before the rest of the sim is rendered. If we had proper associative compositing with pre-multiplied alpha, it could be, but this doesn't really work well with the colour space we're using right now (sRGB, with u8 components).
2025-01-01 21:55:37 +01:00
Tamás Bálint Misius
87cf63dbcc
Disable steam builds for mods and ordinary official workflows
Ordinary i.e. not stables, betas, or snapshots.
2025-01-01 16:51:49 +01:00
Tamás Bálint Misius
6dd0e9533f
Fix Rect::operator & (intersection)
Completely neglected to normalize the Rect's size. Somehow completely asymptomatic unless looking at the favourites menu if it's too long to fit on the screen, on MacOS. Yeah.

Another in the series of fixes for easily avoidable problems introduced in c2bb77721208 by my infinite wisdom >_>. The previous (and thankfully, first) commit in the series is 8cab4ab73819.
2024-12-30 15:22:54 +01:00
jacob1
a32f0fe178
Version 99.0 (Build 377) v99.0.377 2024-12-24 22:50:36 -05:00
jacob1
64af43eccd
Build number 375 -> 376 (new beta) v99.0.376b 2024-12-22 23:36:20 -05:00
jacob1
8b2d354043
Turn Separate Rendering Thread on by default 2024-12-22 23:26:18 -05:00
Tamás Bálint Misius
5103db8288
Update tpt-libs
This fixes upload issues (mainly on windows, though I've found no reason why it wouldn't manifest elsewhere also) and enables querying display refresh rate when using xorg.
2024-12-22 20:55:39 +01:00
Tamás Bálint Misius
2286440b46
Update refresh rate when the window is moved to another display 2024-12-21 23:55:50 +01:00
Tamás Bálint Misius
5ff963a40d
Add debug levels for simulation and rendering info 2024-12-21 11:52:10 +01:00
Tamás Bálint Misius
86fd919699
Add draw limit variant that mirrors the display's refresh rate 2024-12-21 11:52:10 +01:00
Tamás Bálint Misius
3b70324b78
Fix draw cap math
Floating point nonsense made the common case of draw cap = fps cap sometimes skip frames. This commit essentially duplicates the tick scheduling logic over to draw scheduling, with the exception that the draw schedule's "how much time to sleep" output goes nowhere; instead, we explicitly check whether we should be drawing a frame every tick.
2024-12-21 11:52:10 +01:00
Tamás Bálint Misius
c645269c86
Only copy the live portion of parts when SRT is enabled
One major downside of SRT is that a RenderableSimulation has to be copied between the main thread and the rendering thread, which may actually take more time than to render on the main thread. This commit reduces the impact of this copy by copying only the subset of RenderableSimulation::parts that actually matters.
2024-12-21 11:52:10 +01:00
Tamás Bálint Misius
2f2d24b838
Add a config option for standard stream redirection to log files
Equivalent to the redirect command line option.
2024-12-19 22:41:56 +01:00
Tamás Bálint Misius
f580a0b9d4
Fix gravity wall being intermittently broken when drawn while paused
In fact, even when it was drawn while unpaused, there would be two different gravity masks being swapped between, and only one of them was what the user wanted. However, there wasn't as much difference between them, because one was just one frame more out of date than the other, so this was hard to notice.

Broken since 6b5bbb177dd5, where I forgot that the gravity mask exists at all. The gravity mass input is thrown away every frame in Simulation, and so that commit applies to it well, but the gravity mask isn't.
2024-12-19 12:53:51 +01:00
Tamás Bálint Misius
a01a075551
Fix the "fake" newer version number being actually older 2024-12-18 19:26:57 +01:00
JJ Marr
7394a1c081
Add clang-tidy support and fix modernize-use-nullptr (#966)
C++11 standardizes the "nullptr" keyword, which replaces the
implementation-defined macro null pointer "NULL" or a hardcoded 0.

---------

Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
2024-12-18 18:11:06 +00:00
jacob1
0506bc4f89
Update version numbers (99.0) and readme v99.0.375b 2024-12-17 16:43:46 -05:00
Tamás Bálint Misius
7de0bb8506
Fix some warnings 2024-12-17 20:39:51 +01:00
Project_HSI
6762744afa
Untemplate RGB(A) (fixes #968) (#969)
We were never going to use any instance other than the uint8_t ones anyway.
2024-12-17 19:18:18 +00:00
Tamás Bálint Misius
1ef78c019a
Migrate embedded files to custom targets
Meson generators seem to be a dying feature, evidenced by the fact that they have been in a state of isolation from the rest of the language for several years at this point:

 - very few things accept generator outputs as inputs, not even generators themselves do
 - unlike configured files, their outputs aren't guaranteed to be always synthesized, and yet they can't be passed as dependencies to other targets
 - they accept strictly one input and can't depend on other files

This makes them really hard to work with in a context that would require either a project resource or a target. Custom targets don't have any of these shortcomings, so this commit migrates embedded files over to those. A real shame, considering that generators can be used anywhere and are generally less messy than custom targets.
2024-12-17 16:15:27 +01:00
Tamás Bálint Misius
c62f105c85
Propagate python3 program to the android build's meson config
This should have been done in 9a785dc3890c.
2024-12-17 14:33:17 +01:00
jacob1
653d43699e
Fixes to scrollbar mouse tracking
Click inside the scroll panel area would sometimes scroll even if you weren't clicking the scrollbar
2024-12-16 22:42:47 -05:00
jacob1
57593fb212
Add credits UI
Lists all GitHub contributors and moderators, alongside the original credits (which were moved from the intro text to here)

The UI itself is controlled with credits.json. This can be regenerated with resources/gencredits.py.
2024-12-16 22:42:41 -05:00
Tamás Bálint Misius
9fa0fc45bc
Use std::span where possible without much effort 2024-12-16 17:11:50 +01:00
Tamás Bálint Misius
5739170f20
Fix oversize thumbnails
Broken since f52e04703731, where Renderer::DumpFrame was removed in favour of constructing VideoBuffers directly from pixel data, but Renderer::video's exact width wasn't taken into account. This was chosen to be WINDOW.X, rather than the intuitive RES.X, in order to enable blitting the sim framebuffer onto the window framebuffer with a single memcpy.
2024-12-16 16:22:21 +01:00
Tamás Bálint Misius
43c92f5c8f
Fix NUM_PARTS being wrong almost all the time
This was really annoying to deal with on the Lua side.
2024-12-14 22:00:40 +01:00
ChromicQuanta
049d5d8b37
Make BGLA PROP_DEADLY (#964) 2024-12-13 23:55:41 -05:00
jm211
68a8b055e3
STOR can absorb radiation particles (#978) 2024-12-13 23:55:23 -05:00
jm211
f3c73c8658
Fire and Plsm create wtrv, not dstw (#979) 2024-12-13 23:55:06 -05:00
jm211
0ad91f74f2
VIBR explosion bound fixing (#980) 2024-12-13 23:49:16 -05:00
jacob1
6e43882a0e
Prevent creating two tools with the same identifier in tools.allocate 2024-12-12 23:56:25 -05:00
Tamás Bálint Misius
3e2fc0b31f
Snapshot 374 snapshot-374 2024-12-12 17:30:03 +01:00
Tamás Bálint Misius
0ee442e0b8
Fix crash when navigating away from a save while voting on it
By tying the lifetimes of the vote request and the queued vote to the online save info. Broken since c73fa1bcdde3, where the vote request was made non-blocking. TODO: Let the user know that their vote may not have gone through if the vote request gets destroyed abnormally.
2024-12-12 15:37:38 +01:00
Tamás Bálint Misius
76dca483e9
Fix unnatural stacking near powers of 2 positions
Displacing the swapped-out particle by the difference between the integer positions (derived from the float position via rounding) of the particles would sometimes cause the floats in Particle to switch to a lower precision range, and this would overflow them such that the integer position would change by an amount different from what was intended (exactly the difference between the integer positions of the particles). Such switches between precision ranges can only happen when a sufficiently big positive number is added to a positive float near the positive end of its current precision range. Swapping displacements are usually small, so this problem mostly manifested near the positive end of precision ranges, that is, near powers of 2.

Informally, for illustrative purposes, consider the float position (either x or y, doesn't matter) 511.49995, fairly close to the positive end of the precision range [256, 512), and the swap displacement +1: these yield the position 512.49995. Assume that this is not be representable, and that the two nearest representable values are 512.4998 and 512.5. 512.49995 is closer to 512.5, so that's what it gets rounded to. But oops, 511 = round(511.49995) + 1 != round(512.5) = 513, so we're now overwriting the wrong pmap entry.

Reproduce with

	sim.paused(true)
	sim.clearSim()
	local brmt = sim.partCreate(-1, 128, 100, elem.DEFAULT_PT_BRMT)
	local dust = sim.partCreate(-1, 127, 101, elem.DEFAULT_PT_DUST)
	sim.createBox(125, 98, 130, 103, elem.DEFAULT_PT_DMND)
	sim.partProperty(dust, "x", 127.49999)
	sim.frameRender(2)

The BRMT and the DUST should swap places; instead, without the fix, the DUST gets stacked under a DMND.

This commit fixes this problem by moving the swapped-out particle exactly where the moving particle is.
2024-12-12 13:10:00 +01:00
Tamás Bálint Misius
5540517368
Make properties and callbacks of non-custom tools read-only
Non-custom here means any built-in tool but also the ElementTool associated with elements, including custom ones. So, describing the tools this commit affects as "built-in tools" wouldn't quite be correct. It was even possible to cause crashes by freeing such tools.

Also fix crashes when attempting to access non-custom tools as if they were custom tools. The incorrect assumption was that GameModel::GetToolIndex succeeding means that LuaScriptInterface::customTools has an entry for the tool, but this is only guaranteed for custom tools.
2024-12-09 21:46:05 +01:00
Tamás Bálint Misius
860ba13899
Fix crash on windows when using invalid particle/element property values
See the comment in meson.build. Reproduce with

	elem.property(elem.DEFAULT_PT_DMND, "Enabled", false)
2024-12-09 20:43:50 +01:00
Tamás Bálint Misius
9233b0036f
Only use custom LTO flags when we actually want LTO
This considerably speeds up linking of release binaries with msvc when testing locally, when LTO is of no concern.

Also properly override b_lto and b_vscrt in all cases for all targets, never leaving them to take default values.
2024-12-09 17:55:11 +01:00
Tamás Bálint Misius
a85bee5578
Fix gravity staying broken when pasted over by unrelated data
Gravity has been possible to save since 7e9d9686dda4, but the gravity process's definition of when there is work to be done wasn't adjusted accordingly. Thus, when the user manually changed the gravity force (the output of the gravity process) by e.g. pasting over it, it would stay, not quite broken, but very much out of place.
2024-12-09 16:47:36 +01:00
Tamás Bálint Misius
fb7ae9fc63
Only dispatch the gravity thread if there is work to be done
The definition of when there is work to be done is more or less "when the input to the gravity process has changed"; this is about to be extended to cover some other situations by the next commit.
2024-12-09 16:47:25 +01:00
Tamás Bálint Misius
6b5bbb177d
Stop copying the gravity process's input every frame
In the vast majority of cases (i.e. when Gravity::Exchange is indirectly called from BeforeSim), the input is cleared to zeros anyway, so it's less work in Exchange to actually just exchange the old input with the new one than to copy the new one into the old one.

Also make gravity functions private in Simulation.
2024-12-09 16:35:01 +01:00
Tamás Bálint Misius
a65338beea
Fix occasional hang on exit when SRT is enabled
Aka episode 29743 of game mvc being a joke: Happens since 74386631e0b6, where GameModel started being destroyed after GameView. The problem is that GameModel assumes that GameView is still alive and tells it to stop rendering the simulation on another thread, and expects it to acknowledge this request.
2024-12-07 14:27:34 +01:00
Tamás Bálint Misius
5454ef892d
Fix crashes when giving !set invalid property values
This fixes two kinds of crashes: the one where the value passed is not possible to convert at all to the type of value expected (e.g. expect unsigned integer, get point), and also when it is possible, because the difference is only in signedness (e.g. expect unsigned integer, get signed integer). Both cases crash since 8552aafbceb7, where the handling of the former case got removed and accidentally never got added back, and the handling of the latter changed from converting everything to strings and working from there to converting directly between floats and numbers, disregarding signedness.
2024-12-07 00:10:33 +01:00
Tamás Bálint Misius
639504ab23
Make global quit shortcut optional
Some people prefer to use the window manager to close windows.
2024-12-04 23:27:26 +01:00
Tamás Bálint Misius
5e20edeb9e
Don't complain about missing elements that aren't actually used
We would complain about them indiscriminately, see 36800a76cd97.
2024-12-02 18:38:26 +01:00
jacob1
75d33adbde
CRMC low pressure - preserve .temp when breaking 2024-11-23 11:23:36 -05:00
jacob1
32033af67c
Fix EMP radius when damaging things around SPRK 2024-11-20 21:25:45 -05:00
Tamás Bálint Misius
74386631e0
Fix crash on exit while there are Lua windows visible
Broken since 02b679aec37f, where GameView started popping everything above itself before popping itself. The problem was that LSI would get destroyed before GameView did this, but popping Lua windows needed LSI to be alive still.
2024-11-20 21:33:54 +01:00
Tamás Bálint Misius
b448622921
Fix crash when a Lua tool Perform callback throws an error
Broken since 00ec4e0754d1, when the Perform callback was added. It's a bad idea to pop return values that never got pushed because the function that was supposed to push them threw an error.
2024-11-20 21:33:54 +01:00
Tamás Bálint Misius
0c74c8080d
Make LuaSmartRef properly non-copyable
Broken since 06e28367266e, which added LuaSmartRef. That it had absolutely not followed the rule of five at all didn't use to be a problem because it had only ever been in vectors that got resized only once throughout the lifetime of the program >_>
2024-11-20 21:33:14 +01:00
Tamás Bálint Misius
afb9fa7df2
Add Select callback to Lua tools
This is intended to support selection-time configuration the way PROP and the custom life tools do it. Indeed, they now use the infrastructure this commit adds to implement their own configuration actions.
2024-11-20 19:02:35 +01:00