Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions source/egg/math/Quat.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ struct Quatf {
return *this = *this * q;
}

bool operator==(const Quatf &rhs) const {
[[nodiscard]] bool operator==(const Quatf &rhs) const {
return w == rhs.w && v == rhs.v;
}

bool operator!=(const Quatf &rhs) const {
[[nodiscard]] bool operator!=(const Quatf &rhs) const {
return !(*this == rhs);
}

/// @brief A conversion function that allows for string representation of a quaternion.
explicit operator std::string() const {
[[nodiscard]] explicit operator std::string() const {
return std::format("[0x{:08X}, 0x{:08X}, 0x{:08X}, 0x{:08X}] | [{}, {}, {}, {}]", f2u(v.x),
f2u(v.y), f2u(v.z), f2u(w), v.x, v.y, v.z, w);
}
Expand All @@ -82,33 +82,33 @@ struct Quatf {
void makeVectorRotation(const Vector3f &from, const Vector3f &to);

/// @brief Computes \f$conj(a+bi+cj+dk) = a-bi-cj-dk\f$
Quatf conjugate() const {
[[nodiscard]] Quatf conjugate() const {
return Quatf(w, -v);
}

Vector3f rotateVector(const Vector3f &vec) const;
Vector3f rotateVectorInv(const Vector3f &vec) const;
Quatf slerpTo(const Quatf &q2, f32 t) const;
[[nodiscard]] Vector3f rotateVector(const Vector3f &vec) const;
[[nodiscard]] Vector3f rotateVectorInv(const Vector3f &vec) const;
[[nodiscard]] Quatf slerpTo(const Quatf &q2, f32 t) const;

/// @addr{0x8023A138}
/// @brief Computes \f$this \cdot this = w^2 + x^2 + y^2 + z^2\f$
f32 squaredNorm() const {
[[nodiscard]] f32 squaredNorm() const {
return w * w + v.squaredLength();
}

f32 norm() const {
[[nodiscard]] f32 norm() const {
return Mathf::sqrt(squaredNorm());
}

/// @brief Computes \f$this \cdot rhs = w \times rhs.w + x \times rhs.x + y \times rhs.y + z
/// \times rhs.z\f$
f32 dot(const Quatf &q) const {
[[nodiscard]] f32 dot(const Quatf &q) const {
return w * q.w + v.dot(q.v);
}

void setAxisRotation(f32 angle, const Vector3f &axis);
Quatf multSwap(const Vector3f &v) const;
Quatf multSwap(const Quatf &q) const;
[[nodiscard]] Quatf multSwap(const Vector3f &v) const;
[[nodiscard]] Quatf multSwap(const Quatf &q) const;

void read(Stream &stream);

Expand Down
4 changes: 2 additions & 2 deletions source/egg/math/Vector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ struct Vector3f {
return *this = *this / scalar;
}

bool operator==(const Vector3f &rhs) const {
[[nodiscard]] bool operator==(const Vector3f &rhs) const {
return x == rhs.x && y == rhs.y && z == rhs.z;
}

bool operator!=(const Vector3f &rhs) const {
[[nodiscard]] bool operator!=(const Vector3f &rhs) const {
return !(*this == rhs);
}

Expand Down
2 changes: 1 addition & 1 deletion source/game/field/CourseColMgr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public:
}
/// @endGetters

static void *LoadFile(const char *filename);
[[nodiscard]] static void *LoadFile(const char *filename);

static CourseColMgr *CreateInstance();
static void DestroyInstance();
Expand Down
10 changes: 5 additions & 5 deletions source/game/field/ObjectCollisionBase.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ public:

virtual void transform(const EGG::Matrix34f &mat, const EGG::Vector3f &scale,
const EGG::Vector3f &speed) = 0;
virtual const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const = 0;
virtual f32 getBoundingRadius() const = 0;
[[nodiscard]] virtual const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const = 0;
[[nodiscard]] virtual f32 getBoundingRadius() const = 0;

bool check(ObjectCollisionBase &rhs, EGG::Vector3f &distance);

protected:
EGG::Vector3f m_translation;

private:
bool enclosesOrigin(const GJKState &state, u32 idx) const;
[[nodiscard]] bool enclosesOrigin(const GJKState &state, u32 idx) const;
void FUN_808350e4(GJKState &state, EGG::Vector3f &v) const;
bool getNearestSimplex(GJKState &state, EGG::Vector3f &v) const;
void getNearestPoint(GJKState &state, u32 idx, EGG::Vector3f &v0, EGG::Vector3f &v1) const;
bool FUN_808357e4(const GJKState &state, u32 idx) const;
bool inSimplex(const GJKState &state, const EGG::Vector3f &v) const;
[[nodiscard]] bool FUN_808357e4(const GJKState &state, u32 idx) const;
[[nodiscard]] bool inSimplex(const GJKState &state, const EGG::Vector3f &v) const;
void getNearestPoint(const GJKState &state, u32 idx, EGG::Vector3f &v) const;
void calcSimplex(GJKState &state) const;

Expand Down
2 changes: 1 addition & 1 deletion source/game/field/ObjectCollisionConvexHull.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public:

void transform(const EGG::Matrix34f &mat, const EGG::Vector3f &scale,
const EGG::Vector3f &speed) override;
const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override;
[[nodiscard]] const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override;

/// @addr{0x807F957C}
f32 getBoundingRadius() const override {
Expand Down
4 changes: 2 additions & 2 deletions source/game/field/ObjectCollisionCylinder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public:
const EGG::Vector3f &speed) override;

/// @addr{0x8083618C}
const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override {
[[nodiscard]] const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override {
return m_top.dot(v) > m_bottom.dot(v) ? m_top : m_bottom;
}

/// @addr{0x80836498}
f32 getBoundingRadius() const override {
[[nodiscard]] f32 getBoundingRadius() const override {
return m_worldRadius;
}

Expand Down
4 changes: 2 additions & 2 deletions source/game/field/ObjectCollisionKart.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public:

size_t checkCollision(const EGG::Matrix34f &mat, const EGG::Vector3f &v);

static EGG::Vector3f GetHitDirection(u16 objKartHit);
static constexpr std::span<const EGG::Vector3f> GetVehicleVertices(Vehicle vehicle);
[[nodiscard]] static EGG::Vector3f GetHitDirection(u16 objKartHit);
[[nodiscard]] static constexpr std::span<const EGG::Vector3f> GetVehicleVertices(Vehicle vehicle);

private:
ObjectCollisionConvexHull *m_hull;
Expand Down
4 changes: 2 additions & 2 deletions source/game/field/ObjectCollisionSphere.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public:

void transform(const EGG::Matrix34f &mat, const EGG::Vector3f &scale,
const EGG::Vector3f &speed) override;
const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override;
[[nodiscard]] const EGG::Vector3f &getSupport(const EGG::Vector3f &v) const override;

/// @addr{0x80836B54}
f32 getBoundingRadius() const override {
[[nodiscard]] f32 getBoundingRadius() const override {
return m_scaledRadius;
}

Expand Down
2 changes: 1 addition & 1 deletion source/game/field/ObjectFlowTable.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public:
ObjectFlowTable(const char *filename);
~ObjectFlowTable();

const SObjectCollisionSet *set(s16 slot) const {
[[nodiscard]] const SObjectCollisionSet *set(s16 slot) const {
return slot == -1 ? nullptr : slot < m_count ? &m_sets[slot] : nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions source/game/field/ObjectHitTable.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public:
ObjectHitTable(const char *filename);
~ObjectHitTable();

Kart::Reaction reaction(s16 i) const;
s16 slot(ObjectId id) const;
[[nodiscard]] Kart::Reaction reaction(s16 i) const;
[[nodiscard]] s16 slot(ObjectId id) const;

private:
s16 m_count;
Expand Down
2 changes: 1 addition & 1 deletion source/game/kart/KartHalfPipe.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public:
void end(bool boost);

/// @addr{0x80574108}
static consteval f32 TerminalVelocity() {
[[nodiscard]] static consteval f32 TerminalVelocity() {
return 65.0f;
}

Expand Down
8 changes: 4 additions & 4 deletions source/game/kart/KartMove.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public:
bool calcZipperCollision(f32 radius, f32 scale, EGG::Vector3f &pos, EGG::Vector3f &upLocal,
const EGG::Vector3f &prevPos, Field::CourseColMgr::CollisionInfo *colInfo,
Field::KCLTypeMask *maskOut, Field::KCLTypeMask flags) const;
f32 calcSlerpRate(f32 scale, const EGG::Quatf &from, const EGG::Quatf &to) const;
[[nodiscard]] f32 calcSlerpRate(f32 scale, const EGG::Quatf &from, const EGG::Quatf &to) const;
virtual void calcVehicleRotation(f32 turn);
virtual void hop();
virtual void onHop() {}
Expand All @@ -102,12 +102,12 @@ public:
}

/// @addr{0x8058758C}
virtual bool canWheelie() const {
[[nodiscard]] virtual bool canWheelie() const {
return false;
}

/// @addr{0x8057DA18}
virtual bool canHop() const {
[[nodiscard]] virtual bool canHop() const {
if (!state()->isHopStart() || !state()->isTouchingGround()) {
return false;
}
Expand All @@ -120,7 +120,7 @@ public:
}

/// @addr{0x8057EA94}
bool canStartDrift() const {
[[nodiscard]] bool canStartDrift() const {
constexpr f32 MINIMUM_DRIFT_THRESOLD = 0.55f;

return m_speed > MINIMUM_DRIFT_THRESOLD * m_baseSpeed;
Expand Down
2 changes: 1 addition & 1 deletion source/game/kart/KartReject.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public:
void reset();

void calcRejectRoad();
bool calcRejection();
[[nodiscard]] bool calcRejection();

private:
f32 m_rejectSign;
Expand Down
10 changes: 5 additions & 5 deletions source/game/system/TimerManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Timer {
Timer(u32 data);
~Timer();

std::strong_ordering operator<=>(const Timer &rhs) const {
[[nodiscard]] std::strong_ordering operator<=>(const Timer &rhs) const {
if (auto cmp = min <=> rhs.min; cmp != 0) {
return cmp;
}
Expand All @@ -27,11 +27,11 @@ struct Timer {
return valid <=> rhs.valid;
}

bool operator==(const Timer &rhs) const = default;
bool operator!=(const Timer &rhs) const = default;
[[nodiscard]] bool operator==(const Timer &rhs) const = default;
[[nodiscard]] bool operator!=(const Timer &rhs) const = default;

/// @addr{0x807EE860}
Timer operator-(const Timer &rhs) const {
[[nodiscard]] Timer operator-(const Timer &rhs) const {
s16 addMin = 0;
s16 addSec = 0;

Expand All @@ -57,7 +57,7 @@ struct Timer {
return Timer(newMin, newSec, newMs);
}

Timer operator+(f32 ms) const {
[[nodiscard]] Timer operator+(f32 ms) const {
s16 addMin = 0;
s16 addSec = 0;

Expand Down
8 changes: 4 additions & 4 deletions source/game/system/map/MapdataCannonPoint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ public:
void read(EGG::Stream &stream);

/// @beginGetters
const EGG::Vector3f &pos() const {
[[nodiscard]] const EGG::Vector3f &pos() const {
return m_pos;
}

const EGG::Vector3f &rot() const {
[[nodiscard]] const EGG::Vector3f &rot() const {
return m_rot;
}

u16 id() const {
[[nodiscard]] u16 id() const {
return m_id;
}

s16 parameterIdx() const {
[[nodiscard]] s16 parameterIdx() const {
return m_parameterIdx;
}
/// @endGetters
Expand Down
10 changes: 5 additions & 5 deletions source/game/system/map/MapdataGeoObj.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public:
void read(EGG::Stream &stream);

/// @beginGetters
u16 id() const {
[[nodiscard]] u16 id() const {
return m_id;
}

const EGG::Vector3f &pos() const {
[[nodiscard]] const EGG::Vector3f &pos() const {
return m_pos;
}

const EGG::Vector3f &rot() const {
[[nodiscard]] const EGG::Vector3f &rot() const {
return m_rot;
}

const EGG::Vector3f &scale() const {
[[nodiscard]] const EGG::Vector3f &scale() const {
return m_scale;
}

u16 presenceFlag() const {
[[nodiscard]] u16 presenceFlag() const {
return m_presenceFlag;
}
/// @endGetters
Expand Down
10 changes: 5 additions & 5 deletions source/host/KReplaySystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public:
static KReplaySystem *CreateInstance();
static void DestroyInstance();

static KReplaySystem *Instance() {
[[nodiscard]] static KReplaySystem *Instance() {
return static_cast<KReplaySystem *>(s_instance);
}

Expand All @@ -27,12 +27,12 @@ private:
KReplaySystem(KReplaySystem &&) = delete;
~KReplaySystem() override;

bool calcEnd() const;
[[nodiscard]] bool calcEnd() const;
void reportFail(const std::string &msg) const;

bool success() const;
s32 getDesyncingTimerIdx() const;
DesyncingTimerPair getDesyncingTimer(s32 i) const;
[[nodiscard]] bool success() const;
[[nodiscard]] s32 getDesyncingTimerIdx() const;
[[nodiscard]] DesyncingTimerPair getDesyncingTimer(s32 i) const;

static void OnInit(System::RaceConfig *config, void *arg);

Expand Down
6 changes: 3 additions & 3 deletions source/host/KTestSystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public:
static KTestSystem *CreateInstance();
static void DestroyInstance();

static KTestSystem *Instance() {
[[nodiscard]] static KTestSystem *Instance() {
return static_cast<KTestSystem *>(s_instance);
}

Expand Down Expand Up @@ -118,13 +118,13 @@ private:
bool popTestCase();

bool calcTest();
TestData findCurrentFrameEntry();
[[nodiscard]] TestData findCurrentFrameEntry();
void testFrame(const TestData &data);

bool runTest();
void writeTestOutput() const;

const TestCase &getCurrentTestCase() const;
[[nodiscard]] const TestCase &getCurrentTestCase() const;

static void OnInit(System::RaceConfig *config, void *arg);

Expand Down
2 changes: 1 addition & 1 deletion source/host/Option.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum class EOption {

namespace Option {

std::optional<EOption> CheckFlag(const char *arg);
[[nodiscard]] std::optional<EOption> CheckFlag(const char *arg);

} // namespace Option
} // namespace Host