-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathPlayerPainPartsKeeper.cpp
89 lines (73 loc) · 3.01 KB
/
PlayerPainPartsKeeper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "Player/PlayerPainPartsKeeper.h"
#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorModelFunction.h"
#include "Library/LiveActor/ActorMovementFunction.h"
#include "Library/LiveActor/LiveActorUtil.h"
#include "Library/LiveActor/SubActorKeeper.h"
#include "Library/Obj/PartsModel.h"
#include "Player/Player.h"
#include "Player/PlayerCostumeInfo.h"
#include "Player/PlayerModelHolder.h"
PlayerPainPartsKeeper::PlayerPainPartsKeeper(const al::LiveActor* liveActor,
const PlayerCostumeInfo* costumeInfo)
: mLiveActor(liveActor), mPlayerCostumeInfo(costumeInfo) {}
void PlayerPainPartsKeeper::update() {
updateNeedle();
}
void PlayerPainPartsKeeper::updateNeedle() {
if (!mNeedlesActor || al::isDead(mNeedlesActor))
return;
if (!mPlayerCostumeInfo->isPreventHeadPain() || !rs::isGuardNosePainCap(mLiveActor)) {
al::setModelAlphaMask(mNeedlesActor, mModelAlphaMask);
if (al::isHideModel(mPlayerFaceActor))
al::hideModelIfShow(mNeedlesActor);
else
al::showModelIfHide(mNeedlesActor);
if (mIsEnableTimer)
mTimer++;
if (mTimer < 3600)
return;
}
mNeedlesActor->kill();
}
void PlayerPainPartsKeeper::resetPosition() {
if (mNeedlesActor && al::isAlive(mNeedlesActor))
al::resetPosition(mNeedlesActor);
}
bool PlayerPainPartsKeeper::isEnableNosePain() const {
if (mPlayerCostumeInfo->isPreventHeadPain() && rs::isGuardNosePainCap(mLiveActor))
return false;
return true;
}
bool PlayerPainPartsKeeper::isInvalidNoseDynamics() const {
return mNeedlesActor && al::isAlive(mNeedlesActor);
}
static sead::Vector3f initialRotation = {0, 270, 180};
void PlayerPainPartsKeeper::createNoseNeedle(const PlayerModelHolder* playerModelHolder,
const al::ActorInitInfo& actorInitInfo) {
auto* playerFaceActor = playerModelHolder->findModelActor("Normal");
auto* faceSubActor = al::getSubActor(playerFaceActor, "顔");
mPlayerFaceActor = playerFaceActor;
mNeedlesActor = new al::PartsModel("鼻のトゲ");
mNeedlesActor->initPartsDirect(playerFaceActor, actorInitInfo, "CactusMiniNeedle",
al::getJointMtxPtr(faceSubActor, "Nose"), sead::Vector3f::zero,
initialRotation, {1, 1, 1}, false);
al::onSyncClippingSubActor(playerFaceActor, mNeedlesActor);
al::onSyncHideSubActor(playerFaceActor, mNeedlesActor);
al::onSyncAlphaMaskSubActor(playerFaceActor, mNeedlesActor);
al::setMaterialProgrammable(mNeedlesActor);
mNeedlesActor->makeActorDead();
}
// NON_MATCHING
void PlayerPainPartsKeeper::appearNeedle() {
mTimer = 0;
if (al::isAlive(mNeedlesActor))
return;
mNeedlesActor->makeActorAlive();
const char* actionName;
if (mPlayerCostumeInfo->isHidePainNose())
actionName = "NoseOff";
else
actionName = "NoseOn";
al::startAction(mNeedlesActor, actionName);
}