- Change the character jumping variables and methods from int to char.
- Limit the maxJumps integer value from 0 to 255.
- Allow to set the minimum jump amount to 0.
Details
Diff Detail
Event Timeline
| source/gameengine/Ketsji/KX_CharacterWrapper.cpp | ||
|---|---|---|
| 115 | I have forgotten to change the text from "between 1 and 255" to "from 1 to 255". | |
| source/gameengine/Ketsji/KX_CharacterWrapper.cpp | ||
|---|---|---|
| 113 | I wonder if a value of 0 is useful since we've supported it in the past. I guess it could be used as a quick way to disable jumping from the Python API. | |
Changes:
- Change char to unsigned char.
- Silent clamp values from 1 to 255. (Campbell prefer silent clamping)
| source/gameengine/Ketsji/KX_CharacterWrapper.cpp | ||
|---|---|---|
| 31 | Whilst I recognise this might be a quick hack, I think the user code should be responsible for this, not the character wrapper. Also, shouldn't the PY API enforce unsigned positive, between range? | |
| source/gameengine/Ketsji/KX_CharacterWrapper.cpp | ||
|---|---|---|
| 31 | I am not 100% sure what you mean here. But I try to answer you, how I think what you want to tell me.
This is an existing API. I can't remove the API without breaking existing code. Also it is necessary to get double jumps working with the LB motion actuator.
For converting Python arguments with an integer value, we use PyLong_AsLong which returns a C long representation, with LONG_MAX (2147483647L) as maximum. So we need to manually clamp the range to 255. | |
| source/gameengine/Physics/Bullet/CcdPhysicsController.h | ||
| 431 | Why? | |
| source/gameengine/Ketsji/KX_CharacterWrapper.cpp | ||
|---|---|---|
| 31 | It was a reply to moguri. However, if it works, it's fine to allow 0, after some more thought. | |
Making some of these member functions constant would probably be nice, but that would be better done in a separate patch.