Library/Area: Implement SwitchOnAreaGroup (#711)

This commit is contained in:
Fuzzy2319 2025-08-27 15:57:25 +02:00 committed by GitHub
parent 4186cc6521
commit f4f32d833d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 28 deletions

View file

@ -1,10 +1,10 @@
---
Language: Cpp
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
@ -22,29 +22,30 @@ BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 100
CommentPragmas: '^ (IWYU pragma:|NOLINT)'
ColumnLimit: 100
CommentPragmas: '^ (IWYU pragma:|NOLINT)'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: []
DisableFormat: false
ForEachMacros: [ ]
IncludeCategories:
- Regex: '^<[Ww]indows\.h>$'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '^"'
Priority: 3
- Regex: '^<[Ww]indows\.h>$'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '^"'
Priority: 3
IndentCaseLabels: false
IndentWidth: 4
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
@ -58,22 +59,22 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
QualifierAlignment: Left
ReflowComments: true
ReflowComments: true
RemoveBracesLLVM: true
SeparateDefinitionBlocks: Always
SortIncludes: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
TabWidth: 4
UseTab: Never
WhitespaceSensitiveMacros: ["SEAD_ENUM", "SEAD_ENUM_EX", "SEAD_ENUM_EX_VALUES"]
TabWidth: 4
UseTab: Never
WhitespaceSensitiveMacros: [ "SEAD_ENUM", "SEAD_ENUM_EX", "SEAD_ENUM_EX_VALUES" ]
...

View file

@ -222890,19 +222890,19 @@ Library/Area/SwitchOnAreaGroup.o:
label:
- _ZN2al17SwitchOnAreaGroupC1EPNS_12AreaObjGroupE
- _ZN2al17SwitchOnAreaGroupC2EPNS_12AreaObjGroupE
status: NotDecompiled
status: Matching
- offset: 0x807dc4
size: 308
label: _ZN2al17SwitchOnAreaGroup6updateEPKN4sead7Vector3IfEEi
status: NotDecompiled
status: Matching
- offset: 0x807ef8
size: 196
label: _ZN2al17SwitchOnAreaGroup6updateERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
- offset: 0x807fbc
size: 8
label: _ZNK2al17SwitchOnAreaGroup19isExternalConditionEv
status: NotDecompiled
status: Matching
lazy: true
Library/Area/TrafficArea.o:
'.text':

View file

@ -0,0 +1,35 @@
#include "Library/Area/SwitchOnAreaGroup.h"
#include "Library/Area/AreaObj.h"
#include "Library/Area/AreaObjGroup.h"
#include "Library/Stage/StageSwitchUtil.h"
namespace al {
SwitchOnAreaGroup::SwitchOnAreaGroup(AreaObjGroup* areaObjGroup) : mAreaObjGroup(areaObjGroup) {}
void SwitchOnAreaGroup::update(const sead::Vector3f* positions, s32 posCount) {
s32 size = mAreaObjGroup->getSize();
for (s32 i = 0; i < size; i++) {
AreaObj* areaObj = mAreaObjGroup->getAreaObj(i);
if (isOnStageSwitch(areaObj, "SwitchAreaOn"))
continue;
for (s32 j = 0; j < posCount; j++) {
if (areaObj->isInVolume(positions[j]) && isExternalCondition()) {
onStageSwitch(areaObj, "SwitchAreaOn");
break;
}
}
}
}
void SwitchOnAreaGroup::update(const sead::Vector3f& position) {
sead::Vector3f positions[1] = {position};
update(positions, 1);
}
bool SwitchOnAreaGroup::isExternalCondition() const {
return true;
}
} // namespace al

View file

@ -4,17 +4,16 @@
namespace al {
class AreaObjGroup;
class PlayerHolder;
class SwitchOnAreaGroup {
public:
SwitchOnAreaGroup(AreaObjGroup* areaObjGroup);
void update(const sead::Vector3f* trans, s32);
void update(const sead::Vector3f& trans);
virtual bool isExternalCondition() const;
void update(const sead::Vector3f* positions, s32 posCount);
void update(const sead::Vector3f& position);
private:
AreaObjGroup* mAreaObjGroup;
};