diff --git a/include/entity.h b/include/entity.h index 57744f0d0..1c9efe948 100644 --- a/include/entity.h +++ b/include/entity.h @@ -164,9 +164,8 @@ typedef struct { /* 0x90 */ s32 unk90; /* 0x94 */ s32 unk94; /* 0x98 */ s32 unk98; - /* 0x9C */ s16 unk9C; - /* 0x9E */ s16 unk9E; - /* 0xA0 */ s32 unkA0; + /* 0x9C */ s32 accelerationX; + /* 0xA0 */ s32 accelerationY; /* 0xA4 */ s32 unkA4; /* 0xA8 */ s32 unkA8; /* 0xAC */ u8 unkAC; @@ -177,6 +176,17 @@ typedef struct { typedef struct { /* 0x7C */ u8 unk7C; /* 0x7D */ u8 unk7D; + /* 0x7E */ s16 unk7E; + /* 0x80 */ s16 unk80; + /* 0x82 */ s16 unk82; + /* 0x84 */ s32 unk84; + /* 0x88 */ s16 childPalette; + /* 0x8A */ s16 unk8A; + /* 0x8C */ struct Entity* parent; + /* 0x90 */ s32 unk90; + /* 0x94 */ s32 unk94; + /* 0x98 */ s32 unk98; + /* 0x9C */ s16 unk9C; } ET_Weapon29; typedef struct { diff --git a/src/weapon/w_015.c b/src/weapon/w_015.c index 036e7f604..1e17a701e 100644 --- a/src/weapon/w_015.c +++ b/src/weapon/w_015.c @@ -35,7 +35,53 @@ INCLUDE_ASM("weapon/nonmatchings/w_015", func_ptr_8017000C); INCLUDE_ASM("weapon/nonmatchings/w_015", func_ptr_80170010); -INCLUDE_ASM("weapon/nonmatchings/w_015", func_ptr_80170014); +extern SpriteParts D_6D000_8017A2B0[]; +extern AnimationFrame D_6D000_8017A770[]; + +void func_ptr_80170014(Entity* self) { + s16 angle; + + if (self->step == 0) { + if (self->ext.weapon.parent->entityId == 0) { + DestroyEntity(self); + return; + } + SetSpriteBank2(D_6D000_8017A2B0); + self->animSet = ANIMSET_OVL(17); + self->palette = 0x111; + self->unk5A = 101; + if (g_HandId != 0) { + self->animSet += 2; + self->palette += 24; + self->unk5A = 103; + } + self->unk4C = D_6D000_8017A770; + self->flags = FLAG_UNK_08000000 | FLAG_UNK_100000; + self->zPriority = PLAYER.zPriority - 2; + self->drawMode = DRAW_TPAGE | 0x20; + angle = ratan2(-self->ext.weapon.parent->velocityY, + self->ext.weapon.parent->velocityX); + angle += (0x500 + (rand() % 0x600)); + self->velocityX = rcos(angle) * 64; + self->velocityY = rsin(angle) * -64; + self->ext.weapon.accelerationX = -self->velocityX / 13; + self->ext.weapon.accelerationY = -self->velocityY / 13; + self->ext.weapon.equipId = self->ext.weapon.parent->ext.weapon.equipId; + SetWeaponProperties(self, 0); + self->enemyId = self->ext.weapon.parent->enemyId; + self->hitboxHeight = self->hitboxWidth = 12; + self->step++; + return; + } + if (self->animFrameDuration < 0) { + DestroyEntity(self); + return; + } + self->posY.val += self->velocityY; + self->posX.val += self->velocityX; + self->velocityX += self->ext.weapon.accelerationX; + self->velocityY += self->ext.weapon.accelerationY; +} int GetWeaponId(void) { return 15; } diff --git a/src/weapon/w_029.c b/src/weapon/w_029.c index 6296282e5..22fe3ac3a 100644 --- a/src/weapon/w_029.c +++ b/src/weapon/w_029.c @@ -391,7 +391,7 @@ void func_ptr_80170024(Entity* self) { self->ext.weapon29.unk7D = 0; } self->flags |= 0x04800000; - self->ext.weapon.unk9C = 0x40; + self->ext.weapon29.unk9C = 0x40; for (i = 0, prim = &g_PrimBuf[self->primIndex]; prim != NULL; i++, prim = prim->next) { @@ -504,9 +504,9 @@ void func_ptr_80170024(Entity* self) { break; } } - self->ext.weapon.unk9C += 2; - if (self->ext.weapon.unk9C > 0x100) { - self->ext.weapon.unk9C = 0x100; + self->ext.weapon29.unk9C += 2; + if (self->ext.weapon29.unk9C > 0x100) { + self->ext.weapon29.unk9C = 0x100; } } firstPrim = prim = &g_PrimBuf[self->primIndex]; @@ -532,7 +532,7 @@ void func_ptr_80170024(Entity* self) { } var_s7 = &D_CF000_8017C9A0[dragonNumber][0]; - size = ((self->ext.weapon.unk9C * 54 / 256) * + size = ((self->ext.weapon29.unk9C * 54 / 256) * (rsin(var_s7->unkE) * var_s7->unk14 / 256 + 4096)) / 4096; nextX = (var_s7 + 1)->posX.i.hi;