Commit Graph

3354 Commits

Author SHA1 Message Date
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
Tamás Bálint Misius
3eb1609934
Preprocessor purge round 4: misc function macros 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
b2b06bf009
Preprocessor purge round 3: spaghetti headers 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
e4c2ec5a00
Preprocessor purge round 2: #pragma once 2023-01-27 09:26:38 +01:00
Tamás Bálint Misius
3a591b8539
Preprocessor purge round 1: simulation constants 2023-01-27 09:26:36 +01:00
jacob1
44d53082eb
Fix memory leak in SaveRenderer (not cleaned up on exit) 2023-01-26 22:41:38 -05:00
jacob1
4c74d25840
Fix graphical artifacts sometimes showing up with ptsave startup arg 2023-01-26 22:40:58 -05:00
jacob1
e824e023f1
Fix WIND tool not reacting to zoom window properly, fixes #899 2023-01-23 20:32:37 -05:00
suve
8ce7a37070 Add missing cstdint includes
Some files have been using various fixed-size types (uint32_t etc.),
which are defined in stdint.h / cstdint, without including said header
file. While this code worked with GCC12 (likely a transitive include),
under GCC13 it fails to build due to "unknown type" errors.
2023-01-21 19:50:55 -05:00
Ksawi
62129e3d34 Add BIZR/BIZG/BIZS ctype serialization 2023-01-17 13:10:10 -05:00
jacob1
4c8cbf49be
Fix Gravity.cpp permission bits, fixes #893 2023-01-16 23:58:50 -05:00
Tamás Bálint Misius
d02242714e
Fix particle maps sometimes being stale when pasting
This restrict effects of paste-time de-stacking to positions under particles being pasted. If this is not done, particles beyond the paste area can be wrongfully killed, see #889.
2023-01-10 08:06:47 +01:00
Tamás Bálint Misius
853c47b0bd
Fix potential crashes due to overeager operator[]s
Some operator[]s that know the size of the container they wrap like to assert(index >= 0 && index < size), which is bad for us because we sometimes use &container[size]. This is not undefined behaviour until that pointer is dereferenced, but certain operator[]s choose to ignore this fact and err on the side of caution. The solution is to use &container[0] + size instead of &container[size].
2023-01-07 15:08:50 +01:00
Tamás Bálint Misius
c6d6a7d0bf
Cap FPS in a more stable way
Time-related variables are now on the nanosecond scale. See #886.
2023-01-05 18:25:41 +01:00
jacob1
225293cc80
Update build number and readme date 2023-01-03 21:02:45 -05:00
jacob1
3a7cdeefd9
Add sim.temperatureScale 2023-01-02 13:25:00 -05:00
Tamás Bálint Misius
55524bc27a
Fix proxy, cafile, capath command line options
Broken by edab57887d.
2023-01-02 18:48:02 +01:00
Tamás Bálint Misius
6e140b580c
Fix vote buttons being wrong on own saves
The buttons are disabled on such saves, and the disabled background colours weren't set.
2023-01-02 16:33:47 +01:00
jacob1
3519dfa83a
Fix pmap not being updated when setting x / y from Lua 2023-01-01 20:42:03 -05:00
Tamás Bálint Misius
80448440e9
Redo Platform::ExecutableName 2023-01-01 18:36:21 +01:00
Tamás Bálint Misius
edab57887d
Redo command line parsing 2022-12-31 10:48:44 +01:00
Tamás Bálint Misius
1da7438e39
Add ability to disable blue screens
This will let us produce crash dumps on user machines.
2022-12-30 08:21:12 +01:00
Tamás Bálint Misius
2bcf32e2cf
Stop relying on _DEBUG 2022-12-30 08:12:12 +01:00
jacob1
4907b84a84
Fix white LIFE being created in some cases, such as from EXOT+NEUT
The default for v is -1, which gets interpreted as a GoL rule with all bits set. Now, it will default to builtin-type GOL when v is -1.
2022-12-29 23:56:50 -05:00
Tamás Bálint Misius
1ffc2055ca
Extend the BETA part of the intro text
So it now includes a warning about local saves and stamps made in a beta potentially being incompatible with older versions.
2022-12-29 12:57:49 +01:00
Tamás Bálint Misius
c5c9c046aa
Fix an uninitialized variable warning
Not an issue in practice because that value is never used unless the accompanying isValid is true, but the compiler can't know that.
2022-12-29 08:46:35 +01:00
jacob1
932f28bcd7
Fix property tool converting x / y values as temperatures 2022-12-28 22:57:03 -05:00
jacob1
d318424038
Update readme date and version numbers 2022-12-27 12:08:47 -05:00
jacob1
f1cf0ade70
Merge pull request #847 from xphere07/temperaturescales
Add temperature scales option
2022-12-27 11:59:16 -05:00
jacob1
2a83d49979
Make CRMC immune to ACID, fixes #851 2022-12-27 11:48:15 -05:00
jacob1
d481bef647
Sent SessionKey in a few more places in Client.cpp 2022-12-27 11:47:57 -05:00
Tamás Bálint Misius
86b6084baf
Vote editing 2022-12-27 17:42:15 +01:00
jacob1
b6cb6801df
Use RenderTemperature method in OptionsView, always re-render it on defocus, and remove degree symbol 2022-12-27 11:33:44 -05:00
xphere07
fe67ec8550
Add temperature scales option
Make the PROP tool default to the current temperature scale
Make the PROP tool's temp suffixes work in the console(This is currently blocked by AnyType doing resource management wrong)

Signed-off-by: xphere07 <xphere07@outlook.com>
2022-12-27 22:07:52 +09:00
Tamás Bálint Misius
6b133aced6
Fix renderer table gradients
The unsigned type would overflow when it was asked to represent negative values.
2022-12-27 08:49:32 +01:00
Tamás Bálint Misius
4304bda6d1
Fix loading of "version 1" PSv saves
These are apparently the ones without sign data. Was broken by c31267b06f.
2022-12-27 07:10:12 +01:00
Tamás Bálint Misius
16df10bc39
Have the intro text hide the HUD completely
Including the right portion, which hadn't been hidden until now.
2022-12-25 22:43:34 +01:00
Tamás Bálint Misius
a3fe59a2c8
Silence a few libcurl warnings
About CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS being deprecated in 7.85.0.
2022-12-25 11:16:54 +01:00
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
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
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
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
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
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
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
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
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
Tamás Bálint Misius
a57bb09d02
Target v141 toolset with msvc, update tpt-libs
Also reduce per-host connection count to 1, now that we support HTTP/2.
2022-10-29 08:42:39 +02:00
jacob1
8fd6db56d1
Fix string handling in text drawing / width functions
Allows passing in null bytes, which allows 0s to be used with \x0F color codes
Also unrelated, fix two warnings in OptionsView.cpp
2022-10-25 22:35:49 -04:00
Tamás Bálint Misius
a3a874f4d6
Get png avatars from the static server
Also restore concurrent connection / stream counts, and fix a bug that would cause AvatarButtons to try to fetch avatars before they knew what name they belonged to. I apparently broke this in the first PNG commit.
2022-10-24 22:12:10 +02:00
Tamás Bálint Misius
59354731df
Remove all PTI code, use libpng to load avatars and thumbnails
Also write PNGs with libpng, and BMPs with SDL, and have the renderer only generate a large PNG thumbnail, and disable HTTP/2 multiplexing for now so we don't get banned when loading avatars.

simon pls reply to the stupid emails already.
2022-10-23 20:21:05 +02:00
Tamás Bálint Misius
ebb87a17c6
Unbundle bzip2 and jsoncpp, update tpt-libs
Also Disallow linking against non-C++ system Lua, unless configuring with -Dworkaround_noncpp_lua=true, add -Dworkaround_elusive_bzip2 and friends, and get rid of the -image_base hack for macos.
2022-10-20 23:15:49 +02:00
jacob1
6338da7cb7
Fix empty string being discarded at beginning of lua log/return lists 2022-10-19 17:28:13 -04:00
Tamás Bálint Misius
715333295b
Add clip rect feature to Graphics and gfx.setClipRect
Also retire the separate VideoBuffer in Panel and hiding ToolButtons in the GameView ToolButton panel in favour of clip rects.
2022-10-11 20:47:39 +02:00
Tamás Bálint Misius
f18bd6553f
Remove long defunct OpenGL code paths 2022-10-11 20:11:14 +02:00
Tamás Bálint Misius
f378b3ac1d
Fix BSON.h rolling its own 64-bit integer types
This is problematic as per a comment on #860, and everything we target has <cstdint> now.
2022-10-10 10:20:55 +02:00
Tamás Bálint Misius
04e8538a48
Fix uninitialized stickmen
Funny commit message aside, they were throwing warnings in valgrind.
2022-10-06 19:42:13 +02:00
Tamás Bálint Misius
d75e4ccb2e
Fix OOB read when parsing empty string as float
I really don't like how the only way to return with an error from ParseFloatProperty is via an exception >_>

Also do a range check on airTemp only if isValid is true, otherwise it's uninitialized.
2022-10-06 19:25:41 +02:00
Tamás Bálint Misius
304cc3a47b
Move Read/WriteFile from Client to Platform 2022-10-05 19:55:04 +02:00
Tamás Bálint Misius
084f196248
Add http.getAuthToken
This website API was created to enable TPTMP to prove the identity of connecting users, and while TPTMP works fine without explicit support for this from the game, it has to resort to parsing powder.pref. This is not only ugly but also likely to be disallowed by the next version of the script manager. This new script manager will probably come after 97.0, so it's okay for it to rely on a game feature that won't be available until 97.0.
2022-10-05 19:55:02 +02:00
Tamás Bálint Misius
e54df0e6ad
More Lua API 8-bit-cleanliness changes
Round 2 of what I started in 36d034dc2e, mostly fixing c_str usage where it's not sensible.
2022-10-05 11:38:35 +02:00
Tamás Bálint Misius
b4462273b0
Fix a very elusive PHOT reflection crash
get_normal_interp is given a PHOT and scans a line section starting from the PHOT, extended in the direction of its velocity, to determine the surface normal of the surface that is reflecting the PHOT. It uses is_boundary to detect "boundaries" on this line section, defined as one "blocking" cell with at least one "non-blocking" non-diagonal neighbour. It never actually makes sure the position it passes to is_boundary is within the simulation area, so I assume is_boundary is expected to handle this correctly.

Plot twist: it does not. It delegates checking whether a cell is "blocking" (defined as something PHOT would normally fail to move into as per eval_move, but GLAS and BLGA are handled specially) to is_blocking. is_blocking returns true for cells beyond the simulation area (as eval_move returns "no move" for such cells). Once is_boundary sees that the cell it's been given is blocking, it then proceeds to check whether any of its non-diagonal neighbours might be non-blocking. In most cases, non-diagonal neighbours of an out-of-bounds cell are also out of bounds and are thus blocking, but if the cell is_boundary is given is in the innermost layer of out-of-bounds cells, just beyond the simulation area, then it has a neighbour that is in bounds, and that one may not block PHOT. The takeaway is that out of bounds cells can indeed be boundaries, as far as is_boundary is concerned.

This is a problem because get_normal_interp's line section can easily reach beyond the simulation area if the PHOT's velocity is high enough, and if it finds a boundary along this line section, it immediately stops looking and passes its position to photoelectric_effect, which then uses this potentially out-of-bounds position to index pmap. A position with y = -1 causes photoelectric_effect to read from the last few slots of parts data that it then interprets as pmap entries, which then may direct it to particles to spark that are beyond parts. This eventually crashes.

This commit doesn't fix is_boundary's definition of boundaries, but it stops get_normal_interp looking at cells beyond the simulation area.

The crash is difficult to reproduce because there have to be many particles in the simulation for the very last slots of parts to be in use, and for them to point to memory that isn't accessible. PHOT also has to survive a try_move beyond the simulation area first (otherwise the reflection code isn't even run), which requires it to start from EHOLE. I have no idea why this is so. Reproduce the out of bounds read in photoelectric_effect with

	break Simulation.cpp:2934 if nx < 0

in gdb and executing the following Lua code:

	sim.clearSim()
	tpt.set_wallmap(55, 44, 12)
	local i = sim.partCreate(-1, 223, 178, 31)
	sim.partProperty(i, "vx", -300)
	sim.partProperty(i, "vy", 0)
	sim.framerender(1)
2022-10-02 22:57:36 +02:00
catsoften
5d66533f23
Make stickman movement strength independent of gravity (#857) 2022-09-25 14:49:43 +02:00
Tamás Bálint Misius
0f9b1a58b1
Add notification for missing or bad SSL certificates
Also add mbedtls to and document new certificate config options in README.md.
2022-09-25 07:22:23 +02:00
Tamás Bálint Misius
09c2704928
Add CAFile and CAPath config options, use mbedtls in static builds
This is how we'll handle systems where the cert bundle and cert directory is stored where mbedtls doesn't expect it.

Also update tpt-libs to get new curl and mbedtls.
2022-09-25 06:13:35 +02:00
Tamás Bálint Misius
25d6ca9dec
Fix crash when trying to load a stamp that doesn't exist 2022-09-11 16:56:40 +02:00
Tamás Bálint Misius
a674498a96
Clean up Client::DoInstallation
Also Factor out app constants that mods might change into Meson options and clean up format::URLEncode in the process, convert app and document icon data in arrays to actual images, actualize AppStream data for possible future packaging, add alternative command line format for opening filesystem saves and ptsave URLs, fix a memory leak in Platform::GetCwd, and add format::URLDecode.
2022-09-08 06:54:35 +02:00
Tamás Bálint Misius
04e899e824
Use std::vector<char> consistently for file operations
This made it possible to get rid of two GameSave constructors.

Also clean up Client::LoadSaveFile, Client::ReadFile, and Client::WriteFile in the process, and remove unused SaveRenderer::Render
2022-09-08 06:45:25 +02:00
Tamás Bálint Misius
69faea971f
Enable By date button when viewing Favorites 2022-09-07 13:01:52 +02:00
Tamás Bálint Misius
513d2cae3e
Update tpt-libs
Also restructure meson.build and the ghactions workflow a bit, and enable -ffunction-sections and -fdata-sections.

Note that starcatcher uploads have not been tested and most likely don't work.
2022-09-03 07:01:21 +02:00
Tamás Bálint Misius
ed13f33e7a
Fix invalid stamps names being accepted
The .size() == 14 check got lost in the last commit.
2022-08-31 18:52:00 +02:00
Tamás Bálint Misius
9e712eba08
Remove dependency on dirent.h on windows
Also fix a few bugs and other weirdness in Platform::DirectorySearch. Empty string paths would crash and filenames with 4 or fewer characters wouldn't register.
2022-08-30 20:39:44 +02:00