mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Util: Implement ActorDimensionKeeper (#624)
This commit is contained in:
parent
f245e3e2fd
commit
9538e1b6fd
|
|
@ -37589,7 +37589,7 @@ Util/ActorDimensionKeeper.o:
|
|||
- 0x71005416b8: _ZN20ActorDimensionKeeper17forceChange2DKeepEv
|
||||
- 0x71005416c4: _ZN20ActorDimensionKeeper20forceEndChange2DKeepEv
|
||||
- 0x71005416cc: _ZN20ActorDimensionKeeper6updateEv
|
||||
- 0x7100541820: ''
|
||||
- 0x7100541820: GUESS _Z14get2DMoveAreasPN4sead8PtrArrayIN2al7AreaObjEEEPKNS1_9LiveActorERKNS_7Vector3IfEE
|
||||
Util/ActorDimensionUtil.o:
|
||||
.text:
|
||||
- 0x710054193c: _ZN2rs21createDimensionKeeperEPKN2al9LiveActorE
|
||||
|
|
|
|||
|
|
@ -34194,13 +34194,13 @@ Address,Quality,Size,Name
|
|||
0x000000710054160c,U,000020,_ZN2rs28calcGetShineNumCollectBgmNpcEPK14GameDataHolder
|
||||
0x0000007100541620,U,000016,_ZN2rs28calcAllShineNumCollectBgmNpcEPK14GameDataHolder
|
||||
0x0000007100541630,U,000020,_ZN2rs24calcGetShineNumHintPhotoEPK14GameDataHolder
|
||||
0x0000007100541644,U,000072,_ZN20ActorDimensionKeeperC1EPKN2al9LiveActorE
|
||||
0x0000007100541644,O,000072,_ZN20ActorDimensionKeeperC1EPKN2al9LiveActorE
|
||||
0x000000710054168c,O,000012,_ZN20ActorDimensionKeeper8validateEv
|
||||
0x0000007100541698,O,000032,_ZN20ActorDimensionKeeper10invalidateEv
|
||||
0x00000071005416b8,U,000012,_ZN20ActorDimensionKeeper17forceChange2DKeepEv
|
||||
0x00000071005416c4,U,000008,_ZN20ActorDimensionKeeper20forceEndChange2DKeepEv
|
||||
0x00000071005416cc,U,000340,_ZN20ActorDimensionKeeper6updateEv
|
||||
0x0000007100541820,U,000284,
|
||||
0x00000071005416b8,O,000012,_ZN20ActorDimensionKeeper17forceChange2DKeepEv
|
||||
0x00000071005416c4,O,000008,_ZN20ActorDimensionKeeper20forceEndChange2DKeepEv
|
||||
0x00000071005416cc,O,000340,_ZN20ActorDimensionKeeper6updateEv
|
||||
0x0000007100541820,O,000284,_Z14get2DMoveAreasPN4sead8PtrArrayIN2al7AreaObjEEEPKNS1_9LiveActorERKNS_7Vector3IfEE
|
||||
0x000000710054193c,O,000052,_ZN2rs21createDimensionKeeperEPKN2al9LiveActorE
|
||||
0x0000007100541970,U,000004,_ZN2rs21updateDimensionKeeperEP20ActorDimensionKeeper
|
||||
0x0000007100541974,U,000012,_ZN2rs27getSpecialPurposeName2DOnlyEv
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
26
src/Area/In2DAreaMoveControl.h
Normal file
26
src/Area/In2DAreaMoveControl.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <container/seadPtrArray.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
namespace al {
|
||||
class AreaObj;
|
||||
}
|
||||
|
||||
class In2DAreaMoveControl {
|
||||
public:
|
||||
In2DAreaMoveControl();
|
||||
|
||||
void update(const sead::FixedPtrArray<al::AreaObj, 8>&);
|
||||
void calcGravityDir(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&) const;
|
||||
void calcLockDir(sead::Vector3f*, f32*, const sead::Vector3f&) const;
|
||||
void calcLastLockDir(sead::Vector3f*, const sead::Vector3f&) const;
|
||||
bool isNearSnapSurface(const sead::Vector3f&, f32) const;
|
||||
bool isLastAreaPushOutOpposite() const;
|
||||
bool isLastAreaFaceToPushOut() const;
|
||||
|
||||
private:
|
||||
void* filler[0xA0 / 8];
|
||||
};
|
||||
|
||||
static_assert(sizeof(In2DAreaMoveControl) == 0xA0);
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
#include "Util/ItemUtil.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "Item/Coin2DCityDirector.h"
|
||||
#include "System/GameDataFunction.h"
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(BarrelStack2D, Wait)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "Library/LiveActor/ActorSensorUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
|
||||
TransparentWall::TransparentWall(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Player/PlayerFunction.h"
|
||||
#include "Player/PlayerInputFunction.h"
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
|
||||
bool PlayerInput::isEnableCarry() const {
|
||||
if (mIsDisableInput)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
#include "Util/ActorDimensionKeeper.h"
|
||||
|
||||
#include "Library/Area/AreaObj.h"
|
||||
#include "Library/Area/AreaObjGroup.h"
|
||||
#include "Library/Area/AreaObjUtil.h"
|
||||
#include "Library/LiveActor/ActorAreaFunction.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
#include "Area/In2DAreaMoveControl.h"
|
||||
#include "Util/IUseDimension.h"
|
||||
|
||||
ActorDimensionKeeper::ActorDimensionKeeper(const al::LiveActor* actor) : mActor(actor) {
|
||||
mIn2DAreaMoveControl = new In2DAreaMoveControl();
|
||||
}
|
||||
|
||||
void ActorDimensionKeeper::validate() {
|
||||
mIsValid = true;
|
||||
}
|
||||
|
|
@ -17,31 +29,79 @@ void ActorDimensionKeeper::invalidate() {
|
|||
}
|
||||
}
|
||||
|
||||
namespace rs {
|
||||
|
||||
ActorDimensionKeeper* createDimensionKeeper(const al::LiveActor* actor) {
|
||||
return new ActorDimensionKeeper(actor);
|
||||
void ActorDimensionKeeper::forceChange2DKeep() {
|
||||
mIsCurrently2D = true;
|
||||
}
|
||||
|
||||
bool is2D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIs2D();
|
||||
void ActorDimensionKeeper::forceEndChange2DKeep() {
|
||||
mIsCurrently2D = false;
|
||||
}
|
||||
|
||||
bool is3D(const IUseDimension* dimension) {
|
||||
ActorDimensionKeeper* keeper = dimension->getActorDimensionKeeper();
|
||||
return !keeper->getIs2D() && !keeper->getIsCurrently2D();
|
||||
void get2DMoveAreas(sead::PtrArray<al::AreaObj>* areas, const al::LiveActor* actor,
|
||||
const sead::Vector3f& trans);
|
||||
|
||||
void ActorDimensionKeeper::update() {
|
||||
sead::FixedPtrArray<al::AreaObj, 8> areas;
|
||||
areas.clear();
|
||||
|
||||
if (!mIsValid) {
|
||||
if (mIsCanChange3D)
|
||||
mIsCanChange3D = false;
|
||||
get2DMoveAreas(&areas, mActor, al::getTrans(mActor));
|
||||
mIsIn2DArea = areas.size() > 0;
|
||||
return;
|
||||
}
|
||||
|
||||
get2DMoveAreas(&areas, mActor, al::getTrans(mActor));
|
||||
mIsIn2DArea = areas.size() > 0;
|
||||
mIn2DAreaMoveControl->update(areas);
|
||||
|
||||
if (mIsIn2DArea)
|
||||
mIsCurrently2D = false;
|
||||
if (al::isInAreaObj(mActor, "2DKeepArea"))
|
||||
mIsCurrently2D = true;
|
||||
|
||||
mIsCanChange2D = (mIsIn2DArea || mIsCurrently2D) && !mIs2D;
|
||||
mIsCanChange3D = !mIsIn2DArea && mIs2D && !mIsCurrently2D;
|
||||
|
||||
if (mIsCanChange2D)
|
||||
mIs2D = true;
|
||||
if (mIsCanChange3D)
|
||||
mIs2D = false;
|
||||
}
|
||||
|
||||
bool isChange2D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsCanChange2D();
|
||||
}
|
||||
void get2DMoveAreas(sead::PtrArray<al::AreaObj>* areas, const al::LiveActor* actor,
|
||||
const sead::Vector3f& trans) {
|
||||
areas->clear();
|
||||
|
||||
bool isChange3D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsCanChange3D();
|
||||
}
|
||||
al::AreaObjGroup* group = al::tryFindAreaObjGroup(actor, "2DMoveArea");
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
bool isIn2DArea(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsIn2DArea();
|
||||
}
|
||||
s32 num = group->getSize();
|
||||
s32 maxPriority = -1;
|
||||
for (s32 i = 0; i < num; ++i) {
|
||||
al::AreaObj* area = group->getAreaObj(i);
|
||||
if (!area->isInVolume(trans))
|
||||
continue;
|
||||
|
||||
} // namespace rs
|
||||
s32 areaPriority = area->getPriority();
|
||||
if (maxPriority > areaPriority)
|
||||
continue;
|
||||
|
||||
bool isIgnoreArea = false;
|
||||
al::tryGetAreaObjArg(&isIgnoreArea, area, "IsIgnoreArea");
|
||||
if (isIgnoreArea) {
|
||||
maxPriority = areaPriority + 1;
|
||||
areas->clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (maxPriority < areaPriority) {
|
||||
maxPriority = areaPriority;
|
||||
areas->clear();
|
||||
}
|
||||
|
||||
areas->pushBack(area);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
void invalidate();
|
||||
void forceChange2DKeep();
|
||||
void forceEndChange2DKeep();
|
||||
bool update();
|
||||
void update();
|
||||
|
||||
bool getIs2D() const { return mIs2D; }
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ public:
|
|||
bool getIsCanChange3D() const { return mIsCanChange3D; }
|
||||
|
||||
private:
|
||||
const al::LiveActor* mLiveActor;
|
||||
const al::LiveActor* mActor;
|
||||
bool mIsValid = true;
|
||||
bool mIs2D = false;
|
||||
bool mIsIn2DArea = false;
|
||||
|
|
@ -40,22 +40,3 @@ private:
|
|||
};
|
||||
|
||||
static_assert(sizeof(ActorDimensionKeeper) == 0x18);
|
||||
|
||||
namespace rs {
|
||||
|
||||
ActorDimensionKeeper* createDimensionKeeper(const al::LiveActor* actor);
|
||||
void updateDimensionKeeper(ActorDimensionKeeper* keeper);
|
||||
|
||||
const char* getSpecialPurposeName2DOnly();
|
||||
void createAndSetFilter2DOnly(al::LiveActor* actor);
|
||||
al::CollisionPartsFilterOnlySpecialPurpose* createCollisionPartsFilter2DOnly();
|
||||
|
||||
bool is2D(const IUseDimension* dimension);
|
||||
bool isIn2DArea(const IUseDimension* dimension);
|
||||
bool isChange2D(const IUseDimension* dimension);
|
||||
bool isChange3D(const IUseDimension* dimension);
|
||||
bool is3D(const IUseDimension* dimension);
|
||||
void snap2D(al::LiveActor* actor, const IUseDimension* dimension, f32 unk_distance);
|
||||
void snap2DGravity(al::LiveActor* actor, const IUseDimension* dimension, f32 unk_distance);
|
||||
|
||||
} // namespace rs
|
||||
|
|
|
|||
33
src/Util/ActorDimensionUtil.cpp
Normal file
33
src/Util/ActorDimensionUtil.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "Util/ActorDimensionUtil.h"
|
||||
|
||||
#include "Util/ActorDimensionKeeper.h"
|
||||
#include "Util/IUseDimension.h"
|
||||
|
||||
namespace rs {
|
||||
|
||||
ActorDimensionKeeper* createDimensionKeeper(const al::LiveActor* actor) {
|
||||
return new ActorDimensionKeeper(actor);
|
||||
}
|
||||
|
||||
bool is2D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIs2D();
|
||||
}
|
||||
|
||||
bool is3D(const IUseDimension* dimension) {
|
||||
ActorDimensionKeeper* keeper = dimension->getActorDimensionKeeper();
|
||||
return !keeper->getIs2D() && !keeper->getIsCurrently2D();
|
||||
}
|
||||
|
||||
bool isChange2D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsCanChange2D();
|
||||
}
|
||||
|
||||
bool isChange3D(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsCanChange3D();
|
||||
}
|
||||
|
||||
bool isIn2DArea(const IUseDimension* dimension) {
|
||||
return dimension->getActorDimensionKeeper()->getIsIn2DArea();
|
||||
}
|
||||
|
||||
} // namespace rs
|
||||
|
|
@ -1,15 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
namespace al {
|
||||
class LiveActor;
|
||||
class MtxConnector;
|
||||
class CollisionPartsFilterBase;
|
||||
} // namespace al
|
||||
|
||||
class IUseDimension;
|
||||
class ActorDimensionKeeper;
|
||||
class IUsePlayerCollision;
|
||||
|
||||
namespace rs {
|
||||
|
||||
ActorDimensionKeeper* createDimensionKeeper(const al::LiveActor*);
|
||||
void updateDimensionKeeper(ActorDimensionKeeper*);
|
||||
const char* getSpecialPurposeName2DOnly();
|
||||
void createAndSetFilter2DOnly(al::LiveActor*);
|
||||
al::CollisionPartsFilterBase* createCollisionPartsFilter2DOnly();
|
||||
bool is2D(const IUseDimension*);
|
||||
bool isIn2DArea(const IUseDimension*);
|
||||
bool is3D(const IUseDimension*);
|
||||
bool isChange2D(const IUseDimension*);
|
||||
bool isChange3D(const IUseDimension*);
|
||||
bool isNearSnapSurface(const IUseDimension*, f32);
|
||||
void calcLockDirection(sead::Vector3f*, const IUseDimension*);
|
||||
void calcDimensionGravity(sead::Vector3f*, const IUseDimension*, const sead::Vector3f&);
|
||||
void setDimensionGravity(al::LiveActor*, const IUseDimension*);
|
||||
void syncDimensionPoseGravity(al::LiveActor*, const IUseDimension*);
|
||||
void calcLockedMoveVec(sead::Vector3f*, const IUseDimension*, f32);
|
||||
void pushOutFrom2DArea(al::LiveActor*, const IUseDimension*, f32, f32);
|
||||
void snap2D(al::LiveActor*, const IUseDimension*, f32);
|
||||
void snap2DGravity(al::LiveActor*, const IUseDimension*, f32);
|
||||
void snap2DUp(al::LiveActor*, const IUseDimension*, f32);
|
||||
void snap2DParallelizeFront(al::LiveActor*, const IUseDimension*, f32);
|
||||
bool snap2DGravityPoseWithRotateCenter(al::LiveActor*, IUsePlayerCollision*, const IUseDimension*,
|
||||
f32, f32, const sead::Vector3f&);
|
||||
bool calcSnap2DPosition(sead::Vector3f*, const IUseDimension*, const sead::Vector3f&, f32);
|
||||
void attachMtxConnectorTo2DCollision(al::MtxConnector*, const al::LiveActor*, const sead::Vector3f&,
|
||||
const sead::Vector3f&);
|
||||
void attachMtxConnectorTo2DCollision(al::MtxConnector*, const al::LiveActor*, bool);
|
||||
void attachMtxConnectorTo2DCollision(al::MtxConnector*, const al::LiveActor*, f32, f32);
|
||||
void syncVisAnimFrame2D(al::LiveActor*, const char*, bool);
|
||||
|
||||
} // namespace rs
|
||||
|
|
|
|||
Loading…
Reference in a new issue