mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Library/Screen: Implement ScreenPointCheckGroup (#786)
This commit is contained in:
parent
64aa34a491
commit
0b6d26020c
|
|
@ -278201,23 +278201,23 @@ Library/Screen/ScreenPointerCheckGroup.o:
|
|||
label:
|
||||
- _ZN2al21ScreenPointCheckGroupC1Ei
|
||||
- _ZN2al21ScreenPointCheckGroupC2Ei
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9d4774
|
||||
size: 92
|
||||
label: _ZN2al21ScreenPointCheckGroup8setValidEPNS_17ScreenPointTargetE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9d47d0
|
||||
size: 100
|
||||
label: _ZN2al21ScreenPointCheckGroup10setInvalidEPNS_17ScreenPointTargetE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9d4834
|
||||
size: 12
|
||||
label: _ZNK2al21ScreenPointCheckGroup9getTargetEi
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9d4840
|
||||
size: 28
|
||||
label: _ZN2al21ScreenPointCheckGroup9setTargetEPNS_17ScreenPointTargetE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
Library/Screen/ScreenPointKeeper.o:
|
||||
'.text':
|
||||
- offset: 0x9d485c
|
||||
|
|
|
|||
43
lib/al/Library/Screen/ScreenPointCheckGroup.cpp
Normal file
43
lib/al/Library/Screen/ScreenPointCheckGroup.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "Library/Screen/ScreenPointCheckGroup.h"
|
||||
|
||||
namespace al {
|
||||
ScreenPointCheckGroup::ScreenPointCheckGroup(s32 size) : mSize(size) {
|
||||
mScreenPointTargets = new ScreenPointTarget*[mSize];
|
||||
|
||||
for (s32 i = 0; i < mSize; i++)
|
||||
mScreenPointTargets[i] = nullptr;
|
||||
}
|
||||
|
||||
void ScreenPointCheckGroup::setValid(ScreenPointTarget* target) {
|
||||
for (s32 i = mValidCount; i < mCount; i++) {
|
||||
if (mScreenPointTargets[i] == target) {
|
||||
mScreenPointTargets[i] = mScreenPointTargets[mValidCount];
|
||||
mScreenPointTargets[mValidCount] = target;
|
||||
mValidCount++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenPointCheckGroup::setInvalid(ScreenPointTarget* target) {
|
||||
for (s32 i = 0; i < mValidCount; i++) {
|
||||
if (mScreenPointTargets[i] == target) {
|
||||
mScreenPointTargets[i] = mScreenPointTargets[mValidCount - 1];
|
||||
mScreenPointTargets[mValidCount - 1] = target;
|
||||
mValidCount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScreenPointTarget* ScreenPointCheckGroup::getTarget(s32 index) const {
|
||||
return mScreenPointTargets[index];
|
||||
}
|
||||
|
||||
void ScreenPointCheckGroup::setTarget(ScreenPointTarget* target) {
|
||||
mScreenPointTargets[mCount] = target;
|
||||
mCount++;
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
25
lib/al/Library/Screen/ScreenPointCheckGroup.h
Normal file
25
lib/al/Library/Screen/ScreenPointCheckGroup.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
namespace al {
|
||||
class ScreenPointTarget;
|
||||
|
||||
class ScreenPointCheckGroup {
|
||||
public:
|
||||
ScreenPointCheckGroup(s32 size);
|
||||
void setValid(ScreenPointTarget* target);
|
||||
void setInvalid(ScreenPointTarget* target);
|
||||
ScreenPointTarget* getTarget(s32 index) const;
|
||||
void setTarget(ScreenPointTarget* target);
|
||||
|
||||
private:
|
||||
s32 mSize = 0;
|
||||
s32 mCount = 0;
|
||||
s32 mValidCount = 0;
|
||||
// `mValidCount` valid targets first, followed by invalid ones up to `mCount`
|
||||
ScreenPointTarget** mScreenPointTargets = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(ScreenPointCheckGroup) == 0x18);
|
||||
} // namespace al
|
||||
Loading…
Reference in a new issue