assaultcube/AC — pull request #30 by ac-stef (2014-02-01 19:30:11+00:00)
Title: fixing corner physics

AC's cube 1 engine has the ability to create corners (mapeditor key K) not only with single cubes but also on square areas with sidelengths of powers of 2 (2x2, 4x4 etc). Mappers use them for corners between solid walls quite often - a good example is here ac_douze. Go to editmode and press F6 to see, which arts of the map geometry consist of larger blocks than simple 1x1 cubes. The cube engine renderer also supports those corners on non-solid elevated areas, like the platform in the middle of ac_douze. However, the physics engine only handled "solid corners" properly. Corners on platforms were handled as if they were no corners at all. That is not such a big problem for 1x1 corners, but it is quite bad for everything bigger - which is why the platform in ac_douze, although it has double-cube wide corners only uses single corners - 8 for the whole platform.

The reason, why cube supports bigger blocks to build map geometry is, to make rendering cheaper and faster - so, not being able to use the bigger corners on platforms is a huge drawback. To get a feeling for the problem, make a /newmap 5 and raise an aligned block of 16x16 cubes in the middle of the map by four cubes. Then select 8x8 cubes in the corner of those 16x16 and press K. Then leave editmode and jump on the platform - then walk towards the corner. You will see, that according to the game physics, the 16x16 platform is still intact. Now take a screenshot of the platform from an angle, that you can reproduce. Then undo the 8x8 corner and create the same map geometry by using 8 1x1 corners (like every mapper has to do it until now). When done, take a screenshot from the same angle as before. Compare the wqd values of the two screenshots. (Even ac_douze gets a significant wqd reduction, if you change the platform to 2x2 corners.)
You may also notice, that the textures on adjoining 1x1 corners don't fit together very well.

Since the physics engine treated the corners as nonexistent, nade bounces were also wrong. Also, players got stuck walking along corners.

This patch fixes all physics on corner cubes. With the patch, all corner types that the rendering engine supports will work. The patch uses the same code as the renderer to interpret the map geometry data, to get every possible case right. Again: what the renderer can handle, the physics now can, too.

Someone should probably amend the mapping guide to cover creating optimized corners :)

The "prevent nades from jumping out of water" patch fixes the case where a nade is thrown in shallow water. The nade was slowed down while in water - and if it managed to reach the surface again, after bouncing on the floor, it sped up again. To test, use about 0.5 to 0.75 cubes deep water and throw the nade from a platform about 10 cubes high. Thx grenadier, for throwing so many test nades to stumble onto this bug ;)
I'm not sure, if the bug needs fixing. It could also be considered another "cube physics gimmick (TM)".

"fixing edit paste" does exactly that. Without it, the pasted geometry will not be rendered properly.