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:
TrulyNaN 2023-06-02 00:25:03 -04:00 committed by GitHub
parent 95c5796e41
commit 0261dc0a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 35 deletions

View File

@ -1,17 +1,25 @@
<Root>
<!--
Assets for Stone Tower platforms. These platforms include the cubes moved by pressing the switches in
Stone Tower and two unused platforms.
-->
<File Name="object_f40_obj" Segment="6">
<Texture Name="object_f40_obj_Tex_000000" OutName="tex_000000" Format="i8" Width="64" Height="64" Offset="0x0" />
<Texture Name="object_f40_obj_Tex_001000" OutName="tex_001000" Format="rgba16" Width="32" Height="64" Offset="0x1000" />
<Texture Name="object_f40_obj_Tex_002000" OutName="tex_002000" Format="rgba16" Width="32" Height="32" Offset="0x2000" />
<Texture Name="object_f40_obj_Tex_002800" OutName="tex_002800" Format="i4" Width="32" Height="128" Offset="0x2800" />
<Texture Name="object_f40_obj_Tex_003000" OutName="tex_003000" Format="i4" Width="64" Height="64" Offset="0x3000" />
<DList Name="object_f40_obj_DL_003B00" Offset="0x3B00" />
<DList Name="object_f40_obj_DL_003B08" Offset="0x3B08" />
<Collision Name="object_f40_obj_Colheader_003E80" Offset="0x3E80" />
<DList Name="object_f40_obj_DL_004030" Offset="0x4030" />
<DList Name="object_f40_obj_DL_004038" Offset="0x4038" />
<Collision Name="object_f40_obj_Colheader_004240" Offset="0x4240" />
<DList Name="object_f40_obj_DL_0043D0" Offset="0x43D0" /> <!-- Original name is "z2_f40obj01_model" -->
<Collision Name="object_f40_obj_Colheader_004640" Offset="0x4640" /> <!-- Original name is "z2_f40obj01_bgdatainfo" -->
<Texture Name="gStoneTowerPlatformsTopTex" OutName="stone_tower_platforms_top" Format="i8" Width="64" Height="64" Offset="0x0" /> <!-- Unused -->
<Texture Name="gStoneTowerPlatformsSidesTex" OutName="stone_tower_platforms_sides" Format="rgba16" Width="32" Height="64" Offset="0x1000" /> <!-- Unused -->
<Texture Name="gStoneTowerBlockBackgroundTex" OutName="stone_tower_block_background" Format="rgba16" Width="32" Height="32" Offset="0x2000" />
<Texture Name="gStoneTowerBlockPatternTex" OutName="stone_tower_block_pattern" Format="i4" Width="32" Height="128" Offset="0x2800" />
<Texture Name="gStoneTowerBlockSidesTex" OutName="stone_tower_block_sides" Format="i4" Width="64" Height="64" Offset="0x3000" />
<DList Name="gStoneTowerVerticallyOscillatingPlatformEmptyDL" Offset="0x3B00" />
<DList Name="gStoneTowerVerticallyOscillatingPlatformDL" Offset="0x3B08" /> <!-- Unused -->
<Collision Name="gStoneTowerVerticallyOscillatingPlatformCol" Offset="0x3E80" /> <!-- Unused -->
<DList Name="gStoneTowerTempleSquareElevatorEmptyDL" Offset="0x4030" />
<DList Name="gStoneTowerTempleSquareElevatorDL" Offset="0x4038" /> <!-- Unused -->
<Collision Name="gStoneTowerTempleSquareElevatorCol" Offset="0x4240" /> <!-- Unused -->
<DList Name="gStoneTowerBlockDL" Offset="0x43D0" />
<Collision Name="gStoneTowerBlockCol" Offset="0x4640" />
</File>
</Root>

4
spec
View File

@ -1637,9 +1637,7 @@ beginseg
name "ovl_Bg_F40_Swlift"
compress
include "build/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.o"
include "build/data/ovl_Bg_F40_Swlift/ovl_Bg_F40_Swlift.data.o"
include "build/data/ovl_Bg_F40_Swlift/ovl_Bg_F40_Swlift.bss.o"
include "build/data/ovl_Bg_F40_Swlift/ovl_Bg_F40_Swlift.reloc.o"
include "build/src/overlays/actors/ovl_Bg_F40_Swlift/ovl_Bg_F40_Swlift_reloc.o"
endseg
beginseg

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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