mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add CollisionInfoBase::enableLayer/disableLayer
The pattern seems to show up very often in CollisionInfoBase users
This commit is contained in:
parent
5dde8ced89
commit
683108b75c
|
@ -28,6 +28,8 @@ public:
|
|||
sead::BitFlag32& getLayerMask(ContactLayerType layer_type);
|
||||
const sead::BitFlag32& getLayerMask(ContactLayerType layer_type) const;
|
||||
|
||||
void enableLayer(ContactLayer layer);
|
||||
void disableLayer(ContactLayer layer);
|
||||
bool isLayerEnabled(ContactLayer layer) const;
|
||||
|
||||
void lock();
|
||||
|
@ -67,6 +69,15 @@ inline const sead::BitFlag32& CollisionInfoBase::getLayerMask(ContactLayerType l
|
|||
return mLayerMasks[int(layer_type)];
|
||||
}
|
||||
|
||||
inline void CollisionInfoBase::enableLayer(ContactLayer layer) {
|
||||
const u32 mask = makeContactLayerMask(layer);
|
||||
getLayerMask(getContactLayerType(layer)).set(mask);
|
||||
}
|
||||
|
||||
inline void CollisionInfoBase::disableLayer(ContactLayer layer) {
|
||||
getLayerMask(getContactLayerType(layer)).resetBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
}
|
||||
|
||||
inline bool CollisionInfoBase::isLayerEnabled(ContactLayer layer) const {
|
||||
const auto& mask = getLayerMask(getContactLayerType(layer));
|
||||
return mask.isOnBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
|
|
Loading…
Reference in New Issue