Skip to content

Match: Parts of src/66250.c#36

Draft
Bl00D4NGEL wants to merge 6 commits into
Drahsid:masterfrom
Bl00D4NGEL:match/66250
Draft

Match: Parts of src/66250.c#36
Bl00D4NGEL wants to merge 6 commits into
Drahsid:masterfrom
Bl00D4NGEL:match/66250

Conversation

@Bl00D4NGEL

Copy link
Copy Markdown
Contributor

No description provided.

@Drahsid Drahsid 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.

minor issues: mostly not labeling flags with the enums, missing use of FIXED_POINT, and minor style.

Comment thread src/66250.c
Comment on lines +1019 to +1020
gActors[actor_index].velocityX.raw = Math_ApproachS32(gActors[actor_index].velocityX.raw, 0, 0x4000);
gActors[actor_index].velocityY.raw = Math_ApproachS32(gActors[actor_index].velocityY.raw, 0, 0x4000);

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.

0x4000 FixedUnit

Comment thread src/66250.c
void func_8007A8B0(u16 actor_index) {
u16 sp1E;

if (!(gActors[actor_index].flags_098 & 2) || (gActors[actor_index].var_150 & 0x100000)) {

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.

Suggested change
if (!(gActors[actor_index].flags_098 & 2) || (gActors[actor_index].var_150 & 0x100000)) {
if (!(gActors[actor_index].flags_098 & ACTOR_FLAG3_UNK1) || (gActors[actor_index].var_150 & 0x100000)) {

Comment thread src/66250.c
}

sp1E = gActors[actor_index].unk_0D6;
gActors[actor_index].graphicFlags &= ~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.

Suggested change
gActors[actor_index].graphicFlags &= ~8;
gActors[actor_index].graphicFlags &= ~ACTOR_GFLAG_ROTZ;

Comment thread src/66250.c
gActors[arg0].flags |= 0x1000;
gActors[arg0].var_150 &= ~0x300000;
D_800BE704 = 0x10;
gActors[arg0 + 1].flags = 2;

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.

Suggested change
gActors[arg0 + 1].flags = 2;
gActors[arg0 + 1].flags = ACTOR_FLAG_ACTIVE;

Comment thread src/66250.c
}
else {
gActors[arg0].state = 0x10;
gActors[arg0].flags |= 0x1000;

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.

Suggested change
gActors[arg0].flags |= 0x1000;
gActors[arg0].flags |= ACTOR_FLAG_UNK12;

Comment thread src/66250.c
var_f0 = -var_f0;
}
gActors[arg0].rotateZ = var_f0;
if (gActors[arg0].flags & 0x20) {

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.

Suggested change
if (gActors[arg0].flags & 0x20) {
if (gActors[arg0].flags & ACTOR_FLAG_FLIPPED) {

Comment thread src/66250.c
Comment on lines +1207 to +1212
gActors[arg0].flags &= ~0x20;
gActors[0].flags &= ~0x20;
}
if (gActors[arg0].velocityX.raw < FIXED_UNIT(-1.5)) {
gActors[arg0].flags |= 0x20;
gActors[0].flags |= 0x20;

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.

Suggested change
gActors[arg0].flags &= ~0x20;
gActors[0].flags &= ~0x20;
}
if (gActors[arg0].velocityX.raw < FIXED_UNIT(-1.5)) {
gActors[arg0].flags |= 0x20;
gActors[0].flags |= 0x20;
gActors[arg0].flags &= ~ACTOR_FLAG_FLIPPED;
gActors[0].flags &= ~ACTOR_FLAG_FLIPPED;
}
if (gActors[arg0].velocityX.raw < FIXED_UNIT(-1.5)) {
gActors[arg0].flags |= ACTOR_FLAG_FLIPPED;
gActors[0].flags |= ACTOR_FLAG_FLIPPED;

Comment thread src/66250.c
Comment on lines +1259 to +1273
gActors[arg0].flags_098 |= gActors[arg0 + 1].flags_098;
if (gActors[arg0].flags_098 & 0x10) {
gActors[arg0].velocityY.raw = -FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if (gActors[arg0].flags_098 & 0x20) {
gActors[arg0].velocityY.raw = FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if ((gActors[arg0].flags_098 & 4) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX0, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {
gActors[arg0].velocityX.raw = FIXED_UNIT(2);
gActors[arg0].posX.whole = gActors[arg0 + 1].posX.whole;
gActors[arg0].var_15C = 0;
}
if ((gActors[arg0].flags_098 & 8) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX1, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {

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.

Suggested change
gActors[arg0].flags_098 |= gActors[arg0 + 1].flags_098;
if (gActors[arg0].flags_098 & 0x10) {
gActors[arg0].velocityY.raw = -FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if (gActors[arg0].flags_098 & 0x20) {
gActors[arg0].velocityY.raw = FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if ((gActors[arg0].flags_098 & 4) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX0, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {
gActors[arg0].velocityX.raw = FIXED_UNIT(2);
gActors[arg0].posX.whole = gActors[arg0 + 1].posX.whole;
gActors[arg0].var_15C = 0;
}
if ((gActors[arg0].flags_098 & 8) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX1, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {
gActors[arg0].flags_098 |= gActors[arg0 + 1].flags_098;
if (gActors[arg0].flags_098 & ACTOR_FLAG3_UNK4) {
gActors[arg0].velocityY.raw = -FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if (gActors[arg0].flags_098 & ACTOR_FLAG3_UNK5) {
gActors[arg0].velocityY.raw = FIXED_UNIT(2);
gActors[arg0].posY.whole = gActors[arg0 + 1].posY.whole;
}
if ((gActors[arg0].flags_098 & ACTOR_FLAG3_UNK2) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX0, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {
gActors[arg0].velocityX.raw = FIXED_UNIT(2);
gActors[arg0].posX.whole = gActors[arg0 + 1].posX.whole;
gActors[arg0].var_15C = 0;
}
if ((gActors[arg0].flags_098 & ACTOR_FLAG3_UNK3) || (func_80012AB4(gActors[arg0 + 1].posX.whole + gActors[arg0 + 1].hitboxBX1, (gActors[arg0 + 1].posY.whole + gActors[arg0 + 1].hitboxBY0) - 8) & 0x80)) {

Comment thread src/66250.c
Comment on lines +1221 to +1255
} else {
if (gButtonHold & gButton_DLeft) {
gActors[arg0].var_15C -= 0x4000;
} else if (gButtonHold & gButton_DRight) {
gActors[arg0].var_15C += 0x4000;
} else if (gActors[arg0].flags & 0x20) {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, -0x8000, 0x1000);
} else {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, 0x8000, 0x1000);
}
}
var_a3 = gButtonHold & gButton_LTrig;
if (var_a3 || (gButtonHold & gButton_RTrig)) {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, 0x28000);
var_a3 = 0x40000;
var_a3 |= 0x8000;
} else {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, FIXED_UNIT(8));
var_a3 = 0x30000;
var_a3 |= 0x8000;
}

if (gActors[arg0].unk_118 >= 0.0f) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x1000);
} else if (gButtonHold & gButton_DUp) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, var_a3, 0x4000);
} else if (gButtonHold & gButton_DDown) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -var_a3, 0x4000);
} else if ((gActors[arg0].velocityX.raw > FIXED_UNIT(2)) || (gActors[arg0].velocityX.raw < FIXED_UNIT(-2))) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x4000);
} else if (gActiveFrames & 0x10) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0x18000, 0x4000);
} else {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -0x18000, 0x4000);
}

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.

Suggested change
} else {
if (gButtonHold & gButton_DLeft) {
gActors[arg0].var_15C -= 0x4000;
} else if (gButtonHold & gButton_DRight) {
gActors[arg0].var_15C += 0x4000;
} else if (gActors[arg0].flags & 0x20) {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, -0x8000, 0x1000);
} else {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, 0x8000, 0x1000);
}
}
var_a3 = gButtonHold & gButton_LTrig;
if (var_a3 || (gButtonHold & gButton_RTrig)) {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, 0x28000);
var_a3 = 0x40000;
var_a3 |= 0x8000;
} else {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, FIXED_UNIT(8));
var_a3 = 0x30000;
var_a3 |= 0x8000;
}
if (gActors[arg0].unk_118 >= 0.0f) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x1000);
} else if (gButtonHold & gButton_DUp) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, var_a3, 0x4000);
} else if (gButtonHold & gButton_DDown) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -var_a3, 0x4000);
} else if ((gActors[arg0].velocityX.raw > FIXED_UNIT(2)) || (gActors[arg0].velocityX.raw < FIXED_UNIT(-2))) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x4000);
} else if (gActiveFrames & 0x10) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0x18000, 0x4000);
} else {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -0x18000, 0x4000);
}
}
else {
if (gButtonHold & gButton_DLeft) {
gActors[arg0].var_15C -= 0x4000;
}
else if (gButtonHold & gButton_DRight) {
gActors[arg0].var_15C += 0x4000;
}
else if (gActors[arg0].flags & 0x20) {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, -0x8000, 0x1000);
}
else {
gActors[arg0].var_15C = Math_ApproachS32(gActors[arg0].var_15C, 0x8000, 0x1000);
}
}
var_a3 = gButtonHold & gButton_LTrig;
if (var_a3 || (gButtonHold & gButton_RTrig)) {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, 0x28000);
var_a3 = 0x40000;
var_a3 |= 0x8000;
}
else {
gActors[arg0].var_15C = Math_ClampLimit(gActors[arg0].var_15C, FIXED_UNIT(8));
var_a3 = 0x30000;
var_a3 |= 0x8000;
}
if (gActors[arg0].unk_118 >= 0.0f) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x1000);
}
else if (gButtonHold & gButton_DUp) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, var_a3, 0x4000);
}
else if (gButtonHold & gButton_DDown) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -var_a3, 0x4000);
}
else if ((gActors[arg0].velocityX.raw > FIXED_UNIT(2)) || (gActors[arg0].velocityX.raw < FIXED_UNIT(-2))) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0, 0x4000);
}
else if (gActiveFrames & 0x10) {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, 0x18000, 0x4000);
}
else {
gActors[arg0].velocityY.raw = Math_ApproachS32(gActors[arg0].velocityY.raw, -0x18000, 0x4000);
}

Code style: no cuddled else

Comment thread src/66250.c
Comment on lines +1301 to +1302
} else {
func_80035A20(arg0);

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.

Suggested change
} else {
func_80035A20(arg0);
}
else {
func_80035A20(arg0);

@Drahsid Drahsid marked this pull request as draft June 30, 2026 22:12
Comment thread src/66250.c
Actor* temp_v0;
s32 var_v1;

temp_v0 = &gActors[arg0];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only calling this out since using Actor pointers sometimes prevents matches. Devs seemed to prefer using indexes instead of pointers so I'd recommend matching with: https://decomp.me/scratch/HZDfG

Otherwise, aside from the Drahsid's recommendations. this looks great!

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