Skip to content

Commit

Permalink
Try to cleanup the char folder, get more TUs Equivalent (#324)
Browse files Browse the repository at this point in the history
* charuppertwist equivalent

* charsleeve work

* charservobone work

* charpollgroup sortpolls

* match charpollgroup

* charnecktwist poll

* charbone is equivalent

* charguitarstring is equivalent

* charmirror attempt

* charinterest work

* charikfoot work

* charforetwist poll tweak

* chareyes work

* more chareyes work

* charhair work

* charcollide work

* charcollide tweaks

* charcollide highlight work

* charcollide tweaks

* more charactertest work

* charactertest symbols

* charutl work

* charutl is equivalent

* correct angle func name

* waypoint work

* waypoint symbols in retail

* waypoint work

* clipcollide work

* more clipcollide work

* clipgraphgen work

* no charforetwist enter
  • Loading branch information
rjkiv authored Aug 25, 2024
1 parent b3f2a12 commit afeae54
Show file tree
Hide file tree
Showing 56 changed files with 1,853 additions and 422 deletions.
1 change: 1 addition & 0 deletions config/SZBE69/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"system/char/CharUtl.cpp": "NonMatching",
"system/char/CharWeightable.cpp": "NonMatching",
"system/char/CharWeightSetter.cpp": "NonMatching",
"system/char/Waypoint.cpp": "NonMatching",

"system/math/Key.cpp": "NonMatching",
"system/math/Rand.cpp": "NonMatching",
Expand Down
348 changes: 174 additions & 174 deletions config/SZBE69/symbols.txt

Large diffs are not rendered by default.

35 changes: 26 additions & 9 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@
"system/char/Char.cpp": "NonMatching",
"system/char/Character.cpp": "NonMatching",
"system/char/CharBlendBone.cpp": "NonMatching",
"system/char/CharBone.cpp": "NonMatching",
"system/char/CharBone.cpp": {
"status": "Equivalent",
"comment": "regswaps in standalone stlport functions"
},
"system/char/CharBoneDir.cpp": "NonMatching",
"system/char/CharBoneOffset.cpp": "Matching",
"system/char/CharBones.cpp": "NonMatching",
Expand All @@ -210,8 +213,14 @@
"system/char/CharEyeDartRuleset.cpp": "Matching",
"system/char/CharEyes.cpp": "NonMatching",
"system/char/CharFaceServo.cpp": "NonMatching",
"system/char/CharForeTwist.cpp": "NonMatching",
"system/char/CharGuitarString.cpp": "NonMatching",
"system/char/CharForeTwist.cpp": {
"status": "Equivalent",
"comment": "Poll checks out in retail"
},
"system/char/CharGuitarString.cpp": {
"status": "Equivalent",
"comment": "Poll checks out in retail"
},
"system/char/CharHair.cpp": "NonMatching",
"system/char/CharIKFingers.cpp": "NonMatching",
"system/char/CharIKFoot.cpp": "NonMatching",
Expand All @@ -232,28 +241,36 @@
"system/char/CharMeshHide.cpp": "NonMatching",
"system/char/CharMirror.cpp": "NonMatching",
"system/char/CharNeckTwist.cpp": "NonMatching",
"system/char/CharPollGroup.cpp": "NonMatching",
"system/char/CharPollGroup.cpp": "Matching",
"system/char/CharPosConstraint.cpp": "NonMatching",
"system/char/CharServoBone.cpp": "NonMatching",
"system/char/CharSleeve.cpp": "NonMatching",
"system/char/CharTaskMgr.cpp": "Matching",
"system/char/CharTransCopy.cpp": "Matching",
"system/char/CharTransDraw.cpp": "Matching",
"system/char/CharUpperTwist.cpp": "NonMatching",
"system/char/CharUtl.cpp": "NonMatching",
"system/char/CharUpperTwist.cpp": {
"status": "Equivalent",
"comment": "Poll checks out in retail"
},
"system/char/CharUtl.cpp": {
"status": "Equivalent",
"comment": "ClipPredict::Predict checks out in retail"
},
"system/char/CharWeightable.cpp": "Matching",
"system/char/CharWeightSetter.cpp": "Matching",
"system/char/CharacterTest.cpp": "NonMatching",
"system/char/ClipCollide.cpp": "NonMatching",
"system/char/ClipCompressor.cpp": "Matching",
"system/char/ClipGraphGen.cpp": "NonMatching",
"system/char/Waypoint.cpp": "NonMatching",

"system/math/strips/Adjacency.cpp": "Matching",
"system/math/strips/CustomArray.cpp": "Matching",
"system/math/strips/RevisitedRadix.cpp": "NonMatching",
"system/math/strips/Striper.cpp": {"status": "Equivalent",
"comment": "Regswap in ComputeBestStrip__7StriperFUi"},

"system/math/strips/Striper.cpp": {
"status": "Equivalent",
"comment": "Regswap in ComputeBestStrip__7StriperFUi"
},
"system/math/Color.cpp": "NonMatching",
"system/math/Decibels.cpp": "Matching",
"system/math/FileChecksum.cpp": "Matching",
Expand Down
6 changes: 6 additions & 0 deletions src/system/char/CharBone.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class CharBone : public Hmx::Object {
int ScaleContext() const { return mScaleContext; }
CharBones::Type RotationType() const { return mRotation; }
int RotationContext() const { return mRotationContext; }
CharBone* Target() const { return mTarget; }
void SetTarget(CharBone* b){ mTarget = b; }
void SetPositionContext(int c){ mPositionContext = c; }
void SetScaleContext(int c){ mScaleContext = c; }
void SetRotationContext(int c){ mRotationContext = c; }
void SetRotationType(CharBones::Type ty){ mRotation = ty; }

DECLARE_REVS;
NEW_OVERLOAD;
Expand Down
2 changes: 2 additions & 0 deletions src/system/char/CharBones.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class CharBones {
Zero();
SetWeights(0);
}
int TotalSize() const { return mTotalSize; }
void ScaleDown(CharBones&, float) const;

static Type TypeOf(Symbol);
static const char* SuffixOf(Type);
Expand Down
2 changes: 2 additions & 0 deletions src/system/char/CharClip.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CharClip : public Hmx::Object {
~Transitions();
void Clear();
void Resize(int, const CharClip::NodeVector*);
void RemoveNodes(CharClip*);
int Size() const;

NodeVector* mNodeStart; // 0x0
Expand Down Expand Up @@ -96,6 +97,7 @@ class CharClip : public Hmx::Object {
void SetBeatAlignMode(int);
void SetRelative(CharClip*);
int AllocSize();
void EvaluateChannel(void*, const void*, float);
void LockAndDelete(CharClip**, int, int);
float StartBeat() const { return mBeatTrack.front().value; }
float EndBeat() const { return mBeatTrack.back().value; }
Expand Down
207 changes: 137 additions & 70 deletions src/system/char/CharCollide.cpp
Original file line number Diff line number Diff line change
@@ -1,79 +1,146 @@
#include "char/CharCollide.h"
#include "rndobj/Utl.h"
#include "utl/Symbols.h"

CharCollide::CharCollide() : mShape(kSphere), mFlags(0), mMesh(this, 0) {
INIT_REVS(CharCollide)

CharCollide::CharCollide() : mShape(kSphere), mFlags(0), mMesh(this, 0), mMeshYBias(0) {
for(int i = 0; i < 2; i++){
mOrigLength[i] = 0;
mOrigRadius[i] = 0;
}
CopyOriginalToCur();
for(int i = 0; i < 8; i++){
unk_structs[i].unk0 = 0;
unk_structs[i].vec.Zero();
}
unk148.Reset();
}

// ObjPtr<>::ObjPtr((ObjPtr<> *)(this + 0x98),(Object *)pCVar1,(RndMesh *)0x0);
// pCVar1 = this + 0xb8;
// do {
// RSONotifyModuleLoaded(pCVar1);
// pCVar1 = pCVar1 + 0x10;
// } while (pCVar1 < this + 0x138);
// Transform::Transform(this + 0x148);
// this[0x188] = (CharCollide)0x0;
// iVar3 = 2;
// iVar2 = 0;
// do {
// *(undefined4 *)(this + iVar2 + 0x140) = 0;
// *(undefined4 *)(this + iVar2 + 0x138) = 0;
// iVar3 = iVar3 + -1;
// iVar2 = iVar2 + 4;
// } while (iVar3 != 0);
// fn_804C3484(this); // copy original to cur
// iVar2 = 0;
// iVar3 = 0;
// do {
// *(undefined4 *)(this + iVar3 + 0xb8) = 0;
// Vector3::Zero((Vector3 *)(this + iVar3 + 0xbc));
// iVar2 = iVar2 + 1;
// iVar3 = iVar3 + 0x10;
// } while (iVar2 < 8);

// Transform::Reset(this + 0x148);

// *(undefined4 *)(this + 0xb8) = 0;
// *(float *)(this + 0xc4) = 0.0;
// *(float *)(this + 0xc0) = 0.0;
// *(float *)(this + 0xbc) = 0.0;

// *(undefined4 *)(this + 0xc8) = 0;
// *(float *)(this + 0xd4) = 0.0;
// *(float *)(this + 0xd0) = 0.0;
// *(float *)(this + 0xcc) = 0.0;

// *(undefined4 *)(this + 0xd8) = 0;
// *(float *)(this + 0xe4) = 0.0;
// *(float *)(this + 0xe0) = 0.0;
// *(float *)(this + 0xdc) = 0.0;

// *(undefined4 *)(this + 0xe8) = 0;
// *(float *)(this + 0xf4) = 0.0;
// *(float *)(this + 0xf0) = 0.0;
// *(float *)(this + 0xec) = 0.0;

// *(undefined4 *)(this + 0xf8) = 0;
// *(float *)(this + 0x104) = 0.0;
// *(float *)(this + 0x100) = 0.0;
// *(float *)(this + 0xfc) = 0.0;

// *(undefined4 *)(this + 0x108) = 0;
// *(float *)(this + 0x114) = 0.0;
// *(float *)(this + 0x110) = 0.0;
// *(float *)(this + 0x10c) = 0.0;

// *(undefined4 *)(this + 0x118) = 0;
// *(float *)(this + 0x124) = 0.0;
// *(float *)(this + 0x120) = 0.0;
// *(float *)(this + 0x11c) = 0.0;

// *(undefined4 *)(this + 0x128) = 0;
// *(float *)(this + 0x134) = 0.0;
// *(float *)(this + 0x130) = 0.0;
// *(float *)(this + 0x12c) = 0.0;

CharCollide::~CharCollide(){

}

SAVE_OBJ(CharCollide, 0x58)
void CharCollide::Highlight(){
Hmx::Color black(1.0f, 1.0f, 1.0f);
Hmx::Color red(1.0f, 0.0f, 0.0f);
switch(mShape){
case kPlane:
Plane p(WorldXfm().v, WorldXfm().m.x);
UtilDrawPlane(p, WorldXfm().v, red, 1, 12.0f);
break;
case kSphere:
case kInsideSphere:
UtilDrawSphere(WorldXfm().v, mOrigRadius[0], red);
UtilDrawSphere(WorldXfm().v, mCurRadius[0], black);
break;
case kCigar:
case kInsideCigar:
UtilDrawCigar(WorldXfm(), mOrigRadius, mOrigLength, red, 8);
UtilDrawCigar(WorldXfm(), mCurRadius, mCurLength, black, 8);
break;
default: break;
}
if(mMesh){
int numspheres = NumSpheres();
for(int i = 0; i < numspheres * 2; i++){
UtilDrawSphere(mMesh->VertPos(unk_structs[i].unk0), 0.1f, Hmx::Color(0.0f, 0.0f, 1.0f));
}
}
}

SAVE_OBJ(CharCollide, 0x58)

BEGIN_LOADS(CharCollide)
LOAD_REVS(bs)
ASSERT_REVS(7, 0)
LOAD_SUPERCLASS(Hmx::Object)
LOAD_SUPERCLASS(RndTransformable)
bs >> (int&)mShape;
bs >> mOrigRadius[0];
if(gRev > 4) bs >> mOrigLength[0];
if(gRev > 2) bs >> mOrigLength[1];
if(gRev > 1) bs >> mFlags;
else mFlags = 0;
if(gRev > 3) bs >> mCurRadius[0];
else mCurRadius[0] = mOrigRadius[0];

if(gRev > 5){
bs >> mOrigRadius[1];
bs >> mCurRadius[1];
bs >> mCurLength[0];
bs >> mCurLength[1];
bs >> unk148;
bs >> mMesh;
for(int i = 0; i < 8; i++){
bs >> unk_structs[i].unk0;
bs >> unk_structs[i].vec;
}
bs >> mDigest;
bs >> mMeshYBias;
if(gRev < 7) CopyOriginalToCur();
}
else {
mOrigRadius[1] = mOrigRadius[0];
CopyOriginalToCur();
}
END_LOADS

BEGIN_COPYS(CharCollide)
COPY_SUPERCLASS(Hmx::Object)
COPY_SUPERCLASS(RndTransformable)
CREATE_COPY(CharCollide)
BEGIN_COPYING_MEMBERS
COPY_MEMBER(mShape)
COPY_MEMBER(mFlags)
memcpy(mOrigRadius, c->mOrigRadius, 8);
memcpy(mOrigLength, c->mOrigLength, 8);
memcpy(mCurRadius, c->mCurRadius, 8);
memcpy(mCurLength, c->mCurLength, 8);
COPY_MEMBER(unk148)
COPY_MEMBER(mMeshYBias)
COPY_MEMBER(mMesh)
END_COPYING_MEMBERS
END_COPYS

void CharCollide::Deform(){

}

int CharCollide::NumSpheres(){
if(mShape == kCigar || mShape == kInsideCigar) return 2;
else if (mShape == kSphere || mShape == kInsideSphere) return 1;
else return 0;
}

void CharCollide::CopyOriginalToCur(){
memcpy(mCurRadius, mOrigRadius, 8);
memcpy(mCurLength, mOrigLength, 8);
}


void CharCollide::SyncShape(){
f32 t = mCurLength[1];
if(mCurLength[0] > t){
mCurLength[0] = mCurLength[1];
}
CopyOriginalToCur();
}

BEGIN_HANDLERS(CharCollide)
HANDLE_SUPERCLASS(RndTransformable)
HANDLE_SUPERCLASS(Hmx::Object)
HANDLE_CHECK(0x221)
END_HANDLERS

BEGIN_PROPSYNCS(CharCollide)
SYNC_PROP_MODIFY(shape, (int&)mShape, SyncShape())
SYNC_PROP(flags, mFlags)
SYNC_PROP_MODIFY(radius0, mOrigRadius[0], SyncShape())
SYNC_PROP_MODIFY(radius1, mOrigRadius[1], SyncShape())
SYNC_PROP_MODIFY(length0, mOrigLength[0], SyncShape())
SYNC_PROP_MODIFY(length1, mOrigLength[1], SyncShape())
SYNC_PROP_MODIFY_ALT(mesh, mMesh, SyncShape())
SYNC_PROP_MODIFY(mesh_y_bias, mMeshYBias, SyncShape())
SYNC_SUPERCLASS(RndTransformable)
END_PROPSYNCS
Loading

0 comments on commit afeae54

Please sign in to comment.