| 1 | #include "Project/HitSensor/HitSensor.h" |
|---|---|
| 2 | |
| 3 | #include "Project/HitSensor/SensorHitGroup.h" |
| 4 | |
| 5 | namespace al { |
| 6 | void HitSensor::setFollowPosPtr(const sead::Vector3f* pFollowPos) { |
| 7 | mFollowPos = pFollowPos; |
| 8 | mFollowMtx = nullptr; |
| 9 | } |
| 10 | |
| 11 | void HitSensor::setFollowMtxPtr(const sead::Matrix34f* pFollowMtx) { |
| 12 | mFollowPos = nullptr, mFollowMtx = pFollowMtx; |
| 13 | } |
| 14 | |
| 15 | void HitSensor::validate() { |
| 16 | if (!mIsValid) { |
| 17 | mIsValid = true; |
| 18 | |
| 19 | if (mMaxSensorCount) { |
| 20 | if (mIsValidBySystem) |
| 21 | mHitGroup->add(sensor: this); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | mSensorCount = 0; |
| 26 | } |
| 27 | |
| 28 | void HitSensor::invalidate() { |
| 29 | if (mIsValid) { |
| 30 | mIsValid = false; |
| 31 | |
| 32 | if (mMaxSensorCount) { |
| 33 | if (mIsValidBySystem) |
| 34 | mHitGroup->remove(sensor: this); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | mSensorCount = 0; |
| 39 | } |
| 40 | |
| 41 | // HitSensor::validateBySystem |
| 42 | // HitSensor::invalidateBySystem |
| 43 | // HitSensor::update (requires some more LiveActor research) |
| 44 | |
| 45 | void HitSensor::addHitSensor(HitSensor* pSensor) { |
| 46 | // todo -- registers are different |
| 47 | if (mSensorCount < mMaxSensorCount) { |
| 48 | mSensors[mSensorCount] = pSensor; |
| 49 | ++mSensorCount; |
| 50 | } |
| 51 | } |
| 52 | } // namespace al |
| 53 |