aboutsummaryrefslogtreecommitdiff
path: root/src/player.cpp
Commit message (Collapse)AuthorAge
* Clean up threadingShadowNinja2015-08-23
| | | | | | | | | | | | | | | | | | | | * Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
* minimap: Add ability to disable from serverkwolekr2015-08-13
|
* Optional reconnect functionalityest312015-07-23
| | | | | | Enable the server to request the client to reconnect. This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
* Remove profiler.h include where it's not needed. Remove some unreachable and ↵Loic Blot2015-07-21
| | | | very old code
* Add list-ringsest312015-06-16
| | | | | | | Adds list-rings, a method to implement item sending between inventories via shift-click. Nice insider feature: a ring consisting of a single inventory list serves as nice clean-up method. Also adds them to minimal game, and the standard inventory. Craft output slots are not supported.
* Fix uninitialized variable Player::local_animation_speedLoic Blot2015-03-28
|
* Player: Fix a deadlock triggered by previous commit ↵Loic Blot2015-03-22
| | | | 0e5e49736c0a5fa29bca257bafc02d7c7a7171c9
* Protect Player::hud from concurrent modificationsLoic Blot2015-03-22
| | | | Sometimes HUD can be modified by ServerThread and EmergeThread results in a crash on client side because the HUD is not correct
* Give full breath after deathSmallJoker2015-02-05
|
* Implement WieldMeshSceneNode which improves wield mesh renderingKahrl2014-11-08
| | | | | | | | | | | | | - Don't create and cache an extruded mesh for every (non-node) item. Instead use a single one per image resolution. - For cubic nodes reuse a single wield mesh too - Improve lighting of the wielded item - Increase far value of wield mesh scene camera, fixes #1770 - Also includes some minor refactorings of Camera and GenericCAO.
* Make players check inventory modification properlyShadowNinja2014-10-01
|
* Simplify player modification checksShadowNinja2014-10-01
|
* Split settings into seperate source and header filesShadowNinja2014-09-21
| | | | This also cleans up settings a bit
* Fix memory leaks in GenericCAO, ShaderSource and Player classessapier2014-07-02
|
* Make player files saving againSmallJoker2014-06-29
|
* Store the maximum player file tries in a constantShadowNinja2014-06-23
|
* Only try to load from possible player filesShadowNinja2014-06-23
|
* Only keep players loaded while they're connectedShadowNinja2014-06-23
|
* Small cleanup of hud add/remove codesapier2014-05-31
|
* Prevent player jumping into nodes from belowBlockMen2014-01-16
| | | | Fixes camera glitch and cheating at drowning
* Add sneak and sneak_glitch to set_physics_override()PilzAdam2013-12-03
|
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
|
* Fix various memory access problems detected by valgrindKahrl2013-08-07
|
* Add set_breath and get_breath to lua API.RealBadAngel2013-07-20
|
* Dont write player files all the timePilzAdam2013-06-28
|
* Print playername when failing to read playerfile and ignore files starting ↵PilzAdam2013-06-22
| | | | with .
* Add drowningPilzAdam2013-06-19
|
* Add ObjectRef.hud_set_hotbar_itemcount and add TOCLIENT_HUD_SET_PARAMKahrl2013-05-26
|
* Generalize hud_builtin_enable into hud_set_flagskwolekr2013-04-25
|
* Move player collisionbox to player classsapier2013-04-25
|
* Added support to disable built-in HUD elementsDiego Martínez2013-04-24
|
* Allow modifying movement speed, jump height and gravity per-player via the ↵MirceaKitsune2013-04-05
| | | | Lua API.
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Some kind of middleway values for player acceleration for nowPerttu Ahola2013-02-15
|
* Restore old acceleration behavior until something is actually agreed on (part 2)Perttu Ahola2013-02-15
|
* Improved Player PhysicsMirceaKitsune2013-02-14
|
* Add InventoryList width property & allow custom crafting grids.Ilya Zhuravlev2012-09-01
|
* minetest.register_on_player_receive_fields()Perttu Ahola2012-07-22
|
* Allow defining player's inventory form in LuaPerttu Ahola2012-07-19
|
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
|
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
|
* Switch the license to be LGPLv2/later, with small parts still remaining as ↵Perttu Ahola2012-06-05
| | | | GPLv2/later, by agreement of major contributors
* Add 'fly' and 'fast' privileges and the underlying privileges-to-client systemPerttu Ahola2012-03-31
|
* Simple fix for camera blinking black when jumping into ceiling with current ↵Perttu Ahola2012-03-29
| | | | smaller collision box
* added PlayerSAO and RemotePlayer, removed ServerRemotePlayerKahrl2012-03-29
|
* Add event manager and use it to trigger soundsPerttu Ahola2012-03-24
|
* LocalPlayer::getStandingNodePos()Perttu Ahola2012-03-24
|
* Revert old 4BS/s walk speed for nowPerttu Ahola2012-03-15
|
* Faster player movement and smaller collision boxPerttu Ahola2012-03-10
|
an class="hl opt">(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); if(version == 0) return 1; else if(version <= 9) return 2; else return 3; } void MapNode::serialize(u8 *dest, u8 version) { if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); if(version <= 21) { serialize_pre22(dest, version); return; } writeU8(dest+0, param0); writeU8(dest+1, param1); writeU8(dest+2, param2); } void MapNode::deSerialize(u8 *source, u8 version) { if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); if(version <= 21) { deSerialize_pre22(source, version); return; } param0 = readU8(source+0); param1 = readU8(source+1); param2 = readU8(source+2); } void MapNode::serializeBulk(std::ostream &os, int version, const MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width, bool compressed) { if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); assert(version >= 22); assert(content_width == 1); assert(params_width == 2); SharedBuffer<u8> databuf(nodecount * (content_width + params_width)); // Serialize content if(content_width == 1) { for(u32 i=0; i<nodecount; i++) writeU8(&databuf[i], nodes[i].param0); } /* If param0 is extended to two bytes, use something like this: */ /*else if(content_width == 2) { for(u32 i=0; i<nodecount; i++) writeU16(&databuf[i*2], nodes[i].param0); }*/ // Serialize param1 u32 start1 = content_width * nodecount; for(u32 i=0; i<nodecount; i++) writeU8(&databuf[start1 + i], nodes[i].param1); // Serialize param2 u32 start2 = (content_width + 1) * nodecount; for(u32 i=0; i<nodecount; i++) writeU8(&databuf[start2 + i], nodes[i].param2); /* Compress data to output stream */ if(compressed) { compressZlib(databuf, os); } else { os.write((const char*) &databuf[0], databuf.getSize()); } } // Deserialize bulk node data void MapNode::deSerializeBulk(std::istream &is, int version, MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width, bool compressed) { if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); assert(version >= 22); assert(content_width == 1); assert(params_width == 2); // Uncompress or read data u32 len = nodecount * (content_width + params_width); SharedBuffer<u8> databuf(len); if(compressed) { std::ostringstream os(std::ios_base::binary); decompressZlib(is, os); std::string s = os.str(); if(s.size() != len) throw SerializationError("deSerializeBulkNodes: " "decompress resulted in invalid size"); memcpy(&databuf[0], s.c_str(), len); } else { is.read((char*) &databuf[0], len); if(is.eof() || is.fail()) throw SerializationError("deSerializeBulkNodes: " "failed to read bulk node data"); } // Deserialize content if(content_width == 1) { for(u32 i=0; i<nodecount; i++) nodes[i].param0 = readU8(&databuf[i]); } /* If param0 is extended to two bytes, use something like this: */ /*else if(content_width == 2) { for(u32 i=0; i<nodecount; i++) nodes[i].param0 = readU16(&databuf[i*2]); }*/ // Deserialize param1 u32 start1 = content_width * nodecount; for(u32 i=0; i<nodecount; i++) nodes[i].param1 = readU8(&databuf[start1 + i]); // Deserialize param2 u32 start2 = (content_width + 1) * nodecount; for(u32 i=0; i<nodecount; i++) nodes[i].param2 = readU8(&databuf[start2 + i]); } /* Legacy serialization */ void MapNode::serialize_pre22(u8 *dest, u8 version) { // Translate to wanted version MapNode n_foreign = mapnode_translate_from_internal(*this, version); u8 actual_param0 = n_foreign.param0; // Convert special values from new version to old if(version <= 18) { // In these versions, CONTENT_IGNORE and CONTENT_AIR // are 255 and 254 if(actual_param0 == CONTENT_IGNORE) actual_param0 = 255; else if(actual_param0 == CONTENT_AIR) actual_param0 = 254; } if(version == 0) { dest[0] = actual_param0; } else if(version <= 9) { dest[0] = actual_param0; dest[1] = n_foreign.param1; } else { dest[0] = actual_param0; dest[1] = n_foreign.param1; dest[2] = n_foreign.param2; } } void MapNode::deSerialize_pre22(u8 *source, u8 version) { if(version <= 1) { param0 = source[0]; } else if(version <= 9) { param0 = source[0]; param1 = source[1]; } else { param0 = source[0]; param1 = source[1]; param2 = source[2]; } // Convert special values from old version to new if(version <= 19) { // In these versions, CONTENT_IGNORE and CONTENT_AIR // are 255 and 254 // Version 19 is fucked up with sometimes the old values and sometimes not if(param0 == 255) param0 = CONTENT_IGNORE; else if(param0 == 254) param0 = CONTENT_AIR; } // Translate to our known version *this = mapnode_translate_to_internal(*this, version); }