Merge pull request #38 from robojumper/m_angle

m_angle
This commit is contained in:
Elijah Thomas
2024-05-12 12:46:06 -04:00
committed by GitHub
5 changed files with 48 additions and 5 deletions
+5
View File
@@ -208,6 +208,11 @@ f/f_manager.cpp:
.sbss start:0x80575BB8 end:0x80575BC0
.bss start:0x805B84D8 end:0x805B8588
m/m_angle.cpp:
.text start:0x802EE5F0 end:0x802EE6B8
.ctors start:0x804DB8CC end:0x804DB8D0
.sbss start:0x80575C08 end:0x80575C10
m/m_heap.cpp:
.text start:0x802F0F00 end:0x802F1660
.rodata start:0x804F0570 end:0x804F0580
+3 -3
View File
@@ -17710,8 +17710,8 @@ fn_802EE4A0 = .text:0x802EE4A0; // type:function size:0x70
fn_802EE510 = .text:0x802EE510; // type:function size:0x4C
adjustFrmHeapRestoreCurrent__16mHeapAllocator_cFv = .text:0x802EE560; // type:function size:0x64
fn_802EE5D0 = .text:0x802EE5D0; // type:function size:0x1C
fn_802EE5F0 = .text:0x802EE5F0; // type:function size:0xA4
fn_802EE6A0 = .text:0x802EE6A0; // type:function size:0x18
step__4mAngFsiss = .text:0x802EE5F0; // type:function size:0xA4
__sinit_\m_angle_cpp = .text:0x802EE6A0; // type:function size:0x18 scope:local
fn_802EE6C0 = .text:0x802EE6C0; // type:function size:0x114
fn_802EE7E0 = .text:0x802EE7E0; // type:function size:0x44
fn_802EE830 = .text:0x802EE830; // type:function size:0x58
@@ -40251,7 +40251,7 @@ lbl_80575BF4 = .sbss:0x80575BF4; // type:object size:0x4 data:4byte
lbl_80575BF8 = .sbss:0x80575BF8; // type:object size:0x4 data:4byte
lbl_80575BFC = .sbss:0x80575BFC; // type:object size:0x1 data:byte
lbl_80575C00 = .sbss:0x80575C00; // type:object size:0x8 data:4byte
lbl_80575C08 = .sbss:0x80575C08; // type:object size:0x8 data:2byte
Zero__7mAng3_c = .sbss:0x80575C08; // type:object size:0x6 data:2byte
lbl_80575C10 = .sbss:0x80575C10; // type:object size:0x4 data:4byte
lbl_80575C14 = .sbss:0x80575C14; // type:object size:0x4 data:4byte
lbl_80575C18 = .sbss:0x80575C18; // type:object size:0x4 data:4byte
+1
View File
@@ -300,6 +300,7 @@ config.libs = [
Object(NonMatching, "f/f_base.cpp"),
Object(Matching, "f/f_list.cpp"),
Object(Matching, "f/f_manager.cpp"),
Object(Matching, "m/m_angle.cpp"),
Object(Matching, "m/m_heap.cpp"),
Object(NonMatching, "m/m_mtx.cpp"),
# framework (f_name)
+9 -2
View File
@@ -5,18 +5,25 @@
struct mAng {
mAng() {}
mAng(s16 s) : val(s) {}
s16 val;
mAng(s16 s) : mVal(s) {}
s32 step(s16 target, s32 steps, s16 max, s16 min);
s16 mVal;
};
class mAng3_c {
public:
s16 x, y, z;
mAng3_c(s16 fx, s16 fy, s16 fz) : x(fx), y(fy), z(fz) {}
void set(s16 fx, s16 fy, s16 fz) {
x = fx;
y = fy;
z = fz;
}
static mAng3_c Zero;
};
#endif
+30
View File
@@ -0,0 +1,30 @@
#include <m/m_angle.h>
/** 80575c08 */
mAng3_c mAng3_c::Zero = mAng3_c::mAng3_c(0, 0, 0);
/** 802ee5f0 */
s32 mAng::step(s16 target, s32 steps, s16 max, s16 min) {
if (mVal != target) {
int stepSize;
int diff = target - mVal;
stepSize = diff / steps;
if (stepSize > min || stepSize < -min) {
mVal += stepSize < -max ? -max : stepSize > max ? max : stepSize;
} else if (diff >= 0) {
if (mVal + min >= target) {
mVal = target;
} else {
mVal += min;
}
} else {
if (mVal - min <= target) {
mVal = target;
} else {
mVal -= min;
}
}
}
return target - mVal;
}