Skip to content
Draft
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
9 changes: 9 additions & 0 deletions src/engine/N3Base/N3FXBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ bool CN3FXBundle::Load(HANDLE hFile) {
ReadFile(hFile, &m_bStatic, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion == 3) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if there's any real intention of supporting them, but I would personally make this m_iVersion >= 3 to allow for future versions since there's no real cost for doing so, and only unintentional complications down the track as a result of the explicit check.

ReadFile(hFile, &m_bEarthQuake, sizeof(bool), &dwRWC, NULL);
if (m_bEarthQuake) {
ReadFile(hFile, &m_fEarthQuakeStartTime, sizeof(float), &dwRWC, NULL);
} else {
m_fEarthQuakeStartTime = 0;
}
}

return true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/engine/N3Base/N3FXBundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class CN3FXBundle : public CN3BaseFileAccess {
int m_iSourceJoint;

bool m_bDependScale;
bool m_bEarthQuake; // Needs Implementation
float m_fEarthQuakeStartTime; // Needs Implementation
//__Vector3 m_vTargetScale;
float m_fTargetScale;

Expand Down
8 changes: 8 additions & 0 deletions src/engine/N3Base/N3FXPartBillBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ bool CN3FXPartBillBoard::Load(HANDLE hFile) {
ReadFile(hFile, &m_mtxRot, sizeof(m_mtxRot), &dwRWC, NULL);
}

if (m_iVersion >= 6) {
ReadFile(hFile, &m_bRotationRate, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion >= 7) {
ReadFile(hFile, &m_bOnScreen, sizeof(bool), &dwRWC, NULL); // is this on screen bool?
Copy link
Contributor

@twostars twostars Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm crazy, I think these 2 are mixed up? (i.e. m_bOnScreen should be m_bRotationRate and vice versa)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be like I said I don't have pdbs or asm/reversing experience. This is half of the pr the other was somewhere else to correct few issues. If you want I Can try to search for the src and go over it together?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little hard to tell without any implementation behaviour, but based on naming alone (specifically the rotation one), the way I've named them both personally fits with them the other way around (which tracks with their actual implementation behaviour), which makes me think you possibly accidentally mixed up the order here. It's just a little hard to tell from this alone though if you accidentally mixed up the order or the names perhaps aren't the clearest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably could have mixed them the other way around very highly you're right. For the naming they are the original naming convention except for versioning which I named myself OFC. I'll try to get them today so you can take a look at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bool on screen came later so you must be right...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now understand the order you're pulling them from is the order in the leaked project files. This doesn't mean that they're handled in that order; these project files don't care about the versioning whatsoever, so they're not even currently output in a strict version order, meaning they don't really have any reason to stick to that and throw them in at the bottom.

Now that I understand the reasoning behind the names (leaked effect project files) and why you put them in that order (appearance in the saved project file, which is no guarantee of order in the binary), I can definitely say that they're backwards without question here.

}

CreateVB();
Init();

Expand Down
2 changes: 2 additions & 0 deletions src/engine/N3Base/N3FXPartBillBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class CN3FXPartBillBoard : public CN3FXPartBase {
float m_fRotBillBoardY;
float m_fRotBillBoardZ;

bool m_bRotationRate; // Needs Implementation
bool m_bOnScreen; // Needs Implementation
protected:
__Vector3 m_vUnit[4];

Expand Down
4 changes: 4 additions & 0 deletions src/engine/N3Base/N3FXPartMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ bool CN3FXPartMesh::Load(HANDLE hFile) {
ReadFile(hFile, &m_vUnitScale, sizeof(__Vector3), &dwRWC, NULL);
}

if (m_iVersion == 6) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason as the other case (no real cost to allowing for future versions), I would also make this >=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there is I got this all working already and 1298 fx loading up in other repo/branch where I completed this before ragequiting due to stress on snoxdko discord. About the other if m version 3 is because I intended it to be last major version to be supported and that's why it was ==3. For this one I can't comment much on it have to double triple check my earlier work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I get that, I'm just saying that there's really no downside to just swapping that to >=. All it does is it futureproofs it with no real downside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mgame has a bad habit of doing things weirdly. I've come across parameters that were removed or changed to a different position that's why I probably did this it's hard to tell without the src I had on a diff branch/repo where it was working as in atleast loading and displaying it properly for 95%. Just sometimes scaling or newer functions that aren't added yet but atleast it solved all the crashing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you are probably right anyway. Hey were talking to 2stars afteral. At this point it was all a WIP and I don't know asm so I had to brainstorm to come so far.

ReadFile(hFile, &m_bShapeLoop, sizeof(bool), &dwRWC, NULL); //?<shape_loop> true <view_fix> true <usefadeshowlife> false
}

if (m_pShape) {
for (int i = 0; i < m_pShape->PartCount(); i++) {
m_pShape->Part(i)->m_fTexFPS = m_fTexFPS;
Expand Down
1 change: 1 addition & 0 deletions src/engine/N3Base/N3FXPartMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CN3FXPartMesh : public CN3FXPartBase {

bool m_bTexLoop;
float m_fMeshFPS;
bool m_bShapeLoop; // Needs Implementation

protected:
bool IsDead();
Expand Down
17 changes: 17 additions & 0 deletions src/engine/N3Base/N3FXPartParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,23 @@ bool CN3FXPartParticles::Load(HANDLE hFile) {
ReadFile(hFile, &m_fScaleVelY, sizeof(float), &dwRWC, NULL);
}

if (m_iVersion >= 6) {
ReadFile(hFile, &m_bDistanceNumFix, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion >= 7) {
ReadFile(hFile, &m_bParticleYAxisFix, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion >= 8) {
/*
ReadFile(hFile, &m_bParticle_Not_Rot, sizeof(bool), &dwRWC, NULL);
ReadFile(hFile, &m_vParticle_Not_Rot, sizeof(__Vector3), &dwRWC, NULL);
ReadFile(hFile, &m_fPtRangeMin, sizeof(float), &dwRWC, NULL);
ReadFile(hFile, &m_fPtRangeMax, sizeof(float), &dwRWC, NULL);
*/
}

Init();

return true;
Expand Down
3 changes: 3 additions & 0 deletions src/engine/N3Base/N3FXPartParticles.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class CN3FXPartParticles : public CN3FXPartBase {
float m_fScaleVelX;
float m_fScaleVelY;

bool m_bDistanceNumFix; // Needs Implementation
bool m_bParticleYAxisFix; // Needs Implementation

protected:
void Rotate();
void Scaling();
Expand Down