This commit is contained in:
elijah-thomas774
2024-06-09 23:46:43 -04:00
parent 4e77023d7b
commit e7a7f794d4
5 changed files with 40 additions and 36 deletions
@@ -7,10 +7,10 @@ doDelete__10dTgSndAr_cFv = .text:0x00000220; // type:function size:0x8
actorExecute__10dTgSndAr_cFv = .text:0x00000230; // type:function size:0xCC
draw__10dTgSndAr_cFv = .text:0x00000300; // type:function size:0x8
checkPosInArea__10dTgSndAr_cFR7mVec3_c = .text:0x00000310; // type:function size:0x40
checkAlg0__10dTgSndAr_cFR7mVec3_c = .text:0x00000350; // type:function size:0xF0
checkAlg1__10dTgSndAr_cFR7mVec3_c = .text:0x00000440; // type:function size:0x54
checkAlg2__10dTgSndAr_cFR7mVec3_c = .text:0x000004A0; // type:function size:0x98
checkAlg3__10dTgSndAr_cFR7mVec3_c = .text:0x00000540; // type:function size:0x14C
checkAlg0__10dTgSndAr_cFRC7mVec3_c = .text:0x00000350; // type:function size:0xF0
checkAlg1__10dTgSndAr_cFRC7mVec3_c = .text:0x00000440; // type:function size:0x54
checkAlg2__10dTgSndAr_cFRC7mVec3_c = .text:0x000004A0; // type:function size:0x98
checkAlg3__10dTgSndAr_cFRC7mVec3_c = .text:0x00000540; // type:function size:0x14C
__dt__10dTgSndAr_cFv = .text:0x00000690; // type:function size:0x70
_ctors = .ctors:0x00000000; // type:label scope:global
_dtors = .dtors:0x00000000; // type:label scope:global
+6 -5
View File
@@ -2,10 +2,11 @@
#define D_T_SOUND_AREA_H
#include <d/tg/d_tg.h>
#include <m/m_vec.h>
#include <m/m_mtx.h>
#include <m/m_vec.h>
#include <toBeSorted/actor_on_rail.h>
class dTgSndAr_c : public dTg_c {
public:
dTgSndAr_c() {}
@@ -21,10 +22,10 @@ private:
}
bool checkPosInArea(mVec3_c &pos);
bool checkAlg0(mVec3_c &pos);
bool checkAlg1(mVec3_c &pos);
bool checkAlg2(mVec3_c &pos);
bool checkAlg3(mVec3_c &pos);
bool checkAlg0(const mVec3_c &pos);
bool checkAlg1(const mVec3_c &pos);
bool checkAlg2(const mVec3_c &pos);
bool checkAlg3(const mVec3_c &pos);
mMtx_c mtx;
ActorOnRail mRail;
+1 -1
View File
@@ -111,7 +111,7 @@ struct Vector3f : public nw4r::math::VEC3 {
struct Vector2f : nw4r::math::VEC2 {
inline Vector2f() {}
Vector2f(f32 fx, f32 fy) : VEC2(fx, fy) {}
inline ~Vector2f() {}
inline ~Vector2f() {}
public:
/* 805767c0 */ static const Vector2f zero;
+2 -7
View File
@@ -19,16 +19,11 @@ public:
}
mVec3_c(const mVec3_c &other) {
x = other.x;
y = other.y;
z = other.z;
set(other.x, other.y, other.z);
}
/// @brief Constructs a vector from three floating point values.
mVec3_c(f32 fx, f32 fy, f32 fz) {
x = fx;
y = fy;
z = fz;
set(fx, fy, fz);
}
mVec3_c &operator=(const mVec3_c &r) {
+27 -19
View File
@@ -5,6 +5,11 @@
SPECIAL_ACTOR_PROFILE(TAG_SOUND_AREA, dTgSndAr_c, fProfile::TAG_SOUND_AREA, 0x0146, 0, 0);
void float_ordering() {
f32 arr[6] = {0, 100, 100, 100, 100, 100};
0.01f;
}
struct SoundAreaManager {
u8 unk[0xFC];
u32 bgmFlags;
@@ -49,9 +54,7 @@ int dTgSndAr_c::doDelete() {
struct Unk {
u8 unk[0x144];
f32 x;
f32 y;
f32 z;
mVec3_c v;
};
extern Unk *lbl_80575D58;
@@ -63,7 +66,7 @@ int dTgSndAr_c::actorExecute() {
}
if (lbl_80575D58 != nullptr) {
// Halp
mVec3_c pos(lbl_80575D58->x, lbl_80575D58->y, lbl_80575D58->z);
mVec3_c pos = lbl_80575D58->v;
if (checkPosInArea(pos) && lbl_805756EC != nullptr) {
lbl_805756EC->bgmFlags |= 1 << (params & 0xFF);
}
@@ -90,39 +93,44 @@ bool dTgSndAr_c::checkPosInArea(mVec3_c &pos) {
return false;
}
inline bool inRange(f32 val, f32 tolerance) {
return (-tolerance <= val && val <= tolerance);
}
// Box
bool dTgSndAr_c::checkAlg0(mVec3_c &pos) {
bool dTgSndAr_c::checkAlg0(const mVec3_c &pos) {
mVec3_c c2 = pos;
PSMTXMultVec(mtx.m, c2, c2);
f32 scaleX = scale.x;
f32 scaleZ = scale.z;
if (c2.x >= scaleX * -50.0f && c2.x <= scaleX * 50.0f && c2.y >= 0.0f && c2.y <= scale.y * 100.0f &&
c2.z >= scaleZ * -50.0f && c2.z <= scaleZ * 50.0f) {
f32 sxLower = -50.0f * scale.x;
f32 sxUpper = 50.0f * scale.x;
f32 syLower = 0.0f;
f32 syUpper = 100.0f * scale.y;
f32 szLower = -50.0f * scale.z;
f32 szUpper = 50.0f * scale.z;
if (sxLower <= c2.x && c2.x <= sxUpper && syLower <= c2.y && c2.y <= syUpper && szLower <= c2.z &&
c2.z <= szUpper) {
return true;
}
return false;
}
// Sphere
bool dTgSndAr_c::checkAlg1(mVec3_c &pos) {
bool dTgSndAr_c::checkAlg1(const mVec3_c &pos) {
f32 tgtDist = scale.x * 100.0f;
f32 tgtDist2 = tgtDist * tgtDist;
return PSVECSquareDistance(position, pos) < tgtDist2;
}
// Cylinder
bool dTgSndAr_c::checkAlg2(mVec3_c &pos) {
f32 f3 = position.x;
if (pos.y < f3 || (f3 + scale.y * 100.0f < pos.y)) {
bool dTgSndAr_c::checkAlg2(const mVec3_c &pos) {
if (pos.y < position.y || pos.y > (position.y + 100.0f * scale.y)) {
return false;
}
f32 f1 = position.z;
f32 f2 = position.x;
f3 = scale.x * 100.0f;
return f2 * f2 + f1 * f1 <= f3 * f3;
mVec3_c diff(pos.x - position.x, pos.z - position.z, scale.x * 100.0f);
return diff.x * diff.x + diff.y * diff.y <= diff.x * diff.z;
}
// ???
bool dTgSndAr_c::checkAlg3(mVec3_c &pos) {}
bool dTgSndAr_c::checkAlg3(const mVec3_c &pos) {}