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

Experiment: remove global.h dependency from sys_math, sys_math3d, z_lib #1956

Merged
merged 7 commits into from
Jun 19, 2024

Conversation

mzxrules
Copy link
Contributor

Don't know if anyone is already working on this, or if it's what we want to do now, but I wanted to give it a shot anyway.

Anyway, quick summary of some significant changes:

Main goal was to just do sys_math.c/sys_math3d.c but a few other files got included in because of dependencies.

I split sys_math3d.c into a new sys_math3d_draw.c file, which eliminated a dependency on PlayState. Might not be a real file split, but I don't anticipate reverting it to be too difficult to do, and it makes it far less likely to trigger bss issues.

In z_lib.c/ichain.h I changed Actor_ProcessInitChain to take a void* actor instead of an Actor* actor, which removes the only dependency on z64actor.h. I think it's a fair change since InitChain isn't operating on the Actor struct members.

Made a bunch of new headers, hadn't really put much thought into the names or effort in cleaning it up.

Copy link
Contributor

@Thar0 Thar0 left a comment

Choose a reason for hiding this comment

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

Some things

include/ichain.h Outdated Show resolved Hide resolved
include/libultra_gu_math.h Outdated Show resolved Hide resolved
include/rand.h Outdated Show resolved Hide resolved
include/rand.h Show resolved Hide resolved
include/functions.h Outdated Show resolved Hide resolved
include/z_lib.h Outdated Show resolved Hide resolved
src/code/rand.c Outdated Show resolved Hide resolved
src/code/sys_math3d_draw.c Outdated Show resolved Hide resolved
src/code/z_lib.c Outdated Show resolved Hide resolved
src/code/z_lib.c Outdated Show resolved Hide resolved
@mzxrules
Copy link
Contributor Author

I found a few more math functions scattered about so I've done those as well. Perhaps the headers can be better organized, but I'm pressed for time atm.

include/z_lib.h Outdated Show resolved Hide resolved
src/code/fault.c Show resolved Hide resolved
@@ -8,6 +8,7 @@
#define MAXFLOAT 3.40282347e+38f
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
#define SQ(x) ((x)*(x))
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a standard C header, it should really only contain standard C macros. libultra probably should be changed so it doesn't use this and put it in z64math.h instead or something

@@ -0,0 +1,8 @@
#include "global.h"
#include "terminal.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why include this here?

@Dragorn421
Copy link
Collaborator

image

mzxrules — Today at 5:08 AM
CC0 for pr #1956

@fig02 fig02 merged commit 8d83727 into zeldaret:main Jun 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants