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

BandFaceDeform, GemTrackDir and GemTrackResourceManager #363

Merged
merged 11 commits into from
Oct 4, 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
3 changes: 3 additions & 0 deletions config/SZBE69/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"system/bandobj/BandConfiguration.cpp": "NonMatching",
"system/bandobj/BandCrowdMeter.cpp": "NonMatching",
"system/bandobj/BandDirector.cpp": "NonMatching",
"system/bandobj/BandFaceDeform.cpp": "NonMatching",
"system/bandobj/BandHeadShaper.cpp": "NonMatching",
"system/bandobj/BandHighlight.cpp": "NonMatching",
"system/bandobj/BandLabel.cpp": "NonMatching",
Expand All @@ -84,6 +85,8 @@
"system/bandobj/CrowdMeterIcon.cpp": "NonMatching",
"system/bandobj/EndingBonus.cpp": "NonMatching",
"system/bandobj/FingerShape.cpp": "NonMatching",
"system/bandobj/GemTrackDir.cpp": "NonMatching",
"system/bandobj/GemTrackResourceManager.cpp": "NonMatching",
"system/bandobj/InlineHelp.cpp": "NonMatching",
"system/bandobj/NoteTube.cpp": "NonMatching",
"system/bandobj/OutfitConfig.cpp": "NonMatching",
Expand Down
8 changes: 7 additions & 1 deletion config/SZBE69/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,9 @@ system/bandobj/BandCrowdMeter.cpp:
system/bandobj/BandHighlight.cpp:
.text start:0x803A8A44 end:0x803A9C80

system/bandobj/BandFaceDeform.cpp:
.text start:0x803A9C80 end:0x803ABC68

system/bandobj/BandLabel.cpp:
.text start:0x803B0390 end:0x803B1FA8

Expand Down Expand Up @@ -1053,9 +1056,12 @@ rb3/streakmeter.cpp:
rb3/overdrivemeter.cpp:
.text start:0x804260A4 end:0x80426FDC

rb3/gemtrackdir.cpp:
system/bandobj/GemTrackDir.cpp:
.text start:0x80426FDC end:0x80430F2C

system/bandobj/GemTrackResourceManager.cpp:
.text start:0x80430F2C end:0x80431DC8

system/bandobj/VocalTrackDir.cpp:
.text start:0x80431DC8 end:0x8043B9C0

Expand Down
420 changes: 210 additions & 210 deletions config/SZBE69/symbols.txt

Large diffs are not rendered by default.

26 changes: 24 additions & 2 deletions src/system/bandobj/BandConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void BandConfiguration::SyncPlayMode(){
for(int i = 0; i < 4; i++){
TargTransform& curtargxfm = mXfms[i].xfms[idx];
mXfms[i].mWay->SetLocalXfm(curtargxfm.xfm);
BandCharacter* bchar = TheBandWardrobe->FindTarget(curtargxfm.targName, TheBandWardrobe->unk54);
BandCharacter* bchar = TheBandWardrobe->FindTarget(curtargxfm.targName, TheBandWardrobe->mVenueNames);
if(bchar) bchar->Teleport(mXfms[i].mWay);
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ BEGIN_LOADS(BandConfiguration)
bs >> mXfms[i];
}
if(TheBandWardrobe){
TheBandWardrobe->unk90 = this;
TheBandWardrobe->SetModeSink(this);
}
END_LOADS

Expand All @@ -99,5 +99,27 @@ BEGIN_HANDLERS(BandConfiguration)
HANDLE_CHECK(0x9F)
END_HANDLERS

DataNode BandConfiguration::OnStoreConfiguration(DataArray* da){
int cfgidx = ConfigIndex();
for(int i = 0; i < 4; i++){
TargTransform& curtarg = mXfms[i].xfms[cfgidx];
BandCharacter* bchar = TheBandWardrobe->GetCharacter(i);
if(bchar){
curtarg.targName = TheBandWardrobe->VenueNames().names[i];
curtarg.xfm = bchar->LocalXfm();
}
}
SyncPlayMode();
return 0;
}

DataNode BandConfiguration::OnReleaseConfiguration(DataArray* da){
for(int i = 0; i < 4; i++){
BandCharacter* bchar = TheBandWardrobe->GetCharacter(i);
if(bchar) bchar->Teleport(0);
}
return 0;
}

BEGIN_PROPSYNCS(BandConfiguration)
END_PROPSYNCS
95 changes: 95 additions & 0 deletions src/system/bandobj/BandFaceDeform.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
#include "bandobj/BandFaceDeform.h"
#include "utl/Symbols.h"

INIT_REVS(BandFaceDeform);

BandFaceDeform::DeltaArray::DeltaArray() : mSize(0), mData(0) {}
BandFaceDeform::DeltaArray::DeltaArray(const BandFaceDeform::DeltaArray& da) : mSize(0), mData(0) { *this = da; }

BandFaceDeform::DeltaArray& BandFaceDeform::DeltaArray::operator=(const BandFaceDeform::DeltaArray& da){
SetSize(da.mSize);
memcpy(mData, da.mData, mSize);
return *this;
}

BandFaceDeform::DeltaArray::~DeltaArray(){ _MemFree(mData); }
void BandFaceDeform::DeltaArray::Clear(){ SetSize(0); }

int BandFaceDeform::DeltaArray::NumVerts(){
int num = 0;
void* itend = end();
for(void* p = begin(); p < itend; p){
Delta* d = (Delta*)p;
num += d->num;
p = d->next();
}
return num;
}

void BandFaceDeform::DeltaArray::AppendDeltas(const std::vector<Vector3>& pos, const std::vector<Vector3>& base){
if(pos.size() != base.size()){
MILO_FAIL("AppendDeltas pos has %d points, base has %d", pos.size(), base.size());
}
}

void BandFaceDeform::DeltaArray::SetSize(int i){
if(mSize != i){
mSize = i;
_MemFree(mData);
mData = _MemAlloc(mSize, 0);
}
}

BandFaceDeform::BandFaceDeform(){

}
Expand All @@ -9,6 +48,62 @@ BandFaceDeform::~BandFaceDeform(){

}

void BandFaceDeform::SetFromMeshAnim(RndMeshAnim* a1, RndMeshAnim* a2, int i1, int i2){
if(i2 == -1){
i2 = a1->VertPointsKeys().size();
}
mFrames.resize(i2);
for(int i = 0; i < i2; i++){
mFrames[i].Clear();
mFrames[i].AppendDeltas(a1->VertPointsKeys()[i + i1].value, a2->VertPointsKeys()[0].value);
}
}

int BandFaceDeform::TotalSize(){
int size = 0;
for(int i = 0; i < mFrames.size(); i++){
size += mFrames[i].mSize;
}
return size;
}

BEGIN_COPYS(BandFaceDeform)
COPY_SUPERCLASS(Hmx::Object)
CREATE_COPY(BandFaceDeform)
BEGIN_COPYING_MEMBERS
COPY_MEMBER(mFrames)
END_COPYING_MEMBERS
END_COPYS

BinStream& operator>>(BinStream& bs, BandFaceDeform::DeltaArray& da){
da.Load(bs);
return bs;
}

void BandFaceDeform::DeltaArray::Load(BinStream& bs){
int size;
bs >> size;
SetSize(size);
Delta* d = (Delta*)mData;
short* sptr = (short*)mData;
while(size > 0){
bs >> (short&)d->unk0;
bs >> d->num;
bs.Read(d + 1, d->thisoffset() - 4);
size -= d->thisoffset();
d = (Delta*)d->next();
}
}

SAVE_OBJ(BandFaceDeform, 0x129)

BEGIN_LOADS(BandFaceDeform)
LOAD_REVS(bs)
ASSERT_REVS(0, 0)
LOAD_SUPERCLASS(Hmx::Object)
bs >> mFrames;
END_LOADS

BEGIN_HANDLERS(BandFaceDeform)
HANDLE_ACTION(set_from_meshanim, SetFromMeshAnim(_msg->Obj<RndMeshAnim>(2), _msg->Obj<RndMeshAnim>(3), 0, -1))
HANDLE_SUPERCLASS(Hmx::Object)
Expand Down
32 changes: 29 additions & 3 deletions src/system/bandobj/BandFaceDeform.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,45 @@
#include "obj/Object.h"
#include "rndobj/MeshAnim.h"

// naming stuff is hard
// if you have any better names please by all means
struct Delta {
char unk0; // 0x0
unsigned short num; // 0x1

static unsigned int offset(unsigned short us){
return us * 3 + 4;
}

unsigned int thisoffset(){
return offset(num);
}
void* next(){
char* p = (char*)this;
return &p[thisoffset()];
}
};

class BandFaceDeform : public Hmx::Object {
public:
class DeltaArray {
public:
DeltaArray();
DeltaArray(const DeltaArray&);
~DeltaArray();
int NumVerts();

DeltaArray& operator=(const DeltaArray&);

int unk0;
int unk4;
int NumVerts();
void SetSize(int);
void Clear();
void Load(BinStream&);
void AppendDeltas(const std::vector<Vector3>&, const std::vector<Vector3>&);
void* end(){ return &((char*)mData)[mSize]; }
void* begin(){ return mData; }

int mSize; // 0x0
void* mData; // 0x4
};

BandFaceDeform();
Expand Down
4 changes: 2 additions & 2 deletions src/system/bandobj/BandRetargetVignette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void BandRetargetVignette::Poll(){
for(std::list<String>::iterator it = mEffectors.begin(); it != mEffectors.end(); ++it){
const char* cur = it->c_str();
if(strncmp(cur, "player", 6) == 0 && strlen(cur) == 7){
BandCharacter* bchar = TheBandWardrobe->FindTarget(cur, TheBandWardrobe->unk34);
BandCharacter* bchar = TheBandWardrobe->FindTarget(cur, TheBandWardrobe->mVignetteNames);
if(bchar) bchar->Poll();
else MILO_NOTIFY_ONCE("%s has NULL for %s", PathName(this), cur);
}
Expand All @@ -50,7 +50,7 @@ void BandRetargetVignette::ListPollChildren(std::list<RndPollable*>& polls) cons
void BandRetargetVignette::EnterDir() const {
for(int i = 0; i < 4; i++){
BandCharacter* bchar = TheBandWardrobe->GetCharacter(i);
Symbol name = TheBandWardrobe->unk34.names[i];
Symbol name = TheBandWardrobe->mVignetteNames.names[i];
for(const char** ptr = sIkfs; *ptr != 0; ptr++){
BandIKEffector* ik = bchar->Find<BandIKEffector>(*ptr, false);
if(ik){
Expand Down
26 changes: 11 additions & 15 deletions src/system/bandobj/BandTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void BandTrack::SetMaxMultiplier(int mult) {
void BandTrack::SetupPlayerIntro() {
if (mPlayerIntro) {
mPlayerIntro->HandleType(reset_msg);
if (unk10 <= 7) {
if (mTrackInstrument <= 7) {
static Message setIcon = Message("set_icon", DataNode("G"));
if (mParent) {
setIcon[0] = DataNode(mParent->GetTrackIcon());
Expand All @@ -262,31 +262,27 @@ void BandTrack::SetupCrowdMeter() {
}

void BandTrack::SyncInstrument() {
// static DebugNotifyOncer _dw; -- .bss and .sbss variable

Symbol instrument = mInstrument;
if (instrument == guitar) {
unk10 = 0;
mTrackInstrument = kInstGuitar;
} else if (instrument == bass) {
unk10 = 2;
mTrackInstrument = kInstBass;
} else if (instrument == drums) {
unk10 = 1;
mTrackInstrument = kInstDrum;
} else if (instrument == vocals) {
unk10 = 3;
mTrackInstrument = kInstVocals;
} else if (instrument == keys) {
unk10 = 4;
mTrackInstrument = kInstKeys;
} else if (instrument == real_guitar) {
unk10 = 5;
mTrackInstrument = kInstRealGuitar;
} else if (instrument == real_bass) {
unk10 = 6;
mTrackInstrument = kInstRealBass;
} else if (instrument == real_keys) {
unk10 = 7;
mTrackInstrument = kInstRealKeys;
} else {
// TODO: there is something weird here with _dw which needs to be impl'd, I am not
// sure how to do it; once that is done this function will be complete
TheDebug.Notify(MakeString("unexpected instrument symbol \"%s\"", instrument));
MILO_NOTIFY_ONCE("unexpected instrument symbol \"%s\"", instrument);

unk10 = -1;
mTrackInstrument = kInstNone;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/system/bandobj/BandTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class BandTrack : public virtual Hmx::Object {
void SoloHide();
void UnisonEnd();
void UnisonStart();
TrackPanelDirBase* MyTrackPanelDir();

DECLARE_REVS;
NEW_OVERLOAD;
Expand All @@ -101,7 +102,7 @@ class BandTrack : public virtual Hmx::Object {
bool mDisabled; // 0x8
bool mSimulatedNet; // 0x9
Symbol mInstrument; // 0xc
int unk10; // 0x10
TrackInstrument mTrackInstrument; // 0x10
int unk14; // 0x14
bool unk18; // 0x18
bool unk19; // 0x19
Expand Down
Loading
Loading