Commit Graph

3363 Commits

Author SHA1 Message Date
jacob1
814b73a5ed
Change sim.walls to use real wall identifiers, and also have reverse lookup 2023-10-05 23:59:09 -04:00
jacob1
fde1211cd9
Add ctrl+e shortcut to cycle through edge modes 2023-10-05 21:34:09 -04:00
jacob1
29ea811642
Add enums for gravity/air/edge modes, add more constants to Lua
Constants for the new enums were added, along with walls (in the sim.walls table), x/y center, and a few movement constants
2023-10-05 21:34:09 -04:00
Tamás Bálint Misius
bc51bdf634
Add shortcut to toggle fullscreen 2023-10-05 23:19:59 +02:00
Tamás Bálint Misius
7bb8344d3b
Fix the Maximized property of windows shortcuts not being respected
By not resizing the window if it's resizeable and is somehow already maximized.
2023-10-05 21:23:20 +02:00
Tamás Bálint Misius
bb8605fa3b
Fix ubuntu 20.04 pipelines
By not using SDL_RenderLogicalToWindow if it's not available.

Because of course ubuntu 20.04 has sdl 2.0.10, which of course doesn't yet have SDL_RenderLogicalToWindow which was added in 2.0.18, which is of course needed because of course SDL_SetTextInputRect takes window coordinates rather than logical coordinates. At least official static linux builds are not affected because tpt-libs uses much newer sdl.
2023-10-05 21:23:04 +02:00
Tamás Bálint Misius
79760f5c89
Fix input method candidates being aligned wrong in some cases
Namely when the main window is resizeable and its size isn't the same as it would be with the active scale mode with resizing disabled.

Also fix window position not being restored when the main window is resizeable.
2023-10-05 20:10:50 +02:00
Tamás Bálint Misius
0fb36012a2
Clean up window creation somewhat
Fixes most of the rat's nest situation mentioned in 8cfe7cdd93.
2023-10-05 19:47:29 +02:00
Tamás Bálint Misius
1a8ebd0981
Fix occasional crashes upon opening settings
By zero-initializing pointers in OptionsView so they don't crash when they don't get initialized, which up until very recently they always had. In the cases of the emscripten and android ports, certain components are never created.
2023-10-04 19:32:08 +02:00
Tamás Bálint Misius
8cfe7cdd93
Clean up window frame settings somewhat
Another rat's nest; I'm still not entirely satisfied.

This introduces "frame personalities": one for embedded frames (emscripten), one for handheld devices and everything else that doesn't really work with windows (android), and one for everything else. For now these affect which frame options are configurable by the user and what values they are forced to take if they are not configurable, and whether optimal scale is guessed based on screen size.

Also introduce a future TouchUI config node to allow switching between normal and touch-optimized UI on android. Again, because chromebooks and other android devices with mouse and keyboard support are a thing.

Also enable debugging of debug builds of android. It took me hours to attach a stupid debugger to the process; see:

 - https://www.sh-zam.com/2019/05/debugging-krita-on-android.html
 - https://source.android.com/docs/core/tests/debug/gdb#app-startup

I also had to adb forward the port that lldb was supposedly talking to lldb-server over because otherwise it wouldn't attach; I don't get it either.
2023-10-04 16:01:00 +02:00
Tamás Bálint Misius
b6680a03b2
Fix a few warnings 2023-10-03 18:25:35 +02:00
Tamás Bálint Misius
e635a45251
Make Lua hook timeout configurable 2023-10-03 18:25:34 +02:00
Tamás Bálint Misius
b89d29b744
Enable libcurl on android 2023-10-03 18:25:34 +02:00
Tamás Bálint Misius
f94b436cbc
Use mbedtls on windows 2023-10-03 18:25:34 +02:00
Tamás Bálint Misius
5584acd189
Add version info to bluescreen 2023-09-30 22:15:38 +02: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