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

Refactor as much as possible to GetEntInfo #245

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

mateon1
Copy link
Contributor

@mateon1 mateon1 commented Oct 29, 2024

No description provided.

@@ -4,5 +4,6 @@
// This file gets included by each source file, just like in Chunsoft's original source, so we can have this string easily just like they did.

// Later, we can move this into "global.h" before the #ifdef guard. But we can only do this if "global.h" isn't included outside of .c files...
#include "gba/defines.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, didn't mean to commit this, this was making coccinelle spew an annoying amount of errors on that ALIGNED(4) attribute if this was missing

@@ -549,7 +549,7 @@ void CheriBerryItemAction(Entity *pokemon, Entity *target)

void PechaBerryItemAction(Entity *pokemon, Entity *target)
{
if((u8)(target->axObj.info->nonVolatile.nonVolatileStatus - 2) <= 1)
if((u8)(GetEntInfo(target)->nonVolatile.nonVolatileStatus - 2) <= 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know, that's not related, but since you're at it, maybe you could fix that as well? It's prolly nonVolatileStatus == 1 || nonVolatileStatus == 2 or sth similar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept staring at this the past few PRs, but I think it's the crazy comparison macro, note that the u8 cast is after subtraction.

@@ -200,7 +200,7 @@ void HandleTakeItemAction(Entity *param_1)
Item item;

entity = sub_8044DA4(param_1,0);
info = entity->axObj.info;
info = entity->axObj.info; // GetEntInfo doesn't work here, probably fixable
info2 = entity->axObj.info;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it work if you get rid of info2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope.

@@ -856,7 +856,7 @@ bool8 sub_8058270(Entity *pokemon, Entity *target, Move *move, u32 param_4)
u32 r3;

r3 = 1;
if((u8)(target->axObj.info->charging.chargingStatus - 7) <= 1)
if((u8)(GetEntInfo(target)->charging.chargingStatus - 7) <= 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing with status here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto.

@AnonymousRandomPerson AnonymousRandomPerson merged commit d6197d5 into pret:master Oct 29, 2024
1 check passed
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.

3 participants