-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Simplify/Clean battle controllers code #3202
Simplify/Clean battle controllers code #3202
Conversation
On one hand, I'm glad we're able to untangle this mess :D |
I see no reason why the compatibility would be broken. I want the flow to remain the same, the difference being there is 1 function doing 1 thing, instead of 5 functions doing the same thing :D |
Awesome, we're on the same league then :D |
Ready for review. I also updated the first post with some more information. |
If it's not breaking, why does it have the |
You're right, I removed the tag. |
I love this PR :) |
{ | ||
u16 species; | ||
u32 side = GetBattlerSide(battler); | ||
struct Pokemon *party = GetBattlerParty(battler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think we can just consolidate all of these GetBattlerParty and gBattlerPartyIndexes into just GetBattlerPartyData calls. Sorry I should have noticed earlier
It might also make sense to replace the gActiveBattler check in edit: actually does this not break some implementations of calling BtlController_x inside the battle controller files since gActiveBattler is not explicitly set? |
This should also be done, but I think this PR is big enough as it is. |
Conflicts fixed. Ready to review & merge |
Been testing this in my own game and seems pretty solid. Will do some basic fresh expansion tests soon but should be good to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alex confirmed link battles work, singles and doubles work as expected locally as well
As we are all aware of, battle controllers' code is one of GF's worst creations. The amount of duplicated code over the controllers files is truly unmatched.
Goals of this PR:
This PR should be thoroughly tested as I might have accidentally omitted something while copying the functions. Things to keep an eye on are link battles, multi battles, recorded battles and multi link battles as things may break the most there.
Suggestions and reviews are welcome.
Note:
NONE of the functionality has changed, everything works exactly the same way as before. Compatibility with vanilla games is preserved(at least in the state it was before this PR).
Note 2:
I did the math and this PR saves approx whooping 80 064 bytes of space.