mirror of https://github.com/zeldaret/botw.git
Update libraries and adjust code to match again
This commit is contained in:
parent
96f611fa5d
commit
de0fd08acc
|
@ -1 +1 @@
|
||||||
Subproject commit 362e47b48c27ab51d6e34de11185a0d89bd32a34
|
Subproject commit 8dce6534c41bf304ee9fc44fc99d3023c6fd12bf
|
2
lib/sead
2
lib/sead
|
@ -1 +1 @@
|
||||||
Subproject commit cc672852c6218bf081325cb955dd3d87723d16cc
|
Subproject commit 1decfbfc7f23f11233db326d3796ba96c813fcff
|
|
@ -66,15 +66,15 @@ void HardModeManager::init_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardModeManager::nerfHpRestore(f32* hp) const {
|
void HardModeManager::nerfHpRestore(f32* hp) const {
|
||||||
*hp = sead::Mathf::max(*hp * getMultiplier(MultiplierType::HpRestore), 1.0f);
|
*hp = sead::Mathf::clampMin(*hp * getMultiplier(MultiplierType::HpRestore), 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardModeManager::nerfHpRestore(s32* hp) const {
|
void HardModeManager::nerfHpRestore(s32* hp) const {
|
||||||
*hp = sead::Mathi::max(*hp * getMultiplier(MultiplierType::HpRestore), 1);
|
*hp = sead::Mathi::clampMin(*hp * getMultiplier(MultiplierType::HpRestore), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HardModeManager::modifyEnemyNoticeDuration(f32* value) const {
|
void HardModeManager::modifyEnemyNoticeDuration(f32* value) const {
|
||||||
*value = sead::Mathf::max(*value * getMultiplier(MultiplierType::EnemyNoticeDuration), 0);
|
*value = sead::Mathf::clampMin(*value * getMultiplier(MultiplierType::EnemyNoticeDuration), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HardModeManager::shouldCreateLifeRecoverInfo(ksys::act::Actor* actor) {
|
bool HardModeManager::shouldCreateLifeRecoverInfo(ksys::act::Actor* actor) {
|
||||||
|
|
|
@ -11,9 +11,9 @@ BoxShape* BoxShape::make(const BoxShapeParam& param, sead::Heap* heap) {
|
||||||
hkpBoxShape* box = nullptr;
|
hkpBoxShape* box = nullptr;
|
||||||
if (auto* storage = util::allocStorage<hkpBoxShape>(heap)) {
|
if (auto* storage = util::allocStorage<hkpBoxShape>(heap)) {
|
||||||
const auto radius = param.convex_radius;
|
const auto radius = param.convex_radius;
|
||||||
const hkVector4f half_extents{sead::Mathf::max(param.extents.x / 2 - radius, 0.001),
|
const hkVector4f half_extents{sead::Mathf::clampMin(param.extents.x / 2 - radius, 0.001),
|
||||||
sead::Mathf::max(param.extents.y / 2 - radius, 0.001),
|
sead::Mathf::clampMin(param.extents.y / 2 - radius, 0.001),
|
||||||
sead::Mathf::max(param.extents.z / 2 - radius, 0.001)};
|
sead::Mathf::clampMin(param.extents.z / 2 - radius, 0.001)};
|
||||||
box = new (storage) hkpBoxShape(half_extents, radius);
|
box = new (storage) hkpBoxShape(half_extents, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,9 +122,10 @@ const hkpShape* BoxShape::updateHavokShape() {
|
||||||
if (mFlags.isOn(Flag::Dirty)) {
|
if (mFlags.isOn(Flag::Dirty)) {
|
||||||
{
|
{
|
||||||
const auto radius = mHavokShape->getRadius();
|
const auto radius = mHavokShape->getRadius();
|
||||||
const sead::Vector3f half_extents{sead::Mathf::max(mExtents.x / 2 - radius, 0.001),
|
const sead::Vector3f half_extents{
|
||||||
sead::Mathf::max(mExtents.y / 2 - radius, 0.001),
|
sead::Mathf::clampMin(mExtents.x / 2 - radius, 0.001),
|
||||||
sead::Mathf::max(mExtents.z / 2 - radius, 0.001)};
|
sead::Mathf::clampMin(mExtents.y / 2 - radius, 0.001),
|
||||||
|
sead::Mathf::clampMin(mExtents.z / 2 - radius, 0.001)};
|
||||||
const auto ref_count = mHavokShape->getReferenceCount();
|
const auto ref_count = mHavokShape->getReferenceCount();
|
||||||
mHavokShape = new (mHavokShape) hkpBoxShape(toHkVec4(half_extents), radius);
|
mHavokShape = new (mHavokShape) hkpBoxShape(toHkVec4(half_extents), radius);
|
||||||
mHavokShape->setReferenceCount(ref_count);
|
mHavokShape->setReferenceCount(ref_count);
|
||||||
|
|
|
@ -84,9 +84,9 @@ bool RigidBody::initMotionAccessorForDynamicMotion(sead::Heap* heap) {
|
||||||
|
|
||||||
hkMatrix3 inertia;
|
hkMatrix3 inertia;
|
||||||
body->getInertiaLocal(inertia);
|
body->getInertiaLocal(inertia);
|
||||||
param.inertia = {sead::Mathf::max(inertia(0, 0), MinInertia),
|
param.inertia = {sead::Mathf::clampMin(inertia(0, 0), MinInertia),
|
||||||
sead::Mathf::max(inertia(1, 1), MinInertia),
|
sead::Mathf::clampMin(inertia(1, 1), MinInertia),
|
||||||
sead::Mathf::max(inertia(2, 2), MinInertia)};
|
sead::Mathf::clampMin(inertia(2, 2), MinInertia)};
|
||||||
param.center_of_mass = toVec3(body->getCenterOfMassLocal());
|
param.center_of_mass = toVec3(body->getCenterOfMassLocal());
|
||||||
param.linear_damping = body->getLinearDamping();
|
param.linear_damping = body->getLinearDamping();
|
||||||
param.angular_damping = body->getAngularDamping();
|
param.angular_damping = body->getAngularDamping();
|
||||||
|
@ -126,9 +126,9 @@ bool RigidBody::createMotion(hkpMaxSizeMotion* motion, MotionType motion_type,
|
||||||
|
|
||||||
case MotionType::Dynamic: {
|
case MotionType::Dynamic: {
|
||||||
hkMatrix3f inertia_local;
|
hkMatrix3f inertia_local;
|
||||||
inertia_local.m_col0.set(sead::Mathf::max(param.inertia.x, MinInertia), 0, 0);
|
inertia_local.m_col0.set(sead::Mathf::clampMin(param.inertia.x, MinInertia), 0, 0);
|
||||||
inertia_local.m_col1.set(0, sead::Mathf::max(param.inertia.y, MinInertia), 0);
|
inertia_local.m_col1.set(0, sead::Mathf::clampMin(param.inertia.y, MinInertia), 0);
|
||||||
inertia_local.m_col2.set(0, 0, sead::Mathf::max(param.inertia.z, MinInertia));
|
inertia_local.m_col2.set(0, 0, sead::Mathf::clampMin(param.inertia.z, MinInertia));
|
||||||
|
|
||||||
hkpRigidBody::createDynamicRigidMotion(
|
hkpRigidBody::createDynamicRigidMotion(
|
||||||
hkpMotion::MOTION_DYNAMIC, position, rotation, param.mass, inertia_local,
|
hkpMotion::MOTION_DYNAMIC, position, rotation, param.mass, inertia_local,
|
||||||
|
@ -1630,7 +1630,7 @@ bool RigidBody::isEntityMotionFlag80On() const {
|
||||||
void RigidBody::setColImpulseScale(float scale) {
|
void RigidBody::setColImpulseScale(float scale) {
|
||||||
if (!isEntity())
|
if (!isEntity())
|
||||||
return;
|
return;
|
||||||
scale = sead::Mathf::max(scale, 0.0);
|
scale = sead::Mathf::clampMin(scale, 0.0);
|
||||||
getEntityMotionAccessor()->setColImpulseScale(scale);
|
getEntityMotionAccessor()->setColImpulseScale(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,14 +300,6 @@ float RigidBodyMotionEntity::getMassInv() const {
|
||||||
return mMotion->getMassInv();
|
return mMotion->getMassInv();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float max3(float a, float b, float c) {
|
|
||||||
return sead::Mathf::max(c, a > b ? a : b);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline float min3(float a, float b, float c) {
|
|
||||||
return sead::Mathf::min(a < b ? a : b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RigidBodyMotionEntity::setInertiaLocal(const sead::Vector3f& inertia) {
|
void RigidBodyMotionEntity::setInertiaLocal(const sead::Vector3f& inertia) {
|
||||||
if (mBody->isCharacterControllerType())
|
if (mBody->isCharacterControllerType())
|
||||||
return;
|
return;
|
||||||
|
@ -317,8 +309,8 @@ void RigidBodyMotionEntity::setInertiaLocal(const sead::Vector3f& inertia) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float max = max3(inertia.x, inertia.y, inertia.z);
|
const float max = sead::Mathf::max3(inertia.x, inertia.y, inertia.z);
|
||||||
const float min = min3(inertia.x, inertia.y, inertia.z);
|
const float min = sead::Mathf::min3(inertia.x, inertia.y, inertia.z);
|
||||||
const float threshold = max * 0.8f;
|
const float threshold = max * 0.8f;
|
||||||
|
|
||||||
bool need_to_recreate_motion = false;
|
bool need_to_recreate_motion = false;
|
||||||
|
|
|
@ -551,19 +551,20 @@ void ContactMgr::setImpulseEntryContactInfo(RigidBody* body_a, RigidBody* body_b
|
||||||
const auto relative_vel = linvel_a - linvel_b;
|
const auto relative_vel = linvel_a - linvel_b;
|
||||||
const auto dot_neg = [&](const auto& vec) { return vec.dot(-contact_point_normal); };
|
const auto dot_neg = [&](const auto& vec) { return vec.dot(-contact_point_normal); };
|
||||||
|
|
||||||
float magnitude = is_flag_off ? sead::Mathf::max(0.0, relative_vel.dot(-contact_point_normal)) :
|
float magnitude = is_flag_off ?
|
||||||
sead::Mathf::max(0.0, relative_vel.length());
|
sead::Mathf::clampMin(0.0, relative_vel.dot(-contact_point_normal)) :
|
||||||
|
sead::Mathf::clampMin(0.0, relative_vel.length());
|
||||||
|
|
||||||
if (magnitude >= entry->magnitude) {
|
if (magnitude >= entry->magnitude) {
|
||||||
float i1, i2;
|
float i1, i2;
|
||||||
if (is_flag_off) {
|
if (is_flag_off) {
|
||||||
i1 = sead::Mathf::min(sead::Mathf::max(0.0, dot_neg(linvel_a)), magnitude);
|
i1 = sead::Mathf::min(sead::Mathf::clampMin(0.0, dot_neg(linvel_a)), magnitude);
|
||||||
i2 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_b.dot(contact_point_normal)),
|
i2 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_b.dot(contact_point_normal)),
|
||||||
sead::Mathf::max(0.0, dot_neg(relative_vel)));
|
sead::Mathf::clampMin(0.0, dot_neg(relative_vel)));
|
||||||
} else {
|
} else {
|
||||||
i1 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_a.length()), magnitude);
|
i1 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_a.length()), magnitude);
|
||||||
i2 = sead::Mathf::min(sead::Mathf::max(0.0, linvel_b.length()),
|
i2 = sead::Mathf::min(sead::Mathf::clampMin(0.0, linvel_b.length()),
|
||||||
sead::Mathf::max(0.0, relative_vel.length()));
|
sead::Mathf::clampMin(0.0, relative_vel.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->magnitude = magnitude;
|
entry->magnitude = magnitude;
|
||||||
|
|
|
@ -21,7 +21,7 @@ VFR::~VFR() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VFR::setDelta(u32 core, f32 delta) {
|
void VFR::setDelta(u32 core, f32 delta) {
|
||||||
delta = sead::Mathf::max(delta, 0.01f);
|
delta = sead::Mathf::clampMin(delta, 0.01f);
|
||||||
*mRawDeltaFrames[core] = delta;
|
*mRawDeltaFrames[core] = delta;
|
||||||
*mDeltaFrames[core] = delta * *mIntervalRatios[core];
|
*mDeltaFrames[core] = delta * *mIntervalRatios[core];
|
||||||
*mRawDeltaTimes[core] = delta * mFrameTime;
|
*mRawDeltaTimes[core] = delta * mFrameTime;
|
||||||
|
@ -111,7 +111,7 @@ void VFR::TimeSpeedMultiplier::update(f32 multiplier) {
|
||||||
if (target_value < value) {
|
if (target_value < value) {
|
||||||
value = target_value;
|
value = target_value;
|
||||||
} else {
|
} else {
|
||||||
sead::Mathf::chase(&value, target_value, sead::Mathf::max(value * multiplier, 0.01));
|
sead::Mathf::chase(&value, target_value, sead::Mathf::clampMin(value * multiplier, 0.01));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ float Manager::calcTempDay(float height) const {
|
||||||
float normal_temp = 23.0f;
|
float normal_temp = 23.0f;
|
||||||
|
|
||||||
if (isMainField() && worldInfoLoaded()) {
|
if (isMainField() && worldInfoLoaded()) {
|
||||||
height = sead::Mathf::max(height, 0.0f);
|
height = sead::Mathf::clampMin(height, 0.0f);
|
||||||
|
|
||||||
int a = -1;
|
int a = -1;
|
||||||
float h{};
|
float h{};
|
||||||
|
@ -182,7 +182,7 @@ float Manager::calcTempNight(float height) const {
|
||||||
float normal_temp = 23.0f;
|
float normal_temp = 23.0f;
|
||||||
|
|
||||||
if (isMainField() && worldInfoLoaded()) {
|
if (isMainField() && worldInfoLoaded()) {
|
||||||
height = sead::Mathf::max(height, 0.0f);
|
height = sead::Mathf::clampMin(height, 0.0f);
|
||||||
|
|
||||||
int a = -1;
|
int a = -1;
|
||||||
float h{};
|
float h{};
|
||||||
|
|
|
@ -327,7 +327,7 @@ void TimeMgr::calc_() {
|
||||||
if (!mFindDungeonActivated && mTime >= 11_h)
|
if (!mFindDungeonActivated && mTime >= 11_h)
|
||||||
mTime = 11_h;
|
mTime = 11_h;
|
||||||
|
|
||||||
_d0 = sead::Mathf::max(mTimeStep / DefaultTimeStep, 1.0);
|
_d0 = sead::Mathf::clampMin(mTimeStep / DefaultTimeStep, 1.0);
|
||||||
mBloodMoonTimer += delta;
|
mBloodMoonTimer += delta;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue