mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
MapObj: Implement TouchActionMessageDirector (#996)
This commit is contained in:
parent
c9b73aff31
commit
03cdbfb91f
|
|
@ -89148,66 +89148,66 @@ MapObj/TouchActionMessageDirector.o:
|
|||
label:
|
||||
- _ZN26TouchActionMessageDirectorC1Ev
|
||||
- _ZN26TouchActionMessageDirectorC2Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339eb8
|
||||
size: 104
|
||||
label: _ZN26TouchActionMessageDirector4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339f20
|
||||
size: 8
|
||||
label: _ZN26TouchActionMessageDirector6updateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339f28
|
||||
size: 8
|
||||
label: _ZNK26TouchActionMessageDirector11isTouchHoldEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339f30
|
||||
size: 12
|
||||
label: _ZNK26TouchActionMessageDirector20getRotateSpeedDegreeEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339f3c
|
||||
size: 92
|
||||
label: _ZNK26TouchActionMessageDirector13tryGetMoveVecEPN4sead7Vector2IfEE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339f98
|
||||
size: 68
|
||||
label: _ZNK26TouchActionMessageDirector14tryGetSlideDirEPN4sead7Vector2IfEE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x339fdc
|
||||
size: 40
|
||||
label: _ZN2rs13isTimeHandledEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x33a004
|
||||
size: 44
|
||||
label: _ZN2rs30getTimeHandleRotateSpeedDegreeEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x33a030
|
||||
size: 112
|
||||
label: _ZN2rs24tryGetTouchActionMoveVecEPN4sead7Vector2IfEEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x33a0a0
|
||||
size: 88
|
||||
label: _ZN2rs25tryGetTouchActionSlideDirEPN4sead7Vector2IfEEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x33a0f8
|
||||
size: 12
|
||||
label: _ZNK26TouchActionMessageDirector15getSceneObjNameEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x33a104
|
||||
size: 4
|
||||
label: _ZN26TouchActionMessageDirectorD0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x33a108
|
||||
size: 8
|
||||
label: _ZNK26TouchActionMessageDirector20getCollisionDirectorEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x33a110
|
||||
size: 8
|
||||
label: _ZThn8_NK26TouchActionMessageDirector20getCollisionDirectorEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
MapObj/TouchTargetInfo.o:
|
||||
'.text':
|
||||
|
|
|
|||
35
src/MapObj/ScreenPointAnalyzer.h
Normal file
35
src/MapObj/ScreenPointAnalyzer.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
class ScreenPointAnalyzer {
|
||||
public:
|
||||
ScreenPointAnalyzer();
|
||||
void reset();
|
||||
void update();
|
||||
void analyze(const sead::Vector2f& pos);
|
||||
bool isHold() const;
|
||||
bool isSlide() const;
|
||||
|
||||
const sead::Vector2f& getSlideDir() const { return mSlideDir; }
|
||||
|
||||
const sead::Vector2f& getMoveVec() const { return mMoveVec; }
|
||||
|
||||
f32 getRotateSpeedDegree() const { return mRotateSpeedDegree; }
|
||||
|
||||
private:
|
||||
s32 _00 = 0;
|
||||
s32 _04 = 0;
|
||||
s32 _08 = 0;
|
||||
s32 _0c = 0;
|
||||
s32 _10 = 0;
|
||||
s32 _14 = 0;
|
||||
sead::Vector2f mSlideDir = {0.0f, 0.0f};
|
||||
sead::Vector2f mMoveVec = {0.0f, 0.0f};
|
||||
s32 _28 = 0;
|
||||
s32 _2c = 0;
|
||||
f32 mRotateSpeedDegree = 0.0f;
|
||||
};
|
||||
|
||||
static_assert(sizeof(ScreenPointAnalyzer) == 0x34);
|
||||
71
src/MapObj/TouchActionMessageDirector.cpp
Normal file
71
src/MapObj/TouchActionMessageDirector.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#include "MapObj/TouchActionMessageDirector.h"
|
||||
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Scene/SceneObjUtil.h"
|
||||
#include "Library/Screen/ScreenPointer.h"
|
||||
|
||||
#include "MapObj/ScreenPointAnalyzer.h"
|
||||
|
||||
TouchActionMessageDirector::TouchActionMessageDirector() = default;
|
||||
|
||||
void TouchActionMessageDirector::init(const al::ActorInitInfo& info) {
|
||||
mCollisionDirector = al::getCollisionDirectorFromInfo(info);
|
||||
mScreenPointAnalyzer = new ScreenPointAnalyzer();
|
||||
mScreenPointer = new al::ScreenPointer(info, "No Owner");
|
||||
}
|
||||
|
||||
void TouchActionMessageDirector::update() {
|
||||
mScreenPointAnalyzer->update();
|
||||
}
|
||||
|
||||
bool TouchActionMessageDirector::isTouchHold() const {
|
||||
return mScreenPointAnalyzer->isHold();
|
||||
}
|
||||
|
||||
f32 TouchActionMessageDirector::getRotateSpeedDegree() const {
|
||||
return mScreenPointAnalyzer->getRotateSpeedDegree();
|
||||
}
|
||||
|
||||
bool TouchActionMessageDirector::tryGetMoveVec(sead::Vector2f* out) const {
|
||||
if (!isTouchHold())
|
||||
return false;
|
||||
const sead::Vector2f& moveVec = mScreenPointAnalyzer->getMoveVec();
|
||||
if (al::isNearZero(moveVec))
|
||||
return false;
|
||||
|
||||
out->set(moveVec);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TouchActionMessageDirector::tryGetSlideDir(sead::Vector2f* out) const {
|
||||
if (!mScreenPointAnalyzer->isSlide())
|
||||
return false;
|
||||
out->set(mScreenPointAnalyzer->getSlideDir());
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace rs {
|
||||
|
||||
bool isTimeHandled(const al::LiveActor* actor) {
|
||||
TouchActionMessageDirector* director = al::getSceneObj<TouchActionMessageDirector>(actor);
|
||||
return director->isTouchHold();
|
||||
}
|
||||
|
||||
f32 getTimeHandleRotateSpeedDegree(const al::LiveActor* actor) {
|
||||
TouchActionMessageDirector* director = al::getSceneObj<TouchActionMessageDirector>(actor);
|
||||
return director->getRotateSpeedDegree();
|
||||
}
|
||||
|
||||
bool tryGetTouchActionMoveVec(sead::Vector2f* out, const al::LiveActor* actor) {
|
||||
TouchActionMessageDirector* director = al::getSceneObj<TouchActionMessageDirector>(actor);
|
||||
return director->tryGetMoveVec(out);
|
||||
}
|
||||
|
||||
bool tryGetTouchActionSlideDir(sead::Vector2f* out, const al::LiveActor* actor) {
|
||||
TouchActionMessageDirector* director = al::getSceneObj<TouchActionMessageDirector>(actor);
|
||||
return director->tryGetSlideDir(out);
|
||||
}
|
||||
|
||||
} // namespace rs
|
||||
52
src/MapObj/TouchActionMessageDirector.h
Normal file
52
src/MapObj/TouchActionMessageDirector.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
#include "Library/Collision/IUseCollision.h"
|
||||
#include "Library/HostIO/HioNode.h"
|
||||
#include "Library/Scene/ISceneObj.h"
|
||||
|
||||
#include "Scene/SceneObjFactory.h"
|
||||
|
||||
class ScreenPointAnalyzer;
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class CollisionDirector;
|
||||
class LiveActor;
|
||||
class ScreenPointer;
|
||||
} // namespace al
|
||||
|
||||
class TouchActionMessageDirector : public al::HioNode,
|
||||
public al::ISceneObj,
|
||||
public al::IUseCollision {
|
||||
public:
|
||||
static constexpr s32 sSceneObjId = SceneObjID_TouchActionMessageDirector;
|
||||
|
||||
TouchActionMessageDirector();
|
||||
void init(const al::ActorInitInfo& info);
|
||||
void update();
|
||||
bool isTouchHold() const;
|
||||
f32 getRotateSpeedDegree() const;
|
||||
bool tryGetMoveVec(sead::Vector2f* out) const;
|
||||
bool tryGetSlideDir(sead::Vector2f* out) const;
|
||||
|
||||
const char* getSceneObjName() const override {
|
||||
return "タッチアクションメッセージディレクター";
|
||||
}
|
||||
|
||||
al::CollisionDirector* getCollisionDirector() const override { return mCollisionDirector; }
|
||||
|
||||
private:
|
||||
al::CollisionDirector* mCollisionDirector = nullptr;
|
||||
ScreenPointAnalyzer* mScreenPointAnalyzer = nullptr;
|
||||
al::ScreenPointer* mScreenPointer = nullptr;
|
||||
};
|
||||
|
||||
namespace rs {
|
||||
bool isTimeHandled(const al::LiveActor* actor);
|
||||
f32 getTimeHandleRotateSpeedDegree(const al::LiveActor* actor);
|
||||
bool tryGetTouchActionMoveVec(sead::Vector2f* out, const al::LiveActor* actor);
|
||||
bool tryGetTouchActionSlideDir(sead::Vector2f* out, const al::LiveActor* actor);
|
||||
} // namespace rs
|
||||
|
|
@ -74,7 +74,7 @@ enum SceneObjID : s32 {
|
|||
SceneObjID_TalkNpcSceneEventSwitcher,
|
||||
SceneObjID_TestStageTimeDirector,
|
||||
SceneObjID_TimeBalloonDirector,
|
||||
SceneObjID__42,
|
||||
SceneObjID_TouchActionMessageDirector,
|
||||
SceneObjID_alTrafficAreaDirector,
|
||||
SceneObjID_TrafficRailWatcher,
|
||||
SceneObjID_TRexScrollBreakMapPartsBreakJudge,
|
||||
|
|
|
|||
Loading…
Reference in a new issue