Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the world folder got hands #327

Merged
merged 26 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion config/SZBE69/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,16 @@
"system/utl/Symbols.cpp": "NonMatching",
"system/utl/Symbols2.cpp": "NonMatching",
"system/utl/Symbols3.cpp": "NonMatching",
"system/utl/Symbols4.cpp": "NonMatching"
"system/utl/Symbols4.cpp": "NonMatching",

"system/world/CameraManager.cpp": "NonMatching",
"system/world/CameraShot.cpp": "NonMatching",
"system/world/ColorPalette.cpp": "NonMatching",
"system/world/Crowd.cpp": "NonMatching",
"system/world/Dir.cpp": "NonMatching",
"system/world/FreeCamera.cpp": "NonMatching",
"system/world/LightHue.cpp": "NonMatching",
"system/world/LightPreset.cpp": "NonMatching"
}
},
"RVL_SDK": {
Expand Down
27 changes: 21 additions & 6 deletions config/SZBE69/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1351,17 +1351,32 @@ system/ui/UIGuide.cpp:
system/ui/Utl.cpp:
.text start:0x8057D224 end:0x8057D398

rb3/unknown/805/unk_8057464C.cpp:
.text start:0x8057D398 end:0x80581A8C
system/world/CameraManager.cpp:
.text start:0x8057D398 end:0x80581A9C
.ctors start:0x807EFFCC end:0x807EFFD0

system/world/CameraShot.cpp:
.text start:0x80581A9C end:0x8058CD34

system/world/Crowd.cpp:
.text start:0x8058D868 end:0x80597134
.text start:0x8058CD34 end:0x80597134

rb3/colorpalette.cpp:
system/world/ColorPalette.cpp:
.text start:0x80597134 end:0x80598310

rb3/stubs/stubonef.cpp:
.text start:0x8059FF1C end:0x8059FF28
system/world/Dir.cpp:
.text start:0x80598310 end:0x8059FD9C
.ctors start:0x807EFFD0 end:0x807EFFD4

system/world/FreeCamera.cpp:
.text start:0x8059FD9C end:0x805A0734

system/world/LightPreset.cpp:
.text start:0x805A0734 end:0x805AECCC
.ctors start:0x807EFFD4 end:0x807EFFD8

system/world/LightHue.cpp:
.text start:0x805AECCC end:0x805B04EC

system/rndobj/Anim.cpp:
.text start:0x805C6814 end:0x805C8850
Expand Down
1,932 changes: 966 additions & 966 deletions config/SZBE69/symbols.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/system/math/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace Hmx {
}

void MakeHSL(const Hmx::Color&, float&, float&, float&);
void MakeColor(float, float, float, Hmx::Color&);
TextStream& operator<<(TextStream&, const Hmx::Color&);

inline BinStream& operator<<(BinStream& bs, const Hmx::Color& color){
Expand Down Expand Up @@ -104,10 +105,14 @@ inline void Subtract(const Hmx::Color& c1, const Hmx::Color& c2, Hmx::Color& res
}

inline void Multiply(const Hmx::Color& c1, float f, Hmx::Color& res){
#ifdef VERSION_SZBE69_B8
res.red = c1.red * f;
res.green = c1.green * f;
res.blue = c1.blue * f;
res.alpha = c1.alpha * f;
#else
res.Set(c1.red * f, c1.green * f, c1.blue * f, c1.alpha * f);
#endif
}

inline Hmx::Color& Average(Hmx::Color& res, const Hmx::Color& c1, const Hmx::Color& c2){
Expand Down
13 changes: 11 additions & 2 deletions src/system/math/Mtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ namespace Hmx {
void Set(const Matrix3&);
void Set(const Vector3&);
void Set(const Vector3&, float);
void Set(float f1, float f2, float f3, float f4){
x = f1; y = f2; z = f3; w = f4;
}

bool operator!=(const Quat& q) const {
return x != q.x || y != q.y || z != q.z || w != q.w;
}

float x;
float y;
Expand Down Expand Up @@ -212,13 +219,14 @@ class ShortQuat {
class TransformNoScale {
public:
TransformNoScale(){}
TransformNoScale(const TransformNoScale& t){ Set(t); }
void Set(const Transform&);
void Set(const TransformNoScale&);
void SetRot(const Hmx::Matrix3&);
void Reset();

ShortQuat q;
class Vector3 v;
ShortQuat q; // 0x0/2/4/6
class Vector3 v; // 0x8
};

BinStream& operator>>(BinStream&, TransformNoScale&);
Expand Down Expand Up @@ -280,6 +288,7 @@ void Multiply(const Vector3&, const Hmx::Matrix3&, Vector3&);
void Multiply(const Transform&, const Transform&, Transform&);
void Multiply(const Transform&, const Vector3&, Vector3&);
void Multiply(const Vector3&, const Hmx::Quat&, Vector3&);
void Interp(const Hmx::Matrix3&, const Hmx::Matrix3&, float, Hmx::Matrix3&);

inline void Transpose(const Hmx::Matrix3& min, Hmx::Matrix3& mout){
mout.Set(
Expand Down
1 change: 1 addition & 0 deletions src/system/math/Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Vector2 {
x *= f; y *= f;
return *this;
}
void Zero(){ x = y = 0.0f; }

bool operator!() const {
return x == 0.0f && y == 0.0f;
Expand Down
8 changes: 4 additions & 4 deletions src/system/obj/Dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ template <class T> class ObjDirItr {
ObjDirItr(ObjectDir* dir, bool b) : mDir(b ? dir : 0), mSubDir(dir), mWhich(0) {
if(dir){
// https://decomp.me/scratch/GNNj2 - KeylessHash::FirstFromStart?
mEntry = dir->mHashTable.FirstFromStart();
mEntry = dir->mHashTable.Begin();
Advance();
}
else {
Expand All @@ -298,7 +298,7 @@ template <class T> class ObjDirItr {
ObjDirItr& operator++(){
if(mEntry){
// https://decomp.me/scratch/oVgXk - KeylessHash::FirstFromNext?
mEntry = mSubDir->mHashTable.FirstFromNext(mEntry);
mEntry = mSubDir->mHashTable.Next(mEntry);
Advance();
}
return *this;
Expand All @@ -312,13 +312,13 @@ template <class T> class ObjDirItr {
while(mEntry){
mObj = dynamic_cast<T*>(mEntry->obj);
if(mObj) return;
mEntry = mSubDir->mHashTable.FirstFromNext(mEntry);
mEntry = mSubDir->mHashTable.Next(mEntry);
}
if(mDir){
int nextwhich = ++mWhich;
mSubDir = mDir->NextSubDir(nextwhich);
if(mSubDir){
mEntry = mSubDir->mHashTable.FirstFromStart();
mEntry = mSubDir->mHashTable.Begin();
Advance();
return;
}
Expand Down
14 changes: 12 additions & 2 deletions src/system/obj/ObjList.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@ template <class T> class ObjList : public std::list<T> {
Hmx::Object* mOwner;

Hmx::Object* Owner(){ return mOwner; }
void operator=(const ObjList<T>& oList);

void resize(unsigned long ul){
std::list<T>::resize(ul, T(mOwner));
}

void operator=(const ObjList<T>& oList){
if(this != &oList){
resize(oList.size());
std::list<T>::operator=((std::list<T>&)oList);
}
}
};

template <class T> BinStream& operator>>(BinStream& bs, ObjList<T>& oList) {
unsigned int length;
bs >> length;
oList.resize(length, T(oList.mOwner));
oList.resize(length);

for(std::list<T>::iterator it = oList.begin(); it != oList.end(); ++it){
bs >> *it;
Expand Down
9 changes: 9 additions & 0 deletions src/system/obj/ObjPtr_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,15 @@ template <class T1, class T2> class ObjPtrList : public ObjRef {
if(obj) obj->AddRef(this);
}

// remove a particular item inside iterator otherIt, from list otherList,
// and insert it into this list at the position indicated by thisIt
void MoveItem(iterator thisIt, ObjPtrList<T1, T2>& otherList, iterator otherIt){
if(otherIt != thisIt){
otherList.unlink(otherIt.mNode);
link(thisIt, otherIt.mNode);
}
}

void operator=(const ObjPtrList<T1, T2>& x){
if(this == &x) return;
while(mSize > x.mSize) pop_back();
Expand Down
2 changes: 1 addition & 1 deletion src/system/obj/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace Hmx {
Object& operator=(const Object&);
void RemoveFromDir();

DataNode *Property(DataArray *, bool) const;
DataNode* Property(DataArray *, bool) const;
DataNode* Property(Symbol, bool) const;
void SetProperty(DataArray *, const DataNode &);
void SetProperty(Symbol, const DataNode &);
Expand Down
2 changes: 1 addition & 1 deletion src/system/obj/Utl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void MergeObjectsRecurse(ObjectDir* fromDir, ObjectDir* toDir, MergeFilter& filt
}
}
}
for(ObjectDir::Entry* entry = fromDir->mHashTable.FirstFromStart(); entry != 0; entry = fromDir->mHashTable.FirstFromNext(entry)){
for(ObjectDir::Entry* entry = fromDir->mHashTable.Begin(); entry != 0; entry = fromDir->mHashTable.Next(entry)){
Hmx::Object* curObj = entry->obj;
if(curObj) MergeObject(curObj, toDir->FindObject(curObj->Name(), false), toDir, filt);
}
Expand Down
3 changes: 3 additions & 0 deletions src/system/rndobj/Cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class RndCam : public RndTransformable {
float YFov() const { return mYFov; }
RndTex* TargetTex(){ return mTargetTex; }
void SetZRange(float f1, float f2){ mZRange.Set(f1, f2); }
const Transform& LocalProjectXfm() const { return mLocalProjectXfm; }

bool CompareSphereToWorld(const Sphere& s) const {
return s > mWorldFrustum;
Expand All @@ -50,6 +51,8 @@ class RndCam : public RndTransformable {
}

static RndCam* sCurrent;
static RndCam* Current(){ return sCurrent; }

NEW_OBJ(RndCam)
DELETE_OVERLOAD;
static void Init(){
Expand Down
1 change: 1 addition & 0 deletions src/system/rndobj/Env.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class RndEnviron : public Hmx::Object {
bool FogEnable() const;
bool IsLightInList(const RndLight*, const ObjPtrList<RndLight, class ObjectDir>&) const;
bool IsValidRealLight(const RndLight*) const;
bool GetAnimateFromPreset() const { return mAnimateFromPreset; }

const Hmx::Color& AmbientColor() const { return mAmbientFogOwner->mAmbientColor; }
void SetAmbientColor(const Hmx::Color& col){
Expand Down
5 changes: 5 additions & 0 deletions src/system/rndobj/Lit.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class RndLight : public RndTransformable {
int PackedColor() const;
float Intensity() const;
void SetProjectedBlend(int i){ mProjectedBlend = i; }
bool GetAnimateFromPreset() const {
return mAnimateColorFromPreset || mAnimatePositionFromPreset || mAnimateRangeFromPreset;
}

static const char* TypeToStr(Type);

NEW_OVERLOAD;
DELETE_OVERLOAD;
Expand Down
3 changes: 2 additions & 1 deletion src/system/rndwii/Rnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "rndobj/Rnd.h"
#include <vector>

class WiiRnd : public Rnd { public:
class WiiRnd : public Rnd {
public:
WiiRnd();
virtual ~WiiRnd();
virtual DataNode Handle(DataArray*, bool);
Expand Down
1 change: 1 addition & 0 deletions src/system/ui/PanelDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class PanelDir : public RndDir {
bool PropSyncEditModePanels(std::vector<FilePath>&, DataNode&, DataArray*, int, PropOp);
void SetCam(RndCam* cam){ mCam = cam; }
void SetOwnerPanel(class UIPanel* p){ mOwnerPanel = p; }
RndCam* GetCam() const { return mCam; }

DataNode GetFocusableComponentList();
DataNode OnEnableComponent(const DataArray*);
Expand Down
2 changes: 1 addition & 1 deletion src/system/utl/BinStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ template<class T1, class T2> BinStream& operator>>(BinStream& bs, std::map<T1, T

}

template <class T1, class T2> BinStream& operator>>(BinStream& bs, std::pair<T1, T2> p) {
template <class T1, class T2> BinStream& operator>>(BinStream& bs, std::pair<T1, T2>& p) {
bs >> p.first >> p.second;
return bs;
}
Expand Down
6 changes: 3 additions & 3 deletions src/system/utl/KeylessHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ template <class T1, class T2> class KeylessHash {
}

// keep these in here so that they're inlined - needed for ObjDirItr
T2* FirstFromStart(){ return FirstFrom(mEntries); }
T2* FirstFromNext(T2* entry){ return FirstFrom(&entry[1]); }
T2* Begin(){ return FirstFrom(mEntries); }
T2* Next(T2* entry){ return FirstFrom(&entry[1]); }
};

template <class T1, class T2>
Expand Down Expand Up @@ -137,7 +137,7 @@ void KeylessHash<T1, T2>::Resize(int size, T2* val){
val[i] = mEmpty;
}
mNumEntries = 0;
for(T2* it = FirstFromStart(); it != 0; it = FirstFromNext(it)){
for(T2* it = Begin(); it != 0; it = Next(it)){
int i = HashString(*it, size);
MILO_ASSERT(i >= 0, 0x108);
while(val[i] != mEmpty){
Expand Down
2 changes: 1 addition & 1 deletion src/system/utl/Symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static DataNode PrintSymbolTable(DataArray* da){
if(da->Size() > 1){
std::vector<const char*> strvec;
strvec.reserve(gHashTable->mNumEntries);
for(const char** it = gHashTable->FirstFromStart(); it != 0; it = gHashTable->FirstFromNext(it)){
for(const char** it = gHashTable->Begin(); it != 0; it = gHashTable->Next(it)){
strvec.push_back(*it);
}
std::sort(strvec.begin(), strvec.end(), Alpha());
Expand Down
Loading
Loading