Refactor various operator[] based on BETA10 (#1110)

* Tidy up `operator[]` code

* Add weird index operator for `FUN_1002ddc0`

* Cleanup

* Add Matrix4 BETA10 annotations, fix typo

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2024-10-06 16:50:34 +02:00
committed by GitHub
parent 1a15981324
commit 85ce10ab50
9 changed files with 53 additions and 29 deletions

View File

@@ -163,14 +163,6 @@ public:
return *this;
}
// There is another candidate for `Vector2::operator[]` at BETA10 0x10010890, which is called from only three
// functions in BETA10:
// - `Matrix4::FromQuaternion()`
// - `Matrix4::ToQuaternion()`
// - `UnknownMx4DPointFloat::FUN_100040a0()`
// Maybe there is another subclass of `Vector4` involved that has the same VTABLE but a different `operator[]`.
// It is also interesting that `Matrix4::operator[]` is located right above at BETA10 0x10010860.
// FUNCTION: BETA10 0x1001d140
float& operator[](int idx) { return m_data[idx]; }
@@ -416,6 +408,11 @@ public:
m_data[3] = p_value;
} // vtable+0x84
float& operator[](int idx) { return m_data[idx]; }
// FUNCTION: BETA10 0x10010890
const float& operator[](int idx) const { return m_data[idx]; }
friend class Mx4DPointFloat;
};