Commit Graph

5525 Commits

Author SHA1 Message Date
Tamás Bálint Misius
d3ab2e231e
Merge data/ into resources/ 2022-12-25 11:13:46 +01:00
Tamás Bálint Misius
3e3ee8a722
Convert hmap data to gradients 2022-12-25 11:09:08 +01:00
Tamás Bálint Misius
bb6c371aa8
Convert images.cpp to actual images
Also remove some dead code.
2022-12-25 11:09:06 +01:00
Tamás Bálint Misius
6e9b9cd861
Use different app constants for betas and snapshots 2022-12-24 08:41:10 +01:00
Tamás Bálint Misius
762208356a
Bump macos minimum version to 10.13, update tpt-libs
The version bump was made necessary by 7173650df9.
2022-12-23 19:43:07 +01:00
Tamás Bálint Misius
7173650df9
Migrate AnyType to std::variant
AnyType did resource management wrong. Not that it's particularly nice now, but it's at least correct. There's a change I want to make later that was blocked by this.
2022-12-23 12:15:28 +01:00
Tamás Bálint Misius
50ef07c339
Add underline escape sequence to text renderer
This allows us to do underline the app name in the intro text correctly. More important than it used to be now that the app name can be changed.
2022-12-23 07:39:58 +01:00
jacob1
952c3a6975
Add sim.historyRestore and sim.historyForward 2022-12-22 22:05:05 -05:00
Cracker1000
81bd1fd9e7
Make GLAS strengthening reaction more controllable and not so arbitrary (#856) 2022-12-22 21:36:50 -05:00
jacob1
87ba01d018
Add discord link to intro text 2022-12-22 21:35:10 -05:00
jacob1
94406a4320
Fix "End of particles reached" not printing if manually simulating to particle 235008 2022-12-22 21:08:18 -05:00
Tamás Bálint Misius
543bd5f5c0
Add diff verb to fonttool.py 2022-12-22 18:44:05 +01:00
Tamás Bálint Misius
06802949ab
Add Lua support for partial sim updates 2022-12-22 17:44:06 +01:00
Tamás Bálint Misius
ca93e69b19
UpdateParticles takes a range that is inclusive on both ends 2022-12-22 17:34:43 +01:00
jacob1
888e0f2065
Remove pmap hack in BOMB.cpp 2022-12-20 23:59:17 -05:00
CanGonenc
ed9d405742
FIRE.cpp: minor improvements on readibility (#872) 2022-12-20 20:39:10 -05:00
Tamás Bálint Misius
3be884513d
Do macos packaging on ghactions 2022-12-20 08:25:48 +01:00
jacob1
1c459a7e1a
Fix compilation with LUACONSOLE turned off 2022-12-19 22:45:08 -05:00
jacob1
63661a752c
Add evt.beforesim and evt.aftersim for running code only when simulation advances
Only triggered when simulation is unpaused or simulating via subframe debugging. beforesim is the location where most vanilla sim handlers are run.
2022-12-19 22:31:21 -05:00
jacob1
299781bf13
Block solids from being created in detect wall in IsWallBlocking instead, fixes #881 2022-12-19 21:38:42 -05:00
jacob1
74adc9e4b2
Use bitmap in FloodParts to prevent infinite loops in unusual situations, fixes #882
"unusual situations" include all particle slots filling up
2022-12-19 21:38:42 -05:00
Tamás Bálint Misius
7768450e74
Fix document icons on windows
I was wrong in dd7178dbc8, we do need resource.h after all.
2022-12-19 20:51:54 +01:00
Tamás Bálint Misius
467049d4dd
Ignore mod_id.txt if the mod ID is set in meson_options.txt
Fixes forward-incompatible behaviour introduced by 0ff08c276f. The idea is to have mod owners migrate from using mod_id.txt to using meson_options.txt, but if prepare.py unconditionally prefers the former, nobody can use the latter.
2022-12-19 20:08:47 +01:00
Tamás Bálint Misius
0ff08c276f
Bring back mod_id.txt
Removed in 59f89f9a46, brought back to minimize discomfort downstream. prepare.py will still default to the mod_id in meson_options.txt if mod_id.txt is deleted though.
2022-12-19 15:42:47 +01:00
Tamás Bálint Misius
dd7178dbc8
Stop setting window icons on windows
Also fix font editor builds on windows and add more font editor builds to the ghactions workflow.

Funny, we don't really need resource.h anymore. The resource compiler does, but we don't.
2022-12-18 19:32:12 +01:00
Tamás Bálint Misius
7bfce3e4a8
Fix local browser offering to open broken saves
It wouldn't actually open them, it'd just exit back to the currently open save. It's better to tell the user the reason why the save is broken instead.
2022-12-18 15:32:45 +01:00
Tamás Bálint Misius
e5c88f154a
Unify icons 2022-12-18 15:00:08 +01:00
Tamás Bálint Misius
9e2185c8a2
Keep thumbnails of SaveButtons with lazily loaded SaveFiles 2022-12-18 10:38:37 +01:00
Tamás Bálint Misius
5ae7755025
Fix the zoom window producing out of bounds coordinates
Also fixes sim.adjustCoords doing the same.
2022-12-18 09:05:55 +01:00
Tamás Bálint Misius
59f89f9a46
Let mods customize app constants
Mainly via meson_options.txt.
2022-12-17 19:45:01 +01:00
Tamás Bálint Misius
2140d6db4b
Clean up the feature line a bit
Also fix the icon name in the desktop file not including the vendor string.
2022-12-17 13:07:07 +01:00
Tamás Bálint Misius
1beaebb928
Fix nullptr deref in SaveButtons without an associated SaveFile
I've seen the nullptr deref, but I don't see how it's possible at all. A condition for file->LazyUnload to be called is for SaveButton::wantsDraw to be false, but for that to happen, SaveButton::Tick has to be called after a call to SaveButton::Draw to reset it to false, and then *again* for it to see it being false on entry.

Whatever, the bug is genuinely there and is bad, and easy to fix, no need to figure out in what way it is bad exactly.
2022-12-15 07:46:41 +01:00
Tamás Bálint Misius
2cd1f7bad3
Fix local browser handling large amounts saves badly
So instead of loading every save in sight and rendering the thumbnails for them too, SaveButtons will only do this when they are actually visible, and unload saves and thumbnails when they are not.

Also remove the "Rendering thumbnails" progress bar, which did absolutely nothing.
2022-12-14 19:04:59 +01:00
Tamás Bálint Misius
54cd259a18
Fix PSv parsing
I took extra care to not mess up signedness in readOPS in ab600780d0, but apparently didn't do the same in readPSv.

Also fix a bound check that was broken since aac6b7258c. It's a good thing this was broken, because this allowed negative type values from broken signedness readPSv to get past and cause a crash later on, rather than just cause particles to disappear or something.
2022-12-11 08:55:46 +01:00
Tamás Bálint Misius
b57db7991a
Restrict tmp2 != 0 CONV to 97.0
See 0e361c170c.
2022-12-08 07:57:41 +01:00
Tamás Bálint Misius
1af85b0f56
Make workaround_elusive_bzip2 default to true
We will undo this once major linux distros pull their crap together.
2022-12-08 07:49:55 +01:00
Tamás Bálint Misius
b20d38d3b0
Silence unused variable warnings for fromNewerVersion 2022-12-08 07:48:00 +01:00
Tamás Bálint Misius
9a9c686d91
Expose BZ2 to Lua 2022-12-08 07:47:59 +01:00
Jakav-N
0e361c170c
Add inverted element filtering to CONV with tmp2 set to 1 (#871) 2022-12-07 12:43:21 +01:00
Mark Theng
34fa5d0cce
Make file browser respond to search query changes while loading files (#866) 2022-12-07 12:17:30 +01:00
catsoften
510424363b
Replace max/min pressure with constants (#870) 2022-12-07 12:07:46 +01:00
Tamás Bálint Misius
b393050e55
Fix PHOT reflecting off thin walls of particles incorrectly
When PHOT fails to move (do_move or eval_move return "no move"), it looks for
a surface (a contour of boundaries, as reported by is_boundary) along its path
and reflects off (or refracts into, see below) it, using get_normal_interp to
find the point of incidence and get_normal to deduce the surface normal.
get_normal is given the point and angle of incidence, and attempts to traverse
the surface the point belongs to by running two "surface scout" processes.

These processes remember their own position and "heading", a subset of the
eight cardinal directions on the grid. They are initialized with the point of
incidence and a heading that includes all directions whose dot product with
the angle of incidence is non-negative (see direction_to_map). They then
perform a few iterations (SURF_RANGE).

In each iteration, the processes check all eight neighbours of the cell they
are on and select the first neighbouring cell they find that is both a
boundary (as reported by is_boundary) and that is within their heading. They
then move to this neighbouring cell and update their heading by discarding
directions that are not similar enough to (differ by more than 45 degrees
from) the one that took them where they are now (see find_next_boundary). If
they find no such neighbour, they stop.

Continuing the militaristic line of thinking introduced by the term "surface
scout", you can imagine the two processes as two paratroopers who arrive from
above, land on a horizontal surface, and one starts going left, while the
other starts going right. They initially expect the surface they land on to be
close to horizontal, but are also prepared for not too erratic changes in its
angle as they go. Changes too erratic (imagine a precipice) scare them and
force them to stop.

Once the processes finish, an imaginary line segment is drawn between the
cells they ended up on. If the line segment is long enough (estimated by j,
and compared against NORMAL_MIN_EST), get_normal returns a normal that is
perpendicular to it. If it is too short, get_normal gives up and returns
nothing (which results in the PHOT being killed).

This amounts to our paratroopers attempting to get the "lay of the land" by
walking away from where they landed and comparing where they end up. They also
know that if they are still relatively close to each other at the end of their
walk, their measurement is probably wrong and their mission should be aborted.

The bug this commit fixes is that get_normal returns bogus surface normals
when it encounters thin walls of particles, defined as walls exactly two
layers of particles thick. One-layer walls are not really walls, as movement
code allows particles to penetrate these, and three-layer and thicker walls
are too thick for the bug to manifest.

The bug manifests for two-layer walls because the "left" scout process is
drawn to the side of the wall opposite to the one with the point of incidence.
This is because scout processes check neighbours in a clockwise order, and
always select the first suitable neighbour they find. As particles on the
other side of the wall are both boundaries and are within the heading of the
processes, they also qualify as suitable neighbours, so whether a scout
process selects the correct side of the wall depends on the order in which
neighbours are checked.

Essentially, the paratroopers look at their immediate surroundings in a
clockwise order. The right paratrooper always finds the ground and knows where
to step. The left paratrooper finds the Upside Down from Stranger Things and
teleports there.

This bug also affects refraction into and out of thin walls, but since these
walls are thin, the path the PHOT takes inside them is rather short and the
incorrect angle of travel is difficult to see. Furthermore, upon exit, the
same normal deduction bug causes the PHOT to take a path whose angle is almost
identical to that of the path that took it to the wall, so much so that it is
also difficult to see over shorter distances.

The solution is to have the left scout process check neighbours in reverse
order, so that it prefers the right side of the wall over the wrong one. This
does not affect its behaviour when facing thicker walls, but fixes its
behaviour when facing two-layer walls.

The changes in this commit also make find_next_boundary interact with
is_blocking directly to detect a change between the blocking trait of
immediate neighbours. This makes more sense than relying on is_boundary
because find_next_boundary is meant to find a transition from non-blocking to
blocking neighbours within the current heading, rather than to find any
boundary particle. The difference is subtle but important.
2022-11-12 11:10:43 +01:00
Tamás Bálint Misius
ab600780d0
Clean up GameSave somewhat
Namely:

 - get rid of unsafe memory management;
   - use vectors / Planes everywhere;
   - return a vector from serialization functions;
   - have read functions take a vector;
 - improve constness;
 - hide a few implementation details from GameSave.h;
 - get rid of GameSave copy constructor;
 - better member initialization;
 - use the slightly more C++-looking BZ2 wrappers.

The BSON library still takes ownership of the data it parses, and GameSave
ownership is still a joke. Those will need to be fixed later.
2022-11-10 15:15:10 +01:00
Tamás Bálint Misius
f70cc705cb
Remove GameSave::Collapse and GameSave::originalData
... and everything built around them.

A GameSave would hold at least one but sometimes two representations of a save:
one serialized, and one "friendly", accessible for modification. Thus, a
GameSave would have three states:

 - "Collapsed": only the serialized representation was present; this was the
   initial state of GameSaves loaded from files;
 - "Expanded With Data": both the serialized and the friendly representations
   were present; this was the state of GameSaves loaded from files after a call
   to Expand;
 - "Expanded Without Data": only the friendly representation was present; this
   was the initial state of GameSaves being prepared for being saved to files.

A GameSave would be able to go from Collapsed to Expanded With Data with a call
to Expand, and back with a call to Collapse. Of course, this latter transition
would discard any changes made to the friendly representation, for example with
Translate. A GameSave would however be unable to go from Expanded Without Data
to any other state; a call to Collapse in this state would have been a no-op.

There were two instances of Collapse being called, one in the GameSave
constructor taking the serialized representation, immediately after a call to
Expand, and another in SaveRenderer, which would Collapse a save "back down" if
it had originally been Collapsed. Now, consider that there reasons for
constructing a GameSave from the serialized representation are as follows:

 - loading an online save at startup from the command line;
 - loading a local save at startup from the command line;
 - loading a local save when it is dropped into the window;
 - loading a local save for placement of the most recently used stamp;
 - loading a local save for stamp placement via Lua;
 - loading an online save for preview generation while browsing;
 - loading a local save in the stamp browser for thumbnail generation;
 - loading a local save in the local save browser for thumbnail generation.

In some cases, the friendly representation is needed for thumbnail generation
by ThumbnailRendererTask. ThumbnailRendererTask operates on its own copy of the
GameSave, because it runs SaveRenderer on a thread different from the main one
and cannot be sure of the lifetime of the original GameSave. It destroys this
copy when it is done rendering, so the call SaveRenderer makes to Collapse is
pointless.

In all other cases, the friendly representation is needed immediately. In some
of these, SaveRenderer is used from the main thread, but since the friendly
representation of the GameSave will be needed for pasting anyway, the call
SaveRenderer makes to Collapse is pointless again.

So, Collapse goes away. This also means that it is pointless for GameSaves to
hold on to the serialized representation, since in all cases in which they have
access to it, the friendly representation is needed immediately, and with
Collapse gone, they will never need it again.
2022-11-10 12:03:48 +01:00
Tamás Bálint Misius
630db0ef6b
Update tpt-libs
Comes with a new SDL2 version that fixes some obscure bug on Linux with nvidia drivers installed which makes TPT unable to start.
2022-11-08 21:16:13 +01:00
Tamás Bálint Misius
d120529492
Update tpt-libs
Hopefully fixes 601 errors on win11.
2022-11-06 17:18:08 +01:00
Tamás Bálint Misius
9b76c0dfe2
Fix snapshots being configured with ignore_updates=true
By moving appimages to their own build jobs. This required restructuring prepare.py again: release and debug jobs are not configured in pairs anymore.
2022-11-03 08:06:26 +01:00
Tamás Bálint Misius
b568b11927
Explicitly specify appimage destination
Because appimagetool is too smart for its own good.
2022-11-02 06:45:19 +01:00
Tamás Bálint Misius
059b3a8e38
Add verb parameter to http.get/post
Also make ENFORCE_HTTPS optional, but default to enabled, so unencrypted HTTP is disabled by default, and require it to be enabled for release binaries.
2022-11-01 19:25:17 +01:00
jacob1
3011e45475
Fix text in some buttons being cut off prematurely 2022-10-31 16:22:34 -04:00