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

CCover #621

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

CCover #621

wants to merge 14 commits into from

Conversation

b00tkitism
Copy link

No description provided.

source/game_sa/Cover.cpp Outdated Show resolved Hide resolved
Pirulax
Pirulax previously approved these changes Sep 26, 2023
@yukani
Copy link
Collaborator

yukani commented Sep 26, 2023

Note for future: We're usually reversing per-class basis. If you want to reverse all of CCover methods, open a CCover PR with all reversed functions committed.

@Pirulax
Copy link
Collaborator

Pirulax commented Sep 26, 2023

It's fine I do functions only time to time too.
But yeah, CCover seems easy, you could try reversing the rest of it too.

@b00tkitism b00tkitism changed the title reversed CCover::Init CCover Sep 26, 2023
@b00tkitism
Copy link
Author

b00tkitism commented Sep 27, 2023

btw the codes that I wrote are not clean, I'll reverse whole CCover and then make the code more cleaner.

vector.x = (float)sin(direction * 0.02454369);
vector.y = (float)cos(direction * 0.02454369);
vector.z = 0.0;
return vector;
}

// unused
// 0x698790
CVector CCover::FindVectorFromFirstToMissingVertex(CColTriangle* triangle, int32* a3, CVector* vertPositions) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

CVector CCover::FindVectorFromFirstToMissingVertex(CColTriangle *tri, uint32 *sharedVert, CVector *vertices)

source/game_sa/Cover.cpp Outdated Show resolved Hide resolved
source/game_sa/Cover.cpp Outdated Show resolved Hide resolved
Comment on lines 132 to 134
vector.x = (float)sin(direction * 0.02454369);
vector.y = (float)cos(direction * 0.02454369);
vector.z = 0.0;
Copy link
Contributor

@temajm temajm Oct 1, 2023

Choose a reason for hiding this comment

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

Suggested change
vector.x = (float)sin(direction * 0.02454369);
vector.y = (float)cos(direction * 0.02454369);
vector.z = 0.0;
vector.x = -sinf(direction * 0.02454369f);
vector.y = cosf(direction * 0.02454369f);
vector.z = 0.0f;

How do you like the idea of ​​adding the following functions to common.h and using them?:

constexpr inline uint8_t CompressRad(float rad) { return (uint8)(rad * (128.0f / PI)); }
constexpr inline float DecompressRad(uint8 rad) { return (float)rad * (PI / 128.0f); }

Then it can be implemented like this:

    return CVector{
        -std::sinf(DecompressRad(direction)),
        std::cosf(DecompressRad(direction)),
        0.0f
    };

Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you like the idea of ​​adding the following functions to common.h and using them?

FixedFloat<uint8, 128.0f / PI> can be used for this purpose

Copy link
Collaborator

@Pirulax Pirulax Oct 1, 2023

Choose a reason for hiding this comment

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

We could also typedef it for this purpose.
using FixedRadians = FixedFloat<uint8, 128.0f / PI>

Copy link
Collaborator

Choose a reason for hiding this comment

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

that's kinda errnous tho, it should be 255 / PI... Though seemingly they did use 256 instead, which might've lead to overflows... :D

@yukani yukani dismissed Pirulax’s stale review October 1, 2023 17:00

PR scope changed

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.

None yet

4 participants