mirror of https://github.com/zeldaret/botw.git
Change getContactLayerBaseRelativeValue to return an int to avoid casts
This commit is contained in:
parent
e7e9644a1f
commit
8d88461c52
|
@ -74,12 +74,12 @@ inline void CollisionInfoBase::enableLayer(ContactLayer layer) {
|
|||
}
|
||||
|
||||
inline void CollisionInfoBase::disableLayer(ContactLayer layer) {
|
||||
getLayerMask(getContactLayerType(layer)).resetBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
getLayerMask(getContactLayerType(layer)).resetBit(getContactLayerBaseRelativeValue(layer));
|
||||
}
|
||||
|
||||
inline bool CollisionInfoBase::isLayerEnabled(ContactLayer layer) const {
|
||||
const auto& mask = getLayerMask(getContactLayerType(layer));
|
||||
return mask.isOnBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
return mask.isOnBit(getContactLayerBaseRelativeValue(layer));
|
||||
}
|
||||
|
||||
inline void CollisionInfoBase::lock() {
|
||||
|
|
|
@ -41,13 +41,13 @@ public:
|
|||
|
||||
bool isLayerSubscribed(ContactLayer layer) const {
|
||||
const auto type = getContactLayerType(layer);
|
||||
return mSubscribedLayers[int(type)].isOnBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
return mSubscribedLayers[int(type)].isOnBit(getContactLayerBaseRelativeValue(layer));
|
||||
}
|
||||
|
||||
// TODO: rename
|
||||
bool isLayerInMask2(ContactLayer layer) const {
|
||||
const auto type = getContactLayerType(layer);
|
||||
return mLayerMask2[int(type)].isOnBit(int(getContactLayerBaseRelativeValue(layer)));
|
||||
return mLayerMask2[int(type)].isOnBit(getContactLayerBaseRelativeValue(layer));
|
||||
}
|
||||
|
||||
void setLayerMasks(const LayerMaskBuilder& builder) {
|
||||
|
|
|
@ -20,7 +20,7 @@ u32 getContactLayerBase(ContactLayerType type) {
|
|||
return FirstSensor;
|
||||
}
|
||||
|
||||
u32 getContactLayerBaseRelativeValue(ContactLayer layer) {
|
||||
int getContactLayerBaseRelativeValue(ContactLayer layer) {
|
||||
return layer - (layer < FirstSensor ? FirstEntity : FirstSensor);
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ union SensorQueryCollisionMask {
|
|||
ContactLayerType getContactLayerType(ContactLayer layer);
|
||||
u32 makeContactLayerMask(ContactLayer layer);
|
||||
u32 getContactLayerBase(ContactLayerType type);
|
||||
u32 getContactLayerBaseRelativeValue(ContactLayer layer);
|
||||
int getContactLayerBaseRelativeValue(ContactLayer layer);
|
||||
const char* contactLayerToText(ContactLayer layer);
|
||||
ContactLayer contactLayerFromText(const sead::SafeString& text);
|
||||
|
||||
|
|
Loading…
Reference in New Issue