diff --git a/include/enemy/gyorg.h b/include/enemy/gyorg.h index a45b3657..a372dcdf 100644 --- a/include/enemy/gyorg.h +++ b/include/enemy/gyorg.h @@ -88,6 +88,6 @@ typedef struct { u16 unk_38; u16 unk_3a; u8 unk_3c; -} GyorgFemaleHeap; +} GyorgHeap; #endif diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index 33e96136..e524e711 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -33,6 +33,11 @@ extern u8 gUnk_080B3E80[]; extern u8 gUnk_080B37A0[]; extern u16 gMetatileTypesTop[]; +extern const u8 gUnk_080D1A94[]; +extern const u8 gUnk_080D1AAC[]; +extern const u8 gUnk_080D1AC4[]; +extern const u8 gUnk_080D1ADC[]; + void sub_0804614C(GyorgFemaleEntity*); void sub_0804625C(GyorgFemaleEntity*); void sub_0804632C(GyorgFemaleEntity*); @@ -55,10 +60,10 @@ void sub_0804614C(GyorgFemaleEntity* this) { tmp = CreateProjectile(0x22); tmp->type = 0; tmp->parent = super; - ((GyorgFemaleHeap*)super->myHeap)->unk_14 = (GenericEntity*)tmp; + ((GyorgHeap*)super->myHeap)->unk_14 = (GenericEntity*)tmp; tmp = CreateEnemy(GYORG_FEMALE_MOUTH, 0); tmp->parent = super; - ((GyorgFemaleHeap*)super->myHeap)->unk_10 = (GyorgFemaleMouthEntity*)tmp; + ((GyorgHeap*)super->myHeap)->unk_10 = (GyorgFemaleMouthEntity*)tmp; tmp = CreateEnemy(GYORG_FEMALE_EYE, 0); tmp->parent = super; tmp = CreateEnemy(GYORG_FEMALE_EYE, 1); @@ -107,7 +112,7 @@ void sub_0804625C(GyorgFemaleEntity* this) { } } sub_080465C8(); - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x38) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) { super->action = 2; super->actionDelay = 0; this->unk_7a = 0; @@ -117,7 +122,7 @@ void sub_0804625C(GyorgFemaleEntity* this) { this->unk_80 = 0; return; } - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x40) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x40) { super->action = 3; this->unk_70 = 0x3c; super->actionDelay = 0; @@ -127,7 +132,7 @@ void sub_0804625C(GyorgFemaleEntity* this) { this->unk_80 = 0; return; } - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x100) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x100) { if (--this->unk_70 == 0) { this->unk_70 = 0x168; sub_08046634(this, 1); @@ -156,11 +161,11 @@ void sub_0804632C(GyorgFemaleEntity* this) { } } } - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x80 && --this->unk_70 == 0) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x80 && --this->unk_70 == 0) { this->unk_70 = 0x168; sub_08046634(this, 0); } - if ((((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x38) == 0) { + if ((((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) == 0) { super->action = 1; this->unk_70 = 0x3c; #ifndef EU @@ -205,7 +210,7 @@ void sub_080463E4(GyorgFemaleEntity* this) { this->unk_78 = 0; #endif this->unk_80 = 0; - SoundReq(0x128); + SoundReq(SFX_BOSS_DIE); } } @@ -217,11 +222,6 @@ void sub_08046498(GyorgFemaleEntity* this) { } #endif -extern const u8 gUnk_080D1A94[]; -extern const u8 gUnk_080D1AAC[]; -extern const u8 gUnk_080D1AC4[]; -extern const u8 gUnk_080D1ADC[]; - void sub_080464C0(GyorgFemaleEntity* this) { static const void* const gUnk_080D1A74[] = { gUnk_080D1A94, @@ -406,7 +406,7 @@ void sub_080466A8(GyorgFemaleEntity* this) { super->actionDelay = 0; this->unk_7d = 0; this->unk_78 = 0xFF; - SoundReq(0x127); + SoundReq(SFX_BOSS_HIT); if (super->health != 0) { sub_08080964(8, 0); if (++this->unk_82 <= 0xC) { @@ -431,16 +431,16 @@ void sub_080466A8(GyorgFemaleEntity* this) { this->unk_7d = 0; sub_080467DC(this); #ifndef EU - if (((GyorgFemaleHeap*)super->myHeap)->unk_3c != 0xFF) { + if (((GyorgHeap*)super->myHeap)->unk_3c != 0xFF) { #endif tmp = &gPlayerEntity; - tmp->knockbackDirection = ((GyorgFemaleHeap*)super->myHeap)->unk_3c; + tmp->knockbackDirection = ((GyorgHeap*)super->myHeap)->unk_3c; tmp->iframes = 0xF4; tmp->knockbackDuration = 0xA; tmp = CreateFx(super, 0x2C, 0); if (tmp) { - tmp->x.HALF.HI = ((GyorgFemaleHeap*)super->myHeap)->unk_38; - tmp->y.HALF.HI = ((GyorgFemaleHeap*)super->myHeap)->unk_3a; + tmp->x.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_38; + tmp->y.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_3a; tmp->collisionLayer = 1; UpdateSpriteForCollisionLayer(tmp); } @@ -454,6 +454,6 @@ void sub_080466A8(GyorgFemaleEntity* this) { void sub_080467DC(GyorgFemaleEntity* this) { u32 i; for (i = 0; i < 8; i++) { - (*((GyorgFemaleHeap**)(&super->myHeap)))->unk_18[i] = 0; + (*((GyorgHeap**)(&super->myHeap)))->unk_18[i] = 0; } } diff --git a/src/enemy/gyorgFemaleEye.c b/src/enemy/gyorgFemaleEye.c index dd47b6f9..f83f3170 100644 --- a/src/enemy/gyorgFemaleEye.c +++ b/src/enemy/gyorgFemaleEye.c @@ -77,16 +77,14 @@ void sub_080489CC(GyorgFemaleEyeEntity* this) { case 16 ... 18: case 24 ... 26: #endif - (*(((GyorgFemaleHeap**)&parent->base.myHeap)))->unk_18[super->type] = super->field_0x4c; - (*(((GyorgFemaleHeap**)&parent->base.myHeap)))->unk_38 = - (gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2; - (*(((GyorgFemaleHeap**)&parent->base.myHeap)))->unk_3a = - (gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2; - (*(((GyorgFemaleHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10); + (*(((GyorgHeap**)&parent->base.myHeap)))->unk_18[super->type] = super->field_0x4c; + (*(((GyorgHeap**)&parent->base.myHeap)))->unk_38 = (gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2; + (*(((GyorgHeap**)&parent->base.myHeap)))->unk_3a = (gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2; + (*(((GyorgHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10); #ifndef EU break; default: - ((GyorgFemaleHeap*)parent->base.myHeap)->unk_3c = 0xFF; + ((GyorgHeap*)parent->base.myHeap)->unk_3c = 0xFF; break; } } @@ -199,9 +197,9 @@ u32 sub_08048D70(GyorgFemaleEntity* parent) { if (parent->base.health != 0) { return 1; } - tmp = ((GyorgFemaleHeap*)parent->base.myHeap)->male1; + tmp = ((GyorgHeap*)parent->base.myHeap)->male1; if (!tmp) { - tmp = ((GyorgFemaleHeap*)parent->base.myHeap)->male2; + tmp = ((GyorgHeap*)parent->base.myHeap)->male2; } if (tmp->base.health != 0) { return 0; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 17cf00f9..1ebd5e31 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -209,7 +209,7 @@ void sub_080469F4(GyorgMaleEntity* this) { void sub_08046A30(GyorgMaleEntity* this) { sub_08047D88(this); - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 1) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 1) { super->action = 2; super->subAction = 0; } @@ -224,7 +224,7 @@ void sub_08046A54(GyorgMaleEntity* this) { void sub_08046A78(GyorgMaleEntity* this) { sub_08047D88(this); - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 0x10) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x10) { super->action = 3; super->subAction = 0; } @@ -250,7 +250,7 @@ void sub_08046A9C(GyorgMaleEntity* this) { void sub_08046AE8(GyorgMaleEntity* this) { super->subAction = 1; super->speed = 0x180; - sub_08048178(this, ((GyorgFemaleHeap*)super->myHeap)->female->base.animationState >> 5); + sub_08048178(this, ((GyorgHeap*)super->myHeap)->female->base.animationState >> 5); this->unk_76 = super->direction << 8; sub_08047D88(this); } @@ -323,7 +323,7 @@ void sub_08046CEC(GyorgMaleEntity* this) { } gUnk_080D1B4C[super->subAction](this); UpdateAnimationSingleFrame(super); - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 2) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 2) { super->action = 2; super->subAction = 0; super->animationState = super->speed; @@ -373,7 +373,7 @@ void sub_08046E0C(GyorgMaleEntity* this) { const s16 gUnk_080D1B70[2] = { 0x40, -0x40 }; void sub_08046E68(GyorgMaleEntity* this) { - u32 tmp = ((GyorgFemaleHeap*)super->myHeap)->female->base.animationState ^ 0x80; + u32 tmp = ((GyorgHeap*)super->myHeap)->female->base.animationState ^ 0x80; if (tmp != super->direction) { if (((tmp - super->direction) & 0xFF) > 0x80) { this->unk_76 -= 0x100; @@ -436,7 +436,7 @@ void sub_08046F64(GyorgMaleEntity* this) { UpdateSpriteForCollisionLayer(tmp); } } - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 4) { + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 4) { super->action = 5; super->subAction = 0; } @@ -805,11 +805,11 @@ void sub_080477F0(GyorgMaleEntity* this) { super->subAction = 2; this->unk_76 = super->animationState << 8; this->unk_74 = gUnk_080D1BF0[Random() & 1]; - if (((GyorgFemaleHeap*)super->myHeap)->boss->unk_6c & 1) { - ((GyorgFemaleHeap*)super->myHeap)->female->unk_79 = + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 1) { + ((GyorgHeap*)super->myHeap)->female->unk_79 = gRoomControls.roomOriginX + 0x200 > super->x.HALF.HI ? 0x81 : 0x83; } else { - ((GyorgFemaleHeap*)super->myHeap)->female->unk_79 = 0x80; + ((GyorgHeap*)super->myHeap)->female->unk_79 = 0x80; } } } @@ -824,7 +824,7 @@ void sub_08047914(GyorgMaleEntity* this) { super->subAction = 3; this->unk_70 = 0x3C; this->unk_7e = ((super->type * 0xF) << 2) + 0x78; - sub_080A1D70(&(((GyorgFemaleHeap*)super->myHeap)->boss->base), super->animationState); + sub_080A1D70(&(((GyorgHeap*)super->myHeap)->boss->base), super->animationState); } } @@ -867,7 +867,7 @@ void sub_08047978(GyorgMaleEntity* this) { return; super->subAction = 4; if (super->type == 0) { - if ((((GyorgFemaleHeap*)super->myHeap)->female->base.animationState >> 6) == 1) { + if ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6) == 1) { this->unk_80 = gRoomControls.roomOriginX + 0x1C0; this->unk_82 = gRoomControls.roomOriginY + 0x250; } else { @@ -1174,8 +1174,8 @@ const u16 gUnk_080D1C50[8] = { 0x200, 0x180, 0x2C0, 0x210, 0x200, 0x2A0, 0x140, const u16 gUnk_080D1C60[8] = { 0x200, 0x150, 0x290, 0x210, 0x200, 0x2D0, 0x170, 0x210 }; void sub_08048178(GyorgMaleEntity* this, u32 unk1) { - const u16* tmp = ((((GyorgFemaleHeap*)super->myHeap)->female->base.animationState >> 6 & 1) ? gUnk_080D1C60 + unk1 - : gUnk_080D1C50 + unk1); + const u16* tmp = ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6 & 1) ? gUnk_080D1C60 + unk1 + : gUnk_080D1C50 + unk1); this->unk_80 = *tmp + gRoomControls.roomOriginX; this->unk_82 = *(tmp + 1) + gRoomControls.roomOriginY; } diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 9647e4c6..12256c82 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -45,14 +45,14 @@ void GyorgBossObject(Entity* this) { } void sub_080A1704(GyorgBossObjectEntity* this) { - GyorgFemaleHeap* heap; + GyorgHeap* heap; Entity* tmp; if (CheckFlags(0x7B)) { DeleteThisEntity(); } if (gEntCount > 0x45) return; - heap = zMalloc(sizeof(GyorgFemaleHeap)); + heap = zMalloc(sizeof(GyorgHeap)); if (!heap) return; super->action = 1; @@ -103,20 +103,20 @@ void sub_080A184C(GyorgBossObjectEntity* this) { if (--this->unk_6e == 0) { super->action = 2; this->unk_6c = 8; - ((GyorgFemaleHeap*)super->myHeap)->female->base.health = 8; + ((GyorgHeap*)super->myHeap)->female->base.health = 8; } gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; } void sub_080A189C(GyorgBossObjectEntity* this) { - if (((GyorgFemaleHeap*)super->myHeap)->female->base.health == 0) { + if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { super->action = 3; super->actionDelay = 0x23; this->unk_6c = 1; this->unk_78 = 0x400; this->unk_7b = 1; - ((GyorgFemaleHeap*)super->myHeap)->male1->base.health = 0xC; + ((GyorgHeap*)super->myHeap)->male1->base.health = 0xC; SoundReq(0x128); sub_08080964(0x96, 1); } @@ -126,25 +126,25 @@ void sub_080A189C(GyorgBossObjectEntity* this) { void sub_080A190C(GyorgBossObjectEntity* this) { sub_080A1FF0(this); - if (((GyorgFemaleHeap*)super->myHeap)->male1->base.health == 0) { - if (sub_080A20B8(this, ((GyorgFemaleHeap*)super->myHeap)->male1)) { + if (((GyorgHeap*)super->myHeap)->male1->base.health == 0) { + if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male1)) { super->action = 4; this->unk_6c = 0x10; this->unk_78 = 0xC0; - sub_080A1D70(this, ((GyorgFemaleHeap*)super->myHeap)->female->base.animationState); - ((GyorgFemaleHeap*)super->myHeap)->female->base.health = 0x18; + sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); + ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; } gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; } else { - gPlayerState.startPosX = ((GyorgFemaleHeap*)super->myHeap)->male1->base.x.HALF.HI; - gPlayerState.startPosY = ((GyorgFemaleHeap*)super->myHeap)->male1->base.y.HALF.HI; + gPlayerState.startPosX = ((GyorgHeap*)super->myHeap)->male1->base.x.HALF.HI; + gPlayerState.startPosY = ((GyorgHeap*)super->myHeap)->male1->base.y.HALF.HI; } } void sub_080A1990(GyorgBossObjectEntity* this) { - if (((GyorgFemaleHeap*)super->myHeap)->female->base.health == 0) { - ((GyorgFemaleHeap*)super->myHeap)->male1->base.health = 0xC; + if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { + ((GyorgHeap*)super->myHeap)->male1->base.health = 0xC; super->action = 5; super->actionDelay = 0x23; this->unk_6c = 2; @@ -159,25 +159,25 @@ void sub_080A1990(GyorgBossObjectEntity* this) { void sub_080A19FC(GyorgBossObjectEntity* this) { sub_080A1FF0(this); - if (((GyorgFemaleHeap*)super->myHeap)->male2->base.health == 0) { - if (sub_080A20B8(this, ((GyorgFemaleHeap*)super->myHeap)->male2)) { + if (((GyorgHeap*)super->myHeap)->male2->base.health == 0) { + if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male2)) { super->action = 6; this->unk_6c = 0x20; this->unk_78 = 0xc0; - sub_080A1D70(this, ((GyorgFemaleHeap*)super->myHeap)->female->base.animationState); - ((GyorgFemaleHeap*)super->myHeap)->female->base.health = 0x18; + sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); + ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; } gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; } else { - gPlayerState.startPosX = ((GyorgFemaleHeap*)super->myHeap)->male2->base.x.HALF.HI; - gPlayerState.startPosY = ((GyorgFemaleHeap*)super->myHeap)->male2->base.y.HALF.HI; + gPlayerState.startPosX = ((GyorgHeap*)super->myHeap)->male2->base.x.HALF.HI; + gPlayerState.startPosY = ((GyorgHeap*)super->myHeap)->male2->base.y.HALF.HI; } } void sub_080A1A80(GyorgBossObjectEntity* this) { - if (((GyorgFemaleHeap*)super->myHeap)->female->base.health == 0) { - ((GyorgFemaleHeap*)super->myHeap)->male2->base.health = 0xC; + if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { + ((GyorgHeap*)super->myHeap)->male2->base.health = 0xC; super->action = 7; super->actionDelay = 0x23; this->unk_6c = 0x104; @@ -191,12 +191,12 @@ void sub_080A1A80(GyorgBossObjectEntity* this) { void sub_080A1AE8(GyorgBossObjectEntity* this) { sub_080A1FF0(this); - if (((GyorgFemaleHeap*)super->myHeap)->male2->base.health == 0) { - if (sub_080A20B8(this, ((GyorgFemaleHeap*)super->myHeap)->male2)) { + if (((GyorgHeap*)super->myHeap)->male2->base.health == 0) { + if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male2)) { super->action = 8; this->unk_6c = 0x40; this->unk_78 = 0xC0; - ((GyorgFemaleHeap*)super->myHeap)->female->base.health = 0xC; + ((GyorgHeap*)super->myHeap)->female->base.health = 0xC; } } gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; @@ -204,7 +204,7 @@ void sub_080A1AE8(GyorgBossObjectEntity* this) { } void sub_080A1B4C(GyorgBossObjectEntity* this) { - if (((GyorgFemaleHeap*)super->myHeap)->female->base.health == 0) { + if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { if (this->unk_6c != 0) { sub_08080964(0x2d, 1); SoundReq(SFX_BOSS_DIE); @@ -309,11 +309,11 @@ void sub_080A1D8C(GyorgBossObjectEntity* this, s32 unk1) { void sub_080A1DCC(GyorgBossObjectEntity* this) { GenericEntity* tmp; - if ((tmp = (GenericEntity*)((GyorgFemaleHeap*)super->myHeap)->male1) != NULL || - (tmp = (GenericEntity*)((GyorgFemaleHeap*)super->myHeap)->male2) != NULL) { + if ((tmp = (GenericEntity*)((GyorgHeap*)super->myHeap)->male1) != NULL || + (tmp = (GenericEntity*)((GyorgHeap*)super->myHeap)->male2) != NULL) { if (tmp->field_0x7c.BYTES.byte0 && tmp->base.spriteRendering.b3 == 2) { - ((GyorgFemaleHeap*)super->myHeap)->unk_10->base.flags &= ~0x80; - tmp = ((GyorgFemaleHeap*)super->myHeap)->unk_14; + ((GyorgHeap*)super->myHeap)->unk_10->base.flags &= ~0x80; + tmp = ((GyorgHeap*)super->myHeap)->unk_14; tmp->base.flags &= ~0x80; tmp = (GenericEntity*)tmp->base.child; tmp->base.flags &= ~0x80; @@ -324,8 +324,8 @@ void sub_080A1DCC(GyorgBossObjectEntity* this) { return; } } - ((GyorgFemaleHeap*)super->myHeap)->unk_10->base.flags |= 0x80; - tmp = ((GyorgFemaleHeap*)super->myHeap)->unk_14; + ((GyorgHeap*)super->myHeap)->unk_10->base.flags |= 0x80; + tmp = ((GyorgHeap*)super->myHeap)->unk_14; tmp->base.flags |= 0x80; tmp = (GenericEntity*)tmp->base.child; tmp->base.flags |= 0x80;