Commit Graph

531 Commits

Author SHA1 Message Date
red-001 f3ad75691a Create a filesystem abstraction layer for CSM and only allow accessing files that are scanned into it. (#5965)
* Load client-side mods into memory before executing them.

This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure.

* Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory.

* Fix the issues with backtrace

* fix most of the issues

* fix code style.

* add a comment
2017-06-30 20:14:39 +02:00
Loïc Blot b3a36f7378 Isolate irrlicht references and use a singleton (#6041)
* Add Device3D class which will contain IrrlichtDevice interface

move getSupportedVideoDrivers to Device3D

Add Device3D singleton & use it in various places

Rename Device3D to Rendering engine & add helper functions to various device pointers

More singleton work

RenderingEngine owns draw_load_screen

move draw functions to RenderingEngine

Reduce IrrlichtDevice exposure and guienvironment

RenderingEngine: Expose get_timer_time() to remove device from guiEngine

Make irrlichtdevice & scene manager less exposed

* Code style fixes

* Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine

Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly

* enum paralax => enum parallax
2017-06-26 20:11:17 +02:00
Loic Blot 8a84e89922
Game::showOverlayMessage: securise function
Do wgettext call directly in the function instead of caller, as we destroy wstd inside it
2017-06-24 11:43:17 +02:00
Wuzzy 08f57e1e38 Show param1 and param2 in debug screen (#6031)
* Show param1 and param2 in debug screen

* Add units and some formatting to debug screen

* Minor refactor of param1/param2 debug display
2017-06-23 13:31:01 +02:00
Dániel Juhász 0fcaf9fb1b Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2017-06-20 11:19:56 +02:00
Loic Blot 8f2e60a961
Client::makeScreenshot: remove device param
We already have the device param as class member
2017-06-19 00:00:55 +02:00
Loïc Blot 8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
Loïc Blot 65819f3b9f Use thread_local instead from some static settings (#5955)
thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places.

Add thread_local to undersampling calculation too.
2017-06-11 13:58:43 +02:00
QrchackOfficial 5cc8ad946e Remove superfluous pointer null checks 2017-06-10 21:04:47 -04:00
Paramat 0a5c3c2852 Autorun: Change to 'autoforward' (#5926)
Minetest does not have 'run'.
Automatic forwards is very often used while flying or swimming, so a general
word is more suitable.
2017-06-08 09:57:00 +02:00
ShadowNinja 7786521f15 Fix segmentation fault with tool capabilities (#5899) 2017-06-03 23:59:17 +02:00
Vincent Glize dd0a058e1f Snake case for screen options in minetest.conf (#5792) 2017-06-03 22:02:07 +02:00
red-001 2f291e6685 Close formspec on client shutdown. (#5811)
This ensures the shutting down progress bar is correctly rendered. This fixes #3050.
2017-05-25 12:46:24 +02:00
Paramat 9ff5302c8b Client crashfix: load meta after digging (#5801)
Fixes a crash caused in MTGame by breaking and right-clicking a chest.

If loading meta, digging, node can disappear and we looked at meta, which is wrong because meta became NULL.

Pointer is invalidated and we read wrong memory area
2017-05-23 19:54:37 +02:00
you 358074b296 Fix instant digging (#5785)
Use runData.dig_time_complete instead of params.time to find out whether it's instant digging.
runData.dig_time_complete is set to something very big if the node can't be dug, whereas param.time is 0 when digging is impossible or it's instant digging. So not using param.time fixes #5728.
2017-05-20 20:43:13 +02:00
Loïc Blot e25a38e3fb When minimap is disabled in configuration, really disable it (#5771)
* When minimap is disabled in configuration, really disable it
2017-05-19 07:25:27 +02:00
SmallJoker febd07fc0d No cursor lock when window inactive (#5754) 2017-05-13 17:42:42 +02:00
Loïc Blot 6673aff685 Limit properly the sound setting at updateSound runtime step (#5753)
* Limit properly the sound setting at updateSound runtime step

Fix #5026

* Add a comment
2017-05-13 12:03:11 +02:00
Loïc Blot 9b8ca3a746 Move KeyList & InputHandler from game.h to client/inputhandler.h (#5752)
* Move KeyList & InputHandler from game.h to client/inputhandler.h

We have a header for inputs, move inputhandler class & related keylist object to it

Also introduce a cpp file for MyEventReceiver::OnEvent function in inputhandler.h because a so huge function doesn't needs to be inlined

* Pass clang-format on inputhandler.{cpp,h} (compatible)
2017-05-13 11:05:16 +02:00
Loic Blot 5cb7f6a9b7
Android build fix 2017-05-13 09:10:43 +02:00
red-001 98327a59c4 Minor pause/escape menu improvements (#5751)
- Split movement keys into separate entries.
- Increase buffer size due to the above change.
- Change capitalisation.
- Remove code-style violating white spaces.
2017-05-13 08:50:19 +02:00
red-001 0e0c824ea7 Rework escape/pause menu (#5719)
* Rework escape/pause menu

- Remove build information
- Use current controls instead of default controls
- Add information about the current server in place of the build information
- Add text saying the game is paused to if in singleplayer mode.
rework pause/escape menu

* improve consistency + display server_name
2017-05-11 10:39:37 +02:00
Wuzzy 07c17db114 Add configurable key bindings for hotbar scrolling, and for changing volume. 2017-05-06 21:21:59 +02:00
red-001 5ebf8f9450 [CSM] add `on_item_use` (#5544) 2017-05-06 21:12:44 +02:00
TeTpaAka 6658ad3d94 Make players respect makes_footstep_sound in the object properties 2017-05-06 20:16:16 +02:00
Loïc Blot 21e0a049f8 Save minetest screen width/height options when modified (#5683)
* Save minetest screen width/height options when modified

* Add autosave_screensize setting (default true)

* Fix @SmallJoker comments
2017-05-05 13:47:11 +02:00
red-001 ae0d8f74d7 Add function to get server info. 2017-05-04 04:25:45 +01:00
paramat ad9fcf859e Set sky API: Add bool for clouds in front of custom skybox
Default true.
Add 'm_clouds_enabled' bool to sky.h, set from new bool in 'set sky' API.
Make 'getCloudsVisible()' depend on 'm_clouds_enabled' instead of
'm_visible' (whether normal sky is visible).
2017-05-02 20:42:35 -07:00
Ben Deutsch f1d7a26b7c Add clouds API 2017-04-30 00:06:13 +01:00
Loïc Blot 3db66b4531 Client & ClientEnvirnment: don't create fake events (#5676)
Instead of create fake events on the stack on each loop call (Game::run), verify is queue is empty or not and handle event directly if there is.

This prevents fake ClientEvent creation & memory allocations

Same fix is also applied on ClientEnvironment, & rename getClientEvent to getClientEnvEvent to match ClientEnvEvent object
2017-04-29 17:25:25 +02:00
Vincent Glize dc5bc6cac7 [CSM] Add event on_place_node API lua (#5548)
* [CSM] Add event on_place_node API lua
2017-04-29 12:08:16 +02:00
you 7f4cdbcbe9 Fix click-digging torches (#5652)
Torches are dug instantly again.
When the digging time is 0, a delay of 0.15 seconds is added between digging nodes. If the left mouse button is released, the delay is set to 0, thus click-digging.
2017-04-28 20:12:28 +02:00
Louis Pearson 04ba2d2721 Search user path for sounds (#5657) 2017-04-27 21:33:59 +10:00
ShadowNinja 2818d3f224 Rename Scripting API files for consistency 2017-04-25 13:41:36 -04:00
Loïc Blot a7e131f53e Fix various points reported by cppcheck (#5656)
* Fix various performance issues reported by cppcheck + code style (CI)

* Make CI happy with code style on master
* guiFileSelectMenu: remove useless includes
* some performance fixes pointed by cppcheck
* remove some useless casts
* TextDest: remove unused setFormSpec function

* Fix various iterator post-increment reported by cppcheck
2017-04-25 10:21:42 +02:00
Loïc Blot f3fe62a0bf Fix various copy instead of const ref reported by cppcheck (#5615)
* Also remove InventoryList::peekItem unused function
* Fix some post increment to preincrement reported by cppcheck
2017-04-19 23:02:07 +02:00
Hybrid Dog 858c722974 Tools: Fix tool digging speed limit 2017-04-19 02:01:15 +01:00
Loïc Blot cf37a55690 Fix various variables passed by copy instead of const ref (#5610)
Pointed by cppcheck
2017-04-19 00:36:30 +02:00
Loïc Blot 73de17afa8 Android progressbar fix (#5601)
* Fix progressbar for Android

Fixes #5599
Fixed #5403 

* draw_load_screen: use texturesource
  this permits to unify texture loading code
* scale progress bar

* Add gl version check for GL_OES_texture_npot. This fixed the texture on loading screen

* Remove two sanity checks pointed by @celeron55

* sfan5 comments + android ratio fixes
2017-04-16 14:44:15 +02:00
Ekdohibs a5c9174bad Fix spacing 2017-04-06 21:27:29 -07:00
Ekdohibs 08b680d588 Fix problems when overriding the hand:
- If the hand can dig a node the item wielded can't, allow to dig it anyway.
- Fix the API callbacks from setting the hand instead of the wielded item.
2017-04-06 21:27:29 -07:00
orwell96 63e175dd70 Show media download progress in percent on progress screen (#5498) 2017-04-07 00:03:29 +02:00
red-001 e70e15134c Change command prefix to "." and add "help" command. 2017-03-26 05:51:14 +01:00
Loïc Blot 072bbba69a Some performance optimizations (#5424)
* Some performance optimizations

This is globally removing some memory useless copy

* use a const ref return on std::string Settings::get to prevent data copy on getters which doesn't need to copy it
 * pass some stack created strings to static const as they are not modified anywhere
 * Camera: return nametags per const ref instead of a list pointer, we only need to read it
 * INodeDefManager: getAll should be a result ref writer instead of a return copy
 * INodeDefManager: getAlias should return a const std::string ref
 * Minimap: unroll a Scolor creation in blitMinimapPixersToImageRadar to prvent many variable construct/destruct which are unneeded (we rewrite the content in the loop)
 * CNodeDefManager::updateAliases: prevent a idef getall copy
 * Profiler: constness
 * rollback_interface: create real_name later, and use const ref
 * MapBlockMesh updateFastFaceRow: unroll TileSpec next_tile, which has a cost of 1.8% CPU due to variable allocation/destruction,
 * MapBlockMesh updateFastFaceRow: copy next_tile to tile only if it's a different tilespec
 * MapBlockMesh updateFastFaceRow: use memcpy to copy next_lights to lights to do it in a single cpu operation
2017-03-22 21:41:02 +01:00
Ben Deutsch e7246d3f0d Refactored client event if-else cascade to switch statement 2017-03-20 18:35:33 +00:00
Loïc Blot 3c4ac70348 Refactor Game class (part 2) (#5422)
* showPauseMenu is now part of game
* remove many flags parameters passed to game functions, use the member.
* rename VolatileRunFlags to GameUIFlags (this will permit to share structure with client and CSM
* updatePointedThing: remove pointer ref, we already have the pointer in rundata
* move some attributes outside of VolatileRunFlags after renaming, to game class
* rename statustext to m_statustext
* make some const variables static
* All those changes permit to reduce a little bit function class cost and will permit to interface CSM with some interesting Game flags
* Expose GameUIFlags to client
* Client now have GameUIFlags parameter and setters for other classes
* Fix minimap show/hide in Lua because we now have access to the real flag
2017-03-19 13:18:52 +01:00
ShadowNinja b8484ef24e Server list cleanup
This removes the hacky server_dedicated pseudo-setting.
2017-03-18 12:37:57 +01:00
Loic Blot 9f4916a452
TOGGLE_CHAT keymap should togglechat not HUD
Fixes #5413
2017-03-18 10:00:04 +01:00
Loïc Blot a7485e40ff Reduce memory & function cost of Game class functions (#5406)
GameRunData is passed on many game functions, or one of its attributes whereas it's a member of the class. Remove it from functions arguments and call object directly from concerned functions.
This will reduce a little bit the Game class loop usage & very little bit the memory usage (due to non creation of pointer/references)
2017-03-17 22:15:25 +01:00
Loïc Blot 7b74f04a61 [CSM] Fix minimap problems (#5405)
This fixes issue #5404
2017-03-17 07:54:49 +01:00