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

Can't use #define-d constants in event.inc macros #4757

Open
mrgriffin opened this issue Jun 11, 2024 · 1 comment
Open

Can't use #define-d constants in event.inc macros #4757

mrgriffin opened this issue Jun 11, 2024 · 1 comment
Labels
bug Bug status: unconfirmed This bug has not been reproduced yet

Comments

@mrgriffin
Copy link
Collaborator

Description

Context

I think the problem is that the test system .includes event.inc, which means that cpp doesn't run over it, so if you use, e.g. PARTY_SIZE or SPECIES_NONE or whatever in that file you'll get a linker error.

To fix this we could move all the scripts out into .s files, and assemble them the usual way. That change would end up looking like:

-    RUN_OVERWORLD_SCRIPT(
-        hasgigantamaxfactor 0;
-    );
+   extern const u8 TestScript_HasGigantamaxFactor0[];
+   RunScriptImmediately(RunScriptImmediately);
+TestScript_HasGigantamaxFactor0::
+  hasgigantamaxfactor 0
+  end

So, makes the tests more annoying to read and write because now you're juggling two files and need to give names to all the scripts. But I think it will allow us to use constants. Alex and I aren't sure if it's currently worth doing, but I've raised the issue so that we don't forget how to fix it in the future if we want to.

Version

1.8.4 (Latest release)

Upcoming/master Version

No response

Discord contact info

No response

@mrgriffin mrgriffin added bug Bug status: unconfirmed This bug has not been reproduced yet labels Jun 11, 2024
@mrgriffin
Copy link
Collaborator Author

#5033 has a hacky workaround: .setting the constants that we need: https://github.com/rh-hideout/pokeemerald-expansion/pull/5033/files#diff-dc229fb98aa82e4418f93a183ac1637de405898e3ed72eab4bfb6bc49cd791f2

Obviously this is not a particularly good solution, so I'm leaving this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug status: unconfirmed This bug has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant