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

This commit is contained in:
elijah-thomas774
2025-03-22 20:47:19 -04:00
10 changed files with 170 additions and 48 deletions
+73 -2
View File
@@ -1,3 +1,74 @@
#include "egg/gfx/eggLight.h"
#include "egg/gfx/eggLightManager.h"
namespace EGG {} // namespace EGG
#include "common.h"
#include "egg/egg_types.h"
#include "egg/gfx/eggDrawGX.h"
#include "egg/gfx/eggLightObject.h"
#include "egg/gfx/eggLightTextureMgr.h"
#include "rvl/GX/GXLight.h"
namespace EGG {
LightManager::LightManager(u32 p1, u32 p2, u8 p3) {
Counts c;
c.mNumEggLightObjects = p1;
c.mNumUnks = p2;
mCounts0x04 = c;
mCounts0x06 = c;
mpLightData = nullptr;
mpUnk1 = nullptr;
mpTextureMgr = nullptr;
field_0x1C = p3;
mFlags = 0x40;
field_0x20 = 0;
field_0x24 = -1;
mpTextureMgr = new LightTextureManager(this);
u16 numGxObjs = mCounts0x04.mNumEggLightObjects < 8 ? mCounts0x04.mNumEggLightObjects : 8;
mpLightObjs = new GXLightObj[field_0x1C * numGxObjs]();
mpLightData = new LightData[mCounts0x04.mNumEggLightObjects]();
mpUnk1 = new Unk1[mCounts0x04.mNumUnks]();
for (int i = 0; i < mCounts0x04.mNumEggLightObjects; i++) {
GetLightObject(i)->SetIndex(i);
GetLightObject(i)->ClearField0xA0();
BecomeInvalidLight(i);
}
for (u16 i = 0; i < (u32)mCounts0x04.mNumUnks; i++) {
mpUnk1[i].field_0x08 = 0;
}
Reset();
}
LightManager::~LightManager() {
delete mpTextureMgr;
delete[] mpLightObjs;
delete[] mpLightData;
delete[] mpUnk1;
}
static const char *resetPattern = "--";
void LightManager::Reset() {
for (int i = 0; i < mCounts0x04.mNumEggLightObjects; i++) {
LightObject *obj = GetLightObject(i);
obj->Reset();
if (i > 0) {
obj->ClearFlag4();
}
}
for (u16 i = 0; i < (u32)mCounts0x04.mNumUnks; i++) {
mpUnk1[i].mColor = (GXColor){0x64, 0x64, 0x64, 0xFF};
mpUnk1[i].mStr = resetPattern;
}
mColor = DrawGX::BLACK;
field_0x1D = 0;
mFlags = mFlags & 0xFFE0;
}
} // namespace EGG
+3 -4
View File
@@ -286,9 +286,9 @@ void LightObject::CopyFromG3D(
}
} else {
// TODO
mFlags = mFlags & 0xFFFE;
ClearFlag4();
if (optObj != nullptr) {
optObj->mFlags = optObj->mFlags & 0xFFFE;
optObj->ClearFlag4();
}
}
}
@@ -367,8 +367,7 @@ bool LightObject::ApplyAnmResultB(const nw4r::g3d::LightAnmResult &res) {
mShininess = res.shininess;
return true;
} else {
// TODO
mFlags = mFlags & 0xFFFE;
ClearFlag4();
return false;
}
}
+3
View File
@@ -1,7 +1,9 @@
#include "m/m3d/m3d.h"
#include "egg/gfx/eggDrawGX.h"
#include "egg/gfx/eggFogManager.h"
#include "egg/gfx/eggGfxEngine.h"
#include "egg/gfx/eggLightManager.h"
#include "egg/gfx/eggLightTexture.h"
#include "egg/gfx/eggLightTextureMgr.h"
#include "egg/gfx/eggScreen.h"
@@ -13,6 +15,7 @@
#include "nw4r/g3d/g3d_state.h"
#include "nw4r/g3d/res/g3d_resmat.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
#include "rvl/GX.h" // IWYU pragma: export
namespace m3d {
+1
View File
@@ -2,6 +2,7 @@
#include "d/col/bg/d_bg_w_kcol.h"
#include "d/d_rawarchive.h"
#include "egg/gfx/eggLightTextureMgr.h"
#include "egg/gfx/eggLightManager.h"
#include "m/m3d/m3d.h"
#include "nw4r/g3d.h" // IWYU pragma: export
#include "toBeSorted/arc_managers/current_stage_arc_manager.h"