10-02-2012, 05:57 AM
I'm refactoring the blockhandlers a bit. I don't like two things about them now:
- the NeedsRandomTicks() virtual function is called, followed by OnUpdate(). Why have two virtual functions, if you can combine them into one and avoid doing a vtable call per each block update. I'm combining the two.
- GetDropCount() / GetDropID() / GetDropMeta() triplet. It uses three vtable calls and doesn't let us drop two different things from a block. Rewriting into ConvertToPickups(cItems & a_Pickups). That would also hook nicely into plugins.
The falling block physics are great, but they still need fine-tuning. Falling blocks need to convert into pickups if they land on torch / rail. And there are bugs on the falling start algorithm when the player holds rclk for a longer time:
- when facing a side of a block, two blocks are placed but only the first one falls, the second one hangs.
- when looking up and placing blocks on a vertical wall above self, two blocks are placed, the top one falls and disappears, the bottom one stays "glued" to the wall.
- the NeedsRandomTicks() virtual function is called, followed by OnUpdate(). Why have two virtual functions, if you can combine them into one and avoid doing a vtable call per each block update. I'm combining the two.
- GetDropCount() / GetDropID() / GetDropMeta() triplet. It uses three vtable calls and doesn't let us drop two different things from a block. Rewriting into ConvertToPickups(cItems & a_Pickups). That would also hook nicely into plugins.
The falling block physics are great, but they still need fine-tuning. Falling blocks need to convert into pickups if they land on torch / rail. And there are bugs on the falling start algorithm when the player holds rclk for a longer time:
- when facing a side of a block, two blocks are placed but only the first one falls, the second one hangs.
- when looking up and placing blocks on a vertical wall above self, two blocks are placed, the top one falls and disappears, the bottom one stays "glued" to the wall.