-
Notifications
You must be signed in to change notification settings - Fork 106
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
40530f0
commit 40cea7c
Showing
4 changed files
with
129 additions
and
2 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,63 @@ | ||
#include "KingSystem/ActorSystem/actLinkTag.h" | ||
|
||
namespace ksys::act { | ||
|
||
LinkTag* LinkTag::construct(const BaseProc::CreateArg& arg, sead::Heap* heap) { | ||
return new (heap, std::nothrow) LinkTag(arg); | ||
} | ||
|
||
LinkTag::LinkTag(const BaseProc::CreateArg& arg) : BaseProc(arg), mJob(this, &LinkTag::calc) { | ||
mJobHandlers[3] = &mJob; | ||
} | ||
|
||
bool LinkTag::init(){ | ||
if(mName == "LinkTagOr") | ||
mLinkTagType = Type::Or; | ||
else if(mName == "LinkTagNOr") | ||
mLinkTagType = Type::NOr; | ||
else if(mName == "LinkTagNAnd") | ||
mLinkTagType = Type::NAnd; | ||
else if(mName == "LinkTagXOr") | ||
mLinkTagType = Type::XOr; | ||
else if(mName == "LinkTagAnd") | ||
mLinkTagType = Type::And; | ||
else if(mName == "LinkTagCount") | ||
mLinkTagType = Type::Count; | ||
else if(mName == "LinkTagPulse") | ||
mLinkTagType = Type::Pulse; | ||
else if(mName == "LinkTagNone") | ||
mLinkTagType = Type::None; | ||
|
||
if(mName == "LinkTagNAnd" || mName == "LinkTagNOr") | ||
mFlags.set(LinkTagFlag::_4); | ||
|
||
int noChangeSignalValue = 0; | ||
mMubinIter.tryGetParamIntByKey(&noChangeSignalValue, "NoChangeSignal"); | ||
if(noChangeSignalValue != 0) | ||
mFlags.set(LinkTagFlag::_40); | ||
|
||
int saveFlagOnOffTypeValue = 0; | ||
if(mMubinIter.tryGetParamIntByKey(&saveFlagOnOffTypeValue, "SaveFlagOnOffType")){ | ||
if(saveFlagOnOffTypeValue == 2) | ||
mFlags.set(LinkTagFlag::_200); | ||
else if(saveFlagOnOffTypeValue == 1) | ||
mFlags.set(LinkTagFlag::_100); | ||
} | ||
|
||
bool flagSet = false; | ||
isFlagSet(&flagSet, 0, mMapObj); | ||
updateIsFlagSetFlag(flagSet, 1, 1); | ||
if(flagSet){ | ||
mFlags.set(LinkTagFlag::_10); | ||
mTriggeredLinkFlags.makeAllOne(); | ||
mFlags.set(LinkTagFlag::_30); | ||
} | ||
else { | ||
mFlags.reset(LinkTagFlag::_10); | ||
mTriggeredLinkFlags.makeAllZero(); | ||
mFlags.reset(LinkTagFlag::_30); | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace ksys::act |
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,62 @@ | ||
#pragma once | ||
|
||
#include <prim/seadLongBitFlag.h> | ||
#include <prim/seadTypedBitFlag.h> | ||
#include <thread/seadAtomic.h> | ||
#include "KingSystem/ActorSystem/actBaseProc.h" | ||
#include "KingSystem/ActorSystem/actBaseProcJobHandler.h" | ||
#include "KingSystem/Map/mapMubinIter.h" | ||
#include "KingSystem/Utils/Types.h" | ||
|
||
namespace ksys::map { | ||
class Object; | ||
} // namespace ksys::map | ||
|
||
namespace ksys::act { | ||
|
||
class LinkTag : public BaseProc { | ||
SEAD_RTTI_OVERRIDE(LinkTag, BaseProc) | ||
|
||
public: | ||
enum class Type : u8 { And, Or, NAnd, NOr, XOr, Count, Pulse, None }; | ||
enum class JobFlag {}; | ||
enum class LinkTagFlag { | ||
_4 = 0x4, | ||
_10 = 0x10, | ||
_20 = 0x20, | ||
_40 = 0x40, | ||
_100 = 0x100, | ||
_200 = 0x200, | ||
|
||
_30 = _10 | _20 | ||
}; | ||
|
||
static LinkTag* construct(const BaseProc::CreateArg& arg, sead::Heap* heap); | ||
|
||
explicit LinkTag(const BaseProc::CreateArg& arg); | ||
void calc(); | ||
bool init(); | ||
void updateIsFlagSetFlag(bool isFlagSet, bool a3, bool a4); | ||
|
||
// this doesn't even belong in this namespace, but is used as a placeholder for init() | ||
void isFlagSet(bool* isSet, int unk, map::Object* object); | ||
|
||
BaseProcJobHandlerT<LinkTag> mJob; | ||
sead::LongBitFlag<96> mTriggeredLinkFlags; | ||
Type mLinkTagType = Type::And; | ||
u8 _1dd = 0xFF; | ||
u8 _1de = 0; | ||
u8 _1df = 0xFF; | ||
sead::TypedBitFlag<LinkTagFlag, u16> mFlags; | ||
u8 mTagCount = 0; | ||
u8 field_1E3 = 0; | ||
u32 mCounter = 0; | ||
int field_1E8 = 0; | ||
sead::TypedBitFlag<JobFlag, sead::Atomic<u32>> mJobFlags; | ||
u32 mHashId = 0; | ||
map::MubinIter mMubinIter; | ||
map::Object* mMapObj = nullptr; | ||
}; | ||
KSYS_CHECK_SIZE_NX150(LinkTag, 0x210); | ||
|
||
} // namespace ksys::act |