Skip to content

Commit

Permalink
Rnd work (#246)
Browse files Browse the repository at this point in the history
* rnddrawable work

* rnddrawable collides

* rnddrawable work

* fix up rnddrawable load

* match rnddrawable copy

* rnddrawable load matched

* dump load matched

* rnddrawable collideplane regswap

* add scratch links for both versions of collideplane

* rndanimatable load is closer

* rndanim animate methods

* animtask poll

* rnddir work

* a little more rndtex cleanup

* more tweaks across rnd

* rndtex platformbpporder work

* fix loadmgr mplatform everywhere

* rndtex basically done

* animtask ctor

* rndanim is getting closer

* unknown modulo func

* texblendcntr work

* rndanimfilter propsync

* modrange

* rndenv work

* rndfont added

* multimeshproxy added and already nearly done

---------

Co-authored-by: rjkiv <[email protected]>
  • Loading branch information
rjkiv and rjkiv authored Jun 7, 2024
1 parent 621cfba commit 70725e6
Show file tree
Hide file tree
Showing 36 changed files with 688 additions and 215 deletions.
2 changes: 2 additions & 0 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
"system/rndobj/EnvAnim.cpp": "NonMatching",
"system/rndobj/EventTrigger.cpp": "NonMatching",
"system/rndobj/Flare.cpp": "NonMatching",
"system/rndobj/Font.cpp": "NonMatching",
"system/rndobj/Fur.cpp": "Matching",
"system/rndobj/Graph.cpp": "NonMatching",
"system/rndobj/Group.cpp": "NonMatching",
Expand All @@ -363,6 +364,7 @@
"system/rndobj/MotionBlur.cpp": "NonMatching",
"system/rndobj/Movie.cpp": "Matching",
"system/rndobj/MultiMesh.cpp": { "status": "NonMatching", "extra_cflags": [""] },
"system/rndobj/MultiMeshProxy.cpp": "NonMatching",
"system/rndobj/Overlay.cpp": "NonMatching",
"system/rndobj/Poll.cpp": "Matching",
"system/rndobj/PollAnim.cpp": "NonMatching",
Expand Down
4 changes: 2 additions & 2 deletions config/SZBE69_B8/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49903,7 +49903,7 @@ __vt__15LatencyCallback = .data:0x80B7DA28; // type:object size:0x10 scope:globa
@62935 = .data:0x80B7DA48; // type:object size:0xC scope:local align:4
__RTTI__15LatencyCallback = .data:0x80B7DA58; // type:object size:0x8 scope:global align:8
__vt__Q210RndOverlay8Callback = .data:0x80B7DA60; // type:object size:0x10 scope:global align:8
@STRING@Find<Q23Hmx6Object>__9ObjectDirFPCcb_PQ23Hmx6Object = .data:0x80B7DA70; // type:object size:0xC scope:local align:4 data:string
@STRING@Find<Q23Hmx6Object>__9ObjectDirFPCcb_PQ23Hmx6Object = .data:0x80B7DA70; // type:object size:0xC scope:global align:4 data:string
@STRING@SetType__9GamePanelF6Symbol@1 = .data:0x80B7DA7C; // type:object size:0x1C scope:local align:4 data:string
@STRING@SetType__9GamePanelF6Symbol@0 = .data:0x80B7DA98; // type:object size:0x6 scope:local align:4 data:string
@STRING@SetType__9GamePanelF6Symbol = .data:0x80B7DAA0; // type:object size:0x8 scope:local align:8 data:string
Expand Down Expand Up @@ -60905,7 +60905,7 @@ __FUNCTION__$23285 = .data:0x80C1EFB8; // type:object size:0x12 scope:local alig
__vt__6RndDir = .data:0x80C1EFCC; // type:object size:0x24C scope:global align:4
@STRING@PropSync<11RndPollable>__FRP11RndPollableR8DataNodeP9DataArrayi6PropOp_b@0 = .data:0x80C1F218; // type:object size:0x27 scope:local align:4 data:string
@STRING@PropSync<11RndPollable>__FRP11RndPollableR8DataNodeP9DataArrayi6PropOp_b = .data:0x80C1F240; // type:object size:0xD scope:local align:4 data:string
@STRING@New<11RndPostProc>__Q23Hmx6ObjectFv_P11RndPostProc = .data:0x80C1F250; // type:object size:0x1E scope:local align:4 data:string
@STRING@New<11RndPostProc>__Q23Hmx6ObjectFv_P11RndPostProc = .data:0x80C1F250; // type:object size:0x1E scope:global align:4 data:string
@STRING@StaticClassName__11RndPostProcFv = .data:0x80C1F270; // type:object size:0x9 scope:global align:4 data:string
@stringBase0 = .data:0x80C1F280; // type:object size:0xD0 scope:local align:8 data:string_table
__vt__7DOFProc = .data:0x80C1F350; // type:object size:0x80 scope:global align:8
Expand Down
2 changes: 2 additions & 0 deletions src/system/math/Geo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MATH_GEO_H
#define MATH_GEO_H
#include "math/Vec.h"
#include "math/Sphere.h"
#include "utl/BinStream.h"

class Segment {
Expand Down Expand Up @@ -48,5 +49,6 @@ inline BinStream& operator>>(BinStream& bs, Box& box){
}

void SetBSPParams(float f1, float f2, int r3, int r4, float f3);
bool Intersect(const Segment&, const Sphere&);

#endif
13 changes: 13 additions & 0 deletions src/system/math/MathFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ inline float ceil_f(double d){
return ceil(d);
}

inline float Modulo(float f1, float f2) {
if (f2 == 0.0f)
return 0.0f;
float tmp = fmod_f(f1, f2);
if (tmp < 0.0f)
tmp += f2;
return tmp;
}

inline float ModRange(float f1, float f2, float f3){
return Modulo(f3 - f1, f2 - f1) + f1;
}

inline float fmod_f(double x, double y){
return fmod(x, y);
}
Expand Down
6 changes: 6 additions & 0 deletions src/system/math/Mtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ class TransformNoScale {

class Plane {
public:
Plane(){}

float Dot(const Vector3& vec) const {
return a * vec.x + b * vec.y + c * vec.z + d;
}

float a, b, c, d;
};

Expand Down
20 changes: 19 additions & 1 deletion src/system/math/Sphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,30 @@ class Sphere {
public:
Sphere(){ Zero(); }
void Zero(){ radius = 0.0f; center.Zero(); }
float Radius() const { return radius; }
float GetRadius() const { return radius; }

Sphere& operator=(const Sphere& s){
center = s.center;
radius = s.radius;
}

void Set(const Vector3& vec, float f){
center = vec;
radius = f;
}

Vector3 center;
float radius;
};

inline BinStream& operator>>(BinStream& bs, Sphere& s){
Vector3 vec;
float f;
bs >> vec >> f;
s.Set(vec, f);
return bs;
}

bool operator>(const Sphere&, const Frustum&);

#endif
5 changes: 5 additions & 0 deletions src/system/math/Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class Vector4 {
// Vector4(const Vector4 &);
};

inline BinStream& operator>>(BinStream& bs, Vector4& vec){
bs >> vec.x >> vec.y >> vec.z >> vec.w;
return bs;
}

class Vector4_16_01 {
public:
//Vector4_16_01() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) {}
Expand Down
8 changes: 6 additions & 2 deletions src/system/obj/Dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,12 @@ class ObjectDir : public virtual Hmx::Object {
DataNode OnFind(DataArray*);

Hmx::Object* FindObject(const char*, bool);
template <class T> T* Find(const char* name, bool b) {
return dynamic_cast<T*>(FindObject(name, b));
template <class T> T* Find(const char* name, bool parentDirs) {
T* castedObj = dynamic_cast<T*>(FindObject(name, false));
if(!castedObj && parentDirs){
MILO_FAIL(kNotObjectMsg, name, PathName(this) ? PathName(this) : "**no file**");
}
return castedObj;
}

DECLARE_REVS;
Expand Down
2 changes: 1 addition & 1 deletion src/system/obj/DirLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const char* DirLoader::CachedPath(const char* cc, bool b){
if((sCacheMode || b) && ext){
bool isMilo = strcmp(ext, "milo") == 0;
if(isMilo){
return MakeString("%s/gen/%s.milo_%s", FileGetPath(cc, 0), FileGetBase(cc, 0), PlatformSymbol(TheLoadMgr.mPlatform));
return MakeString("%s/gen/%s.milo_%s", FileGetPath(cc, 0), FileGetBase(cc, 0), PlatformSymbol(TheLoadMgr.GetPlatform()));
}
}
return cc;
Expand Down
2 changes: 1 addition & 1 deletion src/system/obj/ObjMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void objType::Load(BinStream& bs){
// for loading in a version number that isn't a class's gRev/gAltRev
#define ASSERT_GLOBAL_REV(ver, rev_name) \
if (ver > rev_name){ \
MILO_FAIL("%s can't load new %s version %d > %d", PathName(this), ClassName(), rev_name, ver); \
MILO_FAIL("%s can't load new %s version %d > %d", PathName(this), ClassName(), ver, rev_name); \
}

#define LOAD_SUPERCLASS(parent) \
Expand Down
8 changes: 4 additions & 4 deletions src/system/obj/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ inline TextStream& operator<<(TextStream& ts, const Hmx::Object* obj){
return ts;
}

inline unsigned short getHmxRev(int ui){
return ui;
inline unsigned short getHmxRev(int packed){
return packed;
}

inline unsigned short getAltRev(int ui){
return (unsigned int)ui >> 0x10;
inline unsigned short getAltRev(int packed){
return (unsigned int)packed >> 0x10;
}

inline int packRevs(unsigned short alt, unsigned short rev){
Expand Down
2 changes: 1 addition & 1 deletion src/system/os/ArkFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bool ArkFile::ReadAsync(void* iBuff, int iBytes){
unsigned int last = mFilename.find_last_of('_');
bool met = last != String::npos;
if(met){
Symbol plat = PlatformSymbol(TheLoadMgr.mPlatform);
Symbol plat = PlatformSymbol(TheLoadMgr.GetPlatform());
const char* strIdx = mFilename.c_str() + last + 1;
met = plat == strIdx;
}
Expand Down
2 changes: 1 addition & 1 deletion src/system/os/AsyncFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void PrintDiscFile(const char* cc){
unsigned int last = fullPath.find_last_of('_');
bool lastFound = last != String::npos;
if(lastFound){
Symbol plat = PlatformSymbol(TheLoadMgr.mPlatform);
Symbol plat = PlatformSymbol(TheLoadMgr.GetPlatform());
lastFound = plat == fullPath.c_str() + last + 1;
}
fullPath = (lastFound) ? fullPath.substr(0, last) : fullPath;
Expand Down
4 changes: 2 additions & 2 deletions src/system/os/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static DataNode OnToggleFakeFileErrors(DataArray* da){
void OnFrameRateRecurseCB(const char* cc1, const char* cc2){
MILO_ASSERT(gFrameRateArray, 0x148);
String str(cc2);
const char* keepStr = MakeString("_keep_%s.dta", PlatformSymbol(TheLoadMgr.mPlatform));
const char* keepStr = MakeString("_keep_%s.dta", PlatformSymbol(TheLoadMgr.GetPlatform()));
int theStrLen = strlen(str.c_str());
int keepLen = strlen(keepStr);
str = str.substr(0, theStrLen - keepLen);
Expand All @@ -104,7 +104,7 @@ void OnFrameRateRecurseCB(const char* cc1, const char* cc2){
static DataNode OnEnumerateFrameRateResults(DataArray* da){
DataNode ret(new DataArray(0), kDataArray);
gFrameRateArray = ret.Array(0);
FileRecursePattern(MakeString("ui/framerate/venue_test/*%s", MakeString("_keep_%s.dta", PlatformSymbol(TheLoadMgr.mPlatform))), OnFrameRateRecurseCB, false);
FileRecursePattern(MakeString("ui/framerate/venue_test/*%s", MakeString("_keep_%s.dta", PlatformSymbol(TheLoadMgr.GetPlatform()))), OnFrameRateRecurseCB, false);
gFrameRateArray = 0;
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/system/os/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace {
SetUsingCD(true);

FileStat stat;
if (FileGetStat(MakeString("gen/main_%s.hdr", PlatformSymbol(TheLoadMgr.mPlatform)), &stat) < 0) {
if (FileGetStat(MakeString("gen/main_%s.hdr", PlatformSymbol(TheLoadMgr.GetPlatform())), &stat) < 0) {
SetUsingCD(false);
}
}
Expand Down
Loading

0 comments on commit 70725e6

Please sign in to comment.