Skip to content

Conversation

@Aldrin-John-Olaer-Manalansan

Plugin_SA:

  • Added member functions to convert between matrix and Euler Angles.
  • Renamed parameter names of angular rotation-related member functions.
  • Added CVector version overloads for some member functions.

* Corrected misleading member names:
	`up -> forward` representing the Y axis
	`at -> up` representing the Z axis
* Adeed member functions to convert between matrix and Euler Angles.
* Renamed parameter names of angular rotation related member functions.
* Added CVector version overloads for some member functions.
…ross all games

It's not right for me to do so but sure
}

void CMatrix::SetScale(CVector const &scale) {
SetScale(pos.x, pos.y, pos.z);
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Author

@Aldrin-John-Olaer-Manalansan Aldrin-John-Olaer-Manalansan Dec 14, 2025

Choose a reason for hiding this comment

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

?

Addessed this incorrect passed parameter in 50621d8

@MiranDMC
Copy link
Contributor

What about other game versions?
We are trying to unify util class interfaces across all versions, and this is doing opposite. Check recent updates of CVector class.

* Fixed parameters passed to SetScale overload
* renamed Translate related function parameters named "pos" (in conflict with CMatrix member with the same name) into "newPos".
@Aldrin-John-Olaer-Manalansan
Copy link
Author

Aldrin-John-Olaer-Manalansan commented Dec 14, 2025

What about other game versions? We are trying to unify util class interfaces across all versions, and this is doing opposite. Check recent updates of CVector class.

Which part in the changes opposes the attempt? If you mean Euler Angle conversion wrappers are different/non-existent across games, then this simply suggests that CMatrix isn't suited to be shared. Alternatively, I could preserve the current CMatrix blueprint by adding a new derived class CMatrixInterface containing the new converter methods, exclusive for the game that supports such methods. I would need confirmation from the approver on how to proceed.

@MiranDMC
Copy link
Contributor

MiranDMC commented Dec 14, 2025

What about other game versions? We are trying to unify util class interfaces across all versions, and this is doing opposite. Check recent updates of CVector class.

Which part in the changes opposes the attempt? If you mean Euler Angle conversion wrappers are different/non-existent across games, then this simply suggests that CMatrix isn't suited to be shared. Alternatively, I could preserve the current CMatrix blueprint by adding a new derived class CMatrixInterface containing the new converter methods, exclusive for the game that supports such methods. I would need confirmation from the approver on how to proceed.

As said look at recent CVector rework. It abandoned calling in-game code at all in favor of implementing them itself. I had plan to do same with CMatrix but I did not came to it yet (there is still CVector2D to update too).
Then we will have shared utils for all games, making creation of multi target plugins easier.

You can give a try doing same thing with CMatrix.
6ff0e62
Take note there are also Unit Tests for all methods.

@Aldrin-John-Olaer-Manalansan
Copy link
Author

What about other game versions? We are trying to unify util class interfaces across all versions, and this is doing opposite. Check recent updates of CVector class.

Which part in the changes opposes the attempt? If you mean Euler Angle conversion wrappers are different/non-existent across games, then this simply suggests that CMatrix isn't suited to be shared. Alternatively, I could preserve the current CMatrix blueprint by adding a new derived class CMatrixInterface containing the new converter methods, exclusive for the game that supports such methods. I would need confirmation from the approver on how to proceed.

As said look at recent CVector rework. It abandoned calling in-game code at all in favor of implementing them itself. I had plan to do same with CMatrix but I did not came to it yet (there is still CVector2D to update too). Then we will have shared utils for all games, making creation of multi target plugins easier.

You can give a try doing same thing with CMatrix. 6ff0e62 Take note there are also Unit Tests for all methods.

Not everyone has familiarity across every game. Such mindset puts pressure on collaborators who focus on a specific game, therefore limiting attempts to improve the SDK. Plus, the implementation of CMatrix in GTA SA is a gigantic mess, not sure about the other games, but I would assume the same thing.

This pull request is intended to focus on improving the CMatrix class of Plugin_SA, I'll leave the unification attempt to someone with enough inspiration to implement the entire class by code.

};

struct t_EulerAngleConversionFlags {
unsigned char swapXAndZ: 1 = true; // if set, treats the X axis as Yaw, Z-axis at Pitch
Copy link
Contributor

Choose a reason for hiding this comment

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

You know C++ has dedicated type for storing true/false values?

Choose a reason for hiding this comment

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

Wouldn't really matter either way, a single-bit bitfield resolves the same way as a boolean type. It's a matter of coding discipline at my part.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just use "coding discipline" already present in the project.

@MiranDMC
Copy link
Contributor

Was some AI involved in creation of this? Prefixing types with t_ or e_ is not present in PSDK, gta-reversed or in original sources.

@Aldrin-John-Olaer-Manalansan
Copy link
Author

Aldrin-John-Olaer-Manalansan commented Dec 17, 2025

Was some AI involved in creation of this? Prefixing types with t_ or e_ is not present in PSDK, gta-reversed or in original sources.

Ofcourse those declarations doesn't exists because those are based on how I perceived the ida pseudo-code. And no, this isn't made by AI either. The choice of naming is just my coding discipline.

* Applied missing const qualifier to signature of `ConvertToEulerAngles`
* Added Test Combination Guide for `t_EulerAngleConversionFlags`
* Renamed parameters of Euler Angle Conversion member functions
* Removed Confusing Euler Angle Conversion overloads
// The rest of the remaining sequence are yet to discover
// ...
} sequence;
struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is flags struct needed at all? Modern reversed just used enum with values that make sense:
https://github.com/gta-reversed/gta-reversed/blob/master/source/game_sa/Core/Matrix.h#L13
In real use-case person will just want to select one of reasonable options, not spending time configuring each flag one by one in some configuration object.

Copy link
Author

@Aldrin-John-Olaer-Manalansan Aldrin-John-Olaer-Manalansan Dec 25, 2025

Choose a reason for hiding this comment

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

I was my planing on declaring the conversion flag type into pure enum when the combinations are completely understood. Which is why I decided for the flags struct to stay the way it is as a safer fallback for advanced users to configure onto.

I wasn't aware about reversed source codes containing the euler conversion flags while was specifying the struct type. It's a bad habit of mine of reversing something myself instead of digging onto existing reversed source codes about it. The source material you've tagged here is identical to my findings and seems simpler to use than the current. Yea I think we should adapt the current onto that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants