mirror of https://github.com/zeldaret/mm.git
EnAz and EnTwig (Beaver bros and the minigame rings) (#999)
* leave it to beavers * match * merge * catchup part 2 * fix warnings * I accidentally the xml * hopefully that's all of them * lol merge * linked object * now with more enums * Update src/overlays/actors/ovl_En_Az/z_en_az.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * more fixes * limbs and maths * stuff * more macro management * last enum? * more fixes * fixed * entrances Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain> Co-authored-by: petrie911 <pmontag@Monday.localdomain> Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
parent
3d430a5733
commit
bf26065867
|
|
@ -83,7 +83,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 unk_0; // frame?
|
||||
/* 0x2 */ Vec3s unk_2; // pos?
|
||||
/* 0x2 */ Vec3s unk_2; // scale
|
||||
} struct_80124618; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ typedef struct {
|
|||
#define BINANG_LERPIMP(v0, v1, t) ((v0) + (s16)(BINANG_SUB((v1), (v0)) * (t)))
|
||||
#define BINANG_LERPIMPINV(v0, v1, t) ((v0) + BINANG_SUB((v1), (v0)) / (t))
|
||||
|
||||
#define LERPWEIGHT(val, prev, next) (((val) - (prev)) / ((next) - (prev)))
|
||||
#define F32_LERPWEIGHT(val, prev, next) (((f32)(val) - (f32)(prev)) / ((f32)(next) - (f32)(prev)))
|
||||
|
||||
#define VEC3F_LERPIMPDST(dst, v0, v1, t){ \
|
||||
(dst)->x = (v0)->x + (((v1)->x - (v0)->x) * t); \
|
||||
(dst)->y = (v0)->y + (((v1)->y - (v0)->y) * t); \
|
||||
|
|
|
|||
8
spec
8
spec
|
|
@ -3038,9 +3038,7 @@ beginseg
|
|||
name "ovl_En_Az"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Az/z_en_az.o"
|
||||
include "build/data/ovl_En_Az/ovl_En_Az.data.o"
|
||||
include "build/data/ovl_En_Az/ovl_En_Az.bss.o"
|
||||
include "build/data/ovl_En_Az/ovl_En_Az.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Az/ovl_En_Az_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
@ -3206,9 +3204,7 @@ beginseg
|
|||
name "ovl_En_Twig"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Twig/z_en_twig.o"
|
||||
include "build/data/ovl_En_Twig/ovl_En_Twig.data.o"
|
||||
include "build/data/ovl_En_Twig/ovl_En_Twig.bss.o"
|
||||
include "build/data/ovl_En_Twig/ovl_En_Twig.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Twig/ovl_En_Twig_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,10 +7,48 @@ struct EnAz;
|
|||
|
||||
typedef void (*EnAzActionFunc)(struct EnAz*, PlayState*);
|
||||
|
||||
#define BEAVER_GET_PARAM_F00(thisx) (((thisx)->params >> 8) & 0xF)
|
||||
#define BEAVER_GET_PARAM_FF(thisx) ((thisx)->params & 0xFF)
|
||||
|
||||
typedef struct EnAz {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnAzActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x290];
|
||||
/* 0x148 */ SkelAnime skelAnime;
|
||||
/* 0x18C */ ColliderCylinder collider;
|
||||
/* 0x1D8 */ Vec3s jointTable[24];
|
||||
/* 0x268 */ Vec3s morphTable[24];
|
||||
/* 0x2F8 */ s16 unk_2F8;
|
||||
/* 0x2FA */ s16 unk_2FA; // cutscene state?
|
||||
/* 0x2FC */ s32 animIndex;
|
||||
/* 0x300 */ ActorPathing unk_300;
|
||||
/* 0x36C */ f32 unk_36C;
|
||||
/* 0x370 */ UNK_TYPE1 unk370[4];
|
||||
/* 0x374 */ u16 unk_374; // flags of some sort
|
||||
/* 0x376 */ u16 unk_376; // flags of some sort
|
||||
/* 0x378 */ u8 unk_378; // cutscene state?
|
||||
/* 0x37A */ s16 unk_37A;
|
||||
/* 0x37C */ s16 unk_37C;
|
||||
/* 0x37E */ s16 unk_37E;
|
||||
/* 0x380 */ s16 unk_380;
|
||||
/* 0x382 */ s16 unk_382;
|
||||
/* 0x384 */ s16 unk_384;
|
||||
/* 0x388 */ struct EnAz* brother;
|
||||
/* 0x38C */ UNK_TYPE1 unk38C[0x10];
|
||||
/* 0x39C */ s16 unk_39C;
|
||||
/* 0x39E */ s16 unk_39E; // some sort of rotation
|
||||
/* 0x3A0 */ UNK_TYPE1 unk3A0[4];
|
||||
/* 0x3A4 */ f32 unk_3A4;
|
||||
/* 0x3A8 */ Vec3f unk_3A8;
|
||||
/* 0x3B4 */ Vec3f unk_3B4; // translation
|
||||
/* 0x3C0 */ s16 unk_3C0; // seems to do nothing
|
||||
/* 0x3C2 */ s16 unk_3C2;
|
||||
/* 0x3C4 */ s16 unk_3C4;
|
||||
/* 0x3C6 */ UNK_TYPE1 unk3C6[6];
|
||||
/* 0x3CC */ s32 getItemId;
|
||||
/* 0x3D0 */ s16 unk_3D0[1];
|
||||
/* 0x3D2 */ u16 unk_3D2;
|
||||
/* 0x3D4 */ s16 unk_3D4;
|
||||
/* 0x3D6 */ s16 unk_3D6;
|
||||
} EnAz; // size = 0x3D8
|
||||
|
||||
extern const ActorInit En_Az_InitVars;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_en_twig.h"
|
||||
#include "objects/object_twig/object_twig.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
|
|
@ -12,10 +13,18 @@
|
|||
|
||||
void EnTwig_Init(Actor* thisx, PlayState* play);
|
||||
void EnTwig_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnTwig_Update(Actor* thisx, PlayState* play);
|
||||
void EnTwig_Draw(Actor* thisx, PlayState* play);
|
||||
void EnTwig_Update(Actor* this, PlayState* play);
|
||||
void EnTwig_Draw(EnTwig* this, PlayState* play);
|
||||
|
||||
void func_80AC0A54(EnTwig* this, PlayState* play);
|
||||
void func_80AC0A6C(EnTwig* this, PlayState* play);
|
||||
|
||||
void func_80AC0A7C(EnTwig* this, PlayState* play);
|
||||
void func_80AC0AC8(EnTwig* this, PlayState* play);
|
||||
|
||||
void func_80AC0CC4(EnTwig* this, PlayState* play);
|
||||
void func_80AC0D2C(EnTwig* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Twig_InitVars = {
|
||||
ACTOR_EN_TWIG,
|
||||
ACTORCAT_MISC,
|
||||
|
|
@ -28,36 +37,205 @@ const ActorInit En_Twig_InitVars = {
|
|||
(ActorFunc)EnTwig_Draw,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_80AC10C0[] = {
|
||||
static s32 sCurrentRing;
|
||||
static s16 sRingCount;
|
||||
static s16 sRingNotCollected[25];
|
||||
|
||||
static CollisionHeader* sColHeaders[] = {
|
||||
NULL,
|
||||
&object_twig_Colheader_0020A0,
|
||||
&object_twig_Colheader_0016C0,
|
||||
};
|
||||
|
||||
static s16 sRingsHaveSpawned = false;
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneScale, 40, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 40, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
void EnTwig_Init(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
EnTwig* this = THIS;
|
||||
s32 i;
|
||||
|
||||
extern InitChainEntry D_80AC10C0[];
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
this->unk_160 = RACERING_GET_PARAM_F(&this->dyna.actor);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
if (sColHeaders[this->unk_160] != NULL) {
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[this->unk_160]);
|
||||
}
|
||||
this->dyna.actor.bgCheckFlags |= 0x400;
|
||||
switch (this->unk_160) {
|
||||
case 0:
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
break;
|
||||
case 1:
|
||||
if (!sRingsHaveSpawned) {
|
||||
sRingCount = (gSaveContext.save.weekEventReg[24] & 4) ? 25 : 20;
|
||||
for (i = 0; i < sRingCount; i++) {
|
||||
sRingNotCollected[i] = false;
|
||||
}
|
||||
sRingsHaveSpawned = true;
|
||||
}
|
||||
if (RACERING_GET_PARAM_1F0(&this->dyna.actor) != 0) {
|
||||
if (!(gSaveContext.save.weekEventReg[24] & 4)) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
} else if (gSaveContext.save.weekEventReg[24] & 4) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
Actor_SetScale(&this->dyna.actor, 4.2f);
|
||||
this->dyna.actor.uncullZoneScale = this->dyna.actor.uncullZoneDownward = this->dyna.actor.scale.x * 60.0f;
|
||||
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
func_80AC0A7C(this, play);
|
||||
break;
|
||||
case 2:
|
||||
Actor_SetScale(&this->dyna.actor, 1.0f);
|
||||
this->dyna.actor.uncullZoneScale = this->dyna.actor.uncullZoneDownward = this->dyna.actor.scale.x * 880.0f;
|
||||
func_80AC0A54(this, play);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06001C38;
|
||||
void EnTwig_Destroy(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
EnTwig* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/EnTwig_Init.s")
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/EnTwig_Destroy.s")
|
||||
void func_80AC0A54(EnTwig* this, PlayState* play) {
|
||||
this->actionFunc = func_80AC0A6C;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0A54.s")
|
||||
void func_80AC0A6C(EnTwig* this, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0A6C.s")
|
||||
void func_80AC0A7C(EnTwig* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0A7C.s")
|
||||
Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]);
|
||||
this->unk_178 = 0;
|
||||
this->unk_17A = 0;
|
||||
this->actionFunc = func_80AC0AC8;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0AC8.s")
|
||||
void func_80AC0AC8(EnTwig* this, PlayState* play) {
|
||||
static Vec3f D_80AC10D0 = { 0.0f, 0.0f, 1.0f };
|
||||
Player* player = GET_PLAYER(play);
|
||||
Plane sp4C;
|
||||
Vec3f sp40;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0CC4.s")
|
||||
if (sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) {
|
||||
if (this->unk_17A == 3) {
|
||||
this->unk_17A = 0;
|
||||
this->dyna.actor.shape.rot.z += 0x2000;
|
||||
} else {
|
||||
this->unk_17A++;
|
||||
}
|
||||
}
|
||||
SubS_ConstructPlane(&this->dyna.actor.world.pos, &D_80AC10D0, &this->dyna.actor.shape.rot, &sp4C);
|
||||
if ((sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) &&
|
||||
Math3D_LineSegVsPlane(sp4C.normal.x, sp4C.normal.y, sp4C.normal.z, sp4C.originDist, &this->unk_180,
|
||||
&player->bodyPartsPos[0], &sp40, 0)) {
|
||||
if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &sp40) <= SQ(this->dyna.actor.scale.x * 0.345f * 40.0f)) {
|
||||
func_80AC0CC4(this, play);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (this->dyna.actor.xyzDistToPlayerSq <= SQ((this->dyna.actor.scale.x * 40.0f) + 40)) {
|
||||
func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
} else {
|
||||
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
if (this->dyna.actor.xyzDistToPlayerSq >= (this->dyna.actor.scale.x * 10.0f * 40.0f * 40.0f)) {
|
||||
this->dyna.actor.shape.rot.y = this->dyna.actor.yawTowardsPlayer;
|
||||
this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer;
|
||||
}
|
||||
}
|
||||
Math_Vec3f_Copy(&this->unk_180, &player->bodyPartsPos[0]);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/func_80AC0D2C.s")
|
||||
void func_80AC0CC4(EnTwig* this, PlayState* play) {
|
||||
this->unk_170 = 3458.0f;
|
||||
this->unk_174 = 0.2f;
|
||||
this->unk_16C |= 1;
|
||||
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->actionFunc = func_80AC0D2C;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/EnTwig_Update.s")
|
||||
void func_80AC0D2C(EnTwig* this, PlayState* play) {
|
||||
static Vec3f sKiraVel = { 0.0f, -0.05f, 0.0f };
|
||||
static Vec3f sKiraAccel = { 0.0f, -0.025f, 0.0f };
|
||||
static Color_RGBA8 sColorWhite = { 255, 255, 255, 130 };
|
||||
static Color_RGBA8 sColorYellow = { 255, 255, 0, 0 };
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Twig/EnTwig_Draw.s")
|
||||
Math_SmoothStepToF(&this->dyna.actor.world.pos.x, player->bodyPartsPos[0].x, 0.5f, 100.0f, 0.01f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.world.pos.y, player->bodyPartsPos[0].y, 0.5f, 100.0f, 0.01f);
|
||||
Math_SmoothStepToF(&this->dyna.actor.world.pos.z, player->bodyPartsPos[0].z, 0.5f, 100.0f, 0.01f);
|
||||
this->dyna.actor.shape.rot.z += (s16)this->unk_170;
|
||||
this->dyna.actor.scale.x -= this->unk_174;
|
||||
if (this->dyna.actor.scale.x < 0.0f) {
|
||||
Actor_SetScale(&this->dyna.actor, 0.0f);
|
||||
} else {
|
||||
Actor_SetScale(&this->dyna.actor, this->dyna.actor.scale.x);
|
||||
}
|
||||
if (this->dyna.actor.scale.x <= 0.0f) {
|
||||
s32 j;
|
||||
Vec3f sp6C;
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
sp6C.x = (Rand_Centered() * 10.0f) + this->dyna.actor.world.pos.x;
|
||||
sp6C.y = (Rand_Centered() * 10.0f) + this->dyna.actor.world.pos.y;
|
||||
sp6C.z = (Rand_Centered() * 10.0f) + this->dyna.actor.world.pos.z;
|
||||
EffectSsKirakira_SpawnDispersed(play, &sp6C, &sKiraVel, &sKiraAccel, &sColorWhite, &sColorYellow, 1000,
|
||||
(s32)(Rand_ZeroOne() * 10.0f) + 20);
|
||||
}
|
||||
play_sound(NA_SE_SY_GET_ITEM);
|
||||
play->interfaceCtx.unk_25C--;
|
||||
sRingNotCollected[RACERING_GET_PARAM_FE0(&this->dyna.actor)] = true;
|
||||
if (sCurrentRing == RACERING_GET_PARAM_FE0(&this->dyna.actor)) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < sRingCount; i++) {
|
||||
if (!sRingNotCollected[i]) {
|
||||
sCurrentRing = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == sRingCount) {
|
||||
sCurrentRing = -1;
|
||||
}
|
||||
}
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
this->unk_170 += 180.0f / 0x10000;
|
||||
this->unk_174 += 0.15f;
|
||||
}
|
||||
|
||||
void EnTwig_Update(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
EnTwig* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
void EnTwig_Draw(EnTwig* thisx, PlayState* play) {
|
||||
EnTwig* this = THIS;
|
||||
|
||||
switch (this->unk_160) {
|
||||
case 1:
|
||||
Gfx_DrawDListOpa(play, object_twig_DL_001C38);
|
||||
break;
|
||||
case 2:
|
||||
Gfx_DrawDListOpa(play, object_twig_DL_0014C8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,22 @@ struct EnTwig;
|
|||
|
||||
typedef void (*EnTwigActionFunc)(struct EnTwig*, PlayState*);
|
||||
|
||||
#define RACERING_GET_PARAM_F(thisx) ((thisx)->params & 0xF)
|
||||
#define RACERING_GET_PARAM_1F0(thisx) (((thisx)->params >> 4) & 0x1F)
|
||||
#define RACERING_GET_PARAM_FE0(thisx) (((thisx)->params >> 9) & 0x7F)
|
||||
|
||||
typedef struct EnTwig {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x18];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ EnTwigActionFunc actionFunc;
|
||||
/* 0x160 */ char unk_160[0x2C];
|
||||
/* 0x160 */ s32 unk_160;
|
||||
/* 0x160 */ UNK_TYPE1 unk164[8];
|
||||
/* 0x16C */ s32 unk_16C;
|
||||
/* 0x170 */ f32 unk_170;
|
||||
/* 0x174 */ f32 unk_174;
|
||||
/* 0x178 */ s16 unk_178;
|
||||
/* 0x17A */ u16 unk_17A;
|
||||
/* 0x17C */ UNK_TYPE1 unk17C[4];
|
||||
/* 0x180 */ Vec3f unk_180;
|
||||
} EnTwig; // size = 0x18C
|
||||
|
||||
extern const ActorInit En_Twig_InitVars;
|
||||
|
|
|
|||
Loading…
Reference in New Issue