mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 06:40:15 +00:00
ovl_Bg_Ice_Shutter (#377)
* Starting work on Bg_Ice_Shutter, want to commit before attempting to use the permuter. * Forgot to use the new UNK_TPYE in DynaPolyInfo_Alloc * Resolving last asm issues by re-ordering and updating .c file. * Attempting to match by reordering things, removing no longer used .s files from spec file. * Adding in proper include path for _reloc file * Removing unneeded parens and casts * Removing extra space. * Updated with review fixes * Another round of review comments. * Adding description to comment to clarify what these are. * Adding in newline before draw function
This commit is contained in:
parent
14191307e9
commit
44dac7af67
13 changed files with 110 additions and 336 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* File: z_bg_ice_shutter.c
|
||||
* Overlay: ovl_Bg_Ice_Shutter
|
||||
* Description: 2D Ice Bars
|
||||
* Description: Vertical Ice Bars (Doors) in Ice Cavern
|
||||
*/
|
||||
|
||||
#include "z_bg_ice_shutter.h"
|
||||
|
@ -15,7 +15,10 @@ void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_80891CF4(BgIceShutter* thisx, GlobalContext* globalCtx);
|
||||
void func_80891D6C(BgIceShutter* thisx, GlobalContext* globalCtx);
|
||||
void func_80891DD4(BgIceShutter* thisx, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Bg_Ice_Shutter_InitVars = {
|
||||
ACTOR_BG_ICE_SHUTTER,
|
||||
ACTORTYPE_PROP,
|
||||
|
@ -27,19 +30,110 @@ const ActorInit Bg_Ice_Shutter_InitVars = {
|
|||
(ActorFunc)BgIceShutter_Update,
|
||||
(ActorFunc)BgIceShutter_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/func_80891AC0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Init.s")
|
||||
extern UNK_TYPE D_06002854;
|
||||
extern Gfx D_06002740[];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Destroy.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/func_80891CF4.s")
|
||||
void func_80891AC0(BgIceShutter* this) {
|
||||
f32 sp24;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/func_80891D6C.s")
|
||||
sp24 = Math_Sins(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y;
|
||||
this->dyna.actor.posRot.pos.y =
|
||||
(Math_Coss(this->dyna.actor.shape.rot.x) * this->dyna.actor.velocity.y) + this->dyna.actor.initPosRot.pos.y;
|
||||
this->dyna.actor.posRot.pos.x =
|
||||
(Math_Sins(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z =
|
||||
(Math_Coss(this->dyna.actor.shape.rot.y) * sp24) + this->dyna.actor.initPosRot.pos.z;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/func_80891DD4.s")
|
||||
void BgIceShutter_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceShutter* this = THIS;
|
||||
f32 sp24;
|
||||
s32 localC;
|
||||
s32 sp28;
|
||||
f32 temp_f6;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Update.s")
|
||||
localC = 0;
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 0);
|
||||
sp28 = this->dyna.actor.params & 0xFF;
|
||||
this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF;
|
||||
DynaPolyInfo_Alloc(&D_06002854, &localC);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
|
||||
if (sp28 == 2) {
|
||||
this->dyna.actor.shape.rot.x = -0x4000;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Draw.s")
|
||||
if (sp28 != 1) {
|
||||
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
this->actionFunc = func_80891CF4;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
} else {
|
||||
this->actionFunc = func_80891D6C;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp28 == 2) {
|
||||
temp_f6 = Math_Sins(this->dyna.actor.shape.rot.x) * 50.0f;
|
||||
this->dyna.actor.posRot2.pos.x =
|
||||
(Math_Sins(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot2.pos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
this->dyna.actor.posRot2.pos.z =
|
||||
this->dyna.actor.initPosRot.pos.z + (Math_Coss(this->dyna.actor.shape.rot.y) * temp_f6);
|
||||
} else {
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceShutter_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceShutter* this = THIS;
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
|
||||
void func_80891CF4(BgIceShutter* this, GlobalContext* globalCtx) {
|
||||
if (Flags_GetTempClear(globalCtx, this->dyna.actor.room)) {
|
||||
Flags_SetClear(globalCtx, this->dyna.actor.room);
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN);
|
||||
this->actionFunc = func_80891DD4;
|
||||
if (this->dyna.actor.shape.rot.x == 0) {
|
||||
func_80080480(globalCtx, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80891D6C(BgIceShutter* this, GlobalContext* globalCtx) {
|
||||
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params)) {
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 30, NA_SE_EV_SLIDE_DOOR_OPEN);
|
||||
this->actionFunc = func_80891DD4;
|
||||
func_80080480(globalCtx, this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) {
|
||||
Math_ApproxF(&this->dyna.actor.speedXZ, 30.0f, 2.0f);
|
||||
if (Math_ApproxF(&this->dyna.actor.velocity.y, 210.0f, this->dyna.actor.speedXZ)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
|
||||
func_80891AC0(this);
|
||||
}
|
||||
|
||||
void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceShutter* this = THIS;
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgIceShutter_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_06002740);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue