mirror of
https://github.com/MonsterDruide1/OdysseyDecomp.git
synced 2024-11-22 21:09:43 +00:00
Library/MapObj: Implement SurfMapParts
(#195)
Some checks are pending
Compile and verify functions / compile_verify (push) Waiting to run
Copy headers to separate repo / copy_headers (push) Waiting to run
lint / clang-format (push) Waiting to run
lint / custom-lint (push) Waiting to run
progress / publish_progress (push) Waiting to run
testcompile / test_compile (push) Waiting to run
Some checks are pending
Compile and verify functions / compile_verify (push) Waiting to run
Copy headers to separate repo / copy_headers (push) Waiting to run
lint / clang-format (push) Waiting to run
lint / custom-lint (push) Waiting to run
progress / publish_progress (push) Waiting to run
testcompile / test_compile (push) Waiting to run
This commit is contained in:
parent
36fb2fa78f
commit
799f31bd28
@ -30477,7 +30477,7 @@ Address,Quality,Size,Name
|
||||
0x00000071004bd21c,U,000052,_ZN2al19createActorFunctionINS_14SeesawMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd250,U,000052,_ZN2al19createActorFunctionINS_13SlideMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd284,U,000052,_ZN2al19createActorFunctionINS_19SubActorLodMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd2b8,U,000052,_ZN2al19createActorFunctionINS_12SurfMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd2b8,O,000052,_ZN2al19createActorFunctionINS_12SurfMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd2ec,U,000052,_ZN2al19createActorFunctionINS_13SwingMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd320,U,000052,_ZN2al19createActorFunctionINS_20SwitchDitherMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd354,U,000052,_ZN2al19createActorFunctionINS_19SwitchKeepOnWatcherEEEPNS_9LiveActorEPKc
|
||||
@ -58487,11 +58487,11 @@ Address,Quality,Size,Name
|
||||
0x000000710091a05c,U,000004,_ZN2al28SupportFreezeSyncGroupHolderD0Ev
|
||||
0x000000710091a060,U,000004,_ZThn264_N2al28SupportFreezeSyncGroupHolderD1Ev
|
||||
0x000000710091a064,U,000008,_ZThn264_N2al28SupportFreezeSyncGroupHolderD0Ev
|
||||
0x000000710091a06c,U,000224,_ZN2al12SurfMapPartsC2EPKc
|
||||
0x000000710091a14c,U,000236,_ZN2al12SurfMapPartsC1EPKc
|
||||
0x000000710091a238,U,000240,_ZN2al12SurfMapParts4initERKNS_13ActorInitInfoE
|
||||
0x000000710091a328,U,000424,_ZN2al12SurfMapParts7exeWaitEv
|
||||
0x000000710091a4d0,U,000008,
|
||||
0x000000710091a06c,O,000224,_ZN2al12SurfMapPartsC2EPKc
|
||||
0x000000710091a14c,O,000236,_ZN2al12SurfMapPartsC1EPKc
|
||||
0x000000710091a238,O,000240,_ZN2al12SurfMapParts4initERKNS_13ActorInitInfoE
|
||||
0x000000710091a328,O,000424,_ZN2al12SurfMapParts7exeWaitEv
|
||||
0x000000710091a4d0,O,000008,_ZNK12_GLOBAL__N_119SurfMapPartsNrvWait7executeEPN2al11NerveKeeperE
|
||||
0x000000710091a4d8,U,000168,_ZN2al13SwingMapPartsC2EPKc
|
||||
0x000000710091a580,U,000180,_ZN2al13SwingMapPartsC1EPKc
|
||||
0x000000710091a634,U,000380,_ZN2al13SwingMapParts4initERKNS_13ActorInitInfoE
|
||||
|
Can't render this file because it is too large.
|
16
lib/al/Library/Collision/CollisionPartsKeeperUtil.h
Normal file
16
lib/al/Library/Collision/CollisionPartsKeeperUtil.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <math/seadVector.h>
|
||||
|
||||
namespace al {
|
||||
class CollisionPartsFilterBase;
|
||||
class IUseCollision;
|
||||
class Triangle;
|
||||
class TriangleFilterBase;
|
||||
} // namespace al
|
||||
|
||||
namespace alCollisionUtil {
|
||||
bool getFirstPolyOnArrow(const al::IUseCollision*, sead::Vector3f*, al::Triangle*,
|
||||
const sead::Vector3f&, const sead::Vector3f&,
|
||||
const al::CollisionPartsFilterBase*, const al::TriangleFilterBase*);
|
||||
}
|
@ -8,6 +8,8 @@
|
||||
|
||||
namespace al {
|
||||
class ByamlIter;
|
||||
class CollisionParts;
|
||||
class LiveActor;
|
||||
|
||||
struct KCPrismHeader {
|
||||
u32 mPositionsOffset;
|
||||
@ -189,4 +191,20 @@ private:
|
||||
f32 mPrevStep;
|
||||
};
|
||||
|
||||
class CollisionPartsFilterBase {
|
||||
public:
|
||||
virtual bool isInvalidParts(CollisionParts* collisionParts) = 0;
|
||||
};
|
||||
|
||||
class CollisionPartsFilterActor : public CollisionPartsFilterBase {
|
||||
public:
|
||||
CollisionPartsFilterActor(LiveActor* actor) : mActor(actor) {}
|
||||
|
||||
bool isInvalidParts(CollisionParts* collisionParts) override;
|
||||
|
||||
private:
|
||||
LiveActor* mActor;
|
||||
bool mIsCompareEqual = true;
|
||||
};
|
||||
|
||||
} // namespace al
|
||||
|
@ -168,6 +168,7 @@ void addRotateAndRepeatZ(LiveActor* actor, f32);
|
||||
void addRandomRotateY(LiveActor* actor);
|
||||
void calcQuatSide(sead::Vector3f*, const LiveActor* actor);
|
||||
void calcQuatUp(sead::Vector3f*, const LiveActor* actor);
|
||||
void calcQuatUp(sead::Vector3f*, const sead::Quatf& quat);
|
||||
void calcQuatFront(sead::Vector3f*, const LiveActor* actor);
|
||||
void calcQuatLocalAxis(sead::Vector3f*, const LiveActor* actor, s32);
|
||||
void calcTransOffsetFront(sead::Vector3f*, const LiveActor* actor, f32);
|
||||
|
63
lib/al/Library/MapObj/SurfMapParts.cpp
Normal file
63
lib/al/Library/MapObj/SurfMapParts.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include "Library/MapObj/SurfMapParts.h"
|
||||
|
||||
#include "Library/Collision/CollisionPartsKeeperUtil.h"
|
||||
#include "Library/Collision/CollisionPartsTriangle.h"
|
||||
#include "Library/Collision/KCollisionServer.h"
|
||||
#include "Library/LiveActor/ActorAreaFunction.h"
|
||||
#include "Library/LiveActor/ActorInitFunction.h"
|
||||
#include "Library/LiveActor/ActorPoseKeeper.h"
|
||||
#include "Library/Math/VectorUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
|
||||
namespace {
|
||||
using namespace al;
|
||||
|
||||
NERVE_IMPL(SurfMapParts, Wait)
|
||||
|
||||
NERVES_MAKE_STRUCT(SurfMapParts, Wait)
|
||||
} // namespace
|
||||
|
||||
namespace al {
|
||||
SurfMapParts::SurfMapParts(const char* name) : LiveActor(name) {}
|
||||
|
||||
void SurfMapParts::init(const ActorInitInfo& info) {
|
||||
initMapPartsActor(this, info, nullptr);
|
||||
tryGetQuatPtr(this);
|
||||
initNerve(this, &NrvSurfMapParts.Wait, 0);
|
||||
registerAreaHostMtx(this, info);
|
||||
|
||||
tryGetArg(&mIsEnableSlope, info, "IsEnableSlope");
|
||||
|
||||
initMaterialCode(this, info);
|
||||
|
||||
mQuat = getQuat(this);
|
||||
mTrans = getTrans(this);
|
||||
calcQuatUp(&mUpDir, mQuat);
|
||||
|
||||
mCollisionPartsFilterActor = new CollisionPartsFilterActor(this);
|
||||
|
||||
trySyncStageSwitchAppear(this);
|
||||
}
|
||||
|
||||
void SurfMapParts::exeWait() {
|
||||
sead::Vector3f hitPos;
|
||||
Triangle triangle;
|
||||
sead::Vector3f trans = getTrans(this);
|
||||
|
||||
if (alCollisionUtil::getFirstPolyOnArrow(
|
||||
this, &hitPos, &triangle, getTrans(this) + mCheckOffset * sead::Vector3f::ey * 0.5f,
|
||||
-mCheckOffset * sead::Vector3f::ey, mCollisionPartsFilterActor, nullptr)) {
|
||||
setTrans(this, trans * 0.9f + hitPos * 0.1f);
|
||||
if (mIsEnableSlope) {
|
||||
sead::Quatf quat;
|
||||
sead::Vector3f normal = triangle.getNormal(0);
|
||||
turnQuatYDirRate(&quat, getQuat(this), normal, 0.1f);
|
||||
calcQuatUp(&mUpDir, quat);
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsEnableSlope)
|
||||
turnQuatYDirRate(getQuatPtr(this), mQuat, mUpDir, 1.0f);
|
||||
}
|
||||
} // namespace al
|
25
lib/al/Library/MapObj/SurfMapParts.h
Normal file
25
lib/al/Library/MapObj/SurfMapParts.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
namespace al {
|
||||
class CollisionPartsFilterActor;
|
||||
|
||||
class SurfMapParts : public LiveActor {
|
||||
public:
|
||||
SurfMapParts(const char* name);
|
||||
|
||||
void init(const ActorInitInfo& info) override;
|
||||
void exeWait();
|
||||
|
||||
private:
|
||||
CollisionPartsFilterActor* mCollisionPartsFilterActor = nullptr;
|
||||
f32 mCheckOffset = 1000.0f;
|
||||
sead::Quatf mQuat = sead::Quatf::unit;
|
||||
sead::Vector3f mTrans = sead::Vector3f::zero;
|
||||
sead::Vector3f mUpDir = sead::Vector3f::ey;
|
||||
bool mIsEnableSlope = true;
|
||||
};
|
||||
|
||||
static_assert(sizeof(SurfMapParts) == 0x140);
|
||||
} // namespace al
|
@ -26,4 +26,6 @@ void makeMtxUpFrontPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vect
|
||||
const sead::Vector3f&);
|
||||
void makeMtxRotateTrans(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&);
|
||||
|
||||
void turnQuatYDirRate(sead::Quatf*, const sead::Quatf&, const sead::Vector3f&, f32);
|
||||
|
||||
} // namespace al
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "Library/MapObj/GateMapParts.h"
|
||||
#include "Library/MapObj/OneMeshFixMapParts.h"
|
||||
#include "Library/MapObj/RollingCubeMapParts.h"
|
||||
#include "Library/MapObj/SurfMapParts.h"
|
||||
#include "Library/Obj/AllDeadWatcher.h"
|
||||
|
||||
#include "MapObj/AnagramAlphabet.h"
|
||||
@ -574,7 +575,7 @@ static al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
||||
{"SeesawMapParts", nullptr},
|
||||
{"SlideMapParts", nullptr},
|
||||
{"SubActorLodMapParts", nullptr},
|
||||
{"SurfMapParts", nullptr},
|
||||
{"SurfMapParts", al::createActorFunction<al::SurfMapParts>},
|
||||
{"SwingMapParts", nullptr},
|
||||
{"SwitchDitherMapParts", nullptr},
|
||||
{"SwitchKeepOnWatcher", nullptr},
|
||||
|
Loading…
Reference in New Issue
Block a user