mirror of https://github.com/zeldaret/tmc.git
clang-format pass and workflow
This commit is contained in:
parent
fd2a50eee4
commit
31f324e3a7
|
@ -7,5 +7,5 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
- uses: DoozyX/clang-format-lint-action@v0.8
|
||||
with:
|
||||
source: 'src, include'
|
||||
source: './src ./include'
|
||||
clangFormatVersion: 10
|
||||
|
|
|
@ -170,7 +170,8 @@
|
|||
#define DmaWait(DmaNo) \
|
||||
{ \
|
||||
vu32*(DmaCntp) = (vu32*)REG_ADDR_DMA##DmaNo; \
|
||||
while (DmaCntp[2] & (DMA_ENABLE << 16)) ; \
|
||||
while (DmaCntp[2] & (DMA_ENABLE << 16)) \
|
||||
; \
|
||||
}
|
||||
|
||||
#define IntrEnable(flags) \
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#define RESET_REGS 0x80
|
||||
#define RESET_ALL 0xFF
|
||||
|
||||
#define SystemCall(x) { asm("svc " #x); }
|
||||
#define SystemCall(x) \
|
||||
{ asm("svc " #x); }
|
||||
|
||||
extern void SoundBiasReset();
|
||||
extern void SoundBiasSet();
|
||||
|
|
|
@ -193,5 +193,4 @@ extern void sub_0805E0FC();
|
|||
|
||||
void (*const gManagerFunctions[58])();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -172,7 +172,6 @@ extern void NPC58_Head(Entity*);
|
|||
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
|
||||
|
||||
void (*const gNPCFunctions[128][3])(Entity*);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -359,8 +359,7 @@ void sub_08017508(Entity* this) {
|
|||
|
||||
// regalloc
|
||||
NONMATCH("asm/non_matching/arm_proxy/sub_08017530.inc", void sub_08017530(Entity* this)) {
|
||||
if ((this->currentHealth & 0x7f) &&
|
||||
!ReadBit(&gUnk_020342F8, this->currentHealth - 1)) {
|
||||
if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((this->action == 0) && ((this->flags & 1) == 0)) {
|
||||
|
@ -519,10 +518,12 @@ NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Enti
|
|||
BoundingBox* bb_that = that->boundingBox;
|
||||
u32 this_w = bb_this->width;
|
||||
u32 that_w = bb_that->width;
|
||||
if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <= (this_w + that_w) * 2) {
|
||||
if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <=
|
||||
(this_w + that_w) * 2) {
|
||||
u32 this_h = bb_this->height;
|
||||
u32 that_h = bb_that->height;
|
||||
if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <= (this_h + that_h) * 2) {
|
||||
if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <=
|
||||
(this_h + that_h) * 2) {
|
||||
if ((this->field_0x3c & 0x10) != 0)
|
||||
this_d = ((BoundingBox3D*)bb_this)->depth;
|
||||
else
|
||||
|
|
|
@ -88,16 +88,8 @@ void sub_0804813C(Entity*);//
|
|||
u32 sub_08048158(u32);
|
||||
void sub_08048178(Entity*, u32);
|
||||
|
||||
void (* const gUnk_080D1AFC[8])(Entity*) = {
|
||||
sub_08046898,
|
||||
sub_08046910,
|
||||
sub_08046A9C,
|
||||
sub_08046CEC,
|
||||
sub_08046F64,
|
||||
sub_0804736C,
|
||||
sub_08047778,
|
||||
sub_08047B84
|
||||
};
|
||||
void (*const gUnk_080D1AFC[8])(Entity*) = { sub_08046898, sub_08046910, sub_08046A9C, sub_08046CEC,
|
||||
sub_08046F64, sub_0804736C, sub_08047778, sub_08047B84 };
|
||||
|
||||
void GyorgMale(Entity* this) {
|
||||
if (this->action) {
|
||||
|
@ -120,7 +112,8 @@ void GyorgMale(Entity* this) {
|
|||
void sub_08046898(Entity* this) {
|
||||
Entity* tmp = sub_080A7EE0(0x22);
|
||||
u32 tmp2;
|
||||
if (!tmp) return;
|
||||
if (!tmp)
|
||||
return;
|
||||
tmp->entityType.form = 1;
|
||||
tmp->parent = this;
|
||||
this->attachedEntity = tmp;
|
||||
|
@ -139,15 +132,8 @@ void sub_08046898(Entity* this) {
|
|||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1B1C[7])(Entity*) = {
|
||||
sub_08046930,
|
||||
sub_0804696C,
|
||||
sub_080469CC,
|
||||
sub_080469F4,
|
||||
sub_08046A30,
|
||||
sub_08046A54,
|
||||
sub_08046A78
|
||||
};
|
||||
void (*const gUnk_080D1B1C[7])(Entity*) = { sub_08046930, sub_0804696C, sub_080469CC, sub_080469F4,
|
||||
sub_08046A30, sub_08046A54, sub_08046A78 };
|
||||
|
||||
void sub_08046910(Entity* this) {
|
||||
gUnk_080D1B1C[this->previousActionFlag](this);
|
||||
|
@ -161,7 +147,8 @@ void sub_08046930(Entity* this) {
|
|||
this->nonPlanarMovement = 0x280;
|
||||
}
|
||||
sub_08047D88(this);
|
||||
if (this->field_0x7c.BYTES.byte0 == 0) return;
|
||||
if (this->field_0x7c.BYTES.byte0 == 0)
|
||||
return;
|
||||
this->previousActionFlag = 1;
|
||||
this->actionDelay = 1;
|
||||
this->animationState = 0;
|
||||
|
@ -227,13 +214,7 @@ void sub_08046A78(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1B38[5])(Entity*) = {
|
||||
sub_08046AE8,
|
||||
sub_08046B18,
|
||||
sub_08046B8C,
|
||||
sub_08046C04,
|
||||
sub_08046C88
|
||||
};
|
||||
void (*const gUnk_080D1B38[5])(Entity*) = { sub_08046AE8, sub_08046B18, sub_08046B8C, sub_08046C04, sub_08046C88 };
|
||||
|
||||
void sub_08046A9C(Entity* this) {
|
||||
if (this->animIndex == 1) {
|
||||
|
@ -281,7 +262,8 @@ void sub_08046B8C(Entity* this) {
|
|||
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x210;
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
this->direction =
|
||||
sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
|
@ -309,18 +291,13 @@ void sub_08046C88(Entity* this) {
|
|||
sub_08048178(this, sub_08048158(this->field_0x70.HALF_U.LO));
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
this->direction =
|
||||
sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1B4C[5])(Entity*) = {
|
||||
sub_08046D44,
|
||||
sub_08046D98,
|
||||
sub_08046E0C,
|
||||
sub_08046E68,
|
||||
sub_08046EF4
|
||||
};
|
||||
void (*const gUnk_080D1B4C[5])(Entity*) = { sub_08046D44, sub_08046D98, sub_08046E0C, sub_08046E68, sub_08046EF4 };
|
||||
|
||||
void sub_08046CEC(Entity* this) {
|
||||
if (this->animIndex == 0) {
|
||||
|
@ -337,16 +314,7 @@ void sub_08046CEC(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
const u16 gUnk_080D1B60[8] = {
|
||||
0x200,
|
||||
0x184,
|
||||
0x28C,
|
||||
0x210,
|
||||
0x200,
|
||||
0x29C,
|
||||
0x174,
|
||||
0x210
|
||||
};
|
||||
const u16 gUnk_080D1B60[8] = { 0x200, 0x184, 0x28C, 0x210, 0x200, 0x29C, 0x174, 0x210 };
|
||||
|
||||
void sub_08046D44(Entity* this) {
|
||||
const u16* tmp;
|
||||
|
@ -381,15 +349,13 @@ void sub_08046E0C(Entity* this) {
|
|||
this->field_0x76.HWORD = this->direction << 8;
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
this->direction =
|
||||
sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
const s16 gUnk_080D1B70[2] = {
|
||||
0x40,
|
||||
-0x40
|
||||
};
|
||||
const s16 gUnk_080D1B70[2] = { 0x40, -0x40 };
|
||||
|
||||
void sub_08046E68(Entity* this) {
|
||||
u32 tmp = ((Entity*)this->otherEntity)->next->animationState ^ 0x80;
|
||||
|
@ -411,24 +377,8 @@ void sub_08046E68(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
const u16 gUnk_080D1B74[0x10] = {
|
||||
0x20,
|
||||
0x40,
|
||||
0x60,
|
||||
0x80,
|
||||
0xA0,
|
||||
0xC0,
|
||||
0xE0,
|
||||
0x100,
|
||||
0x100,
|
||||
0xE0,
|
||||
0xC0,
|
||||
0xA0,
|
||||
0x80,
|
||||
0x60,
|
||||
0x40,
|
||||
0x20
|
||||
};
|
||||
const u16 gUnk_080D1B74[0x10] = { 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0, 0x100,
|
||||
0x100, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20 };
|
||||
|
||||
void sub_08046EF4(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
|
@ -449,18 +399,8 @@ void sub_08046EF4(Entity* this) {
|
|||
sub_08047E48(this);
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1B94[0xA])(Entity*) = {
|
||||
sub_08046FE8,
|
||||
sub_0804702C,
|
||||
sub_080470B4,
|
||||
sub_08047140,
|
||||
sub_0804717C,
|
||||
sub_080471C8,
|
||||
sub_0804723C,
|
||||
sub_08047284,
|
||||
sub_080472BC,
|
||||
sub_08047310
|
||||
};
|
||||
void (*const gUnk_080D1B94[0xA])(Entity*) = { sub_08046FE8, sub_0804702C, sub_080470B4, sub_08047140, sub_0804717C,
|
||||
sub_080471C8, sub_0804723C, sub_08047284, sub_080472BC, sub_08047310 };
|
||||
|
||||
void sub_08046F64(Entity* this) {
|
||||
if (this->animIndex == 0) {
|
||||
|
@ -512,10 +452,7 @@ void sub_0804702C(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
const u16 gUnk_080D1BBC[2] = {
|
||||
0x1A0,
|
||||
0xE0
|
||||
};
|
||||
const u16 gUnk_080D1BBC[2] = { 0x1A0, 0xE0 };
|
||||
|
||||
void sub_080470B4(Entity* this) {
|
||||
u32 tmp = 0x40;
|
||||
|
@ -565,7 +502,8 @@ void sub_080471C8(Entity* this) {
|
|||
this->direction++;
|
||||
}
|
||||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
if (gRoomControls.roomOriginY + 0x190 <= this->y.HALF.HI) return;
|
||||
if (gRoomControls.roomOriginY + 0x190 <= this->y.HALF.HI)
|
||||
return;
|
||||
if (this->field_0x74.HWORD > 0x100) {
|
||||
if (Random() & 1) {
|
||||
this->previousActionFlag = 6;
|
||||
|
@ -604,7 +542,8 @@ void sub_080472BC(Entity* this) {
|
|||
this->nonPlanarMovement += 8;
|
||||
}
|
||||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI) return;
|
||||
if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI)
|
||||
return;
|
||||
this->previousActionFlag = 9;
|
||||
this->field_0x76.HWORD = this->direction << 8;
|
||||
}
|
||||
|
@ -622,15 +561,8 @@ void sub_08047310(Entity* this) {
|
|||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1BC0[7])(Entity*) = {
|
||||
sub_080473B8,
|
||||
sub_080473F0,
|
||||
sub_08047484,
|
||||
sub_08047508,
|
||||
sub_080475F4,
|
||||
sub_0804763C,
|
||||
sub_0804772C
|
||||
};
|
||||
void (*const gUnk_080D1BC0[7])(Entity*) = { sub_080473B8, sub_080473F0, sub_08047484, sub_08047508,
|
||||
sub_080475F4, sub_0804763C, sub_0804772C };
|
||||
|
||||
void sub_0804736C(Entity* this) {
|
||||
if (this->animIndex == 1) {
|
||||
|
@ -812,13 +744,7 @@ void sub_0804772C(Entity* this) {
|
|||
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1BDC[5])(Entity*) = {
|
||||
sub_08047798,
|
||||
sub_080477F0,
|
||||
sub_08047914,
|
||||
sub_08047978,
|
||||
sub_08047B08
|
||||
};
|
||||
void (*const gUnk_080D1BDC[5])(Entity*) = { sub_08047798, sub_080477F0, sub_08047914, sub_08047978, sub_08047B08 };
|
||||
|
||||
void sub_08047778(Entity* this) {
|
||||
gUnk_080D1BDC[this->previousActionFlag](this);
|
||||
|
@ -838,10 +764,7 @@ void sub_08047798(Entity* this) {
|
|||
sub_08047D88(this);
|
||||
}
|
||||
|
||||
const s16 gUnk_080D1BF0[2] = {
|
||||
0x80,
|
||||
-0x80
|
||||
};
|
||||
const s16 gUnk_080D1BF0[2] = { 0x80, -0x80 };
|
||||
|
||||
void sub_080477F0(Entity* this) {
|
||||
if (this->nonPlanarMovement < 0x300) {
|
||||
|
@ -866,7 +789,8 @@ void sub_080477F0(Entity* this) {
|
|||
this->field_0x76.HWORD = this->animationState << 8;
|
||||
this->field_0x74.HWORD = gUnk_080D1BF0[Random() & 1];
|
||||
if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 1) {
|
||||
((Entity*) this->otherEntity)->next->field_0x78.HALF.HI = gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI ? 0x81 : 0x83;
|
||||
((Entity*)this->otherEntity)->next->field_0x78.HALF.HI =
|
||||
gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI ? 0x81 : 0x83;
|
||||
} else {
|
||||
((Entity*)this->otherEntity)->next->field_0x78.HALF.HI = 0x80;
|
||||
}
|
||||
|
@ -920,8 +844,10 @@ void sub_08047978(Entity* this) {
|
|||
this->spriteRendering.b3 = 2;
|
||||
this->direction = this->animationState;
|
||||
}
|
||||
if (this->currentHealth != 0) return;
|
||||
if (this->attachedEntity->action != 1) return;
|
||||
if (this->currentHealth != 0)
|
||||
return;
|
||||
if (this->attachedEntity->action != 1)
|
||||
return;
|
||||
this->previousActionFlag = 4;
|
||||
if (this->entityType.form == 0) {
|
||||
if ((((Entity*)this->otherEntity)->next->animationState >> 6) == 1) {
|
||||
|
@ -945,7 +871,6 @@ void sub_08047978(Entity* this) {
|
|||
}
|
||||
this->field_0x82.HWORD += gRoomControls.roomOriginY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sub_08047B08(Entity* this) {
|
||||
|
@ -953,7 +878,8 @@ void sub_08047B08(Entity* this) {
|
|||
this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI);
|
||||
this->nonPlanarMovement = 0x200;
|
||||
sub_08047E58(this);
|
||||
if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) return;
|
||||
if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4))
|
||||
return;
|
||||
if (this->entityType.form == 0) {
|
||||
this->action = 7;
|
||||
this->previousActionFlag = 0;
|
||||
|
@ -967,11 +893,7 @@ void sub_08047B08(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void (* const gUnk_080D1BF4[3])(Entity*) = {
|
||||
sub_08047BA4,
|
||||
sub_08047BF0,
|
||||
sub_08047D24
|
||||
};
|
||||
void (*const gUnk_080D1BF4[3])(Entity*) = { sub_08047BA4, sub_08047BF0, sub_08047D24 };
|
||||
|
||||
void sub_08047B84(Entity* this) {
|
||||
gUnk_080D1BF4[this->previousActionFlag](this);
|
||||
|
@ -991,12 +913,7 @@ void sub_08047BA4(Entity* this) {
|
|||
sub_08047BF0(this);
|
||||
}
|
||||
|
||||
const s8 gUnk_080D1C00[4] = {
|
||||
0x40,
|
||||
-0x40,
|
||||
-0x40,
|
||||
0x40
|
||||
};
|
||||
const s8 gUnk_080D1C00[4] = { 0x40, -0x40, -0x40, 0x40 };
|
||||
|
||||
void sub_08047BF0(Entity* this) {
|
||||
Entity* tmp;
|
||||
|
@ -1074,11 +991,15 @@ void sub_08047D88(Entity* this) {
|
|||
tmp = ((tmp << 1) & 0x7F) | (tmp & 0x80);
|
||||
this->field_0x7c.BYTES.byte0 = tmp;
|
||||
tmp2 = this->spriteRendering.b3;
|
||||
if (tmp2 == 3 && gPlayerState.field_0x14 != 0) return;
|
||||
if (this->animIndex == 1) return;
|
||||
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) return;
|
||||
if (tmp2 == 3 && gPlayerState.field_0x14 != 0)
|
||||
return;
|
||||
if (this->animIndex == 1)
|
||||
return;
|
||||
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
|
||||
return;
|
||||
gPlayerState.field_0x14 = 1;
|
||||
if (gPlayerEntity.height.HALF.HI != 0) return;
|
||||
if (gPlayerEntity.height.HALF.HI != 0)
|
||||
return;
|
||||
this->field_0x7c.BYTES.byte0 |= 1;
|
||||
}
|
||||
|
||||
|
@ -1120,7 +1041,8 @@ void sub_08047EA4(Entity* this, u32 unk1) {
|
|||
u32 tmp2, dir;
|
||||
this->field_0x78.HWORD = unk1;
|
||||
tmp = this->field_0x78.HWORD - this->field_0x7a.HWORD;
|
||||
if (tmp + 0x100 < 0x200u) return;
|
||||
if (tmp + 0x100 < 0x200u)
|
||||
return;
|
||||
if (this->field_0x7c.BYTES.byte0 & 1) {
|
||||
tmp2 = sub_08047F68(this) << 8;
|
||||
dir = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI);
|
||||
|
@ -1132,16 +1054,8 @@ void sub_08047EA4(Entity* this, u32 unk1) {
|
|||
this->field_0x7a.HWORD = this->field_0x78.HWORD;
|
||||
}
|
||||
|
||||
const u16 gUnk_080D1C04[0x20] = {
|
||||
0, 1, 4, 9,
|
||||
16, 25, 36, 49,
|
||||
64, 81, 100, 121,
|
||||
144, 169, 196, 225,
|
||||
256, 289, 324, 361,
|
||||
400, 441, 484, 529,
|
||||
576, 625, 676, 729,
|
||||
784, 841, 900, 961
|
||||
};
|
||||
const u16 gUnk_080D1C04[0x20] = { 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225,
|
||||
256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961 };
|
||||
|
||||
u32 sub_08047F68(Entity* this) {
|
||||
s32 diffX, diffY;
|
||||
|
@ -1149,7 +1063,8 @@ u32 sub_08047F68(Entity* this) {
|
|||
diffX = gPlayerEntity.x.HALF.HI - this->x.HALF.HI;
|
||||
diffY = gPlayerEntity.y.HALF.HI - this->y.HALF.HI;
|
||||
distSquared = (diffX * diffX) + (diffY * diffY);
|
||||
if (distSquared == 0x400) return 0x20;
|
||||
if (distSquared == 0x400)
|
||||
return 0x20;
|
||||
if (distSquared < gUnk_080D1C04[0x10]) {
|
||||
approx = 0x8;
|
||||
} else {
|
||||
|
@ -1181,11 +1096,14 @@ u32 sub_08047F68(Entity* this) {
|
|||
}
|
||||
|
||||
void sub_08048004(Entity* this) {
|
||||
if (this->action == 0) return;
|
||||
if (this->action == 0)
|
||||
return;
|
||||
if (this->animIndex == 0) {
|
||||
this->flags &= ~0x80;
|
||||
if (gPlayerEntity.height.HALF.HI != 0) return;
|
||||
if (!sub_08079F8C()) return;
|
||||
if (gPlayerEntity.height.HALF.HI != 0)
|
||||
return;
|
||||
if (!sub_08079F8C())
|
||||
return;
|
||||
if (this->field_0x7c.BYTES.byte0 & 1) {
|
||||
u32 b = this->spriteRendering.b3;
|
||||
if (b == 3) {
|
||||
|
@ -1196,7 +1114,8 @@ void sub_08048004(Entity* this) {
|
|||
if (!(this->field_0x7c.BYTES.byte0 & 2)) {
|
||||
this->field_0x7c.BYTES.byte0 |= 0x80;
|
||||
}
|
||||
if ((this->field_0x7c.BYTES.byte0 & 0x80)) return;
|
||||
if ((this->field_0x7c.BYTES.byte0 & 0x80))
|
||||
return;
|
||||
gPlayerEntity.x.HALF.HI = this->cutsceneBeh.HWORD;
|
||||
gPlayerEntity.y.HALF.HI = this->field_0x86.HWORD;
|
||||
return;
|
||||
|
@ -1208,7 +1127,8 @@ void sub_08048004(Entity* this) {
|
|||
if (b != 3) {
|
||||
if (sub_0806FCB8(&gPlayerEntity, this->x.HALF.HI, this->y.HALF.HI, 0x24)) {
|
||||
if (!(this->field_0x7c.BYTES.byte0 & 2)) {
|
||||
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI);
|
||||
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI,
|
||||
gPlayerEntity.y.HALF.HI - this->y.HALF.HI);
|
||||
gPlayerEntity.x.WORD = this->x.WORD + (gSineTable[tmp] * 9216);
|
||||
gPlayerEntity.y.WORD = this->y.WORD - (gSineTable[tmp + 0x40] * 9216);
|
||||
}
|
||||
|
@ -1226,41 +1146,19 @@ void sub_0804813C(Entity* this) {
|
|||
sub_080A1ED0(rand & 7, 1, (rand >> 8) & 3);
|
||||
}
|
||||
|
||||
|
||||
const u8 gUnk_080D1C44[0xC] = {
|
||||
0, 2, 6, 0,
|
||||
2, 4, 2, 4,
|
||||
6, 0, 4, 6
|
||||
};
|
||||
const u8 gUnk_080D1C44[0xC] = { 0, 2, 6, 0, 2, 4, 2, 4, 6, 0, 4, 6 };
|
||||
|
||||
u32 sub_08048158(u32 unk1) {
|
||||
return gUnk_080D1C44[(unk1 * 3) + ((signed)Random() % 3)];
|
||||
}
|
||||
|
||||
const u16 gUnk_080D1C50[8] = {
|
||||
0x200,
|
||||
0x180,
|
||||
0x2C0,
|
||||
0x210,
|
||||
0x200,
|
||||
0x2A0,
|
||||
0x140,
|
||||
0x210
|
||||
};
|
||||
const u16 gUnk_080D1C50[8] = { 0x200, 0x180, 0x2C0, 0x210, 0x200, 0x2A0, 0x140, 0x210 };
|
||||
|
||||
const u16 gUnk_080D1C60[8] = {
|
||||
0x200,
|
||||
0x150,
|
||||
0x290,
|
||||
0x210,
|
||||
0x200,
|
||||
0x2D0,
|
||||
0x170,
|
||||
0x210
|
||||
};
|
||||
const u16 gUnk_080D1C60[8] = { 0x200, 0x150, 0x290, 0x210, 0x200, 0x2D0, 0x170, 0x210 };
|
||||
|
||||
void sub_08048178(Entity* this, u32 unk1) {
|
||||
const u16* tmp = ((((Entity*) this->otherEntity)->next->animationState >> 6 & 1) ? gUnk_080D1C60 + unk1: gUnk_080D1C50 + unk1);
|
||||
const u16* tmp =
|
||||
((((Entity*)this->otherEntity)->next->animationState >> 6 & 1) ? gUnk_080D1C60 + unk1 : gUnk_080D1C50 + unk1);
|
||||
this->field_0x80.HWORD = *tmp + gRoomControls.roomOriginX;
|
||||
this->field_0x82.HWORD = *(tmp + 1) + gRoomControls.roomOriginY;
|
||||
}
|
||||
|
|
|
@ -1146,8 +1146,7 @@ void sub_08051874(void) {
|
|||
gUnk_02019EE0.saveStatus[gUnk_02019EE0.unk7] = temp;
|
||||
switch (temp) {
|
||||
case 1:
|
||||
_DmaCopy(&gSave, &gUnk_02019EE0.saves[gUnk_02019EE0.unk7],
|
||||
sizeof(gUnk_02019EE0.saves[gUnk_02019EE0.unk7]));
|
||||
_DmaCopy(&gSave, &gUnk_02019EE0.saves[gUnk_02019EE0.unk7], sizeof(gUnk_02019EE0.saves[gUnk_02019EE0.unk7]));
|
||||
SetFileSelectState(0);
|
||||
break;
|
||||
case -1:
|
||||
|
|
|
@ -2,62 +2,13 @@
|
|||
|
||||
// TODO: change all manager arguments to be Entity* and cast to specific type later.
|
||||
void (*const gManagerFunctions[])() = {
|
||||
NULL,
|
||||
Manager1,
|
||||
Manager2,
|
||||
sub_080576C0,
|
||||
sub_08057854,
|
||||
sub_08057AD0,
|
||||
sub_08057CB4,
|
||||
Manager7_Main,
|
||||
sub_08057ED0,
|
||||
sub_080581D8,
|
||||
sub_08058380,
|
||||
sub_080585F0,
|
||||
sub_0805884C,
|
||||
sub_08058DD0,
|
||||
sub_08058E60,
|
||||
sub_08058ECC,
|
||||
sub_08059570,
|
||||
sub_080599B8,
|
||||
sub_080599EC,
|
||||
sub_08059DAC,
|
||||
sub_08059E58,
|
||||
sub_0805A280,
|
||||
sub_0805AB4C,
|
||||
sub_0805AD48,
|
||||
sub_0805ADD8,
|
||||
sub_0805AF60,
|
||||
sub_0805B030,
|
||||
sub_0805B3B4,
|
||||
sub_0805B53C,
|
||||
sub_0805B5C8,
|
||||
Manager1E_Handler,
|
||||
sub_0805B6F4,
|
||||
sub_0805B7A0,
|
||||
sub_0805B820,
|
||||
sub_0805B8EC,
|
||||
sub_0805BC74,
|
||||
sub_0805BF18,
|
||||
sub_0805C61C,
|
||||
sub_0805C6B8,
|
||||
Manager27,
|
||||
Manager28_Entry,
|
||||
sub_0805CB90,
|
||||
sub_0805CFC0,
|
||||
sub_0805D014,
|
||||
sub_0805D174,
|
||||
sub_0805D1FC,
|
||||
sub_0805D250,
|
||||
sub_0805D3C8,
|
||||
Manager30_Main,
|
||||
sub_0805D630,
|
||||
sub_0805D7A4,
|
||||
sub_0805DAE8,
|
||||
sub_0805DB94,
|
||||
sub_0805DC84,
|
||||
sub_0805DDB4,
|
||||
sub_0805DE38,
|
||||
sub_0805E0A8,
|
||||
sub_0805E0FC
|
||||
NULL, Manager1, Manager2, sub_080576C0, sub_08057854, sub_08057AD0, sub_08057CB4,
|
||||
Manager7_Main, sub_08057ED0, sub_080581D8, sub_08058380, sub_080585F0, sub_0805884C, sub_08058DD0,
|
||||
sub_08058E60, sub_08058ECC, sub_08059570, sub_080599B8, sub_080599EC, sub_08059DAC, sub_08059E58,
|
||||
sub_0805A280, sub_0805AB4C, sub_0805AD48, sub_0805ADD8, sub_0805AF60, sub_0805B030, sub_0805B3B4,
|
||||
sub_0805B53C, sub_0805B5C8, Manager1E_Handler, sub_0805B6F4, sub_0805B7A0, sub_0805B820, sub_0805B8EC,
|
||||
sub_0805BC74, sub_0805BF18, sub_0805C61C, sub_0805C6B8, Manager27, Manager28_Entry, sub_0805CB90,
|
||||
sub_0805CFC0, sub_0805D014, sub_0805D174, sub_0805D1FC, sub_0805D250, sub_0805D3C8, Manager30_Main,
|
||||
sub_0805D630, sub_0805D7A4, sub_0805DAE8, sub_0805DB94, sub_0805DC84, sub_0805DDB4, sub_0805DE38,
|
||||
sub_0805E0A8, sub_0805E0FC
|
||||
};
|
||||
|
|
|
@ -15,19 +15,13 @@ typedef struct {
|
|||
u16 playerInRegionFlag;
|
||||
} Manager1E;
|
||||
|
||||
enum Manager1E_State {
|
||||
Init,
|
||||
ObserveRegion
|
||||
};
|
||||
enum Manager1E_State { Init, ObserveRegion };
|
||||
|
||||
void Manager1E_Handler(Manager1E*);
|
||||
void Manager1E_Init(Manager1E*);
|
||||
void Manager1E_ObserveRegion(Manager1E*);
|
||||
|
||||
void (* const Manager1E_ActionFuncs[2])(Manager1E*) = {
|
||||
Manager1E_Init,
|
||||
Manager1E_ObserveRegion
|
||||
};
|
||||
void (*const Manager1E_ActionFuncs[2])(Manager1E*) = { Manager1E_Init, Manager1E_ObserveRegion };
|
||||
|
||||
void Manager1E_Handler(Manager1E* this) {
|
||||
Manager1E_ActionFuncs[this->manager.action](this);
|
||||
|
|
|
@ -17,11 +17,7 @@ void sub_0805C6D0(Manager26*);
|
|||
void sub_0805C7A0(Manager26*);
|
||||
void sub_0805C7C4(Manager26*);
|
||||
|
||||
void (* const gUnk_08108D04[])(Manager26*) = {
|
||||
sub_0805C6D0,
|
||||
sub_0805C7A0,
|
||||
sub_0805C7C4
|
||||
};
|
||||
void (*const gUnk_08108D04[])(Manager26*) = { sub_0805C6D0, sub_0805C7A0, sub_0805C7C4 };
|
||||
|
||||
void sub_0805C7CC(Manager26*);
|
||||
|
||||
|
|
|
@ -11,16 +11,9 @@ void sub_0805C894(Entity*);
|
|||
void sub_0805C8B4(Entity*);
|
||||
void sub_0805C908(Entity*);
|
||||
|
||||
void (*const gUnk_08108D10[])(Entity*) = {
|
||||
sub_0805C874,
|
||||
sub_0805C894,
|
||||
sub_0805C8B4,
|
||||
sub_0805C908
|
||||
};
|
||||
void (*const gUnk_08108D10[])(Entity*) = { sub_0805C874, sub_0805C894, sub_0805C8B4, sub_0805C908 };
|
||||
|
||||
const u8 gUnk_08108D20[] = {
|
||||
0x6F, 0x70, 0x71, 0x72, 0x71, 0x70
|
||||
};
|
||||
const u8 gUnk_08108D20[] = { 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 };
|
||||
|
||||
void Manager27(Entity* this) {
|
||||
|
||||
|
|
|
@ -18,20 +18,11 @@ u32 Manager28_FindMatchingEntities(Manager28*);
|
|||
Entity* Manager28_FindMatchingEntity(EntityData*);
|
||||
void Manager28_RemoveDeletedEntities(Manager28*);
|
||||
|
||||
void (* const Manager28_ActionFuncs[])(Manager28*) = {
|
||||
Manager28_Init,
|
||||
Manager28_Main
|
||||
};
|
||||
void (*const Manager28_ActionFuncs[])(Manager28*) = { Manager28_Init, Manager28_Main };
|
||||
|
||||
enum Manager28_Action {
|
||||
Init = 0,
|
||||
Main = 1
|
||||
};
|
||||
enum Manager28_Action { Init = 0, Main = 1 };
|
||||
|
||||
enum Manager28_InitState {
|
||||
DoInit = 0,
|
||||
DoNotInit = 1
|
||||
};
|
||||
enum Manager28_InitState { DoInit = 0, DoNotInit = 1 };
|
||||
|
||||
void Manager28_Entry(Manager28* this) {
|
||||
Manager28_ActionFuncs[this->manager.action](this);
|
||||
|
@ -93,19 +84,25 @@ void Manager28_Main(Manager28* this) {
|
|||
u32 Manager28_FindMatchingEntities(Manager28* this) {
|
||||
u32 re = 0;
|
||||
EntityData* tmp = GetCurrentRoomProperty(this->manager.unk_0b);
|
||||
if (!tmp) return 0;
|
||||
if (!tmp)
|
||||
return 0;
|
||||
for (; *((u8*)tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) {
|
||||
Entity* tmp2;
|
||||
u32 i;
|
||||
if (tmp->type != 3) continue;
|
||||
if (tmp->type != 3)
|
||||
continue;
|
||||
tmp2 = Manager28_FindMatchingEntity(tmp);
|
||||
if (!tmp2) continue;
|
||||
if (!tmp2)
|
||||
continue;
|
||||
for (i = 0; i < re; i++) {
|
||||
if (this->d.enemies[i] == tmp2) break;
|
||||
if (this->d.enemies[i] == tmp2)
|
||||
break;
|
||||
}
|
||||
if (i != re) continue;
|
||||
if (i != re)
|
||||
continue;
|
||||
this->d.enemies[re++] = tmp2;
|
||||
if (re == 8) return 8;
|
||||
if (re == 8)
|
||||
return 8;
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
@ -118,11 +115,8 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
|
|||
y = unk1->yPos + gRoomControls.roomOriginY;
|
||||
tmp = &gUnk_03003D90;
|
||||
for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) {
|
||||
if (x == i->x.HALF.HI
|
||||
&& y == i->y.HALF.HI
|
||||
&& unk1->subtype == i->entityType.subtype
|
||||
&& 3 == i->entityType.type
|
||||
&& unk1->form == i->entityType.form) {
|
||||
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->entityType.subtype &&
|
||||
3 == i->entityType.type && unk1->form == i->entityType.form) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -141,5 +135,6 @@ void Manager28_RemoveDeletedEntities(Manager28* this) {
|
|||
this->manager.unk_0e--;
|
||||
}
|
||||
}
|
||||
if (this->manager.unk_0e <= 1) DeleteThisEntity();
|
||||
if (this->manager.unk_0e <= 1)
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ void sub_0805E1F8(u32, u32);
|
|||
|
||||
void sub_0805E0FC(Manager39* this) {
|
||||
gUnk_08108E28[this->manager.action](this);
|
||||
if ((gRoomControls.roomID != this->unk_20)
|
||||
|| (gTextBox.doTextBox & 0x7F)) {
|
||||
if ((gRoomControls.roomID != this->unk_20) || (gTextBox.doTextBox & 0x7F)) {
|
||||
sub_0805E1D8(this);
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +53,8 @@ void sub_0805E140(Manager39* this) {
|
|||
}
|
||||
|
||||
void sub_0805E18C(Manager39* this) {
|
||||
if (gFadeControl.active) return;
|
||||
if (gFadeControl.active)
|
||||
return;
|
||||
if (this->manager.unk_0b) {
|
||||
if (!--this->manager.unk_0f) {
|
||||
this->manager.unk_0b = 0;
|
||||
|
@ -86,7 +86,8 @@ void sub_0805E1F8(u32 unk0, u32 unk1) {
|
|||
tmp.unk_04 = unk0 >> 8;
|
||||
tmp.unk_05 = unk0;
|
||||
tmp2 = gUnk_08108E48;
|
||||
if (!unk1) tmp2 = gUnk_08108E30;
|
||||
if (!unk1)
|
||||
tmp2 = gUnk_08108E30;
|
||||
sub_0805F46C(&tmp, tmp2);
|
||||
gScreen.bg.bg3Control = 1;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "functions.h"
|
||||
#include "save.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
s32 unk_20;
|
||||
|
@ -60,11 +59,7 @@ void sub_08058894(ManagerC*);
|
|||
void sub_080588CC(ManagerC*);
|
||||
void nullsub_108(ManagerC*);
|
||||
|
||||
void (* const gUnk_0810821C[])(ManagerC*) = {
|
||||
sub_08058894,
|
||||
sub_080588CC,
|
||||
nullsub_108
|
||||
};
|
||||
void (*const gUnk_0810821C[])(ManagerC*) = { sub_08058894, sub_080588CC, nullsub_108 };
|
||||
|
||||
void sub_0805884C(ManagerC* this) {
|
||||
u32 tmp;
|
||||
|
@ -90,7 +85,8 @@ void sub_080588CC(ManagerC* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void nullsub_108(ManagerC* this) {}
|
||||
void nullsub_108(ManagerC* this) {
|
||||
}
|
||||
|
||||
#define ABS_DIFF_GT(a, b, c) (signed)a - b >= 0 ? a - b > c : b - a > c
|
||||
|
||||
|
@ -140,50 +136,27 @@ void sub_080588F8(ManagerC* this) {
|
|||
}
|
||||
}
|
||||
|
||||
const struct_08108228 gUnk_08108228[6] = {
|
||||
{0x40, 0x2A, 0x1C, 0x10},
|
||||
{0x3C, 0x24, 0x1C, 0x12},
|
||||
{0x3C, 0x1C, 0x1A, 0x18},
|
||||
{0x38, 0x16, 0x1C, 0x16},
|
||||
{0x34, 0x16, 0x1E, 0x0E},
|
||||
{0x30, 0x16, 0x20, 0x0A}
|
||||
};
|
||||
const struct_08108228 gUnk_08108228[6] = { { 0x40, 0x2A, 0x1C, 0x10 }, { 0x3C, 0x24, 0x1C, 0x12 },
|
||||
{ 0x3C, 0x1C, 0x1A, 0x18 }, { 0x38, 0x16, 0x1C, 0x16 },
|
||||
{ 0x34, 0x16, 0x1E, 0x0E }, { 0x30, 0x16, 0x20, 0x0A } };
|
||||
|
||||
const struct_08108228 gUnk_08108258[6] = {
|
||||
{0x30, 0x88, 0x20, 0x0A},
|
||||
{0x34, 0x7E, 0x1E, 0x12},
|
||||
{0x38, 0x78, 0x1A, 0x16},
|
||||
{0x3A, 0x70, 0x1A, 0x18},
|
||||
{0x3C, 0x64, 0x1E, 0x1E},
|
||||
{0x3E, 0x6A, 0x1C, 0x10}
|
||||
};
|
||||
const struct_08108228 gUnk_08108258[6] = { { 0x30, 0x88, 0x20, 0x0A }, { 0x34, 0x7E, 0x1E, 0x12 },
|
||||
{ 0x38, 0x78, 0x1A, 0x16 }, { 0x3A, 0x70, 0x1A, 0x18 },
|
||||
{ 0x3C, 0x64, 0x1E, 0x1E }, { 0x3E, 0x6A, 0x1C, 0x10 } };
|
||||
|
||||
const struct_08108228 gUnk_08108288[6] = {
|
||||
{0x98, 0x2A, 0x1C, 0x10},
|
||||
{0x98, 0x24, 0x1C, 0x12},
|
||||
{0x9C, 0x1C, 0x1A, 0x18},
|
||||
{0x9C, 0x16, 0x1C, 0x16},
|
||||
{0xA0, 0x16, 0x1E, 0x0E},
|
||||
{0xA0, 0x16, 0x20, 0x0A}
|
||||
};
|
||||
const struct_08108228 gUnk_08108288[6] = { { 0x98, 0x2A, 0x1C, 0x10 }, { 0x98, 0x24, 0x1C, 0x12 },
|
||||
{ 0x9C, 0x1C, 0x1A, 0x18 }, { 0x9C, 0x16, 0x1C, 0x16 },
|
||||
{ 0xA0, 0x16, 0x1E, 0x0E }, { 0xA0, 0x16, 0x20, 0x0A } };
|
||||
|
||||
const struct_08108228 gUnk_081082B8[6] = {
|
||||
{0xA0, 0x88, 0x20, 0x0A},
|
||||
{0x9E, 0x7E, 0x1E, 0x12},
|
||||
{0x9C, 0x78, 0x1A, 0x16},
|
||||
{0x9A, 0x70, 0x1A, 0x18},
|
||||
{0x98, 0x64, 0x1E, 0x1E},
|
||||
{0x98, 0x6A, 0x1C, 0x10}
|
||||
};
|
||||
const struct_08108228 gUnk_081082B8[6] = { { 0xA0, 0x88, 0x20, 0x0A }, { 0x9E, 0x7E, 0x1E, 0x12 },
|
||||
{ 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 },
|
||||
{ 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } };
|
||||
|
||||
void sub_08058A04(ManagerC* this) {
|
||||
s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
|
||||
s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY;
|
||||
if ((this->unk_20 - 0x118 < 0xDu) &&
|
||||
CheckGlobalFlag(LV1TARU_OPEN) &&
|
||||
(tmp - 0x6d < 0x17u) &&
|
||||
(tmp2 - 0x45 < 0x17u) &&
|
||||
(gPlayerEntity.height.HALF.HI == 0)) {
|
||||
if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) &&
|
||||
(tmp2 - 0x45 < 0x17u) && (gPlayerEntity.height.HALF.HI == 0)) {
|
||||
gPlayerState.playerAction = 3;
|
||||
gPlayerState.field_0x38 = 0;
|
||||
gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x78;
|
||||
|
@ -228,12 +201,7 @@ u32 sub_08058B08(ManagerC* this, u32 unk1, u32 unk2, const struct_08108228* unk3
|
|||
}
|
||||
}
|
||||
|
||||
const u16 gUnk_081082E8[0xC] = {
|
||||
0xB8, 0x80, 0x0,
|
||||
0xB8, 0x110, 0x2,
|
||||
0x118, 0x80, 0x2,
|
||||
0x118, 0x110, 0x0
|
||||
};
|
||||
const u16 gUnk_081082E8[0xC] = { 0xB8, 0x80, 0x0, 0xB8, 0x110, 0x2, 0x118, 0x80, 0x2, 0x118, 0x110, 0x0 };
|
||||
|
||||
void sub_08058B5C(ManagerC* this, u32 unk1) {
|
||||
gScreenTransition.transitioningOut = 1;
|
||||
|
@ -262,7 +230,9 @@ void sub_08058BC8(ManagerC* this) {
|
|||
do {
|
||||
u32 indx = ((tmp3 << 7) / 0xA0) & 0xFF;
|
||||
tmp2.sx = 0x100 + ((gSineTable[indx] * 3) >> 2);
|
||||
tmp2.sy = 0x100 - ((gSineTable[indx * 2] * 2) >> 5);//yes, it makes no sense to multiply first and then shift right, but it's matching this way
|
||||
tmp2.sy =
|
||||
0x100 - ((gSineTable[indx * 2] * 2) >>
|
||||
5); // yes, it makes no sense to multiply first and then shift right, but it's matching this way
|
||||
tmp2.texY = (this->unk_20 + tmp3) << 8;
|
||||
BgAffineSet(&tmp2, tmp, 1);
|
||||
tmp++;
|
||||
|
@ -278,9 +248,7 @@ void sub_08058BC8(ManagerC* this) {
|
|||
gScreen.controls.bg2yPointMostSig = ((union SplitWord*)&tmp->dy)->HALF.HI;
|
||||
}
|
||||
|
||||
const u16 gUnk_08108300[4] = {
|
||||
0xA4, 0x4C, 0xF4, 0x9C
|
||||
};
|
||||
const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C };
|
||||
|
||||
void sub_08058CB0(ManagerC* this) {
|
||||
u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
|
||||
|
|
|
@ -21,29 +21,8 @@ extern void sub_080A306C();
|
|||
extern void NulledItem();
|
||||
|
||||
void (*const gPlayerItemFunctions[])() = {
|
||||
DeleteEntity,
|
||||
sub_080A7544,
|
||||
sub_0801B188,
|
||||
sub_0801B45C,
|
||||
sub_08018FCC,
|
||||
sub_080A2D74,
|
||||
sub_08054A40,
|
||||
sub_08056330,
|
||||
sub_080ADA30,
|
||||
sub_080704BC,
|
||||
DeleteEntity,
|
||||
DeleteEntity,
|
||||
sub_0801B898,
|
||||
CellOverwriteSet,
|
||||
SwordSpin,
|
||||
SwordBeam,
|
||||
sub_080ACBCC,
|
||||
Item11,
|
||||
sub_080700E8,
|
||||
sub_080ACF14,
|
||||
Item14,
|
||||
sub_080A306C,
|
||||
SwordBeam,
|
||||
NulledItem,
|
||||
CellOverwriteSet
|
||||
DeleteEntity, sub_080A7544, sub_0801B188, sub_0801B45C, sub_08018FCC, sub_080A2D74, sub_08054A40,
|
||||
sub_08056330, sub_080ADA30, sub_080704BC, DeleteEntity, DeleteEntity, sub_0801B898, CellOverwriteSet,
|
||||
SwordSpin, SwordBeam, sub_080ACBCC, Item11, sub_080700E8, sub_080ACF14, Item14,
|
||||
sub_080A306C, SwordBeam, NulledItem, CellOverwriteSet
|
||||
};
|
||||
|
|
198
src/script.c
198
src/script.c
|
@ -156,145 +156,28 @@ extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32);
|
|||
extern void sub_0801C4A0(u32);
|
||||
|
||||
void (*const gUnk_0811E524[])() = {
|
||||
nullsub_507,
|
||||
sub_0807E004,
|
||||
sub_0807E014,
|
||||
sub_0807E024,
|
||||
sub_0807E050,
|
||||
sub_0807E064,
|
||||
sub_0807E078,
|
||||
sub_0807E0A0,
|
||||
sub_0807E0B8,
|
||||
sub_0807E0CC,
|
||||
sub_0807E0E0,
|
||||
sub_0807E10C,
|
||||
sub_0807E124,
|
||||
sub_0807E148,
|
||||
sub_0807E158,
|
||||
sub_0807E188,
|
||||
nullsub_507, sub_0807E004, sub_0807E014, sub_0807E024, sub_0807E050, sub_0807E064, sub_0807E078, sub_0807E0A0,
|
||||
sub_0807E0B8, sub_0807E0CC, sub_0807E0E0, sub_0807E10C, sub_0807E124, sub_0807E148, sub_0807E158, sub_0807E188,
|
||||
sub_0807E1D8,
|
||||
sub_0807E4AC, // defined out of order
|
||||
sub_0807E200,
|
||||
sub_0807E220,
|
||||
sub_0807E240,
|
||||
sub_0807E260,
|
||||
sub_0807E280,
|
||||
sub_0807E2A8,
|
||||
sub_0807E2E4,
|
||||
sub_0807E30C,
|
||||
sub_0807E390,
|
||||
sub_0807E3BC,
|
||||
sub_0807E3E8,
|
||||
sub_0807E40C,
|
||||
sub_0807E42C,
|
||||
sub_0807E48C,
|
||||
sub_0807E4CC,
|
||||
sub_0807E4EC,
|
||||
sub_0807E514,
|
||||
sub_0807E538,
|
||||
sub_0807E564,
|
||||
sub_0807E584,
|
||||
sub_0807E5A0,
|
||||
sub_0807E5CC,
|
||||
sub_0807E5F8,
|
||||
sub_0807E610,
|
||||
sub_0807E628,
|
||||
sub_0807E634,
|
||||
sub_0807E644,
|
||||
sub_0807E650,
|
||||
sub_0807E65C,
|
||||
sub_0807E668,
|
||||
sub_0807E674,
|
||||
sub_0807E680,
|
||||
sub_0807E690,
|
||||
sub_0807E6AC,
|
||||
sub_0807E6DC,
|
||||
sub_0807E700,
|
||||
sub_0807E72C,
|
||||
sub_0807E75C,
|
||||
sub_0807E778,
|
||||
sub_0807E788,
|
||||
sub_0807E79C,
|
||||
nullsub_508,
|
||||
sub_0807E7B0,
|
||||
sub_0807E7C4,
|
||||
sub_0807E7D8,
|
||||
sub_0807E7EC,
|
||||
sub_0807E800,
|
||||
sub_0807E80C,
|
||||
sub_0807E858,
|
||||
sub_0807E864,
|
||||
sub_0807E878,
|
||||
sub_0807E888,
|
||||
sub_0807E898,
|
||||
sub_0807E8C4,
|
||||
sub_0807E8D4,
|
||||
sub_0807E8E4,
|
||||
sub_0807E200, sub_0807E220, sub_0807E240, sub_0807E260, sub_0807E280, sub_0807E2A8, sub_0807E2E4, sub_0807E30C,
|
||||
sub_0807E390, sub_0807E3BC, sub_0807E3E8, sub_0807E40C, sub_0807E42C, sub_0807E48C, sub_0807E4CC, sub_0807E4EC,
|
||||
sub_0807E514, sub_0807E538, sub_0807E564, sub_0807E584, sub_0807E5A0, sub_0807E5CC, sub_0807E5F8, sub_0807E610,
|
||||
sub_0807E628, sub_0807E634, sub_0807E644, sub_0807E650, sub_0807E65C, sub_0807E668, sub_0807E674, sub_0807E680,
|
||||
sub_0807E690, sub_0807E6AC, sub_0807E6DC, sub_0807E700, sub_0807E72C, sub_0807E75C, sub_0807E778, sub_0807E788,
|
||||
sub_0807E79C, nullsub_508, sub_0807E7B0, sub_0807E7C4, sub_0807E7D8, sub_0807E7EC, sub_0807E800, sub_0807E80C,
|
||||
sub_0807E858, sub_0807E864, sub_0807E878, sub_0807E888, sub_0807E898, sub_0807E8C4, sub_0807E8D4, sub_0807E8E4,
|
||||
sub_0807E8E4, // duplicate
|
||||
sub_0807E8E4, // duplicate
|
||||
sub_0807E8E4, // duplicate
|
||||
sub_0807E908,
|
||||
sub_0807E914,
|
||||
sub_0807E924,
|
||||
sub_0807E930,
|
||||
sub_0807E944,
|
||||
sub_0807E974,
|
||||
sub_0807E9D4,
|
||||
sub_0807E9DC,
|
||||
sub_0807E9E4,
|
||||
sub_0807E9F0,
|
||||
sub_0807EA4C,
|
||||
sub_0807EA88,
|
||||
sub_0807EA94,
|
||||
sub_0807EAB4,
|
||||
sub_0807EAC0,
|
||||
sub_0807EAD0,
|
||||
sub_0807EAF0,
|
||||
sub_0807EB18,
|
||||
sub_0807EB28,
|
||||
sub_0807EB38,
|
||||
sub_0807EB44,
|
||||
sub_0807EB4C,
|
||||
sub_0807EB74,
|
||||
sub_0807EB8C,
|
||||
sub_0807EBA8,
|
||||
sub_0807EBB0,
|
||||
sub_0807EBC0,
|
||||
sub_0807EBC8,
|
||||
sub_0807EBD8,
|
||||
sub_0807EBF4,
|
||||
sub_0807EC08,
|
||||
nullsub_509,
|
||||
sub_0807EC1C,
|
||||
sub_0807EC64,
|
||||
sub_0807EC94,
|
||||
sub_0807ECC4,
|
||||
sub_0807ECF4,
|
||||
sub_0807ED24,
|
||||
sub_0807EDD4,
|
||||
sub_0807EE04,
|
||||
sub_0807EE30,
|
||||
sub_0807EEB4,
|
||||
sub_0807EEF4,
|
||||
sub_0807EF3C,
|
||||
sub_0807EF80,
|
||||
sub_0807EF90,
|
||||
sub_0807EFA0,
|
||||
sub_0807EFAC,
|
||||
sub_0807EFD4,
|
||||
sub_0807EFE4,
|
||||
sub_0807EFF4,
|
||||
sub_0807F004,
|
||||
sub_0807F010,
|
||||
sub_0807F034,
|
||||
sub_0807F050,
|
||||
sub_0807F060,
|
||||
sub_0807F078,
|
||||
sub_0807F088,
|
||||
sub_0807F098,
|
||||
sub_0807F0A4,
|
||||
sub_0807F0B4,
|
||||
sub_0807F0C8
|
||||
sub_0807E908, sub_0807E914, sub_0807E924, sub_0807E930, sub_0807E944, sub_0807E974, sub_0807E9D4, sub_0807E9DC,
|
||||
sub_0807E9E4, sub_0807E9F0, sub_0807EA4C, sub_0807EA88, sub_0807EA94, sub_0807EAB4, sub_0807EAC0, sub_0807EAD0,
|
||||
sub_0807EAF0, sub_0807EB18, sub_0807EB28, sub_0807EB38, sub_0807EB44, sub_0807EB4C, sub_0807EB74, sub_0807EB8C,
|
||||
sub_0807EBA8, sub_0807EBB0, sub_0807EBC0, sub_0807EBC8, sub_0807EBD8, sub_0807EBF4, sub_0807EC08, nullsub_509,
|
||||
sub_0807EC1C, sub_0807EC64, sub_0807EC94, sub_0807ECC4, sub_0807ECF4, sub_0807ED24, sub_0807EDD4, sub_0807EE04,
|
||||
sub_0807EE30, sub_0807EEB4, sub_0807EEF4, sub_0807EF3C, sub_0807EF80, sub_0807EF90, sub_0807EFA0, sub_0807EFAC,
|
||||
sub_0807EFD4, sub_0807EFE4, sub_0807EFF4, sub_0807F004, sub_0807F010, sub_0807F034, sub_0807F050, sub_0807F060,
|
||||
sub_0807F078, sub_0807F088, sub_0807F098, sub_0807F0A4, sub_0807F0B4, sub_0807F0C8
|
||||
};
|
||||
|
||||
extern const u16 gUnk_08016984;
|
||||
|
@ -599,7 +482,8 @@ void sub_0807DF50(void) {
|
|||
}
|
||||
|
||||
void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
if (!unk2->unk_00) return;
|
||||
if (!unk2->unk_00)
|
||||
return;
|
||||
if (unk2->unk_10) {
|
||||
unk2->unk_10--;
|
||||
} else {
|
||||
|
@ -608,7 +492,8 @@ void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
do {
|
||||
u32 cmd = GetNextScriptCommandHalfword(unk2->unk_00);
|
||||
u16* tmp;
|
||||
if (cmd == 0xFFFF) return;
|
||||
if (cmd == 0xFFFF)
|
||||
return;
|
||||
tmp2->unk_06 = cmd >> 0xA;
|
||||
tmp2->unk_04 = cmd & 0x3FF;
|
||||
tmp = unk2->unk_00;
|
||||
|
@ -622,7 +507,8 @@ void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
}
|
||||
}
|
||||
|
||||
void nullsub_507(Entity* unk1, ScriptExecutionContext* unk2) {}
|
||||
void nullsub_507(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
}
|
||||
|
||||
void sub_0807E004(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
gUnk_02033280.unk_07 |= 2;
|
||||
|
@ -684,11 +570,13 @@ void sub_0807E0E0(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
}
|
||||
|
||||
void sub_0807E10C(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
((void (*)(Entity*, ScriptExecutionContext*)) GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00))(unk1, unk2);
|
||||
((void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00))(unk1,
|
||||
unk2);
|
||||
}
|
||||
|
||||
void sub_0807E124(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
void (* tmp)(Entity*, ScriptExecutionContext*) = (void (*)(Entity*, ScriptExecutionContext*)) GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
|
||||
void (*tmp)(Entity*, ScriptExecutionContext*) =
|
||||
(void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
|
||||
unk2->unk_04 = GetNextScriptCommandWord(unk2->unk_00 + 3);
|
||||
tmp(unk1, unk2);
|
||||
}
|
||||
|
@ -701,7 +589,8 @@ void sub_0807E158(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00);
|
||||
u32 tmp2 = 0;
|
||||
u32 tmp3 = gUnk_02033280.unk_00;
|
||||
if ((tmp3 & tmp) == tmp) tmp2 = 1;
|
||||
if ((tmp3 & tmp) == tmp)
|
||||
tmp2 = 1;
|
||||
unk2->unk_14 = tmp2;
|
||||
gUnk_02033280.unk_00 = tmp3 & ~tmp;
|
||||
gUnk_02033280.unk_07 |= 1;
|
||||
|
@ -787,9 +676,8 @@ void sub_0807E2E4(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
}
|
||||
|
||||
void sub_0807E30C(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
if ((unk2->unk_1A & 0xF) == 0
|
||||
&& (gPlayerState.flags.all & 0x80) == 0
|
||||
&& sub_080041A0(unk1, &gPlayerEntity, 0x28, 0x28)) {
|
||||
if ((unk2->unk_1A & 0xF) == 0 && (gPlayerState.flags.all & 0x80) == 0 &&
|
||||
sub_080041A0(unk1, &gPlayerEntity, 0x28, 0x28)) {
|
||||
unk1->animationState = sub_0806F5B0(GetFacingDirection(unk1, &gPlayerEntity));
|
||||
}
|
||||
unk2->unk_1A++;
|
||||
|
@ -994,7 +882,8 @@ void sub_0807E79C(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
sub_080500F4(gUnk_02033280.unk_08);
|
||||
}
|
||||
|
||||
void nullsub_508(Entity* unk1, ScriptExecutionContext* unk2) {}
|
||||
void nullsub_508(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
}
|
||||
|
||||
void sub_0807E7B0(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
DoFade(4, gUnk_02033280.unk_08);
|
||||
|
@ -1103,16 +992,19 @@ void sub_0807E944(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
void sub_0807E974(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
switch (unk2->unk_18) {
|
||||
default:
|
||||
if (!--unk2->unk_19) return;
|
||||
if (!--unk2->unk_19)
|
||||
return;
|
||||
break;
|
||||
case 0:
|
||||
if (!unk1->interactType) break;
|
||||
if (!unk1->interactType)
|
||||
break;
|
||||
unk1->interactType = 0;
|
||||
unk2->unk_18++;
|
||||
TextboxNoOverlapFollow(unk2->unk_00[1]);
|
||||
break;
|
||||
case 1:
|
||||
if (gTextBox.doTextBox & 0x7F) break;
|
||||
if (gTextBox.doTextBox & 0x7F)
|
||||
break;
|
||||
unk2->unk_18 = 2;
|
||||
unk2->unk_19 = 0xF;
|
||||
break;
|
||||
|
@ -1217,7 +1109,8 @@ void sub_0807EB44(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
}
|
||||
|
||||
void sub_0807EB4C(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY));
|
||||
unk1->animationState = sub_0806F5B0(
|
||||
sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY));
|
||||
}
|
||||
|
||||
void sub_0807EB74(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
|
@ -1259,7 +1152,8 @@ void sub_0807EC08(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
CopyPosition(&gPlayerEntity, unk1);
|
||||
}
|
||||
|
||||
void nullsub_509(Entity* unk1, ScriptExecutionContext* unk2) {}
|
||||
void nullsub_509(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
}
|
||||
|
||||
void sub_0807EC1C(Entity* unk1, ScriptExecutionContext* unk2) {
|
||||
if (!unk2->unk_18) {
|
||||
|
@ -1332,7 +1226,8 @@ void sub_0807ED24(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
tmp = unk2->unk_00[2];
|
||||
tmp3 = unk1->y.HALF.HI - gRoomControls.roomOriginY;
|
||||
unk2->unk_20.WORD = ((tmp - tmp3) << 0x10) / unk2->unk_12;
|
||||
unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY));
|
||||
unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX,
|
||||
unk2->unk_00[2] + gRoomControls.roomOriginY));
|
||||
unk2->unk_08 |= 2;
|
||||
} else {
|
||||
if (!--unk2->unk_12) {
|
||||
|
@ -1411,7 +1306,8 @@ void sub_0807EF3C(Entity* unk1, ScriptExecutionContext* unk2) {
|
|||
unk2->unk_1C.HALF.LO = unk2->unk_00[2] << 8;
|
||||
sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO);
|
||||
} else {
|
||||
if (!sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO)) return;
|
||||
if (!sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO))
|
||||
return;
|
||||
}
|
||||
gUnk_02033280.unk_06 = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue