Skip to content

battle: match BattleUpdateUnitMasks - #266

Merged
Xeeynamo merged 1 commit into
Xeeynamo:mainfrom
GinNoOokami:BattleUpdateUnitMasks
Oct 5, 2026
Merged

Xeeynamo merged 1 commit into
Xeeynamo:mainfrom
GinNoOokami:BattleUpdateUnitMasks

Conversation

@GinNoOokami

Copy link
Copy Markdown
Contributor

Added symbol size to g_BattleSceneContext. Wasn't 100% sure on the unnamed locals, but I think var_t3 represents targetable actors, and var_s1 are those driven by AI scripts (stateFlags & 0x8/0x10, respectively). Pretty sure 0xF and 0x3F0 are masks for the party and enemies. I'll add constants for these in a separate cleanup pass.

The last loop is what needed the BattleData refactor. unk174 was offset locally from unitZoneMask in the asm, and while I found a nested dummy struct that matched, it seemed pretty unnatural. Given what we know about the PC build, the BattleData struct is a much simpler solution that fits neatly.

@Xeeynamo Xeeynamo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Left a comment for a potential follow-up

Comment thread src/battle/battle.c
stateFlags = g_BattleState.combatant[i].stateFlags;
status = g_BattleState.combatant[i].status;

if (stateFlags & 8) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We need an enum for this at some point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I want to work towards understanding these stateFlags better.

@Xeeynamo
Xeeynamo merged commit f815bed into Xeeynamo:main Oct 5, 2026
1 check passed
@GinNoOokami
GinNoOokami deleted the BattleUpdateUnitMasks branch October 5, 2026 18:20
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.

2 participants