mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-03 00:36:35 -04:00
ovl_Bg_F40_Swlift OK and documented. obj_f40_obj documented. (#1171)
* Ported ovl_Bg_F40_Swlift to most recent zeldaret/master. * Ran formatter. * Attempt at fixing formatter problem. * Applied PR changes suggestions and added authors Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu> Co-authored-by: Isghj5 <isghj5@gmail.com> Co-authored-by: Tom-Overton <tom.overton@outlook.com> Co-authored-by: Derek-Hensley <hensley.derek58@gmail.com> * More PR fixes. Put object_f40_obj unused descriptor as comments. Added another author. Co-authored-by: AngheloAlf <angheloalf95@gmail.com> * Fixed some effect of handling merge conflicts. Some early returns added and renames in object_f40_obj.xml --------- Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu> Co-authored-by: Isghj5 <isghj5@gmail.com> Co-authored-by: Tom-Overton <tom.overton@outlook.com> Co-authored-by: Derek-Hensley <hensley.derek58@gmail.com> Co-authored-by: AngheloAlf <angheloalf95@gmail.com>
This commit is contained in:
@@ -229,7 +229,7 @@ void BgF40Block_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004640);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gStoneTowerBlockCol);
|
||||
|
||||
if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) {
|
||||
this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)];
|
||||
@@ -373,5 +373,5 @@ void BgF40Block_Update(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void BgF40Block_Draw(Actor* thisx, PlayState* play) {
|
||||
Gfx_DrawDListOpa(play, object_f40_obj_DL_0043D0);
|
||||
Gfx_DrawDListOpa(play, gStoneTowerBlockDL);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void BgF40Flift_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004240);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gStoneTowerTempleSquareElevatorCol);
|
||||
this->dyna.actor.params = 1;
|
||||
this->actionFunc = func_808D75F0;
|
||||
}
|
||||
@@ -91,5 +91,5 @@ void BgF40Flift_Update(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void BgF40Flift_Draw(Actor* thisx, PlayState* play) {
|
||||
Gfx_DrawDListOpa(play, object_f40_obj_DL_004038);
|
||||
Gfx_DrawDListOpa(play, gStoneTowerTempleSquareElevatorDL);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_bg_f40_swlift.h"
|
||||
#include "objects/object_f40_obj/object_f40_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
@@ -12,11 +13,13 @@
|
||||
|
||||
void BgF40Swlift_Init(Actor* thisx, PlayState* play);
|
||||
void BgF40Swlift_Destroy(Actor* thisx, PlayState* play);
|
||||
void BgF40Swlift_Update(Actor* thisx, PlayState* play);
|
||||
void BgF40Swlift_Update(Actor* thisx, PlayState* play2);
|
||||
void BgF40Swlift_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
#if 0
|
||||
ActorInit Bg_F40_Swlift_InitVars = {
|
||||
static s32 sSwitchFlags[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
static s32 sHeights[4];
|
||||
|
||||
const ActorInit Bg_F40_Swlift_InitVars = {
|
||||
ACTOR_BG_F40_SWLIFT,
|
||||
ACTORCAT_BG,
|
||||
FLAGS,
|
||||
@@ -28,24 +31,86 @@ ActorInit Bg_F40_Swlift_InitVars = {
|
||||
(ActorFunc)BgF40Swlift_Draw,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_8096F540[] = {
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneScale, 550, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 5000, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
void BgF40Swlift_Init(Actor* thisx, PlayState* play) {
|
||||
BgF40Swlift* this = THIS;
|
||||
s32 index;
|
||||
s32 pad;
|
||||
|
||||
extern InitChainEntry D_8096F540[];
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
index = BG_F40_SWLIFT_GET_INDEX(thisx);
|
||||
if ((index < 0) || (index >= 5)) { //! @bug An index greater than 3 will cause an out of bounds array access.
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06003B08;
|
||||
extern UNK_TYPE D_06003E80;
|
||||
sHeights[index] = this->dyna.actor.world.pos.y;
|
||||
sSwitchFlags[index] = BG_F40_SWLIFT_GET_SWITCHFLAG(thisx);
|
||||
if (index != 0) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Swlift/BgF40Swlift_Init.s")
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gStoneTowerVerticallyOscillatingPlatformCol);
|
||||
this->dyna.actor.params = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Swlift/BgF40Swlift_Destroy.s")
|
||||
void BgF40Swlift_Destroy(Actor* thisx, PlayState* play) {
|
||||
BgF40Swlift* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Swlift/BgF40Swlift_Update.s")
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Swlift/BgF40Swlift_Draw.s")
|
||||
void BgF40Swlift_Update(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
BgF40Swlift* this = THIS;
|
||||
s32 i;
|
||||
|
||||
for (i = 1; i < ARRAY_COUNT(sSwitchFlags); i++) {
|
||||
if ((sSwitchFlags[i] == 0xFF) || !Flags_GetSwitch(play, sSwitchFlags[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i--;
|
||||
if (i != this->dyna.actor.params) {
|
||||
f32 heightOffset;
|
||||
|
||||
this->dyna.actor.params = -1;
|
||||
heightOffset = (sHeights[i] - this->dyna.actor.world.pos.y) * 0.1f;
|
||||
if (heightOffset > 0.0f) {
|
||||
heightOffset = CLAMP(heightOffset, 0.5f, 15.0f);
|
||||
} else {
|
||||
heightOffset = CLAMP(heightOffset, -15.0f, -0.5f);
|
||||
}
|
||||
|
||||
if (Math_StepToF(&this->dyna.actor.speed, heightOffset, 1.0f) && (fabsf(heightOffset) <= 0.5f)) {
|
||||
if (Math_StepToF(&this->dyna.actor.world.pos.y, sHeights[i], fabsf(this->dyna.actor.speed))) {
|
||||
this->dyna.actor.params = i;
|
||||
this->timer = 48;
|
||||
this->dyna.actor.speed = 0.0f;
|
||||
}
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y += this->dyna.actor.speed;
|
||||
}
|
||||
} else {
|
||||
if (this->timer == 0) {
|
||||
this->timer = 48;
|
||||
}
|
||||
this->timer--;
|
||||
this->dyna.actor.world.pos.y =
|
||||
sHeights[this->dyna.actor.params] + (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void BgF40Swlift_Draw(Actor* thisx, PlayState* play) {
|
||||
BgF40Swlift* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(play, gStoneTowerVerticallyOscillatingPlatformDL);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#ifndef Z_BG_F40_SWLIFT_H
|
||||
#define Z_BG_F40_SWLIFT_H
|
||||
|
||||
#define BG_F40_SWLIFT_GET_SWITCHFLAG(thisx) ((thisx)->params & 0xFF)
|
||||
#define BG_F40_SWLIFT_GET_INDEX(thisx) (((thisx)->params >> 8) & 0xFF)
|
||||
|
||||
#include "global.h"
|
||||
|
||||
struct BgF40Swlift;
|
||||
|
||||
typedef struct BgF40Swlift {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x1C];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ s32 timer;
|
||||
} BgF40Swlift; // size = 0x160
|
||||
|
||||
#endif // Z_BG_F40_SWLIFT_H
|
||||
|
||||
Reference in New Issue
Block a user