Merge branch '🥚' of https://github.com/robojumper/ss into pr/142

This commit is contained in:
elijah-thomas774
2025-03-23 21:01:23 -04:00
15 changed files with 400 additions and 48 deletions
+2
View File
@@ -18,6 +18,8 @@ public:
void *param_6, int param_7, int param_8
);
static void setUpLightSet(nw4r::g3d::LightSetting&, nw4r::g3d::ResAnmScn, int);
private:
static MEMAllocator *sAllocator;
};
+50 -11
View File
@@ -4,6 +4,9 @@
#include "egg/egg_types.h"
#include "egg/gfx/eggLightObject.h"
#include "egg/prim/eggBinary.h"
#include "nw4r/g3d/g3d_light.h"
#include "nw4r/g3d/res/g3d_resanmamblight.h"
#include "nw4r/g3d/res/g3d_resanmscn.h"
#include "nw4r/types_nw4r.h"
#include "rvl/GX/GXLight.h"
#include "rvl/GX/GXTypes.h"
@@ -20,18 +23,36 @@ class LightManager : public IBinary<LightManager> {
union Counts {
struct {
/* 0x00 */ u8 mNumEggLightObjects;
/* 0x01 */ u8 mNumUnks;
/* 0x01 */ u8 mNumAmbientObjects;
};
};
struct Unk1 {
/* 0x00 */ GXColor mColor;
/* 0x04 */ const char *mStr;
struct AmbientObject {
/* 0x00 */ nw4r::g3d::AmbLightObj mLightObj;
/* 0x04 */ const char *mLightName;
/* 0x08 */ u8 field_0x08;
};
public:
struct BinData {};
struct BinAmbient {
/* 0x00 */ u8 field_0x00;
/* 0x01 */ u8 field_0x01;
/* 0x02 */ u8 field_0x02;
/* 0x03 */ u8 field_0x03;
/* 0x04 */ u8 field_0x04;
/* 0x05 */ u8 field_0x05;
/* 0x06 */ u8 field_0x06;
/* 0x07 */ u8 field_0x07;
};
struct BinData {
/* 0x00 */ u16 mNumLightObjects;
/* 0x02 */ u16 mNumAmbientObjects;
/* 0x04 */ GXColor mColor;
/* 0x08 */ u8 _0x08[0x18 - 0x08];
/* 0x18 */ LightObject::Bin mObjData[1];
};
// vt at 0x00
LightManager(u32, u32, u8);
virtual ~LightManager();
@@ -44,28 +65,46 @@ public:
virtual void CalcView(const nw4r::math::MTX34 &, u8, nw4r::g3d::ScnRoot *);
virtual void DoneDraw();
void LoadLightSet(int, u32 *, u32 *, u32 *, u32 *, GXColor *);
void LoadScnLightInner(nw4r::g3d::ResAnmScn, f32, s16, u32);
void AnmScnRes_GetAmbLightColor(AmbientObject *, nw4r::g3d::ResAnmAmbLight, f32) const;
void CopyToG3D_Ambient(nw4r::g3d::ScnRoot *) const;
void CopyToG3D_World(nw4r::g3d::ScnRoot *) const;
void CopyToG3D_View(nw4r::g3d::ScnRoot *, const nw4r::math::MTX34 &) const;
void BecomeInvalidLight(int);
LightTextureManager *GetTextureMgr() const {
return mpTextureMgr;
}
static u16 CheckedNumLightObjs(u8 num) {
return num < 8 ? num : 8;
}
const LightObject *GetLightObject(int i) const {
return &mpLightData[i].mLightObject;
}
LightObject *GetLightObject(int i) {
return &mpLightData[i].mLightObject;
}
/* 0x04 */ Counts mCounts0x04;
/* 0x06 */ Counts mCounts0x06;
/* 0x04 */ Counts mCounts;
/* 0x06 */ Counts mSavedCounts;
/* 0x08 */ LightData *mpLightData;
/* 0x0C */ Unk1 *mpUnk1;
/* 0x0C */ AmbientObject *mpAmbientObjects;
/* 0x10 */ GXLightObj *mpLightObjs;
/* 0x14 */ LightTextureManager *mpTextureMgr;
/* 0x18 */ GXColor mColor;
/* 0x1C */ u8 field_0x1C;
/* 0x1C */ u8 mNumGxObjsPerEggObj;
/* 0x1D */ u8 field_0x1D;
/* 0x1E */ u16 mFlags;
/* 0x20 */ u32 field_0x20;
/* 0x24 */ s16 field_0x24;
/* 0x20 */ nw4r::g3d::ResAnmScn mResAnmScn;
/* 0x24 */ s16 mRefNumber;
};
} // namespace EGG
+46 -2
View File
@@ -7,12 +7,32 @@
#include "nw4r/math/math_types.h"
#include "rvl/GX/GXLight.h"
#include "rvl/GX/GXTypes.h"
#include "rvl/MTX/mtx.h"
namespace EGG {
class LightObject : public IBinary<LightObject> {
public:
struct BinData {};
struct BinData {
/* 0x00 */ u8 mSpotFn;
/* 0x01 */ u8 mDistAttnFn;
/* 0x02 */ u8 field_0x02;
/* 0x03 */ u8 field_0x03;
/* 0x04 */ u16 mIndex;
/* 0x06 */ u16 mFlags;
/* 0x08 */ Vec mPos;
/* 0x14 */ Vec mAt;
/* 0x20 */ f32 field_0x20;
/* 0x24 */ GXColor mWhite;
/* 0x28 */ GXColor mBlack;
/* 0x2C */ f32 field_0x2C;
/* 0x30 */ f32 field_0x30;
/* 0x34 */ f32 field_0x34;
/* 0x38 */ f32 field_0x38;
/* 0x3C */ u16 field_0x3C;
/* 0x3E */ u16 field_0x3E;
};
LightObject();
virtual ~LightObject() {}
@@ -66,10 +86,34 @@ public:
field_0xA0 = 0;
}
void ClearFlag4() {
void ClearFlag2() {
mFlags = mFlags & 0xFFFE;
}
bool CheckFlag1() const {
return (mFlags & 1) != 0;
}
void SetOtherFlag1() {
field_0xA0 |= 1;
}
void ClearOtherFlag1() {
field_0xA0 = field_0xA0 & ~1;
}
bool CheckFlag2() const {
return (mFlags & 2) != 0;
}
u16 GetField0x06() const {
return field_0x06;
}
void UpdatePosAt(LightObject &other) {
SetPosAt(other.mPos, other.mAt);
}
private:
/* 0x04 */ u16 mIndex;
/* 0x06 */ u16 field_0x06;
+1
View File
@@ -30,6 +30,7 @@ public:
int replaceModelTextures(nw4r::g3d::ResMdl) const;
int replaceModelTexture(u16, nw4r::g3d::ResMdl) const;
void drawAndCaptureTexture(f32, f32, f32, f32);
void frameReset();
// Inofficial
static const void *getLtexFromLmap(const void *lmap, u16 index);