diff --git a/include/functions.h b/include/functions.h index 51d6d9c54b..ce8b5ac1a2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -756,8 +756,8 @@ s32 Actor_CollisionCheck_SetOT(GlobalContext* globalCtx, SubGlobalContext11E60* // ? func_80061C98(?); // ? func_80061E48(?); // ? func_80061E8C(?); -void func_80061ED4(SubActorStruct98* sub98, ActorDamageChart* damageChart, SubActor98Init* subActor98Init); -void func_80061EFC(SubActorStruct98* sub98, ActorDamageChart* damageChart, SubActor98Init* subActor98Init); +void func_80061ED4(SubActorStruct98* sub98, ActorDamageChart* damageChart, Sub98Init4* sub98Init); +void func_80061EFC(SubActorStruct98* sub98, ActorDamageChart* damageChart, Sub98Init4* sub98Init); // ? func_80061F64(?); // ? func_800622E4(?); // ? func_80062530(?); diff --git a/include/z64actor.h b/include/z64actor.h index 91a1f9f716..bee0433109 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -80,13 +80,6 @@ typedef struct { } attack[32]; } ActorDamageChart; -typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ u8 mass; -} SubActor98Init; - typedef struct { /* 0x00 */ ActorDamageChart* damageChart; // For actors which contain a damage chart (example: Stalfos)... /* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body @@ -182,6 +175,21 @@ typedef struct Actor { /* From here on, the structure and size varies for each actor */ } Actor; // size = 0x14C +typedef struct { + /* 0x00 */ u8 health; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ u8 mass; +} Sub98Init4; + +typedef struct { + /* 0x00 */ u8 health; + /* 0x02 */ s16 unk_10; + /* 0x04 */ s16 unk_12; + /* 0x06 */ u16 unk_14; + /* 0x08 */ u8 mass; +} Sub98Init5; + typedef enum { COLTYPE_CYLINDER = 1, COLTYPE_CYLINDER_GROUP = 0, diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index fe21fd9292..edd2247267 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -47,7 +47,7 @@ void ArrowFire_Init(ArrowFire* this, GlobalContext* globalCtx) { this->radius = 0; this->unk_158 = 1.0f; ArrowFire_SetupAction(&this->actor, ArrowFire_Charge); - Actor_SetScale(this, 0.01); + Actor_SetScale(this, 0.01f); this->alpha = 0xA0; this->timer = 0; this->unk_15C = 0.0f; @@ -105,7 +105,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { scale = 310.0f; } else { scale = this->actor.unk_F0; - scale = ((scale - 50.0f) * 0.33333334f) + 10.0f; + scale = ((scale - 50.0f) * (1.0f / 3.0f)) + 10.0f; } } @@ -114,7 +114,7 @@ void ArrowFire_Hit(ArrowFire* this, GlobalContext* globalCtx) { this->timer -= 1; if (this->timer >= 8) { - offset = ((this->timer - 8) * 0.041666668f); + offset = ((this->timer - 8) * (1.0f / 24.0f)); offset = SQ(offset); this->radius = (((1.0f - offset) * scale) + 10.0f); this->unk_158 += ((2.0f - this->unk_158) * 0.1f); @@ -158,7 +158,7 @@ void ArrowFire_Fly(ArrowFire* this, GlobalContext* globalCtx) { // copy position and rotation from the attached arrow this->actor.posRot.pos = arrow->actor.posRot.pos; this->actor.shape.rot = arrow->actor.shape.rot; - distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * 0.041666668f; + distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * (1.0f / 24.0f); this->unk_158 = distanceScaled; if (distanceScaled < 1.0f) { this->unk_158 = 1.0f; diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 2835ad6cf5..76dde2184c 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -47,7 +47,7 @@ void ArrowIce_Init(ArrowIce* this, GlobalContext* globalCtx) { this->radius = 0; this->unk_160 = 1.0f; ArrowIce_SetupAction(this, ArrowIce_Charge); - Actor_SetScale(&this->actor, 0.01); + Actor_SetScale(&this->actor, 0.01f); this->alpha = 0x64; this->timer = 0; this->unk_164 = 0.0f; @@ -105,7 +105,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { scale = 310.0f; } else { scale = this->actor.unk_F0; - scale = ((scale - 50.0f) * 0.33333334f) + 10.0f; + scale = ((scale - 50.0f) * (1.0f / 3.0f)) + 10.0f; } } @@ -114,7 +114,7 @@ void ArrowIce_Hit(ArrowIce* this, GlobalContext* globalCtx) { this->timer -= 1; if (this->timer >= 8) { - offset = ((this->timer - 8) * 0.041666668f); + offset = ((this->timer - 8) * (1.0f / 24.0f)); offset = SQ(offset); this->radius = (((1.0f - offset) * scale) + 10.0f); this->unk_160 += ((2.0f - this->unk_160) * 0.1f); @@ -158,7 +158,7 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { // copy position and rotation from the attached arrow this->actor.posRot.pos = arrow->actor.posRot.pos; this->actor.shape.rot = arrow->actor.shape.rot; - distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * 0.041666668f; + distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * (1.0f / 24.0f); this->unk_160 = distanceScaled; if (distanceScaled < 1.0f) { this->unk_160 = 1.0f; @@ -167,7 +167,7 @@ void ArrowIce_Fly(ArrowIce* this, GlobalContext* globalCtx) { if (arrow->hitWall & 1) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_ICE); - ArrowIce_SetupAction(this, &ArrowIce_Hit); + ArrowIce_SetupAction(this, ArrowIce_Hit); this->timer = 32; this->alpha = 0xFF; } else if (arrow->timer < 34) { diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index a91c2fce9e..555c7f276a 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -47,7 +47,7 @@ void ArrowLight_Init(ArrowLight* this, GlobalContext* globalCtx) { this->radius = 0; this->unk_160 = 1.0f; ArrowLight_SetupAction(this, ArrowLight_Charge); - Actor_SetScale(&this->actor, 0.01); + Actor_SetScale(&this->actor, 0.01f); this->alpha = 0x82; this->timer = 0; this->unk_164 = 0.0f; @@ -105,7 +105,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { scale = 310.0f; } else { scale = this->actor.unk_F0; - scale = ((scale - 50.0f) * 0.33333334f) + 10.0f; + scale = ((scale - 50.0f) * (1.0f / 3.0f)) + 10.0f; } } @@ -114,7 +114,7 @@ void ArrowLight_Hit(ArrowLight* this, GlobalContext* globalCtx) { this->timer -= 1; if (this->timer >= 8) { - offset = ((this->timer - 8) * 0.041666668f); + offset = ((this->timer - 8) * (1.0f / 24.0f)); offset = SQ(offset); this->radius = (((1.0f - offset) * scale) + 10.0f); this->unk_160 += ((2.0f - this->unk_160) * 0.1f); @@ -158,7 +158,7 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { // copy position and rotation from the attached arrow this->actor.posRot.pos = arrow->actor.posRot.pos; this->actor.shape.rot = arrow->actor.shape.rot; - distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * 0.041666668f; + distanceScaled = Math_Vec3f_DistXYZ(&this->unkPos, &this->actor.posRot.pos) * (1.0f / 24.0f); this->unk_160 = distanceScaled; if (distanceScaled < 1.0f) { this->unk_160 = 1.0f; @@ -167,7 +167,7 @@ void ArrowLight_Fly(ArrowLight* this, GlobalContext* globalCtx) { if (arrow->hitWall & 1) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_EXPLOSION_LIGHT); - ArrowLight_SetupAction(this, &ArrowLight_Hit); + ArrowLight_SetupAction(this, ArrowLight_Hit); this->timer = 32; this->alpha = 0xFF; } else if (arrow->timer < 34) { diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index d87c2f1362..47f061eba0 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -168,7 +168,7 @@ static ColliderCylinderInit colliderInit = { 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0001, 0x0000, 0x000A, 0x0046, 0x0000, }; -static SubActor98Init subActor98Init = { +static Sub98Init4 sub98Init = { 0x0A, 0x0023, 0x0064, @@ -202,7 +202,7 @@ static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) { ActorCollider_AllocCylinder(globalCtx, collision); ActorCollider_InitCylinder(globalCtx, collision, thisx, &colliderInit); ActorCollider_Cylinder_Update(thisx, collision); - func_80061ED4(&thisx->sub_98, 0, &subActor98Init); + func_80061ED4(&thisx->sub_98, 0, &sub98Init); } static void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index d625fc2f86..073ef77f38 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -41,17 +41,7 @@ static ColliderCylinderInit cylinderInit = { 0x0010, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, }; -// There are multiple versions of sub98 init structs -// Keeping these local until z_collision_check is decompiled -typedef struct { - /* 0x00 */ u8 health; - /* 0x02 */ s16 unk_10; - /* 0x04 */ s16 unk_12; - /* 0x06 */ u16 unk_14; - /* 0x08 */ u8 mass; -} sub98Init; - -static sub98Init sub98Data = { +static Sub98Init5 sub98Data = { 0x00, // health 0x0000, // unk_10 0x0000, // unk_12 diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 818b254344..04dc225182 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -1,15 +1,10 @@ -#include -#include -#include "z_en_tk.h" +/* + * File: z_en_tk.c + * Overlay: ovl_En_Tk + * Description: Dampe NPC from "Dampe's Heart-Pounding Gravedigging Tour" + */ -typedef struct { - /* 0x0000 */ u8 health; /* SubActorStruct98.health */ - /* 0x0002 */ s16 h_2; /* SubActorStruct98.unk_10 */ - /* 0x0004 */ s16 h_4; /* SubActorStruct98.unk_12 */ - /* 0x0006 */ s16 h_6; /* SubActorStruct98.unk_14 */ - /* 0x0008 */ u8 mass; /* SubActorStruct98.mass */ - /* 0x000A */ -} EnTk_SubActorStruct98Init; +#include "z_en_tk.h" #define ROOM 0x00 #define FLAGS 0x00000009 @@ -181,7 +176,7 @@ static ColliderCylinderInit D_80B1D508 = { 0x00, 0x00, 0x01, 0x00, 0x001E, 0x0034, 0x0000, 0x0000, 0x0000, 0x0000, }; -static EnTk_SubActorStruct98Init D_80B1D534 = { +static Sub98Init5 D_80B1D534 = { 0x00, 0x0000, 0x0000, 0x0000, 0xFF, }; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 48f1cae778..d106c9cd02 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -57,7 +57,12 @@ static ColliderCylinderInit colCylinderInit = { 0x00, 0x01, 0x01, 0x00, 0x001E, 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, }; -static SubActor98Init subActor98Init = { 0x04, 0x001E, 0x0028, 0x96 }; +static Sub98Init4 sub98Init = { + 0x04, + 0x001E, + 0x0028, + 0x96, +}; static ActorDamageChart damageChart = { { { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x1 }, { 0x0, 0x2 }, { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x2 }, { 0x1, 0x0 }, @@ -96,7 +101,7 @@ static void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx) { ActorCollider_AllocCylinder(globalCtx, &this->colCylinder); ActorCollider_InitCylinder(globalCtx, &this->colCylinder, &this->actor, &colCylinderInit); - func_80061ED4(&this->actor.sub_98, &damageChart, &subActor98Init); + func_80061ED4(&this->actor.sub_98, &damageChart, &sub98Init); this2->switchFlag = (u8)(this2->actor.params >> 0x8); this->actor.params = this->actor.params & 0xFF;