Skip to content

Decompile unk_02097268#445

Merged
adrienntindall merged 16 commits intopret:masterfrom
PikalaxALT:decomp/unk_02097268
Apr 15, 2026
Merged

Decompile unk_02097268#445
adrienntindall merged 16 commits intopret:masterfrom
PikalaxALT:decomp/unk_02097268

Conversation

@PikalaxALT
Copy link
Copy Markdown
Collaborator

Safari zone objects code

Must come after #444

@PikalaxALT PikalaxALT self-assigned this Feb 3, 2026
@PikalaxALT PikalaxALT requested review from adrienntindall and tgsm and removed request for adrienntindall April 5, 2026 12:12
Copy link
Copy Markdown
Collaborator

@adrienntindall adrienntindall left a comment

Choose a reason for hiding this comment

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

GitHub merges got messy so I'm only reviewing unk_02097268 and trusting that other changes were from previous PRs.

Just a few suggestions, then you need to deal with merge conflicts and it should be good to go.

Also: Are there any holdbacks in naming this safari_zone_objects.c?

Comment thread src/unk_02097268.c
SafariZone *safariZone = Save_SafariZone_Get(saveData);
SAFARIZONE_AREASET *areaSet = SafariZone_GetAreaSet(safariZone, 0);

static const u16 ffff = 0xFFFF;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

needed to match

Comment thread src/unk_02097268.c Outdated
int i;
int j;
int numAreas;
ENC_SLOT *allEncounterSlots[SAFARI_ZONE_MAX_AREAS_PER_SET][NUM_SAFARI_ENCOUNTER_TYPES];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ENC_SLOT -> EncounterSlot

Didn't this get fixed in the last PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed by resolving conflicts

Comment thread src/unk_02097268.c Outdated
u8 areas[SAFARI_ZONE_MAX_AREAS_PER_SET];
PhoneCallPersistentState *callPersistentState = SaveData_GetPhoneCallPersistentState(saveData);
SafariZone *safariZone = Save_SafariZone_Get(saveData);
SAFARIZONE_AREASET *areaSet = SafariZone_GetAreaSet(safariZone, 0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

SAFARIZONE_AREASET -> SafariZoneAreaSet

Comment thread src/unk_02097268.c
for (i = 0; i < SAFARI_ZONE_MAX_AREAS_PER_SET; ++i) {
// (((ffff >> i) & 1) * 4) + 1
// fancy way of saying
// mapHasWater ? 5 : 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this not match if you make i (and maybe j) into an 8 bit? This seems like it isn't the written code even if gamefreak does do weird stuff sometimes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it does not match by any simpler method. i did use the leaks to guide this, it's actually from a scrapped feature

Comment thread src/unk_02097268.c Outdated
ret[i].level_max = ret[i].level_min = slot->level;
}

{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is the scope required to match?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

turns out, it's not

Copy link
Copy Markdown
Collaborator

@adrienntindall adrienntindall left a comment

Choose a reason for hiding this comment

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

Gamefreak's kind of wild for this one

@adrienntindall adrienntindall merged commit 9d4d566 into pret:master Apr 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants