-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1859701
commit e195f01
Showing
7 changed files
with
234 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
#include "MapObj/ChurchDoor.h" | ||
|
||
#include "Library/Base/StringUtil.h" | ||
#include "Library/Bgm/BgmLineFunction.h" | ||
#include "Library/LiveActor/ActorActionFunction.h" | ||
#include "Library/LiveActor/ActorCollisionFunction.h" | ||
#include "Library/LiveActor/ActorInitInfo.h" | ||
#include "Library/LiveActor/ActorSensorFunction.h" | ||
#include "Library/LiveActor/ActorSensorMsgFunction.h" | ||
#include "Library/Nerve/NerveSetupUtil.h" | ||
#include "Library/Nerve/NerveUtil.h" | ||
|
||
#include "System/GameDataFunction.h" | ||
#include "Util/Sensor.h" | ||
#include "Util/StageSensorMsgFunction.h" | ||
|
||
namespace { | ||
NERVE_IMPL(ChurchDoor, DemoEnterChurch); | ||
NERVE_IMPL(ChurchDoor, CloseWait1); | ||
NERVE_IMPL(ChurchDoor, OpenWait); | ||
NERVE_IMPL(ChurchDoor, Open1); | ||
NERVE_IMPL(ChurchDoor, Open2); | ||
NERVE_IMPL(ChurchDoor, CloseWait2); | ||
NERVE_IMPL(ChurchDoor, CloseWait3); | ||
NERVE_IMPL(ChurchDoor, Open3); | ||
|
||
NERVES_MAKE_NOSTRUCT(ChurchDoor, DemoEnterChurch, CloseWait1, OpenWait, Open1, Open2, CloseWait2, | ||
CloseWait3, Open3); | ||
} // namespace | ||
|
||
inline bool isCurrentStageMoonWeddingRoom(const al::LiveActor* actor) { | ||
return al::isEqualString("MoonWorldWeddingRoomStage", | ||
GameDataFunction::getCurrentStageName(actor)); | ||
} | ||
|
||
ChurchDoor::ChurchDoor(const char* name) : al::LiveActor(name) {} | ||
|
||
void ChurchDoor::init(const al::ActorInitInfo& info) { | ||
al::initActor(this, info); | ||
al::initNerve(this, &CloseWait1, 0); | ||
|
||
if (isCurrentStageMoonWeddingRoom(this)) { | ||
mSaveObjInfo = rs::createSaveObjInfoWriteSaveData(info); | ||
if (rs::isOnSaveObjInfo(mSaveObjInfo)) { | ||
al::invalidateCollisionParts(this); | ||
al::setNerve(this, &OpenWait); | ||
makeActorAlive(); | ||
return; | ||
} | ||
} | ||
|
||
al::startBgmSituation(this, "CloseChurchDoor", true, true); | ||
makeActorAlive(); | ||
} | ||
|
||
bool ChurchDoor::receiveMsg(const al::SensorMsg* msg, al::HitSensor* source, | ||
al::HitSensor* target) { | ||
if (rs::isMsgPlayerDisregardTargetMarker(msg)) | ||
return true; | ||
|
||
if (rs::isMsgCapTouchWall(msg)) { | ||
if ((al::isNerve(this, &Open1) || al::isNerve(this, &Open2)) && | ||
al::isLessEqualStep(this, 10)) | ||
return true; | ||
|
||
rs::requestHitReactionToAttacker(msg, source, al::getSensorPos(source)); | ||
|
||
if (al::isNerve(this, &CloseWait1)) { | ||
al::startHitReaction(this, "ヒット1回目"); | ||
al::setNerve(this, &Open1); | ||
} else if (al::isNerve(this, &CloseWait2) || al::isNerve(this, &Open1)) { | ||
al::startHitReaction(this, "ヒット2回目"); | ||
al::setNerve(this, &Open2); | ||
} else if (al::isNerve(this, &CloseWait3) || al::isNerve(this, &Open2)) { | ||
al::startHitReaction(this, "ヒット3回目"); | ||
al::setNerve(this, &Open3); | ||
} | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool ChurchDoor::isOpenWait() const { | ||
return al::isNerve(this, &OpenWait); | ||
} | ||
|
||
bool ChurchDoor::isDemoEnterChurch() const { | ||
return al::isNerve(this, &DemoEnterChurch); | ||
} | ||
|
||
void ChurchDoor::startDemoEnterChurch() { | ||
al::setNerve(this, &DemoEnterChurch); | ||
} | ||
|
||
void ChurchDoor::endDemoEnterChurch() { | ||
al::setNerve(this, &OpenWait); | ||
} | ||
|
||
void ChurchDoor::exeCloseWait1() { | ||
if (al::isFirstStep(this)) | ||
al::startAction(this, "CloseWait1"); | ||
} | ||
|
||
void ChurchDoor::exeOpen1() { | ||
if (al::isFirstStep(this)) | ||
al::startAction(this, "Open1"); | ||
|
||
al::setNerveAtActionEnd(this, &CloseWait2); | ||
} | ||
|
||
void ChurchDoor::exeCloseWait2() { | ||
if (al::isFirstStep(this)) | ||
al::startAction(this, "CloseWait2"); | ||
} | ||
|
||
void ChurchDoor::exeOpen2() { | ||
if (al::isFirstStep(this)) | ||
al::startAction(this, "Open2"); | ||
|
||
al::setNerveAtActionEnd(this, &CloseWait3); | ||
} | ||
|
||
void ChurchDoor::exeCloseWait3() { | ||
if (al::isFirstStep(this)) | ||
al::startAction(this, "CloseWait3"); | ||
} | ||
|
||
void ChurchDoor::exeOpen3() { | ||
if (al::isFirstStep(this)) { | ||
al::startAction(this, "Open3"); | ||
al::invalidateCollisionParts(this); | ||
} | ||
|
||
al::setNerveAtActionEnd(this, &OpenWait); | ||
} | ||
|
||
void ChurchDoor::exeOpenWait() { | ||
if (al::isFirstStep(this)) { | ||
al::startAction(this, "OpenWait"); | ||
|
||
if (isCurrentStageMoonWeddingRoom(this)) | ||
rs::onSaveObjInfo(mSaveObjInfo); | ||
} | ||
} | ||
|
||
void ChurchDoor::exeDemoEnterChurch() { | ||
if (al::isFirstStep(this)) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "Library/LiveActor/LiveActor.h" | ||
|
||
class SaveObjInfo; | ||
|
||
class ChurchDoor : public al::LiveActor { | ||
public: | ||
ChurchDoor(const char* name); | ||
|
||
void init(const al::ActorInitInfo& info) override; | ||
bool receiveMsg(const al::SensorMsg* msg, al::HitSensor* source, | ||
al::HitSensor* target) override; | ||
|
||
bool isOpenWait() const; | ||
bool isDemoEnterChurch() const; | ||
void startDemoEnterChurch(); | ||
void endDemoEnterChurch(); | ||
|
||
void exeCloseWait1(); | ||
void exeOpen1(); | ||
void exeCloseWait2(); | ||
void exeOpen2(); | ||
void exeCloseWait3(); | ||
void exeOpen3(); | ||
void exeOpenWait(); | ||
void exeDemoEnterChurch(); | ||
|
||
private: | ||
SaveObjInfo* mSaveObjInfo = nullptr; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include <math/seadVector.h> | ||
|
||
namespace al { | ||
class HitSensor; | ||
class SensorMsg; | ||
} // namespace al | ||
|
||
namespace rs { | ||
|
||
bool isMsgPlayerDisregardTargetMarker(const al::SensorMsg* msg); | ||
|
||
void requestHitReactionToAttacker(const al::SensorMsg*, const al::HitSensor*, | ||
const sead::Vector3f&); | ||
|
||
} // namespace rs |