Commit Graph

3453 Commits

Author SHA1 Message Date
Tamás Bálint Misius
f94b436cbc
Use mbedtls on windows 2023-10-03 18:25:34 +02:00
Saveliy Skresanov
78bc86d107 Add ctype mechanics. 2023-10-02 22:41:22 +07:00
Saveliy Skresanov
b000abcdd8 Add reactions of resist with other elements. 2023-10-01 21:00:53 +07:00
Tamás Bálint Misius
5584acd189
Add version info to bluescreen 2023-09-30 22:15:38 +02:00
Saveliy Skresanov
93cbb065dd Add liquid resist (RSST) and solid resist (RSSS). 2023-09-30 20:05:29 +07:00
Tamás Bálint Misius
146fb4b549
Sample "into" the PROP tool when it is active
That is, if the PROP tool is active and is configured correctly, instead of sampling a type and activating the corresponding ElementTool, sample whichever property has been configured in the PROP tool and put the result back into the PROP tool.
2023-09-29 23:00:35 +02:00
jacob1
d1a4c6ad85
Fix custom can_move settings being reset after using tpt.el 2023-09-25 20:16:07 -04:00
Tamás Bálint Misius
ef04068a85
Make find mode work with the PROP tool 2023-09-20 07:16:28 +02:00
Tamás Bálint Misius
ca6558bd5d
Fix FUSE not burning as fiercely as meant to
Broken in 49703404be.

Also fix .chance's parameter names.
2023-09-16 21:41:07 +02:00
Tamás Bálint Misius
70e6f4e241
Fix fs.makeDirectory negating its result 2023-09-16 07:22:04 +02:00
Tamás Bálint Misius
b99914bac5
Fix crash from Lua prompts when exiting the game completely
The problem is that Engine outlives GameController and thus also LuaScriptInterface. The solution is to not try to access LSI's lua_State if it doesn't exist; this is the case in Engine's dtor.

This is ugly as hell and the root of the problem is the cursed ownership model of LuaComponents and Windows by Engine, which I don't think I'll be fixing any time soon.
2023-09-14 19:58:59 +02:00
Tamás Bálint Misius
a2c82444aa
Fix local browser sometimes failing to load saves
Namely when they have been scrolled past already so they have been unloaded to save memory.
2023-09-12 19:28:11 +02:00
Tamás Bálint Misius
fcba9f1f2e
Fix RenderView not drawing any simulation content
This used to work without the explicit copy because Graphics and Renderer used to share backing buffers.
2023-09-12 19:00:38 +02:00
Tamás Bálint Misius
440dc68b5e
Fix PMODE_SPARK producing black spots
PMODE_SPARK does weird colour ops with alpha values larger than 255, so of course it looks odd with the new code that expects alpha to be at most 255. The solution is to do the work on the spot.

Other effects may also be affected by this new assumption.
2023-09-12 18:41:44 +02:00
Tamás Bálint Misius
d2d1fd902f
Fix crash upon changing tpt.brushID
This was because brushes are not in an initialized state by default, SetRadius needs to be called on them before they can be used. This is ensured elsewhere but had not been ensured on this code path.

This is hilariously bad design and needs to be fixed sometime.
2023-09-10 11:32:32 +02:00
Tamás Bálint Misius
28d86d2859
Unify InBounds implementations 2023-09-07 22:40:01 +02:00
Tamás Bálint Misius
1b1ef99194
Move callback parameter of ui.begin* functions up
See 4f31f85b6b. This is better because the need to pad partial parameter lists with nils is avoided.
2023-09-07 21:29:44 +02:00
Tamás Bálint Misius
59b79e805f
Make ui.beginInput return nil if cancelled 2023-09-07 20:56:46 +02:00
Tamás Bálint Misius
77071c524e
Fix rendering of fire effects when their intensity exceeds 1.0f
This had been overlooked for a long time because intensity defaults to 1.0f and is seldom changed. The underlying issue is that an intensity value higher than 1.0f produces fire_alpha values above 255, which the new graphics code doesn't deal with properly. That said, that code works fine for every other case, so the solution is to add a special case for when fire_alpha is used.
2023-09-07 16:03:44 +02:00
Tamás Bálint Misius
2dc468bcd1
Add tpt.version.vcstag
Which is by default only enabled for static release builds.
2023-09-05 20:20:00 +02:00
Tamás Bálint Misius
3e4fed02d4
Make PROP tool less annoying to use
By refusing to exit unless the property being set is correct, rather than throwing an error when it's not and exiting anyway. It's still possible to cancel changing the current setting by exiting with Esc.
2023-09-05 09:28:05 +02:00
Tamás Bálint Misius
6a64de8297
Fix LuaScriptInterface ctor stack imbalance 2023-09-02 13:32:39 +02:00
Tamás Bálint Misius
52a4917624
Remove BOUNDS_CHECK
It didn't do anything anyway, see 10e104f3f5.

Also fix some C89-isms.
2023-09-02 12:11:24 +02:00
jacob1
46730cfc26
Fix bad 0C constant in GLOW.cpp 2023-08-31 13:03:25 -04:00
Tamás Bálint Misius
345c432767
Clean up tool ID list too
Same idea as in c188837fec.
2023-08-31 15:40:04 +02:00
Tamás Bálint Misius
c188837fec
Delete E146
This was an unused and by default disabled element that did nothing even when enabled. 146 used to be the element ID allocated to some legacy GOL variant that I cannot be bothered to look into, and the element itself existed in this vegetative state for years to ensure some sort of compatibility that I found no trace of or reason for.

Also make the element list friendlier, both for humans and for git. The list held consecutive integers starting from 0, so it was ripe for factoring. Element ID's are skipped if the name that they would normally belong to is not a string but rather a disabler(), the closest thing to a null/nil/none value in meson.
2023-08-31 15:05:15 +02:00
Tamás Bálint Misius
2539c3eff5
Emscripten: Make default FPS limit 60 2023-08-31 08:24:00 +02:00
Tamás Bálint Misius
3388094110
Fix failing to change the favourite status of a save crashing the game
I have no idea where the code that used to handle PreviewModelException went but it's pointless anyway; out the window it goes.
2023-08-29 17:10:18 +02:00
Tamás Bálint Misius
9ea09d129d
Enter stamp placement mode when dnd'ing a stamp
That is, an .stm file. Do this rather than open it as a save, as is done with .cps files.
2023-08-29 15:17:43 +02:00
Tamás Bálint Misius
f0a447bcd5
Fix empty stamp browser crashing upon an attempt to change pages 2023-08-28 20:27:38 +02:00
Tamás Bálint Misius
98cf5b302d
Emscripten: Immediately mark presentable if no url is specified
Also log failed requests.
2023-08-23 15:33:16 +02:00
Tamás Bálint Misius
7365d7e11c
Emscripten: Add Platform::MarkPresentable
So the website knows when to swap the thumbnail with the canvas of the TPT instance
2023-08-23 00:42:34 +02:00
Tamás Bálint Misius
6ceb51b408
Handle ptsave urls with GameController 2023-08-22 23:51:17 +02:00
Tamás Bálint Misius
3ab697d05f
More boolean.to_string() fixes in meson.builds 2023-08-22 00:26:34 +02:00
Tamás Bálint Misius
bbefc9970f
Rename tpt.getscript and give it a completion callback
Also reinstate the confirm prompt. Effectively a continuation of b972fe46d2e4.
2023-08-22 00:26:34 +02:00
Tamás Bálint Misius
7cb0ac96c9
Emscripten: Enable modularity
This allows multiple instances of the game to be loaded in a single page.

Also stop emitting htmls as a build artifact and require presence of #PowderSessionInfo.
2023-08-22 00:26:34 +02:00
Tamás Bálint Misius
25b15208cf
Emscripten: Disable a few options
Namely broken window frame options and pointless data folder options.
2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
3d4ce09a80
Emscripten: Fix a crash from SDL2 by disabling asserts
Clearly not ideal.
2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
dca5e25b3b
Implement vsync fps limit outside emscripten 2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
bfe7d765c4
Emscripten: Disable hopefully all ways to quit
Also fix FPS going nuts when recreating the window by setting it again every time.
2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
845e195ba5
Emscripten: Sync session with the website one
Also fix a cursed length-related problem with passing strings from JS to C++.
2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
f7bca3b1b1
Emscripten: Attempt to scroll canvas into view 2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
cfd2baa064
Emscripten: Fix dead requests having their status updated 2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
648bc08377
Emscripten: Implement more CRT stuff
Namely:

 - Platform::OpenURI
 - Platform::DoRestart
 - Platform::ExecutableName
2023-08-22 00:26:33 +02:00
Tamás Bálint Misius
fd50f2dc9a
Emscripten: Use custom user agent 2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
58229f49b2
Emscripten: Support persistent storage 2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
82bd834e05
Emscripten: Add RequestManager 2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
a860cbeabf
Use name-value pairs for HTTP post data and headers
And fuse them only if needed (e.g. in Libcurl.cpp). Also finally stop specifying the filename for a form item with the : separator hack.
2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
5c816fe1ee
Emscripten: Cosmetics 2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
c725894abd
Emscripten: Add "vsync" FPS limit mode
Would be really useful for native versions too, but it's more complicated to pull off. For now, vsync on native is the same as tpt.setfpscap(2).
2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
9f71eb9d77
Emscripten: Add compatible main loop 2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
bef2fb01d0
Emscripten: Pivot EngineProcess
... such that it ends with a sleep and delegates looping to its caller.
2023-08-22 00:26:32 +02:00
Tamás Bálint Misius
1094cc9dc9
Emscripten: Remove blocking prompt functions 2023-08-22 00:26:31 +02:00
Tamás Bálint Misius
96dea30480
Emscripten: Remove all other blocking prompt calls 2023-08-22 00:26:31 +02:00
Tamás Bálint Misius
4f31f85b6b
Emscripten: Remove direct blocking prompt calls from Lua
Notable changes:

 - tpt.{input,throw_error,message_box,confirm} have been superseded by ui.begin{Input,ThrowError,MessageBox,Confirm}, each with an extra callback argument and no blocking behaviour, but otherwise the same semantics as their predecessors.
 - The "script not responding" error doesn't wait for user confirmation anymore, it fires without asking. Future exercise: maybe let the user configure the timeout.
 - Remove the confirmPrompt argument of tpt.getscript; this also means it unconditionally fails if the destination file exists.
2023-08-22 00:26:31 +02:00
Tamás Bálint Misius
67e41b6705
Emscripten: Add target, update tpt-libs
The code itself is nowhere near being usable in a browser though.
2023-08-22 00:26:31 +02:00
jacob1
7bb2eb9d4d
Update streamline description so that it's more helpful and matches intended description from dd8902b2c33c 2023-08-20 00:29:04 -04:00
Tamás Bálint Misius
98b42d9e71
Prefer luajit's bit module over ours 2023-08-08 08:11:00 +02:00
jacob1
8855a26667
Kill stickman/figh immediately if health goes below zero, fixes #929 2023-08-07 21:39:18 -04:00
Tamás Bálint Misius
2c56adde5a
Work around some input method bug on windows
At least this fixes Hangul input for me. I'm sure nobody else had any problems with it and I'm sure everyone will start having problems with it now :)
2023-08-01 18:41:34 +02:00
Tamás Bálint Misius
a5e179e530
Fix some signed integer UB in RNG and related code 2023-07-20 21:38:30 +02:00
Tamás Bálint Misius
26a17c4e1f
Fix crash in math.random if a max size interval is specified 2023-07-20 21:33:43 +02:00
Tamás Bálint Misius
53d573ad3c
Fix crash if a save thumbnail is missing from the server
Which basically never happens. Except when the server runs out of space :) See 0f418ec195 for a similar fix.
2023-07-19 11:06:13 +02:00
Tamás Bálint Misius
2c04cf510a
Fix sim.neighbours yielding the center particle
The wiki says it shouldn't. Broken in 6a6b14f871.
2023-07-01 16:13:06 +02:00
Tamás Bálint Misius
90004242d6
Fix crash when overwriting a local save 2023-06-24 07:13:43 +02:00
Tamás Bálint Misius
5b708219c0
Fix logouts not actually destroying sessions 2023-06-23 22:00:54 +02:00
Tamás Bálint Misius
56004348c3
Fix negative-size rects being returned by Rect::operator &
Which make some sense in theory but they're prone to mishandling on usage sites, such as RasterDrawMethodsImpl.h:171.
2023-06-22 21:39:09 +02:00
Tamás Bálint Misius
2bc2acc00e
Fix ExecVoteRequest sending AuthHeaders multiple times
Doesn't seem to affect libcurl, somehow.
2023-06-18 20:47:57 +02:00
Tamás Bálint Misius
0f418ec195
Fix crash if an avatar is missing from the server
Which basically never happens.
2023-06-18 15:37:32 +02:00
Tamás Bálint Misius
5b610f0b0e
Make OptionsView somewhat more manageable 2023-06-11 21:04:24 +02:00
Tamás Bálint Misius
958ab1df96
Make Grave (the key under Esc) exiting the console optional
Also fix perfectCirclePressure copypasta.
2023-06-11 20:09:01 +02:00
Tamás Bálint Misius
d296cf5d77
Enable SECURE_CIPHERS_ONLY with mbedTLS 2023-06-11 20:09:00 +02:00
Tamás Bálint Misius
ced2700c34
Wire up SECURE_CIPHERS_ONLY
This has been in the codebase for ages but apparently never enabled or wired up at all. Defaults to false for now.
2023-06-11 20:09:00 +02:00
Tamás Bálint Misius
0b0f40ec94
Eliminate a GameSave copy in Simulation::Load 2023-06-11 20:09:00 +02:00
Tamás Bálint Misius
f805b15ee5
Don't show a blue screen when the window is already closing 2023-06-11 20:09:00 +02:00
Tamás Bálint Misius
04455ada1c
Use clip rects to draw progress bar content 2023-06-11 20:09:00 +02:00
Tamás Bálint Misius
5e15d02eb8
Stop using 32-bit time in SaveInfo 2023-06-11 20:08:58 +02:00
Tamás Bálint Misius
daabe6a116
Use unique_ptr to hold on to SDL_GetPrefPath's result 2023-06-11 07:22:04 +02:00
Tamás Bálint Misius
3991bb0906
Complain on windows if the active code page is not UTF-8
See 18084d5aa0, where we enable requesting this on startup but it may fail on older versions of windows.
2023-06-11 07:13:03 +02:00
Tamás Bálint Misius
ced60439ae
Fix mingw builds
My local mingw handled the previous commit fine, it's just the ghactions 8.1.0 one that didn't. We should update to windows-2022 which brings 11.2.0.
2023-06-10 19:52:55 +02:00
Tamás Bálint Misius
c73fa1bcdd
Prevent almost all HTTP requests from blocking
The ones that remain blocking are the ones that run on different threads; see Task, yet another big mess to clean up.
2023-06-10 19:19:53 +02:00
Tamás Bálint Misius
c2f8a7df25
Fix crash on exit when multiple windows are open
Controllers would delete their Views even if they failed to pop them from the window stack.

Have I mentioned that I really hate our MVC?
2023-06-10 18:56:05 +02:00
Tamás Bálint Misius
eea0c54a36
Fix pastes not being centred on the cursor
This commit hopefully concludes hammering at old pasting code.
2023-06-08 12:21:23 +02:00
Tamás Bálint Misius
6fb893a8de
Fix random particles disappearing when pasting
Because apparently GameSaves can have type = 0 particles.

Also possibly fix other odd phenomena. Background: I moved all spawnability checks to the previous loop over particles in 2e2c3181b5 and removed all of them from this loop. It turns out that I should have at least left the type == 0 check alone, because that's what ultimately prevented particles from being added to the simulation.
2023-06-02 09:16:41 +02:00
Tamás Bálint Misius
28a701a756
Enable out of bounds pasting in GameView 2023-06-02 08:10:57 +02:00
Tamás Bálint Misius
a205612802
Fix crash upon an out of bounds Simulation::Load
Also fix out of bounds signs being allowed to load and a potential out of bounds operator[] on Sign::text.
2023-06-02 07:06:40 +02:00
Tamás Bálint Misius
1a69bbfb51
Add hflip and rotation parameters to sim.loadStamp 2023-06-02 06:44:23 +02:00
Tamás Bálint Misius
7b894a693e
Get rid of pointless virtual dtors in Request derivatives 2023-05-30 15:32:42 +02:00
Tamás Bálint Misius
0cc179ae4e
Factor RequestManager threading into Libcurl impl
Because that's the only impl that needs it and is likely to ever need it. I hope I don't have to factor it back out for Android.
2023-05-30 15:32:42 +02:00
Tamás Bálint Misius
7cd88a094c
Enable non-multipart POST requests 2023-05-30 15:32:41 +02:00
Tamás Bálint Misius
6179071351
Pass particle coordinates to Simulation::Save
Both Save and Load were recently migrated to block coordinates, see 7ef02a6c0b. The expected behaviour for Save is to extend the particle-oriented rect it gets to the smallest enclosing block-oriented rect and save all blocks inside that rect, but exclude the particles that fall outside the original rect. Using block coordinates made this exclusion impossible.
2023-05-30 15:18:54 +02:00
Tamás Bálint Misius
9884b4108e
Tame variable scopes in Air.cpp 2023-05-28 00:17:58 +02:00
JasonS05
86fb18aa08
Fix some air simulation asymmetries (#897) 2023-05-28 00:14:46 +02:00
Tamás Bálint Misius
f23a3dd2f8
Fix unknown HTTP response body size being reported as 0 in some cases
Namely, when libcurl dies or when progress is checked before the request is started, although this should never happen.
2023-05-27 20:22:13 +02:00
Tamás Bálint Misius
16e1ca74f2
Mark Platform::WinNarrow/WinWiden as to-be-eventually-deprecated 2023-05-27 20:07:52 +02:00
Tamás Bálint Misius
920f7646e4
Fix more reflection issues
Since b393050e55, surface normals were calculated incorrectly because blocking cells were detected as blocking only if they were within the heading of the scout process (see that commit for terminology). This had been true even before that commit but it had had less visible effects because both processes would traverse their neighbours in the same order, which the initial heading approximation code (direction_to_map, removed in this commit) had worked better with.

This commit fixes this by separating information about blocking entirely from information about current heading, as it should be. This fixes a few prism-type saves such as id:1188302, but is also not entirely backwards-compatible, for all saves that are considered broken as far as normal calculation code is concerned (e.g. the surfaces are not long enough or are wobbly) will now be broken differently from before. This affects for example many coalescing laser-type saves such as id:482187 that rely on very specific arrangements of very few particles of reflective material behaving as perfect 45deg mirrors.
2023-05-17 17:21:41 +02:00
Tamás Bálint Misius
c0a2370c77
Fix paste previews being positioned incorrectly
Recent changes made to multiple instances of paste placement code caused inconsistencies between what paste previews suggested would happen and what actually happened during pasting. Relevant code factored out.
2023-05-14 20:44:13 +02:00
Tamás Bálint Misius
18084d5aa0
Request UTF-8 code page at startup on windows
This makes the *A Win32 API variants work correctly with UTF-8 parameters, which is nice because standard C/C++ facilities use those (because microsoft's libc is a steaming pile of microsoft code). OF COURSE this only works on win10 1903 and above. See https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
2023-05-13 14:54:50 +02:00
Tamás Bálint Misius
7ef02a6c0b
Remove return value from Simulation::Load
Not useful anymore, it can only fail if the GameSave passed in is nullptr, which this commit guards against.

Also make Simulation::Load and Simulation::Save take block-oriented positions and rects.
2023-05-13 13:21:05 +02:00
Tamás Bálint Misius
ee87f0a0a7
Fix vote bars in previews touching the enclosing rects 2023-05-13 13:21:05 +02:00
Tamás Bálint Misius
a9d231587c
Show save button thumbnail in the preview if it's available
This is good enough for now but also more limited than I'd like because if the thumbnail arrives (gets rendered or downloaded) later than the preview is opened, it's never shown.
2023-05-13 13:21:05 +02:00
Tamás Bálint Misius
843f414291
Fix scary mutant spiders (many-headed stickmen)
They would sometimes show up in intentionally or otherwise corrupted saves.
2023-05-13 13:20:58 +02:00
Tamás Bálint Misius
d8acdfb576
Fix various warnings that had piled up 2023-05-12 19:25:41 +02:00
Tamás Bálint Misius
9bd8bd2274
Fix some deprecation warnings
Namely:

 - [[deprecated("Use Mat2")]]
 - [[deprecated("Use Vec2")]]
 - [[deprecated("Use Mat2::operator*(Vec2)")]]
 - [[deprecated("Use Vec2<float>::operator*(float)")]]
 - [[deprecated("Use Vec2::operator+")]]
 - [[deprecated("Use Vec2::operator-")]]
 - [[deprecated("Use Vec2::Zero")]]
 - [[deprecated("Use Mat2::Identity")]]
2023-05-12 18:53:48 +02:00
Tamás Bálint Misius
c8bc8a7285
Fix some deprecation warnings (#920)
Namely:

 - [[deprecated("Use PlaneAdapter<std::vector>")]]
 - [[deprecated("Use operator[](Vec2)")]]
2023-05-12 09:00:06 +02:00
Tamás Bálint Misius
0f95ce82f8
Sanitize GameSave/SaveInfo/SaveFile ownership 2023-05-11 12:40:23 +02:00
Tamás Bálint Misius
5c5354655c
Fix progress bars drawing their borders in the wrong place
Same problem as with textboxes solved in 3eb3481fda.
2023-05-09 22:54:57 +02:00
Tamás Bálint Misius
0e3968af0b
Add fs.isLink 2023-05-09 22:31:12 +02:00
mniip
65cf8021c9 Reorganize the constructors of non-owning PlaneAdapter 2023-05-04 19:41:47 +02:00
Victoria Hoyle
29655db976
Update IntroText.h
Name change here as well
2023-05-03 23:34:53 -04:00
Tamás Bálint Misius
3eb3481fda
Fix local save browser crashing in some cases
This also fixes local save thumbnails being resized such that they are just short of filling the space they are supposed to.

Also fix textboxes drawing their borders in the wrong place.
2023-05-01 22:32:31 +02:00
Tamás Bálint Misius
60a7ce1aae
Use _rgb literals where possible 2023-04-30 14:22:56 +02:00
Tamás Bálint Misius
410dc71f42
Fix some deprecation warnings
Namely:

 - [[deprecated("Use DrawPixel/BlendPixel")]]
 - [[deprecated("Use DrawLine/BlendLine")]]
 - [[deprecated("Use DrawRect/BlendRect")]]
 - [[deprecated("Use DrawFilledRect/BlendFilledRect")]]
2023-04-30 14:06:54 +02:00
Tamás Bálint Misius
9fbb780728
Fix some deprecation warnings
Namely:

 - [[deprecated("Use BlendChar")]]
 - [[deprecated("Use AddChar")]]
 - [[deprecated("Use XorPixel")]]
 - [[deprecated("Use AddPixel")]]
 - [[deprecated("Use XorLine")]]
 - [[deprecated("Use XorDottedRect")]]
 - [[deprecated("Use XorImage")]]
 - [[deprecated("Use BlendEllipse")]]
 - [[deprecated("Use BlendFilledEllipse")]]
 - [[deprecated("Use DrawFilledRect (beware off by 1)")]]
2023-04-30 11:27:58 +02:00
Tamás Bálint Misius
f5cbc30d85
Fix some deprecation warnings
Namely:

 - [[deprecated("Use BlendTextOutline")]]
 - [[deprecated("Use BlendText")]]
 - [[deprecated("Use BlendImage")]]
 - [[deprecated("Use BlendImage")]]
 - [[deprecated("Use TextSize().X - 1 (yes this is very bad code eww)")]]
2023-04-29 15:50:34 +02:00
Tamás Bálint Misius
2960e0f58f
Fix some deprecation warnings
Namely:

 - [[deprecated("Use operator+(Vec2)")]]
 - [[deprecated("Use operator-(Vec2)")]]
 - [[deprecated("Use video")]]
 - [[deprecated("Use persistentVideo")]]
 - [[deprecated("Use wrapVideo")]]
2023-04-29 14:44:27 +02:00
Tamás Bálint Misius
8f10210c77
Fix various unintended layout changes since 97.0
Also fix a few unused variable warnings.
2023-04-29 13:18:32 +02:00
jacob1
ad1420152c
Fix delete key not functioning correctly in textboxes when text is selected 2023-04-25 00:30:07 -04:00
jacob1
8b7a96b5ef
Fix RIME's description (it is formed through deposition, not sublimation) 2023-04-23 22:52:29 -04:00
catsoften
8d88394e38 Add RGBA.Pack(), Simplify ui::Colour/RGBA conversions 2023-04-16 22:13:39 +02:00
catsoften
561fc17431 Simplify conversion from temperature to color in OptionsView 2023-04-16 22:13:39 +02:00
catsoften
a715f5d71a Use RGB for constants and gradients, other misc changes 2023-04-16 22:13:39 +02:00
catsoften
bc085705a8 Remove deprecated PIXPACK/RGB/R/G/B functions 2023-04-16 22:13:39 +02:00
Tamás Bálint Misius
5fc8770ee2
Fix pmap usage in Simulation::flood_water
flood_water would occasionally corrupt pmap by moving the pmap entry at i's location even if the entry itself didn't refer to i. pmap updates are tricky, they are best handled by Simulation::move.
2023-04-16 11:05:42 +02:00
Tamás Bálint Misius
54d08f3496
Protect new math.random against division by 0 2023-04-15 23:22:20 +02:00
Tamás Bálint Misius
34e4d90dac
Properly seed rng at load time for saves that don't carry rng state
Also save rngState as a user object rather than two separate i64s.
2023-04-15 23:04:58 +02:00
Tamás Bálint Misius
a8604ef579
Add ensureDeterminism to saves 2023-04-15 22:19:54 +02:00
Tamás Bálint Misius
9c3b966c18
Expose new features to Lua
math.random now uses our rngs. In most cases, this means the interface rng, but it means the sim rng during simulation events.
2023-04-15 22:19:54 +02:00
Tamás Bálint Misius
0b82796ba4
Add Simulation::frameCount, save blockair/blockairh and rng state
Saving blockair/blockairh is nice because RecalculateBlockAirMaps uses the sim rng, which means the sim rng would get advanced in Simulation::Load. Also rename RecalculateBlockAirMaps to ApproximateBlockAirMaps because that's what it is, an approximation, and it's needed only if there are no block air maps in the save.

Simulation::frameCount keeps track of frames elapsed since the beginning of the simulation, zeroed at clear_sim. It overflows when it reaches the 64-bit limit, which means anything that depends on it should either handle this, or not fail catastrophically. sandcolour (the only thing that depends on it as of now) is a good example of the latter: sandcolour has a periodicity of 360 frames, which means that there is one sandcolour period that is cut short by the overflow. This is not "handled" (the period is cut short, which is detectable by users) but is not catastrophic either (it's not a big deal, and it won't ever happen unless someone hacks the save).

Also restrict saves with determinism data to 98.0.
2023-04-15 22:19:50 +02:00
Tamás Bálint Misius
eee42b2ea3
Fix RNG usage
Mostly boils down to having graphics functions use Renderer's RNG, update and similar functions Simulation's.
2023-04-15 18:22:03 +02:00
mniip
c23eba1921 Remove unused Component::Component overloads 2023-04-13 18:48:19 +02:00
mniip
8c387a5a00 convert ThumbnailRequest to Vec2 2023-04-12 19:28:55 +02:00
mniip
aa2fa9ed8c Remove Graphics::SetClipRect 2023-04-12 19:24:54 +02:00
mniip
9b9b0b794a Remove Graphics::vid, Graphics::textwidthx, Graphics::textsize 2023-04-12 19:21:37 +02:00
mniip
e1d230f814 New text width ops 2023-04-10 23:54:46 +02:00
mniip
7a459e8021 Fix CI 2023-04-10 23:31:30 +02:00
mniip
f443eeff2f Refactor Engine, Window, and Panel drawing 2023-04-10 23:05:44 +02:00
mniip
4b70eeab55 Refactor PNG and working with alpha 2023-04-05 21:30:24 +02:00
mniip
b26a1b4a88 VideoBuffer pointer correctness 2023-04-05 14:52:20 +02:00
mniip
50bfa7cd5e Remove unused VideoBuffer code 2023-04-05 14:16:25 +02:00
mniip
132e3508cf Refactor tools 2023-04-05 14:11:37 +02:00
mniip
7f84887f6d Refactor things referencing VideoBuffer internals 2023-04-05 02:30:05 +02:00
mniip
b56d3cf611 Fix return values in VideoBuffer::*Character 2023-04-05 02:30:05 +02:00
mniip
e5af4dab68 Refactor resize-related code 2023-04-05 02:30:05 +02:00
mniip
caab738184 Refactor raster draw methods 2023-04-05 02:29:35 +02:00
mniip
e93db9c06a RasterDrawMethods CRTP, PlaneAdapters in VideoBuffer, Graphics, and Renderer 2023-04-05 02:29:35 +02:00
mniip
a0a9ad0abd Add new Vec2, Mat2, RGB, RGBA classes and deprecate some old functions 2023-04-05 02:29:35 +02:00
Tamás Bálint Misius
a2c7242c7c
Fix uninitialized read of Engine::dt early after startup 2023-03-02 20:55:48 +01:00
Tamás Bálint Misius
369dadf81e
Fix crash from new brush code when TPTMP is enabled
Okay yeah this is actually a well-camouflaged refactor.
2023-02-28 14:57:30 +01:00
Tamás Bálint Misius
114017d550
Fix msvc error due to narrowing conversion 2023-02-28 14:57:29 +01:00
Tamás Bálint Misius
a13c29875f
Don't mangle custom element types in life, ctype, tmp{,2,3,4}
Achieved by adding a new element property called CarriesTypeIn, whose bits signal to save loading code which properties of particles of the element class in question carry element IDs. The bits in this property are numbered the same way as sim.FIELD_* constants for consistency. One would signal from Lua that a custom element carries element IDs in its tmp like this:

	elem.property(id, "CarriesTypeIn", 2 ^ sim.FIELD_TMP)

"Carrying an element ID in a property" is to be interpreted as follows: the property is treated as a combination of a PMAPBITS-bit (so, currently 9-bit) unsigned integer lower part holding an element ID and a 32-PMAPBITS-bit (so, currently 23-bit) signed integer upper part holding whatever makes sense for the element. CONV, for example, uses this signed integer in its ctype as the extra "v" parameter for particle creation.
2023-02-28 12:43:45 +01:00
Tamás Bálint Misius
2e2c3181b5
Fix custom elements disappearing on load (fixes #908)
Some checks on particles, most importantly whether their element IDs refers to an enabled element, were done _before_ in-save element IDs are mapped to in-simulation element IDs. This resulted in some particles being removed if their IDs were unlucky enough.
2023-02-28 12:29:26 +01:00
mniip
ed8ec51f95 Copy brushes instead of making temporary changes to them 2023-02-22 09:58:03 +01:00
mniip
515df765e4 Clean up brush code 2023-02-22 09:58:03 +01:00
jacob1
6d4f6218a4
Create wrapper around lua_pcall that properly tracks Lua execution time
A bug existed before where certain events would not update Engine's lastTick. If the sim was lagging hard, then this could cause "script is not responding" errors to appear in unintentional situations.

The starting execution time is tracked in LuaScriptInterface instead now, and set in tpt_lua_pcall
2023-02-17 21:58:57 -05:00
Tamás Bálint Misius
e5fec98d28
Fix stamps being impossible to delete
Broken by 416f84a1c4, oops.
2023-02-05 23:09:53 +01:00
Tamás Bálint Misius
1c92280097
Clean up Misc.cpp somewhat
Also make a feeble attempt at rooting out standard C I/O library function usage. Lua still uses it though >_>
2023-02-05 15:59:31 +01:00
Tamás Bálint Misius
0fe8d79e60
Make replace parameter of RenameFile explicit
Also replace a few rename calls with RenameFile calls. Old code doesn't expect rename to overwrite existing files without question, when it in fact can.
2023-02-01 21:48:18 +01:00
Tamás Bálint Misius
aa78a1ee6b
Clean up FFT gravity 2023-02-01 19:56:55 +01:00
Tamás Bálint Misius
85d492bad6
Make request progress variables atomic
These are the only bit of shared state between the Request user thread and RequestManager that aren't covered by RequestHandle::stateMx. The problem was that they were not covered by anything, which meant that they were not guaranteed to be coherent between threads.
2023-02-01 19:26:59 +01:00
Tamás Bálint Misius
b7a6663e08
Fix updating not deleting the old exe on windows
Also fix WriteFile being unable to overwrite existing files. The rename would fail because the file was still open, and the sanity remove in response to that would also fail for the same reason.
2023-01-29 18:54:02 +01:00
Tamás Bálint Misius
bd667dddad
Group request manager files into their own directory 2023-01-27 23:04:30 +01:00
Tamás Bálint Misius
b9c8817386
Group gravity files into their own directory
Also replace non-FFT gravity with "no gravity"; fine for render.
2023-01-27 23:04:27 +01:00
Tamás Bálint Misius
159d0eb4b7
Group platform files into their own directory 2023-01-27 17:31:40 +01:00
Tamás Bálint Misius
694bc8eb0f
Fix exit behaviour
We can't rely on atexit, handlers registered with it are in a hard to establish ordering relationship with destructors of static and thread-local objects.
2023-01-27 14:55:58 +01:00
Tamás Bálint Misius
11945ba620
Factor out game stuff from PowderToySDL.cpp 2023-01-27 09:29:19 +01:00
Tamás Bálint Misius
2566506e4b
Provide three levels of install support
Namely: no, yes, and yes and ask at startup.

The install_check option is thus replaced by the can_install option. -Dinstall_check=true maps to -Dcan_install=yes_check, while -Dinstall_check=false maps to -Dcan_install=yes. -Dcan_install=no is new and is recommended for downstream packaging, where -Dinstall_check=false was historically used.

Also improve error messages about bad configuration here and there and scatter configuration code in subdirectories, where they can be closer to their areas of effect.
2023-01-27 09:27:33 +01:00
Tamás Bálint Misius
416f84a1c4
Read stamps from stamps.json
... while retaining all the functionality of stamps.def.

Also fix stamp names encoding only 32 bits of the timestamp, migrate from stamps.def to stamps.json if the latter doesn't exist, delete both on migration to the shared data directory, rescan stamps at startup, and make rescanning a painless process in general by removing invalid entries and adding missing entires at the beginning of the list.
2023-01-27 09:27:33 +01:00
Tamás Bálint Misius
9034736708
Move more stuff to Editing.cpp 2023-01-27 09:27:32 +01:00
Tamás Bálint Misius
75191e7ac5
Skip loading authorship info in render 2023-01-27 09:27:32 +01:00
Tamás Bálint Misius
a438584871
Only save custom GOL data if it changed 2023-01-27 09:27:32 +01:00
Tamás Bálint Misius
4f0c365e05
Preprocessor purge round 19: Split and minimize usage of Config.h
Also mostly banish it from other headers, and shuffle standard header includes to minimize cross-contamination between headers.
2023-01-27 09:27:32 +01:00
Tamás Bálint Misius
6ea66f02de
Include "1" in the list of "true-strings" on the command line 2023-01-27 09:27:32 +01:00
Tamás Bálint Misius
3cb6b26d1d
Migrate Singletons to ExplicitSingleton 2023-01-27 09:27:30 +01:00
Tamás Bálint Misius
8680f0d4a7
Remove PATH_SEP, set PATH_SEP_CHAR in meson.build 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
36d6f1d67e
Preprocessor purge round 18: difficult parts of WIN, LIN, MACOSX, AND 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
49102e395c
Move platform-specific code out of entrypoint TUs 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
c8ca016494
Move update code to Platform 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
a7d8ecc6e3
Make WriteFile replace rather than overwrite
This preserves old file if writing the new one fails for some reason.
2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
163203b321
Preprocessor purge round 17: easy parts of WIN, LIN, MACOSX, AND 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
746dbb0cba
Manage search model requests in SearchModel
Also make Client an ExplicitSingleton, and thus fix all known instances of Requests outliving RequestManager.
2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
afda2826bf
Refactor preferences 2023-01-27 09:26:41 +01:00
Tamás Bálint Misius
f7478422a4
Preprocessor purge round 16: DEBUG 2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
f0ffa2eeb1
Preprocessor purge round 15: FONTEDITOR, RENDERER 2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
a2a079356a
Preprocessor purge round 14: NOHTTP 2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
7ea839feb8
Move Lua HTTP out of LSI 2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
91a9973bfd
Refactor HTTP
Request ownership is no longer flaky. Requests are now owned by the code that makes requests, and Requests and the RequestManager co-own RequestHandles. RequestManager disowns a RequestHandle if it's done with it or if Request code reports that it's no longer needed.

All libcurl code has been moved to RequestManager. This is nice because once NOHTTP is removed, we can add any number of RequestManager implementations, for example one for Android.

Client outliving RequestManager is still a problem, this will have to be addressed later.
2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
29d4d4e91c
Preprocessor purge round 13: X86 2023-01-27 09:26:40 +01:00
Tamás Bálint Misius
b16cbf86fc
Preprocessor purge round 12: BETA, SNAPSHOT, MOD 2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
9068920de3
Preprocessor purge round 11: GRAVFFT
By splitting gravity implementations into separate translation units.
2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
dc8d63fb15
Preprocessor purge round 10: LUACONSOLE 2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
7fca2433cd
Derive LuaScriptInterface from TPTScriptInterface
Also convert stray references to LSI to stray references to CommandInterface. Not a lot better as it's still a global >_> but it's easier to follow.
2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
1f22e209f1
Localize Simulation::Before/AfterSim control to GameModel 2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
169aa47685
Hide CommandInterface creation behind a factory
Which is then provided by either a Lua-ful or a Lua-less translation unit.
2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
33edb2e0e4
Refactor GameController events
More precisely, refactor the code responsible for routing these GameController events to the Lua side. The issue with the previous solution was it relied on preprocessor macros to switch between Lua-ful and Lua-less builds.
2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
27ddf78e0c
Preprocessor purge round 9: XCELLS and YCELLS 2023-01-27 09:26:39 +01:00
Tamás Bálint Misius
1efafb8d30
Preprocessor purge round 8: trivial binary macros 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
9542f98b82
Preprocessor purge round 7: Config.template.h 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
e97fd74503
Preprocessor purge round 6: intro text and user agent 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
fdfa206a3c
Preprocessor purge round 5: M_PI 2023-01-27 09:26:38 +01:00