diff --git a/assets/gfx.json b/assets/gfx.json index fb11973e..06453894 100644 --- a/assets/gfx.json +++ b/assets/gfx.json @@ -15645,7 +15645,12 @@ "start": 6589216, "size": 2848, "type": "gfx", - "TODO": "if not EU" + "variants": [ + "USA", + "JP", + "DEMO_USA", + "DEMO_JP" + ] }, { "path": "gfx/fixedTypeGfx_501.4bpp", diff --git a/data/animations/object/gyorgBossObject.s b/data/animations/object/gyorgBossObject.s deleted file mode 100644 index 3dc36b66..00000000 --- a/data/animations/object/gyorgBossObject.s +++ /dev/null @@ -1,39 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08124F08:: @ 08124F08 - .incbin "gyorgBossObject/gUnk_08124F08.bin" - -gUnk_08124F28:: @ 08124F28 - .incbin "gyorgBossObject/gUnk_08124F28.bin" - -gUnk_08124F48:: @ 08124F48 - .incbin "gyorgBossObject/gUnk_08124F48.bin" - -gUnk_08124F68:: @ 08124F68 - .incbin "gyorgBossObject/gUnk_08124F68.bin" - -gUnk_08124F88:: @ 08124F88 - .incbin "gyorgBossObject/gUnk_08124F88.bin" - -gUnk_08124FA8:: @ 08124FA8 - .incbin "gyorgBossObject/gUnk_08124FA8.bin" - -gUnk_08124FC8:: @ 08124FC8 - .incbin "gyorgBossObject/gUnk_08124FC8.bin" - -gUnk_08124FDC:: @ 08124FDC - .incbin "gyorgBossObject/gUnk_08124FDC.bin" - -gUnk_08124FF0:: @ 08124FF0 - .4byte gUnk_08124F08 - .4byte gUnk_08124F28 - .4byte gUnk_08124F48 - .4byte gUnk_08124F68 - .4byte gUnk_08124F88 - .4byte gUnk_08124FA8 - .4byte gUnk_08124FC8 - .4byte gUnk_08124FDC diff --git a/include/enemy/gyorg.h b/include/enemy/gyorg.h index a372dcdf..a7ea53f6 100644 --- a/include/enemy/gyorg.h +++ b/include/enemy/gyorg.h @@ -6,18 +6,18 @@ typedef struct { Entity base; u8 unk_68[0x8]; - u16 unk_70; + u16 childrenSpawnTimer; u8 unk_72[0x6]; - u8 unk_78; + u8 eyesVulnerable; /**< bitset of eyes currently vulnerable */ u8 unk_79; - u16 unk_7a; - u8 unk_7c; - u8 unk_7d; + u16 eyeTimer; + u8 eyesHitFrame; /**< bitset of eyes hit this frame */ + u8 eyesHit; /**< bitset buffer of eyes hit */ u8 unk_7e[1]; u8 unk_7f; u8 unk_80; u8 unk_81[1]; - u8 unk_82; + u8 damageTakenCycle; /**< damage taken this cycle */ u8 unk_83[5]; } GyorgFemaleEntity; @@ -52,10 +52,10 @@ typedef struct { typedef struct { Entity base; u8 unk_68[0xC]; - u16 unk_74; - u16 unk_76; - u16 unk_78; - u8 unk_7a; + s16 attackOffsetX; + s16 attackOffsetY; + s16 attackSpeed; + u8 attackDirection; u8 unk_7b; u8 unk_7c[0xC]; } GyorgChildEntity; @@ -64,7 +64,7 @@ typedef struct { Entity base; u8 unk_68[4]; u16 unk_6c; - u16 unk_6e; + u16 timer; u16 unk_70; u16 unk_72; u8 unk_74; @@ -82,12 +82,13 @@ typedef struct { GyorgFemaleEntity* female; GyorgMaleEntity* male1; GyorgMaleEntity* male2; - GyorgFemaleMouthEntity* unk_10; - GenericEntity* unk_14; + GyorgFemaleMouthEntity* mouth; + GenericEntity* tail; void* unk_18[0x8]; - u16 unk_38; - u16 unk_3a; + Coords reflectFxPos; u8 unk_3c; } GyorgHeap; +extern void GyorgBossObject_SpawnChildren(u32 unk0, bool32 fromBlue, u32 animationState); + #endif diff --git a/include/functions.h b/include/functions.h index 44b14c4d..64ab6229 100644 --- a/include/functions.h +++ b/include/functions.h @@ -181,7 +181,6 @@ extern void sub_0808091C(const ScreenTransitionData*, u32); extern void sub_080809D4(void); extern void sub_08080CB4(Entity*); extern u32 sub_0808288C(Entity*, u32, u32, u32); -extern void sub_080A1ED0(u32, u32, u32); extern Entity* sub_080A2A3C(Entity*, u32, u32, u32); extern Entity* sub_080A2AD4(Entity*); extern void sub_080A2AF4(Entity*, u32, u32); diff --git a/linker.ld b/linker.ld index 2f1a2180..69c5a5da 100644 --- a/linker.ld +++ b/linker.ld @@ -1593,7 +1593,6 @@ SECTIONS { data/const/object/windTribeTeleporter.o(.rodata); data/const/object/objectB9.o(.rodata); src/object/gyorgBossObject.o(.rodata); - data/animations/object/gyorgBossObject.o(.rodata); data/const/object/windcrest.o(.rodata); data/const/object/objectBD.o(.rodata); data/const/object/pinwheel.o(.rodata); diff --git a/src/enemy/gyorgChild.c b/src/enemy/gyorgChild.c index 91b6bf41..698ad03a 100644 --- a/src/enemy/gyorgChild.c +++ b/src/enemy/gyorgChild.c @@ -27,55 +27,55 @@ void GyorgChild(Entity* this) { GyorgChild_Functions[GetNextFunction(this)]((GyorgChildEntity*)this); } -void sub_080486F4(GyorgChildEntity*); -void sub_0804877C(GyorgChildEntity*); -void sub_0804882C(GyorgChildEntity*); -void sub_08048904(GyorgChildEntity*); +void GyorgChild_Action0(GyorgChildEntity* this); +void GyorgChild_Action1(GyorgChildEntity* this); +void GyorgChild_Action2(GyorgChildEntity* this); +void GyorgChild_Action3(GyorgChildEntity* this); void GyorgChild_OnTick(GyorgChildEntity* this) { - static void (*const gUnk_080D1E84[])(GyorgChildEntity*) = { - sub_080486F4, - sub_0804877C, - sub_0804882C, - sub_08048904, + static void (*const GyorgChild_Actions[])(GyorgChildEntity*) = { + GyorgChild_Action0, + GyorgChild_Action1, + GyorgChild_Action2, + GyorgChild_Action3, }; - gUnk_080D1E84[super->action](this); + GyorgChild_Actions[super->action](this); } void GyorgChild_OnCollision(GyorgChildEntity* this) { EnemyFunctionHandlerAfterCollision(super, GyorgChild_Functions); } -void sub_080486D0(GyorgChildEntity*); -void sub_080486D8(GyorgChildEntity*); -void sub_080486E0(GyorgChildEntity*); +void GyordChild_OnGrabbed_Action0(GyorgChildEntity* this); +void GyorgChild_OnGrabbed_Action1(GyorgChildEntity* this); +void GyorgChild_OnGrabbed_Action3(GyorgChildEntity* this); void GyorgChild_OnGrabbed(GyorgChildEntity* this) { - static void (*const gUnk_080D1E94[])(GyorgChildEntity*) = { - sub_080486D0, - sub_080486D8, - sub_080486E0, + static void (*const GyorgChild_OnGrabbed_Actions[])(GyorgChildEntity*) = { + GyordChild_OnGrabbed_Action0, + GyorgChild_OnGrabbed_Action1, + GyorgChild_OnGrabbed_Action3, }; if (sub_0806F520()) { - gUnk_080D1E94[super->subAction](this); + GyorgChild_OnGrabbed_Actions[super->subAction](this); } } -void sub_080486D0(GyorgChildEntity* this) { +void GyordChild_OnGrabbed_Action0(GyorgChildEntity* this) { super->subAction = 2; } -void sub_080486D8(GyorgChildEntity* this) { +void GyorgChild_OnGrabbed_Action1(GyorgChildEntity* this) { sub_0806F4E8(super); } -void sub_080486E0(GyorgChildEntity* this) { +void GyorgChild_OnGrabbed_Action3(GyorgChildEntity* this) { if (sub_0806F3E4(super)) { GenericDeath(super); } } -void sub_080486F4(GyorgChildEntity* this) { +void GyorgChild_Action0(GyorgChildEntity* this) { static const s8 gUnk_080D1EA0[] = { 0x50, 0x1, 0x40, 0x1, 0x30, 0x1, 0x20, 0x1, 0x10, 0x1, 0, 0, 0x10, -0x1, 0x20, -0x1, 0x30, -0x1, 0x40, -0x1, 0x50, -0x1, @@ -84,13 +84,13 @@ void sub_080486F4(GyorgChildEntity* this) { super->spriteOrientation.flipY = 3; super->spriteRendering.b3 = 3; super->spritePriority.b0 = 7; - super->animationState = super->direction >> 2; + super->animationState = Direction8ToAnimationState(super->direction); if (super->type == 0) { s32 r; InitializeAnimation(super, super->animationState); super->action = 1; super->flags |= ENT_COLLIDE; - r = (signed)Random() % 0xB; + r = (signed)Random() % 11; super->direction += r; super->direction -= 5; super->direction &= 0x1F; @@ -105,7 +105,7 @@ void sub_080486F4(GyorgChildEntity* this) { } } -void sub_0804877C(GyorgChildEntity* this) { +void GyorgChild_Action1(GyorgChildEntity* this) { LinearMoveUpdate(super); if (super->actionDelay != 0) { if ((--super->actionDelay & 0xF) == 0) { @@ -140,29 +140,29 @@ void sub_0804877C(GyorgChildEntity* this) { super->spriteSettings.draw = 0; } -void sub_0804882C(GyorgChildEntity* this) { +void GyorgChild_Action2(GyorgChildEntity* this) { if (--super->actionDelay == 0) { super->action = 3; super->flags |= ENT_COLLIDE; Random(); super->spriteSettings.draw = 1; super->spritePriority.b0 = 4; - super->speed = this->unk_78; + super->speed = this->attackSpeed; super->collisionLayer = 2; UpdateSpriteForCollisionLayer(super); - super->direction = this->unk_7a; + super->direction = this->attackDirection; super->animationState = super->direction >> 2; InitializeAnimation(super, super->animationState); switch (super->animationState >> 1) { case 0: case 2: - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk_74; - super->y.HALF.HI = gRoomControls.scroll_y + this->unk_76; + super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->attackOffsetX; + super->y.HALF.HI = gRoomControls.scroll_y + this->attackOffsetY; break; case 1: default: - super->x.HALF.HI = gRoomControls.scroll_x + this->unk_74; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk_76; + super->x.HALF.HI = gRoomControls.scroll_x + this->attackOffsetX; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->attackOffsetY; break; } if (super->type2 == 0) { @@ -171,7 +171,7 @@ void sub_0804882C(GyorgChildEntity* this) { } } -void sub_08048904(GyorgChildEntity* this) { +void GyorgChild_Action3(GyorgChildEntity* this) { LinearMoveUpdate(super); GetNextFrame(super); switch (super->animationState >> 1) { diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index a411698e..2b7911d3 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -20,10 +20,10 @@ extern void RegisterTransitionManager(void*, void (*)(), void (*)()); void sub_08046498(); void sub_0804660C(GyorgFemaleEntity*, u32); void sub_080464C0(GyorgFemaleEntity*); -void sub_08046634(GyorgFemaleEntity*, u32); +void GyorgFemale_SpawnChildren(GyorgFemaleEntity* this, bool32 unlimit_tmp); void sub_080465C8(void); -void sub_080466A8(GyorgFemaleEntity*); -void sub_08046668(GyorgFemaleEntity*); +void GyorgFemale_ProcessEyeHit(GyorgFemaleEntity* this); +void GyorgFemale_ChooseEyePattern(GyorgFemaleEntity* this); void sub_08046518(void); void sub_080467DC(GyorgFemaleEntity*); @@ -37,32 +37,32 @@ 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*); -void sub_080463E4(GyorgFemaleEntity*); +void GyorgFemale_Setup(GyorgFemaleEntity* this); +void GyorgFemale_Action1(GyorgFemaleEntity* this); +void GyorgFemale_Action2(GyorgFemaleEntity* this); +void GyorgFemale_Action3(GyorgFemaleEntity* this); void GyorgFemale(Entity* this) { - static void (*const gUnk_080D1A64[])(GyorgFemaleEntity*) = { - sub_0804614C, - sub_0804625C, - sub_0804632C, - sub_080463E4, + static void (*const GyorgFemale_Actions[])(GyorgFemaleEntity*) = { + GyorgFemale_Setup, + GyorgFemale_Action1, + GyorgFemale_Action2, + GyorgFemale_Action3, }; - gUnk_080D1A64[this->action]((GyorgFemaleEntity*)this); + GyorgFemale_Actions[this->action]((GyorgFemaleEntity*)this); } -void sub_0804614C(GyorgFemaleEntity* this) { +void GyorgFemale_Setup(GyorgFemaleEntity* this) { Entity* tmp; if (gEntCount > 0x3d) return; tmp = CreateProjectile(GYORG_TAIL); tmp->type = 0; tmp->parent = super; - ((GyorgHeap*)super->myHeap)->unk_14 = (GenericEntity*)tmp; + ((GyorgHeap*)super->myHeap)->tail = (GenericEntity*)tmp; tmp = CreateEnemy(GYORG_FEMALE_MOUTH, 0); tmp->parent = super; - ((GyorgHeap*)super->myHeap)->unk_10 = (GyorgFemaleMouthEntity*)tmp; + ((GyorgHeap*)super->myHeap)->mouth = (GyorgFemaleMouthEntity*)tmp; tmp = CreateEnemy(GYORG_FEMALE_EYE, 0); tmp->parent = super; tmp = CreateEnemy(GYORG_FEMALE_EYE, 1); @@ -83,9 +83,9 @@ void sub_0804614C(GyorgFemaleEntity* this) { super->spriteOrientation.flipY = 2; super->spriteRendering.b3 = 2; super->collisionLayer = 2; - this->unk_78 = 0; + this->eyesVulnerable = 0; this->unk_79 = 0; - this->unk_70 = 0x3C; + this->childrenSpawnTimer = 0x3C; MemClear(&gUnk_02019EE0, 0x8000); MemClear(&gMapDataTopSpecial, 0x8000); sub_0804660C(this, 0); @@ -99,7 +99,7 @@ void sub_0804614C(GyorgFemaleEntity* this) { #endif } -void sub_0804625C(GyorgFemaleEntity* this) { +void GyorgFemale_Action1(GyorgFemaleEntity* this) { if (this->unk_79 & 0x80) { this->unk_79 &= ~0x80; this->unk_79 |= 0x40; @@ -114,86 +114,86 @@ void sub_0804625C(GyorgFemaleEntity* this) { if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) { super->action = 2; super->actionDelay = 0; - this->unk_7a = 0; - this->unk_7c = 0; - this->unk_7d = 0; - this->unk_70 = 0x3c; + this->eyeTimer = 0; + this->eyesHitFrame = 0; + this->eyesHit = 0; + this->childrenSpawnTimer = 0x3c; this->unk_80 = 0; return; } if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x40) { super->action = 3; - this->unk_70 = 0x3c; + this->childrenSpawnTimer = 0x3c; super->actionDelay = 0; - this->unk_7a = 0; - this->unk_7c = 0; - this->unk_7d = 0; + this->eyeTimer = 0; + this->eyesHitFrame = 0; + this->eyesHit = 0; this->unk_80 = 0; return; } if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x100) { - if (--this->unk_70 == 0) { - this->unk_70 = 0x168; - sub_08046634(this, 1); + if (--this->childrenSpawnTimer == 0) { + this->childrenSpawnTimer = 0x168; + GyorgFemale_SpawnChildren(this, TRUE); } } } -void sub_0804632C(GyorgFemaleEntity* this) { +void GyorgFemale_Action2(GyorgFemaleEntity* this) { sub_080465C8(); - sub_080466A8(this); - if (++this->unk_7a > 0x59f) { - this->unk_7a = 0; - this->unk_7c = 0; - this->unk_7d = 0; + GyorgFemale_ProcessEyeHit(this); + if (++this->eyeTimer >= 1440) { + this->eyeTimer = 0; + this->eyesHitFrame = 0; + this->eyesHit = 0; this->unk_80 = 0; } else { - if (this->unk_7a == 0x78) { - sub_08046668(this); + if (this->eyeTimer == 120) { + GyorgFemale_ChooseEyePattern(this); } else { - if (this->unk_7a == 0x528) { - this->unk_78 = 0; + if (this->eyeTimer == 1320) { + this->eyesVulnerable = 0; #ifndef EU - this->unk_7d = 0; + this->eyesHit = 0; this->unk_7f = 0; #endif } } } - if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x80 && --this->unk_70 == 0) { - this->unk_70 = 0x168; - sub_08046634(this, 0); + if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x80 && --this->childrenSpawnTimer == 0) { + this->childrenSpawnTimer = 0x168; + GyorgFemale_SpawnChildren(this, 0); } if ((((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) == 0) { super->action = 1; - this->unk_70 = 0x3c; + this->childrenSpawnTimer = 0x3c; #ifndef EU - this->unk_78 = 0; + this->eyesVulnerable = 0; #endif this->unk_80 = 0; } } -void sub_080463E4(GyorgFemaleEntity* this) { +void GyorgFemale_Action3(GyorgFemaleEntity* this) { sub_080465C8(); - if (--this->unk_70 == 0) { - this->unk_70 = 0x168; - sub_08046634(this, 1); + if (--this->childrenSpawnTimer == 0) { + this->childrenSpawnTimer = 0x168; + GyorgFemale_SpawnChildren(this, 1); } - sub_080466A8(this); - if (++this->unk_7a > 0x59f) { - this->unk_7a = 0; - this->unk_7c = 0; - this->unk_7d = 0; + GyorgFemale_ProcessEyeHit(this); + if (++this->eyeTimer >= 1440) { + this->eyeTimer = 0; + this->eyesHitFrame = 0; + this->eyesHit = 0; this->unk_80 = 0; } else { - if (this->unk_7a == 0x78) { - sub_08046668(this); + if (this->eyeTimer == 120) { + GyorgFemale_ChooseEyePattern(this); } else { - if (this->unk_7a == 0x528) { - this->unk_78 = 0; + if (this->eyeTimer == 1320) { + this->eyesVulnerable = 0; #ifndef EU - this->unk_7d = 0; + this->eyesHit = 0; this->unk_7f = 0; #endif } @@ -202,11 +202,11 @@ void sub_080463E4(GyorgFemaleEntity* this) { if (super->health == 0) { super->action = 1; #ifdef EU - this->unk_78 = 0; + this->eyesVulnerable = 0; #endif - this->unk_70 = 0x3c; + this->childrenSpawnTimer = 0x3c; #ifndef EU - this->unk_78 = 0; + this->eyesVulnerable = 0; #endif this->unk_80 = 0; SoundReq(SFX_BOSS_DIE); @@ -364,70 +364,70 @@ const u8 gUnk_080D1ADC[] = { 0xDE, 0x22, 0x00, 0x54, 0xB6, 0x00, 0x02, 0x80, 0x1F, 0x00, 0x80, }; -void sub_08046634(GyorgFemaleEntity* this, u32 unk1) { +void GyorgFemale_SpawnChildren(GyorgFemaleEntity* this, bool32 unlimit_tmp) { static const u8 gUnk_080D1AF4[] = { 2, 3, 6, 7 }; u32 tmp; - if (unk1 == 0) { + if (unlimit_tmp == 0) { tmp = gUnk_080D1AF4[Random() & 3]; } else { tmp = Random() & 7; } - sub_080A1ED0(tmp, 0, super->animationState >> 3); + GyorgBossObject_SpawnChildren(tmp, FALSE, super->animationState >> 3); } -void sub_08046668(GyorgFemaleEntity* this) { +void GyorgFemale_ChooseEyePattern(GyorgFemaleEntity* this) { static const u8 gUnk_080D1AF8[] = { 0x16, 0x92, 0x94, 0x86 }; if (super->health == 0) { return; } #ifndef EU - if (this->unk_78 == 0xFF) { + if (this->eyesVulnerable == 0xFF) { return; } #endif - this->unk_78 = gUnk_080D1AF8[Random() & 3]; + this->eyesVulnerable = gUnk_080D1AF8[Random() & 3]; this->unk_7f = 0; - this->unk_82 = 0; + this->damageTakenCycle = 0; sub_080467DC(this); } -void sub_080466A8(GyorgFemaleEntity* this) { - if (this->unk_7c != 0) { - this->unk_7d |= this->unk_7c; - if (super->actionDelay == 0 && this->unk_78 != 0xFF) { +void GyorgFemale_ProcessEyeHit(GyorgFemaleEntity* this) { + if (this->eyesHitFrame != 0) { + this->eyesHit |= this->eyesHitFrame; + if (super->actionDelay == 0 && this->eyesVulnerable != 0xFF) { #ifndef EU super->actionDelay = 4; #else super->actionDelay = 3; #endif } - if (sub_08000E62(this->unk_7d) > 2) { + if (sub_08000E62(this->eyesHit) > 2) { super->actionDelay = 0; - this->unk_7d = 0; - this->unk_78 = 0xFF; + this->eyesHit = 0; + this->eyesVulnerable = 0xFF; SoundReq(SFX_BOSS_HIT); if (super->health != 0) { InitScreenShake(8, 0); - if (++this->unk_82 <= 0xC) { + if (++this->damageTakenCycle <= 12) { super->health--; } if (super->health == 0) { - this->unk_78 = 0; - this->unk_7a = 0x528; + this->eyesVulnerable = 0; + this->eyeTimer = 1320; } else { if (this->unk_7f == 0) { this->unk_7f = 1; - this->unk_7a = 0x438; + this->eyeTimer = 1080; } } } sub_080467DC(this); } } - if (super->actionDelay != 0 && this->unk_78 != 0xFF && --super->actionDelay == 0) { + if (super->actionDelay != 0 && this->eyesVulnerable != 0xFF && --super->actionDelay == 0) { Entity* tmp; - this->unk_80 |= this->unk_7d; - this->unk_7d = 0; + this->unk_80 |= this->eyesHit; + this->eyesHit = 0; sub_080467DC(this); #ifndef EU if (((GyorgHeap*)super->myHeap)->unk_3c != 0xFF) { @@ -436,10 +436,10 @@ void sub_080466A8(GyorgFemaleEntity* this) { tmp->knockbackDirection = ((GyorgHeap*)super->myHeap)->unk_3c; tmp->iframes = 0xF4; tmp->knockbackDuration = 0xA; - tmp = CreateFx(super, 0x2C, 0); + tmp = CreateFx(super, FX_REFECT3, 0); if (tmp) { - tmp->x.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_38; - tmp->y.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_3a; + tmp->x.HALF.HI = ((GyorgHeap*)super->myHeap)->reflectFxPos.HALF.x; + tmp->y.HALF.HI = ((GyorgHeap*)super->myHeap)->reflectFxPos.HALF.y; tmp->collisionLayer = 1; UpdateSpriteForCollisionLayer(tmp); } @@ -447,7 +447,7 @@ void sub_080466A8(GyorgFemaleEntity* this) { } #endif } - this->unk_7c = 0; + this->eyesHitFrame = 0; } void sub_080467DC(GyorgFemaleEntity* this) { diff --git a/src/enemy/gyorgFemaleEye.c b/src/enemy/gyorgFemaleEye.c index 89d8207a..84d1aa3b 100644 --- a/src/enemy/gyorgFemaleEye.c +++ b/src/enemy/gyorgFemaleEye.c @@ -67,9 +67,9 @@ void GyorgFemaleEye_OnCollision(GyorgFemaleEyeEntity* this) { if (super->health != 0xFF) { parent = (GyorgFemaleEntity*)super->parent; #ifndef EU - if ((parent->unk_78 >> super->type) & 1) { + if ((parent->eyesVulnerable >> super->type) & 1) { #endif - parent->unk_7c |= (1 << super->type); + parent->eyesHitFrame |= (1 << super->type); #ifndef EU switch (super->bitfield & 0x7F) { case 4 ... 6: @@ -78,8 +78,10 @@ void GyorgFemaleEye_OnCollision(GyorgFemaleEyeEntity* this) { case 24 ... 26: #endif (*(((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)))->reflectFxPos.HALF.x = + (gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2; + (*(((GyorgHeap**)&parent->base.myHeap)))->reflectFxPos.HALF.y = + (gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2; (*(((GyorgHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10); #ifndef EU break; @@ -116,7 +118,7 @@ void sub_08048B2C(GyorgFemaleEyeEntity* this) { } else { super->spriteSettings.draw = 0; } - if ((parent->unk_78 >> super->type) & 1) { + if ((parent->eyesVulnerable >> super->type) & 1) { super->action = 2; } } @@ -132,7 +134,7 @@ void sub_08048B84(GyorgFemaleEyeEntity* this) { void sub_08048BB0(GyorgFemaleEyeEntity* this) { GyorgFemaleEntity* parent = (GyorgFemaleEntity*)super->parent; - if (!((parent->unk_78 >> super->type) & 1)) { + if (!((parent->eyesVulnerable >> super->type) & 1)) { if (parent->base.health != 0) { super->action = 4; super->flags &= ~ENT_COLLIDE; @@ -160,7 +162,7 @@ void sub_08048BB0(GyorgFemaleEyeEntity* this) { parent->unk_80 &= ~(1 << super->type); } } else { - if (parent->unk_78 == 0xFF) { + if (parent->eyesVulnerable == 0xFF) { u32 tmp = super->animIndex; if (tmp < 0x10 || tmp > 0x13) { InitializeAnimation(super, super->animationState + 0x10); diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 667fa934..b2ba5b13 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -91,9 +91,9 @@ void sub_08047DF0(GyorgMaleEntity*, u32); void sub_08047E48(GyorgMaleEntity*); // void sub_08047E58(GyorgMaleEntity*); // void sub_08047EA4(GyorgMaleEntity*, u32); -u32 sub_08047F68(GyorgMaleEntity*); // distance this to player? -void sub_08048004(GyorgMaleEntity*); // -void sub_0804813C(GyorgMaleEntity*); // +u32 sub_08047F68(GyorgMaleEntity*); // distance this to player? +void sub_08048004(GyorgMaleEntity*); // +void GyorgMale_SpawnChildren(GyorgMaleEntity* this); // u32 sub_08048158(u32); void sub_08048178(GyorgMaleEntity*, u32); @@ -847,7 +847,7 @@ void sub_08047978(GyorgMaleEntity* this) { } } else { if (this->unk_70 == 0xF0) { - sub_0804813C(this); + GyorgMale_SpawnChildren(this); } } } else { @@ -1165,9 +1165,9 @@ void sub_08048004(GyorgMaleEntity* this) { } } -void sub_0804813C(GyorgMaleEntity* this) { +void GyorgMale_SpawnChildren(GyorgMaleEntity* this) { u32 rand = Random(); - sub_080A1ED0(rand & 7, 1, (rand >> 8) & 3); + GyorgBossObject_SpawnChildren(rand & 7, TRUE, (rand >> 8) & 3); } const u8 gUnk_080D1C44[0xC] = { 0, 2, 6, 0, 2, 4, 2, 4, 6, 0, 4, 6 }; diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 89fb9d33..b63b8d81 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -11,7 +11,12 @@ extern const ScreenTransitionData gUnk_0813ABD0; extern u32 sub_08079F8C(void); -extern s16* const gUnk_08124FF0[]; +struct GyorgChildSpawns { + s16 offsetX; + s16 offsetY; + s16 unk2; +} FORCE_WORD_ALIGNED; +extern struct GyorgChildSpawns* const gUnk_08124FF0[]; extern void sub_080A1DCC(GyorgBossObjectEntity*); extern void sub_080A1C9C(GyorgBossObjectEntity*); @@ -23,28 +28,30 @@ void sub_080A1FF0(GyorgBossObjectEntity*); u32 sub_080A20B8(GyorgBossObjectEntity*, GyorgMaleEntity*); void sub_080A1D70(GyorgBossObjectEntity*, u32); -void sub_080A1704(GyorgBossObjectEntity*); -void sub_080A184C(GyorgBossObjectEntity*); -void sub_080A189C(GyorgBossObjectEntity*); -void sub_080A190C(GyorgBossObjectEntity*); -void sub_080A1990(GyorgBossObjectEntity*); -void sub_080A19FC(GyorgBossObjectEntity*); -void sub_080A1A80(GyorgBossObjectEntity*); -void sub_080A1AE8(GyorgBossObjectEntity*); -void sub_080A1B4C(GyorgBossObjectEntity*); -void sub_080A1C04(GyorgBossObjectEntity*); +void GyorgBossObject_SetupStart(GyorgBossObjectEntity* this); +void GyorgBossObject_Setup(GyorgBossObjectEntity* this); +void GyorgBossObject_FemalePhase1(GyorgBossObjectEntity* this); +void GyorgBossObject_MalePhase1(GyorgBossObjectEntity* this); +void GyorgBossObject_FemalePhase2(GyorgBossObjectEntity* this); +void GyorgBossObject_MalePhase2(GyorgBossObjectEntity* this); +void GyorgBossObject_FemalePhase3(GyorgBossObjectEntity* this); +void GyorgBossObject_MalePhase3(GyorgBossObjectEntity* this); +void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this); +void GyorgBossObject_FightEnd(GyorgBossObjectEntity* this); void GyorgBossObject(Entity* this) { static void (*const gUnk_08124ED0[])(GyorgBossObjectEntity*) = { - sub_080A1704, sub_080A184C, sub_080A189C, sub_080A190C, sub_080A1990, - sub_080A19FC, sub_080A1A80, sub_080A1AE8, sub_080A1B4C, sub_080A1C04, + GyorgBossObject_SetupStart, GyorgBossObject_Setup, GyorgBossObject_FemalePhase1, + GyorgBossObject_MalePhase1, GyorgBossObject_FemalePhase2, GyorgBossObject_MalePhase2, + GyorgBossObject_FemalePhase3, GyorgBossObject_MalePhase3, GyorgBossObject_FemalePhase4, + GyorgBossObject_FightEnd, }; gUnk_08124ED0[this->action]((GyorgBossObjectEntity*)this); sub_080A1DCC((GyorgBossObjectEntity*)this); sub_080A1C9C((GyorgBossObjectEntity*)this); } -void sub_080A1704(GyorgBossObjectEntity* this) { +void GyorgBossObject_SetupStart(GyorgBossObjectEntity* this) { GyorgHeap* heap; Entity* tmp; if (CheckFlags(0x7B)) { @@ -57,7 +64,7 @@ void sub_080A1704(GyorgBossObjectEntity* this) { return; super->action = 1; super->myHeap = heap; - this->unk_6e = 0x258; + this->timer = 0x258; this->unk_6c = 0; heap->boss = this; tmp = CreateEnemy(GYORG_FEMALE, 0); @@ -94,13 +101,14 @@ void sub_080A1704(GyorgBossObjectEntity* this) { gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; #ifndef EU - SoundReq(0x80100000); + SoundReq(SONG_STOP_BGM); gArea.bgm = gArea.queued_bgm; #endif } -void sub_080A184C(GyorgBossObjectEntity* this) { - if (--this->unk_6e == 0) { +void GyorgBossObject_Setup(GyorgBossObjectEntity* this) { + if (--this->timer == 0) { + // start female phase 1 super->action = 2; this->unk_6c = 8; ((GyorgHeap*)super->myHeap)->female->base.health = 8; @@ -109,30 +117,32 @@ void sub_080A184C(GyorgBossObjectEntity* this) { gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A189C(GyorgBossObjectEntity* this) { +void GyorgBossObject_FemalePhase1(GyorgBossObjectEntity* this) { if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { + // start male phase 1 super->action = 3; super->actionDelay = 0x23; this->unk_6c = 1; this->unk_78 = 0x400; this->unk_7b = 1; - ((GyorgHeap*)super->myHeap)->male1->base.health = 0xC; - SoundReq(0x128); + ((GyorgHeap*)super->myHeap)->male1->base.health = 12; + SoundReq(SFX_BOSS_DIE); InitScreenShake(0x96, 1); } gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A190C(GyorgBossObjectEntity* this) { +void GyorgBossObject_MalePhase1(GyorgBossObjectEntity* this) { sub_080A1FF0(this); if (((GyorgHeap*)super->myHeap)->male1->base.health == 0) { if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male1)) { + // start female phase 2 super->action = 4; this->unk_6c = 0x10; this->unk_78 = 0xC0; sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); - ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; + ((GyorgHeap*)super->myHeap)->female->base.health = 24; } gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; @@ -142,30 +152,32 @@ void sub_080A190C(GyorgBossObjectEntity* this) { } } -void sub_080A1990(GyorgBossObjectEntity* this) { +void GyorgBossObject_FemalePhase2(GyorgBossObjectEntity* this) { if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { - ((GyorgHeap*)super->myHeap)->male1->base.health = 0xC; + // start male phase 2 + ((GyorgHeap*)super->myHeap)->male1->base.health = 12; super->action = 5; super->actionDelay = 0x23; this->unk_6c = 2; this->unk_78 = 0x400; this->unk_7b = 1; - SoundReq(0x128); + SoundReq(SFX_BOSS_DIE); InitScreenShake(0x96, 1); } gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A19FC(GyorgBossObjectEntity* this) { +void GyorgBossObject_MalePhase2(GyorgBossObjectEntity* this) { sub_080A1FF0(this); if (((GyorgHeap*)super->myHeap)->male2->base.health == 0) { if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male2)) { + // start female phase 3 super->action = 6; this->unk_6c = 0x20; this->unk_78 = 0xc0; sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); - ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; + ((GyorgHeap*)super->myHeap)->female->base.health = 24; } gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; @@ -175,9 +187,10 @@ void sub_080A19FC(GyorgBossObjectEntity* this) { } } -void sub_080A1A80(GyorgBossObjectEntity* this) { +void GyorgBossObject_FemalePhase3(GyorgBossObjectEntity* this) { if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { - ((GyorgHeap*)super->myHeap)->male2->base.health = 0xC; + // start male phase 3 + ((GyorgHeap*)super->myHeap)->male2->base.health = 12; super->action = 7; super->actionDelay = 0x23; this->unk_6c = 0x104; @@ -189,21 +202,22 @@ void sub_080A1A80(GyorgBossObjectEntity* this) { gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A1AE8(GyorgBossObjectEntity* this) { +void GyorgBossObject_MalePhase3(GyorgBossObjectEntity* this) { sub_080A1FF0(this); if (((GyorgHeap*)super->myHeap)->male2->base.health == 0) { if (sub_080A20B8(this, ((GyorgHeap*)super->myHeap)->male2)) { + // start female phase 4 super->action = 8; this->unk_6c = 0x40; this->unk_78 = 0xC0; - ((GyorgHeap*)super->myHeap)->female->base.health = 0xC; + ((GyorgHeap*)super->myHeap)->female->base.health = 12; } } gPlayerState.startPosX = gRoomControls.origin_x + 0x200; gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A1B4C(GyorgBossObjectEntity* this) { +void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) { if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { if (this->unk_6c != 0) { InitScreenShake(0x2d, 1); @@ -216,7 +230,7 @@ void sub_080A1B4C(GyorgBossObjectEntity* this) { super->action = 9; super->actionDelay = 0; super->field_0xf = 0xF0; - this->unk_6e = 0x1a4; + this->timer = 0x1a4; super->direction = 0; super->speed = 0x60; gPlayerState.flags &= ~PL_FLAGS20000; @@ -229,8 +243,8 @@ void sub_080A1B4C(GyorgBossObjectEntity* this) { gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } -void sub_080A1C04(GyorgBossObjectEntity* this) { - if (this->unk_6e == 0) { +void GyorgBossObject_FightEnd(GyorgBossObjectEntity* this) { + if (this->timer == 0) { LinearMoveUpdate(super); sub_080A1E54(this); if (--super->field_0xf == 0) { @@ -243,11 +257,11 @@ void sub_080A1C04(GyorgBossObjectEntity* this) { } return; } - if (--this->unk_6e < 0xb4) { + if (--this->timer < 0xb4) { sub_080A1E54(this); return; } - switch (this->unk_6e) { + switch (this->timer) { case 0xb4: SoundReq(SFX_BOSS_DIE); InitScreenShake(0x2d0, 2); @@ -312,8 +326,8 @@ void sub_080A1DCC(GyorgBossObjectEntity* this) { 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) { - ((GyorgHeap*)super->myHeap)->unk_10->base.flags &= ~0x80; - tmp = ((GyorgHeap*)super->myHeap)->unk_14; + ((GyorgHeap*)super->myHeap)->mouth->base.flags &= ~0x80; + tmp = ((GyorgHeap*)super->myHeap)->tail; tmp->base.flags &= ~0x80; tmp = (GenericEntity*)tmp->base.child; tmp->base.flags &= ~0x80; @@ -324,8 +338,8 @@ void sub_080A1DCC(GyorgBossObjectEntity* this) { return; } } - ((GyorgHeap*)super->myHeap)->unk_10->base.flags |= 0x80; - tmp = ((GyorgHeap*)super->myHeap)->unk_14; + ((GyorgHeap*)super->myHeap)->mouth->base.flags |= 0x80; + tmp = ((GyorgHeap*)super->myHeap)->tail; tmp->base.flags |= 0x80; tmp = (GenericEntity*)tmp->base.child; tmp->base.flags |= 0x80; @@ -350,45 +364,74 @@ void sub_080A1E54(GyorgBossObjectEntity* this) { } } -void sub_080A1ED0(u32 unk0, u32 unk1, u32 unk2) { +void GyorgBossObject_SpawnChildren(u32 unk0, bool32 fromBlue, u32 animationState) { static const u16 gUnk_08124EF8[] = { 0x200, 0x1C0, 0x250, 0x210, 0x200, 0x260, 0x1B0, 0x210 }; + static const s16 gUnk_08124F08[] = { + -80, 48, 320, -40, 32, 320, 0, 16, 320, 40, 32, 320, 80, 48, 320, 1, + }; + static const s16 gUnk_08124F28[] = { + -80, 16, 448, -40, 48, 448, 0, 16, 448, 40, 48, 448, 80, 16, 448, 1, + }; + static const s16 gUnk_08124F48[] = { + -80, 16, 320, -40, 48, 576, 0, 16, 320, 40, 48, 576, 80, 16, 320, 1, + }; + static const s16 gUnk_08124F68[] = { + -80, 16, 320, -40, 32, 448, 0, 48, 576, 40, 32, 448, 80, 16, 320, 1, + }; + static const s16 gUnk_08124F88[] = { + -80, 32, 320, -40, 48, 320, 0, 32, 320, 40, 16, 320, 80, 32, 320, 1, + }; + static const s16 gUnk_08124FA8[] = { + -80, 32, 576, -40, 32, 448, 0, 32, 320, 40, 32, 448, 80, 32, 576, 1, + }; + static const s16 gUnk_08124FC8[] = { + -80, 32, 320, 0, 16, 320, 80, 32, 320, 1, + }; + static const s16 gUnk_08124FDC[] = { + -80, 16, 448, 0, 48, 448, 80, 16, 448, 1, + }; + static const s16* const gUnk_08124FF0[] = { + gUnk_08124F08, gUnk_08124F28, gUnk_08124F48, gUnk_08124F68, + gUnk_08124F88, gUnk_08124FA8, gUnk_08124FC8, gUnk_08124FDC, + }; + u32 i = 0; - s16* p; + struct GyorgChildSpawns* p; u32 x, y; - x = gUnk_08124EF8[unk2 * 2] + gRoomControls.origin_x; - y = gUnk_08124EF8[unk2 * 2 + 1] + gRoomControls.origin_y; - p = gUnk_08124FF0[unk0]; - while (*p != 1) { - GyorgChildEntity* tmp = (GyorgChildEntity*)CreateEnemy(GYORG_CHILD, unk1); + x = gUnk_08124EF8[animationState * 2] + gRoomControls.origin_x; + y = gUnk_08124EF8[animationState * 2 + 1] + gRoomControls.origin_y; + p = (struct GyorgChildSpawns*)gUnk_08124FF0[unk0]; + while (p->offsetX != 1) { + GyorgChildEntity* tmp = (GyorgChildEntity*)CreateEnemy(GYORG_CHILD, fromBlue); if (tmp) { tmp->base.type2 = i++; tmp->base.x.HALF.HI = x; tmp->base.y.HALF.HI = y; - tmp->base.direction = DirectionFromAnimationState(unk2); - tmp->unk_7a = DirectionTurnAround(DirectionFromAnimationState(unk2)); - tmp->unk_78 = p[2]; - switch (unk2) { + tmp->base.direction = DirectionFromAnimationState(animationState); + tmp->attackDirection = DirectionTurnAround(DirectionFromAnimationState(animationState)); + tmp->attackSpeed = p->unk2; + switch (animationState) { case 0: - tmp->unk_74 = p[0]; - tmp->unk_76 = -p[1]; + tmp->attackOffsetX = p->offsetX; + tmp->attackOffsetY = -p->offsetY; break; case 1: - tmp->unk_74 = p[1] + 0xF0; - tmp->unk_76 = p[0]; + tmp->attackOffsetX = p->offsetY + 0xF0; + tmp->attackOffsetY = p->offsetX; break; case 2: - tmp->unk_74 = p[0]; - tmp->unk_76 = p[1] + 0xA0; + tmp->attackOffsetX = p->offsetX; + tmp->attackOffsetY = p->offsetY + 0xA0; break; case 3: - tmp->unk_74 = -p[1]; - tmp->unk_76 = p[0]; + tmp->attackOffsetX = -p->offsetY; + tmp->attackOffsetY = p->offsetX; break; } } - p += 3; + p++; } - if (unk1 == 0) { + if (fromBlue == FALSE) { Entity* tmp; tmp = CreateObject(SPECIAL_FX, 2, 0); if (tmp) {