mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
MapObj: Implement RhythmInfoWatcher
This commit is contained in:
parent
b6f947c559
commit
ce8a15d4a2
|
|
@ -81596,81 +81596,81 @@ MapObj/RhyhtmInfoWatcher.o:
|
|||
- offset: 0x2f7050
|
||||
size: 160
|
||||
label: _ZN17RhyhtmInfoWatcherC2EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f70f0
|
||||
size: 156
|
||||
label: _ZN17RhyhtmInfoWatcherC1EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f718c
|
||||
size: 92
|
||||
label: _ZN17RhyhtmInfoWatcher26initAfterPlacementSceneObjERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f71e8
|
||||
size: 108
|
||||
label: _ZThn264_N17RhyhtmInfoWatcher26initAfterPlacementSceneObjERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f7254
|
||||
size: 84
|
||||
label: _ZN17RhyhtmInfoWatcher7controlEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f72a8
|
||||
size: 20
|
||||
label: _ZN17RhyhtmInfoWatcher9loopCheckEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f72bc
|
||||
size: 36
|
||||
label: _ZN2rs11getInstanceEPN2al18IUseSceneObjHolderE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f72e0
|
||||
size: 60
|
||||
label: _ZN2rs26registerRhyhtmInfoListenerEPN2al18IUseSceneObjHolderE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f731c
|
||||
size: 44
|
||||
label: _ZN2rs14getCurrentBeatEPN2al18IUseSceneObjHolderE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f7348
|
||||
size: 44
|
||||
label: _ZN2rs12getBeatDeltaEPN2al18IUseSceneObjHolderE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f7374
|
||||
size: 44
|
||||
label: _ZN2rs9isLoopingEPN2al18IUseSceneObjHolderE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2f73a0
|
||||
size: 8
|
||||
label: _ZNK17RhyhtmInfoWatcher14getCurrentBeatEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73a8
|
||||
size: 16
|
||||
label: _ZNK17RhyhtmInfoWatcher12getBeatDeltaEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73b8
|
||||
size: 8
|
||||
label: _ZNK17RhyhtmInfoWatcher9isLoopingEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73c0
|
||||
size: 4
|
||||
label: _ZN17RhyhtmInfoWatcherD1Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73c4
|
||||
size: 4
|
||||
label: _ZN17RhyhtmInfoWatcherD0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73c8
|
||||
size: 4
|
||||
label: _ZThn264_N17RhyhtmInfoWatcherD1Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2f73cc
|
||||
size: 8
|
||||
label: _ZThn264_N17RhyhtmInfoWatcherD0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
MapObj/RhythmSpotlight.o:
|
||||
'.text':
|
||||
|
|
|
|||
72
src/MapObj/RhyhtmInfoWatcher.cpp
Normal file
72
src/MapObj/RhyhtmInfoWatcher.cpp
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#include "MapObj/RhyhtmInfoWatcher.h"
|
||||
|
||||
#include "Library/Bgm/BgmLineFunction.h"
|
||||
#include "Library/LiveActor/ActorInitFunction.h"
|
||||
#include "Library/Scene/SceneObjUtil.h"
|
||||
|
||||
RhyhtmInfoWatcher::RhyhtmInfoWatcher(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
void RhyhtmInfoWatcher::initAfterPlacementSceneObj(const al::ActorInitInfo& info) {
|
||||
al::initActorSceneInfo(this, info);
|
||||
al::initExecutorWatchObj(this, info);
|
||||
al::initActorBgmKeeper(this, info, nullptr);
|
||||
getSceneObjName();
|
||||
makeActorAlive();
|
||||
}
|
||||
|
||||
void RhyhtmInfoWatcher::control() {
|
||||
const al::IUseAudioKeeper* audioKeeper = this;
|
||||
|
||||
if (!al::isEnableRhythmAnim(audioKeeper, nullptr))
|
||||
return;
|
||||
|
||||
mPreviousBeat = mCurrentBeat;
|
||||
|
||||
f32 currentBeat = al::getCurBeat(audioKeeper);
|
||||
|
||||
mCurrentBeat = currentBeat;
|
||||
mIsLooping = loopCheck();
|
||||
}
|
||||
|
||||
bool RhyhtmInfoWatcher::loopCheck() {
|
||||
return !(mPreviousBeat <= mCurrentBeat);
|
||||
}
|
||||
|
||||
f32 RhyhtmInfoWatcher::getCurrentBeat() const {
|
||||
return mCurrentBeat;
|
||||
}
|
||||
|
||||
f32 RhyhtmInfoWatcher::getBeatDelta() const {
|
||||
return mCurrentBeat - mPreviousBeat;
|
||||
}
|
||||
|
||||
bool RhyhtmInfoWatcher::isLooping() const {
|
||||
return mIsLooping;
|
||||
}
|
||||
|
||||
namespace rs {
|
||||
|
||||
RhyhtmInfoWatcher* getInstance(al::IUseSceneObjHolder* holder) {
|
||||
return al::getSceneObj<RhyhtmInfoWatcher>(holder);
|
||||
}
|
||||
|
||||
void registerRhyhtmInfoListener(al::IUseSceneObjHolder* holder) {
|
||||
if (al::isExistSceneObj(holder, SceneObjID_RhyhtmInfoWatcher))
|
||||
return;
|
||||
|
||||
al::createSceneObj(holder, SceneObjID_RhyhtmInfoWatcher);
|
||||
}
|
||||
|
||||
f32 getCurrentBeat(al::IUseSceneObjHolder* holder) {
|
||||
return al::getSceneObj<RhyhtmInfoWatcher>(holder)->getCurrentBeat();
|
||||
}
|
||||
|
||||
f32 getBeatDelta(al::IUseSceneObjHolder* holder) {
|
||||
return al::getSceneObj<RhyhtmInfoWatcher>(holder)->getBeatDelta();
|
||||
}
|
||||
|
||||
bool isLooping(al::IUseSceneObjHolder* holder) {
|
||||
return al::getSceneObj<RhyhtmInfoWatcher>(holder)->isLooping();
|
||||
}
|
||||
|
||||
} // namespace rs
|
||||
44
src/MapObj/RhyhtmInfoWatcher.h
Normal file
44
src/MapObj/RhyhtmInfoWatcher.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
#include "Library/Scene/ISceneObj.h"
|
||||
|
||||
#include "Scene/SceneObjFactory.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class IUseSceneObjHolder;
|
||||
} // namespace al
|
||||
|
||||
class RhyhtmInfoWatcher : public al::LiveActor, public al::ISceneObj {
|
||||
public:
|
||||
static constexpr s32 sSceneObjId = SceneObjID_RhyhtmInfoWatcher;
|
||||
|
||||
RhyhtmInfoWatcher(const char* name);
|
||||
|
||||
void initAfterPlacementSceneObj(const al::ActorInitInfo& info) override;
|
||||
void control() override;
|
||||
|
||||
virtual f32 getCurrentBeat() const;
|
||||
virtual f32 getBeatDelta() const;
|
||||
virtual bool isLooping() const;
|
||||
|
||||
private:
|
||||
bool loopCheck();
|
||||
|
||||
f32 mCurrentBeat = -1.0f;
|
||||
f32 mPreviousBeat = -1.0f;
|
||||
bool mIsLooping = false;
|
||||
};
|
||||
|
||||
static_assert(sizeof(RhyhtmInfoWatcher) == 0x120);
|
||||
|
||||
namespace rs {
|
||||
RhyhtmInfoWatcher* getInstance(al::IUseSceneObjHolder* holder);
|
||||
void registerRhyhtmInfoListener(al::IUseSceneObjHolder* holder);
|
||||
f32 getCurrentBeat(al::IUseSceneObjHolder* holder);
|
||||
f32 getBeatDelta(al::IUseSceneObjHolder* holder);
|
||||
bool isLooping(al::IUseSceneObjHolder* holder);
|
||||
} // namespace rs
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Item/CoinCollectHolder.h"
|
||||
#include "Item/CoinCollectWatcher.h"
|
||||
#include "Layout/KidsModeLayoutAccessor.h"
|
||||
#include "MapObj/RhyhtmInfoWatcher.h"
|
||||
#include "MapObj/RouteGuideDirector.h"
|
||||
#include "Scene/HintPhotoLayoutHolder.h"
|
||||
|
||||
|
|
@ -84,7 +85,7 @@ static al::ISceneObj* sceneObjCreator(s32 id) {
|
|||
return nullptr;
|
||||
|
||||
case SceneObjID_RhyhtmInfoWatcher:
|
||||
return nullptr;
|
||||
return new RhyhtmInfoWatcher("");
|
||||
|
||||
case SceneObjID_RouteGuideDirector:
|
||||
return new RouteGuideDirector();
|
||||
|
|
|
|||
Loading…
Reference in a new issue