move / fix bunch of stuff (#133)

* fix some class structures / d_event wip

* d_event wip

* move gamepad stuff

* move m_Do_main

* move d_bomb / partial m_Do_reset

* format

* remove asm

* add Z2SoundID enum

* move some Z2 classes

* fix

* move more Z2 stuff

* fix fopAc_ac_c more
This commit is contained in:
TakaRikka
2021-06-12 15:22:36 -07:00
committed by GitHub
parent 5be309a186
commit 4448c08ac0
132 changed files with 6755 additions and 3217 deletions
+23
View File
@@ -1,6 +1,29 @@
#ifndef J3DSTRUCT_H
#define J3DSTRUCT_H
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/gx/GXTexture.h"
#include "dolphin/types.h"
struct J3DLightInfo {
/* 803256C4 */ void operator=(J3DLightInfo const&);
/* 0x00 */ cXyz mLightPosition;
/* 0x0C */ cXyz mLightDirection;
/* 0x18 */ _GXColor mColor;
/* 0x1C */ f32 mA0;
/* 0x20 */ f32 mA1;
/* 0x24 */ f32 mA2;
/* 0x28 */ f32 mK0;
/* 0x2C */ f32 mK1;
/* 0x30 */ f32 mK2;
}; // Size = 0x34
struct J3DLightObj {
/* 80018C0C */ J3DLightObj();
/* 0x00 */ J3DLightInfo mInfo;
/* 0x34 */ u8 field_0x34[64];
}; // Size = 0x74
#endif /* J3DSTRUCT_H */
+18 -2
View File
@@ -8,8 +8,9 @@
class JAISoundID {
public:
operator u32() const { return this->mId; }
void operator=(JAISoundID const&);
JAISoundID(u32 pId) : mId(pId) {}
JAISoundID(u32 pId);
JAISoundID(JAISoundID const& other);
@@ -62,7 +63,7 @@ public:
/* 802A26B8 */ void calc_JAISound_();
/* 802A29DC */ void initTrack_JAISound_(JASTrack*);
JAISoundID getID() const { return JAISoundID((u32)this->sound_id); }
JAISoundID getID() const;
u32 getUserData() const { return user_data; }
// TODO: do proper struct later
@@ -167,4 +168,19 @@ private:
JAISound* mSound;
};
class JAISoundHandles {
public:
JAISoundHandles(JAISoundHandle* pHandle, int param_1) {
mSoundHandle = pHandle;
field_0x04 = param_1;
};
void getHandleSoundID(JAISoundID);
void getFreeHandle();
private:
JAISoundHandle* mSoundHandle;
int field_0x04;
};
#endif /* JAISOUND_H */
+92
View File
@@ -20,6 +20,98 @@ struct TVec3<f32> {
};
*/
template <typename T>
struct TVec2 {
TVec2() {}
TVec2(T x, T y) { set(x, y); }
void set(T x, T y) {
this->x = x;
this->y = y;
}
void set(const TVec2& other) {
x = other.x;
y = other.y;
}
void setMin(const TVec2<f32>& min) {
if (min.x <= x)
x = min.x;
if (min.y <= y)
y = min.y;
}
void setMax(const TVec2<f32>& max) {
if (x <= max.x)
x = max.x;
if (y <= max.y)
y = max.y;
}
void add(const TVec2<T>& other) {
x += other.x;
y += other.y;
}
bool isAbove(const TVec2<T>& other) const {
return (other.x <= x) && (other.y <= y) ? true : false;
}
T x;
T y;
};
template <class T>
struct TBox {
TBox() : i(), f() {}
TBox(const TBox& other) : i(other.f), f(other.y) {}
T i, f;
};
// clang-format off
template<> struct TBox<TVec2<f32> > {
f32 getWidth() const { return f.x - i.x; }
f32 getHeight() const { return f.y - i.y; }
inline void operator= (const TBox<TVec2<f32> >& rhs) {
// ???
*(u32*)&i.x = *(u32*)&rhs.i.x;
*(u32*)&i.y = *(u32*)&rhs.i.y;
*(u32*)&f.x = *(u32*)&rhs.f.x;
*(u32*)&f.y = *(u32*)&rhs.f.y;
}
bool isValid() const { return f.isAbove(i); }
void addPos(const TVec2<f32>& pos) {
i.add(pos);
f.add(pos);
}
bool intersect(const TBox<TVec2<f32> >& other) {
i.setMax(other.i);
f.setMin(other.f);
return isValid();
}
TVec2<f32> i, f;
};
template <typename T>
struct TBox2 : TBox<TVec2<T> > {
TBox2() {}
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
inline const TBox2& operator=(const TBox2& rhs) { *(TBox<TVec2<T> >*)this = rhs; }
void set(const TBox2& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32> f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
};
// clang-format on
} // namespace JGeometry
#endif