mirror of
https://github.com/MonsterDruide1/OdysseyDecomp.git
synced 2024-11-26 23:00:25 +00:00
lint: Set RemoveBracesLLVM
(#81)
This commit is contained in:
parent
44cc1b0eb5
commit
0b16ad111f
@ -57,6 +57,7 @@ PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
|
@ -384,11 +384,9 @@ constexpr bool strings_equal(const char* a, const char* b) {
|
||||
}
|
||||
|
||||
static constexpr s32 getUpdateTableIndex(const char* listName) {
|
||||
for (s32 i = 0; i < sizeof(updateTableArr) / sizeof(updateTableArr[0]); i++) {
|
||||
if (strings_equal(updateTableArr[i].mListName, listName)) {
|
||||
for (s32 i = 0; i < sizeof(updateTableArr) / sizeof(updateTableArr[0]); i++)
|
||||
if (strings_equal(updateTableArr[i].mListName, listName))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -403,12 +401,10 @@ createUpdateTable(const char* tableName, const char* startListName, const char*
|
||||
}
|
||||
|
||||
static constexpr s32 getDrawTableIndex(const char* listName, const char* groupName) {
|
||||
for (s32 i = 0; i < sizeof(drawTableArr) / sizeof(drawTableArr[0]); i++) {
|
||||
for (s32 i = 0; i < sizeof(drawTableArr) / sizeof(drawTableArr[0]); i++)
|
||||
if (strings_equal(drawTableArr[i].mListName, listName) &&
|
||||
strings_equal(drawTableArr[i].mExecuteGroup, groupName)) {
|
||||
strings_equal(drawTableArr[i].mExecuteGroup, groupName))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
lib/al/include/Library/Rail/Graph.h
Executable file → Normal file
6
lib/al/include/Library/Rail/Graph.h
Executable file → Normal file
@ -16,11 +16,9 @@ public:
|
||||
s32 getIndex() const { return mIndex; }
|
||||
void addEdge(Edge* edge) { mEdges.pushBack(edge); }
|
||||
void tryAddEdge(Edge* edge) {
|
||||
for (s32 i = 0; i < mEdges.size(); i++) {
|
||||
if (mEdges[i] == edge) {
|
||||
for (s32 i = 0; i < mEdges.size(); i++)
|
||||
if (mEdges[i] == edge)
|
||||
return;
|
||||
}
|
||||
}
|
||||
addEdge(edge);
|
||||
}
|
||||
|
||||
|
6
lib/al/include/Library/Yaml/ByamlUtil.h
Executable file → Normal file
6
lib/al/include/Library/Yaml/ByamlUtil.h
Executable file → Normal file
@ -56,17 +56,15 @@ void getByamlIterByIndex(ByamlIter*, const ByamlIter&, s32);
|
||||
template <ByamlDataType T>
|
||||
bool isTypeByIndex(const ByamlIter& rIter, s32 index) {
|
||||
ByamlData data;
|
||||
if (rIter.getByamlDataByIndex(&data, index)) {
|
||||
if (rIter.getByamlDataByIndex(&data, index))
|
||||
return data.getType() == T;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
template <ByamlDataType T>
|
||||
bool isTypeByKey(const ByamlIter& rIter, const char* key) {
|
||||
ByamlData data;
|
||||
if (rIter.getByamlDataByKey(&data, key)) {
|
||||
if (rIter.getByamlDataByKey(&data, key))
|
||||
return data.getType() == T;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isTypeBoolByIndex(const ByamlIter&, s32);
|
||||
|
@ -69,9 +69,8 @@ ActorActionKeeper* ActorActionKeeper::tryCreate(LiveActor* actor, const ActorRes
|
||||
}
|
||||
|
||||
void ActorActionKeeper::init() {
|
||||
if (mFlagCtrl) {
|
||||
if (mFlagCtrl)
|
||||
mFlagCtrl->initPost();
|
||||
}
|
||||
}
|
||||
bool ActorActionKeeper::startAction(const char* name) {
|
||||
mIsActionRunning = true;
|
||||
|
@ -64,8 +64,7 @@ void ApplicationMessageReceiver::update() {
|
||||
mIsUpdatedPerformanceMode = false;
|
||||
u32 message;
|
||||
|
||||
if (nn::oe::TryPopNotificationMessage(&message)) {
|
||||
if (nn::oe::TryPopNotificationMessage(&message))
|
||||
procMessage(message);
|
||||
}
|
||||
}
|
||||
} // namespace al
|
||||
|
@ -84,11 +84,10 @@ bool AreaShape::calcWorldDir(sead::Vector3f* worldDir, const sead::Vector3f& tra
|
||||
}
|
||||
|
||||
void AreaShape::calcTrans(sead::Vector3f* trans) const {
|
||||
if (mBaseMtxPtr) {
|
||||
if (mBaseMtxPtr)
|
||||
mBaseMtxPtr->getTranslation(*trans);
|
||||
} else {
|
||||
else
|
||||
trans->e = sead::Vector3f::zero.e;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -6,23 +6,20 @@
|
||||
|
||||
namespace al {
|
||||
s32 calcHashCode(const char* str) {
|
||||
if (str[0] == '\0') {
|
||||
if (str[0] == '\0')
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 hashCode = 0;
|
||||
for (s32 i = 0; str[i] != '\0'; i++) {
|
||||
for (s32 i = 0; str[i] != '\0'; i++)
|
||||
hashCode = (hashCode * 0x1f) + str[i];
|
||||
}
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
s32 calcHashCodeLower(const char* str) {
|
||||
s32 hashCode = 0;
|
||||
for (s32 i = 0; str[i] != '\0'; i++) {
|
||||
for (s32 i = 0; str[i] != '\0'; i++)
|
||||
hashCode = (hashCode * 0x1f) + tolower(str[i]);
|
||||
}
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
6
lib/al/src/Library/Base/StringUtil.cpp
Executable file → Normal file
6
lib/al/src/Library/Base/StringUtil.cpp
Executable file → Normal file
@ -9,16 +9,14 @@ bool isEqualString(const char16_t* pString_0, const char16_t* pString_1) {
|
||||
|
||||
while (1) {
|
||||
val = *pString_0;
|
||||
if (val != *pString_1) {
|
||||
if (val != *pString_1)
|
||||
break;
|
||||
}
|
||||
|
||||
++pString_1;
|
||||
++pString_0;
|
||||
|
||||
if (!val) {
|
||||
if (!val)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -11,9 +11,8 @@ namespace al {
|
||||
|
||||
BgmKeeper::BgmKeeper(const AudioSystemInfo* audioInfo, BgmDirector* director, const char* string)
|
||||
: mBgmDirector(director) {
|
||||
if (string != nullptr) {
|
||||
if (string != nullptr)
|
||||
mBgmUserInfo = alBgmFunction::tryFindBgmUserInfo(audioInfo->getBgmDataBase(), string);
|
||||
}
|
||||
}
|
||||
|
||||
BgmKeeper* BgmKeeper::create(const AudioSystemInfo* audioInfo, BgmDirector* director,
|
||||
@ -26,9 +25,8 @@ BgmKeeper* BgmKeeper::create(const AudioSystemInfo* audioInfo, BgmDirector* dire
|
||||
void BgmKeeper::update() {}
|
||||
|
||||
const char* BgmKeeper::getUserName() const {
|
||||
if (mBgmUserInfo == nullptr) {
|
||||
if (mBgmUserInfo == nullptr)
|
||||
return nullptr;
|
||||
}
|
||||
return mBgmUserInfo->mName;
|
||||
}
|
||||
} // namespace al
|
||||
|
@ -8,9 +8,8 @@ sead::ControllerBase* getController_(s32 port) {
|
||||
}
|
||||
|
||||
sead::ControllerBase* getController(s32 port) {
|
||||
if (port == -1) {
|
||||
if (port == -1)
|
||||
port = getMainControllerPort();
|
||||
}
|
||||
|
||||
return getController_(port);
|
||||
}
|
||||
|
@ -6,9 +6,8 @@ namespace al {
|
||||
SceneEventFlowMsg::SceneEventFlowMsg() {}
|
||||
|
||||
bool SceneEventFlowMsg::isReceiveCommand(const char* cmd) const {
|
||||
if (mCmd.isEmpty()) {
|
||||
if (mCmd.isEmpty())
|
||||
return false;
|
||||
}
|
||||
|
||||
return isEqualString(cmd, mCmd.cstr());
|
||||
}
|
||||
|
@ -39,20 +39,16 @@ void ExecuteDirector::init(const ExecuteSystemInitInfo& initInfo) {
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerActorUpdate(LiveActor* actor, const char* tableName) {
|
||||
if (!actor->getExecuteInfo()) {
|
||||
if (!actor->getExecuteInfo())
|
||||
actor->initExecuteInfo(new ActorExecuteInfo(mRequestKeeper));
|
||||
}
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (mUpdateTableCount >= 1)
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
mUpdateTables[i]->tryRegisterActor(actor, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerActorDraw(LiveActor* actor, const char* tableName) {
|
||||
if (!actor->getExecuteInfo()) {
|
||||
if (!actor->getExecuteInfo())
|
||||
actor->initExecuteInfo(new ActorExecuteInfo(mRequestKeeper));
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
mDrawTables[i]->tryRegisterActor(actor, tableName);
|
||||
@ -62,83 +58,60 @@ void ExecuteDirector::registerActorDraw(LiveActor* actor, const char* tableName)
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerActorModelDraw(LiveActor* actor, const char* tableName) {
|
||||
if (!actor->getExecuteInfo()) {
|
||||
if (!actor->getExecuteInfo())
|
||||
actor->initExecuteInfo(new ActorExecuteInfo(mRequestKeeper));
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->tryRegisterActorModel(actor, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerLayoutUpdate(LayoutActor* lyt, const char* tableName) {
|
||||
if (!lyt->getExecuteInfo()) {
|
||||
if (!lyt->getExecuteInfo())
|
||||
lyt->initExecuteInfo(new LayoutExecuteInfo());
|
||||
}
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (mUpdateTableCount >= 1)
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
mUpdateTables[i]->tryRegisterLayout(lyt, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerLayoutDraw(LayoutActor* lyt, const char* tableName) {
|
||||
if (!lyt->getExecuteInfo()) {
|
||||
if (!lyt->getExecuteInfo())
|
||||
lyt->initExecuteInfo(new LayoutExecuteInfo());
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->tryRegisterLayout(lyt, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerUser(IUseExecutor* user, const char* tableName) {
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (mUpdateTableCount >= 1)
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
mUpdateTables[i]->tryRegisterUser(user, tableName);
|
||||
}
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->tryRegisterUser(user, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerFunctor(const FunctorBase& functor, const char* tableName) {
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (mUpdateTableCount >= 1)
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
mUpdateTables[i]->tryRegisterFunctor(functor, tableName);
|
||||
}
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->tryRegisterFunctor(functor, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::registerFunctorDraw(const FunctorBase& functor, const char* tableName) {
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->tryRegisterFunctor(functor, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::createExecutorListTable() {
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (mUpdateTableCount >= 1)
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
mUpdateTables[i]->createExecutorListTable();
|
||||
}
|
||||
}
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (mDrawTableCount >= 1)
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
mDrawTables[i]->createExecutorListTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExecuteDirector::execute(const char* tableName) const {
|
||||
@ -188,11 +161,9 @@ void ExecuteDirector::executeList(const char* tableName, const char* listName) c
|
||||
mRequestKeeper->executeRequestActorDrawAllOn();
|
||||
if (tableName) {
|
||||
if (mUpdateTableCount >= 1) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i) {
|
||||
if (isEqualString(tableName, mUpdateTables[i]->getName())) {
|
||||
for (s32 i = 0; i < mUpdateTableCount; ++i)
|
||||
if (isEqualString(tableName, mUpdateTables[i]->getName()))
|
||||
mUpdateTables[i]->executeList(listName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mUpdateTables[0]->executeList(listName);
|
||||
@ -230,11 +201,9 @@ void ExecuteDirector::drawList(const char* tableName, const char* listName) cons
|
||||
bool ExecuteDirector::isActiveDraw(const char* tableName) const {
|
||||
if (tableName) {
|
||||
if (mDrawTableCount >= 1) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i) {
|
||||
if (isEqualString(tableName, mDrawTables[i]->getName())) {
|
||||
for (s32 i = 0; i < mDrawTableCount; ++i)
|
||||
if (isEqualString(tableName, mDrawTables[i]->getName()))
|
||||
return mDrawTables[i]->isActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return mDrawTables[0]->isActive();
|
||||
|
@ -5,14 +5,12 @@
|
||||
namespace al {
|
||||
void LayoutPartsActorKeeper::resisterPartsActor(LayoutActor* actor) {}
|
||||
void LayoutPartsActorKeeper::appear() {
|
||||
for (s32 i = 0; i < mNumActors; i++) {
|
||||
for (s32 i = 0; i < mNumActors; i++)
|
||||
mPartsActors[i]->appear();
|
||||
}
|
||||
}
|
||||
void LayoutPartsActorKeeper::calcAnim(bool recursive) {
|
||||
for (s32 i = 0; i < mNumActors; i++) {
|
||||
for (s32 i = 0; i < mNumActors; i++)
|
||||
mPartsActors[i]->calcAnim(recursive);
|
||||
}
|
||||
}
|
||||
LayoutPartsActorKeeper::LayoutPartsActorKeeper(s32 maxActors) : mMaxActors(maxActors) {
|
||||
mPartsActors = new LayoutActor*[maxActors];
|
||||
|
@ -24,12 +24,10 @@ bool tryStartAction(LiveActor* actor, const char* actionName) {
|
||||
bool mtsStarted = tryStartMtsAnimIfExist(actor, actionName);
|
||||
bool visStarted = tryStartVisAnimIfExistForAction(actor, actionName);
|
||||
|
||||
if (!sklStarted && !mtpStarted && !mclStarted && !mtsStarted && !visStarted) {
|
||||
if (!sklStarted && !mtpStarted && !mclStarted && !mtsStarted && !visStarted)
|
||||
return false;
|
||||
}
|
||||
if (!actor->getActorActionKeeper()) {
|
||||
if (!actor->getActorActionKeeper())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
actor->getActorActionKeeper()->startAction(actionName);
|
||||
return true;
|
||||
|
@ -158,10 +158,9 @@ void setSklAnimBlendFrameAll(LiveActor* actor, f32 frame, bool isSync) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++) {
|
||||
for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++)
|
||||
if (getSkl(actor)->isSklAnimPlaying(j))
|
||||
getSkl(actor)->setSklAnimFrame(j, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
void setSklAnimBlendFrameRateAll(LiveActor* actor, f32 frameRate, bool isSync) {
|
||||
@ -177,10 +176,9 @@ void setSklAnimBlendFrameRateAll(LiveActor* actor, f32 frameRate, bool isSync) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++) {
|
||||
for (s32 j = 1; j < sklAnim->getSklAnimBlendNum(); j++)
|
||||
if (getSkl(actor)->isSklAnimPlaying(j))
|
||||
getSkl(actor)->setSklAnimFrameRate(j, frameRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
void startMtpAnim(LiveActor* actor, const char* animName) {
|
||||
|
@ -44,9 +44,8 @@ void resetPosition(LiveActor* actor) {
|
||||
alSensorFunction::clearHitSensors(actor);
|
||||
alSensorFunction::updateHitSensorsAll(actor);
|
||||
}
|
||||
if (actor->getScreenPointKeeper()) {
|
||||
if (actor->getScreenPointKeeper())
|
||||
alScreenPointFunction::updateScreenPointAll(actor);
|
||||
}
|
||||
if (actor->getCollider())
|
||||
actor->getCollider()->onInvalidate();
|
||||
if (actor->getCollisionParts())
|
||||
|
45
lib/al/src/Library/LiveActor/LiveActorGroup.cpp
Executable file → Normal file
45
lib/al/src/Library/LiveActor/LiveActorGroup.cpp
Executable file → Normal file
@ -31,15 +31,12 @@ void LiveActorGroup::removeActorAll() {
|
||||
}
|
||||
|
||||
bool LiveActorGroup::isExistActor(const LiveActor* pActor) const {
|
||||
if (mActorCount < 1) {
|
||||
if (mActorCount < 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (mActors[i] == pActor) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (mActors[i] == pActor)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -51,60 +48,48 @@ bool LiveActorGroup::isFull() const {
|
||||
s32 LiveActorGroup::calcAliveActorNum() const {
|
||||
s32 count = 0;
|
||||
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (!isDead(mActors[i])) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (!isDead(mActors[i]))
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
LiveActor* LiveActorGroup::getDeadActor() const {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (isDead(mActors[i])) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (isDead(mActors[i]))
|
||||
return mActors[i];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LiveActor* LiveActorGroup::tryFindDeadActor() const {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (isDead(mActors[i])) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (isDead(mActors[i]))
|
||||
return mActors[i];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LiveActorGroup::appearAll() {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (isDead(mActors[i])) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (isDead(mActors[i]))
|
||||
mActors[i]->appear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LiveActorGroup::killAll() {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (isAlive(mActors[i])) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (isAlive(mActors[i]))
|
||||
mActors[i]->kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LiveActorGroup::makeActorAliveAll() {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
mActors[i]->makeActorAlive();
|
||||
}
|
||||
}
|
||||
|
||||
void LiveActorGroup::makeActorDeadAll() {
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
mActors[i]->makeActorDead();
|
||||
}
|
||||
}
|
||||
} // namespace al
|
||||
|
@ -54,30 +54,25 @@ LiveActorKit::~LiveActorKit() {
|
||||
delete mModelGroup;
|
||||
mModelGroup = nullptr;
|
||||
}
|
||||
if (mGraphicsSystemInfo) {
|
||||
if (mGraphicsSystemInfo)
|
||||
delete mGraphicsSystemInfo;
|
||||
}
|
||||
if (mModelDrawBufferUpdater) {
|
||||
if (mModelDrawBufferUpdater)
|
||||
delete mModelDrawBufferUpdater;
|
||||
}
|
||||
|
||||
if (mExecutorCore1)
|
||||
delete mExecutorCore1;
|
||||
if (mExecutorCore2)
|
||||
delete mExecutorCore2;
|
||||
|
||||
if (mDynamicDrawActorGroup) {
|
||||
for (s32 i = 0; i < mDynamicDrawActorGroup->getActorCount(); i++) {
|
||||
if (mDynamicDrawActorGroup)
|
||||
for (s32 i = 0; i < mDynamicDrawActorGroup->getActorCount(); i++)
|
||||
((DynamicDrawActor*)mDynamicDrawActorGroup->getActor(i))->finalize();
|
||||
}
|
||||
}
|
||||
|
||||
if (mEffectSystem) {
|
||||
mEffectSystem->endScene();
|
||||
mEffectSystem->setCameraDirector(nullptr);
|
||||
if (mEffectSystem) {
|
||||
if (mEffectSystem)
|
||||
mEffectSystem->setGraphicsSystemInfo(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,8 @@ void SubActorKeeper::init(const ActorInitInfo& initInfo, const char* suffix, s32
|
||||
u8* modelResourceYaml;
|
||||
|
||||
if (isExistModelResource(mRootActor) &&
|
||||
!tryGetActorInitFileName(&actorInitFileName, mRootActor, "InitSubActor", suffix)) {
|
||||
!tryGetActorInitFileName(&actorInitFileName, mRootActor, "InitSubActor", suffix))
|
||||
createFileNameBySuffix(&actorInitFileName, "InitSubActor", suffix);
|
||||
}
|
||||
|
||||
if (isExistModelResource(mRootActor) &&
|
||||
isExistModelResourceYaml(mRootActor, actorInitFileName.cstr(), nullptr)) {
|
||||
|
@ -16,9 +16,8 @@ void FixMapParts::init(const ActorInitInfo& info) {
|
||||
trySyncStageSwitchAppearAndKill(this);
|
||||
registActorToDemoInfo(this, info);
|
||||
|
||||
if (getModelKeeper() != nullptr && !isExistAction(this) && !isViewDependentModel(this)) {
|
||||
if (getModelKeeper() != nullptr && !isExistAction(this) && !isViewDependentModel(this))
|
||||
mIsStatic = true;
|
||||
}
|
||||
}
|
||||
void FixMapParts::appear() {
|
||||
LiveActor::appear();
|
||||
|
12
lib/al/src/Library/Math/MathUtil.cpp
Executable file → Normal file
12
lib/al/src/Library/Math/MathUtil.cpp
Executable file → Normal file
@ -55,23 +55,19 @@ f32 easeInOut(f32 var) {
|
||||
f32 sign(f32 result) {
|
||||
f32 v1;
|
||||
v1 = result < 0.0f;
|
||||
if (result > 0.0f) {
|
||||
if (result > 0.0f)
|
||||
result = 1.0f;
|
||||
}
|
||||
if (v1) {
|
||||
if (v1)
|
||||
result = -1.0f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 sign(s32 var) {
|
||||
if (var < 0) {
|
||||
if (var < 0)
|
||||
return -1;
|
||||
}
|
||||
if (var > 0) {
|
||||
if (var > 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -145,9 +145,8 @@ void createWorldResourceHeap(bool useCategory) {
|
||||
}
|
||||
|
||||
void destroyWorldResourceHeap(bool removeCategory) {
|
||||
if (removeCategory) {
|
||||
if (removeCategory)
|
||||
removeResourceCategory("ワールド常駐");
|
||||
}
|
||||
|
||||
clearFileLoaderEntry();
|
||||
alProjectInterface::getSystemKit()->getMemorySystem()->destroyWorldResourceHeap();
|
||||
|
@ -6,9 +6,8 @@
|
||||
namespace al {
|
||||
NerveKeeper::NerveKeeper(IUseNerve* parent, const Nerve* nerve, s32 maxStates)
|
||||
: mParent(parent), mNextNerve(nullptr) {
|
||||
if (maxStates > 0) {
|
||||
if (maxStates > 0)
|
||||
mStateCtrl = new NerveStateCtrl(maxStates);
|
||||
}
|
||||
}
|
||||
void NerveKeeper::initNerveAction(NerveActionCtrl* actionCtrl) {
|
||||
mActionCtrl = actionCtrl;
|
||||
|
@ -17,9 +17,8 @@ void NerveStateBase::kill() {
|
||||
bool NerveStateBase::update() {
|
||||
updateNerve();
|
||||
|
||||
if (mIsDead) {
|
||||
if (mIsDead)
|
||||
return true;
|
||||
}
|
||||
|
||||
control();
|
||||
|
||||
|
@ -12,9 +12,8 @@ void NerveStateCtrl::addState(NerveStateBase* state, const Nerve* nerve, const c
|
||||
|
||||
// run the state's update function, if there is a current state active
|
||||
bool NerveStateCtrl::updateCurrentState() {
|
||||
if (!mCurrentState) {
|
||||
if (!mCurrentState)
|
||||
return false;
|
||||
}
|
||||
|
||||
return mCurrentState->state->update();
|
||||
}
|
||||
@ -23,11 +22,9 @@ bool NerveStateCtrl::updateCurrentState() {
|
||||
// uses a supplied nerve pointer to compare it with the nerves contained in states
|
||||
// returns the matching nerve, if any
|
||||
NerveStateCtrl::State* NerveStateCtrl::findStateInfo(const Nerve* nerve) {
|
||||
for (s32 i = 0; i < mStateCount; i++) {
|
||||
if (mStates[i].nerve == nerve) {
|
||||
for (s32 i = 0; i < mStateCount; i++)
|
||||
if (mStates[i].nerve == nerve)
|
||||
return &mStates[i];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@ -35,9 +32,8 @@ NerveStateCtrl::State* NerveStateCtrl::findStateInfo(const Nerve* nerve) {
|
||||
// determines if the current state on the controller has ended
|
||||
// this can occur if there is no state, or if the base is not considered dead
|
||||
bool NerveStateCtrl::isCurrentStateEnd() const {
|
||||
if (!mCurrentState) {
|
||||
if (!mCurrentState)
|
||||
return true;
|
||||
}
|
||||
|
||||
return mCurrentState->state->isDead() != 0;
|
||||
}
|
||||
@ -46,18 +42,16 @@ bool NerveStateCtrl::isCurrentStateEnd() const {
|
||||
// controller contained in the nerve keeper
|
||||
void NerveStateCtrl::tryEndCurrentState() {
|
||||
if (mCurrentState) {
|
||||
if (!mCurrentState->state->isDead()) {
|
||||
if (!mCurrentState->state->isDead())
|
||||
mCurrentState->state->kill();
|
||||
}
|
||||
|
||||
NerveKeeper* keeper = mCurrentState->state->getNerveKeeper();
|
||||
|
||||
if (keeper) {
|
||||
NerveStateCtrl* ctrl = keeper->getStateCtrl();
|
||||
|
||||
if (ctrl) {
|
||||
if (ctrl)
|
||||
ctrl->tryEndCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
mCurrentState = nullptr;
|
||||
|
@ -6,9 +6,8 @@ AccountHolder::AccountHolder() {
|
||||
mUserHandle = new nn::account::UserHandle;
|
||||
|
||||
if (nn::account::OpenPreselectedUser(mUserHandle).IsSuccess() &&
|
||||
nn::account::GetUserId(&mUid, *mUserHandle).IsSuccess()) {
|
||||
nn::account::GetUserId(&mUid, *mUserHandle).IsSuccess())
|
||||
mIsValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
AccountHolder::~AccountHolder() {
|
||||
|
@ -13,30 +13,25 @@ AllDeadWatcher::AllDeadWatcher(const char* name) : LiveActor(name) {}
|
||||
void AllDeadWatcher::appear() {
|
||||
LiveActor::appear();
|
||||
|
||||
if (mIsNotControlActorAppear) {
|
||||
if (mIsNotControlActorAppear)
|
||||
return;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < mTargetCount; i++) {
|
||||
for (s32 i = 0; i < mTargetCount; i++)
|
||||
mTargets[i]->appear();
|
||||
}
|
||||
}
|
||||
|
||||
void AllDeadWatcher::exeWait() {
|
||||
if (!isGreaterEqualStep(this, mSwitchOnDelayStep)) {
|
||||
if (!isGreaterEqualStep(this, mSwitchOnDelayStep))
|
||||
return;
|
||||
}
|
||||
|
||||
kill();
|
||||
tryOnSwitchDeadOn(this);
|
||||
}
|
||||
|
||||
void AllDeadWatcher::exeWatch() {
|
||||
for (s32 i = 0; i < mTargetCount; i++) {
|
||||
if (isAlive(mTargets[i])) {
|
||||
for (s32 i = 0; i < mTargetCount; i++)
|
||||
if (isAlive(mTargets[i]))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setNerve(this, &NrvAllDeadWatcher.Watch);
|
||||
}
|
||||
@ -50,20 +45,17 @@ void AllDeadWatcher::init(const ActorInitInfo& info) {
|
||||
mTargetCount = calcLinkChildNum(info, "WatchTargetEnemy");
|
||||
mTargets = new LiveActor*[mTargetCount];
|
||||
|
||||
for (s32 i = 0; i < mTargetCount; i++) {
|
||||
for (s32 i = 0; i < mTargetCount; i++)
|
||||
mTargets[i] = createLinksActorFromFactory(info, "WatchTargetEnemy", i);
|
||||
}
|
||||
|
||||
tryGetArg(&mSwitchOnDelayStep, info, "SwitchOnDelayStep");
|
||||
mIsNotControlActorAppear = tryGetBoolArgOrFalse(info, "IsNotControlActorAppear");
|
||||
|
||||
if (!trySyncStageSwitchAppear(this) || mIsNotControlActorAppear) {
|
||||
if (!trySyncStageSwitchAppear(this) || mIsNotControlActorAppear)
|
||||
return;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < mTargetCount; i++) {
|
||||
for (s32 i = 0; i < mTargetCount; i++)
|
||||
mTargets[i]->makeActorDead();
|
||||
}
|
||||
}
|
||||
|
||||
void AllDeadWatcher::kill() {
|
||||
|
14
lib/al/src/Library/Placement/PlacementFunction.cpp
Executable file → Normal file
14
lib/al/src/Library/Placement/PlacementFunction.cpp
Executable file → Normal file
@ -14,18 +14,16 @@ void getPlacementInfoByKey(PlacementInfo* pOutInfo, const PlacementInfo& rInfo,
|
||||
ByamlIter iterator;
|
||||
bool ret = rInfo.getPlacementIter().tryGetIterByKey(&iterator, pKey);
|
||||
|
||||
if (ret) {
|
||||
if (ret)
|
||||
pOutInfo->set(iterator, rInfo.getZoneIter());
|
||||
}
|
||||
}
|
||||
|
||||
void getPlacementInfoByIndex(PlacementInfo* pOutInfo, const PlacementInfo& rInfo, s32 idx) {
|
||||
ByamlIter iterator;
|
||||
bool ret = rInfo.getPlacementIter().tryGetIterByIndex(&iterator, idx);
|
||||
|
||||
if (ret) {
|
||||
if (ret)
|
||||
pOutInfo->set(iterator, rInfo.getZoneIter());
|
||||
}
|
||||
}
|
||||
|
||||
bool tryGetPlacementInfoByIndex(PlacementInfo* pOutInfo, const PlacementInfo& rInfo, s32 idx) {
|
||||
@ -50,9 +48,8 @@ void getPlacementInfoAndKeyNameByIndex(PlacementInfo* pOutInfo, const char** pOu
|
||||
|
||||
bool ret = rInfo.getPlacementIter().tryGetIterAndKeyNameByIndex(&iterator, pOutKeyName, idx);
|
||||
|
||||
if (ret) {
|
||||
if (ret)
|
||||
pOutInfo->set(iterator, rInfo.getZoneIter());
|
||||
}
|
||||
}
|
||||
|
||||
bool tryGetPlacementInfoAndKeyNameByIndex(PlacementInfo* pOutInfo, const char** pOutKeyName,
|
||||
@ -112,11 +109,10 @@ bool isEqualPlacementId(const PlacementInfo& rLhs, const PlacementInfo& rRhs) {
|
||||
if (id_lhs.init(rLhs)) {
|
||||
PlacementId id_rhs;
|
||||
|
||||
if (id_rhs.init(rRhs)) {
|
||||
if (id_rhs.init(rRhs))
|
||||
res = id_lhs.isEqual(id_rhs);
|
||||
} else {
|
||||
else
|
||||
res = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
res = false;
|
||||
|
@ -104,9 +104,8 @@ void CameraVerticalAbsorber::update() {
|
||||
mLookAtCamera.getUp().normalize();
|
||||
if (!unk_unusedBool && !mIsInvalidated) {
|
||||
mLookAtCamera.getAt() -= mTargetInterp;
|
||||
if (!mIsNoCameraPosAbsorb) {
|
||||
if (!mIsNoCameraPosAbsorb)
|
||||
mLookAtCamera.getPos() -= mTargetInterp;
|
||||
}
|
||||
}
|
||||
mLookAtCamera.doUpdateMatrix(&mLookAtCamera.getMatrix());
|
||||
mProjection.set(alCameraPoserFunction::getNear(mCameraPoser),
|
||||
@ -115,13 +114,11 @@ void CameraVerticalAbsorber::update() {
|
||||
alCameraPoserFunction::getAspect(mCameraPoser));
|
||||
alCameraPoserFunction::calcTargetFront(&mTargetFront, mCameraPoser);
|
||||
if (!isNerve(this, &NrvCameraVerticalAbsorber.FollowGround) &&
|
||||
alCameraPoserFunction::isTargetCollideGround(mCameraPoser)) {
|
||||
alCameraPoserFunction::isTargetCollideGround(mCameraPoser))
|
||||
setNerve(this, &NrvCameraVerticalAbsorber.FollowGround);
|
||||
}
|
||||
if (!isNerve(this, &NrvCameraVerticalAbsorber.FollowAbsolute) &&
|
||||
alCameraPoserFunction::isPlayerTypeNotTouchGround(mCameraPoser)) {
|
||||
alCameraPoserFunction::isPlayerTypeNotTouchGround(mCameraPoser))
|
||||
setNerve(this, &NrvCameraVerticalAbsorber.FollowAbsolute);
|
||||
}
|
||||
updateNerve();
|
||||
sead::Vector3f prevTargetTrans = sead::Vector3f::zero;
|
||||
if (!mIsKeepInFrame) {
|
||||
|
@ -26,11 +26,10 @@ LiveActor* PlayerHolder::getPlayer(s32 index) const {
|
||||
}
|
||||
|
||||
LiveActor* PlayerHolder::tryGetPlayer(s32 index) const {
|
||||
if (mBufferSize <= index) {
|
||||
if (mBufferSize <= index)
|
||||
return nullptr;
|
||||
} else if (mPlayerNum <= index) {
|
||||
else if (mPlayerNum <= index)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mPlayers[index].mActor;
|
||||
}
|
||||
|
@ -18,9 +18,8 @@ s32 getAlivePlayerNum(const PlayerHolder* holder) {
|
||||
|
||||
for (s32 i = 0; i < player_num; i++) {
|
||||
LiveActor* player = holder->tryGetPlayer(i);
|
||||
if (isAlive(player)) {
|
||||
if (isAlive(player))
|
||||
alive_players++;
|
||||
}
|
||||
}
|
||||
|
||||
return alive_players;
|
||||
@ -54,9 +53,8 @@ LiveActor* tryFindAlivePlayerActorFirst(const PlayerHolder* holder) {
|
||||
|
||||
for (u32 i = 0; i < player_num; i++) {
|
||||
LiveActor* player = holder->tryGetPlayer(i);
|
||||
if (!isDead(player)) {
|
||||
if (!isDead(player))
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -67,9 +65,8 @@ LiveActor* findAlivePlayerActorFirst(const PlayerHolder* holder) {
|
||||
|
||||
for (u32 i = 0; i < player_num; i++) {
|
||||
LiveActor* player = holder->tryGetPlayer(i);
|
||||
if (!isDead(player)) {
|
||||
if (!isDead(player))
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -22,9 +22,8 @@ void Graph::appendVertex(Vertex* vertex) {
|
||||
void Graph::removeVertex(const Vertex* vertex) { // FIXME mismatching
|
||||
for (s32 i = 0; i < mVertices.size(); i++) {
|
||||
if (mVertices[i] == vertex) {
|
||||
for (s32 i = 0; i < vertex->getEdges().size(); i++) {
|
||||
for (s32 i = 0; i < vertex->getEdges().size(); i++)
|
||||
removeEdge(vertex->getEdges()[i]);
|
||||
}
|
||||
mVertices.erase(i);
|
||||
return;
|
||||
}
|
||||
@ -44,9 +43,8 @@ Graph::Edge* Graph::tryFindEdge(s32 index_vertex1, s32 index_vertex2) const {
|
||||
for (s32 i = 0; i < mEdges.size(); i++) {
|
||||
auto* edge = mEdges[i];
|
||||
if (edge->getVertex1()->getIndex() == index_vertex1 &&
|
||||
edge->getVertex2()->getIndex() == index_vertex2) {
|
||||
edge->getVertex2()->getIndex() == index_vertex2)
|
||||
return edge;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -72,11 +72,10 @@ s32 Rail::getIncludedSection(const RailPart** part, f32* partDistance, f32 dista
|
||||
s64 longI = -0x100000000;
|
||||
for (s32 i = 0; i < mRailPartCount; i++) {
|
||||
if (distanceOnRail <= mRailPart[i].getTotalDistance()) {
|
||||
if (i <= 0) {
|
||||
if (i <= 0)
|
||||
startDistanceOnRail = distanceOnRail;
|
||||
} else {
|
||||
else
|
||||
startDistanceOnRail = distanceOnRail - mRailPart[longI >> 32].getTotalDistance();
|
||||
}
|
||||
maxRailPart = i;
|
||||
break;
|
||||
}
|
||||
@ -249,19 +248,17 @@ f32 Rail::getIncludedSectionLength(f32* partDistance, f32* length, f32 distance)
|
||||
const RailPart* part = nullptr;
|
||||
getIncludedSection(&part, partDistance, distance);
|
||||
f32 partLength = part->getPartLength();
|
||||
if (partDistance && length) {
|
||||
if (partDistance && length)
|
||||
*length = partLength - *partDistance;
|
||||
}
|
||||
return partLength;
|
||||
}
|
||||
s32 Rail::getIncludedSectionIndex(f32 distance) const {
|
||||
return getIncludedSection(nullptr, nullptr, distance);
|
||||
}
|
||||
bool Rail::isIncludeBezierRailPart() const {
|
||||
for (s32 i = 0; i < mRailPartCount; i++) {
|
||||
for (s32 i = 0; i < mRailPartCount; i++)
|
||||
if (isBezierRailPart(i))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool Rail::isBezierRailPart(s32 index) const {
|
||||
|
@ -43,11 +43,10 @@ void RailPart::calcDir(sead::Vector3f* dir, f32 param) const {
|
||||
dir->x = endPos.x - startPos.x;
|
||||
dir->y = endPos.y - startPos.y;
|
||||
dir->z = endPos.z - startPos.z;
|
||||
if (isNearZero(*dir, 0.001)) {
|
||||
if (isNearZero(*dir, 0.001))
|
||||
*dir = {0, 0, 1};
|
||||
} else {
|
||||
else
|
||||
normalize(dir);
|
||||
}
|
||||
}
|
||||
void RailPart::calcStartPos(sead::Vector3f* pos) const {
|
||||
return mBezierCurve ? mBezierCurve->calcStartPos(pos) : mLinearCurve->calcStartPos(pos);
|
||||
|
@ -8,9 +8,8 @@ SceneObjHolder::SceneObjHolder(ISceneObj* (*creator)(s32), s32 size)
|
||||
: mCreator(creator), mArraySize(size) {
|
||||
mSceneObjArray = new ISceneObj*[size];
|
||||
|
||||
for (s32 i = 0; i < mArraySize; i++) {
|
||||
for (s32 i = 0; i < mArraySize; i++)
|
||||
mSceneObjArray[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ISceneObj* SceneObjHolder::create(s32 index) {
|
||||
@ -37,10 +36,9 @@ void SceneObjHolder::setSceneObj(ISceneObj* obj, s32 index) {
|
||||
}
|
||||
|
||||
void SceneObjHolder::initAfterPlacementSceneObj(const ActorInitInfo& info) {
|
||||
for (s32 i = 0; i < mArraySize; i++) {
|
||||
for (s32 i = 0; i < mArraySize; i++)
|
||||
if (mSceneObjArray[i])
|
||||
mSceneObjArray[i]->initAfterPlacementSceneObj(info);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
6
lib/al/src/Library/Yaml/ByamlData.cpp
Executable file → Normal file
6
lib/al/src/Library/Yaml/ByamlData.cpp
Executable file → Normal file
@ -51,9 +51,8 @@ const ByamlHashPair* ByamlHashIter::findPair(s32 key) const {
|
||||
s32 avg = (lowerBound + upperBound) / 2;
|
||||
const ByamlHashPair* pair = &pairTable[avg];
|
||||
s32 result = key - pair->getKey(mIsRev);
|
||||
if (result == 0) {
|
||||
if (result == 0)
|
||||
return pair;
|
||||
}
|
||||
|
||||
if (result > 0)
|
||||
lowerBound = avg + 1;
|
||||
@ -92,9 +91,8 @@ bool ByamlHashIter::getDataByKey(ByamlData* data, s32 key) const {
|
||||
s32 avg = (lowerBound + upperBound) / 2;
|
||||
pair = &pairTable[avg];
|
||||
s32 result = key - pair->getKey(mIsRev);
|
||||
if (result == 0) {
|
||||
if (result == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (result > 0)
|
||||
lowerBound = avg + 1;
|
||||
|
@ -168,12 +168,10 @@ bool ByamlIter::tryGetIterAndKeyNameByIndex(ByamlIter* iter, const char** key, s
|
||||
return iter->isValid();
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_ARRAY || data.getType() == ByamlDataType::TYPE_HASH) {
|
||||
if (data.getType() == ByamlDataType::TYPE_ARRAY || data.getType() == ByamlDataType::TYPE_HASH)
|
||||
*iter = {mData, &mData[data.getValue()]};
|
||||
}
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL) {
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
*iter = {mData, nullptr};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool ByamlIter::tryGetIterByKey(ByamlIter* iter, const char* key) const {
|
||||
@ -195,17 +193,15 @@ bool ByamlIter::tryConvertIter(ByamlIter* iter, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetStringByIndex(const char** value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertString(value, &data);
|
||||
}
|
||||
bool ByamlIter::tryGetStringByKey(const char** value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -213,9 +209,8 @@ bool ByamlIter::tryGetStringByKey(const char** value, const char* key) const {
|
||||
}
|
||||
|
||||
bool ByamlIter::tryConvertString(const char** value, const ByamlData* data) const {
|
||||
if (data->getType() != ByamlDataType::TYPE_STRING) {
|
||||
if (data->getType() != ByamlDataType::TYPE_STRING)
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto string_table = alByamlLocalUtil::getStringTable(mData);
|
||||
if (!string_table.isValidate())
|
||||
@ -226,24 +221,21 @@ bool ByamlIter::tryConvertString(const char** value, const ByamlData* data) cons
|
||||
}
|
||||
bool ByamlIter::tryGetBinaryByIndex(const u8** value, s32* size, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertBinary(value, size, &data);
|
||||
}
|
||||
bool ByamlIter::tryGetBinaryByKey(const u8** value, s32* size, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertBinary(value, size, &data);
|
||||
}
|
||||
bool ByamlIter::tryConvertBinary(const u8** value, s32* size, const ByamlData* data) const {
|
||||
if (data->getType() != ByamlDataType::TYPE_STRING) {
|
||||
if (data->getType() != ByamlDataType::TYPE_STRING)
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto string_table = alByamlLocalUtil::getStringTable(mData);
|
||||
if (!string_table.isValidate())
|
||||
@ -256,18 +248,16 @@ bool ByamlIter::tryConvertBinary(const u8** value, s32* size, const ByamlData* d
|
||||
|
||||
bool ByamlIter::tryGetIntByIndex(s32* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertInt(value, &data);
|
||||
}
|
||||
|
||||
bool ByamlIter::tryGetIntByKey(s32* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -275,9 +265,8 @@ bool ByamlIter::tryGetIntByKey(s32* value, const char* key) const {
|
||||
}
|
||||
|
||||
bool ByamlIter::tryConvertInt(s32* value, const ByamlData* data) const {
|
||||
if (data->getType() != ByamlDataType::TYPE_INT) {
|
||||
if (data->getType() != ByamlDataType::TYPE_INT)
|
||||
return false;
|
||||
}
|
||||
|
||||
*value = data->getValue();
|
||||
return true;
|
||||
@ -286,9 +275,8 @@ bool ByamlIter::tryConvertInt(s32* value, const ByamlData* data) const {
|
||||
// NON_MATCHING: mismatch in inlined convert
|
||||
bool ByamlIter::tryGetUIntByIndex(u32* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertUInt(value, &data);
|
||||
}
|
||||
@ -296,9 +284,8 @@ bool ByamlIter::tryGetUIntByIndex(u32* value, s32 index) const {
|
||||
// NON_MATCHING: mismatch in inlined convert
|
||||
bool ByamlIter::tryGetUIntByKey(u32* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -322,26 +309,23 @@ bool ByamlIter::tryConvertUInt(u32* value, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetFloatByIndex(f32* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertFloat(value, &data);
|
||||
}
|
||||
bool ByamlIter::tryGetFloatByKey(f32* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
return tryConvertFloat(value, &data);
|
||||
}
|
||||
bool ByamlIter::tryConvertFloat(f32* value, const ByamlData* data) const {
|
||||
if (data->getType() != ByamlDataType::TYPE_FLOAT) {
|
||||
if (data->getType() != ByamlDataType::TYPE_FLOAT)
|
||||
return false;
|
||||
}
|
||||
|
||||
*value = data->getValue<f32>();
|
||||
return true;
|
||||
@ -349,18 +333,16 @@ bool ByamlIter::tryConvertFloat(f32* value, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetBoolByIndex(bool* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
return tryConvertBool(value, &data);
|
||||
}
|
||||
|
||||
bool ByamlIter::tryGetBoolByKey(bool* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -368,9 +350,8 @@ bool ByamlIter::tryGetBoolByKey(bool* value, const char* key) const {
|
||||
}
|
||||
|
||||
bool ByamlIter::tryConvertBool(bool* value, const ByamlData* data) const {
|
||||
if (data->getType() != ByamlDataType::TYPE_BOOL) {
|
||||
if (data->getType() != ByamlDataType::TYPE_BOOL)
|
||||
return false;
|
||||
}
|
||||
|
||||
*value = data->getValue() != 0;
|
||||
return true;
|
||||
@ -378,9 +359,8 @@ bool ByamlIter::tryConvertBool(bool* value, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetInt64ByIndex(s64* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -389,9 +369,8 @@ bool ByamlIter::tryGetInt64ByIndex(s64* value, s32 index) const {
|
||||
|
||||
bool ByamlIter::tryGetInt64ByKey(s64* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -418,9 +397,8 @@ bool ByamlIter::tryConvertInt64(s64* value, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetUInt64ByIndex(u64* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -429,9 +407,8 @@ bool ByamlIter::tryGetUInt64ByIndex(u64* value, s32 index) const {
|
||||
|
||||
bool ByamlIter::tryGetUInt64ByKey(u64* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -466,9 +443,8 @@ bool ByamlIter::tryConvertUInt64(u64* value, const ByamlData* data) const {
|
||||
|
||||
bool ByamlIter::tryGetDoubleByIndex(f64* value, s32 index) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByIndex(&data, index)) {
|
||||
if (!getByamlDataByIndex(&data, index))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -477,9 +453,8 @@ bool ByamlIter::tryGetDoubleByIndex(f64* value, s32 index) const {
|
||||
|
||||
bool ByamlIter::tryGetDoubleByKey(f64* value, const char* key) const {
|
||||
ByamlData data;
|
||||
if (!getByamlDataByKey(&data, key)) {
|
||||
if (!getByamlDataByKey(&data, key))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data.getType() == ByamlDataType::TYPE_NULL)
|
||||
return false;
|
||||
@ -502,9 +477,8 @@ bool ByamlIter::tryConvertDouble(f64* value, const ByamlData* data) const {
|
||||
}
|
||||
|
||||
bool ByamlIter::isEqualData(const ByamlIter& other) const {
|
||||
if (!mData || !other.mData) {
|
||||
if (!mData || !other.mData)
|
||||
return false;
|
||||
}
|
||||
|
||||
return mData == other.mData && mRootNode == other.mRootNode;
|
||||
}
|
||||
|
6
lib/al/src/Library/Yaml/ByamlUtil.cpp
Executable file → Normal file
6
lib/al/src/Library/Yaml/ByamlUtil.cpp
Executable file → Normal file
@ -38,9 +38,8 @@ bool tryGetByamlS32(s32* pOut, const ByamlIter& rIter, const char* pKey) {
|
||||
bool tryGetByamlU32(u32* pOut, const ByamlIter& rIter, const char* pKey) {
|
||||
s32 value = 0;
|
||||
bool res = rIter.tryGetIntByKey(&value, pKey);
|
||||
if (res) {
|
||||
if (res)
|
||||
*pOut = value;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -51,9 +50,8 @@ bool tryGetByamlS64(s64* pOut, const ByamlIter& rIter, const char* pKey) {
|
||||
bool tryGetByamlU64(u64* pOut, const ByamlIter& rIter, const char* pKey) {
|
||||
u64 value = 0;
|
||||
bool res = rIter.tryGetUInt64ByKey(&value, pKey);
|
||||
if (res) {
|
||||
if (res)
|
||||
*pOut = value;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,8 @@ ByamlWriter::~ByamlWriter() {
|
||||
delete mBigDataList;
|
||||
delete[] mContainerStack;
|
||||
|
||||
for (auto* node : mContainerList) {
|
||||
for (auto* node : mContainerList)
|
||||
node->deleteData();
|
||||
}
|
||||
while (auto* node = mContainerList.popBack()) {
|
||||
node->mList = nullptr;
|
||||
delete node->mData;
|
||||
@ -168,17 +167,17 @@ void ByamlWriter::pushLocalIter(const ByamlIter& iter, const char* iterKey) {
|
||||
return;
|
||||
|
||||
s32 size = iter.getSize();
|
||||
if (iter.isTypeHash()) {
|
||||
if (iter.isTypeHash())
|
||||
if (iterKey)
|
||||
pushHash(iterKey);
|
||||
else
|
||||
pushHash();
|
||||
} else if (iter.isTypeArray()) {
|
||||
else if (iter.isTypeArray())
|
||||
if (iterKey)
|
||||
pushArray(iterKey);
|
||||
else
|
||||
pushArray();
|
||||
} else
|
||||
else
|
||||
return;
|
||||
|
||||
for (s32 i = 0; i < size; i++) {
|
||||
@ -290,9 +289,8 @@ u32 ByamlWriter::calcPackSize() const {
|
||||
size += mStringTable2->calcPackSize();
|
||||
if (mBigDataList)
|
||||
size += mBigDataList->calcPackSize();
|
||||
for (auto* container : mContainerList) {
|
||||
for (auto* container : mContainerList)
|
||||
size += container->calcPackSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
// NON_MATCHING: offsetBigDataList increased "too early"
|
||||
@ -317,9 +315,8 @@ void ByamlWriter::write(sead::WriteStream* stream) {
|
||||
container->setOffset(offsetBigDataList);
|
||||
offsetBigDataList += container->calcPackSize();
|
||||
}
|
||||
for (auto* container : mContainerList) {
|
||||
for (auto* container : mContainerList)
|
||||
container->writeContainer(stream);
|
||||
}
|
||||
}
|
||||
|
||||
void ByamlWriter::print() const {
|
||||
@ -327,9 +324,8 @@ void ByamlWriter::print() const {
|
||||
mStringTable1->print();
|
||||
if (mStringTable2)
|
||||
mStringTable2->print();
|
||||
if (mCurrentContainerIndex >= 0) {
|
||||
if (mCurrentContainerIndex >= 0)
|
||||
mContainerStack[0]->print(1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
@ -6,18 +6,16 @@ namespace al {
|
||||
|
||||
ByamlWriterBigDataList::ByamlWriterBigDataList() = default;
|
||||
ByamlWriterBigDataList::~ByamlWriterBigDataList() {
|
||||
while (auto* node = mList.popBack()) {
|
||||
while (auto* node = mList.popBack())
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
void ByamlWriterBigDataList::addData(ByamlWriterBigData* data) {
|
||||
mList.pushBack(new sead::TListNode<ByamlWriterBigData*>(data));
|
||||
}
|
||||
u32 ByamlWriterBigDataList::calcPackSize() const {
|
||||
u32 size = 0;
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
size += node->calcBigDataSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
s32 ByamlWriterBigDataList::setOffset(s32 offset) {
|
||||
@ -28,9 +26,8 @@ s32 ByamlWriterBigDataList::setOffset(s32 offset) {
|
||||
return offset;
|
||||
}
|
||||
void ByamlWriterBigDataList::write(sead::WriteStream* stream) {
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
node->writeBigData(stream);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
@ -164,9 +164,8 @@ void ByamlWriterContainer::deleteData() {}
|
||||
ByamlWriterArray::ByamlWriterArray(ByamlWriterStringTable* stringTable)
|
||||
: mStringTable(stringTable) {}
|
||||
ByamlWriterArray::~ByamlWriterArray() {
|
||||
while (auto* node = mList.popBack()) {
|
||||
while (auto* node = mList.popBack())
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
void ByamlWriterArray::deleteData() {
|
||||
for (auto it = mList.robustBegin(); it != mList.robustEnd(); ++it) {
|
||||
@ -224,29 +223,25 @@ void ByamlWriterArray::writeContainer(sead::WriteStream* stream) const {
|
||||
stream->writeU8(0xC0);
|
||||
alByamlLocalUtil::writeU24(stream, mList.size());
|
||||
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
stream->writeU8(node->getTypeCode());
|
||||
}
|
||||
|
||||
s32 i = mList.size();
|
||||
s32 v12 = i < 0 ? i + 3 : i;
|
||||
s32 v14 = i - (v12 & 0xFFFFFFFC);
|
||||
s32 v15 = 4 - v14;
|
||||
s32 v16 = v14 == 0 ? 0 : v15;
|
||||
for (s32 j = 0; j < v16; j++) {
|
||||
for (s32 j = 0; j < v16; j++)
|
||||
stream->writeU8(0);
|
||||
}
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
node->write(stream);
|
||||
}
|
||||
}
|
||||
void ByamlWriterArray::write(sead::WriteStream* stream) const {
|
||||
stream->writeU32(getOffset());
|
||||
}
|
||||
void ByamlWriterArray::print(s32 unknown) const {
|
||||
for (auto node : mList) {
|
||||
for (auto node : mList)
|
||||
node->print(unknown + 1);
|
||||
}
|
||||
}
|
||||
bool ByamlWriterArray::isArray() const {
|
||||
return true;
|
||||
@ -259,9 +254,8 @@ ByamlWriterHash::ByamlWriterHash(ByamlWriterStringTable* stringTable1,
|
||||
ByamlWriterStringTable* stringTable2)
|
||||
: mStringTable1(stringTable1), mStringTable2(stringTable2) {}
|
||||
ByamlWriterHash::~ByamlWriterHash() {
|
||||
while (auto* node = mList.popBack()) {
|
||||
while (auto* node = mList.popBack())
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
u32 ByamlWriterHash::calcPackSize() const {
|
||||
return mList.size() * 8 + 4;
|
||||
|
@ -26,9 +26,8 @@ inline char* add(const char* string, sead::TList<const char*>& list) {
|
||||
const char* ByamlWriterStringTable::tryAdd(const char* string) {
|
||||
for (auto it = mList.robustBegin(); it != mList.robustEnd(); ++it) {
|
||||
s32 result = strcmp(string, it->mData);
|
||||
if (result == 0) {
|
||||
if (result == 0)
|
||||
return it->mData;
|
||||
}
|
||||
if (result < 0) {
|
||||
s32 length = (s64)((strlen(string) << 32) + 0x100000000LL) >> 32;
|
||||
char* array = new char[length];
|
||||
@ -50,9 +49,8 @@ u32 ByamlWriterStringTable::calcHeaderSize() const {
|
||||
}
|
||||
u32 ByamlWriterStringTable::calcContentSize() const {
|
||||
u32 size = 0;
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
size += strlen(node) + 1;
|
||||
}
|
||||
return (size + 3) & 0xFFFFFFFC;
|
||||
}
|
||||
u32 ByamlWriterStringTable::calcPackSize() const {
|
||||
@ -100,14 +98,12 @@ void ByamlWriterStringTable::write(sead::WriteStream* stream) const {
|
||||
s32 v15 = 4 - v14;
|
||||
s32 v16 = v14 == 0 ? 0 : v15;
|
||||
|
||||
for (s32 j = 0; j < v16; j++) {
|
||||
for (s32 j = 0; j < v16; j++)
|
||||
stream->writeU8(0);
|
||||
}
|
||||
}
|
||||
void ByamlWriterStringTable::print() const {
|
||||
for (auto& node : mList) {
|
||||
for (auto& node : mList)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
@ -7,9 +7,8 @@ namespace alActionFunction {
|
||||
const char* getAnimName(const al::ActionAnimCtrlInfo* infoCtrl,
|
||||
const al::ActionAnimDataInfo* infoData) {
|
||||
const char* animName = infoData->mActionName;
|
||||
if (animName == nullptr) {
|
||||
if (animName == nullptr)
|
||||
animName = infoCtrl->mActionName;
|
||||
}
|
||||
return animName;
|
||||
}
|
||||
} // namespace alActionFunction
|
||||
|
6
lib/al/src/Project/HitSensor/HitSensor.cpp
Executable file → Normal file
6
lib/al/src/Project/HitSensor/HitSensor.cpp
Executable file → Normal file
@ -15,9 +15,8 @@ void HitSensor::validate() {
|
||||
mIsValid = true;
|
||||
|
||||
if (mMaxSensorCount) {
|
||||
if (mIsValidBySystem) {
|
||||
if (mIsValidBySystem)
|
||||
mHitGroup->add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,9 +28,8 @@ void HitSensor::invalidate() {
|
||||
mIsValid = false;
|
||||
|
||||
if (mMaxSensorCount) {
|
||||
if (mIsValidBySystem) {
|
||||
if (mIsValidBySystem)
|
||||
mHitGroup->remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,8 @@ f32 BezierCurve::calcLength(f32 startParam, f32 endParam, s32 stepCount) const {
|
||||
|
||||
sumVelHalfStep += calcDeltaLength((halfStepSize * (doubleI - 1)) + startParam);
|
||||
|
||||
if (i != stepCount) {
|
||||
if (i != stepCount)
|
||||
sumVelFullStep += calcDeltaLength((halfStepSize * (doubleI)) + startParam);
|
||||
}
|
||||
}
|
||||
|
||||
return std::floor((halfStepSize * 0.33333f) *
|
||||
@ -97,9 +96,8 @@ f32 BezierCurve::calcCurveParam(f32 distance) const {
|
||||
return percent;
|
||||
}
|
||||
|
||||
if (percent > 1.0f || partLength < 0.0f) {
|
||||
if (percent > 1.0f || partLength < 0.0f)
|
||||
return sead::Mathf::clamp(percent, 0.0f, 1.0f);
|
||||
}
|
||||
return percent;
|
||||
}
|
||||
|
||||
|
@ -40,24 +40,20 @@ ActorDimensionKeeper* FireDrum2D::getActorDimensionKeeper() const {
|
||||
}
|
||||
|
||||
void FireDrum2D::exeWait() {
|
||||
if (al::isFirstStep(this)) {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "Burn");
|
||||
}
|
||||
}
|
||||
|
||||
void FireDrum2D::exeBurn() {
|
||||
if (al::isFirstStep(this)) {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "Wait");
|
||||
}
|
||||
if (al::isActionEnd(this)) {
|
||||
if (al::isActionEnd(this))
|
||||
al::setNerve(this, &Wait);
|
||||
}
|
||||
}
|
||||
|
||||
void FireDrum2D::attackSensor(al::HitSensor* source, al::HitSensor* target) {
|
||||
if (rs::sendMsgTouchFireDrum2D(target, source) || rs::sendMsgEnemyAttack2D(target, source)) {
|
||||
if (rs::sendMsgTouchFireDrum2D(target, source) || rs::sendMsgEnemyAttack2D(target, source))
|
||||
al::setNerve(this, &Burn);
|
||||
}
|
||||
}
|
||||
|
||||
bool FireDrum2D::receiveMsg(const al::SensorMsg* message, al::HitSensor* source,
|
||||
|
@ -15,18 +15,16 @@ void AchievementHolder::init(const al::ActorInitInfo&) {
|
||||
mAchievementInfoReader->init();
|
||||
mArray.allocBuffer(mAchievementInfoReader->size(), nullptr);
|
||||
|
||||
for (s32 i = 0; i < mArray.capacity(); i++) {
|
||||
for (s32 i = 0; i < mArray.capacity(); i++)
|
||||
mArray.pushBack(new Achievement(mAchievementInfoReader->get(i)));
|
||||
}
|
||||
}
|
||||
void AchievementHolder::init() {
|
||||
mAchievementInfoReader = new AchievementInfoReader();
|
||||
mAchievementInfoReader->init();
|
||||
mArray.allocBuffer(mAchievementInfoReader->size(), nullptr);
|
||||
|
||||
for (s32 i = 0; i < mArray.capacity(); i++) {
|
||||
for (s32 i = 0; i < mArray.capacity(); i++)
|
||||
mArray.pushBack(new Achievement(mAchievementInfoReader->get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
bool AchievementHolder::isGetMoon(s32 index, GameDataHolderAccessor accessor) const {
|
||||
@ -53,9 +51,8 @@ s32 AchievementHolder::getAchievementProgressCurrent(s32 index,
|
||||
return progressCurrentRow < 0 ? 0 : max;
|
||||
}
|
||||
if (!al::isEqualSubString(*name, "Other_Coin_") && !al::isEqualString(*name, "Other_Jump") &&
|
||||
!al::isEqualString(*name, "Other_CapThrow")) {
|
||||
!al::isEqualString(*name, "Other_CapThrow"))
|
||||
return progressCurrentRow;
|
||||
}
|
||||
|
||||
s32 max = 999999999;
|
||||
|
||||
@ -171,10 +168,9 @@ s32 AchievementHolder::getAchievementProgressCurrentRow(s32 index,
|
||||
s32 AchievementHolder::calcAchieveTotalNum(GameDataHolderAccessor accessor) const {
|
||||
s32 count = 0;
|
||||
|
||||
for (s32 i = 0; i < mArray.capacity(); i++) {
|
||||
for (s32 i = 0; i < mArray.capacity(); i++)
|
||||
if (getAchievementProgressCurrent(i, accessor) >= mAchievementInfoReader->get(i)->mNum)
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -182,10 +178,9 @@ s32 AchievementHolder::calcAchieveTotalNum(GameDataHolderAccessor accessor) cons
|
||||
s32 AchievementHolder::calcMoonGetTotalNum(GameDataHolderAccessor accessor) const {
|
||||
s32 count = 0;
|
||||
|
||||
for (s32 i = 0; i < mArray.capacity(); i++) {
|
||||
for (s32 i = 0; i < mArray.capacity(); i++)
|
||||
if (mArray[i]->isGet(accessor))
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -193,10 +188,9 @@ s32 AchievementHolder::calcMoonGetTotalNum(GameDataHolderAccessor accessor) cons
|
||||
Achievement*
|
||||
AchievementHolder::tryGetNewAchievement(GameDataHolderAccessor accessor) const { // TODO mismatch
|
||||
s32 i = 0;
|
||||
for (; i < mArray.capacity(); i++) {
|
||||
for (; i < mArray.capacity(); i++)
|
||||
if (!mArray[i]->isGet(accessor) &&
|
||||
getAchievementProgressCurrent(i, accessor) >= mAchievementInfoReader->get(i)->mNum)
|
||||
break;
|
||||
}
|
||||
return mArray[i];
|
||||
}
|
||||
|
@ -39,9 +39,8 @@ void AchievementInfoReader::init() { // TODO minor mismatches during loop
|
||||
}
|
||||
|
||||
s32 AchievementInfoReader::tryFindIndexByName(const char* name) const {
|
||||
for (s32 i = 0; i < mAchievements.size(); i++) {
|
||||
for (s32 i = 0; i < mAchievements.size(); i++)
|
||||
if (al::isEqualString(name, mAchievements[i]->mName))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -153,9 +153,8 @@ void Player::attackSensor(al::HitSensor* target, al::HitSensor* source) {
|
||||
(al::isSensorEnemy(source) || al::isSensorPlayer(source)) &&
|
||||
(al::getVelocity(this).dot(al::getGravity(this)) > 0.0f) &&
|
||||
((actorTrans - trans).dot(al::getGravity(this)) > 0.0f) &&
|
||||
al::sendMsgPlayerAttackTrample(source, target, nullptr)) {
|
||||
al::sendMsgPlayerAttackTrample(source, target, nullptr))
|
||||
al::setVelocityJump(this, 23.0f);
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::receiveMsg(const al::SensorMsg* message, al::HitSensor* source,
|
||||
|
@ -12,9 +12,8 @@ void PlayerContinuousJump::update(bool shouldCountDown) {
|
||||
|
||||
if (mCount > 0) {
|
||||
mTimer++;
|
||||
if (mTimer >= mConst->getContinuousJumpTimer()) {
|
||||
if (mTimer >= mConst->getContinuousJumpTimer())
|
||||
clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,10 @@ PlayerCounterQuickTurnJump::PlayerCounterQuickTurnJump(const PlayerConst* pConst
|
||||
: mConst(pConst), mTrigger(trigger) {}
|
||||
|
||||
void PlayerCounterQuickTurnJump::update() {
|
||||
if (mTrigger->isOn(PlayerTrigger::EActionTrigger_QuickTurn)) {
|
||||
if (mTrigger->isOn(PlayerTrigger::EActionTrigger_QuickTurn))
|
||||
mCounter = mConst->getQuickTurnJumpFrame();
|
||||
} else {
|
||||
else
|
||||
mCounter = al::converge(mCounter, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool PlayerCounterQuickTurnJump::isEnableTurnJump() const {
|
||||
|
@ -221,9 +221,8 @@ bool PlayerInput::isHoldJump() const {
|
||||
if (mIsDisableInput)
|
||||
return false;
|
||||
auto* dimension = mDimension;
|
||||
if (dimension && rs::is2D(dimension) && rs::isIn2DArea(dimension) && _88 > 0) {
|
||||
if (dimension && rs::is2D(dimension) && rs::isIn2DArea(dimension) && _88 > 0)
|
||||
return true;
|
||||
}
|
||||
return PlayerInputFunction::isHoldJump(mLiveActor,
|
||||
PlayerFunction::getPlayerInputPort(mLiveActor));
|
||||
}
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
bool PlayerInputFunction::isTriggerAction(const al::LiveActor* actor, s32 port) {
|
||||
if (rs::isSeparatePlay(actor) && al::isPadTypeJoySingle(port)) {
|
||||
if (rs::isSeparatePlay(actor) && al::isPadTypeJoySingle(port))
|
||||
return true;
|
||||
}
|
||||
return al::isPadTriggerX(port) || al::isPadTriggerY(port);
|
||||
}
|
||||
|
@ -17,9 +17,8 @@ void PlayerJudgePreInputJump::reset() {
|
||||
void PlayerJudgePreInputJump::update() {
|
||||
mRemainJumpFrame = sead::Mathi::clampMin(mRemainJumpFrame - 1, 0);
|
||||
|
||||
if (mInput->isTriggerJump()) {
|
||||
if (mInput->isTriggerJump())
|
||||
mRemainJumpFrame = mConst->getContinuousJumpPreInputFrame();
|
||||
}
|
||||
}
|
||||
|
||||
bool PlayerJudgePreInputJump::judge() const {
|
||||
|
@ -13,9 +13,8 @@ PlayerJudgeStartHipDrop::PlayerJudgeStartHipDrop(const PlayerConst* playerConst,
|
||||
mModelChanger(playerModelChanger) {}
|
||||
|
||||
bool PlayerJudgeStartHipDrop::judge() const {
|
||||
if (mModelChanger->is2DModel() || !mInput->isTriggerHipDrop()) {
|
||||
if (mModelChanger->is2DModel() || !mInput->isTriggerHipDrop())
|
||||
return false;
|
||||
}
|
||||
|
||||
return !(rs::getGroundHeight(mHeightCheck) < mConst->getHipDropHeight());
|
||||
}
|
||||
|
@ -20,20 +20,16 @@ void PlayerModelHolder::changeModel(const char* name) {
|
||||
}
|
||||
|
||||
al::LiveActor* PlayerModelHolder::findModelActor(const char* name) const {
|
||||
for (auto it = mBuffer.begin(), end = mBuffer.end(); it != end; ++it) {
|
||||
if (al::isEqualString(it->mName, sead::SafeString(name))) {
|
||||
for (auto it = mBuffer.begin(), end = mBuffer.end(); it != end; ++it)
|
||||
if (al::isEqualString(it->mName, sead::SafeString(name)))
|
||||
return it->mLiveActor;
|
||||
}
|
||||
}
|
||||
return mCurrentModel->mLiveActor;
|
||||
}
|
||||
|
||||
al::LiveActor* PlayerModelHolder::tryFindModelActor(const char* name) const {
|
||||
for (auto it = mBuffer.begin(), end = mBuffer.end(); it != end; ++it) {
|
||||
if (al::isEqualString(it->mName, sead::SafeString(name))) {
|
||||
for (auto it = mBuffer.begin(), end = mBuffer.end(); it != end; ++it)
|
||||
if (al::isEqualString(it->mName, sead::SafeString(name)))
|
||||
return it->mLiveActor;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,7 @@ void PlayerOxygen::recovery() {
|
||||
#endif
|
||||
|
||||
bool PlayerOxygen::isTriggerDamage() const {
|
||||
if (mFramesWithoutOxygen) {
|
||||
if (mFramesWithoutOxygen)
|
||||
return (mFramesWithoutOxygen % mOxygenDamageInterval) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -25,9 +25,8 @@ WorldResourceLoader::~WorldResourceLoader() {
|
||||
mIsCancelled = true;
|
||||
mCurLoadCount = 0;
|
||||
|
||||
if (mWorldResourceLoader) {
|
||||
if (mWorldResourceLoader)
|
||||
delete mWorldResourceLoader;
|
||||
}
|
||||
|
||||
tryDestroyWorldResource();
|
||||
}
|
||||
@ -166,9 +165,8 @@ s32 WorldResourceLoader::getLoadWorldId() const {
|
||||
al::Resource* WorldResourceLoader::tryLoadResource(const char* resPath, const char* category,
|
||||
const char* str3) {
|
||||
if (category) {
|
||||
if (str3) {
|
||||
if (str3)
|
||||
return al::findOrCreateResourceCategory(resPath, str3, category);
|
||||
}
|
||||
return al::findOrCreateResource(resPath, category);
|
||||
} else {
|
||||
return al::findOrCreateResource(resPath, nullptr);
|
||||
@ -209,11 +207,10 @@ void WorldResourceLoader::loadWorldResource(s32 loadWorldId, s32 scenario, bool
|
||||
resEntry.tryGetStringByKey(&resName, "Name");
|
||||
resEntry.tryGetStringByKey(&resExt, "Ext");
|
||||
|
||||
if (resExt) {
|
||||
if (resExt)
|
||||
al::findOrCreateResourceCategory(resName, resourceCategory, resExt);
|
||||
} else {
|
||||
else
|
||||
al::findOrCreateResource(resName, nullptr);
|
||||
}
|
||||
|
||||
if (mIsCancelled)
|
||||
return;
|
||||
|
@ -31,9 +31,8 @@ void GameDataFile::HintInfo::clear() {
|
||||
}
|
||||
|
||||
bool GameDataFile::HintInfo::isDisableByWorldWarpHole(bool condition) const {
|
||||
if (!condition && al::isEqualString(mOptionalID.cstr(), "WorldWarpHoleShine")) {
|
||||
if (!condition && al::isEqualString(mOptionalID.cstr(), "WorldWarpHoleShine"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -43,15 +42,13 @@ bool GameDataFile::HintInfo::isEnableUnlock(s32 curWorldId, bool isGameClear, s3
|
||||
if (unkBool1)
|
||||
return false;
|
||||
|
||||
if (mHintStatus == HintStatus::NONE) {
|
||||
if (mHintStatus == HintStatus::NONE)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isGameClear && mIsMoonRock) {
|
||||
if (isGameClear && mIsMoonRock)
|
||||
return false;
|
||||
} else if (!isGameClear && mIsMoonRock) {
|
||||
else if (!isGameClear && mIsMoonRock)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -76,28 +73,22 @@ bool GameDataFile::HintInfo::isHintStatusUnlockByAmiibo() const {
|
||||
|
||||
bool GameDataFile::HintInfo::isEnableNameUnlockByScenario(s32 curWorldId, s32 scenarioNo,
|
||||
bool isInWorld) const {
|
||||
if (isDisableByWorldWarpHole(isInWorld)) {
|
||||
if (isDisableByWorldWarpHole(isInWorld))
|
||||
return false;
|
||||
}
|
||||
if (mWorldIndex != curWorldId || unkBool2) {
|
||||
if (mWorldIndex != curWorldId || unkBool2)
|
||||
return false;
|
||||
}
|
||||
if (mProgressBitflag.countOnBit()) {
|
||||
if (mProgressBitflag.countOnBit())
|
||||
return mProgressBitflag.isOnBit(scenarioNo - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameDataFile::HintInfo::testFunc(s32 curWorldId, bool isGameClear, s32 scenarioNo,
|
||||
bool isInWorld) const {
|
||||
if (isDisableByWorldWarpHole(isInWorld)) {
|
||||
if (isDisableByWorldWarpHole(isInWorld))
|
||||
return false;
|
||||
}
|
||||
if (mWorldIndex != curWorldId || unkBool2 || isGameClear) {
|
||||
if (mWorldIndex != curWorldId || unkBool2 || isGameClear)
|
||||
return false;
|
||||
}
|
||||
if (mProgressBitflag.countOnBit()) {
|
||||
if (mProgressBitflag.countOnBit())
|
||||
return mProgressBitflag.isOnBit(scenarioNo - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -20,9 +20,8 @@ bool rs::updateJudgeAndResult(IJudge* judge) {
|
||||
}
|
||||
|
||||
bool rs::judgeAndResetReturnTrue(IJudge* judge) {
|
||||
if (!judge->judge()) {
|
||||
if (!judge->judge())
|
||||
return false;
|
||||
}
|
||||
|
||||
judge->reset();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user