mirror of https://github.com/zeldaret/botw.git
ksys/phys: Update some RigidBody flag names for clarity
This commit is contained in:
parent
c20142ab7b
commit
178108d42c
|
|
@ -47,7 +47,7 @@ RigidBody::RigidBody(Type type, ContactLayerType layer_type, hkpRigidBody* hk_bo
|
|||
mFlags.change(Flag::HighQualityCollidable, isCharacterControllerType());
|
||||
mFlags.change(Flag::IsSensor, layer_type == ContactLayerType::Sensor);
|
||||
mFlags.change(Flag::_10, a7);
|
||||
mFlags.set(Flag::_100);
|
||||
mFlags.set(Flag::UseSystemTimeFactor);
|
||||
}
|
||||
|
||||
RigidBody::~RigidBody() {
|
||||
|
|
@ -184,7 +184,7 @@ void RigidBody::x_0() {
|
|||
auto lock = makeScopedLock(false);
|
||||
|
||||
if (mMotionAccessor) {
|
||||
const bool use_system_time_factor = hasFlag(Flag::_100);
|
||||
const bool use_system_time_factor = hasFlag(Flag::UseSystemTimeFactor);
|
||||
setTimeFactor(use_system_time_factor ? MemSystem::instance()->getTimeFactor() : 1.0f);
|
||||
|
||||
if (isSensor()) {
|
||||
|
|
@ -207,8 +207,8 @@ void RigidBody::setMotionFlag(MotionFlag flag) {
|
|||
|
||||
mMotionFlags.set(flag);
|
||||
|
||||
if (mFlags.isOff(Flag::_20) && mFlags.isOff(Flag::_2)) {
|
||||
mFlags.set(Flag::_2);
|
||||
if (mFlags.isOff(Flag::_20) && mFlags.isOff(Flag::UpdateRequested)) {
|
||||
mFlags.set(Flag::UpdateRequested);
|
||||
MemSystem::instance()->getRigidBodyRequestMgr()->pushRigidBody(getLayerType(), this);
|
||||
}
|
||||
}
|
||||
|
|
@ -315,7 +315,7 @@ void RigidBody::setContactPoints(RigidContactPoints* points) {
|
|||
}
|
||||
|
||||
void RigidBody::freeze(bool should_freeze, bool preserve_velocities, bool preserve_max_impulse) {
|
||||
if (hasFlag(Flag::_80000) == should_freeze) {
|
||||
if (hasFlag(Flag::Frozen) == should_freeze) {
|
||||
if (should_freeze) {
|
||||
setLinearVelocity(sead::Vector3f::zero);
|
||||
setAngularVelocity(sead::Vector3f::zero);
|
||||
|
|
@ -324,40 +324,41 @@ void RigidBody::freeze(bool should_freeze, bool preserve_velocities, bool preser
|
|||
}
|
||||
|
||||
if (!mMotionAccessor) {
|
||||
mFlags.change(Flag::_80000, should_freeze);
|
||||
mFlags.change(Flag::Frozen, should_freeze);
|
||||
return;
|
||||
}
|
||||
|
||||
if (should_freeze) {
|
||||
mMotionAccessor->freeze(true, preserve_velocities, preserve_max_impulse);
|
||||
mFlags.set(Flag::_80000);
|
||||
mFlags.set(Flag::Frozen);
|
||||
} else {
|
||||
mFlags.reset(Flag::_80000);
|
||||
mFlags.reset(Flag::Frozen);
|
||||
mMotionAccessor->freeze(false, preserve_velocities, preserve_max_impulse);
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody::setFixedAndPreserveImpulse(bool fixed, bool mark_linear_vel_as_dirty) {
|
||||
if (hasFlag(Flag::_20000) != fixed) {
|
||||
mFlags.change(Flag::_20000, fixed);
|
||||
if (hasFlag(Flag::FixedWithImpulsePreserved) != fixed) {
|
||||
mFlags.change(Flag::FixedWithImpulsePreserved, fixed);
|
||||
if (!fixed && mark_linear_vel_as_dirty) {
|
||||
setMotionFlag(MotionFlag::DirtyLinearVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
freeze(hasFlag(Flag::_20000) || hasFlag(Flag::_40000), true, true);
|
||||
freeze(hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed), true, true);
|
||||
}
|
||||
|
||||
void RigidBody::setFixed(bool fixed, bool preserve_velocities) {
|
||||
if (hasFlag(Flag::_40000) != fixed) {
|
||||
mFlags.change(Flag::_40000, fixed);
|
||||
if (hasFlag(Flag::Fixed) != fixed) {
|
||||
mFlags.change(Flag::Fixed, fixed);
|
||||
if (!fixed) {
|
||||
setMotionFlag(MotionFlag::DirtyLinearVelocity);
|
||||
setMotionFlag(MotionFlag::_40000);
|
||||
}
|
||||
}
|
||||
|
||||
freeze(hasFlag(Flag::_20000) || hasFlag(Flag::_40000), preserve_velocities, false);
|
||||
freeze(hasFlag(Flag::FixedWithImpulsePreserved) || hasFlag(Flag::Fixed), preserve_velocities,
|
||||
false);
|
||||
}
|
||||
|
||||
void RigidBody::resetFrozenState() {
|
||||
|
|
@ -704,7 +705,7 @@ bool RigidBody::setTimeFactor(float value) {
|
|||
if (sead::Mathf::equalsEpsilon(current_time_factor, value, 0.001))
|
||||
return false;
|
||||
|
||||
if (hasFlag(Flag::_80000))
|
||||
if (hasFlag(Flag::Frozen))
|
||||
return false;
|
||||
|
||||
mMotionAccessor->setTimeFactor(value);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
enum class Flag {
|
||||
IsSensor = 1 << 0,
|
||||
_2 = 1 << 1,
|
||||
UpdateRequested = 1 << 1,
|
||||
_4 = 1 << 2,
|
||||
_8 = 1 << 3,
|
||||
_10 = 1 << 4,
|
||||
|
|
@ -56,7 +56,7 @@ public:
|
|||
_40 = 1 << 6,
|
||||
/// Indicates whether the Havok collidable has been configured to use a higher quality type.
|
||||
HighQualityCollidable = 1 << 7,
|
||||
_100 = 1 << 8,
|
||||
UseSystemTimeFactor = 1 << 8,
|
||||
_200 = 1 << 9,
|
||||
_400 = 1 << 10,
|
||||
_800 = 1 << 11,
|
||||
|
|
@ -65,9 +65,9 @@ public:
|
|||
_4000 = 1 << 14,
|
||||
_8000 = 1 << 15,
|
||||
_10000 = 1 << 16,
|
||||
_20000 = 1 << 17,
|
||||
_40000 = 1 << 18,
|
||||
_80000 = 1 << 19,
|
||||
FixedWithImpulsePreserved = 1 << 17,
|
||||
Fixed = 1 << 18,
|
||||
Frozen = 1 << 19,
|
||||
_100000 = 1 << 20,
|
||||
_200000 = 1 << 21,
|
||||
_400000 = 1 << 22,
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void RigidBodyMotionEntity::processUpdateFlags() {
|
|||
}
|
||||
|
||||
if (hasMotionFlagSet(RigidBody::MotionFlag::DirtyDampingOrGravityFactor)) {
|
||||
if (mBody->hasFlag(RigidBody::Flag::_20000)) {
|
||||
if (mBody->hasFlag(RigidBody::Flag::FixedWithImpulsePreserved)) {
|
||||
body->setLinearDamping(1.0);
|
||||
body->setAngularDamping(1.0);
|
||||
body->setGravityFactor(0.0);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ private:
|
|||
return getRigidBodyMotion();
|
||||
}
|
||||
|
||||
bool arePropertyChangesBlocked() const { return mBody->hasFlag(RigidBody::Flag::_80000); }
|
||||
bool arePropertyChangesBlocked() const { return mBody->hasFlag(RigidBody::Flag::Frozen); }
|
||||
|
||||
sead::Vector3f mLinearVelocity = sead::Vector3f::zero;
|
||||
float mLinearDamping{};
|
||||
|
|
|
|||
Loading…
Reference in New Issue