diff options
| author | LC <mathew1800@gmail.com> | 2021-01-21 20:29:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-21 20:29:22 -0500 |
| commit | afb426c60ca87472063b9b58b1a6b6a9db4fc127 (patch) | |
| tree | 68ef128ab508537c5601148fa89c1e777cfa4e1b /libs/SSystem/SComponent/c_lib.cpp | |
| parent | f33e47c0319daa9422922f17d63eac84508bc970 (diff) | |
c_lib: Decomp a few functions (#89)
* c_lib: Decomp cLib_memSet and cLib_memCpy
Gets rid of some low-hanging fruit.
* c_lib: Decomp cLib_distanceAngleS
Another super trivial function to make match.
* c_lib: Decomp cLib_targetAngleY overload set
Fairly trivial in terms of matching.
* c_lib: Sate clang-format
I didn't touch this code, but the clang-format pass wants this done, and
so it is.
Diffstat (limited to 'libs/SSystem/SComponent/c_lib.cpp')
| -rw-r--r-- | libs/SSystem/SComponent/c_lib.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/libs/SSystem/SComponent/c_lib.cpp b/libs/SSystem/SComponent/c_lib.cpp index 9ea135cfca..5fbb3c0876 100644 --- a/libs/SSystem/SComponent/c_lib.cpp +++ b/libs/SSystem/SComponent/c_lib.cpp @@ -1,19 +1,18 @@ /* c_lib.cpp autogenerated by split.py v0.3 at 2021-01-01 14:12:11.766106 */ #include "SComponent/c_lib.h" +#include "SComponent/c_math.h" // cLib_memCpy__FPvPCvUl // cLib_memCpy(void*, const void*, unsigned long) -asm void cLib_memCpy(void*, const void*, unsigned long) { - nofralloc -#include "SComponent/c_lib/asm/func_8026F93C.s" +void cLib_memCpy(void* dst, const void* src, unsigned long size) { + memcpy(dst, src, size); } // cLib_memSet__FPviUl // cLib_memSet(void*, int, unsigned long) -asm void cLib_memSet(void*, int, unsigned long) { - nofralloc -#include "SComponent/c_lib/asm/func_8026F95C.s" +void cLib_memSet(void* ptr, int value, unsigned long size) { + memset(ptr, value, size); } // cLib_addCalc__FPfffff @@ -116,23 +115,20 @@ asm int cLib_chasePosXZ(cXyz*, const cXyz&, float) { // cLib_chaseAngleS__FPsss // cLib_chaseAngleS(short*, short, short) -asm int cLib_chaseAngleS(short*, short, short) { - nofralloc +asm int cLib_chaseAngleS(short*, short, short){nofralloc #include "SComponent/c_lib/asm/func_80270B90.s" } // cLib_targetAngleY__FPC3VecPC3Vec // cLib_targetAngleY(const Vec*, const Vec*) -asm short cLib_targetAngleY(const Vec*, const Vec*) { - nofralloc -#include "SComponent/c_lib/asm/func_80270C04.s" +s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs) { + return cM_atan2s(rhs->x - lhs->x, rhs->z - lhs->z); } // cLib_targetAngleY__FRC3VecRC3Vec // cLib_targetAngleY(const Vec&, const Vec&) -asm short cLib_targetAngleY(const Vec&, const Vec&) { - nofralloc -#include "SComponent/c_lib/asm/func_80270C3C.s" +s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs) { + return cM_atan2s(rhs.x - lhs.x, rhs.z - lhs.z); } // cLib_targetAngleX__FPC4cXyzPC4cXyz @@ -144,16 +140,14 @@ asm short cLib_targetAngleX(const cXyz*, const cXyz*) { // cLib_offsetPos__FP4cXyzPC4cXyzsPC4cXyz // cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*) -asm void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*) { - nofralloc +asm void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*){nofralloc #include "SComponent/c_lib/asm/func_80270DC0.s" } // cLib_distanceAngleS__Fss // cLib_distanceAngleS(short, short) -asm short cLib_distanceAngleS(short, short) { - nofralloc -#include "SComponent/c_lib/asm/func_80270E24.s" +s32 cLib_distanceAngleS(s16 x, s16 y) { + return abs(static_cast<s16>(x - y)); } // MtxInit__Fv |
