Skip to content
Merged
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
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def MatchingFor(*versions):
Object(Matching, "d/lyt/d_lyt_common_icon_item.cpp"),
Object(NonMatching, "d/lyt/d_lyt_target_bird.cpp"),
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window.cpp"),
Object(NonMatching, "d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp"),
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp"),
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_common.cpp"),
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_talk.cpp"),
Object(Matching, "d/lyt/msg_window/d_lyt_msg_window_link.cpp"),
Expand Down Expand Up @@ -2437,7 +2437,7 @@ def MatchingFor(*versions):
Rel(NonMatching, "d_a_obj_D3_dummy", "REL/d/a/obj/d_a_obj_D3_dummy.cpp"),
Rel(NonMatching, "d_a_obj_daynight", "REL/d/a/obj/d_a_obj_daynight.cpp"),
Rel(NonMatching, "d_a_obj_decoA", "REL/d/a/obj/d_a_obj_decoA.cpp"),
Rel(NonMatching, "d_a_obj_decoB", "REL/d/a/obj/d_a_obj_decoB.cpp"),
Rel(Matching, "d_a_obj_decoB", "REL/d/a/obj/d_a_obj_decoB.cpp"),
Rel(NonMatching, "d_a_obj_desert", "REL/d/a/obj/d_a_obj_desert.cpp"),
Rel(NonMatching, "d_a_obj_desert_ago", "REL/d/a/obj/d_a_obj_desert_ago.cpp"),
Rel(Matching, "d_a_obj_desert_debris", "REL/d/a/obj/d_a_obj_desert_debris.cpp"),
Expand Down
2 changes: 0 additions & 2 deletions include/d/a/obj/d_a_obj_decoB.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "m/m_angle.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"

class dAcODecoB_c : public dAcObjBase_c {
public:
Expand All @@ -28,7 +27,6 @@ class dAcODecoB_c : public dAcObjBase_c {
/* 0x38C */ u16 padding_0x38C;
/* 0x38E */ mAng field_0x38E;

static f32 lbl_611_data_34;
static const f32 lbl_611_rodata_30;
};

Expand Down
1 change: 0 additions & 1 deletion include/d/a/obj/d_a_obj_windmill.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "m/m_vec.h"
#include "nw4r/g3d/res/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/stage_render_stuff.h"

class dAcOwindmill_c : public dAcObjBase_c {
Expand Down
150 changes: 72 additions & 78 deletions include/m/m_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,141 +8,145 @@
#include "nw4r/math/math_triangular.h"
#include "s/s_Math.h"

struct mAng {
class mAng {
public:
mAng() {}
mAng(s16 s) : mVal(s) {}
mAng(const mAng &other) : mVal(other.mVal) {}

mAng &operator=(const s32 &val) {
public:
void set(s16 val) {
mVal = val;
return *this;
}

void setF(const f32 &f) {
mVal = f;
}

static mAng atan2s(f32 a, f32 b) {
return mAng(cM::atan2s(a, b));
}
static mAng fromVec(const mVec3_c &other) {
return mAng(cM::atan2s(other.x, other.z));
public:
s16 *ref() {
return &mVal;
}

operator s16() const {
return mVal;
}

void set(s16 val) {
mVal = val;
}

s16 *ref() {
return &mVal;
}

mAng operator-() {
return mAng(-mVal);
}

mAng &operator+=(const mAng &other) {
mVal += other.mVal;
template <typename T>
mAng &operator+=(const T &other) {
mVal += s16(other);
return *this;
}
mAng &operator-=(const mAng &other) {
mVal -= other.mVal;
template <typename T>
mAng &operator-=(const T &other) {
mVal -= s16(other);
return *this;
}
mAng &operator*=(const s32 &other) {
template <typename T>
mAng &operator*=(const T &other) {
mVal *= other;
return *this;
}
mAng &operator*=(const f32 &other) {
mVal *= other;
template <typename T>
mAng &operator=(const T &other) {
mVal = other;
return *this;
}

s32 absDiff(const mAng &other) const {
return sLib::absDiff(mVal, other.mVal);
}

public:
static s32 abs(const mAng b) {
return labs(b);
}

s32 step(s16 target, s32 steps, s16 max, s16 min);

s32 abs() const {
return abs(*this);
}
s32 absDiff(const mAng &other) const {
return sLib::absDiff(mVal, other.mVal);
}
f32 sin() const {
return nw4r::math::SinIdx(*this);
}

f32 cos() const {
return nw4r::math::CosIdx(*this);
}

f32 degree() const {
return (360.0f / 65536.0f) * mVal;
static mAng atan2s(f32 a, f32 b) {
return mAng(cM::atan2s(a, b));
}

public:
s32 step(s16 target, s32 steps, s16 max, s16 min);

public:
static mAng fromVec(const mVec3_c &other) {
return mAng(cM::atan2s(other.x, other.z));
}
static s16 fromDeg(f32 deg) {
return deg * sDegToAng;
}
f32 degree2() const {
return mVal * sAngToDeg;
static mAng fromRad(f32 rad) {
return rad * sRadToAng;
}

f32 degree() const {
return (360.0f / 65536.0f) * mVal;
}
f32 radian() const {
return ((2.f * M_PI) / 65536.0f) * mVal;
}

f32 radian2() const {
f32 degree_c() const {
return mVal * sAngToDeg;
}
f32 radian_c() const {
return mVal * sAngToRad;
}

static mAng fromRad(f32 rad) {
return rad * sRadToAng;
public:
static s16 d2s(f32 deg) {
return deg * (65536.0f / 360.0f);
}

static f32 ang2deg_c(f32 ang) {
static f32 s2d(s16 angle) {
return (360.0f / 65536.0f) * angle;
}
static f32 s2d_c(f32 ang) {
return ang * sAngToDeg;
}

static f32 rad2deg_c(f32 rad) {
return rad * sRadToDeg;
static f32 d2s_c(f32 ang) {
return ang * sDegToAng;
}

static f32 rad2deg(f32 rad) {
return rad * (360.f / (2.f * M_PI));
static f32 s2r(s16 angle) {
return ((2.f * M_PI) / 65536.0f) * angle;
}
static f32 deg2rad(f32 deg) {
return deg * ((2.f * M_PI) / 360.f);
static s16 r2s(f32 rad) {
return rad * (65536.0f / (2.f * M_PI));
}
static s16 deg2short(f32 deg) {
return deg * (65536.0f / 360.0f);
static f32 s2r_c(f32 ang) {
return ang * sAngToRad;
}
static f32 short2deg(s16 angle) {
return (360.0f / 65536.0f) * angle;
static f32 r2s_c(f32 ang) {
return ang * sRadToAng;
}
static f32 short2rad(s16 angle) {
return ((2.f * M_PI) / 65536.0f) * angle;

static f32 d2r(f32 deg) {
return deg * ((2.f * M_PI) / 360.f);
}
static f32 short2norm(s16 angle) {
return 3.0517578E-5f * angle;
static f32 r2d(f32 rad) {
return rad * (360.f / (2.f * M_PI));
}
static s16 rad2short(f32 rad) {
return rad * (65536.0f / (2.f * M_PI));
static f32 d2r_c(f32 deg) {
return deg * sDegToRad;
}
static f32 r2d_c(f32 rad) {
return rad * sRadToDeg;
}

static f32 deg2rad_c(f32 deg) {
return deg * sDegToRad;
static f32 s2n(s16 angle) {
return 3.0517578E-5f * angle;
}

s16 mVal;

static const mAng Zero() {
return 0;
}

private:
static const f32 sHalfCircleDeg;
static const f32 sAngToDeg;
Expand Down Expand Up @@ -197,16 +201,6 @@ class mAng3_c {
set(0, 0, 0);
}

// TODO - This is the only way I could get the regswap to be fixed..
// Found with the pattern mAng3_c.y += cM::rndFX()
void addY(f32 val) {
y.mVal += (s16)val;
}

void addX(const s32 &fx) {
x += fx;
}

mAng x, y, z;

static mAng3_c Zero;
Expand Down
2 changes: 1 addition & 1 deletion include/m/m_pad.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ inline int getCurrentCoreID() {
}

inline bool isMpls(const int i) {
return g_padMg->getDevType(i) == EGG::cDEV_MPLS;
return g_padMg->getDevType(i) == EGG::cDEV_MPLS ? true : false;
}
inline bool isMplsPtFS(const int i) {
return g_padMg->getDevType(i) == EGG::cDEV_MPLS_PT_FS;
Expand Down
5 changes: 2 additions & 3 deletions src/REL/d/a/e/d_a_e_sm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,7 @@ void dAcEsm_c::fn_187_4540(int param0) {
pChild->mStateMgr.changeState(StateID_BirthJump);

if (field_0xB98 == 0) {
mAng ang = (f + cM::rndFX(4096.f));
rot.y -= mAng(ang);
rot.y -= mAng(f + cM::rndFX(4096.f));
} else {
rot.y = fn_187_51F0(true);
const f32 y = sSmDataArr[field_0xB98].field_0x04.y;
Expand Down Expand Up @@ -1438,7 +1437,7 @@ void dAcEsm_c::fn_187_6C20(bool param0) {
if (!param0) {
dCamera_c *cam = dScGame_c::getCamera(0);
mAngle.y = cLib::targetAngleY(cam->getPositionMaybe(), cam->getField_0x78());
mAngle.addY(cM::rndFX(16384.f));
mAngle.y += cM::rndFX(16384.f);
}

field_0xBCE = 1;
Expand Down
Loading