Library/MapObj: Implement BackHideParts, BackHideDitherAnimator (#202)
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:
Fuzzy2319 2024-11-28 21:25:46 +01:00 committed by GitHub
parent 1009a5da85
commit d3bb972009
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 111 additions and 10 deletions

View File

@ -7385,8 +7385,8 @@ Address,Quality,Size,Name
0x000000710012de7c,U,000036,_ZN13ImomuFunction29invalidateDepthShadowMapImomuEPN2al9LiveActorE 0x000000710012de7c,U,000036,_ZN13ImomuFunction29invalidateDepthShadowMapImomuEPN2al9LiveActorE
0x000000710012dea0,U,000112,_ZN13ImomuFunction16setVelocityZeroHEPN2al9LiveActorE 0x000000710012dea0,U,000112,_ZN13ImomuFunction16setVelocityZeroHEPN2al9LiveActorE
0x000000710012df10,U,000036,_ZN19ImomuDitherAnimatorD0Ev 0x000000710012df10,U,000036,_ZN19ImomuDitherAnimatorD0Ev
0x000000710012df34,U,000004,_ZN2al14DitherAnimator4showEv 0x000000710012df34,O,000004,_ZN2al14DitherAnimator4showEv
0x000000710012df38,U,000008,_ZNK2al14DitherAnimator15isValidNearClipEv 0x000000710012df38,O,000008,_ZNK2al14DitherAnimator15isValidNearClipEv
0x000000710012df40,U,000012,_ZNK26ImomuJointMtxControllerTmp15getCtrlTypeNameEv 0x000000710012df40,U,000012,_ZNK26ImomuJointMtxControllerTmp15getCtrlTypeNameEv
0x000000710012df4c,U,000164, 0x000000710012df4c,U,000164,
0x000000710012dff0,U,000204,_ZN5JangoC2EPKc 0x000000710012dff0,U,000204,_ZN5JangoC2EPKc
@ -30453,7 +30453,7 @@ Address,Quality,Size,Name
0x00000071004bcd3c,U,000052,_ZN2al19createActorFunctionI8FastenerEEPNS_9LiveActorEPKc 0x00000071004bcd3c,U,000052,_ZN2al19createActorFunctionI8FastenerEEPNS_9LiveActorEPKc
0x00000071004bcd70,U,000052,_ZN2al19createActorFunctionI11FastenerObjEEPNS_9LiveActorEPKc 0x00000071004bcd70,U,000052,_ZN2al19createActorFunctionI11FastenerObjEEPNS_9LiveActorEPKc
0x00000071004bcda4,U,000052,_ZN2al19createActorFunctionINS_21AtmosScatterRequesterEEEPNS_9LiveActorEPKc 0x00000071004bcda4,U,000052,_ZN2al19createActorFunctionINS_21AtmosScatterRequesterEEEPNS_9LiveActorEPKc
0x00000071004bcdd8,U,000052,_ZN2al19createActorFunctionINS_13BackHidePartsEEEPNS_9LiveActorEPKc 0x00000071004bcdd8,O,000052,_ZN2al19createActorFunctionINS_13BackHidePartsEEEPNS_9LiveActorEPKc
0x00000071004bce0c,U,000052,_ZN2al19createActorFunctionI17CapRotateMapPartsEEPNS_9LiveActorEPKc 0x00000071004bce0c,U,000052,_ZN2al19createActorFunctionI17CapRotateMapPartsEEPNS_9LiveActorEPKc
0x00000071004bce40,U,000052,_ZN2al19createActorFunctionINS_13ClockMapPartsEEEPNS_9LiveActorEPKc 0x00000071004bce40,U,000052,_ZN2al19createActorFunctionINS_13ClockMapPartsEEEPNS_9LiveActorEPKc
0x00000071004bce74,U,000052,_ZN2al19createActorFunctionINS_16ConveyerMapPartsEEEPNS_9LiveActorEPKc 0x00000071004bce74,U,000052,_ZN2al19createActorFunctionINS_16ConveyerMapPartsEEEPNS_9LiveActorEPKc
@ -58139,12 +58139,12 @@ Address,Quality,Size,Name
0x0000007100910910,O,000096,_ZN2al14LiveActorGroup7killAllEv 0x0000007100910910,O,000096,_ZN2al14LiveActorGroup7killAllEv
0x0000007100910970,O,000080,_ZN2al14LiveActorGroup17makeActorAliveAllEv 0x0000007100910970,O,000080,_ZN2al14LiveActorGroup17makeActorAliveAllEv
0x00000071009109c0,O,000080,_ZN2al14LiveActorGroup16makeActorDeadAllEv 0x00000071009109c0,O,000080,_ZN2al14LiveActorGroup16makeActorDeadAllEv
0x0000007100910a10,U,000064,_ZN2al22BackHideDitherAnimatorC1EPNS_9LiveActorE 0x0000007100910a10,O,000064,_ZN2al22BackHideDitherAnimatorC1EPNS_9LiveActorE
0x0000007100910a50,U,000360,_ZN2al22BackHideDitherAnimator6updateEv 0x0000007100910a50,O,000360,_ZN2al22BackHideDitherAnimator6updateEv
0x0000007100910bb8,U,000124,_ZN2al13BackHidePartsC2EPKc 0x0000007100910bb8,O,000124,_ZN2al13BackHidePartsC2EPKc
0x0000007100910c34,U,000136,_ZN2al13BackHidePartsC1EPKc 0x0000007100910c34,O,000136,_ZN2al13BackHidePartsC1EPKc
0x0000007100910cbc,U,000144,_ZN2al13BackHideParts4initERKNS_13ActorInitInfoE 0x0000007100910cbc,m,000144,_ZN2al13BackHideParts4initERKNS_13ActorInitInfoE
0x0000007100910d4c,U,000036,_ZN2al22BackHideDitherAnimatorD0Ev 0x0000007100910d4c,O,000036,_ZN2al22BackHideDitherAnimatorD0Ev
0x0000007100910d70,O,000140,_ZN2al17BreakMapPartsBaseC2EPKc 0x0000007100910d70,O,000140,_ZN2al17BreakMapPartsBaseC2EPKc
0x0000007100910dfc,O,000152,_ZN2al17BreakMapPartsBaseC1EPKc 0x0000007100910dfc,O,000152,_ZN2al17BreakMapPartsBaseC1EPKc
0x0000007100910e94,O,000464,_ZN2al17BreakMapPartsBase4initERKNS_13ActorInitInfoE 0x0000007100910e94,O,000464,_ZN2al17BreakMapPartsBase4initERKNS_13ActorInitInfoE

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

View File

@ -0,0 +1,18 @@
#pragma once
#include "Library/Nerve/NerveExecutor.h"
namespace al {
class LiveActor;
class DitherAnimator : public NerveExecutor {
public:
DitherAnimator(const char* name) : NerveExecutor(name) {}
virtual void update() = 0;
virtual void show() {}
virtual bool isValidNearClip() const { return false; }
};
} // namespace al

View File

@ -0,0 +1,54 @@
#include "Library/MapObj/BackHideParts.h"
#include "Library/Camera/CameraUtil.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorModelFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Math/MathAngleUtil.h"
#include "Library/Math/MathLengthUtil.h"
#include "Library/Math/MathUtil.h"
#include "Library/Model/ModelKeeper.h"
#include "Library/Placement/PlacementFunction.h"
namespace al {
BackHideDitherAnimator::BackHideDitherAnimator(LiveActor* actor)
: DitherAnimator("背面ディザアニメーター"), mActor(actor) {}
void BackHideDitherAnimator::update() {
sead::Vector3f cameraFront;
calcCameraFront(&cameraFront, mActor, 0);
f32 cameraOffset = (getCameraPos(mActor, 0) - getTrans(mActor)).length();
sead::Vector3f actorFront;
calcFrontDir(&actorFront, mActor);
f32 angleDegree = normalize(calcAngleDegree(cameraFront, actorFront), 60.0f, 90.0f);
cameraOffset = normalize(cameraOffset, 10000.0f, 12000.0f);
f32 actorAlpha = sead::Mathf::clamp(lerpValue(angleDegree, 1.0f, cameraOffset), 0.0f, 1.0f);
setModelAlphaMask(mActor, actorAlpha);
if (isNearZero(actorAlpha, 0.001)) {
hideModelIfShow(mActor);
return;
}
showModelIfHide(mActor);
}
BackHideParts::BackHideParts(const char* name) : LiveActor(name) {}
// NON_MATCHING: regswap (https://decomp.me/scratch/j5tRy)
void BackHideParts::init(const ActorInitInfo& info) {
const char* suffix = nullptr;
tryGetStringArg(&suffix, info, "Suffix");
initMapPartsActor(this, info, suffix);
mBackHideDitherAnimator = new BackHideDitherAnimator(this);
getModelKeeper()->setDitherAnimator(mBackHideDitherAnimator);
trySyncStageSwitchAppearAndKill(this);
}
} // namespace al

View File

@ -0,0 +1,26 @@
#pragma once
#include "Library/Anim/DitherAnimator.h"
#include "Library/LiveActor/LiveActor.h"
namespace al {
class BackHideDitherAnimator : public DitherAnimator {
public:
BackHideDitherAnimator(LiveActor* actor);
void update() override;
private:
LiveActor* mActor;
};
class BackHideParts : public LiveActor {
public:
BackHideParts(const char* name);
void init(const ActorInitInfo& info) override;
private:
BackHideDitherAnimator* mBackHideDitherAnimator = nullptr;
};
} // namespace al

View File

@ -12,6 +12,7 @@ class AnimPlayerSimple;
class AnimPlayerSkl; class AnimPlayerSkl;
class AnimPlayerVis; class AnimPlayerVis;
class ModelCtrl; class ModelCtrl;
class DitherAnimator;
class ModelKeeper : public HioNode { class ModelKeeper : public HioNode {
public: public:
@ -22,6 +23,7 @@ public:
void calc(const sead::Matrix34f&, const sead::Vector3f&); void calc(const sead::Matrix34f&, const sead::Vector3f&);
void initResource(); void initResource();
void createMatAnimForProgram(s32); void createMatAnimForProgram(s32);
void setDitherAnimator(DitherAnimator* ditherAnimator);
ModelCtrl* getModelCtrl() const { return mModelCtrl; } ModelCtrl* getModelCtrl() const { return mModelCtrl; }

View File

@ -2,6 +2,7 @@
#include "Library/Factory/Factory.h" #include "Library/Factory/Factory.h"
#include "Library/LiveActor/CreateActorFunction.h" #include "Library/LiveActor/CreateActorFunction.h"
#include "Library/MapObj/BackHideParts.h"
#include "Library/MapObj/FallMapParts.h" #include "Library/MapObj/FallMapParts.h"
#include "Library/MapObj/FixMapParts.h" #include "Library/MapObj/FixMapParts.h"
#include "Library/MapObj/FloaterMapParts.h" #include "Library/MapObj/FloaterMapParts.h"
@ -550,7 +551,7 @@ static al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
{"Fastener", nullptr}, {"Fastener", nullptr},
{"FastenerObj", nullptr}, {"FastenerObj", nullptr},
{"AtmosScatterRequester", nullptr}, {"AtmosScatterRequester", nullptr},
{"BackHideParts", nullptr}, {"BackHideParts", al::createActorFunction<al::BackHideParts>},
{"BreakMapParts", nullptr}, {"BreakMapParts", nullptr},
{"CapRotateMapParts", nullptr}, {"CapRotateMapParts", nullptr},
{"ClockMapParts", nullptr}, {"ClockMapParts", nullptr},