Commit Graph

6683 Commits (master)

Author SHA1 Message Date
Wuzzy 142928e944
Allow to set maximum star opacity at daytime (#11663) 2022-07-02 19:57:48 +01:00
sfan5 a5f385917d Remove an unused method and header includes 2022-06-28 12:21:12 +02:00
Zughy 18fbc0394b
Remove tile_images and special_materials obsolete code (#12455)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2022-06-28 00:55:01 +01:00
ROllerozxa 35ad006234
Increase max FPS on Android to 60 (#12373) 2022-06-26 14:38:11 +01:00
JosiahWI 4163c872af
Fix two memleak reports from Coverity (#12466) 2022-06-26 14:37:50 +01:00
SmallJoker a463620edb
Re-order sound-related code (#12382)
Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated
'fade' and 'pitch' values on server-side where only one was used anyway.
SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included.

Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the
future. Per-type version numbers are kept for now as a safety rope in a special case.
2022-06-20 21:56:12 +02:00
sfan5 0b41533763
Annotate light spread functions with comments 2022-06-20 21:24:28 +02:00
sfan5 e92a217bd1 Fix CAO light calculation issue 2022-06-19 13:30:11 +02:00
sfan5 a83d81ff45 Fix updating glow on entities
was broken in #10021 more than 2 years ago(!)
2022-06-17 20:50:24 +02:00
savilli ae555465ba
Fix zlib (de)compressor memory leaks 2022-06-16 23:53:23 +02:00
Nathanaël Courant 622d857bed Update my name 2022-06-16 21:38:32 +02:00
sfan5 e9e721b937 Fix entity related bugs
* Make minetest.add_entity() binary-safe
* Fix on_death pushing dummy ObjectRef instead of nil
2022-06-15 17:20:07 +02:00
ROllerozxa 992f501159 Fix Android input box crash 2022-06-14 19:22:22 +02:00
paradust7 7ffc0268df
Inline triLinearInterpolationNoEase and triLinearInterpolation (#12421)
Performance profiling on Linux AMD64 showed this to be a significant bottleneck. The non-inlined functions are expensive due to XMM registers spilling onto the stack.
2022-06-11 20:01:30 +02:00
Lars Müller e7d4ec6834
on_deactivate: distinguish removal and unloading (#11931)
Sometimes you need to be able to do removal-related cleanup, such as removing files from disk, or entries from a database. staticdata obviously isn't suitable for large data. The data shouldn't be removed if the entity is unloaded, only if it is removed.
2022-06-11 20:01:14 +02:00
Lars Müller f4a53f7ee6
No damage effects on hp_max change (#11846) 2022-06-11 20:00:40 +02:00
sfan5 3ac5a24b12
Sanitize player position and speed server-side (#12396) 2022-06-07 21:27:05 +02:00
x2048 3107c98591
Mapblock Mesh BspTree: Increase the depth of block-level splits
... before going node-level triangle search.
Fixes transparent grass on transparent land
2022-06-07 21:26:31 +02:00
paradust7 951604e29f Remove invalid fps_max on Mac 2022-06-06 12:03:28 +02:00
sfan5 14c283a623 Fix crash in commit a69b7abe00 2022-06-05 19:00:14 +02:00
rubenwardy 4baf56520d
Android: Add support for sharing debug.txt (#12370) 2022-06-05 17:42:09 +01:00
sfan5 a69b7abe00 Improve LBMManager::applyLBMs() code
Fixes a possible bug for lbms on content ID zero and removes unsafe casts.
2022-06-05 17:48:51 +02:00
rubenwardy 03d86ea0b4
Add register dialog to separate login/register (#12185)
New users find Minetest's account system confusing.
This change moves username/password to a new dialog,
with login and register buttons added to the Join Game tab.

The old registration confirmation dialog is removed in
favour of the new dialog.

Fixes #8138
2022-06-05 17:47:38 +02:00
savilli 1f39948bc3
Fix BSD iconv declaration 2022-06-05 15:20:29 +02:00
JosiahWI 8e5bd82c4d
fix integer overflow in mapgen (#11641)
* fix integer overflow in mapgen

Some calculations involving the magic seed had overflow because the result of an intermediate arithmetic step could not fit in an s32. By making the magic seed unsigned, the other operand in the equation will be cast to unsigned, and possibly other operands or intermediate operands. This will result in unexpected behavior if an operand is negative, which is technically possible, but logically should not happen.

* comment noise2d bitshift

While working through the code I was momentarily concerned that the right bitshift in noise2d could fill ones in some cases. It turns out that with signed integers, this is indeed true, but this one is shifting an unsigned integer, so the behavior is as expected. I put a comment here to clarify this, in case someone else wonders the same thing down the line.

* noise2d and noise3d unittests

I have added 3 tests each for noise2d and noise3d, testing all zero inputs, a very large seed (case which caused UB in the old implementation) and some fun primes I picked for no particular reason. This should be sufficient to demonstrate that the behavior of the new implementation has not changed. I used uniform initialization because it is a good feature of C++11. Please do not explode.

* uncomment the noise2d bitshift

This reverts commit 583b77ee9f1ad6bb77340ebb5ba51eb9a88ff51c. It's a
well-defined language semantic; it doesn't need to be commented.

* code cleanliness
2022-06-03 20:51:58 -04:00
sfan5 575caa8015 Properly keep noclip state in Game and ClientMap 2022-06-03 21:48:52 +02:00
sfan5 5f3af7d18b Remove obsolete eye_height related workaround
This was added a long time ago in 42bbd5c9ae
and meant to fix prevent the view becoming black when jumping into a
ceiling, this no longer happens today.
2022-06-03 21:48:52 +02:00
Wuzzy 6a6b579c54
Add helper functions to make tool usable n times (#12047) 2022-06-03 21:47:04 +02:00
sfan5 9fc018ded1 Fix use-after-free in node meta cleanup
bug introduced in 8908a91016
2022-05-29 16:30:13 +02:00
sfan5 a9a207685a Reject registering node with empty name
fixes #10769
2022-05-29 14:00:19 +02:00
sfan5 c1d03695d4 Minor code improvements around active block keeping 2022-05-29 14:00:19 +02:00
sfan5 ea74680df4 Immediately activate blocks when a player joins
issue: #10884
This makes it possible for objects to immediately be activated,
but doesn't guarantee it since blocks may still need be emerged.
2022-05-29 14:00:19 +02:00
stefan bb671c3089 Remove debug.get/setmetatable from security whitelist
fixes #12216
2022-05-29 14:00:19 +02:00
sfan5 303329f2d6 Handle lua entity HP changes correctly (like punches)
fixes #11975
2022-05-29 14:00:19 +02:00
sfan5 85c824ed13 Make sure real disconnect reason isn't overwritten
bug introduced in 2f32044273
2022-05-29 14:00:19 +02:00
sfan5 998e4820c9 Fix linking with Postgres libs on older cmake versions
closes #12149
2022-05-29 14:00:19 +02:00
sfan5 5cd7b0c6e4 Remove remains of video mode querying 2022-05-29 14:00:19 +02:00
sfan5 8908a91016 Get rid of node metadata when it becomes empty
fixes #8943
2022-05-29 14:00:19 +02:00
sfan5 261a8db9dd Optimize Server::sendMetadataChanged a bit
The distance check also never worked as intended, now fixed.
2022-05-29 14:00:19 +02:00
sfan5 f195db2d14 Add API function to invoke player respawn
closes #12272
2022-05-29 14:00:19 +02:00
sfan5 da71e86633 Protect a few more settings from being set from mods
Of those settings main_menu_script has concrete security impact, the rest are added out of abundance of caution.
2022-05-29 14:00:19 +02:00
sfan5 bccaf5fc2d Map opaque waving leaves to allfaces drawtype
fixes #9842
2022-05-29 14:00:19 +02:00
sfan5 0c6a029413 Improve a translation string
fixes #11442
2022-05-29 14:00:19 +02:00
x2048 ef22c0206f
Force-update shadows when the world is changed (#12364) 2022-05-26 22:28:34 +02:00
sfan5 8b74257bf3 Reduce size of ContentFeatures structure
On my system this is a reduction from 4664 to 3704 bytes.
This is not for the sake of saving RAM but ensuring
commonly used structures fit into caches better.
2022-05-26 15:49:12 +02:00
sfan5 9a01581cdd Get rid of global buffer that would ruin concurrent MapBlock serialization 2022-05-26 15:49:12 +02:00
sfan5 5d26ac0088 Improve code in mapblock_mesh.cpp a bit 2022-05-26 15:49:12 +02:00
x2048 ed26ed5a1f
Quantize light frustum calculations (#12357)
* Quantize light frustum calculations

Reduces shadow flicker

* Fix function name to match conventions
2022-05-23 23:45:18 +02:00
sfan5 5daafc9d33 Fix hash implementation for SerializedBlockCache 2022-05-23 22:50:58 +02:00
Richard Try e16a470d59
Use unordered_map instead of map for MapSectors 2022-05-23 22:50:49 +02:00
paradust7 367a2d4b29
Add missing concurrency protection in logger (#12325) 2022-05-23 22:50:25 +02:00
Wuzzy 0f9c78c3eb
Fix no_texture.png for unknown nodes with ID < 125 (#12329) 2022-05-23 22:50:10 +02:00
paradust7 9f338f5a56
Replace all uses of core::list with std::list (#12313) 2022-05-22 00:11:59 +02:00
paradust7 2742fef458
Fixes needed to use irrArray backed by std::vector (#12263) 2022-05-22 00:11:49 +02:00
sfan5 2f32044273 Don't ignore server disconnects in client code
If the server stops talking to us without saying bye we
should actually end the in-game session with an error message.
2022-05-21 17:49:55 +02:00
sfan5 9ee3dc71f1 Optimize JSON string (de)serialization routines
stringstreams were shown to be slow when reading/writing single characters
and there is lots of potential by having functions perform on existing
buffers whenever possible.
2022-05-21 17:46:10 +02:00
sfan5 70dc23f996 Improve testSerializeJsonString unit tests
this also removes the requirement that / is escaped, there is
no reason for doing so.
2022-05-21 17:46:10 +02:00
rubenwardy 4e9e230e34
Deprecate game.conf name, use title instead (#12030) 2022-05-21 16:23:30 +01:00
x2048 dc45b85a54
Improve shadow filters (#12195)
* Rewrite shadow filtering for the new distortion
* Calculate penumbra radius using a single sample
* Avoid peter-panning effect due to filtering of short shadows
* Add adaptive filter quality for soft shadows
* Avoid sharp shadows on surfaces without normals (e.g. plants)
* Increase default and maximum soft shadow radius
* Make line numbers in shader errors match the code
2022-05-21 16:49:30 +02:00
x2048 a4ef62f5b2
Fix lighting of upright_sprite entities (#12336)
Use MeshNode materials to set the light since ReadOnlyMaterials is now false
2022-05-20 22:35:03 +02:00
x2048 604fb2b738
Fix lighting of the wield mesh (#12341)
* Assign node light to player before final color blend.
  Fixes day/night lightbank ratio for wield meshes
* Update wield mesh light when changing mesh
2022-05-20 22:33:52 +02:00
paradust7 273bfee9a1
Use std::map instead of core::map (#12301) 2022-05-18 12:31:49 +02:00
savilli af37f9dc54
Remove confusing message in keybindings menu 2022-05-17 20:11:08 +02:00
Dmitry Kostenko 8756b7a735 Initialize wield mesh color when wield_image is set
#12245
2022-05-15 21:44:55 +02:00
sfan5 ec9f157512 Use native packer to transfer globals into async env(s) 2022-05-10 22:37:42 +02:00
Jude Melton-Houghton 7f58887ae3
Support packing arbitrary graphs (#12289) 2022-05-10 22:37:33 +02:00
Jude Melton-Houghton d17d7eba14 Fix cooking and fuel crafts with aliases 2022-05-10 22:37:05 +02:00
Octavian 0f8c46771e Fix possible unreliable behavior due to uninitialized variables 2022-05-10 22:36:25 +02:00
sfan5 f5a8593b11
Add more Prometheus metrics (#12274) 2022-05-09 21:20:58 +02:00
Lars Müller c2898f53bc
HUD: Update selection mesh every frame (#12270)
Fixes outdated selection boxes after entity property changes.
2022-05-09 20:43:47 +02:00
sfan5 a66e6d4dff Consolidate some data structures in MapBlockMesh 2022-05-08 19:12:10 +02:00
sfan5 1fa4f58080 Cache serialized mapblocks during sending
This reduces the
(absolute) time spent in Server::SendBlocks() from 700ms to 300ms
(relative) share of MapBlock::serialize() from 80% to 60%
in a test setup with 10 players and many block changes
2022-05-08 19:12:10 +02:00
ROllerozxa f128f4cba1 Fix mapblock geometry optimisation not working
Caused by the depth sorting PR marking not only transparent nodes to be ignored but also opaque ones with the TILE_MATERIAL_BASIC material type
2022-05-08 19:11:44 +02:00
paradust7 87472150bc
Add benchmarks for json string serialize/deserialize (#12258)
Co-authored-by: sfan5 <sfan5@live.de>
2022-05-06 21:17:16 +01:00
Froggo 45d318a773
Enable chat clickable weblinks by default (#12115)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2022-05-06 21:15:16 +01:00
LoneWolfHT 47cf257c40
Fix Windows Visual Studio actions (#11176)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2022-05-04 22:55:02 +01:00
x2048 cc56ebd90d
Avoid rendering invisible faces of simple nodeboxes (#12262)
* Skip rendering faces adjacent to opaque nodes
* Cancel out opposite faces of adjacent nodebox nodes of the same type

Fixes #6409
2022-05-04 23:44:55 +02:00
Lars Müller 89c82035d8
hud_get: Return precision field for waypoints (#12215) 2022-05-04 20:55:20 +02:00
SmallJoker 3ce5a68cd1
guiScalingFilter: Fix most memory leaks (#12256)
Calls to the cache function ended up creating a new texture regardless whether
the texture is already cached.
2022-05-04 20:55:13 +02:00
paradust7 0704ca0550
Make logging cost free when there is no output target (#12247)
The logging streams now do almost no work when there is no output target for them.

For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing.
2022-05-04 20:55:01 +02:00
sfan5 71a56c3552 Fix broken FPS/dtime counters in debug info
was broken by a89afe1229
2022-05-03 20:17:43 +02:00
sfan5 e7659883cc Async environment for mods to do concurrent tasks (#11131) 2022-05-02 20:56:06 +02:00
sfan5 663c936428 Fix synchronization issue at thread start
If a newly started thread immediately exits then m_running would
immediately be set to false again and the caller would be stuck
waiting for m_running to become true forever.
Since a mutex for synchronizing startup already exists we can
simply move the while loop into it.

see also: #5134 which introduced m_start_finished_mutex
2022-05-02 20:54:55 +02:00
sfan5 56a558baf8 Refactor some Lua API functions in preparation for async env 2022-05-02 20:54:55 +02:00
sfan5 5362f472ff Remove some unused variable from Lua class wrappers 2022-05-02 20:54:55 +02:00
x2048 c7bcebb628
Initialize wield mesh colors when changing item. (#12254)
Fixes #12245
2022-05-01 17:21:00 +02:00
sfan5 a89afe1229 Deal with compiler warnings 2022-04-30 16:49:41 +02:00
sfan5 faecff570c Enable additional warning flags
also make them work with the RelWithDebInfo build type
2022-04-30 16:49:41 +02:00
sfan5 a65f6f07f3 Clean up some auth packet handling related code 2022-04-28 20:05:26 +02:00
sfan5 00f71c3b9d Fix password changing getting stuck if wrong password is entered once 2022-04-28 19:55:36 +02:00
sfan5 3d2bf8fb02 Apply disallow_empty_password to password changes too 2022-04-28 19:55:36 +02:00
sfan5 391eec9ee7 Fix race condition in registration leading to duplicate create_auth calls 2022-04-28 19:55:36 +02:00
Oblomov 0d91ef78dd
Refactor local time getter functions (#12221)
This commit introduces mt_localtime() in src/gettime.h, a wrapper
around the OS-specific thread-safe versions of localtime()
(resp. localtime_s on Windows and localtime_r in other systems).

Per the Open Group recommendation,
«portable applications should call tzset() explicitly before using
ctime_r() or localtime_r() because setting timezone information is
optional for those functions», so we also do a one-shot
call of tzset() (_tzset() on Windows to avoid warning C4996).

The function is used to replace the localtime() calls in
getTimestamp() and makeScreenshot().

(The only reminaing call to localtime() in the tree now is the one in
the local copy of the Lua source code.)
2022-04-28 18:53:33 +02:00
paradust7 7e18a1f1be
Remove HW_buffer_counter after IrrlichtMt fix to remove HWBufferMap (#12232)
Keep code and use version check instead, for backwards compatibility
2022-04-28 18:52:19 +02:00
Wuzzy 7f4fc6f8a7
Show unknown node in debug screen (#12230) 2022-04-28 18:51:46 +02:00
Lars Müller fccf1e2eac
Support CSS Color Module Level 4 (#12204) 2022-04-27 17:00:02 -04:00
Giuseppe Bilotta b55d7cd45a Fix worldaligned textures
As reported in #12197, b0b9732359
introduces a regression in worldalign textures.

The specific change that seems to be responsible for this issue is the
change in order between the computation of the cuboid texture
coordinates and the box edge correction.

Fix #12197 by moving the box edge correction back to before the cuboid
texture coordinates, as it used to be.
2022-04-24 21:11:24 +02:00
Giuseppe Bilotta 23f981c458 Fix some textures not being sent correctly to older clients
Since b2eb44afc5, a texture defined as
`[combine:16x512:0,0=some_file.png;etc`
will not be sent correctly from a 5.5 server to a 5.4 client due to the
overeager detection of unsupported base modifier `[` introducing a
spurious `blank.png^` before the modifier.

Fix this by whitelisting which base modifiers can be passed through
unchanged to the client, and prefix `blank.png` for the others
(which at the moment is just [png:, but the list may grow larger
as new base modifiers are added.)
2022-04-24 21:10:23 +02:00
Lars Müller 4558793caf
Fix some debug info showing despite being disabled in the UI (#12205) 2022-04-21 21:45:47 +02:00
paradust7 7cea688a1c
Fix '[combine' when EVDF_TEXTURE_NPOT is disabled. (#12187)
Stop scaling images to POT immediately when loaded. The 'combine'
modifier hardcodes X and Y coordinates, and so behaves incorrectly
if applied to a scaled image. Images emitted by generateImage()
are already scaled to POT before being used as a texture, so
nothing should break.
2022-04-16 18:50:59 +02:00