al/util: add calcDistance, calcSpeed functions

This commit is contained in:
Fruityloops 2022-01-22 17:56:05 +01:00
parent 6b3ebb4934
commit 0c4e8b1d72
2 changed files with 34 additions and 6 deletions

View File

@ -56474,7 +56474,7 @@ Address,Quality,Size,Name
0x00000071008e4dc0,U,000068,_ZN2al28scaleVelocityExceptDirectionEPNS_9LiveActorERKN4sead7Vector3IfEEf
0x00000071008e4e04,U,000212,_ZN2al29scaleVelocityParallelVerticalEPNS_9LiveActorERKN4sead7Vector3IfEEff
0x00000071008e4ed8,U,000176,_ZN2al13limitVelocityEPNS_9LiveActorEf
0x00000071008e4f88,U,000084,_ZN2al9calcSpeedEPKNS_9LiveActorE
0x00000071008e4f88,O,000084,_ZN2al9calcSpeedEPKNS_9LiveActorE
0x00000071008e4fdc,U,000120,_ZN2al14limitVelocityXEPNS_9LiveActorEf
0x00000071008e5054,U,000120,_ZN2al14limitVelocityYEPNS_9LiveActorEf
0x00000071008e50cc,U,000120,_ZN2al14limitVelocityZEPNS_9LiveActorEf
@ -56513,8 +56513,8 @@ Address,Quality,Size,Name
0x00000071008e730c,U,000144,_ZN2al15isVelocityFastHEPKNS_9LiveActorEf
0x00000071008e739c,U,000084,_ZN2al14isVelocitySlowEPKNS_9LiveActorEf
0x00000071008e73f0,U,000144,_ZN2al15isVelocitySlowHEPKNS_9LiveActorEf
0x00000071008e7480,U,000124,_ZN2al10calcSpeedHEPKNS_9LiveActorE
0x00000071008e74fc,U,000096,_ZN2al10calcSpeedVEPKNS_9LiveActorE
0x00000071008e7480,O,000124,_ZN2al10calcSpeedHEPKNS_9LiveActorE
0x00000071008e74fc,O,000096,_ZN2al10calcSpeedVEPKNS_9LiveActorE
0x00000071008e755c,U,000092,_ZN2al18calcSpeedDirectionEPKNS_9LiveActorERKN4sead7Vector3IfEE
0x00000071008e75b8,U,000124,_ZN2al18calcSpeedExceptDirEPKNS_9LiveActorERKN4sead7Vector3IfEE
0x00000071008e7634,U,000120,_ZN2al6isNearEPKNS_9LiveActorES2_f
@ -56529,8 +56529,8 @@ Address,Quality,Size,Name
0x00000071008e7c28,U,000116,_ZN2al10calcHeightEPKNS_9LiveActorERKN4sead7Vector3IfEE
0x00000071008e7c9c,U,000120,_ZN2al5isFarEPKNS_9LiveActorES2_f
0x00000071008e7d14,U,000104,_ZN2al5isFarEPKNS_9LiveActorERKN4sead7Vector3IfEEf
0x00000071008e7d7c,U,000124,_ZN2al12calcDistanceEPKNS_9LiveActorES2_
0x00000071008e7df8,U,000108,_ZN2al12calcDistanceEPKNS_9LiveActorERKN4sead7Vector3IfEE
0x00000071008e7d7c,O,000124,_ZN2al12calcDistanceEPKNS_9LiveActorES2_
0x00000071008e7df8,O,000108,_ZN2al12calcDistanceEPKNS_9LiveActorERKN4sead7Vector3IfEE
0x00000071008e7e64,U,000136,_ZN2al13calcDistanceVEPKNS_9LiveActorES2_
0x00000071008e7eec,U,000176,_ZN2al13calcDistanceHEPKNS_9LiveActorES2_
0x00000071008e7f9c,U,000144,_ZN2al13calcDistanceHEPKNS_9LiveActorERKN4sead7Vector3IfEES7_

Can't render this file because it is too large.

View File

@ -1,3 +1,31 @@
#include <math/seadVector.h>
#include "al/LiveActor/ActorPoseKeeper.h"
#include "al/util/LiveActorUtil.h"
#include "al/util/MathUtil.h"
namespace al {}
namespace al {
float calcDistance(const al::LiveActor* l1, const al::LiveActor* l2) {
return calcDistance(l1, getTrans(l2));
}
float calcDistance(const al::LiveActor* l1, const sead::Vector3f& vec) {
sead::Vector3f distance = al::getTrans(l1) - vec;
return distance.length();
}
float calcSpeed(const al::LiveActor* actor) {
return actor->mPoseKeeper->getVelocity().length();
}
float calcSpeedH(const al::LiveActor* actor) {
sead::Vector3f verticalized;
al::verticalizeVec(&verticalized, al::getGravity(actor), actor->mPoseKeeper->getVelocity());
return verticalized.length();
}
float calcSpeedV(const al::LiveActor* actor) {
return -actor->mPoseKeeper->getVelocity().dot(al::getGravity(actor));
}
} // namespace al