mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-01 08:07:47 -04:00
Bg_Lotus OK (#86)
This commit is contained in:
+4
-4
@@ -218,7 +218,7 @@ void StartHeap_AnalyzeArena(u32* maxFreeBlock, u32* bytesFree, u32* bytesAllocat
|
||||
void StartHeap_InitArena(u32 base, u32 size);
|
||||
// void StartHeap_Cleanup(void);
|
||||
// u32 StartHeap_IsInitialized(void);
|
||||
u32 rand(void);
|
||||
s32 rand(void);
|
||||
void randSetSeed(u32 seed);
|
||||
f32 randZeroOne(void);
|
||||
f32 randPlusMinusPoint5(void);
|
||||
@@ -971,13 +971,13 @@ void func_800C3C00(CollisionContext* bgCtxt, u32 param_2);
|
||||
void func_800C3C14(CollisionContext* bgCtxt, u32 param_2);
|
||||
BgMeshHeader* BgCheck_GetActorMeshHeader(CollisionContext* bgCtxt, s32 index);
|
||||
// void func_800C3C94(void);
|
||||
// float func_800C3D50(UNK_TYPE4 param_1, CollisionContext* bgCtxt, u32 param_3, UNK_PTR param_4, UNK_PTR param_5, UNK_PTR param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, u32 param_9, u32 param_10);
|
||||
f32 func_800C3D50(s32 arg0, CollisionContext* bgCtxt, s32 arg2, BgPolygon* arg3, s32* arg4, Vec3f* pos, Actor* actor, s32 arg7, f32 arg8, s32 arg9);
|
||||
// void func_800C3F40(void);
|
||||
// void func_800C3FA0(void);
|
||||
// void func_800C4000(void);
|
||||
// void func_800C4058(void);
|
||||
// void func_800C40B4(void);
|
||||
// void func_800C411C(CollisionContext* param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE4 param_5);
|
||||
f32 func_800C411C(CollisionContext* bgCtxt, BgPolygon* arg1, s32* arg2, Actor* actor, Vec3f* pos);
|
||||
// void func_800C4188(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800C41E4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800C4240(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
@@ -1101,7 +1101,7 @@ u32 func_800C9E40(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index);
|
||||
u32 func_800C9E88(CollisionContext* bgCtxt, BgPolygon* polygon, s32 index);
|
||||
// void func_800C9EBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void func_800CA1AC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800CA1E8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
void func_800CA1E8(GlobalContext* globalCtx, CollisionContext* bgCtxt, f32 arg2, f32 arg3, f32* arg4, UNK_PTR arg5);
|
||||
// void func_800CA22C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800CA568(void);
|
||||
// void func_800CA634(void);
|
||||
|
||||
@@ -5880,9 +5880,9 @@ SECTIONS
|
||||
ovl_Bg_Lotus : AT(RomLocation)
|
||||
{
|
||||
build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o(.text)
|
||||
build/asm/overlays/ovl_Bg_Lotus_data.o(.data)
|
||||
build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o(.data)
|
||||
build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o(.rodata)
|
||||
build/asm/overlays/ovl_Bg_Lotus_rodata.o(.rodata)
|
||||
build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus_overlay.o(.ovl)
|
||||
}
|
||||
SegmentEnd = .;
|
||||
SegmentSize = SegmentEnd - SegmentStart;
|
||||
|
||||
@@ -119,3 +119,7 @@ D_06006128 = 0x06006128;
|
||||
D_06009278 = 0x06009278;
|
||||
D_06012B70 = 0x06012B70;
|
||||
D_06013EA8 = 0x06013EA8;
|
||||
|
||||
/* bg_lotus */
|
||||
D_06000A20 = 0x06000A20;
|
||||
D_06000040 = 0x06000040;
|
||||
|
||||
@@ -162,7 +162,9 @@ void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vec3f* vector) {
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C411C.asm")
|
||||
f32 func_800C411C(CollisionContext* bgCtxt, BgPolygon* arg1, s32* arg2, Actor* actor, Vec3f* pos) {
|
||||
return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C4188.asm")
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* File: z_bg_lotus.c
|
||||
* Overlay: Bg_Lotus
|
||||
* Description: Southern Swamp Lilypads
|
||||
*/
|
||||
|
||||
#include "z_bg_lotus.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
@@ -9,7 +15,10 @@ void BgLotus_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgLotus_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgLotus_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx);
|
||||
void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx);
|
||||
void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Bg_Lotus_InitVars = {
|
||||
ACTOR_BG_LOTUS,
|
||||
ACTORCAT_BG,
|
||||
@@ -19,22 +28,150 @@ const ActorInit Bg_Lotus_InitVars = {
|
||||
(ActorFunc)BgLotus_Init,
|
||||
(ActorFunc)BgLotus_Destroy,
|
||||
(ActorFunc)BgLotus_Update,
|
||||
(ActorFunc)BgLotus_Draw
|
||||
(ActorFunc)BgLotus_Draw,
|
||||
};
|
||||
*/
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/BgLotus_Init.asm")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/BgLotus_Destroy.asm")
|
||||
extern BgMeshHeader D_06000A20; // Lilypad collision
|
||||
extern Gfx D_06000040[]; // Lilypad model
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/func_80AD6830.asm")
|
||||
void BgLotus_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgLotus* this = THIS;
|
||||
s32 pad;
|
||||
s32 sp2C;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/func_80AD68DC.asm")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
BcCheck3_BgActorInit(&this->dyna, 1);
|
||||
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000A20);
|
||||
this->dyna.actor.floorHeight =
|
||||
func_800C411C(&globalCtx->colCtx, &thisx->floorPoly, &sp2C, &this->dyna.actor, &this->dyna.actor.world.pos);
|
||||
this->timer2 = 96;
|
||||
this->dyna.actor.world.rot.y = (s16)(rand() >> 0x10);
|
||||
this->actionFunc = BgLotus_Wait;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/func_80AD6A88.asm")
|
||||
void BgLotus_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgLotus* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/func_80AD6B68.asm")
|
||||
BgCheck_RemoveActorMesh(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/BgLotus_Update.asm")
|
||||
void BgLotus_SetScaleXZ(BgLotus* this) {
|
||||
f32 scale;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Lotus_0x80AD6760/BgLotus_Draw.asm")
|
||||
if (this->dyna.actor.params == 0) {
|
||||
scale = sin_rad(this->timer * 0.7853982f) * ((0.014f * ((f32)this->timer / 8)) + 0.01f);
|
||||
this->dyna.actor.scale.x = (1.0f + scale) * 0.1f;
|
||||
this->dyna.actor.scale.z = (1.0f - scale) * 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) {
|
||||
f32 moveDist; // distance for the xz position of the lilypad to move
|
||||
|
||||
this->timer2--;
|
||||
|
||||
moveDist = sin_rad(this->timer2 * 0.06544985f) * 6.0f;
|
||||
|
||||
if (this->dyna.actor.params == 0) {
|
||||
this->dyna.actor.world.pos.x =
|
||||
(Math_Sins(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.world.pos.z =
|
||||
(Math_Coss(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.z;
|
||||
|
||||
if (this->timer2 == 0) {
|
||||
this->timer2 = 96;
|
||||
this->dyna.actor.world.rot.y += (s16)(rand() >> 0x12);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->height < this->dyna.actor.floorHeight) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->height;
|
||||
|
||||
if (func_800CAF70(&this->dyna)) {
|
||||
if (this->hasSpawnedRipples == 0) {
|
||||
EffectSS_SpawnGRipple(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 0);
|
||||
EffectSS_SpawnGRipple(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 8);
|
||||
this->timer = 40;
|
||||
}
|
||||
if (gSaveContext.perm.unk20 != 3) {
|
||||
this->timer = 40;
|
||||
this->dyna.actor.flags |= 0x10;
|
||||
this->actionFunc = BgLotus_Sink;
|
||||
return;
|
||||
}
|
||||
|
||||
this->hasSpawnedRipples = 1;
|
||||
} else {
|
||||
this->hasSpawnedRipples = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->timer > 0) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
BgLotus_SetScaleXZ(this);
|
||||
}
|
||||
|
||||
void BgLotus_Sink(BgLotus* this, GlobalContext* globalCtx) {
|
||||
if (this->height < this->dyna.actor.world.pos.y) {
|
||||
this->dyna.actor.world.pos.y = this->height;
|
||||
}
|
||||
|
||||
this->dyna.actor.world.pos.y -= 1.0f;
|
||||
|
||||
if (this->dyna.actor.world.pos.y <= this->dyna.actor.floorHeight) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
this->timer = 0;
|
||||
}
|
||||
|
||||
if (this->timer > 0) {
|
||||
this->timer--;
|
||||
BgLotus_SetScaleXZ(this);
|
||||
} else {
|
||||
if (Lib_StepTowardsCheck_f(&this->dyna.actor.scale.x, 0, 0.0050000003539f)) {
|
||||
this->dyna.actor.draw = NULL;
|
||||
this->timer = 100;
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
this->actionFunc = BgLotus_WaitToAppear;
|
||||
}
|
||||
|
||||
this->dyna.actor.scale.z = this->dyna.actor.scale.x;
|
||||
}
|
||||
}
|
||||
|
||||
void BgLotus_WaitToAppear(BgLotus* this, GlobalContext* globalCtx) {
|
||||
if (this->timer > 0) {
|
||||
this->timer--;
|
||||
} else if ((this->dyna.actor.xzDistToPlayer > 100.0f) && (this->dyna.actor.projectedPos.z < 0.0f)) {
|
||||
this->dyna.actor.draw = BgLotus_Draw;
|
||||
func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
this->dyna.actor.world.pos.y = CLAMP_MIN(this->height, this->dyna.actor.floorHeight);
|
||||
this->dyna.actor.flags &= ~0x10;
|
||||
this->timer2 = 96;
|
||||
this->actionFunc = BgLotus_Wait;
|
||||
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z;
|
||||
}
|
||||
}
|
||||
|
||||
void BgLotus_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgLotus* this = THIS;
|
||||
s32 pad;
|
||||
void* sp2C;
|
||||
|
||||
func_800CA1E8(globalCtx, &globalCtx->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z,
|
||||
&this->height, &sp2C);
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgLotus_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_800BDFC0(globalCtx, D_06000040);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
|
||||
struct BgLotus;
|
||||
|
||||
typedef void (*BgLotusActionFunc)(struct BgLotus*, GlobalContext*);
|
||||
|
||||
typedef struct BgLotus {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x28];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ BgLotusActionFunc actionFunc;
|
||||
/* 0x160 */ f32 height;
|
||||
/* 0x164 */ u8 hasSpawnedRipples;
|
||||
/* 0x166 */ s16 timer;
|
||||
/* 0x168 */ s16 timer2;
|
||||
} BgLotus; // size = 0x16C
|
||||
|
||||
extern const ActorInit Bg_Lotus_InitVars;
|
||||
|
||||
Reference in New Issue
Block a user