switch to dtk setup (#2203)

* switch to dtk setup

* some cleanup / fixes

* cleanup d_a_alink literals

* Restore doxygen, update CI & README.md (#1)

* Fix build image ref (#2)

---------

Co-authored-by: Luke Street <luke@street.dev>
This commit is contained in:
TakaRikka
2024-10-10 07:29:58 -07:00
committed by GitHub
parent 3769ea47a6
commit 178194ccb2
33438 changed files with 370506 additions and 3055930 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* c_API.cpp
*
*/
#include "SSystem/SComponent/c_API.h"
extern void mDoGph_BlankingON();
extern void mDoGph_BlankingOFF();
extern void mDoGph_BeforeOfDraw();
extern void mDoGph_AfterOfDraw();
extern void mDoGph_Painter();
extern void mDoGph_Create();
/* ############################################################################################## */
/* 803C3528-803C3540 0018+00 s=0 e=3 z=0 None .data g_cAPI_Interface */
cAPI_Interface g_cAPI_Interface = {
mDoGph_Create, mDoGph_BeforeOfDraw, mDoGph_AfterOfDraw,
mDoGph_Painter, mDoGph_BlankingON, mDoGph_BlankingOFF,
};
@@ -0,0 +1,17 @@
/**
* c_API_controller_pad.cpp
* Controller Pad API utilities
*/
#include "SSystem/SComponent/c_API_controller_pad.h"
#include "m_Do/m_Do_controller_pad.h"
/* 8026328C-802632AC 25DBCC 0020+00 0/0 3/3 0/0 .text cAPICPad_recalibrate__Fv */
void cAPICPad_recalibrate() {
mDoCPd_c::recalibrate();
}
/* 802632AC-802632C8 25DBEC 001C+00 0/0 3/3 1/1 .text cAPICPad_ANY_BUTTON__FUl */
u32 cAPICPad_ANY_BUTTON(u32 portNo) {
return mDoCPd_c::getTrig(portNo) & (CButton::A | CButton::B | CButton::START);
}
+22
View File
@@ -0,0 +1,22 @@
/**
* c_API_graphic.cpp
*
*/
#include "SSystem/SComponent/c_API_graphic.h"
#include "SSystem/SComponent/c_API.h"
/* 802632C8-802632F8 0030+00 s=0 e=1 z=0 None .text cAPIGph_Painter__Fv */
void cAPIGph_Painter() {
g_cAPI_Interface.painterMtd();
}
/* 802632F8-80263328 0030+00 s=0 e=1 z=0 None .text cAPIGph_BeforeOfDraw__Fv */
void cAPIGph_BeforeOfDraw() {
g_cAPI_Interface.beforeOfDrawMtd();
}
/* 80263328-80263358 0030+00 s=0 e=1 z=0 None .text cAPIGph_AfterOfDraw__Fv */
void cAPIGph_AfterOfDraw() {
g_cAPI_Interface.afterOfDrawMtd();
}
+332
View File
@@ -0,0 +1,332 @@
/**
* c_angle.cpp
*
*/
#include "SSystem/SComponent/c_angle.h"
extern f32 cM_atan2f(f32, f32);
const cSAngle cSAngle::_0(static_cast<s16>(0));
const cSAngle cSAngle::_1(static_cast<s16>(0xb6));
const cSAngle cSAngle::_90(static_cast<s16>(0x4000));
const cSAngle cSAngle::_180(static_cast<s16>(-0x8000));
const cSAngle cSAngle::_270(static_cast<s16>(-0x4000));
/* 80270F68-80270F98 0030+00 s=0 e=33 z=2 None .text __ct__7cSAngleFRC7cSAngle */
cSAngle::cSAngle(const cSAngle& angle) {
Val(angle);
}
/* 80270F98-80270FC8 0030+00 s=14 e=50 z=4 None .text __ct__7cSAngleFs */
cSAngle::cSAngle(s16 angle) {
Val(angle);
}
/* 80270FC8-80270FF8 0030+00 s=0 e=22 z=0 None .text __ct__7cSAngleFf */
cSAngle::cSAngle(f32 angle) {
Val(angle);
}
/* 80270FF8-80271004 000C+00 s=2 e=6 z=0 None .text Val__7cSAngleFRC7cSAngle */
void cSAngle::Val(const cSAngle& other) {
mAngle = other.mAngle;
}
/* 80271004-8027100C 0008+00 s=4 e=7 z=0 None .text Val__7cSAngleFs */
void cSAngle::Val(s16 val) {
mAngle = val;
}
/* 8027100C-80271030 0024+00 s=1 e=8 z=0 None .text Val__7cSAngleFf */
void cSAngle::Val(f32 degree) {
mAngle = cAngle::Degree_to_SAngle(degree);
}
/* 80271030-80271064 0034+00 s=0 e=11 z=0 None .text Degree__7cSAngleCFv */
f32 cSAngle::Degree() const {
return cAngle::SAngle_to_Degree(mAngle);
}
/* 80271064-80271098 0034+00 s=3 e=0 z=0 None .text Radian__7cSAngleCFv */
f32 cSAngle::Radian() const {
return cAngle::SAngle_to_Radian(mAngle);
}
/* 80271098-802710CC 0034+00 s=0 e=1 z=0 None .text Norm__7cSAngleCFv */
f32 cSAngle::Norm() const {
return cAngle::SAngle_to_Normal(mAngle);
}
/* 802710CC-802710E8 001C+00 s=0 e=5 z=1 None .text Abs__7cSAngleCFv */
s16 cSAngle::Abs() const {
return mAngle >= 0 ? mAngle : -mAngle;
}
/* 802710E8-802710F8 0010+00 s=2 e=22 z=2 None .text Inv__7cSAngleCFv */
s16 cSAngle::Inv() const {
return mAngle - 0x8000;
}
/* 802710F8-80271120 0028+00 s=0 e=6 z=1 None .text Sin__7cSAngleCFv */
f32 cSAngle::Sin() const {
return sin(Radian());
}
/* 80271120-80271148 0028+00 s=0 e=8 z=1 None .text Cos__7cSAngleCFv */
f32 cSAngle::Cos() const {
return cos(Radian());
}
/* 80271148-80271174 002C+00 s=2 e=8 z=0 None .text __mi__7cSAngleCFv */
cSAngle cSAngle::operator-() const {
return cSAngle(static_cast<s16>(-mAngle));
}
/* 80271174-802711A4 0030+00 s=0 e=30 z=1 None .text __pl__7cSAngleCFRC7cSAngle */
cSAngle cSAngle::operator+(const cSAngle& other) const {
return cSAngle(static_cast<s16>(mAngle + other.mAngle));
}
/* 802711A4-802711D4 0030+00 s=2 e=37 z=0 None .text __mi__7cSAngleCFRC7cSAngle */
cSAngle cSAngle::operator-(const cSAngle& other) const {
return cSAngle(static_cast<s16>(mAngle - other.mAngle));
}
/* 802711D4-802711E8 0014+00 s=0 e=15 z=0 None .text __apl__7cSAngleFRC7cSAngle */
void cSAngle::operator+=(const cSAngle& other) {
mAngle += other.mAngle;
}
/* 802711E8-802711FC 0014+00 s=0 e=3 z=0 None .text __ami__7cSAngleFRC7cSAngle */
void cSAngle::operator-=(const cSAngle& other) {
mAngle -= other.mAngle;
}
/* 802711FC-80271228 002C+00 s=0 e=5 z=0 None .text __pl__7cSAngleCFs */
cSAngle cSAngle::operator+(s16 other) const {
return cSAngle(static_cast<s16>(mAngle + other));
}
/* 80271228-80271254 002C+00 s=0 e=9 z=3 None .text __mi__7cSAngleCFs */
cSAngle cSAngle::operator-(s16 other) const {
return cSAngle(static_cast<s16>(mAngle - other));
}
/* 80271254-80271264 0010+00 s=0 e=1 z=0 None .text __apl__7cSAngleFs */
void cSAngle::operator+=(s16 other) {
mAngle += other;
}
/* 80271264-802712B4 0050+00 s=0 e=31 z=0 None .text __ml__7cSAngleCFf */
cSAngle cSAngle::operator*(f32 f1) const {
return cSAngle(static_cast<s16>(mAngle * f1));
}
/* 802712B4-802712F4 0040+00 s=0 e=3 z=0 None .text __amu__7cSAngleFf */
void cSAngle::operator*=(f32 f1) {
mAngle *= f1;
}
/* 802712F4-80271320 002C+00 s=0 e=2 z=0 None .text __pl__FsRC7cSAngle */
cSAngle operator+(s16 other, const cSAngle& angle) {
return cSAngle(static_cast<s16>(other + angle.Val()));
}
/* 80271320-8027134C 002C+00 s=0 e=5 z=0 None .text __mi__FsRC7cSAngle */
cSAngle operator-(s16 other, const cSAngle& angle) {
return cSAngle(static_cast<s16>(other - angle.Val()));
}
/* 8027134C-8027137C 0030+00 s=0 e=3 z=0 None .text __ct__7cDegreeFf */
cDegree::cDegree(f32 f) {
Val(f);
}
/* 8027137C-802713BC 0040+00 s=1 e=0 z=0 None .text Formal__7cDegreeFv */
cDegree& cDegree::Formal() {
mDegree = cAngle::Adjust<f32>(mDegree, -180.0f, 180.0f);
return *this;
}
/* 802713BC-802713E0 0024+00 s=1 e=0 z=0 None .text Val__7cDegreeFf */
void cDegree::Val(f32 f) {
mDegree = f;
Formal();
}
/* 802713E0-802713F0 0010+00 s=3 e=0 z=0 None .text Radian__7cDegreeCFv */
f32 cDegree::Radian() const {
return cAngle::Degree_to_Radian(mDegree);
}
/* 802713F0-80271418 0028+00 s=0 e=1 z=0 None .text Sin__7cDegreeCFv */
f32 cDegree::Sin() const {
return sin(Radian());
}
/* 80271418-80271440 0028+00 s=0 e=2 z=0 None .text Cos__7cDegreeCFv */
f32 cDegree::Cos() const {
return cos(Radian());
}
/* 80271440-80271468 0028+00 s=0 e=1 z=0 None .text Tan__7cDegreeCFv */
f32 cDegree::Tan() const {
return tan(Radian());
}
/* 80271468-80271498 0030+00 s=1 e=0 z=0 None .text __ct__7cSPolarFRC4cXyz */
cSPolar::cSPolar(const cXyz& xyz) {
Val(xyz);
}
/* 80271498-80271558 00C0+00 s=2 e=0 z=0 None .text Formal__7cSPolarFv */
cSPolar& cSPolar::Formal() {
if (mRadial < 0.0f) {
mRadial = -mRadial;
cSAngle tmp(static_cast<s16>(-0x8000));
mAngle1.Val(tmp - mAngle1);
mAngle2.Val(mAngle2.Inv());
}
if (mAngle1.Val() < 0 && mAngle1.Val() != -0x8000) {
mAngle1.Val(-mAngle1);
mAngle2.Val(mAngle2.Inv());
}
return *this;
}
/* 80271558-802715BC 0064+00 s=1 e=0 z=0 None .text Val__7cSPolarFfss */
void cSPolar::Val(f32 f, s16 s1, s16 s2) {
mRadial = f;
mAngle1 = cSAngle(s1);
mAngle2 = cSAngle(s2);
Formal();
}
inline double square(f32 f) {
return f * f;
}
/* 802715BC-802716EC 0130+00 s=1 e=0 z=0 None .text Val__7cSPolarFRC4cXyz */
void cSPolar::Val(const cXyz& xyz) {
f32 x, y, z, tmp4;
x = xyz.x;
y = xyz.y;
z = xyz.z;
double tmp = square(z) + square(x);
double tmp2 = square(y) + tmp;
tmp4 = (tmp > 0.0) ? (f32)sqrt(tmp) : 0.0f;
mRadial = (tmp2 > 0.0) ? (f32)sqrt(tmp2) : 0.0f;
mAngle1.Val(cAngle::Radian_to_SAngle(cM_atan2f(tmp4, y)));
mAngle2.Val(cAngle::Radian_to_SAngle(cM_atan2f(x, z)));
Formal();
}
/* 802716EC-802717B4 00C8+00 s=1 e=1 z=0 None .text Xyz__7cSPolarCFv */
cXyz cSPolar::Xyz() const {
f32 ang1Cos;
f32 ang2Cos;
f32 ang1Sin = mRadial * (f32)sin(mAngle1.Radian());
ang2Cos = (f32)cos(mAngle2.Radian());
ang1Cos = mRadial * (f32)cos(mAngle1.Radian());
f32 ang2Sin = sin(mAngle2.Radian());
return cXyz(ang1Sin * ang2Sin, ang1Cos, ang1Sin * ang2Cos);
}
/* 802717B4-802717F0 003C+00 s=1 e=0 z=0 None .text Globe__7cSPolarCFP7cSGlobe */
void cSPolar::Globe(cSGlobe* globe) const {
globe->Val(mRadial, 0x4000 - mAngle1.Val(), mAngle2.Val());
}
/* 802717F0-80271820 0030+00 s=0 e=6 z=0 None .text __ct__7cSGlobeFRC7cSGlobe */
cSGlobe::cSGlobe(const cSGlobe& other) {
Val(other);
}
/* 80271820-80271850 0030+00 s=0 e=3 z=0 None .text __ct__7cSGlobeFfss */
cSGlobe::cSGlobe(f32 f, s16 s1, s16 s2) {
Val(f, s1, s2);
}
/* 80271850-80271880 0030+00 s=1 e=4 z=0 None .text __ct__7cSGlobeFfRC7cSAngleRC7cSAngle */
cSGlobe::cSGlobe(f32 f, const cSAngle& a1, const cSAngle& a2) {
Val(f, a1, a2);
}
/* 80271880-802718B0 0030+00 s=0 e=35 z=3 None .text __ct__7cSGlobeFRC4cXyz */
cSGlobe::cSGlobe(const cXyz& xyz) {
Val(xyz);
}
/* 802718B0-8027196C 00BC+00 s=5 e=0 z=0 None .text Formal__7cSGlobeFv */
cSGlobe& cSGlobe::Formal() {
if (mRadius < 0.0f) {
mRadius = -mRadius;
mAzimuth = -mAzimuth;
mInclination.Val(mInclination.Inv());
}
if (mAzimuth.Val() < -0x4000 || 0x4000 < mAzimuth.Val()) {
mAzimuth = cSAngle((s16)-0x8000) - mAzimuth;
mInclination.Val(mInclination.Inv());
}
return *this;
}
/* 8027196C-802719A4 0038+00 s=1 e=0 z=0 None .text Val__7cSGlobeFRC7cSGlobe */
void cSGlobe::Val(const cSGlobe& other) {
mRadius = other.mRadius;
mAzimuth = other.mAzimuth;
mInclination = other.mInclination;
Formal();
}
/* 802719A4-80271A08 0064+00 s=2 e=3 z=0 None .text Val__7cSGlobeFfss */
void cSGlobe::Val(f32 f, s16 s1, s16 s2) {
mRadius = f;
mAzimuth = cSAngle(s1);
mInclination = cSAngle(s2);
Formal();
}
/* 80271A08-80271A70 0068+00 s=1 e=11 z=0 None .text Val__7cSGlobeFfRC7cSAngleRC7cSAngle */
void cSGlobe::Val(f32 f, const cSAngle& a1, const cSAngle& a2) {
mRadius = f;
mAzimuth = cSAngle(a1.Val());
mInclination = cSAngle(a2.Val());
Formal();
}
/* 80271A70-80271AB4 0044+00 s=1 e=38 z=0 None .text Val__7cSGlobeFRC4cXyz */
void cSGlobe::Val(const cXyz& xyz) {
cSPolar csp(xyz);
csp.Globe(this);
Formal();
}
/* 80271AB4-80271AF4 0040+00 s=1 e=38 z=0 None .text Xyz__7cSGlobeCFv */
cXyz cSGlobe::Xyz() const {
cSPolar csp;
Polar(&csp);
return csp.Xyz();
}
/* 80271AF4-80271B30 003C+00 s=1 e=0 z=0 None .text Polar__7cSGlobeCFP7cSPolar */
void cSGlobe::Polar(cSPolar* csp) const {
csp->Val(mRadius, 0x4000 - mAzimuth.Val(), mInclination.Val());
}
/* 80271B30-80271B7C 004C+00 s=0 e=3 z=0 None .text Norm__7cSGlobeCFv */
cXyz cSGlobe::Norm() const {
cSGlobe glob(1.0f, mAzimuth, mInclination);
return glob.Xyz();
}
/* 80271B7C-80271BA8 002C+00 s=0 e=2 z=0 None .text Invert__7cSGlobeFv */
cSGlobe& cSGlobe::Invert() {
mRadius = -mRadius;
return Formal();
}
+33
View File
@@ -0,0 +1,33 @@
/**
* c_bg_s_chk.cpp
*
*/
#include "SSystem/SComponent/c_bg_s_chk.h"
/* 80267B4C-80267B70 26248C 0024+00 0/0 7/7 0/0 .text __ct__8cBgS_ChkFv */
cBgS_Chk::cBgS_Chk() {
mPolyPassChk = 0;
mGrpPassChk = 0;
unk_0x0C = 1;
}
/* 80267B70-80267BB8 2624B0 0048+00 1/0 7/7 0/0 .text __dt__8cBgS_ChkFv */
cBgS_Chk::~cBgS_Chk() {}
/* 80267BB8-80267BDC 2624F8 0024+00 0/0 4/4 0/0 .text SetExtChk__8cBgS_ChkFR8cBgS_Chk */
void cBgS_Chk::SetExtChk(cBgS_Chk& other) {
mPolyPassChk = other.mPolyPassChk;
mGrpPassChk = other.mGrpPassChk;
mActorPid = other.mActorPid;
unk_0x0C = other.unk_0x0C;
}
/* 80267BDC-80267C1C 26251C 0040+00 0/0 7/7 0/0 .text ChkSameActorPid__8cBgS_ChkCFUi */
bool cBgS_Chk::ChkSameActorPid(unsigned int pid) const {
if (mActorPid == -1 || pid == UINT32_MAX || unk_0x0C == 0) {
return FALSE;
} else {
return (mActorPid == pid) ? TRUE : FALSE;
}
}
+32
View File
@@ -0,0 +1,32 @@
/**
* c_bg_s_gnd_chk.cpp
*
*/
#include "SSystem/SComponent/c_bg_s_gnd_chk.h"
/* 80267C1C-80267C94 26255C 0078+00 0/0 2/2 123/123 .text __ct__11cBgS_GndChkFv */
cBgS_GndChk::cBgS_GndChk() {
m_pos = cXyz::Zero;
SetActorPid(UINT32_MAX);
mFlags = 2;
}
/* 80267C94-80267D0C 2625D4 0078+00 2/1 4/4 110/110 .text __dt__11cBgS_GndChkFv */
cBgS_GndChk::~cBgS_GndChk() {}
/* 80267D0C-80267D28 26264C 001C+00 0/0 0/0 62/62 .text SetPos__11cBgS_GndChkFPC3Vec */
void cBgS_GndChk::SetPos(Vec const* pos) {
m_pos = *pos;
}
/* 80267D28-80267D44 262668 001C+00 0/0 51/51 185/185 .text SetPos__11cBgS_GndChkFPC4cXyz
*/
void cBgS_GndChk::SetPos(cXyz const* pos) {
m_pos = *pos;
}
/* 80267D44-80267D54 262684 0010+00 0/0 1/1 0/0 .text PreCheck__11cBgS_GndChkFv */
void cBgS_GndChk::PreCheck() {
mWallPrecheck = mFlags & 2;
}
+42
View File
@@ -0,0 +1,42 @@
/**
* c_bg_s_lin_chk.cpp
*
*/
#include "SSystem/SComponent/c_bg_s_lin_chk.h"
/* 80267D5C-80267DBC 26269C 0060+00 0/0 2/2 0/0 .text __ct__11cBgS_LinChkFv */
cBgS_LinChk::cBgS_LinChk() {
ct();
}
/* 80267DBC-80267E48 2626FC 008C+00 2/1 2/2 0/0 .text __dt__11cBgS_LinChkFv */
cBgS_LinChk::~cBgS_LinChk() {}
/* 80267E48-80267ED0 262788 0088+00 1/1 0/0 0/0 .text ct__11cBgS_LinChkFv */
void cBgS_LinChk::ct() {
cXyz start_end(cXyz::Zero);
mLin.SetStartEnd(start_end, start_end);
field_0x40 = start_end;
SetActorPid(UINT32_MAX);
field_0x4c = 0;
mFrontFlag = 1;
mBackFlag = 0;
}
/* 80267ED0-80267F40 262810 0070+00 0/0 2/2 0/0 .text Set2__11cBgS_LinChkFPC4cXyzPC4cXyzUi */
void cBgS_LinChk::Set2(cXyz const* startPos, cXyz const* endPos, unsigned int actorPid) {
mLin.SetStartEnd(*startPos, *endPos);
field_0x40 = *endPos;
SetActorPid(actorPid);
field_0x4c &= ~0x10;
ClearPi();
}
/* 80267F40-80267F80 262880 0040+00 0/0 1/1 0/0 .text PreCalc__11cBgS_LinChkFv */
void cBgS_LinChk::PreCalc() {
mPreWallChk = !(field_0x4c & 0x40000000);
mPreGroundChk = !(field_0x4c & 0x80000000);
mPreRoofChk = !(field_0x4c & 0x20000000);
}
@@ -0,0 +1,68 @@
/**
* c_bg_s_poly_info.cpp
*
*/
#include "SSystem/SComponent/c_bg_s_poly_info.h"
/* 80268074-802680B0 2629B4 003C+00 0/0 7/7 9/9 .text __ct__13cBgS_PolyInfoFv */
cBgS_PolyInfo::cBgS_PolyInfo() {
ClearPi();
}
/* 802680B0-802680F8 2629F0 0048+00 1/0 10/10 393/393 .text __dt__13cBgS_PolyInfoFv */
cBgS_PolyInfo::~cBgS_PolyInfo() {}
/* 802680F8-80268120 262A38 0028+00 0/0 4/4 0/0 .text ChkSetInfo__13cBgS_PolyInfoCFv */
bool cBgS_PolyInfo::ChkSetInfo() const {
if (mPolyIndex == 0xFFFF || mBgIndex == 0x100) {
return false;
} else {
return true;
}
}
/* 80268120-80268148 262A60 0028+00 1/1 11/11 0/0 .text ClearPi__13cBgS_PolyInfoFv */
void cBgS_PolyInfo::ClearPi() {
mPolyIndex = -1;
mBgIndex = 0x100;
unk_0x04 = 0;
mActorId = -1;
}
/* 80268148-8026816C 262A88 0024+00 0/0 11/11 1/1 .text
* SetPolyInfo__13cBgS_PolyInfoFRC13cBgS_PolyInfo */
void cBgS_PolyInfo::SetPolyInfo(const cBgS_PolyInfo& poly) {
mPolyIndex = poly.mPolyIndex;
mBgIndex = poly.mBgIndex;
unk_0x04 = poly.unk_0x04;
mActorId = poly.mActorId;
}
/* 8026816C-8026817C 262AAC 0010+00 0/0 6/6 0/0 .text SetActorInfo__13cBgS_PolyInfoFiPvUi
*/
void cBgS_PolyInfo::SetActorInfo(int bg_index, void* p_data, unsigned int actor_id) {
mBgIndex = bg_index;
unk_0x04 = p_data;
mActorId = actor_id;
}
/* 8026817C-802681A4 262ABC 0028+00 0/0 1/1 0/0 .text ChkSafe__13cBgS_PolyInfoCFPCvUi */
bool cBgS_PolyInfo::ChkSafe(const void* param_1, unsigned int actor_id) const {
if (unk_0x04 == param_1 && mActorId == actor_id) {
return true;
} else {
return false;
}
}
/* 802681A4-802681AC 262AE4 0008+00 0/0 11/11 0/0 .text SetPolyIndex__13cBgS_PolyInfoFi
*/
void cBgS_PolyInfo::SetPolyIndex(int poly_index) {
mPolyIndex = poly_index;
}
/* 802681AC-802681C0 262AEC 0014+00 0/0 3/3 0/0 .text ChkBgIndex__13cBgS_PolyInfoCFv */
bool cBgS_PolyInfo::ChkBgIndex() const {
return mBgIndex != 0x100;
}
@@ -0,0 +1,24 @@
/**
* c_bg_s_shdw_draw.cpp
*
*/
#include "SSystem/SComponent/c_bg_s_shdw_draw.h"
/* 80267F88-80267FD0 2628C8 0048+00 0/0 1/1 0/0 .text __ct__13cBgS_ShdwDrawFv */
cBgS_ShdwDraw::cBgS_ShdwDraw() {}
/* 80267FD0-80268048 262910 0078+00 1/0 2/2 0/0 .text __dt__13cBgS_ShdwDrawFv */
cBgS_ShdwDraw::~cBgS_ShdwDraw() {}
/* 80268048-8026806C 262988 0024+00 0/0 1/1 0/0 .text Set__13cBgS_ShdwDrawFR4cXyzR4cXyz
*/
void cBgS_ShdwDraw::Set(cXyz& bound_min, cXyz& bound_max) {
mM3dGAab.Set(&bound_min, &bound_max);
}
/* 8026806C-80268074 -00001 0008+00 0/0 0/0 0/0 .text
* SetCallback__13cBgS_ShdwDrawFPFP13cBgS_ShdwDrawP10cBgD_Vtx_tiiiP8cM3dGPla_i */
void cBgS_ShdwDraw::SetCallback(cBgS_ShdwDraw_Callback callback) {
mCallbackFun = callback;
}
+39
View File
@@ -0,0 +1,39 @@
/**
* c_bg_w.cpp
*
*/
#include "SSystem/SComponent/c_bg_w.h"
/* 802681C0-802681C8 262B00 0008+00 0/0 1/1 0/0 .text Regist__9cBgW_BgIdFi */
void cBgW_BgId::Regist(int id) {
m_id = id;
}
/* 802681C8-802681D4 262B08 000C+00 0/0 2/2 0/0 .text Release__9cBgW_BgIdFv */
void cBgW_BgId::Release() {
m_id = 0x100;
}
/* 802681D4-802681E4 262B14 0010+00 0/0 7/7 121/121 .text ChkUsed__9cBgW_BgIdCFv */
bool cBgW_BgId::ChkUsed() const {
return m_id < 0x100;
}
/* 802681E4-802681FC 262B24 0018+00 1/1 22/22 8/8 .text cBgW_CheckBGround__Ff */
bool cBgW_CheckBGround(float y) {
return y >= 0.5f;
}
/* 802681FC-80268210 262B3C 0014+00 1/1 6/6 0/0 .text cBgW_CheckBRoof__Ff */
bool cBgW_CheckBRoof(float y) {
return y < (-4.0f / 5.0f);
}
/* 80268210-80268260 262B50 0050+00 0/0 16/16 4/4 .text cBgW_CheckBWall__Ff */
bool cBgW_CheckBWall(float y) {
if (!cBgW_CheckBGround(y) && !cBgW_CheckBRoof(y))
return true;
return false;
}
+793
View File
@@ -0,0 +1,793 @@
/**
* c_cc_d.cpp
*
*/
#include "SSystem/SComponent/c_cc_d.h"
#include "JSystem/JUtility/JUTAssert.h"
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
/* 80430CB4-80430CC0 05D9D4 000C+00 1/1 2/2 0/0 .bss m_virtual_center__14cCcD_ShapeAttr
*/
cXyz cCcD_ShapeAttr::m_virtual_center = cXyz::Zero;
/* 80263358-80263368 25DC98 0010+00 2/2 1/1 0/0 .text Set__15cCcD_DivideInfoFUlUlUl */
void cCcD_DivideInfo::Set(u32 xDivInfo, u32 yDivInfo, u32 zDivInfo) {
mXDivInfo = xDivInfo;
mYDivInfo = yDivInfo;
mZDivInfo = zDivInfo;
}
/* 80263368-802633A8 25DCA8 0040+00 0/0 5/5 0/0 .text Chk__15cCcD_DivideInfoCFRC15cCcD_DivideInfo
*/
bool cCcD_DivideInfo::Chk(const cCcD_DivideInfo& other) const {
if ((mXDivInfo & other.mXDivInfo) == 0 || (mZDivInfo & other.mZDivInfo) == 0 ||
(mYDivInfo & other.mYDivInfo) == 0)
{
return false;
} else {
return true;
}
}
/* 802633A8-802634D4 25DCE8 012C+00 0/0 2/2 0/0 .text SetArea__15cCcD_DivideAreaFRC8cM3dGAab */
void cCcD_DivideArea::SetArea(const cM3dGAab& aab) {
Set(aab.GetMinP(), aab.GetMaxP());
mScaledXDiff = 1.0f / 32.0f * (GetMaxP()->x - GetMinP()->x);
mXDiffIsZero = cM3d_IsZero(mScaledXDiff);
if (!mXDiffIsZero) {
mInvScaledXDiff = 1.0f / mScaledXDiff;
}
mScaledYDiff = 1.0f / 32.0f * (GetMaxP()->y - GetMinP()->y);
mYDiffIsZero = cM3d_IsZero(mScaledYDiff);
if (!mYDiffIsZero) {
mInvScaledYDiff = 1.0f / mScaledYDiff;
}
mScaledZDiff = 1.0f / 32.0f * (GetMaxP()->z - GetMinP()->z);
mZDiffIsZero = cM3d_IsZero(mScaledZDiff);
if (!mZDiffIsZero) {
mInvScaledZDiff = 1.0f / mScaledZDiff;
}
}
/* 8039A7E8-8039A868 026E48 0080+00 2/2 0/0 0/0 .rodata l_base */
static const u32 l_base[32] = {
0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF,
0x0001FFFF, 0x0003FFFF, 0x0007FFFF, 0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF, 0x00FFFFFF,
0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, 0x0FFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF,
};
/* 802634D4-802636A0 25DE14 01CC+00 0/0 2/2 0/0 .text
* CalcDivideInfo__15cCcD_DivideAreaFP15cCcD_DivideInfoRC8cM3dGAabUl */
void cCcD_DivideArea::CalcDivideInfo(cCcD_DivideInfo* pDivideInfo, const cM3dGAab& aab,
u32 param_2) {
if (param_2 != 0) {
pDivideInfo->Set(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
} else {
u32 xDivInfo, yDivInfo, zDivInfo;
if (!mXDiffIsZero) {
s32 var1 = mInvScaledXDiff * (aab.GetMinP()->x - GetMinP()->x);
s32 var3 = mInvScaledXDiff * (aab.GetMaxP()->x - GetMinP()->x);
if (31 < var3) {
var3 = 31;
}
xDivInfo = l_base[var3];
if (0 < var1) {
var1--;
xDivInfo &= ~l_base[var1];
}
} else {
xDivInfo = 0xFFFFFFFF;
}
if (!mYDiffIsZero) {
s32 var1 = mInvScaledYDiff * (aab.GetMinP()->y - GetMinP()->y);
s32 var3 = mInvScaledYDiff * (aab.GetMaxP()->y - GetMinP()->y);
if (31 < var3) {
var3 = 31;
}
yDivInfo = l_base[var3];
if (0 < var1) {
var1--;
yDivInfo &= ~l_base[var1];
}
} else {
yDivInfo = 0xFFFFFFFF;
}
if (!mZDiffIsZero) {
s32 var1 = mInvScaledZDiff * (aab.GetMinP()->z - GetMinP()->z);
s32 var3 = mInvScaledZDiff * (aab.GetMaxP()->z - GetMinP()->z);
if (31 < var3) {
var3 = 31;
}
zDivInfo = l_base[var3];
if (0 < var1) {
var1--;
zDivInfo &= ~l_base[var1];
}
} else {
zDivInfo = 0xFFFFFFFF;
}
pDivideInfo->Set(xDivInfo, yDivInfo, zDivInfo);
}
}
/* 802636A0-80263894 25DFE0 01F4+00 0/0 3/3 0/0 .text
* CalcDivideInfoOverArea__15cCcD_DivideAreaFP15cCcD_DivideInfoRC8cM3dGAab */
void cCcD_DivideArea::CalcDivideInfoOverArea(cCcD_DivideInfo* pDivideInfo, const cM3dGAab& aab) {
u32 xDivInfo, yDivInfo, zDivInfo;
if (!mXDiffIsZero) {
s32 var1 = mInvScaledXDiff * (aab.GetMinP()->x - GetMinP()->x);
s32 var3 = mInvScaledXDiff * (aab.GetMaxP()->x - GetMinP()->x);
if (var3 < 0 || 31 < var1) {
xDivInfo = 0;
} else {
if (31 < var3) {
var3 = 31;
}
xDivInfo = l_base[var3];
if (0 < var1) {
var1--;
xDivInfo &= ~l_base[var1];
}
}
} else {
xDivInfo = 0xFFFFFFFF;
}
if (!mYDiffIsZero) {
s32 var1 = mInvScaledYDiff * (aab.GetMinP()->y - GetMinP()->y);
s32 var3 = mInvScaledYDiff * (aab.GetMaxP()->y - GetMinP()->y);
if (var3 < 0 || 31 < var1) {
yDivInfo = 0;
} else {
if (31 < var3) {
var3 = 31;
}
yDivInfo = l_base[var3];
if (0 < var1) {
var1--;
yDivInfo &= ~l_base[var1];
}
}
} else {
yDivInfo = 0xFFFFFFFF;
}
if (!mZDiffIsZero) {
s32 var1 = mInvScaledZDiff * (aab.GetMinP()->z - GetMinP()->z);
s32 var3 = mInvScaledZDiff * (aab.GetMaxP()->z - GetMinP()->z);
if (var3 < 0 || 31 < var1) {
zDivInfo = 0;
} else {
if (31 < var3) {
var3 = 31;
}
zDivInfo = l_base[var3];
if (0 < var1) {
var1--;
zDivInfo &= ~l_base[var1];
}
}
} else {
zDivInfo = 0xFFFFFFFF;
}
pDivideInfo->Set(xDivInfo, yDivInfo, zDivInfo);
}
/* 80263894-8026389C 25E1D4 0008+00 1/0 1/0 0/0 .text GetGStts__9cCcD_SttsCFv */
const cCcD_GStts* cCcD_Stts::GetGStts() const {
return NULL;
}
/* 8026389C-802638A4 25E1DC 0008+00 1/0 0/0 0/0 .text GetGStts__9cCcD_SttsFv */
cCcD_GStts* cCcD_Stts::GetGStts() {
return NULL;
}
/* 802638A4-80263904 25E1E4 0060+00 0/0 1/1 0/0 .text Init__9cCcD_SttsFiiPvUi */
void cCcD_Stts::Init(int weight, int param_1, void* pactor, fpc_ProcID apid) {
Ct();
m_weight = weight;
field_0x15 = param_1;
mp_actor = static_cast<fopAc_ac_c*>(pactor);
m_apid = apid;
}
/* 80263904-80263934 25E244 0030+00 1/0 1/1 0/0 .text Ct__9cCcD_SttsFv */
void cCcD_Stts::Ct() {
m_cc_move.x = 0.0f;
m_cc_move.y = 0.0f;
m_cc_move.z = 0.0f;
mp_actor = NULL;
m_apid = fpcM_ERROR_PROCESS_ID_e;
m_weight = 0;
field_0x15 = 0;
m_dmg = 0;
}
/* 80263934-8026395C 25E274 0028+00 0/0 3/3 0/0 .text PlusCcMove__9cCcD_SttsFfff */
void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) {
m_cc_move.x += x;
m_cc_move.y += y;
m_cc_move.z += z;
CHECK_FLOAT_CLASS(422, m_cc_move.x);
CHECK_FLOAT_CLASS(423, m_cc_move.y);
CHECK_FLOAT_CLASS(424, m_cc_move.z);
CHECK_FLOAT_RANGE(426, m_cc_move.x);
CHECK_FLOAT_RANGE(427, m_cc_move.y);
CHECK_FLOAT_RANGE(428, m_cc_move.z);
}
/* 8026395C-80263970 25E29C 0014+00 0/0 10/10 23/23 .text ClrCcMove__9cCcD_SttsFv */
void cCcD_Stts::ClrCcMove() {
m_cc_move.z = 0.0f;
m_cc_move.y = 0.0f;
m_cc_move.x = 0.0f;
}
/* 80263970-80263984 25E2B0 0014+00 0/0 2/2 0/0 .text PlusDmg__9cCcD_SttsFi */
void cCcD_Stts::PlusDmg(int dmg) {
if (m_dmg >= dmg) {
return;
}
m_dmg = dmg;
}
/* 80263984-802639B0 25E2C4 002C+00 0/0 1/1 0/0 .text GetWeightF__9cCcD_SttsCFv */
f32 cCcD_Stts::GetWeightF() const {
return (s32)m_weight;
}
/* 802639B0-802639C4 25E2F0 0014+00 0/0 1/1 0/0 .text ct__18cCcD_ObjCommonBaseFv */
void cCcD_ObjCommonBase::ct() {
mSPrm = 0;
mRPrm = 0;
mHitObj = NULL;
}
/* 802639C4-80263A10 25E304 004C+00 1/1 0/0 0/0 .text Set__14cCcD_ObjHitInfFRC17cCcD_SrcObjHitInf
*/
void cCcD_ObjHitInf::Set(const cCcD_SrcObjHitInf& src) {
mObjAt.Set(src.mObjAt);
mObjTg.Set(src.mObjTg);
mObjCo.Set(src.mObjCo);
}
/* 80263A10-80263A1C 25E350 000C+00 0/0 1/1 0/0 .text ct__8cCcD_ObjFv */
void cCcD_Obj::ct() {
mFlags = 0;
}
/* 80263A1C-80263A48 25E35C 002C+00 0/0 1/1 0/0 .text Set__8cCcD_ObjFRC11cCcD_SrcObj */
void cCcD_Obj::Set(const cCcD_SrcObj& src) {
mFlags = src.mFlags;
cCcD_ObjHitInf::Set(src.mSrcObjHitInf);
}
/* 80263A48-80263A64 25E388 001C+00 0/0 9/9 87/87 .text GetAc__8cCcD_ObjFv */
fopAc_ac_c* cCcD_Obj::GetAc() {
if (mStts == NULL) {
return NULL;
} else {
return mStts->GetAc();
}
}
/* 80263A64-80263A88 25E3A4 0024+00 3/0 2/0 0/0 .text
* getShapeAccess__14cCcD_ShapeAttrCFPQ214cCcD_ShapeAttr5Shape */
void cCcD_ShapeAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 2;
pshape->_14 = 0.0f;
pshape->_10 = 0.0f;
pshape->_C = 0.0f;
pshape->_8 = 0.0f;
pshape->_4 = 0.0f;
}
/* 80263A88-80263B58 25E3C8 00D0+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_TriAttrCFRC12cCcD_CpsAttrP4cXyz */
bool cCcD_TriAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const {
if (cM3dGTri::Cross(cpsAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263B58-80263B90 25E498 0038+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_TriAttrCFRC12cCcD_CylAttrP4cXyz */
bool cCcD_TriAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const {
if (cM3dGTri::Cross(cylAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263B90-80263BCC 25E4D0 003C+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_TriAttrCFRC12cCcD_SphAttrP4cXyz */
bool cCcD_TriAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
if (cM3dGTri::Cross(sphAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263BCC-80263C04 25E50C 0038+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_TriAttrCFRC12cCcD_TriAttrP4cXyz */
bool cCcD_TriAttr::CrossAtTg(const cCcD_TriAttr& other, cXyz* pxyz) const {
if (cM3dGTri::Cross(other, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263C04-80263C9C 25E544 0098+00 1/0 1/0 0/0 .text CalcAabBox__12cCcD_TriAttrFv */
void cCcD_TriAttr::CalcAabBox() {
mAab.ClearForMinMax();
mAab.SetMinMax(mA);
mAab.SetMinMax(mB);
mAab.SetMinMax(mC);
}
/* 80263C9C-80263D38 25E5DC 009C+00 1/0 1/0 0/0 .text GetNVec__12cCcD_TriAttrCFRC4cXyzP4cXyz */
bool cCcD_TriAttr::GetNVec(const cXyz& param_0, cXyz* pOut) const {
if (getPlaneFunc(&param_0) >= 0.0f) {
*pOut = mNormal;
} else {
*pOut = mNormal;
VECScale(pOut, pOut, -1.0f);
}
return true;
}
/* 80263D38-80263D7C 25E678 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_CpsAttrP4cXyz */
bool cCcD_CpsAttr::CrossAtTg(const cCcD_CpsAttr& other, cXyz* pxyz) const {
if (cM3dGCps::Cross(&other, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263D7C-80263DC0 25E6BC 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_CylAttrP4cXyz */
bool cCcD_CpsAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const {
if (cM3dGCps::Cross(&cylAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263DC0-80263E04 25E700 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_SphAttrP4cXyz */
bool cCcD_CpsAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
if (cM3dGCps::Cross(&sphAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263E04-80263ED4 25E744 00D0+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CpsAttrCFRC12cCcD_TriAttrP4cXyz */
bool cCcD_CpsAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
if (triAttr.cM3dGTri::Cross(*this, pxyz)) {
return true;
} else {
return false;
}
}
/* 80263ED4-80263F24 25E814 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_CpsAttrPf
*/
bool cCcD_CpsAttr::CrossCo(const cCcD_CpsAttr& other, f32* param_1) const {
*param_1 = 0.0f;
cXyz xyz;
if (cM3dGCps::Cross(&other, &xyz)) {
return true;
} else {
return false;
}
}
/* 80263F24-80263F74 25E864 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_CylAttrPf
*/
bool cCcD_CpsAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* param_1) const {
*param_1 = 0.0f;
cXyz xyz;
if (cM3dGCps::Cross(&cylAttr, &xyz)) {
return true;
} else {
return false;
}
}
/* 80263F74-80263FC4 25E8B4 0050+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CpsAttrCFRC12cCcD_SphAttrPf
*/
bool cCcD_CpsAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* param_1) const {
*param_1 = 0.0f;
cXyz xyz;
if (cM3dGCps::Cross(&sphAttr, &xyz)) {
return true;
} else {
return false;
}
}
/* 80263FC4-80264014 25E904 0050+00 1/0 2/1 0/0 .text CalcAabBox__12cCcD_CpsAttrFv */
void cCcD_CpsAttr::CalcAabBox() {
mAab.ClearForMinMax();
mAab.SetMinMax(mStart);
mAab.SetMinMax(mEnd);
mAab.PlusR(mRadius);
}
/* 80264014-8026417C 25E954 0168+00 1/0 1/0 0/0 .text GetNVec__12cCcD_CpsAttrCFRC4cXyzP4cXyz */
bool cCcD_CpsAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
Vec diff;
const cXyz& endP = GetEndP();
VECSubtract(&endP, &mStart, &diff);
f32 diffLen = VECDotProduct(&diff, &diff);
if (cM3d_IsZero(diffLen)) {
return false;
} else {
Vec vec1, vec2;
VECSubtract(&param_0, &mStart, &vec1);
f32 vec1Len = VECDotProduct(&vec1, &diff) / diffLen;
if (vec1Len < 0.0f) {
vec2 = mStart;
} else {
if (vec1Len > 1.0f) {
vec2 = endP;
} else {
VECScale(&diff, &diff, vec1Len);
VECAdd(&diff, &mStart, &vec2);
}
}
VECSubtract(&param_0, &vec2, param_1);
if (cM3d_IsZero(VECMag(param_1))) {
param_1->set(0.0f, 0.0f, 0.0f);
return false;
} else {
VECNormalize(param_1, param_1);
return true;
}
}
}
/* 8026417C-802641C8 25EABC 004C+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CylAttrCFRC12cCcD_CpsAttrP4cXyz */
bool cCcD_CylAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const {
if (cM3dGCyl::Cross(&cpsAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 802641C8-8026420C 25EB08 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CylAttrCFRC12cCcD_CylAttrP4cXyz */
bool cCcD_CylAttr::CrossAtTg(const cCcD_CylAttr& other, cXyz* pxyz) const {
if (cross(&other, pxyz)) {
return true;
} else {
return false;
}
}
/* 8026420C-80264250 25EB4C 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CylAttrCFRC12cCcD_SphAttrP4cXyz */
bool cCcD_CylAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
if (cross(&sphAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80264250-80264288 25EB90 0038+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_CylAttrCFRC12cCcD_TriAttrP4cXyz */
bool cCcD_CylAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
if (cM3dGCyl::Cross(triAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80264288-802642CC 25EBC8 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_CylAttrPf
*/
bool cCcD_CylAttr::CrossCo(const cCcD_CylAttr& other, f32* f) const {
if (cM3dGCyl::Cross(&other, f)) {
return true;
} else {
return false;
}
}
/* 802642CC-80264310 25EC0C 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_SphAttrPf
*/
bool cCcD_CylAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const {
if (cM3dGCyl::Cross(&sphAttr, f)) {
return true;
} else {
return false;
}
}
/* 80264310-80264368 25EC50 0058+00 1/0 1/0 0/0 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_CpsAttrPf
*/
bool cCcD_CylAttr::CrossCo(const cCcD_CpsAttr& cpsAttr, f32* f) const {
*f = 0.0f;
cXyz xyz;
if (cM3dGCyl::Cross(&cpsAttr, &xyz)) {
return true;
} else {
return false;
}
}
/* 80264368-802643D0 25ECA8 0068+00 1/0 1/0 0/0 .text CalcAabBox__12cCcD_CylAttrFv */
void cCcD_CylAttr::CalcAabBox() {
cXyz min;
cXyz max;
min.x = GetCP()->x - GetR();
min.y = GetCP()->y;
min.z = GetCP()->z - GetR();
max.x = GetCP()->x + GetR();
max.y = GetCP()->y + GetH();
max.z = GetCP()->z + GetR();
mAab.Set(&min, &max);
}
/* 802643D0-802644B8 25ED10 00E8+00 1/0 1/0 0/0 .text GetNVec__12cCcD_CylAttrCFRC4cXyzP4cXyz */
bool cCcD_CylAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
Vec vec;
if (GetCP()->y > param_0.y) {
vec = mCenter;
} else {
if (GetCP()->y + GetH() < param_0.y) {
vec.x = GetCP()->x;
vec.y = GetCP()->y;
vec.z = GetCP()->z;
vec.y = GetCP()->y + GetH();
} else {
vec = mCenter;
vec.y = param_0.y;
}
}
VECSubtract(&param_0, &vec, param_1);
if (cM3d_IsZero(VECMag(param_1))) {
param_1->set(0.0f, 0.0f, 0.0f);
return false;
} else {
VECNormalize(param_1, param_1);
return true;
}
return false;
}
/* 802644B8-802644EC 25EDF8 0034+00 1/0 1/0 0/0 .text
* getShapeAccess__12cCcD_CylAttrCFPQ214cCcD_ShapeAttr5Shape */
void cCcD_CylAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 1;
pshape->_4 = mCenter.x;
pshape->_8 = mCenter.y;
pshape->_C = mCenter.z;
pshape->_10 = mRadius;
pshape->_14 = mHeight;
}
inline bool inlineCross(const cM3dGSph& sph, const cM3dGCps* pcps, cXyz* pxyz) {
return cM3d_Cross_CpsSph(*pcps, sph, pxyz);
}
/* 802644EC-80264538 25EE2C 004C+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_SphAttrCFRC12cCcD_CpsAttrP4cXyz */
bool cCcD_SphAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const {
if (inlineCross(*this, &cpsAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 80264538-8026457C 25EE78 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_SphAttrCFRC12cCcD_CylAttrP4cXyz */
bool cCcD_SphAttr::CrossAtTg(const cCcD_CylAttr& cylAttr, cXyz* pxyz) const {
if (cross(&cylAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 8026457C-802645C0 25EEBC 0044+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_SphAttrCFRC12cCcD_SphAttrP4cXyz */
bool cCcD_SphAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
if (cross(&sphAttr, pxyz)) {
return true;
} else {
return false;
}
}
/* 802645C0-802645F8 25EF00 0038+00 1/0 1/0 0/0 .text
* CrossAtTg__12cCcD_SphAttrCFRC12cCcD_TriAttrP4cXyz */
bool cCcD_SphAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
if (triAttr.cM3dGTri::Cross(*this, pxyz)) {
return true;
} else {
return false;
}
}
/* 802645F8-80264644 25EF38 004C+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_CylAttrPf
*/
bool cCcD_SphAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* f) const {
if (cM3dGSph::Cross(&cylAttr, f)) {
return true;
} else {
return false;
}
}
/* 80264644-80264688 25EF84 0044+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_SphAttrPf
*/
bool cCcD_SphAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const {
if (cM3dGSph::Cross(&sphAttr, f)) {
return true;
} else {
return false;
}
}
/* 80264688-802646E0 25EFC8 0058+00 1/0 1/0 0/0 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_CpsAttrPf
*/
bool cCcD_SphAttr::CrossCo(const cCcD_CpsAttr& cpsAttr, f32* f) const {
*f = 0.0f;
cXyz xyz;
if (cM3dGSph::Cross(&cpsAttr, &xyz)) {
return true;
} else {
return false;
}
}
/* 802646E0-8026476C 25F020 008C+00 1/0 2/1 0/0 .text CalcAabBox__12cCcD_SphAttrFv */
void cCcD_SphAttr::CalcAabBox() {
cXyz min;
cXyz max;
min = max = *GetCP();
min.x -= GetR();
min.y -= GetR();
min.z -= GetR();
max.x += GetR();
max.y += GetR();
max.z += GetR();
mAab.Set(&min, &max);
}
/* 8026476C-80264808 25F0AC 009C+00 1/0 1/0 0/0 .text GetNVec__12cCcD_SphAttrCFRC4cXyzP4cXyz */
bool cCcD_SphAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
param_1->x = param_0.x - mCenter.x;
param_1->y = param_0.y - mCenter.y;
param_1->z = param_0.z - mCenter.z;
if (cM3d_IsZero(VECMag(param_1))) {
param_1->x = 0.0f;
param_1->y = 0.0f;
param_1->z = 0.0f;
return false;
} else {
VECNormalize(param_1, param_1);
return true;
}
}
/* 80264808-8026483C 25F148 0034+00 1/0 1/0 0/0 .text
* getShapeAccess__12cCcD_SphAttrCFPQ214cCcD_ShapeAttr5Shape */
void cCcD_SphAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 0;
pshape->_4 = mCenter.x;
pshape->_8 = mCenter.y;
pshape->_C = mCenter.z;
pshape->_10 = mRadius;
pshape->_14 = 0.0f;
}
/* 8026483C-8026484C 25F17C 0010+00 0/0 1/1 0/0 .text SetHit__10cCcD_ObjAtFP8cCcD_Obj */
void cCcD_ObjAt::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
}
/* 8026484C-80264868 25F18C 001C+00 1/1 0/0 0/0 .text Set__10cCcD_ObjAtFRC13cCcD_SrcObjAt
*/
void cCcD_ObjAt::Set(const cCcD_SrcObjAt& src) {
cCcD_ObjCommonBase::Set(src.mBase);
mType = src.mType;
mAtp = src.mAtp;
}
/* 80264868-80264880 25F1A8 0018+00 0/0 2/2 0/0 .text ClrHit__10cCcD_ObjAtFv */
void cCcD_ObjAt::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
}
/* 80264880-80264894 25F1C0 0014+00 1/1 0/0 0/0 .text Set__10cCcD_ObjTgFRC13cCcD_SrcObjTg
*/
void cCcD_ObjTg::Set(const cCcD_SrcObjTg& src) {
cCcD_ObjCommonBase::Set(src.mBase);
mType = src.mType;
}
/* 80264894-802648B0 25F1D4 001C+00 0/0 0/0 2/2 .text SetGrp__10cCcD_ObjTgFUl */
void cCcD_ObjTg::SetGrp(u32 grp) {
mSPrm &= ~0x1E;
mSPrm |= grp;
}
/* 802648B0-802648C8 25F1F0 0018+00 0/0 2/2 0/0 .text ClrHit__10cCcD_ObjTgFv */
void cCcD_ObjTg::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
}
/* 802648C8-802648D8 25F208 0010+00 0/0 1/1 0/0 .text SetHit__10cCcD_ObjTgFP8cCcD_Obj */
void cCcD_ObjTg::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
}
/* 802648D8-802648E8 25F218 0010+00 0/0 1/1 0/0 .text SetHit__10cCcD_ObjCoFP8cCcD_Obj */
void cCcD_ObjCo::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
}
/* 802648E8-80264900 25F228 0018+00 0/0 2/2 0/0 .text ClrHit__10cCcD_ObjCoFv */
void cCcD_ObjCo::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
}
/* 80264900-8026491C 25F240 001C+00 0/0 1/1 1/1 .text SetIGrp__10cCcD_ObjCoFUl */
void cCcD_ObjCo::SetIGrp(u32 grp) {
mSPrm &= ~0xE;
mSPrm |= grp;
}
/* 8026491C-80264938 25F25C 001C+00 0/0 1/1 7/7 .text SetVsGrp__10cCcD_ObjCoFUl */
void cCcD_ObjCo::SetVsGrp(u32 grp) {
mSPrm &= ~0x70;
mSPrm |= grp;
}
+556
View File
@@ -0,0 +1,556 @@
/**
* c_cc_s.cpp
*
*/
#include "SSystem/SComponent/c_cc_s.h"
#include "JSystem/JUtility/JUTAssert.h"
#define CHECK_FLOAT_CLASS(line, x) \
JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
__fpclassifyd((double)(x))) == 1));
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
/* 80264A6C-80264A94 25F3AC 0028+00 0/0 1/1 0/0 .text __ct__4cCcSFv */
cCcS::cCcS() {}
/* 80264A94-80264B60 25F3D4 00CC+00 1/1 1/1 0/0 .text Ct__4cCcSFv */
void cCcS::Ct() {
for (cCcD_Obj** obj = mpObjAt; obj < mpObjAt + ARRAY_SIZE(mpObjAt); ++obj) {
*obj = NULL;
}
mObjAtCount = 0;
for (cCcD_Obj** obj = mpObjTg; obj < mpObjTg + ARRAY_SIZE(mpObjTg); ++obj) {
*obj = NULL;
}
mObjTgCount = 0;
for (cCcD_Obj** obj = mpObjCo; obj < mpObjCo + ARRAY_SIZE(mpObjCo); ++obj) {
*obj = NULL;
}
mObjCoCount = 0;
for (cCcD_Obj** obj = mpObj; obj < mpObj + ARRAY_SIZE(mpObj); ++obj) {
*obj = NULL;
}
mObjCount = 0;
}
/* 80264B60-80264B80 25F4A0 0020+00 0/0 1/1 0/0 .text Dt__4cCcSFv */
void cCcS::Dt() {
Ct();
}
/* 80264B80-80264BA8 25F4C0 0028+00 1/1 0/0 0/0 .text GetWt__4cCcSCFUc */
WeightType cCcS::GetWt(u8 param_0) const {
if (param_0 == 0xFF) {
return WeightType_0;
}
if (param_0 == 0xFE) {
return WeightType_1;
}
return WeightType_2;
}
/* 80264BA8-80264C5C 25F4E8 00B4+00 0/0 7/7 454/454 .text Set__4cCcSFP8cCcD_Obj */
void cCcS::Set(cCcD_Obj* obj) {
if (obj->ChkAtSet()) {
if (mObjAtCount >= ARRAY_SIZE(mpObjAt)) {
OS_REPORT("\x1b[43;30m");
OS_REPORT("cCcS::Set AT Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjAt));
OS_REPORT("\x1b[m");
} else {
mpObjAt[mObjAtCount] = obj;
mObjAtCount++;
}
}
if (obj->ChkTgSet()) {
if (mObjTgCount >= ARRAY_SIZE(mpObjTg)) {
OS_REPORT("\x1b[43;30m");
OS_REPORT("cCcS::Set TG Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjTg));
OS_REPORT("\x1b[m");
} else {
mpObjTg[mObjTgCount] = obj;
mObjTgCount++;
}
}
if (obj->ChkCoSet()) {
if (mObjCoCount >= ARRAY_SIZE(mpObjCo)) {
OS_REPORT("\x1b[43;30m");
OS_REPORT("cCcS::Set CO Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObjCo));
OS_REPORT("\x1b[m");
} else {
mpObjCo[mObjCoCount] = obj;
mObjCoCount++;
}
}
if (mObjCount >= ARRAY_SIZE(mpObj)) {
OS_REPORT("\x1b[43;30m");
OS_REPORT("cCcS::Set SET Overflow.Now Max is %d.\n", ARRAY_SIZE(mpObj));
OS_REPORT("\x1b[m");
} else {
mpObj[mObjCount] = obj;
mObjCount++;
}
}
/* 80264C5C-80264CF0 25F59C 0094+00 1/1 0/0 0/0 .text ClrCoHitInf__4cCcSFv */
void cCcS::ClrCoHitInf() {
for (cCcD_Obj** obj = mpObjCo; obj < mpObjCo + mObjCoCount; ++obj) {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrCoHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrCcMove();
}
}
}
}
/* 80264CF0-80264D90 25F630 00A0+00 1/1 0/0 0/0 .text ClrTgHitInf__4cCcSFv */
void cCcS::ClrTgHitInf() {
for (cCcD_Obj** obj = mpObjTg; obj < mpObjTg + mObjTgCount; ++obj) {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrTgHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrTg();
}
}
}
}
/* 80264D90-80264E2C 25F6D0 009C+00 1/1 0/0 0/0 .text ClrAtHitInf__4cCcSFv */
void cCcS::ClrAtHitInf() {
for (cCcD_Obj** obj = mpObjAt; obj < mpObjAt + mObjAtCount; ++obj) {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrAtHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrAt();
}
}
}
}
/* 80264E2C-80264F40 25F76C 0114+00 1/1 0/0 0/0 .text ChkNoHitAtTg__4cCcSFP8cCcD_ObjP8cCcD_Obj */
bool cCcS::ChkNoHitAtTg(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj) {
fopAc_ac_c* pat_ac = pat_obj->GetAc();
fopAc_ac_c* ptg_ac = ptg_obj->GetAc();
if ((pat_ac != NULL && ptg_ac != NULL && pat_ac == ptg_ac) ||
(pat_obj->GetAtGrp() & ptg_obj->GetTgGrp()) == 0 ||
(pat_obj->GetAtType() & ptg_obj->GetTgType()) == 0)
{
return true;
} else {
return ChkNoHitGAtTg(pat_obj->GetGObjInf(), ptg_obj->GetGObjInf(),
pat_obj->GetStts()->GetGStts(), ptg_obj->GetStts()->GetGStts());
}
}
/* 80264F40-8026515C 25F880 021C+00 1/1 0/0 0/0 .text ChkAtTg__4cCcSFv */
void cCcS::ChkAtTg() {
cCcD_Obj** objTgEnd = mpObjTg + mObjTgCount;
ClrAtHitInf();
ClrTgHitInf();
for (cCcD_Obj** pat_obj = mpObjAt; pat_obj < mpObjAt + mObjAtCount; ++pat_obj) {
if (*pat_obj == NULL || !(*pat_obj)->ChkAtSet())
continue;
cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr();
JUT_ASSERT(pat_sa != 0);
for (cCcD_Obj** ptg_obj = mpObjTg; ptg_obj < objTgEnd; ++ptg_obj) {
if (*ptg_obj == NULL || !(*ptg_obj)->ChkTgSet())
continue;
if (!(*pat_obj)->GetDivideInfo().Chk((*ptg_obj)->GetDivideInfo()))
continue;
if (ChkNoHitAtTg(*pat_obj, *ptg_obj))
continue;
cCcD_ShapeAttr* ptg_sa = (*ptg_obj)->GetShapeAttr();
JUT_ASSERT(ptg_sa != 0);
static cXyz cross;
bool didCross = pat_sa->CrossAtTg(*ptg_sa, &cross);
bool anyBsRevHit = (*pat_obj)->ChkBsRevHit() || (*ptg_obj)->ChkBsRevHit();
if (!anyBsRevHit && didCross) {
SetAtTgCommonHitInf(*pat_obj, *ptg_obj, &cross);
} else if (anyBsRevHit && !didCross) {
cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr();
if (pat_sa == NULL) {
cross.set(0.0f, 0.0f, 0.0f);
} else {
pat_sa->GetWorkAab().CalcCenter(&cross);
}
SetAtTgCommonHitInf(*pat_obj, *ptg_obj, &cross);
}
}
}
}
/* 8026515C-80265230 25FA9C 00D4+00 1/1 0/0 0/0 .text ChkNoHitCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */
bool cCcS::ChkNoHitCo(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) {
fopAc_ac_c* ac1 = pco1_obj->GetAc();
fopAc_ac_c* ac2 = pco2_obj->GetAc();
if (!(((ac1 == NULL || ac2 == NULL) || ac1 != ac2 || pco1_obj->ChkCoSameActorHit() ||
pco2_obj->ChkCoSameActorHit()) &&
(pco1_obj->GetCoIGrp() & (pco2_obj->GetCoVsGrp() >> 3)) &&
((pco1_obj->GetCoVsGrp() >> 3) & pco2_obj->GetCoIGrp() &&
!ChkNoHitGCo(pco1_obj, pco2_obj))))
{
return true;
} else {
return false;
}
}
/* 80265230-802653A0 25FB70 0170+00 1/1 0/0 0/0 .text ChkCo__4cCcSFv */
void cCcS::ChkCo() {
ClrCoHitInf();
if (mObjCoCount <= 1)
return;
cCcD_Obj** objCoEnd = mpObjCo + mObjCoCount;
for (cCcD_Obj** pco1_obj = mpObjCo; pco1_obj < objCoEnd - 1; ++pco1_obj) {
if (*pco1_obj == NULL || !(*pco1_obj)->ChkCoSet())
continue;
cCcD_ShapeAttr* pco1_sa = (*pco1_obj)->GetShapeAttr();
JUT_ASSERT(pco1_sa != 0);
for (cCcD_Obj** pco2_obj = pco1_obj + 1; pco2_obj < objCoEnd; ++pco2_obj) {
if (*pco2_obj == NULL || !(*pco2_obj)->ChkCoSet())
continue;
if (!(*pco1_obj)->GetDivideInfo().Chk((*pco2_obj)->GetDivideInfo()))
continue;
if (ChkNoHitCo(*pco1_obj, *pco2_obj))
continue;
cCcD_ShapeAttr* pco2_sa = (*pco2_obj)->GetShapeAttr();
JUT_ASSERT(pco2_sa != 0);
f32 cross_len;
if (pco1_sa->CrossCo(*pco2_sa, &cross_len)) {
cXyz& co2_center = pco2_sa->GetCoCP();
cXyz& co1_center = pco1_sa->GetCoCP();
SetCoCommonHitInf(*pco1_obj, &co1_center, *pco2_obj, &co2_center, cross_len);
}
}
}
}
/* 802653A0-802653C8 25FCE0 0028+00 1/0 0/0 0/0 .text
* CalcTgPlusDmg__4cCcSFP8cCcD_ObjP8cCcD_ObjP9cCcD_SttsP9cCcD_Stts */
void cCcS::CalcTgPlusDmg(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cCcD_Stts* pat_stts,
cCcD_Stts* ptg_stts) {
ptg_stts->PlusDmg(pat_obj->GetAtAtp());
}
/* 802653C8-802655E4 25FD08 021C+00 1/1 0/0 0/0 .text
* SetAtTgCommonHitInf__4cCcSFP8cCcD_ObjP8cCcD_ObjP4cXyz */
void cCcS::SetAtTgCommonHitInf(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cXyz* pcross) {
cCcD_Stts* pat_stts = pat_obj->GetStts();
cCcD_Stts* ptg_stts = ptg_obj->GetStts();
if (!ChkAtTgHitAfterCross(!ptg_obj->ChkTgNoAtHitInfSet(), !pat_obj->ChkAtNoTgHitInfSet(),
pat_obj->GetGObjInf(), ptg_obj->GetGObjInf(), pat_stts, ptg_stts,
pat_stts->GetGStts(), ptg_stts->GetGStts()))
{
if (!ptg_obj->ChkTgNoAtHitInfSet()) {
pat_obj->SetAtHit(ptg_obj);
}
bool tmp = !(pat_obj->ChkAtNoTgHitInfSet() ||
(pat_obj->ChkAtType(AT_TYPE_SLINGSHOT) && ptg_obj->ChkTgNoSlingHitInfSet()));
if (tmp) {
ptg_obj->SetTgHit(pat_obj);
CalcTgPlusDmg(pat_obj, ptg_obj, pat_stts, ptg_stts);
}
SetAtTgGObjInf(!ptg_obj->ChkTgNoAtHitInfSet(), tmp, pat_obj, ptg_obj, pat_obj->GetGObjInf(),
ptg_obj->GetGObjInf(), pat_stts, ptg_stts, pat_stts->GetGStts(),
ptg_stts->GetGStts(), pcross);
}
}
/* 802655E4-80265750 25FF24 016C+00 1/1 0/0 0/0 .text
* SetCoCommonHitInf__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */
void cCcS::SetCoCommonHitInf(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cXyz* ppos2,
f32 cross_len) {
bool co2_inf_set = !pco2_obj->ChkCoNoCoHitInfSet();
bool co1_inf_set = !pco1_obj->ChkCoNoCoHitInfSet();
if (co2_inf_set) {
pco1_obj->SetCoHit(pco2_obj);
}
if (co1_inf_set) {
pco2_obj->SetCoHit(pco1_obj);
}
if (co2_inf_set && co1_inf_set) {
SetPosCorrect(pco1_obj, ppos1, pco2_obj, ppos2, cross_len);
}
cCcD_Stts* pco1_stts = pco1_obj->GetStts();
cCcD_Stts* pco2_stts = pco2_obj->GetStts();
SetCoGObjInf(co2_inf_set, co1_inf_set, pco1_obj->GetGObjInf(), pco2_obj->GetGObjInf(),
pco1_stts, pco2_stts, pco1_stts->GetGStts(), pco2_stts->GetGStts());
}
/* 80265750-80265BB4 260090 0464+00 1/0 0/0 0/0 .text
* SetPosCorrect__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */
void cCcS::SetPosCorrect(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cXyz* ppos2,
f32 cross_len) {
CHECK_FLOAT_CLASS(616, cross_len);
CHECK_FLOAT_RANGE(617, cross_len);
if (pco1_obj->ChkCoNoCrr() || pco2_obj->ChkCoNoCrr())
return;
if (pco1_obj->GetStts() == NULL || pco2_obj->GetStts() == NULL)
return;
if (pco1_obj->GetStts()->GetAc() != NULL &&
pco1_obj->GetStts()->GetAc() == pco2_obj->GetStts()->GetAc())
return;
if (!(fabsf(cross_len) < (1.0f / 125.0f))) {
SetCoGCorrectProc(pco1_obj, pco2_obj);
bool bothCoSph3DCrr = pco1_obj->ChkCoSph3DCrr() && pco2_obj->ChkCoSph3DCrr();
WeightType obj1WeightType = GetWt(pco1_obj->GetStts()->GetWeightUc());
WeightType obj2WeightType = GetWt(pco2_obj->GetStts()->GetWeightUc());
f32 obj1SrcWeight = pco1_obj->GetStts()->GetWeightF();
f32 obj2SrcWeight = pco2_obj->GetStts()->GetWeightF();
f32 combinedWeight = obj1SrcWeight + obj2SrcWeight;
f32 obj2Weight, obj1Weight;
if (cM3d_IsZero(combinedWeight)) {
obj1SrcWeight = 1;
obj2SrcWeight = 1;
combinedWeight = 2;
}
f32 invCombinedWeight = 1 / combinedWeight;
if (obj1WeightType == WeightType_0) {
if (obj2WeightType == WeightType_0) {
return;
} else {
obj2Weight = 0;
obj1Weight = 1;
}
} else if (obj1WeightType == WeightType_1) {
if (obj2WeightType == WeightType_0) {
obj2Weight = 1;
obj1Weight = 0;
} else if (obj2WeightType == WeightType_1) {
obj2Weight = 0.5;
obj1Weight = 0.5;
} else {
obj2Weight = 0;
obj1Weight = 1;
}
} else {
if (obj2WeightType == WeightType_2) {
obj2Weight = obj2SrcWeight * invCombinedWeight;
obj1Weight = obj1SrcWeight * invCombinedWeight;
} else {
obj2Weight = 1;
obj1Weight = 0;
}
}
f32 objDistLen;
Vec vec1;
Vec vec2;
Vec objsDist;
if (bothCoSph3DCrr) {
VECSubtract(ppos2, ppos1, &objsDist);
objDistLen = VECMag(&objsDist);
} else {
objsDist.x = ppos2->x - ppos1->x;
objsDist.y = 0;
objsDist.z = ppos2->z - ppos1->z;
objDistLen = sqrtf(objsDist.x * objsDist.x + objsDist.z * objsDist.z);
}
if (!cM3d_IsZero(objDistLen)) {
if (bothCoSph3DCrr) {
VECScale(&objsDist, &objsDist, cross_len / objDistLen);
obj2Weight *= -1;
VECScale(&objsDist, &vec1, obj2Weight);
VECScale(&objsDist, &vec2, obj1Weight);
} else {
f32 pushFactor = cross_len / objDistLen;
objsDist.x *= pushFactor;
objsDist.z *= pushFactor;
vec1.x = -objsDist.x * obj2Weight;
vec1.y = 0;
vec1.z = -objsDist.z * obj2Weight;
vec2.x = objsDist.x * obj1Weight;
vec2.y = 0;
vec2.z = objsDist.z * obj1Weight;
}
} else {
vec1.y = 0;
vec1.z = 0;
vec2.y = 0;
vec2.z = 0;
if (!cM3d_IsZero(cross_len)) {
vec1.x = -cross_len * obj2Weight;
vec2.x = cross_len * obj1Weight;
} else {
vec1.x = -obj2Weight;
vec2.x = obj1Weight;
}
}
CHECK_FLOAT_CLASS(767, vec1.x);
CHECK_FLOAT_CLASS(768, vec1.y);
CHECK_FLOAT_CLASS(769, vec1.z);
CHECK_FLOAT_CLASS(771, vec2.x);
CHECK_FLOAT_CLASS(772, vec2.y);
CHECK_FLOAT_CLASS(773, vec2.z);
CHECK_FLOAT_RANGE(775, vec1.x);
CHECK_FLOAT_RANGE(776, vec1.y);
CHECK_FLOAT_RANGE(777, vec1.z);
CHECK_FLOAT_RANGE(779, vec2.x);
CHECK_FLOAT_RANGE(780, vec2.y);
CHECK_FLOAT_RANGE(781, vec2.z);
pco1_obj->GetStts()->PlusCcMove(vec1.x, vec1.y, vec1.z);
pco2_obj->GetStts()->PlusCcMove(vec2.x, vec2.y, vec2.z);
(*ppos1) += vec1;
(*ppos2) += vec2;
CHECK_FLOAT_CLASS(790, ppos1->x);
CHECK_FLOAT_CLASS(791, ppos1->y);
CHECK_FLOAT_CLASS(792, ppos1->z);
CHECK_FLOAT_CLASS(794, ppos2->x);
CHECK_FLOAT_CLASS(795, ppos2->y);
CHECK_FLOAT_CLASS(796, ppos2->z);
CHECK_FLOAT_RANGE(798, ppos1->x);
CHECK_FLOAT_RANGE(799, ppos1->y);
CHECK_FLOAT_RANGE(800, ppos1->z);
CHECK_FLOAT_RANGE(802, ppos2->x);
CHECK_FLOAT_RANGE(803, ppos2->y);
CHECK_FLOAT_RANGE(804, ppos2->z);
}
}
/* 80265BB4-80265CCC 2604F4 0118+00 1/1 0/0 0/0 .text CalcArea__4cCcSFv */
void cCcS::CalcArea() {
cM3dGAab aab;
aab.ClearForMinMax();
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
if (*pset_obj != NULL) {
cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
JUT_ASSERT(pset_sa != 0);
pset_sa->CalcAabBox();
aab.SetMinMax(pset_sa->GetWorkAab());
}
}
mDivideArea.SetArea(aab);
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
if (*pset_obj != NULL) {
const cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
JUT_ASSERT(pset_sa != 0);
cCcD_DivideInfo* divideInfo = &(*pset_obj)->GetDivideInfo();
mDivideArea.CalcDivideInfo(divideInfo, pset_sa->GetWorkAab(),
(*pset_obj)->ChkBsRevHit());
}
}
}
/* 80265CCC-80265D30 26060C 0064+00 0/0 1/1 0/0 .text Move__4cCcSFv */
void cCcS::Move() {
CalcArea();
ChkAtTg();
ChkCo();
MoveAfterCheck();
mObjAtCount = 0;
mObjTgCount = 0;
mObjCoCount = 0;
mObjCount = 0;
}
/* 80265D30-80265DF4 260670 00C4+00 0/0 1/1 0/0 .text DrawClear__4cCcSFv */
void cCcS::DrawClear() {
for (cCcD_Obj** obj = mpObjAt; obj < mpObjAt + mObjAtCount; ++obj) {
*obj = NULL;
}
mObjAtCount = 0;
for (cCcD_Obj** obj = mpObjTg; obj < mpObjTg + mObjTgCount; ++obj) {
*obj = NULL;
}
mObjTgCount = 0;
for (cCcD_Obj** obj = mpObjCo; obj < mpObjCo + mObjCoCount; ++obj) {
*obj = NULL;
}
mObjCoCount = 0;
for (cCcD_Obj** obj = mpObj; obj < mpObj + mObjCount; ++obj) {
*obj = NULL;
}
mObjCount = 0;
}
/* 80265DF4-80265DF8 260734 0004+00 1/0 1/0 0/0 .text
* SetCoGCorrectProc__4cCcSFP8cCcD_ObjP8cCcD_Obj */
void cCcS::SetCoGCorrectProc(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) {}
/* 80265DF8-80265DFC 260738 0004+00 1/0 0/0 0/0 .text
* SetCoGObjInf__4cCcSFbbP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts
*/
void cCcS::SetCoGObjInf(bool co2_set, bool co1_set, cCcD_GObjInf* pco1_gobj,
cCcD_GObjInf* pco2_gobj, cCcD_Stts* pco1_stts, cCcD_Stts* pco2_stts,
cCcD_GStts* pco1_gstts, cCcD_GStts* pco2_gstts) {}
/* 80265DFC-80265E00 26073C 0004+00 1/0 0/0 0/0 .text
* SetAtTgGObjInf__4cCcSFbbP8cCcD_ObjP8cCcD_ObjP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GSttsP4cXyz
*/
void cCcS::SetAtTgGObjInf(bool param_0, bool param_1, cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj,
cCcD_GObjInf* pat_gobj, cCcD_GObjInf* ptg_gobj, cCcD_Stts* pat_stts,
cCcD_Stts* ptg_stts, cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts,
cXyz* pcross) {}
/* 80265E00-80265E08 260740 0008+00 1/0 0/0 0/0 .text
* ChkNoHitGAtTg__4cCcSFPC12cCcD_GObjInfPC12cCcD_GObjInfP10cCcD_GSttsP10cCcD_GStts */
bool cCcS::ChkNoHitGAtTg(const cCcD_GObjInf* pat_gobj, const cCcD_GObjInf* ptg_gobj,
cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts) {
return false;
}
/* 80265E08-80265E10 260748 0008+00 1/0 0/0 0/0 .text
* ChkAtTgHitAfterCross__4cCcSFbbPC12cCcD_GObjInfPC12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts
*/
bool cCcS::ChkAtTgHitAfterCross(bool param_0, bool param_1, const cCcD_GObjInf* pat_gobj,
const cCcD_GObjInf* ptg_gobj, cCcD_Stts* pat_stts, cCcD_Stts* ptg_stts,
cCcD_GStts* pat_gstts, cCcD_GStts* ptg_gstts) {
return false;
}
/* 80265E10-80265E18 260750 0008+00 1/0 0/0 0/0 .text ChkNoHitGCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */
bool cCcS::ChkNoHitGCo(cCcD_Obj* pco1_obj, cCcD_Obj* pco2_obj) {
return false;
}
/* 80265E18-80265E1C 260758 0004+00 1/0 0/0 0/0 .text MoveAfterCheck__4cCcSFv */
void cCcS::MoveAfterCheck() {}
+21
View File
@@ -0,0 +1,21 @@
/**
* c_counter.cpp
*
*/
#include "SSystem/SComponent/c_counter.h"
/* ############################################################################################## */
/* 80430CD8-80430CE8 000C+04 s=1 e=12 z=22 None .bss g_Counter */
counter_class g_Counter;
/* 80265E1C-80265E64 0048+00 s=0 e=1 z=0 None .text cCt_Counter__Fi */
void cCt_Counter(int resetCounter1) {
if (resetCounter1 == 1) {
g_Counter.mCounter1 = 0;
} else {
g_Counter.mCounter1++;
}
g_Counter.mCounter0++;
}
+395
View File
@@ -0,0 +1,395 @@
/**
* c_lib.cpp
*
*/
#include "SSystem/SComponent/c_lib.h"
#include "string.h"
#include "SSystem/SComponent/c_math.h"
/* 8026F93C-8026F95C 26A27C 0020+00 0/0 3/3 0/0 .text cLib_memCpy__FPvPCvUl */
void cLib_memCpy(void* dst, const void* src, unsigned long size) {
memcpy(dst, src, size);
}
/* 8026F95C-8026F97C 26A29C 0020+00 0/0 4/4 0/0 .text cLib_memSet__FPviUl */
void cLib_memSet(void* dst, int value, unsigned long size) {
memset(dst, value, size);
}
/* 8026F97C-8026FA3C 26A2BC 00C0+00 0/0 50/50 178/178 .text cLib_addCalc__FPfffff */
f32 cLib_addCalc(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) {
if (*pValue != target) {
f32 step = scale * (target - *pValue);
if (step >= minStep || step <= -minStep) {
if (step > maxStep) {
step = maxStep;
}
if (step < -maxStep) {
step = -maxStep;
}
*pValue += step;
} else {
if (step > 0) {
if (step < minStep) {
*pValue += minStep;
if (*pValue > target) {
*pValue = target;
}
}
} else {
minStep = -minStep;
if (step > minStep) {
*pValue += minStep;
if (*pValue < target) {
*pValue = target;
}
}
}
}
}
return fabsf(target - *pValue);
}
/* 8026FA3C-8026FA80 26A37C 0044+00 0/0 20/20 701/701 .text cLib_addCalc2__FPffff */
void cLib_addCalc2(f32* pValue, f32 target, f32 scale, f32 maxStep) {
if (*pValue != target) {
f32 step = scale * (target - *pValue);
if (step > maxStep) {
step = maxStep;
} else if (step < -maxStep) {
step = -maxStep;
}
*pValue += step;
}
}
/* 8026FA80-8026FAB8 26A3C0 0038+00 0/0 2/2 322/322 .text cLib_addCalc0__FPfff */
void cLib_addCalc0(f32* pValue, f32 scale, f32 maxStep) {
f32 step = *pValue * scale;
if (step > maxStep) {
step = maxStep;
} else if (step < -maxStep) {
step = -maxStep;
}
*pValue -= step;
}
/* 8026FAB8-8026FDF4 26A3F8 033C+00 0/0 3/3 78/78 .text cLib_addCalcPos__FP4cXyzRC4cXyzfff */
f32 cLib_addCalcPos(cXyz* pValue, cXyz const& target, f32 scale, f32 maxStep, f32 minStep) {
if (*pValue != target) {
cXyz diff = (*pValue - target);
f32 step = diff.abs();
if (step < minStep) {
*pValue = target;
} else {
step *= scale;
diff *= scale;
if (!cLib_IsZero(step)) {
if (step > maxStep) {
diff *= (maxStep / step);
} else if (step < minStep) {
diff *= (minStep / step);
}
*pValue -= diff;
} else {
*pValue = target;
}
}
}
return pValue->abs(target);
}
/* 8026FDF4-80270178 26A734 0384+00 0/0 1/1 4/4 .text cLib_addCalcPosXZ__FP4cXyzRC4cXyzfff */
f32 cLib_addCalcPosXZ(cXyz* pValue, cXyz const& target, f32 scale, f32 maxStep, f32 minStep) {
if (pValue->x != target.x || pValue->z != target.z) {
cXyz diff = (*pValue - target);
f32 step = diff.absXZ();
if (step < minStep) {
pValue->x = target.x;
pValue->z = target.z;
} else {
step *= scale;
diff *= scale;
if (!cLib_IsZero(step)) {
if (step > maxStep) {
diff *= (maxStep / step);
} else if (step < minStep) {
diff *= (minStep / step);
}
pValue->x -= diff.x;
pValue->z -= diff.z;
} else {
pValue->x = target.x;
pValue->z = target.z;
}
}
}
return (*pValue - target).absXZ();
}
/* 80270178-80270350 26AAB8 01D8+00 0/0 2/2 33/33 .text cLib_addCalcPos2__FP4cXyzRC4cXyzff */
void cLib_addCalcPos2(cXyz* pValue, cXyz const& target, f32 scale, f32 maxStep) {
if (*pValue != target) {
cXyz diff = (*pValue - target) * scale;
if (diff.abs() > maxStep) {
diff = diff.normZP();
diff *= maxStep;
}
*pValue -= diff;
}
}
/* 80270350-80270540 26AC90 01F0+00 0/0 0/0 4/4 .text cLib_addCalcPosXZ2__FP4cXyzRC4cXyzff */
void cLib_addCalcPosXZ2(cXyz* pValue, cXyz const& target, f32 scale, f32 maxStep) {
if (pValue->x != target.x || pValue->z != target.z) {
cXyz diff = (*pValue - target) * scale;
f32 step = diff.absXZ();
if (!cLib_IsZero(step)) {
if (step > maxStep) {
diff *= (maxStep / step);
}
pValue->x -= diff.x;
pValue->z -= diff.z;
}
}
}
/* 80270540-80270608 26AE80 00C8+00 0/0 81/81 244/244 .text cLib_addCalcAngleS__FPsssss
*/
s16 cLib_addCalcAngleS(s16* pValue, s16 target, s16 scale, s16 maxStep, s16 minStep) {
s16 diff = target - *pValue;
if (*pValue != target) {
s16 step = (diff) / scale;
if (step > minStep || step < -minStep) {
if (step > maxStep) {
step = maxStep;
}
if (step < -maxStep) {
step = -maxStep;
}
*pValue += step;
} else {
if (0 <= diff) {
*pValue += minStep;
diff = target - *pValue;
if (0 >= diff) {
*pValue = target;
}
} else {
*pValue -= minStep;
diff = target - *pValue;
if (0 <= diff) {
*pValue = target;
}
}
}
}
return target - *pValue;
}
/* 80270608-8027065C 26AF48 0054+00 0/0 2/2 849/849 .text cLib_addCalcAngleS2__FPssss */
void cLib_addCalcAngleS2(s16* pValue, s16 target, s16 scale, s16 maxStep) {
s16 diff = target - *pValue;
s16 step = diff / scale;
if (step > maxStep) {
*pValue += maxStep;
} else if (step < -maxStep) {
*pValue -= maxStep;
} else {
*pValue += step;
}
}
/* 8027065C-802706D0 26AF9C 0074+00 0/0 3/3 14/14 .text cLib_chaseUC__FPUcUcUc */
int cLib_chaseUC(u8* pValue, u8 target, u8 step) {
if (step) {
s16 wideValue = *pValue;
s16 wideTarget = target;
s16 wideStep;
if (wideValue > wideTarget) {
wideStep = -step;
} else {
wideStep = step;
}
wideValue += wideStep;
if (wideStep * (wideValue - wideTarget) >= 0) {
*pValue = target;
return 1;
} else {
*pValue = wideValue;
}
} else if (*pValue == target) {
return 1;
}
return 0;
}
/* 802706D0-80270740 26B010 0070+00 0/0 4/4 49/49 .text cLib_chaseS__FPsss */
int cLib_chaseS(s16* pValue, s16 target, s16 step) {
if (step) {
if (*pValue > target) {
step = -step;
}
*pValue += step;
if (step * (*pValue - target) >= 0) {
*pValue = target;
return 1;
}
} else if (*pValue == target) {
return 1;
}
return 0;
}
/* 80270740-802707AC 26B080 006C+00 0/0 70/70 448/448 .text cLib_chaseF__FPfff */
int cLib_chaseF(f32* pValue, f32 target, f32 step) {
if (step) {
if (*pValue > target) {
step = -step;
}
*pValue += step;
if (step * (*pValue - target) >= 0) {
*pValue = target;
return 1;
}
} else if (*pValue == target) {
return 1;
}
return 0;
}
/* 802707AC-80270990 26B0EC 01E4+00 0/0 3/3 60/60 .text cLib_chasePos__FP4cXyzRC4cXyzf */
int cLib_chasePos(cXyz* pValue, cXyz const& target, f32 step) {
if (step) {
cXyz diff = *pValue - target;
f32 diffF = diff.abs();
if (cLib_IsZero(diffF) || diffF <= step) {
*pValue = target;
return 1;
}
*pValue -= diff * (step / diffF);
} else if (*pValue == target) {
return 1;
}
return 0;
}
/* 80270990-80270B90 26B2D0 0200+00 0/0 1/0 19/19 .text cLib_chasePosXZ__FP4cXyzRC4cXyzf
*/
int cLib_chasePosXZ(cXyz* pValue, cXyz const& target, f32 step) {
cXyz diff = *pValue - target;
diff.y = 0;
f32 diffF = diff.absXZ();
if (step) {
if (cLib_IsZero(diffF) || diffF <= step) {
*pValue = target;
return 1;
}
*pValue -= diff * (step / diffF);
} else if (cLib_IsZero(diffF)) {
return 1;
}
return 0;
}
/* 80270B90-80270C04 26B4D0 0074+00 0/0 4/4 213/213 .text cLib_chaseAngleS__FPsss */
int cLib_chaseAngleS(s16* pValue, s16 target, s16 step) {
if (step) {
if ((s16)(*pValue - target) > 0) {
step = -step;
}
*pValue += step;
if (step * (s16)(*pValue - target) >= 0) {
*pValue = target;
return 1;
}
} else if (*pValue == target) {
return 1;
}
return 0;
}
/* 80270C04-80270C3C 26B544 0038+00 0/0 39/39 454/454 .text cLib_targetAngleY__FPC3VecPC3Vec */
s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs) {
return cM_atan2s(rhs->x - lhs->x, rhs->z - lhs->z);
}
/* 80270C3C-80270C74 26B57C 0038+00 0/0 0/0 7/7 .text cLib_targetAngleY__FRC3VecRC3Vec */
s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs) {
return cM_atan2s(rhs.x - lhs.x, rhs.z - lhs.z);
}
/* 80270C74-80270DC0 26B5B4 014C+00 0/0 2/2 109/109 .text cLib_targetAngleX__FPC4cXyzPC4cXyz */
s16 cLib_targetAngleX(cXyz const* param_0, cXyz const* param_1) {
cXyz diff = *param_1 - *param_0;
f32 f1 = sqrtf(diff.getMagXZ());
return cM_atan2s(diff.y, f1);
}
/* 80270DC0-80270E24 26B700 0064+00 0/0 2/2 118/118 .text cLib_offsetPos__FP4cXyzPC4cXyzsPC4cXyz
*/
void cLib_offsetPos(cXyz* pDest, cXyz const* pSrc, s16 angle, cXyz const* vec) {
f32 cos = cM_scos(angle);
f32 sin = cM_ssin(angle);
pDest->x = pSrc->x + (vec->x * cos + vec->z * sin);
pDest->y = pSrc->y + vec->y;
pDest->z = pSrc->z + (vec->z * cos - vec->x * sin);
}
/* 80270E24-80270E4C 26B764 0028+00 0/0 48/48 71/71 .text cLib_distanceAngleS__Fss */
s32 cLib_distanceAngleS(s16 x, s16 y) {
return abs(static_cast<s16>(x - y));
}
/* ############################################################################################## */
/* 80430DB8-80430F98 05DAD8 01E0+00 2/1 0/0 0/0 .bss mtx */
static Mtx mtx[10];
/* 80450768-80450770 -00001 0004+04 6/6 2/2 695/695 .sdata calc_mtx */
Mtx* calc_mtx = mtx;
/* 80270E4C-80270E5C 26B78C 0010+00 0/0 1/1 0/0 .text MtxInit__Fv */
void MtxInit() {
calc_mtx = mtx;
}
/* 80270E5C-80270EA4 26B79C 0048+00 0/0 0/0 43/43 .text MtxTrans__FfffUc */
void MtxTrans(f32 x_trans, f32 y_trans, f32 z_trans, u8 param_3) {
if (param_3 == 0) {
MTXTrans(*calc_mtx, x_trans, y_trans, z_trans);
} else {
Mtx mtx;
MTXTrans(mtx, x_trans, y_trans, z_trans);
MTXConcat(*calc_mtx, mtx, *calc_mtx);
}
}
/* 80270EA4-80270EEC 26B7E4 0048+00 0/0 0/0 46/46 .text MtxScale__FfffUc */
void MtxScale(f32 x_trans, f32 y_trans, f32 z_trans, u8 param_3) {
if (param_3 == 0) {
MTXScale(*calc_mtx, x_trans, y_trans, z_trans);
} else {
Mtx mtx;
MTXScale(mtx, x_trans, y_trans, z_trans);
MTXConcat(*calc_mtx, mtx, *calc_mtx);
}
}
/* 80270EEC-80270F1C 26B82C 0030+00 0/0 2/2 615/615 .text MtxPosition__FP4cXyzP4cXyz */
void MtxPosition(cXyz* src, cXyz* dest) {
MTXMultVec(*calc_mtx, src, dest);
}
/* 80270F1C-80270F58 26B85C 003C+00 0/0 0/0 20/20 .text MtxPush__Fv */
void MtxPush() {
Mtx mtx;
MTXCopy(*calc_mtx, mtx);
calc_mtx++;
MTXCopy(mtx, *calc_mtx);
}
/* 80270F58-80270F68 26B898 0010+00 0/0 0/0 20/20 .text MtxPull__Fv */
Mtx* MtxPull() {
return calc_mtx--;
}
+75
View File
@@ -0,0 +1,75 @@
/**
* c_list.cpp
*
*/
#include "SSystem/SComponent/c_list.h"
#include "SSystem/SComponent/c_node.h"
#include "dolphin/types.h"
/* 80265E64-80265E78 0014+00 s=1 e=0 z=0 None .text cLs_Init__FP15node_list_class */
void cLs_Init(node_list_class* list) {
list->mpHead = NULL;
list->mpTail = NULL;
list->mSize = 0;
}
/* 80265E78-80265EFC 0084+00 s=1 e=4 z=0 None .text cLs_SingleCut__FP10node_class */
int cLs_SingleCut(node_class* node) {
node_list_class* list = (node_list_class*)node->mpData;
if (node == list->mpHead)
list->mpHead = node->mpNextNode;
if (node == list->mpTail)
list->mpTail = node->mpPrevNode;
cNd_SingleCut(node);
cNd_ClearObject(node);
int newSize = list->mSize - 1;
list->mSize = newSize;
return newSize > 0;
}
/* 80265EFC-80265F70 0074+00 s=1 e=4 z=0 None .text
* cLs_Addition__FP15node_list_classP10node_class */
int cLs_Addition(node_list_class* list, node_class* node) {
if (list->mpTail == NULL) {
list->mpHead = node;
} else {
cNd_Addition(list->mpTail, node);
}
list->mpTail = cNd_Last(node);
cNd_SetObject(node, list);
list->mSize = cNd_LengthOf(list->mpHead);
return list->mSize;
}
/* 80265F70-80265FF8 0088+00 s=0 e=1 z=0 None .text cLs_Insert__FP15node_list_classiP10node_class
*/
int cLs_Insert(node_list_class* list, int idx, node_class* node) {
node_class* pExisting = cNd_Order(list->mpHead, idx);
if (pExisting == NULL) {
return cLs_Addition(list, node);
} else {
cNd_SetObject(node, list);
cNd_Insert(pExisting, node);
list->mpHead = cNd_First(node);
list->mSize = cNd_LengthOf(list->mpHead);
return list->mSize;
}
}
/* 80265FF8-80266040 0048+00 s=0 e=1 z=0 None .text cLs_GetFirst__FP15node_list_class */
node_class* cLs_GetFirst(node_list_class* list) {
if (list->mSize != 0) {
node_class* pHead = list->mpHead;
cLs_SingleCut(pHead);
return pHead;
} else {
return NULL;
}
}
/* 80266040-80266060 0020+00 s=0 e=4 z=0 None .text cLs_Create__FP15node_list_class */
void cLs_Create(node_list_class* list) {
cLs_Init(list);
}
+26
View File
@@ -0,0 +1,26 @@
/**
* c_list_iter.cpp
*
*/
#include "SSystem/SComponent/c_list_iter.h"
#include "SSystem/SComponent/c_list.h"
#include "dolphin/types.h"
/* 80266060-80266098 0038+00 s=0 e=5 z=0 None .text
* cLsIt_Method__FP15node_list_classPFP10node_classPv_iPv */
int cLsIt_Method(node_list_class* list, cNdIt_MethodFunc method, void* data) {
if (list->mSize > 0)
return cNdIt_Method(list->mpHead, method, data);
else
return 1;
}
/* 80266098-802660D0 0038+00 s=0 e=4 z=0 None .text
* cLsIt_Judge__FP15node_list_classPFP10node_classPv_PvPv */
void* cLsIt_Judge(node_list_class* list, cNdIt_JudgeFunc judge, void* data) {
if (list->mSize > 0)
return cNdIt_Judge(list->mpHead, judge, data);
else
return NULL;
}
+52
View File
@@ -0,0 +1,52 @@
/**
* c_m2d.cpp
*
*/
#include "SSystem/SComponent/c_m2d.h"
#include "SSystem/SComponent/c_m3d.h"
#include "SSystem/SComponent/c_m3d_g_cir.h"
/* 80268260-80268560 262BA0 0300+00 0/0 4/4 0/0 .text cM2d_CrossCirLin__FR8cM2dGCirffffPfPf */
void cM2d_CrossCirLin(cM2dGCir& param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4,
f32* param_5, f32* param_6) {
f32 fVar1 = param_1 - param_0.GetCx();
f32 fVar15 = param_2 - param_0.GetCy();
f32 dVar13 = param_3 * param_3 + param_4 * param_4;
f32 dVar14 = 2.0f * ((param_3 * fVar1) + (param_4 * fVar15));
f32 fVar3 = (fVar1 * fVar1 + fVar15 * fVar15) - (param_0.GetR() * param_0.GetR());
f32 in_f31;
if (cM3d_IsZero(dVar13)) {
if (!cM3d_IsZero(dVar14)) {
in_f31 = -fVar3 / dVar14;
}
} else {
f32 dVar10 = ((dVar14 * dVar14) - (4.0f * dVar13) * fVar3);
if (cM3d_IsZero(dVar10)) {
in_f31 = (-dVar14 / (2.0f * dVar13));
} else {
if (dVar10 < 0.0f) {
} else {
f32 fVar2 = 1.0f / (2.0f * dVar13);
f32 fVar15 = sqrtf(dVar10);
fVar15 = fVar2 * (-dVar14 + fVar15);
f32 fVar16 = sqrtf(dVar10);
f32 fVar4 = fVar2 * (-dVar14 - fVar16);
if (fVar15 > fVar4) {
in_f31 = fVar15;
} else {
in_f31 = fVar4;
}
}
}
}
if (cM3d_IsZero(in_f31)) {
*param_5 = param_1;
*param_6 = param_2;
} else {
*param_5 = param_1 + (in_f31 * param_3);
*param_6 = param_2 + (in_f31 * param_4);
}
}
File diff suppressed because it is too large Load Diff
+74
View File
@@ -0,0 +1,74 @@
/**
* c_m3d_g_aab.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_aab.h"
/* 8026EC54-8026EC88 0034+00 s=0 e=4 z=0 None .text Set__8cM3dGAabFPC4cXyzPC4cXyz */
void cM3dGAab::Set(const cXyz* min, const cXyz* max) {
mMin = *min;
mMax = *max;
}
/* 8026EC88-8026ECD0 0048+00 s=0 e=6 z=0 None .text CrossY__8cM3dGAabCFPC4cXyz */
bool cM3dGAab::CrossY(const cXyz* other) const {
if (mMin.x > other->x || mMax.x < other->x || mMin.z > other->z || mMax.z < other->z) {
return false;
} else {
return true;
}
}
/* 8026ECD0-8026ECE4 0014+00 s=0 e=6 z=0 None .text UnderPlaneYUnder__8cM3dGAabCFf */
bool cM3dGAab::UnderPlaneYUnder(f32 y) const {
return mMin.y < y;
}
/* 8026ECE4-8026ECF8 0014+00 s=0 e=6 z=0 None .text TopPlaneYUnder__8cM3dGAabCFf */
bool cM3dGAab::TopPlaneYUnder(f32 y) const {
return mMax.y < y;
}
/* 8026ECF8-8026ED1C 0024+00 s=0 e=6 z=0 None .text ClearForMinMax__8cM3dGAabFv */
void cM3dGAab::ClearForMinMax() {
mMin.z = 1000000000.0f;
mMin.y = 1000000000.0f;
mMin.x = 1000000000.0f;
mMax.z = -1000000000.0f;
mMax.y = -1000000000.0f;
mMax.x = -1000000000.0f;
}
/* 8026ED1C-8026ED60 0044+00 s=1 e=3 z=0 None .text SetMinMax__8cM3dGAabFRC4cXyz */
void cM3dGAab::SetMinMax(const cXyz& pMinMax) {
this->SetMin(pMinMax);
this->SetMax(pMinMax);
}
/* 8026ED60-8026EDA4 0044+00 s=0 e=2 z=0 None .text SetMinMax__8cM3dGAabFRC8cM3dGAab */
void cM3dGAab::SetMinMax(const cM3dGAab& other) {
this->SetMinMax(other.mMin);
this->SetMinMax(other.mMax);
}
/* 8026EDA4-8026EDE4 0040+00 s=1 e=1 z=0 None .text SetMin__8cM3dGAabFRC4cXyz */
void cM3dGAab::SetMin(const cXyz& min) {
mMin.setMin(min);
}
/* 8026EDE4-8026EE24 0040+00 s=1 e=1 z=0 None .text SetMax__8cM3dGAabFRC4cXyz */
void cM3dGAab::SetMax(const cXyz& max) {
mMax.setMax(max);
}
/* 8026EE24-8026EE68 0044+00 s=0 e=1 z=0 None .text CalcCenter__8cM3dGAabCFP4cXyz */
void cM3dGAab::CalcCenter(cXyz* out) const {
VECAdd(&mMin, &mMax, out);
VECScale(out, out, 0.5f);
}
/* 8026EE68-8026EEB4 004C+00 s=0 e=1 z=0 None .text PlusR__8cM3dGAabFf */
void cM3dGAab::PlusR(f32 r) {
mMin -= r;
mMax += r;
}
+20
View File
@@ -0,0 +1,20 @@
/**
* c_m3d_g_cir.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_cir.h"
/* 8026EEB4-8026EED0 001C+00 s=0 e=1 z=0 None .text __ct__8cM3dGCirFv */
cM3dGCir::cM3dGCir() {}
/* 8026EF18-8026EF74 005C+00 s=1 e=4 z=386 None .text __dt__8cM3dGCirFv */
cM3dGCir::~cM3dGCir() {}
/* 8026EF74-8026EF88 0014+00 s=0 e=1 z=0 None .text Set__8cM3dGCirFffff */
void cM3dGCir::Set(f32 pos_x, f32 pos_y, f32 posz, f32 radius) {
mPosX = pos_x;
mPosY = pos_y;
mRadius = radius;
mPosZ = posz;
}
+29
View File
@@ -0,0 +1,29 @@
/**
* c_m3d_g_cps.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_cps.h"
/* 8026EF88-8026EFA4 2698C8 001C+00 0/0 5/5 20/20 .text __ct__8cM3dGCpsFv */
cM3dGCps::cM3dGCps() {}
/* 8026EFA4-8026F000 2698E4 005C+00 1/0 7/7 6/6 .text __dt__8cM3dGCpsFv */
cM3dGCps::~cM3dGCps() {}
/* 8026F000-8026F03C 269940 003C+00 1/1 2/2 10/10 .text Set__8cM3dGCpsFRC4cXyzRC4cXyzf */
void cM3dGCps::Set(const cXyz& start, const cXyz& end, f32 radius) {
SetStartEnd(start, end);
mRadius = radius;
}
/* 8026F03C-8026F080 26997C 0044+00 0/0 1/1 10/10 .text Set__8cM3dGCpsFRC9cM3dGCpsS */
void cM3dGCps::Set(const cM3dGCpsS& other) {
SetStartEnd(other.mStart, other.mEnd);
mRadius = other.mRadius;
}
/* 8026F080-8026F0A8 2699C0 0028+00 0/0 1/1 0/0 .text SetCps__8cM3dGCpsFRC8cM3dGCps */
void cM3dGCps::SetCps(const cM3dGCps& other) {
Set(other.GetStartP(), other.GetEndP(), other.mRadius);
}
+67
View File
@@ -0,0 +1,67 @@
/**
* c_m3d_g_cyl.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_cyl.h"
#include "SSystem/SComponent/c_m3d.h"
/* 8026F0A8-8026F114 2699E8 006C+00 0/0 1/1 0/0 .text __ct__8cM3dGCylFPC4cXyzff */
cM3dGCyl::cM3dGCyl(const cXyz* center, f32 radius, f32 height) {
SetC(*center);
SetR(radius);
SetH(height);
}
/* 8026F114-8026F180 269A54 006C+00 0/0 1/1 4/4 .text Set__8cM3dGCylFRC9cM3dGCylS */
void cM3dGCyl::Set(const cM3dGCylS& other) {
SetC(cXyz(other.mCenter));
SetR(other.mRadius);
SetH(other.mHeight);
}
/* 8026F180-8026F1DC 269AC0 005C+00 0/0 2/2 1/1 .text Set__8cM3dGCylFRC4cXyzff */
void cM3dGCyl::Set(const cXyz& center, f32 radius, f32 height) {
SetC(center);
SetR(radius);
SetH(height);
}
/* 8026F1DC-8026F1F8 269B1C 001C+00 3/3 13/13 257/257 .text SetC__8cM3dGCylFRC4cXyz */
void cM3dGCyl::SetC(const cXyz& center) {
mCenter = center;
}
/* 8026F1F8-8026F200 269B38 0008+00 3/3 11/11 197/197 .text SetH__8cM3dGCylFf */
void cM3dGCyl::SetH(f32 height) {
mHeight = height;
}
/* 8026F200-8026F208 269B40 0008+00 3/3 6/6 204/204 .text SetR__8cM3dGCylFf */
void cM3dGCyl::SetR(f32 radius) {
mRadius = radius;
}
/* 8026F208-8026F22C 269B48 0024+00 0/0 1/1 0/0 .text cross__8cM3dGCylCFPC8cM3dGSphP4cXyz
*/
bool cM3dGCyl::cross(const cM3dGSph* other, cXyz* out) const {
f32 f;
return cM3d_Cross_CylSph(this, other, out, &f);
}
/* 8026F22C-8026F24C 269B6C 0020+00 0/0 1/1 0/0 .text cross__8cM3dGCylCFPC8cM3dGCylP4cXyz
*/
bool cM3dGCyl::cross(const cM3dGCyl* other, cXyz* out) const {
return cM3d_Cross_CylCyl(this, other, out);
}
/* 8026F24C-8026F2A8 269B8C 005C+00 0/0 2/2 0/0 .text calcMinMax__8cM3dGCylFP4cXyzP4cXyz
*/
void cM3dGCyl::calcMinMax(cXyz* min, cXyz* max) {
min->x = mCenter.x - mRadius;
min->y = mCenter.y;
min->z = mCenter.z - mRadius;
max->x = mCenter.x + mRadius;
max->y = mCenter.y + mHeight;
max->z = mCenter.z + mRadius;
}
+34
View File
@@ -0,0 +1,34 @@
/**
* c_m3d_g_lin.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_lin.h"
/* 8026F2A8-8026F2E8 0040+00 s=0 e=8 z=1 None .text __ct__8cM3dGLinFRC4cXyzRC4cXyz */
cM3dGLin::cM3dGLin(const cXyz& start, const cXyz& end) : mStart(start), mEnd(end) {}
/* 8026F2E8-8026F31C 0034+00 s=0 e=8 z=10 None .text SetStartEnd__8cM3dGLinFRC4cXyzRC4cXyz */
void cM3dGLin::SetStartEnd(const cXyz& start, const cXyz& end) {
mStart = start;
mEnd = end;
}
/* 8026F31C-8026F350 0034+00 s=0 e=7 z=4 None .text SetStartEnd__8cM3dGLinFRC3VecRC3Vec */
void cM3dGLin::SetStartEnd(const Vec& start, const Vec& end) {
mStart = start;
mEnd = end;
}
/* 8026F350-8026F3C0 0070+00 s=0 e=3 z=0 None .text CalcPos__8cM3dGLinCFP3Vecf */
void cM3dGLin::CalcPos(Vec* out, f32 scale) const {
Vec tmp;
VECSubtract(&mEnd, &mStart, &tmp);
VECScale(&tmp, &tmp, scale);
VECAdd(&tmp, &mStart, out);
}
/* 8026F3C0-8026F3DC 001C+00 s=0 e=1 z=0 None .text SetEnd__8cM3dGLinFRC4cXyz */
void cM3dGLin::SetEnd(const cXyz& end) {
mEnd = end;
}
+63
View File
@@ -0,0 +1,63 @@
/**
* c_m3d_g_pla.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "SSystem/SComponent/c_m3d.h"
/* 8026F3DC-8026F408 269D1C 002C+00 0/0 3/3 0/0 .text __ct__8cM3dGPlaFPC4cXyzf */
cM3dGPla::cM3dGPla(const cXyz* normal, f32 d) : mNormal(*normal), mD(d) {}
/* 8026F408-8026F4C4 269D48 00BC+00 0/0 3/3 0/0 .text crossInfLin__8cM3dGPlaCFRC4cXyzRC4cXyzR4cXyz
*/
bool cM3dGPla::crossInfLin(const cXyz& start, const cXyz& end, cXyz& out) const {
f32 tmp1 = (mD + VECDotProduct(&mNormal, &start));
f32 tmp2 = tmp1 - (mD + VECDotProduct(&mNormal, &end));
if (fabsf(tmp2) < G_CM3D_F_ABS_MIN) {
out = end;
return false;
} else {
cM3d_InDivPos2(&start, &end, (tmp1 / tmp2), &out);
return true;
}
}
/* 8026F4C4-8026F52C 269E04 0068+00 0/0 1/1 0/0 .text SetupNP0__8cM3dGPlaFRC3VecRC3Vec */
void cM3dGPla::SetupNP0(const Vec& normal, const Vec& point) {
mNormal = normal;
VECNormalize(&mNormal, &mNormal);
mD = -VECDotProduct(&mNormal, &point);
}
/* 8026F52C-8026F57C 269E6C 0050+00 0/0 2/2 0/0 .text SetupNP__8cM3dGPlaFRC3VecRC3Vec */
void cM3dGPla::SetupNP(const Vec& normal, const Vec& point) {
mNormal = normal;
mD = -VECDotProduct(&mNormal, &point);
}
/* 8026F57C-8026F5D4 269EBC 0058+00 0/0 2/2 0/0 .text getCrossY__8cM3dGPlaCFRC4cXyzPf */
bool cM3dGPla::getCrossY(const cXyz& point, f32* out) const {
if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) {
return false;
} else {
*out = (-mNormal.x * point.x - mNormal.z * point.z - mD) / mNormal.y;
return true;
}
}
/* 8026F5D4-8026F624 269F14 0050+00 0/0 1/1 0/0 .text getCrossYLessD__8cM3dGPlaCFRC3VecPf
*/
bool cM3dGPla::getCrossYLessD(const Vec& point, f32* out) const {
if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) {
return false;
} else {
*out = (-mNormal.x * point.x - mNormal.z * point.z) / mNormal.y;
return true;
}
}
/* 8026F624-8026F648 269F64 0024+00 0/0 1/1 0/0 .text Set__8cM3dGPlaFPC8cM3dGPla */
void cM3dGPla::Set(const cM3dGPla* other) {
*this = *other;
}
+52
View File
@@ -0,0 +1,52 @@
/**
* c_m3d_g_sph.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_sph.h"
#include "SSystem/SComponent/c_m3d.h"
/* 8026F648-8026F664 269F88 001C+00 2/2 5/5 254/254 .text SetC__8cM3dGSphFRC4cXyz */
void cM3dGSph::SetC(const cXyz& center) {
mCenter = center;
}
/* 8026F664-8026F6A8 269FA4 0044+00 0/0 3/3 2/2 .text Set__8cM3dGSphFRC4cXyzf */
void cM3dGSph::Set(const cXyz& center, f32 radius) {
SetC(center);
SetR(radius);
}
/* 8026F6A8-8026F708 269FE8 0060+00 0/0 2/2 0/0 .text Set__8cM3dGSphFRC9cM3dGSphS */
void cM3dGSph::Set(const cM3dGSphS& other) {
SetC(cXyz(other.mCenter));
SetR(other.mRadius);
}
/* 8026F708-8026F710 26A048 0008+00 2/2 10/10 197/197 .text SetR__8cM3dGSphFf */
void cM3dGSph::SetR(f32 radius) {
mRadius = radius;
}
/* 8026F710-8026F73C 26A050 002C+00 0/0 1/1 0/0 .text cross__8cM3dGSphCFPC8cM3dGSphP4cXyz
*/
bool cM3dGSph::cross(const cM3dGSph* other, cXyz* out) const {
return cM3d_Cross_SphSph(other, this, out);
}
/* 8026F73C-8026F76C 26A07C 0030+00 0/0 1/1 0/0 .text cross__8cM3dGSphCFPC8cM3dGCylP4cXyz
*/
bool cM3dGSph::cross(const cM3dGCyl* cyl, cXyz* out) const {
f32 f;
return cM3d_Cross_CylSph(cyl, this, out, &f);
}
/* 8026F76C-8026F7B0 26A0AC 0044+00 0/0 1/1 0/0 .text GetMinMaxCube__8cM3dGSphCFR4cXyzR4cXyz */
void cM3dGSph::GetMinMaxCube(cXyz& min, cXyz& max) const {
min.x = mCenter.x - mRadius;
min.y = mCenter.y - mRadius;
min.z = mCenter.z - mRadius;
max.x = mCenter.x + mRadius;
max.y = mCenter.y + mRadius;
max.z = mCenter.z + mRadius;
}
+38
View File
@@ -0,0 +1,38 @@
/**
* c_m3d_g_tri.cpp
*
*/
#include "SSystem/SComponent/c_m3d_g_tri.h"
#include "SSystem/SComponent/c_m3d.h"
/* 8026F7B0-8026F7DC 26A0F0 002C+00 0/0 1/1 0/0 .text cross__8cM3dGTriCFPC8cM3dGCylP3Vec
*/
bool cM3dGTri::cross(const cM3dGCyl* cyl, Vec* out) const {
return cM3d_Cross_CylTri(cyl, this, out);
}
/* 8026F7DC-8026F85C 26A11C 0080+00 0/0 0/0 6/6 .text setPos__8cM3dGTriFPC3VecPC3VecPC3Vec */
void cM3dGTri::setPos(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c) {
mA = *vtx_a;
mB = *vtx_b;
mC = *vtx_c;
cM3d_CalcPla(&mA, &mB, &mC, &mNormal, &mD);
}
/* 8026F85C-8026F8C8 26A19C 006C+00 0/0 2/2 0/0 .text
* setBg__8cM3dGTriFPC3VecPC3VecPC3VecPC8cM3dGPla */
void cM3dGTri::setBg(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c, const cM3dGPla* plane) {
mA = *vtx_a;
mB = *vtx_b;
mC = *vtx_c;
Set(plane);
}
/* 8026F8C8-8026F93C 26A208 0074+00 0/0 1/1 0/0 .text set__8cM3dGTriFPC3VecPC3VecPC3VecPC3Vec */
void cM3dGTri::set(const Vec* vtx_a, const Vec* vtx_b, const Vec* vtx_c, const Vec* normal) {
mA = *vtx_a;
mB = *vtx_b;
mC = *vtx_c;
SetupNP(*normal, *vtx_a);
}
+32
View File
@@ -0,0 +1,32 @@
/**
* c_malloc.cpp
*
*/
#include "SSystem/SComponent/c_malloc.h"
#include "JSystem/JKernel/JKRHeap.h"
/* ############################################################################################## */
/* 80451150-80451158 0004+04 s=3 e=0 z=0 None .sbss Heap__3cMl */
JKRHeap* cMl::Heap;
/* 80263220-80263228 0008+00 s=0 e=1 z=0 None .text init__3cMlFP7JKRHeap */
void cMl::init(JKRHeap* heap) {
Heap = heap;
}
/* 80263228-80263260 0038+00 s=0 e=8 z=0 None .text memalignB__3cMlFiUl */
void* cMl::memalignB(int alignment, unsigned long size) {
if (size == 0) {
return NULL;
} else {
return Heap->alloc(size, alignment);
}
}
/* 80263260-8026328C 002C+00 s=0 e=4 z=0 None .text free__3cMlFPv */
void cMl::free(void* ptr) {
if (ptr != NULL) {
Heap->free(ptr);
}
}
+250
View File
@@ -0,0 +1,250 @@
/**
* c_math.cpp
* Math Helper Utilities
*/
#include "SSystem/SComponent/c_math.h"
#include "SSystem/SComponent/c_m3d.h"
/* 802675E4-80267640 261F24 005C+00 0/0 23/23 11/11 .text cM_rad2s__Ff */
s16 cM_rad2s(float rad) {
f32 rad_mod = fmod(rad, 2 * M_PI);
s32 s = (rad_mod * (0x8000 / M_PI));
if (s < -0x8000) {
s += 0x10000;
} else if (s > 0x7FFF) {
s -= 0x10000;
}
return s;
}
/* ############################################################################################## */
/* 803C3778-803C3F80 020898 0802+06 1/1 0/0 0/0 .data atntable */
static u16 atntable[1025] = {
0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070,
0x007A, 0x0084, 0x008F, 0x0099, 0x00A3, 0x00AD, 0x00B7, 0x00C2, 0x00CC, 0x00D6, 0x00E0, 0x00EA,
0x00F4, 0x00FF, 0x0109, 0x0113, 0x011D, 0x0127, 0x0131, 0x013C, 0x0146, 0x0150, 0x015A, 0x0164,
0x016F, 0x0179, 0x0183, 0x018D, 0x0197, 0x01A1, 0x01AC, 0x01B6, 0x01C0, 0x01CA, 0x01D4, 0x01DE,
0x01E9, 0x01F3, 0x01FD, 0x0207, 0x0211, 0x021B, 0x0226, 0x0230, 0x023A, 0x0244, 0x024E, 0x0258,
0x0262, 0x026D, 0x0277, 0x0281, 0x028B, 0x0295, 0x029F, 0x02A9, 0x02B4, 0x02BE, 0x02C8, 0x02D2,
0x02DC, 0x02E6, 0x02F0, 0x02FB, 0x0305, 0x030F, 0x0319, 0x0323, 0x032D, 0x0337, 0x0341, 0x034C,
0x0356, 0x0360, 0x036A, 0x0374, 0x037E, 0x0388, 0x0392, 0x039C, 0x03A7, 0x03B1, 0x03BB, 0x03C5,
0x03CF, 0x03D9, 0x03E3, 0x03ED, 0x03F7, 0x0401, 0x040C, 0x0416, 0x0420, 0x042A, 0x0434, 0x043E,
0x0448, 0x0452, 0x045C, 0x0466, 0x0470, 0x047A, 0x0484, 0x048E, 0x0499, 0x04A3, 0x04AD, 0x04B7,
0x04C1, 0x04CB, 0x04D5, 0x04DF, 0x04E9, 0x04F3, 0x04FD, 0x0507, 0x0511, 0x051B, 0x0525, 0x052F,
0x0539, 0x0543, 0x054D, 0x0557, 0x0561, 0x056B, 0x0575, 0x057F, 0x0589, 0x0593, 0x059D, 0x05A7,
0x05B1, 0x05BB, 0x05C5, 0x05CF, 0x05D9, 0x05E3, 0x05ED, 0x05F7, 0x0601, 0x060B, 0x0615, 0x061F,
0x0629, 0x0633, 0x063D, 0x0647, 0x0651, 0x065B, 0x0665, 0x066E, 0x0678, 0x0682, 0x068C, 0x0696,
0x06A0, 0x06AA, 0x06B4, 0x06BE, 0x06C8, 0x06D2, 0x06DC, 0x06E5, 0x06EF, 0x06F9, 0x0703, 0x070D,
0x0717, 0x0721, 0x072B, 0x0735, 0x073E, 0x0748, 0x0752, 0x075C, 0x0766, 0x0770, 0x077A, 0x0783,
0x078D, 0x0797, 0x07A1, 0x07AB, 0x07B5, 0x07BE, 0x07C8, 0x07D2, 0x07DC, 0x07E6, 0x07EF, 0x07F9,
0x0803, 0x080D, 0x0817, 0x0820, 0x082A, 0x0834, 0x083E, 0x0848, 0x0851, 0x085B, 0x0865, 0x086F,
0x0878, 0x0882, 0x088C, 0x0896, 0x089F, 0x08A9, 0x08B3, 0x08BD, 0x08C6, 0x08D0, 0x08DA, 0x08E3,
0x08ED, 0x08F7, 0x0901, 0x090A, 0x0914, 0x091E, 0x0927, 0x0931, 0x093B, 0x0944, 0x094E, 0x0958,
0x0961, 0x096B, 0x0975, 0x097E, 0x0988, 0x0992, 0x099B, 0x09A5, 0x09AE, 0x09B8, 0x09C2, 0x09CB,
0x09D5, 0x09DE, 0x09E8, 0x09F2, 0x09FB, 0x0A05, 0x0A0E, 0x0A18, 0x0A22, 0x0A2B, 0x0A35, 0x0A3E,
0x0A48, 0x0A51, 0x0A5B, 0x0A64, 0x0A6E, 0x0A77, 0x0A81, 0x0A8B, 0x0A94, 0x0A9E, 0x0AA7, 0x0AB1,
0x0ABA, 0x0AC4, 0x0ACD, 0x0AD7, 0x0AE0, 0x0AE9, 0x0AF3, 0x0AFC, 0x0B06, 0x0B0F, 0x0B19, 0x0B22,
0x0B2C, 0x0B35, 0x0B3F, 0x0B48, 0x0B51, 0x0B5B, 0x0B64, 0x0B6E, 0x0B77, 0x0B80, 0x0B8A, 0x0B93,
0x0B9D, 0x0BA6, 0x0BAF, 0x0BB9, 0x0BC2, 0x0BCB, 0x0BD5, 0x0BDE, 0x0BE7, 0x0BF1, 0x0BFA, 0x0C03,
0x0C0D, 0x0C16, 0x0C1F, 0x0C29, 0x0C32, 0x0C3B, 0x0C45, 0x0C4E, 0x0C57, 0x0C60, 0x0C6A, 0x0C73,
0x0C7C, 0x0C86, 0x0C8F, 0x0C98, 0x0CA1, 0x0CAB, 0x0CB4, 0x0CBD, 0x0CC6, 0x0CCF, 0x0CD9, 0x0CE2,
0x0CEB, 0x0CF4, 0x0CFD, 0x0D07, 0x0D10, 0x0D19, 0x0D22, 0x0D2B, 0x0D34, 0x0D3E, 0x0D47, 0x0D50,
0x0D59, 0x0D62, 0x0D6B, 0x0D74, 0x0D7D, 0x0D87, 0x0D90, 0x0D99, 0x0DA2, 0x0DAB, 0x0DB4, 0x0DBD,
0x0DC6, 0x0DCF, 0x0DD8, 0x0DE1, 0x0DEA, 0x0DF3, 0x0DFC, 0x0E05, 0x0E0F, 0x0E18, 0x0E21, 0x0E2A,
0x0E33, 0x0E3C, 0x0E45, 0x0E4E, 0x0E56, 0x0E5F, 0x0E68, 0x0E71, 0x0E7A, 0x0E83, 0x0E8C, 0x0E95,
0x0E9E, 0x0EA7, 0x0EB0, 0x0EB9, 0x0EC2, 0x0ECB, 0x0ED4, 0x0EDC, 0x0EE5, 0x0EEE, 0x0EF7, 0x0F00,
0x0F09, 0x0F12, 0x0F1B, 0x0F23, 0x0F2C, 0x0F35, 0x0F3E, 0x0F47, 0x0F50, 0x0F58, 0x0F61, 0x0F6A,
0x0F73, 0x0F7C, 0x0F84, 0x0F8D, 0x0F96, 0x0F9F, 0x0FA7, 0x0FB0, 0x0FB9, 0x0FC2, 0x0FCA, 0x0FD3,
0x0FDC, 0x0FE5, 0x0FED, 0x0FF6, 0x0FFF, 0x1007, 0x1010, 0x1019, 0x1021, 0x102A, 0x1033, 0x103B,
0x1044, 0x104D, 0x1055, 0x105E, 0x1067, 0x106F, 0x1078, 0x1080, 0x1089, 0x1092, 0x109A, 0x10A3,
0x10AB, 0x10B4, 0x10BC, 0x10C5, 0x10CE, 0x10D6, 0x10DF, 0x10E7, 0x10F0, 0x10F8, 0x1101, 0x1109,
0x1112, 0x111A, 0x1123, 0x112B, 0x1134, 0x113C, 0x1145, 0x114D, 0x1156, 0x115E, 0x1166, 0x116F,
0x1177, 0x1180, 0x1188, 0x1191, 0x1199, 0x11A1, 0x11AA, 0x11B2, 0x11BB, 0x11C3, 0x11CB, 0x11D4,
0x11DC, 0x11E4, 0x11ED, 0x11F5, 0x11FD, 0x1206, 0x120E, 0x1216, 0x121F, 0x1227, 0x122F, 0x1237,
0x1240, 0x1248, 0x1250, 0x1259, 0x1261, 0x1269, 0x1271, 0x127A, 0x1282, 0x128A, 0x1292, 0x129A,
0x12A3, 0x12AB, 0x12B3, 0x12BB, 0x12C3, 0x12CC, 0x12D4, 0x12DC, 0x12E4, 0x12EC, 0x12F4, 0x12FC,
0x1305, 0x130D, 0x1315, 0x131D, 0x1325, 0x132D, 0x1335, 0x133D, 0x1345, 0x134D, 0x1355, 0x135E,
0x1366, 0x136E, 0x1376, 0x137E, 0x1386, 0x138E, 0x1396, 0x139E, 0x13A6, 0x13AE, 0x13B6, 0x13BE,
0x13C6, 0x13CE, 0x13D6, 0x13DE, 0x13E6, 0x13ED, 0x13F5, 0x13FD, 0x1405, 0x140D, 0x1415, 0x141D,
0x1425, 0x142D, 0x1435, 0x143D, 0x1444, 0x144C, 0x1454, 0x145C, 0x1464, 0x146C, 0x1473, 0x147B,
0x1483, 0x148B, 0x1493, 0x149B, 0x14A2, 0x14AA, 0x14B2, 0x14BA, 0x14C1, 0x14C9, 0x14D1, 0x14D9,
0x14E0, 0x14E8, 0x14F0, 0x14F8, 0x14FF, 0x1507, 0x150F, 0x1516, 0x151E, 0x1526, 0x152D, 0x1535,
0x153D, 0x1544, 0x154C, 0x1554, 0x155B, 0x1563, 0x156B, 0x1572, 0x157A, 0x1581, 0x1589, 0x1591,
0x1598, 0x15A0, 0x15A7, 0x15AF, 0x15B7, 0x15BE, 0x15C6, 0x15CD, 0x15D5, 0x15DC, 0x15E4, 0x15EB,
0x15F3, 0x15FA, 0x1602, 0x1609, 0x1611, 0x1618, 0x1620, 0x1627, 0x162F, 0x1636, 0x163E, 0x1645,
0x164C, 0x1654, 0x165B, 0x1663, 0x166A, 0x1671, 0x1679, 0x1680, 0x1688, 0x168F, 0x1696, 0x169E,
0x16A5, 0x16AC, 0x16B4, 0x16BB, 0x16C2, 0x16CA, 0x16D1, 0x16D8, 0x16E0, 0x16E7, 0x16EE, 0x16F6,
0x16FD, 0x1704, 0x170B, 0x1713, 0x171A, 0x1721, 0x1728, 0x1730, 0x1737, 0x173E, 0x1745, 0x174C,
0x1754, 0x175B, 0x1762, 0x1769, 0x1770, 0x1778, 0x177F, 0x1786, 0x178D, 0x1794, 0x179B, 0x17A2,
0x17AA, 0x17B1, 0x17B8, 0x17BF, 0x17C6, 0x17CD, 0x17D4, 0x17DB, 0x17E2, 0x17E9, 0x17F0, 0x17F7,
0x17FE, 0x1806, 0x180D, 0x1814, 0x181B, 0x1822, 0x1829, 0x1830, 0x1837, 0x183E, 0x1845, 0x184C,
0x1853, 0x185A, 0x1860, 0x1867, 0x186E, 0x1875, 0x187C, 0x1883, 0x188A, 0x1891, 0x1898, 0x189F,
0x18A6, 0x18AD, 0x18B3, 0x18BA, 0x18C1, 0x18C8, 0x18CF, 0x18D6, 0x18DD, 0x18E3, 0x18EA, 0x18F1,
0x18F8, 0x18FF, 0x1906, 0x190C, 0x1913, 0x191A, 0x1921, 0x1928, 0x192E, 0x1935, 0x193C, 0x1943,
0x1949, 0x1950, 0x1957, 0x195D, 0x1964, 0x196B, 0x1972, 0x1978, 0x197F, 0x1986, 0x198C, 0x1993,
0x199A, 0x19A0, 0x19A7, 0x19AE, 0x19B4, 0x19BB, 0x19C2, 0x19C8, 0x19CF, 0x19D5, 0x19DC, 0x19E3,
0x19E9, 0x19F0, 0x19F6, 0x19FD, 0x1A04, 0x1A0A, 0x1A11, 0x1A17, 0x1A1E, 0x1A24, 0x1A2B, 0x1A31,
0x1A38, 0x1A3E, 0x1A45, 0x1A4B, 0x1A52, 0x1A58, 0x1A5F, 0x1A65, 0x1A6C, 0x1A72, 0x1A79, 0x1A7F,
0x1A86, 0x1A8C, 0x1A93, 0x1A99, 0x1A9F, 0x1AA6, 0x1AAC, 0x1AB3, 0x1AB9, 0x1AC0, 0x1AC6, 0x1ACC,
0x1AD3, 0x1AD9, 0x1ADF, 0x1AE6, 0x1AEC, 0x1AF2, 0x1AF9, 0x1AFF, 0x1B05, 0x1B0C, 0x1B12, 0x1B18,
0x1B1F, 0x1B25, 0x1B2B, 0x1B32, 0x1B38, 0x1B3E, 0x1B44, 0x1B4B, 0x1B51, 0x1B57, 0x1B5D, 0x1B64,
0x1B6A, 0x1B70, 0x1B76, 0x1B7D, 0x1B83, 0x1B89, 0x1B8F, 0x1B95, 0x1B9C, 0x1BA2, 0x1BA8, 0x1BAE,
0x1BB4, 0x1BBA, 0x1BC1, 0x1BC7, 0x1BCD, 0x1BD3, 0x1BD9, 0x1BDF, 0x1BE5, 0x1BEB, 0x1BF2, 0x1BF8,
0x1BFE, 0x1C04, 0x1C0A, 0x1C10, 0x1C16, 0x1C1C, 0x1C22, 0x1C28, 0x1C2E, 0x1C34, 0x1C3A, 0x1C40,
0x1C46, 0x1C4C, 0x1C52, 0x1C58, 0x1C5E, 0x1C64, 0x1C6A, 0x1C70, 0x1C76, 0x1C7C, 0x1C82, 0x1C88,
0x1C8E, 0x1C94, 0x1C9A, 0x1CA0, 0x1CA6, 0x1CAC, 0x1CB2, 0x1CB8, 0x1CBE, 0x1CC3, 0x1CC9, 0x1CCF,
0x1CD5, 0x1CDB, 0x1CE1, 0x1CE7, 0x1CED, 0x1CF3, 0x1CF8, 0x1CFE, 0x1D04, 0x1D0A, 0x1D10, 0x1D16,
0x1D1B, 0x1D21, 0x1D27, 0x1D2D, 0x1D33, 0x1D38, 0x1D3E, 0x1D44, 0x1D4A, 0x1D4F, 0x1D55, 0x1D5B,
0x1D61, 0x1D66, 0x1D6C, 0x1D72, 0x1D78, 0x1D7D, 0x1D83, 0x1D89, 0x1D8E, 0x1D94, 0x1D9A, 0x1DA0,
0x1DA5, 0x1DAB, 0x1DB1, 0x1DB6, 0x1DBC, 0x1DC2, 0x1DC7, 0x1DCD, 0x1DD3, 0x1DD8, 0x1DDE, 0x1DE3,
0x1DE9, 0x1DEF, 0x1DF4, 0x1DFA, 0x1DFF, 0x1E05, 0x1E0B, 0x1E10, 0x1E16, 0x1E1B, 0x1E21, 0x1E26,
0x1E2C, 0x1E32, 0x1E37, 0x1E3D, 0x1E42, 0x1E48, 0x1E4D, 0x1E53, 0x1E58, 0x1E5E, 0x1E63, 0x1E69,
0x1E6E, 0x1E74, 0x1E79, 0x1E7F, 0x1E84, 0x1E8A, 0x1E8F, 0x1E94, 0x1E9A, 0x1E9F, 0x1EA5, 0x1EAA,
0x1EB0, 0x1EB5, 0x1EBA, 0x1EC0, 0x1EC5, 0x1ECB, 0x1ED0, 0x1ED5, 0x1EDB, 0x1EE0, 0x1EE6, 0x1EEB,
0x1EF0, 0x1EF6, 0x1EFB, 0x1F00, 0x1F06, 0x1F0B, 0x1F10, 0x1F16, 0x1F1B, 0x1F20, 0x1F26, 0x1F2B,
0x1F30, 0x1F36, 0x1F3B, 0x1F40, 0x1F45, 0x1F4B, 0x1F50, 0x1F55, 0x1F5A, 0x1F60, 0x1F65, 0x1F6A,
0x1F6F, 0x1F75, 0x1F7A, 0x1F7F, 0x1F84, 0x1F8A, 0x1F8F, 0x1F94, 0x1F99, 0x1F9E, 0x1FA4, 0x1FA9,
0x1FAE, 0x1FB3, 0x1FB8, 0x1FBD, 0x1FC3, 0x1FC8, 0x1FCD, 0x1FD2, 0x1FD7, 0x1FDC, 0x1FE1, 0x1FE6,
0x1FEC, 0x1FF1, 0x1FF6, 0x1FFB, 0x2000,
};
/* 80267640-80267674 261F80 0034+00 1/1 0/0 0/0 .text U_GetAtanTable__Fff */
u16 U_GetAtanTable(float f0, float f1) {
return atntable[(int)(f0 / f1 * 0x400)];
}
/* 80267674-80267814 261FB4 01A0+00 1/1 82/82 822/822 .text cM_atan2s__Fff */
s16 cM_atan2s(float y, float x) {
u32 ret;
if (fabsf(y) < G_CM3D_F_ABS_MIN) {
if (x >= 0.0f) {
ret = 0;
} else {
ret = 0x8000;
}
} else if (fabsf(x) < G_CM3D_F_ABS_MIN) {
if (y >= 0.0f) {
ret = 0x4000;
} else {
ret = 0xC000;
}
} else if (y >= 0.0f) {
if (x >= 0.0f) {
if (x >= y) {
ret = U_GetAtanTable(y, x);
} else {
ret = 0x4000 - U_GetAtanTable(x, y);
}
} else {
if (-x < y) {
ret = U_GetAtanTable(-x, y) + 0x4000;
} else {
ret = 0x8000 - U_GetAtanTable(y, -x);
}
}
} else if (x < 0.0f) {
if (x <= y) {
ret = U_GetAtanTable(-y, -x) + 0x8000;
} else {
ret = 0xC000 - U_GetAtanTable(-x, -y);
}
} else {
if (x < -y) {
ret = U_GetAtanTable(x, -y) + 0xC000;
} else {
ret = -U_GetAtanTable(-y, x);
}
}
return ret;
}
/* 80267814-8026785C 262154 0048+00 0/0 4/4 5/5 .text cM_atan2f__Fff */
float cM_atan2f(float y, float x) {
return ((2 * M_PI) / 0x10000) * cM_atan2s(y, x);
}
/* ############################################################################################## */
/* 80451168-8045116C 000668 0004+00 2/2 0/0 0/0 .sbss r0 */
static s32 r0;
/* 8045116C-80451170 00066C 0004+00 2/2 0/0 0/0 .sbss r1 */
static s32 r1;
/* 80451170-80451174 000670 0004+00 2/2 0/0 0/0 .sbss r2 */
static s32 r2;
/* 8026785C-8026786C 26219C 0010+00 0/0 1/1 0/0 .text cM_initRnd__Fiii */
void cM_initRnd(int s0, int s1, int s2) {
r0 = s0;
r1 = s1;
r2 = s2;
}
/* 8026786C-80267954 2621AC 00E8+00 2/2 15/15 113/113 .text cM_rnd__Fv */
/**
* Gets a random value
* @return a random value
*/
float cM_rnd() {
r0 = (r0 * 171) % 30269;
r1 = (r1 * 172) % 30307;
r2 = (r2 * 170) % 30323;
return fabsf(fmod(r0 / 30269.0f + r1 / 30307.0f + r2 / 30323.0f, 1.0));
}
/* 80267954-8026798C 262294 0038+00 0/0 34/34 951/951 .text cM_rndF__Ff */
/**
* Gets a random value between 0 and a given upper bound
* @param max The upper bound the random value can be
* @return a random value between 0 and `max`
*/
float cM_rndF(float max) {
return cM_rnd() * max;
}
/* 8026798C-802679D4 2622CC 0048+00 0/0 24/24 450/450 .text cM_rndFX__Ff */
/**
* Gets a random value between given bounds
* @param max The upper and lower bound the random value can be
* @return a random value between -`max` and +`max`
*/
float cM_rndFX(float max) {
return max * (cM_rnd() - 0.5f) * 2.0f;
}
/* ############################################################################################## */
/* 80451174-80451178 000674 0004+00 2/2 0/0 0/0 .sbss r02 */
static s32 r02;
/* 80451178-8045117C 000678 0004+00 2/2 0/0 0/0 .sbss r12 */
static s32 r12;
/* 8045117C-80451180 00067C 0004+00 2/2 0/0 0/0 .sbss r22 */
static s32 r22;
/* 802679D4-802679E4 262314 0010+00 0/0 0/0 8/8 .text cM_initRnd2__Fiii */
void cM_initRnd2(int s0, int s1, int s2) {
r02 = s0;
r12 = s1;
r22 = s2;
}
/* 802679E4-80267ACC 262324 00E8+00 2/2 0/0 0/0 .text cM_rnd2__Fv */
float cM_rnd2() {
r02 = (r02 * 171) % 30269;
r12 = (r12 * 172) % 30307;
r22 = (r22 * 170) % 30323;
return fabsf(fmod(r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f, 1.0));
}
/* 80267ACC-80267B04 26240C 0038+00 0/0 0/0 14/14 .text cM_rndF2__Ff */
float cM_rndF2(float max) {
return cM_rnd2() * max;
}
/* 80267B04-80267B4C 262444 0048+00 0/0 0/0 7/7 .text cM_rndFX2__Ff */
float cM_rndFX2(float max) {
return max * (cM_rnd2() - 0.5f) * 2.0f;
}
+123
View File
@@ -0,0 +1,123 @@
/**
* c_node.cpp
*
*/
#include "SSystem/SComponent/c_node.h"
#include "dolphin/types.h"
/* 802660D0-802660DC 000C+00 s=1 e=0 z=0 None .text cNd_Join__FP10node_classP10node_class */
void cNd_Join(node_class* node_a, node_class* node_b) {
node_a->mpNextNode = node_b;
node_b->mpPrevNode = node_a;
}
/* 802660DC-8026610C 0030+00 s=0 e=2 z=0 None .text cNd_LengthOf__FP10node_class */
int cNd_LengthOf(node_class* node) {
int count = 0;
while (node) {
count++;
node = NODE_GET_NEXT(node);
}
return count;
}
/* 8026610C-8026613C 0030+00 s=0 e=1 z=0 None .text cNd_First__FP10node_class */
node_class* cNd_First(node_class* node) {
node_class* ret = NULL;
while (node) {
ret = node;
node = NODE_GET_PREV(node);
}
return ret;
}
/* 8026613C-8026616C 0030+00 s=1 e=1 z=0 None .text cNd_Last__FP10node_class */
node_class* cNd_Last(node_class* node) {
node_class* ret = NULL;
while (node) {
ret = node;
node = NODE_GET_NEXT(node);
}
return ret;
}
/* 8026616C-802661BC 0050+00 s=0 e=1 z=0 None .text cNd_Order__FP10node_classi */
node_class* cNd_Order(node_class* node, int idx) {
node_class* ret = NULL;
int i = 0;
while (i < idx && node) {
ret = node;
i++;
node = NODE_GET_NEXT(node);
}
if (i < idx)
return ret;
return NULL;
}
/* 802661BC-802661F0 0034+00 s=0 e=1 z=0 None .text cNd_SingleCut__FP10node_class */
void cNd_SingleCut(node_class* node) {
node_class* prev = node->mpPrevNode;
node_class* next = node->mpNextNode;
if (prev)
prev->mpNextNode = node->mpNextNode;
if (next)
next->mpPrevNode = node->mpPrevNode;
node->mpPrevNode = NULL;
node->mpNextNode = NULL;
}
/* 802661F0-80266210 0020+00 s=1 e=0 z=0 None .text cNd_Cut__FP10node_class */
void cNd_Cut(node_class* node) {
if (node->mpPrevNode)
node->mpPrevNode->mpNextNode = NULL;
node->mpPrevNode = NULL;
}
/* 80266210-80266244 0034+00 s=1 e=1 z=0 None .text cNd_Addition__FP10node_classP10node_class
*/
void cNd_Addition(node_class* node_a, node_class* node_b) {
node_class* pLast = cNd_Last(node_a);
cNd_Join(pLast, node_b);
}
/* 80266244-802662B0 006C+00 s=0 e=1 z=0 None .text cNd_Insert__FP10node_classP10node_class */
void cNd_Insert(node_class* node_a, node_class* node_b) {
node_class* prev = node_a->mpPrevNode;
if (prev == NULL) {
cNd_Addition(node_b, node_a);
} else {
cNd_Cut(node_a);
cNd_Addition(prev, node_b);
cNd_Addition(node_b, node_a);
}
}
/* 802662B0-802662D8 0028+00 s=1 e=2 z=0 None .text cNd_SetObject__FP10node_classPv */
void cNd_SetObject(node_class* node, void* data) {
while (node) {
node->mpData = data;
node = NODE_GET_NEXT(node);
}
}
/* 802662D8-802662FC 0024+00 s=0 e=1 z=0 None .text cNd_ClearObject__FP10node_class */
void cNd_ClearObject(node_class* node) {
cNd_SetObject(node, NULL);
}
/* 802662FC-80266310 0014+00 s=0 e=1 z=0 None .text cNd_ForcedClear__FP10node_class */
void cNd_ForcedClear(node_class* node) {
node->mpPrevNode = NULL;
node->mpNextNode = NULL;
node->mpData = NULL;
}
/* 80266310-80266324 0014+00 s=0 e=2 z=0 None .text cNd_Create__FP10node_classPv */
void cNd_Create(node_class* node, void* data) {
node->mpPrevNode = NULL;
node->mpNextNode = NULL;
node->mpData = data;
}
+41
View File
@@ -0,0 +1,41 @@
/**
* c_node_iter.cpp
*
*/
#include "SSystem/SComponent/c_node_iter.h"
#include "SSystem/SComponent/c_node.h"
#include "dolphin/types.h"
/* 80266324-802663B4 0090+00 s=0 e=1 z=0 None .text
* cNdIt_Method__FP10node_classPFP10node_classPv_iPv */
int cNdIt_Method(node_class* node, cNdIt_MethodFunc method, void* data) {
int ret = 1;
node_class* pNext = NODE_GET_NEXT(node);
while (node) {
int methodRet = method(node, data);
if (!methodRet)
ret = 0;
node = pNext;
pNext = NODE_GET_NEXT(pNext);
}
return ret;
}
/* 802663B4-80266440 008C+00 s=0 e=1 z=0 None .text
* cNdIt_Judge__FP10node_classPFP10node_classPv_PvPv */
void* cNdIt_Judge(node_class* node, cNdIt_JudgeFunc judge, void* data) {
node_class* pNext = NODE_GET_NEXT(node);
while (node) {
void* ret = judge(node, data);
if (ret != NULL)
return ret;
node = pNext;
pNext = NODE_GET_NEXT(pNext);
}
return NULL;
}
+90
View File
@@ -0,0 +1,90 @@
/**
* c_phase.cpp
*
*/
#include "SSystem/SComponent/c_phase.h"
/* 80266624-80266630 000C+00 s=1 e=2 z=0 None .text
* cPhs_Reset__FP30request_of_phase_process_class */
void cPhs_Reset(request_of_phase_process_class* phase) {
phase->id = cPhs_INIT_e;
}
/* 80266630-80266640 0010+00 s=0 e=3 z=0 None .text
* cPhs_Set__FP30request_of_phase_process_classPPFPv_i */
void cPhs_Set(request_of_phase_process_class* phase, cPhs__Handler* handlerTbl) {
phase->mpHandlerTable = handlerTbl;
phase->id = cPhs_INIT_e;
}
/* 80266640-80266668 0028+00 s=1 e=0 z=0 None .text
* cPhs_UnCompleate__FP30request_of_phase_process_class */
void cPhs_UnCompleate(request_of_phase_process_class* phase) {
phase->mpHandlerTable = NULL;
cPhs_Reset(phase);
}
/* 80266668-80266678 0010+00 s=2 e=0 z=0 None .text
* cPhs_Compleate__FP30request_of_phase_process_class */
int cPhs_Compleate(request_of_phase_process_class* phase) {
phase->mpHandlerTable = NULL;
return cPhs_COMPLEATE_e;
}
/* 80266678-802666D8 0060+00 s=1 e=0 z=0 None .text cPhs_Next__FP30request_of_phase_process_class
*/
int cPhs_Next(request_of_phase_process_class* phase) {
if (const cPhs__Handler* handlerTable = phase->mpHandlerTable) {
phase->id++;
cPhs__Handler handler = handlerTable[phase->id];
// Double null check here actually matters for emitted assembly.
// Wee old compilers.
if (handler == NULL || handler == NULL) {
return cPhs_Compleate(phase);
} else {
return cPhs_LOADING_e;
}
}
return cPhs_COMPLEATE_e;
}
/* 802666D8-802667AC 00D4+00 s=1 e=3 z=0 None .text cPhs_Do__FP30request_of_phase_process_classPv
*/
int cPhs_Do(request_of_phase_process_class* phase, void* data) {
cPhs__Handler* handler = phase->mpHandlerTable;
if (handler) {
handler += phase->id;
int newStep = (*handler)(data);
switch (newStep) {
case cPhs_LOADING_e:
return cPhs_Next(phase);
case cPhs_NEXT_e:
return cPhs_Next(phase) == cPhs_LOADING_e ? cPhs_NEXT_e : cPhs_COMPLEATE_e;
case cPhs_COMPLEATE_e:
return cPhs_Compleate(phase);
case cPhs_UNK3_e:
cPhs_UnCompleate(phase);
return cPhs_UNK3_e;
case cPhs_ERROR_e:
cPhs_UnCompleate(phase);
return cPhs_ERROR_e;
case cPhs_INIT_e:
default:
return newStep;
}
}
return cPhs_Compleate(phase);
}
/* 802667AC-802667D4 0028+00 s=0 e=2 z=0 None .text
* cPhs_Handler__FP30request_of_phase_process_classPPFPv_iPv */
int cPhs_Handler(request_of_phase_process_class* phase, cPhs__Handler* handlerTbl, void* data) {
phase->mpHandlerTable = handlerTbl;
return cPhs_Do(phase, data);
}
+35
View File
@@ -0,0 +1,35 @@
/**
* c_request.cpp
*
*/
#include "SSystem/SComponent/c_request.h"
/* 802667D4-80266800 261114 002C+00 0/0 3/3 0/0 .text cReq_Is_Done__FP18request_base_class */
int cReq_Is_Done(request_base_class* i_this) {
if (i_this->field_0x0.flag1 == 1) {
i_this->field_0x0.flag1 = 0;
return 1;
}
return 0;
}
/* 80266800-80266830 261140 0030+00 0/0 3/3 0/0 .text cReq_Done__FP18request_base_class
*/
void cReq_Done(request_base_class* i_this) {
i_this->field_0x0.flag0 = 0;
i_this->field_0x0.flag1 = 1;
i_this->field_0x0.flag2 = 0;
}
/* 80266830-80266850 261170 0020+00 0/0 2/2 0/0 .text cReq_Command__FP18request_base_classUc */
void cReq_Command(request_base_class* i_this, u8 param_1) {
cReq_Create(i_this, param_1);
}
/* 80266850-80266880 261190 0030+00 1/1 2/2 0/0 .text cReq_Create__FP18request_base_classUc */
void cReq_Create(request_base_class* i_this, u8 param_1) {
i_this->field_0x0.flag0 = 1;
i_this->field_0x0.flag1 = 0;
i_this->field_0x0.flag2 = param_1;
}
+37
View File
@@ -0,0 +1,37 @@
/**
* c_sxyz.cpp
*
*/
#include "SSystem/SComponent/c_sxyz.h"
const csXyz csXyz::Zero = csXyz(0, 0, 0);
/* 802673F4-80267404 0010+00 s=4 e=19 z=119 None .text __ct__5csXyzFsss */
csXyz::csXyz(s16 x, s16 y, s16 z) {
this->x = x;
this->y = y;
this->z = z;
}
/* 80267404-8026745C 0058+00 s=0 e=0 z=3 None .text __pl__5csXyzFR5csXyz */
csXyz csXyz::operator+(csXyz& other) {
return csXyz(x + other.x, y + other.y, z + other.z);
}
/* 8026745C-80267490 0034+00 s=0 e=2 z=11 None .text __apl__5csXyzFR5csXyz */
void csXyz::operator+=(csXyz& other) {
x += other.x;
y += other.y;
z += other.z;
}
/* 80267490-802674E8 0058+00 s=0 e=0 z=1 None .text __mi__5csXyzFR5csXyz */
csXyz csXyz::operator-(csXyz& other) {
return csXyz(x - other.x, y - other.y, z - other.z);
}
/* 802674E8-8026758C 00A4+00 s=0 e=0 z=1 None .text __ml__5csXyzFf */
csXyz csXyz::operator*(f32 mul) {
return csXyz(x * mul, y * mul, z * mul);
}
+96
View File
@@ -0,0 +1,96 @@
/**
* c_tag.cpp
*
*/
#include "SSystem/SComponent/c_tag.h"
#include "SSystem/SComponent/c_list.h"
#include "SSystem/SComponent/c_tree.h"
/* 80266880-8026688C 000C+00 s=0 e=3 z=0 None .text cTg_IsUse__FP16create_tag_class */
int cTg_IsUse(create_tag_class* tag) {
return tag->mbIsUse;
}
/* 8026688C-802668CC 0040+00 s=0 e=4 z=0 None .text cTg_SingleCutFromTree__FP16create_tag_class
*/
int cTg_SingleCutFromTree(create_tag_class* tag) {
if (tag->mbIsUse == true) {
tag->mbIsUse = false;
cTr_SingleCut(&tag->mpNode);
return true;
} else {
return false;
}
}
/* 802668CC-8026691C 0050+00 s=0 e=3 z=0 None .text
* cTg_AdditionToTree__FP21node_lists_tree_classiP16create_tag_class */
int cTg_AdditionToTree(node_lists_tree_class* tree, int listIdx, create_tag_class* tag) {
if (!tag->mbIsUse) {
int ret = cTr_Addition(tree, listIdx, &tag->mpNode);
if (ret) {
tag->mbIsUse = true;
return ret;
}
}
return 0;
}
/* 8026691C-8026696C 0050+00 s=0 e=1 z=0 None .text
* cTg_InsertToTree__FP21node_lists_tree_classiP16create_tag_classi */
int cTg_InsertToTree(node_lists_tree_class* tree, int listIdx, create_tag_class* tag, int idx) {
if (!tag->mbIsUse) {
int ret = cTr_Insert(tree, listIdx, &tag->mpNode, idx);
if (ret) {
tag->mbIsUse = true;
return ret;
}
}
return 0;
}
/* 8026696C-802669A4 0038+00 s=0 e=1 z=0 None .text cTg_GetFirst__FP15node_list_class */
node_class* cTg_GetFirst(node_list_class* list) {
create_tag_class* tag = (create_tag_class*)cLs_GetFirst(list);
if (tag != NULL) {
tag->mbIsUse = false;
} else {
tag = NULL;
}
return &tag->mpNode;
}
/* 802669A4-802669E4 0040+00 s=0 e=7 z=0 None .text cTg_SingleCut__FP16create_tag_class */
int cTg_SingleCut(create_tag_class* tag) {
if (tag->mbIsUse == 1) {
tag->mbIsUse = false;
cLs_SingleCut(&tag->mpNode);
return 1;
}
return 0;
}
/* 802669E4-80266A34 0050+00 s=0 e=7 z=0 None .text
* cTg_Addition__FP15node_list_classP16create_tag_class */
int cTg_Addition(node_list_class* list, create_tag_class* tag) {
if (!tag->mbIsUse) {
int ret = cLs_Addition(list, &tag->mpNode);
if (ret) {
tag->mbIsUse = true;
return ret;
}
}
return 0;
}
/* 80266A34-80266A7C 0048+00 s=0 e=10 z=0 None .text cTg_Create__FP16create_tag_classPv */
void cTg_Create(create_tag_class* tag, void* data) {
cNd_Create(&tag->mpNode, NULL);
tag->mpTagData = data;
tag->mbIsUse = false;
}
+19
View File
@@ -0,0 +1,19 @@
/**
* c_tag_iter.cpp
*
*/
#include "SSystem/SComponent/c_tag_iter.h"
#include "SSystem/SComponent/c_tag.h"
/* 80266A7C-80266AB0 0034+00 s=0 e=4 z=0 None .text
* cTgIt_MethodCall__FP16create_tag_classP13method_filter */
int cTgIt_MethodCall(create_tag_class* tag, method_filter* filter) {
return filter->mpMethodFunc((node_class*)tag->mpTagData, filter->mpUserData);
}
/* 80266AB0-80266AE4 0034+00 s=0 e=5 z=0 None .text
* cTgIt_JudgeFilter__FP16create_tag_classP12judge_filter */
void* cTgIt_JudgeFilter(create_tag_class* tag, judge_filter* filter) {
return filter->mpJudgeFunc((node_class*)tag->mpTagData, filter->mpUserData);
}
+40
View File
@@ -0,0 +1,40 @@
/**
* c_tree.cpp
*
*/
#include "SSystem/SComponent/c_tree.h"
#include "SSystem/SComponent/c_list.h"
/* 80266440-80266460 0020+00 s=0 e=1 z=0 None .text cTr_SingleCut__FP10node_class */
int cTr_SingleCut(node_class* node) {
return cLs_SingleCut(node);
}
/* 80266460-802664A4 0044+00 s=0 e=1 z=0 None .text
* cTr_Addition__FP21node_lists_tree_classiP10node_class */
int cTr_Addition(node_lists_tree_class* tree, int listIdx, node_class* node) {
if (listIdx >= tree->mNumLists)
return 0;
return cLs_Addition(&tree->mpLists[listIdx], node);
}
/* 802664A4-802664E8 0044+00 s=0 e=1 z=0 None .text
* cTr_Insert__FP21node_lists_tree_classiP10node_classi */
int cTr_Insert(node_lists_tree_class* tree, int listIdx, node_class* node, int idx) {
if (listIdx >= tree->mNumLists)
return 0;
return cLs_Insert(&tree->mpLists[listIdx], idx, node);
}
/* 802664E8-80266540 0058+00 s=0 e=2 z=0 None .text
* cTr_Create__FP21node_lists_tree_classP15node_list_classi */
void cTr_Create(node_lists_tree_class* tree, node_list_class* lists, int numLists) {
tree->mpLists = lists;
tree->mNumLists = numLists;
while (numLists-- > 0)
cLs_Create(lists++);
}
+37
View File
@@ -0,0 +1,37 @@
/**
* c_tree_iter.cpp
*
*/
#include "SSystem/SComponent/c_tree_iter.h"
#include "SSystem/SComponent/c_list.h"
#include "SSystem/SComponent/c_list_iter.h"
#include "SSystem/SComponent/c_tree.h"
#include "dolphin/types.h"
/* 80266540-802665B4 0074+00 s=0 e=2 z=0 None .text
* cTrIt_Method__FP21node_lists_tree_classPFP10node_classPv_iPv */
int cTrIt_Method(node_lists_tree_class* tree, cNdIt_MethodFunc method, void* data) {
node_list_class* list = tree->mpLists;
int i = tree->mNumLists;
int ret = 1;
while (i-- > 0) {
int sub = cLsIt_Method(list++, method, data);
if (sub == 0)
ret = 0;
}
return ret;
}
/* 802665B4-80266624 0070+00 s=0 e=2 z=0 None .text
* cTrIt_Judge__FP21node_lists_tree_classPFP10node_classPv_PvPv */
void* cTrIt_Judge(node_lists_tree_class* tree, cNdIt_JudgeFunc judge, void* data) {
node_list_class* list = tree->mpLists;
int i = tree->mNumLists;
while (i-- > 0) {
void* pJudgeRet = cLsIt_Judge(list++, judge, data);
if (pJudgeRet != NULL)
return pJudgeRet;
}
return NULL;
}
+159
View File
@@ -0,0 +1,159 @@
/**
* c_xyz.cpp
*
*/
#include "SSystem/SComponent/c_xyz.h"
#include "SSystem/SComponent/c_math.h"
/* 80266AE4-80266B34 0050+00 s=0 e=103 z=300 None .text __pl__4cXyzCFRC3Vec */
cXyz cXyz::operator+(const Vec& vec) const {
Vec ret;
VECAdd(this, &vec, &ret);
return cXyz(ret);
}
/* 80266B34-80266B84 0050+00 s=0 e=196 z=1082 None .text __mi__4cXyzCFRC3Vec */
cXyz cXyz::operator-(const Vec& vec) const {
Vec ret;
VECSubtract(this, &vec, &ret);
return cXyz(ret);
}
/* 80266B84-80266BD0 004C+00 s=1 e=99 z=158 None .text __ml__4cXyzCFf */
cXyz cXyz::operator*(f32 scale) const {
Vec ret;
VECScale(this, &ret, scale);
return cXyz(ret);
}
/* 80266BD0-80266C18 0048+00 s=0 e=7 z=0 None .text __ml__4cXyzCFRC3Vec */
cXyz cXyz::operator*(const Vec& vec) const {
cXyz ret;
ret.x = this->x * vec.x;
ret.y = this->y * vec.y;
ret.z = this->z * vec.z;
return cXyz(ret);
}
/* 80266C18-80266C6C 0054+00 s=0 e=3 z=12 None .text __dv__4cXyzCFf */
cXyz cXyz::operator/(f32 scale) const {
Vec ret;
VECScale(this, &ret, 1.0f / scale);
return cXyz(ret);
}
/* 80266C6C-80266CBC 0050+00 s=1 e=0 z=0 None .text getCrossProduct__4cXyzCFRC3Vec */
cXyz cXyz::getCrossProduct(const Vec& vec) const {
Vec ret;
VECCrossProduct(this, &vec, &ret);
return cXyz(ret);
}
/* 80266CBC-80266CE4 0028+00 s=0 e=7 z=6 None .text outprod__4cXyzCFRC3Vec */
cXyz cXyz::outprod(const Vec& vec) const {
return this->getCrossProduct(vec);
}
/* 80266CE4-80266D30 004C+00 s=0 e=10 z=1 None .text norm__4cXyzCFv */
cXyz cXyz::norm() const {
Vec ret;
VECNormalize(this, &ret);
return cXyz(ret);
}
/* 80266D30-80266DC4 0094+00 s=1 e=4 z=0 None .text normZP__4cXyzCFv */
cXyz cXyz::normZP() const {
Vec vec;
if (this->isNearZeroSquare() == false) {
VECNormalize(this, &vec);
} else {
vec = cXyz::Zero;
}
return cXyz(vec);
}
// doesn't exist in debug rom, but needed to match?
inline void normToUpZIfNearZero(Vec& vec) {
if (cXyz(vec).isNearZeroSquare()) {
vec.x = 0.0f;
vec.y = 0.0f;
vec.z = 1.0f;
const Vec v = {0, 0, 1};
vec = v;
}
}
/* 80266DC4-80266EF4 0130+00 s=0 e=0 z=2 None .text normZC__4cXyzCFv */
cXyz cXyz::normZC() const {
Vec outVec;
if (this->isNearZeroSquare() == false) {
VECNormalize(this, &outVec);
} else {
outVec = (*this * 1.25f * 1000000.0f).normZP();
normToUpZIfNearZero(outVec);
}
return outVec;
}
/* 80266EF4-80266F48 0054+00 s=0 e=13 z=17 None .text normalize__4cXyzFv */
cXyz cXyz::normalize() {
VECNormalize(this, this);
return *this;
}
/* 80266F48-80266FDC 0094+00 s=0 e=19 z=59 None .text normalizeZP__4cXyzFv */
cXyz cXyz::normalizeZP() {
if (this->isNearZeroSquare() == false) {
VECNormalize(this, this);
} else {
*this = cXyz::Zero;
}
return *this;
}
/* 80266FDC-8026702C 0050+00 s=0 e=2 z=3 None .text normalizeRS__4cXyzFv */
bool cXyz::normalizeRS() {
if (this->isNearZeroSquare()) {
return false;
} else {
VECNormalize(this, this);
return true;
}
}
/* 8026702C-8026706C 0040+00 s=0 e=5 z=9 None .text __eq__4cXyzCFRC3Vec */
bool cXyz::operator==(const Vec& vec) const {
return this->x == vec.x && this->y == vec.y && this->z == vec.z;
}
/* 8026706C-802670AC 0040+00 s=0 e=6 z=6 None .text __ne__4cXyzCFRC3Vec */
bool cXyz::operator!=(const Vec& vec) const {
return !(this->x == vec.x && this->y == vec.y && this->z == vec.z);
}
/* 802670AC-80267128 007C+00 s=0 e=4 z=7 None .text isZero__4cXyzCFv */
bool cXyz::isZero() const {
return fabsf(this->x) < 32.0f * FLT_EPSILON && fabsf(this->y) < 32.0f * FLT_EPSILON &&
fabsf(this->z) < 32.0f * FLT_EPSILON;
}
/* 80267128-80267150 0028+00 s=0 e=81 z=85 None .text atan2sX_Z__4cXyzCFv */
s16 cXyz::atan2sX_Z() const {
return cM_atan2s(this->x, this->z);
}
/* 80267150-80267290 0140+00 s=0 e=21 z=33 None .text atan2sY_XZ__4cXyzCFv */
s16 cXyz::atan2sY_XZ() const {
f32 mag = this->getMagXZ();
return cM_atan2s(-this->y, sqrtf(mag));
}
const cXyz cXyz::Zero(0, 0, 0);
const cXyz cXyz::BaseX(1, 0, 0);
const cXyz cXyz::BaseY(0, 1, 0);
const cXyz cXyz::BaseZ(0, 0, 1);
const cXyz cXyz::BaseXY(1, 1, 0);
const cXyz cXyz::BaseXZ(1, 0, 1);
const cXyz cXyz::BaseYZ(0, 1, 1);
const cXyz cXyz::BaseXYZ(1, 1, 1);