Commit Graph

6854 Commits

Author SHA1 Message Date
x2048
9b24041394
Improve bloom effect (#12916)
* Remove the built-in exposure factor of 2.5
* Add physics-based bloom (https://learnopengl.com/Guest-Articles/2022/Phys.-Based-Bloom)
* Add luminance scaling for bloom layer to simulate HDR
* Add setting to control bloom strength
2022-11-02 09:09:48 +01:00
Muhammad Rifqi Priyo Susanto
987277de52
Send crosshair setting after the touch screen GUI has been initialized (#12910) 2022-10-31 14:17:50 +01:00
Lars Mueller
88af36dd10 Fix node placement regression 2022-10-31 14:17:28 +01:00
x2048
260de1c2b5
Enable negative values for sun/moon orbit tilt (Northern hemisphere) (#12904) 2022-10-30 16:54:06 +01:00
x2048
485b3b1203 Add comments explaining use of entity glow 2022-10-30 16:53:45 +01:00
x2048
bf1cc1bb84 Apply entity glow before translating to color space 2022-10-30 16:53:45 +01:00
x2048
3e7ee499d6 Always add increment when getting node interior light 2022-10-30 16:53:45 +01:00
x2048
a075d83752 Use the same light level for non-solid draw types as for solid 2022-10-30 16:53:45 +01:00
Lars Müller
077627181e
Allow rotating entity selectionboxes (#12379) 2022-10-30 16:53:14 +01:00
lhofhansl
b829231992
Fix incorrect culling introduced by ##12710 (#12887) 2022-10-28 09:52:54 -07:00
lhofhansl
9aaed75eea
Safety check the map's blocksize (#12895) 2022-10-27 19:31:42 -07:00
x2048
88820cd31c
Shadow list improvements (#12898)
* Remove redundant checks when attaching SM texture to entities.
  Some of the checks were broken, leading to crashes when shadow intensity is set to 0
* Avoid memory leak in shadow casters list when wield mesh changes item stacks
2022-10-26 22:26:09 +02:00
Jean-Patrick Guerrero
16266397ed
GUIInventoryList: Keep item size while moving (#12896) 2022-10-24 13:58:56 +02:00
Jude Melton-Houghton
e86d23daed
Check sizeof(int) and sizeof(size_t) 2022-10-23 21:59:12 +02:00
Riceball LEE
8bdedd2bcf
guiChatConsole: fix the unicode characters crowded together on prompt (#12867)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2022-10-21 17:12:07 +02:00
DS
7153cb8a0b
Fix formspec focus (#12795) 2022-10-21 17:11:41 +02:00
Jude Melton-Houghton
dafdb3edb4
Check for falling float nodes in liquid transform (#12862) 2022-10-18 18:03:05 -04:00
Jude Melton-Houghton
b38ffdec27
Implement vector and node conversion in Lua (#12609)
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-18 18:01:44 -04:00
sfan5
87051fca26
Take geographic distance into account for server list ordering (#12790) 2022-10-17 07:56:28 -04:00
SmallJoker
5d8a4917c5
LocalPlayer: Fix sneaking on nodes with large collisionboxes (#12626) 2022-10-17 07:56:04 -04:00
sfan5
25c5400250 Exclude MSVC from new Lua sanity check 2022-10-15 12:02:02 +02:00
sfan5
f680d10259 Other minor CMake improvements 2022-10-13 23:02:11 +02:00
sfan5
e8ee4cb40d Defer searching for libintl to CMake
resolves #12800
2022-10-13 23:02:11 +02:00
sfan5
af38bae57f Get rid of LuaJIT linking workarounds
...and replace them with a cautionary warning message if someone uses an old version.
The detection is kind of a hack but no choice as upstream is not interested in version numbering.
2022-10-13 23:02:11 +02:00
sfan5
558cbd89fb Add extra check in case someone tries to unbundle Lua 2022-10-13 23:02:11 +02:00
Jude Melton-Houghton
cb725a4555 Speed up find_nodes_in_area (#12845) 2022-10-13 09:35:19 -04:00
fluxionary
6b6f886bcd
object ids are u16, not s16 (#12848) 2022-10-13 08:46:48 -04:00
Jude Melton-Houghton
f7ae70c3d9 Use enum to define custom registry indices 2022-10-13 08:46:16 -04:00
Jude Melton-Houghton
f073e37d2f Test on-lighting node param1 in lighting test 2022-10-13 08:46:16 -04:00
Jude Melton-Houghton
b3503e7853 Embed data directly in mapblocks 2022-10-09 13:43:48 -04:00
Jude Melton-Houghton
8f996e4a7c Remove unused MapBlock functionality 2022-10-09 13:43:48 -04:00
Jude Melton-Houghton
9676364c1f
Optimize lighting calculation (#12797) 2022-10-09 10:50:26 -04:00
fluxionary
440d966b93
add an 'equals' method to ItemStack and compatibility w/ lua '==' (#12771)
Co-authored-by: rubenwardy <rw@rubenwardy.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-09 08:06:09 -04:00
ROllerozxa
be5c675263
Only set quicktune keybinds in debug builds (#12779) 2022-10-06 17:07:57 +01:00
x2048
1e96403954 Use legacy call when rendering to a single texture
Fixes depth buffer in when undersampling > 1
2022-10-04 21:02:42 +02:00
Jude Melton-Houghton
7632af3c73
Consolidate API object code (#12728)
Co-authored-by: sfan5 <sfan5@live.de>
2022-10-04 08:31:36 -04:00
Jude Melton-Houghton
b21fb18379
Disable -ffinite-math-only (#12832) 2022-10-03 12:13:35 -04:00
sfan5
525fc3833c Implement tool use sounds 2022-09-30 14:02:14 +02:00
sfan5
bbdb1929c6 Clean up Game::handleDigging() and some related parts 2022-09-30 14:02:14 +02:00
Muhammad Rifqi Priyo Susanto
13a8948edd
Improve double tap for jump detection (#12793) 2022-09-30 14:02:06 +02:00
Jude Melton-Houghton
e832cee1e6
Avert collision static detection rounding error (#12822) 2022-09-30 06:31:24 -04:00
Wuzzy
6eb7d57ed3
Fix inconsistent craft replacements (#9250) (#12819) 2022-09-30 06:30:39 -04:00
Wuzzy
5e7ea0664a
Fix error msg if craft replacement w/ full inv (#12820) 2022-09-29 20:34:51 +02:00
x2048
9df79a4b2d
Bloom (#12791)
Adds configurable light exposure control and bloom effect (light bleeding) with client-side settings.
2022-09-29 20:34:05 +02:00
Muhammad Rifqi Priyo Susanto
3978b9b8ed
Add crosshair support for Android (#7865)
If enabled, a crosshair will be shown to select object.
This will give Android players a way to play like they play on desktop.
On third-person back camera mode, player is forced to use crosshair.
On third-person front camera mode, player is unable to select anything.

Co-authored-by: ROllerozxa <temporaryemail4meh+github@gmail.com>
Co-authored-by: rubenwardy <rw@rubenwardy.com>
2022-09-29 20:30:33 +02:00
20kdc
b1233056b7
Add zstd compression support (#12515) 2022-09-28 09:06:14 -04:00
DS
0251b01da6
Pause shader animation timer in singleplayer pause menu (#12766)
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-27 16:23:07 -04:00
pecksin
6ac38aa2c8
Restore and enhance bouncy behavior (#11939) 2022-09-27 16:22:36 -04:00
savilli
907dcdcf7b
Add unittests for item movement code (#11885) 2022-09-27 16:22:11 -04:00
Wuzzy
3f801bc096
Fix liquid drawtype faces sometimes not rendering (#12807)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2022-09-26 19:27:47 -04:00
Jude Melton-Houghton
f4a01f3a5d
Avoid duplication of mod metadata in memory (#12562)
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-26 17:03:43 -04:00
Jude Melton-Houghton
03428d9825
Modify PUC Lua to wrap C++ exceptions (#12445) 2022-09-26 07:23:48 -04:00
Jude Melton-Houghton
f916398a54
Add lighting test and benchmark (#12802) 2022-09-26 06:49:08 -04:00
Tobias Frost
7069d99aa6
Fix two spelling mistakes
Co-authored-by: Tobias Frost <tobi@debian.org>
2022-09-25 13:45:27 +02:00
Lars Müller
1317cd12d7
Fix formula used for acceleration (#12353) 2022-09-20 10:55:51 +02:00
DS
11905a6db6
Rename a variable in localplayer.h, resolves a TODO 2022-09-20 10:55:11 +02:00
ndren
2c3f641e0b
Simplify bit flip in sha1.cpp 2022-09-20 10:54:35 +02:00
Jude Melton-Houghton
006d974c58 Catch exceptions in SQLite3 callback 2022-09-18 17:39:09 +02:00
Jude Melton-Houghton
6f5a68b7f7
Allow getmetatable in CSM (#12776) 2022-09-18 17:32:18 +02:00
DS
c9ed059d91
Client map: do frustum culling via planes (#12710) 2022-09-18 15:28:53 +02:00
savilli
9428917870
Fix UAF in craft recipes (#12763)
If you call minetest.clear_craft after minetest.register_alias_force, the craft definition reference may not be removed from m_output_craft_definitions leading to UAF.
2022-09-16 13:20:14 +02:00
William Breathitt Gray
19e936362a
Add support for MINETEST_USERDATA environment variable (#12639)
The MINETEST_USER_PATH environment variable can be used to define a
custom path for Minetest user data. If MINETEST_USER_PATH is empty or
unset, the HOME (or APPDATA on Windows) environment variable is used as
the default user data path; this ensures backwards compatibility with
existing user setups.
2022-09-16 13:19:44 +02:00
Wuzzy
1d04903c19
Add paramtype2s for 4 horizontal rotations and 64 colors (#11431)
4dir is like facedir, but only for 4 horizontal directions: NESW. It is identical in behavior to facedir otherwise. The reason why game makers would want to use this over facedir is 1) simplicity and 2) you get 6 free bits.
It can be used for things like chests and furnaces and you don't need or want them to "flip them on the side" (like you could with facedir).

color4dir is like colorfacedir, but you get 64 colors instead of only 8.
2022-09-16 13:18:55 +02:00
DS
f3f3b752f2
Fix tooltips for dropdown, scrollbar and more (#12747) 2022-09-13 12:48:28 +01:00
SmallJoker
bc3dccca5c
Mainmenu: Properly sort mods and games (#12758)
This also removes trivial and unused pkgmgr functions
Fixes a bug caused by sorting in 2133fc8
2022-09-12 19:24:54 +02:00
Jude Melton-Houghton
fe13f9dfd1
Fix potential use-after-free with item metadata (#12729)
This fixes a use-after-free bug in the case where itemstack metadata is accessed after the itemstack has been garbage-collected.
2022-09-11 19:28:37 +02:00
sfan5
c607bee19e Allow looped animation to be used safely with old clients
fixes #12657
2022-09-10 12:21:29 +02:00
pecksin
adb03ccc6d
Chat weblink: remove comma as delimiter (#12730) 2022-09-10 12:21:15 +02:00
DS
643971c948
Add documentation of sun/moon orientation/scale differences (#12145) 2022-09-06 11:21:55 +01:00
Herman Semenov
038da00e79
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-06 11:21:09 +01:00
x2048
ff6dcfea82
Implement rendering pipeline and post-processing (#12465)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: lhofhansl <lhofhansl@yahoo.com>
2022-09-06 08:25:18 +02:00
x2048
464043b8ab Convert entity glow value to color space before adding to the light 2022-09-04 16:00:13 +02:00
fluxionary
0ab9bf926d
Fix texture_min_size 2022-08-24 22:38:14 +02:00
rubenwardy
2d10fa7867
Prevent loading a world with unresolved dependencies (#12542) 2022-08-19 12:31:36 +01:00
x2048
8c29c4f620
Use Sky class to obtain directional light source position for shadows (#12662)
* Also remove unused Sky::getSkyBodyOrbitTilt method

Fixes misalignment of sun position and shadow direction at high tilt values.
2022-08-17 16:30:05 +02:00
celeron55
3f67215df9
Log sockets into tracestream instead of dstream (#12701) 2022-08-16 15:18:11 +01:00
Elliott Lester
7c5e3cac6a
Apply DPI Scaling to GUIModalMenu (#12693)
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-15 21:19:47 +01:00
x2048
aa2fdc6ef6
Limit force shadow update to urgent blocks (#12692) 2022-08-14 20:29:20 +02:00
Lion
2690585e99
Add handling of environment variables to control terminal/logging colors (#12641) 2022-08-14 20:27:28 +02:00
x2048
d1cbb4bd8a
Reduce the use of porting::getTimeMs() when rendering frames (#12679)
* Avoid calling TimeTaker too frequently in renderMapXXX
* Calculate animation timer once per frame
* Remove code that breaks rendering frame at 2000ms

Co-authored-by: sfan5 <sfan5@live.de>

Co-authored-by: sfan5 <sfan5@live.de>
2022-08-13 22:33:26 +02:00
Lars Müller
0e439b2fa3
Check hp_max > 0 for entities (#12667) 2022-08-13 15:35:41 +01:00
Jude Melton-Houghton
ab8dfb45b4
Allow buffer argument to VoxelManip:get_light_data (#12682) 2022-08-13 08:53:47 +02:00
fluxionary
59601eb922
Remove default keybind for range select (#12632)
Reason: accidental key presses, few use-cases.
2022-08-13 08:53:30 +02:00
SmallJoker
023a1c2427
Textures: introduce world-align overrides (#12540)
Many games do not care about world align textures, however texture packs should have the capabilities to change that if they have suitable textures. This commmit now introduces a node property override for world-align in particular to force a certain scale on the selected override tiles.
2022-08-13 08:52:16 +02:00
SmallJoker
c8ee755c05
Physics overrides: Move values to a common struct (#12591)
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-12 10:17:02 +01:00
Zughy
bcc56803d7
Fix crash when stars are reset 2022-08-10 18:03:57 +02:00
sfan5
4fbcc33ee0 Enable C++ stdlib assertions in debug flags 2022-08-05 13:04:01 +02:00
sfan5
c4277877b6 Bump protocol version
Better late than never.
2022-08-04 22:45:52 +02:00
ROllerozxa
eb49b6d85c
Disable dynamic shadow dropdown on OGLES2 (#12637)
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-04 20:42:43 +02:00
x2048
644f145ff2 Explicitly initialize value of particle parameter. Fixes #12621. 2022-08-02 23:51:50 +02:00
SmallJoker
a81259d19a
Run Minetest update checker on startup (#7629)
This feature is enabled by default for non-Android release builds. Package
maintainers may use -DENABLE_UPDATE_CHECKER=0 to disable it.

Co-authored-by: rubenwardy <rw@rubenwardy.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-08-02 21:34:17 +02:00
sfan5
f22d40975e Switch MeshUpdateQueue to better data structure 2022-08-02 11:58:26 +02:00
sfan5
4c1ef1b72b Ratelimit MeshUpdateQueue::cleanupCache() runs 2022-08-02 11:58:26 +02:00
AFCMS
6ec6acc539
Add minetest.settings to CSM API and allow CSMs to provide settingtypes.txt (#12131)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2022-08-02 11:58:08 +02:00
x2048
839600ed70
Use legacy image implementation (no NNAA filter) when not using 9-slice image (#12608) 2022-07-31 21:57:13 +02:00
Mantar
95d7fcb949
Apply NetBSD string conversion workaround to OpenBSD as well (#12618) 2022-07-31 15:18:19 +02:00
ROllerozxa
de509d05e6
Fix Android blank screen (#12604)
Hardcode the variables to 0 on Android
2022-07-31 15:18:04 +02:00
SmallJoker
c14b7536a4 HUD: Fix wrong minimum scale since 051181f
Caused by wrong interpretation of the settingtypes.txt format
2022-07-31 14:57:19 +02:00
rubenwardy
a871115889
Fix some warnings (#12615) 2022-07-30 12:51:23 +01:00
Lars Müller
99c8295e71
Fix media overriding regression (#12602) 2022-07-29 10:19:36 +02:00
sfan5
6611d7e1ee Allow direction keys with autoforward again
This was unintentionally removed in commit 1d69a23.
fixes #12048
2022-07-29 10:19:23 +02:00
Jude Melton-Houghton
d631f21024
Let core.get_mod_storage be called multiple times (#12572) 2022-07-23 22:27:07 +02:00
updatepo.sh
eea2a97475 Update minetest.conf.example 2022-07-20 21:36:03 +02:00
x2048
70c54abc2a
Restore flags texture to fix interlaced stereo mode (#12560) 2022-07-19 20:26:57 +02:00
x2048
b270a46e53
Offset cuboid origin after scaling the cuboid. (#12558)
This avoids the problem of offset nodes with visual_scale > 1.
2022-07-19 10:48:00 +02:00
Lars Müller
d400a98ef0
Fix automatic rotate for attached entities (#12392) 2022-07-17 14:45:57 +01:00
x2048
7b6c4bf2e0
Remove workaround for normals not matching winding order (#12460)
Co-authored-by: sfan5 <sfan5@live.de>
2022-07-17 14:45:42 +01:00
rubenwardy
4648d8f499
Deprecate loading a world with unresolved dependencies (#12541)
Co-authored-by: sfan5 <sfan5@live.de>
2022-07-17 14:45:20 +01:00
rubenwardy
9f41b4f72d Add check_mod_configuration to main menu 2022-07-14 22:12:54 +01:00
rubenwardy
06de82fd86 Refactor ModConfiguration 2022-07-14 22:12:54 +01:00
sfan5
1d512ef7f4 Reduce code duplication between c_converter.cpp and helper.cpp 2022-07-14 20:55:45 +02:00
sfan5
8ff3fadba0 Remove unnecessary float limits from script API
Leaves a check for NaN and inf.
2022-07-14 20:55:45 +02:00
sfan5
137eef6590 Move f1000 sanitizing to the places that still use this type 2022-07-14 20:55:45 +02:00
SmallJoker
f4c6ed863d
GUIFormSpecMenu: Fix label multiline translation (#12527) 2022-07-14 20:51:01 +02:00
Dmitry Kostenko
6df69f9b5b Make BlendMode::alpha the fallback for unknown future blend modes 2022-07-13 22:45:05 +02:00
Lexi Hale
20bd6bdb68
Animated particlespawners and more (#11545)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Dmitry Kostenko <codeforsmile@gmail.com>
2022-07-13 11:57:12 +02:00
SmallJoker
8724fe6e3f GUIFormSpecMenu: Fix parameter order
Fixes a regression caused by e51f47461 because C++ implicitly converts boolean to float. no matter what.
2022-07-10 15:34:53 +02:00
SmallJoker
e51f474613
Sounds: Various little improvements (#12486)
Use SimpleSoundSpec where reasonable (OpenAL)
Ensure the sound IDs do not underflow or get overwritten -> loop in u16
Proper use of an enum.
2022-07-09 22:32:24 +02:00
SmallJoker
051181fa6e
Enforce limits of settings that could cause buggy behaviour (#12450)
Enforces the setting value bounds that are currently only limited by the GUI (settingtypes.txt).
2022-07-09 22:32:08 +02:00
x2048
7c261118e0
Release shadow mapping resources when not needed (#12497) 2022-07-09 22:26:39 +02:00
Vincent Robinson
f7bcf7fa46
FormSpec: 9-slice images, animated_images, and fgimg_middle (#12453)
* FormSpec: 9-slice images and animated_images

* Add fgimg_middle; clean up code

* Address issues, add tests

* Fix stupid error; bump formspec version

* Re-add image[] elements without a size
2022-07-03 08:52:26 -04:00
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 a69b7abe00fb818fd88f3cd04e7f9997ffd21072 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 42bbd5c9ae06a8d8ffb7915599097ead6f848755
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 8908a9101608d3343023b470743ef63f1c44b0b7
2022-05-29 16:30:13 +02:00