6092 Commits

Author SHA1 Message Date
Tamás Bálint Misius
ce250e31f2
Bound-check SOAP links (fixes #973) 2024-11-08 16:37:56 +01:00
Tamás Bálint Misius
809ae3ae93
Automatically set b_vscrt on Windows 2024-11-07 18:42:19 +01:00
Tamás Bálint Misius
b46f35c1e5
Upgrade to C++20 2024-11-07 18:42:19 +01:00
Tamás Bálint Misius
119591d14d
Add support for aarch64 on windows, update tpt-libs 2024-11-07 18:42:19 +01:00
Tamás Bálint Misius
c3b30ec120
Bump some ghactions jobs to ubuntu-22.04 2024-11-07 11:22:56 +01:00
Tamás Bálint Misius
87ab4c285a
Bump some ghactions jobs to macos-13 2024-11-04 18:40:47 +01:00
Tamás Bálint Misius
8620ea13a4
Fix nullptr deref when flooding deco
Broken in ff4500620e56, where the code that constructs DecorationTools got moved from GameModel::BuildMenus to GameModel::InitTools. BuildMenus used to run fairly late, while InitTools is run fairly early, before GameModel's view member is initialized. This wasn't a problem before f52e04703731, since which DecorationTools access Renderer through GameView, rather than directly.
2024-11-04 18:14:33 +01:00
jacob1
875f92b2a6
Fix chance of NEUT spawning PHOT in GLAS and of PHOT multiplying in GLOW. Originally broken in cda029ff4246 2024-11-02 00:02:34 -04:00
Tamás Bálint Misius
02b679aec3
Fix views leaking when closing themselves
Views would invoke c->Exit() upon closing themselves, which would close them but not delete them. The controller would then be destroyed, fail to close the view because it wouldn't be the window on top, and skip destroying it in fear of something worse. This behaviour was introduced by c2f8a7df25f3, fixing something indeed worse: views would be destroyed while they were still in use by ui::Engine, sitting somewhere on the window stack but not at the top. In other words, the problem was (and is) that the terms of ownership of views between controllers and ui::Engine are unclear.

This commit effectively undoes that earlier commit and tries a different approach: when something is closed, close everything above it. This seems a correct thing to do and also allows controllers to unconditionally take care of their views. Prepare your popcorn though.

This fixes a bug where the stamp browser would stop rendering stamps if it was previously closed "too quickly", which turned out to mean that it was closed before all stamps had finished rendering, and thus ThumbnailRendererTasks belonging to LocalBrowserViews indirectly through SaveButtons would get stuck in a queued state, preventing other SaveButtons from starting their own ThumbnailRendererTasks.
2024-10-25 22:08:38 +02:00
Tamás Bálint Misius
d4cbdc84ca
Migrate starcatcher-publish step to sftp 2024-10-24 16:28:59 +02:00
Tamás Bálint Misius
ca930c2494
Allow only a single instance of the exit prompt
This is required because there is a very low-level shortcut that can create one even if one is already being shown.
2024-10-18 08:55:36 +02:00
jacob1
03e1b12173
Snapshot 372 snapshot-372 2024-10-17 23:26:54 -04:00
Tamás Bálint Misius
8cab4ab738
Fix saves sometimes being one cell larger than intended
Namely, when any dimension of the underlying particle area is divisible by CELL. Importantly, this includes "normal" saves (as opposed to stamps), which take the entire simulation area, making them impossible to load.

Broken by c2bb77721208, where RectBetween(topLeft / CELL, bottomRight / CELL) was rewritten to RectSized(pos / CELL, size / CELL), which is not equivalent. This commit also neglected to add TopLeft() and BottomRight() to Rect. Incorrectly fixed by 6a903ed132b3, where RectSized(pos / CELL, size / CELL) was rewritten to RectBetween(pos / CELL, (pos + size) / CELL), which is also not equivalent.
2024-10-16 08:08:24 +02:00
jacob1
7353894618
Ctrl+q - don't trigger quit dialog if alt is also held
Should fix dialog coming up when typing / on some Brazilian keyboards, which use Alt Gr + q to type a /. Apparently this also acts as if Ctrl were held.
2024-10-16 00:04:48 -04:00
jacob1
6a903ed132
Fix possible crash when creating stamps
The save's blockSize was set one cell too short, so extend it by one (by using RectBetween). This fixes a crash when serializing save data that had particles outside its range.
2024-10-15 23:12:35 -04:00
Tamás Bálint Misius
948f6bf27f
Snapshot 371 snapshot-371 2024-10-15 19:37:06 +02:00
Tamás Bálint Misius
43a4311762
Add !get console command
Uses the same selector syntax as !set, and if there is exactly one resulting particle, reads from it the requested property.
2024-10-14 10:23:53 +02:00
Tamás Bálint Misius
7a2d8f6aaf
Deduplicate console command function list 2024-10-14 10:23:49 +02:00
Tamás Bálint Misius
01a6bf15be
Fix the position-based selector of !set
Broken since the addition of !set in 7ae5eaab79a4.
2024-10-14 10:18:00 +02:00
Tamás Bálint Misius
8552aafbce
Unify particle property parsing code
This means that the !set console command now accepts the same language as the prop tool's property value field.
2024-10-14 10:05:40 +02:00
Tamás Bálint Misius
a03db32dd5
Add sim.listDefaultGol 2024-10-14 07:41:17 +02:00
Tamás Bálint Misius
c96128f241
Show placeholder text in text fields even when focused
This is fine, there's no particular benefit to hiding it when they are focused. I did find it annoying that the cursor got a bit tangled up with the placeholder text though, so I moved the text a bit to the right.
2024-10-14 00:15:13 +02:00
Tamás Bálint Misius
f9ccc24177
Remove the single C TU from the codebase
This leaves one non-C++ TU in the entire codebase: Cocoa.mm is Objective C++ and is only compiled on MacOS, where it's used for clipboard integration. This too will go away when we move to SDL3, which has a proper clipboard API.
2024-10-14 00:14:29 +02:00
Tamás Bálint Misius
c2bb777212
Migrate Rects to (pos, size) representation 2024-10-10 19:51:59 +02:00
Tamás Bálint Misius
2cc5d9bbbb
Fix tools drawing rectangles with tools not doing anything in some cases
Namely, when those rectangles are not drawn in a top left to bottom right corner order. Broken by a26544ba955f, which neglected to port the rectangle normalization logic from Simulation::ToolBox.
2024-10-08 22:07:50 +02:00
Tamás Bálint Misius
0c048a9d6e
Show address of Main in stack traces
This beats main because that expands to SDL_main and leaves everyone confused.
2024-10-05 22:14:13 +02:00
Tamás Bálint Misius
07fa908102
Fix EndsWidth crash when the suffix is longer than *this 2024-10-05 21:14:05 +02:00
Tamás Bálint Misius
5928125594
Make more Lua tool properties trigger a menu rebuild
Turns out GameView needs to be told about every single thing, oops.
2024-10-05 09:21:03 +02:00
Tamás Bálint Misius
9c3cd69cef
Add MenuSection and MenuVisible properties to Tool
This makes the task of deciding which tool goes in which menu easier (GameModel::BuildMenus). Due to changes in the order tools are added to menus, the sign/sample/prop tool triplet now comes before custom tools, and the custom life creation tool comes before custom life element tools, which I think is fine.
2024-10-04 12:32:32 +02:00
Tamás Bálint Misius
b26d057783
Store tool identifier to index mapping in tools.index
This mimics sim.walls.* rather than elem.*_PT_*. The latter is fine because element identifiers follow the *_PT_* pattern, but tool identifiers don't, so they'd be a pain to tell apart from the rest of the API.
2024-10-04 12:09:14 +02:00
Tamás Bálint Misius
c03c2f3fd0
Fix Lua elements getting deselected when their properties change
This was because element tools associated with Lua elements were reallocated every time their properties changed. They are now properly updated instead.

This is still a mess and I don't like it at all.
2024-10-04 09:53:51 +02:00
Tamás Bálint Misius
82ec6b2775
Fix yet another extremely rare pmap corruption
Don't just set the .type of struct Particle to 0, kids. Code tracked back to the times from before git; already present in b0ea52690ba5, the initial commit.

Reproduce with

	sim.clearSim()
	elem.property(elem.DEFAULT_PT_DMND, "Update", function(i, x, y)
		local ni = sim.photons(x, y)
		if ni then
			if not sim.partProperty(ni, "vx") then
				print(x, y)
				assert(false)
			end
		end
	end)
	local i = sim.partCreate(-1, 100, 100, elem.DEFAULT_PT_NEUT)
	sim.partProperty(i, "vx", 0)
	sim.partProperty(i, "vy", 2)
	sim.partCreate(-1, 100, 100, elem.DEFAULT_PT_DMND)
	sim.partCreate(-1, 100, 102, elem.DEFAULT_PT_PRTI)
	sim.paused(true)
	sim.framerender(1)

Though if done this way, it's actually a photons corruption.
2024-10-03 10:58:28 +02:00
Tamás Bálint Misius
126e636eb3
Appease the clang gods (fix CI) 2024-10-02 20:19:01 +02:00
Tamás Bálint Misius
2a7a6a40fd
Fix gravity lensing applying uniformly to all of RGB
Broken in 7e9d9686dda4, where I accidentally applied the offset calculated for the red channel to all channels, oops.
2024-10-02 20:05:21 +02:00
Tamás Bálint Misius
7c578b7f13
Port brushes to PlaneAdapter 2024-09-29 16:41:29 +02:00
jacob1
3b3162063f
Fix issues with render ui checkboxes: (fixes #970)
Render mode checkboxes each control multiple bit flags, but they would fully unset all bits they control, even if they shared flags with other render modes (which they always do). This would cause more things to turn off than intended when deselecting options, and all other checkboxes would appear unchecked. Now it will recalculate render mode based on what's checked instead.

Air display mode checkboxes are supposed to act as radio buttons, but it was letting all air modes be selected at once. They are mutually exclusive because only one display background can be drawn at once. Now, they act as exclusive radio buttons again.
2024-09-22 00:27:08 -04:00
Tamás Bálint Misius
c842086309
Pause renderer thread when needed in GameModel 2024-09-15 18:25:37 +02:00
Tamás Bálint Misius
12322bb382
Snapshot 370 snapshot-370 2024-09-14 19:45:25 +02:00
Tamás Bálint Misius
00ec4e0754
Implement Lua tools 2024-09-14 13:49:53 +02:00
Tamás Bálint Misius
ff4500620e
Make GameModel tool list persistent
That is, it's not thrown away and rebuilt every time the underlying set of tools changes (the "derivation" approach). Rather, changes to the underlying set are applied to GameModel's list (the "persistent" approach).

Normally, I'd prefer the derivation approach if its overhead is small enough, which in this case it would be. However, this change, among a few others, is done in preparation for exposing tool functionality to Lua. The Lua side will use persistent numeric identifiers to refer to tools, which means at least Lua tools would need to follow the persistent approach, at which point it makes more sense for all tools to do so, than a hybrid approach.
2024-09-14 13:26:22 +02:00
Tamás Bálint Misius
c1a859c106
Move custom GOL management to GameModel
Also use RGB<uint8_t> for storing custom colors.
2024-09-14 13:09:44 +02:00
Tamás Bálint Misius
352c6227f6
Blow up Tool.cpp into smaller files
It's all still a good old mess though.
2024-09-14 13:09:44 +02:00
Tamás Bálint Misius
a26544ba95
Move tool logic out of Simulation
Also uncurse WindTool in the process; it is now an ordinary SimTool. This required extending SimTool with a Drag method that is called every tick while the user prepares for drawing a line and is shown the preview.

Since the Simulation doesn't have to understand SimTools anymore, they don't have to be a part of SimulationData and so NoToolClasses.cpp can finally be removed from the renderer executable.
2024-09-14 13:09:44 +02:00
Tamás Bálint Misius
2ae5b9209c
Don't force update powder.pref if the session is still invalid 2024-09-14 13:09:44 +02:00
Tamás Bálint Misius
6da42933c4
Fix find mode always reporting 0 particles found
Somehow foundElements (now renamed to foundParticles) made it into RendererSettings in 820f44a71690, even though it's actually a result of the rendering process. It is now extracted the same way as the resulting frame.
2024-09-07 15:13:24 +02:00
Tamás Bálint Misius
65aa34201b
Expose sim.canMove constants 2024-09-01 17:44:58 +02:00
Tamás Bálint Misius
867b8e4327
Bump android target sdk version to 33
See https://support.google.com/googleplay/android-developer/answer/11926878?hl=en
2024-08-31 09:03:28 +02:00
Tamás Bálint Misius
f58d4fbd63
Implement Platform::DefaultDdir for android
The default directory is acquired via getExternalFilesDir. Typical value: /storage/emulated/0/Android/data/uk.co.powdertoy.tpt/files, which seems to be user-accessible both on old and new Android. Probably. Hopefully. We'll see.
2024-08-30 21:25:54 +02:00
jacob1
5180df9180
Fix @tags description 2024-08-25 00:27:18 -04:00
jacob1
c7b3dc5582
Press F1 in save search to open help text + document new advanced search
I tried to document everything the advanced search does, but it was mostly a guessing game discovering all its features. It appears to be insanely powerful, supporting AND, OR, negation, parenthesis,quote-encapsulated phrases, and limiting search to only certain fields. These can be chained together as well. I tried giving examples that could possibly be useful.

Terms like before: and after: are not part of advanced search, and thus are global search options even if they're inside parenthesis
2024-08-25 00:23:11 -04:00