Skip to content

Commit

Permalink
Rename code_80043480.c from decomp (HarbourMasters#4731)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLongstaff authored Dec 20, 2024
1 parent 35e0a7c commit dd11751
Show file tree
Hide file tree
Showing 35 changed files with 126 additions and 115 deletions.
18 changes: 9 additions & 9 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,15 +717,15 @@ void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*);
void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId);
s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor);
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags);
void func_800434A0(DynaPolyActor* dynaActor);
void func_800434A8(DynaPolyActor* dynaActor);
void func_800434C8(CollisionContext* colCtx, s32 floorBgId);
void func_80043508(CollisionContext* colCtx, s32 floorBgId);
void func_80043538(DynaPolyActor* dynaActor);
s32 func_80043548(DynaPolyActor* dynaActor);
s32 func_8004356C(DynaPolyActor* dynaActor);
s32 func_80043590(DynaPolyActor* dynaActor);
s32 func_800435B4(DynaPolyActor* dynaActor);
void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor);
void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor);
void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId);
void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId);
void DynaPolyActor_SetSwitchPressed(DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsPlayerOnTop(DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor);
s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4);
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play);
void Camera_InitPlayerSettings(Camera* camera, Player* player);
Expand Down
11 changes: 9 additions & 2 deletions soh/include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,22 @@ if neither of the above are set : blue
0x2000 : translucent, else opaque
*/

#define DYNA_INTERACT_ACTOR_ON_TOP (1 << 0) // There is an actor standing on the collision of the dynapoly actor
#define DYNA_INTERACT_PLAYER_ON_TOP (1 << 1) // The player actor is standing on the collision of the dynapoly actor
#define DYNA_INTERACT_PLAYER_ABOVE \
(1 << 2) // The player is directly above the collision of the dynapoly actor (any distance above)
#define DYNA_INTERACT_ACTOR_SWITCH_PRESSED \
(1 << 3) // An actor that is capable of pressing switches is on top of the dynapoly actor

typedef struct DynaPolyActor {
/* 0x000 */ struct Actor actor;
/* 0x14C */ s32 bgId;
/* 0x150 */ f32 unk_150;
/* 0x154 */ f32 unk_154;
/* 0x158 */ s16 unk_158; // y rotation?
/* 0x15A */ u16 unk_15A;
/* 0x15C */ u32 unk_15C;
/* 0x160 */ u8 unk_160;
/* 0x15C */ u32 transformFlags;
/* 0x160 */ u8 interactFlags;
/* 0x162 */ s16 unk_162;
} DynaPolyActor; // size = 0x164

Expand Down
8 changes: 4 additions & 4 deletions soh/src/code/code_800430A0.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) {
if (DynaPoly_IsBgIdBgActor(bgId)) {
DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, bgId);
if (dynaActor != NULL) {
func_800434A8(dynaActor);
DynaPolyActor_SetActorOnTop(dynaActor);

if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_CAN_PRESS_SWITCH)) {
func_80043538(dynaActor);
DynaPolyActor_SetSwitchPressed(dynaActor);
}
}
}
Expand Down Expand Up @@ -91,12 +91,12 @@ s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor) {
return false;
}

if (dynaActor->unk_15C & 1) {
if (dynaActor->transformFlags & 1) {
func_800430A0(colCtx, bgId, actor);
result = true;
}

if (dynaActor->unk_15C & 2) {
if (dynaActor->transformFlags & 2) {
func_800432A0(colCtx, bgId, actor);
result = true;
}
Expand Down
48 changes: 24 additions & 24 deletions soh/src/code/code_80043480.c → soh/src/code/z_bg_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,74 @@

void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) {
dynaActor->bgId = -1;
dynaActor->unk_15C = flags;
dynaActor->unk_160 = 0;
dynaActor->transformFlags = flags;
dynaActor->interactFlags = 0;
dynaActor->unk_150 = 0.0f;
dynaActor->unk_154 = 0.0f;
}

void func_800434A0(DynaPolyActor* dynaActor) {
dynaActor->unk_160 = 0;
void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor) {
dynaActor->interactFlags = 0;
}

void func_800434A8(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 1;
void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_ON_TOP;
}

void func_800434B8(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 2;
void DynaPolyActor_SetPlayerOnTop(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ON_TOP;
}

void func_800434C8(CollisionContext* colCtx, s32 floorBgId) {
void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId) {
DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, floorBgId);

if (dynaActor != NULL) {
func_800434B8(dynaActor);
DynaPolyActor_SetPlayerOnTop(dynaActor);
}
}

void func_800434F8(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 4;
void DynaPolyActor_SetPlayerAbove(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ABOVE;
}

void func_80043508(CollisionContext* colCtx, s32 floorBgId) {
void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId) {
DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, floorBgId);

if (dynaActor != NULL) {
func_800434F8(dynaActor);
DynaPolyActor_SetPlayerAbove(dynaActor);
}
}

void func_80043538(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 8;
void DynaPolyActor_SetSwitchPressed(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_SWITCH_PRESSED;
}

s32 func_80043548(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 1) {
s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_ON_TOP) {
return true;
} else {
return false;
}
}

s32 func_8004356C(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 2) {
s32 DynaPolyActor_IsPlayerOnTop(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) {
return true;
} else {
return false;
}
}

s32 func_80043590(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 4) {
s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ABOVE) {
return true;
} else {
return false;
}
}

s32 func_800435B4(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 8) {
s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_SWITCH_PRESSED) {
return true;
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion soh/src/code/z_bgcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,7 @@ void func_8003F8EC(PlayState* play, DynaCollisionContext* dyna, Actor* actor) {
if ((dyna->bgActorFlags[i] & 1)) {
dynaActor = DynaPoly_GetActor(&play->colCtx, i);
if (dynaActor != NULL && &dynaActor->actor == actor) {
func_800434A0((DynaPolyActor*)actor);
DynaPolyActor_UnsetAllInteractFlags((DynaPolyActor*)actor);
return;
}
}
Expand Down
6 changes: 3 additions & 3 deletions soh/src/code/z_en_a_keep.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {

thisx->focus.pos = thisx->world.pos;
this->dyna.bgId = BGACTOR_NEG_ONE;
this->dyna.unk_160 = 0;
this->dyna.unk_15C = DPM_UNK;
this->dyna.interactFlags = 0;
this->dyna.transformFlags = DPM_UNK;
thisx->uncullZoneDownward = 1200.0f;
thisx->uncullZoneScale = 200.0f;

Expand Down Expand Up @@ -234,7 +234,7 @@ void EnAObj_SetupBlockRot(EnAObj* this, s16 type) {

void EnAObj_BlockRot(EnAObj* this, PlayState* play) {
if (this->rotateState == 0) {
if (this->dyna.unk_160 != 0) {
if (this->dyna.interactFlags != 0) {
this->rotateState++;
this->rotateForTimer = 20;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void func_8086C6EC(BgBdanObjects* this, PlayState* play) {
}

void func_8086C76C(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (this->dyna.actor.xzDistToPlayer < 120.0f) {
this->actionFunc = func_8086C7D0;
OnePointCutscene_Init(play, 3090, -99, &this->dyna.actor, MAIN_CAM);
Expand All @@ -352,15 +352,15 @@ void func_8086C874(BgBdanObjects* this, PlayState* play) {
this->timer--;
}
if (this->switchFlag == 0) {
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
this->cameraSetting = play->cameraPtrs[MAIN_CAM]->setting;
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
func_8005AD1C(play->cameraPtrs[MAIN_CAM], 4);
this->switchFlag = 10;
}
} else {
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2);
if (!func_8004356C(&this->dyna)) {
if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (this->switchFlag != 0) {
this->switchFlag--;
}
Expand Down Expand Up @@ -411,7 +411,7 @@ void func_8086CABC(BgBdanObjects* this, PlayState* play) {
}

void func_8086CB10(BgBdanObjects* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
Flags_SetSwitch(play, this->switchFlag);
this->timer = 50;
this->actionFunc = func_8086CB8C;
Expand Down
10 changes: 5 additions & 5 deletions soh/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ void func_8086D5C4(BgBdanSwitch* this) {
void func_8086D5E0(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
case BLUE:
if (func_800435B4(&this->dyna)) {
if (DynaPolyActor_IsSwitchPressed(&this->dyna)) {
func_8086D67C(this);
func_8086D4B4(this, play);
}
break;
case YELLOW:
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
func_8086D67C(this);
func_8086D4B4(this, play);
}
Expand Down Expand Up @@ -293,7 +293,7 @@ void func_8086D730(BgBdanSwitch* this) {
void func_8086D754(BgBdanSwitch* this, PlayState* play) {
switch (this->dyna.actor.params & 0xFF) {
case BLUE:
if (!func_800435B4(&this->dyna)) {
if (!DynaPolyActor_IsSwitchPressed(&this->dyna)) {
if (this->unk_1D8 <= 0) {
func_8086D7FC(this);
func_8086D548(this, play);
Expand Down Expand Up @@ -328,7 +328,7 @@ void func_8086D86C(BgBdanSwitch* this) {
}

void func_8086D888(BgBdanSwitch* this, PlayState* play) {
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
func_8086D8BC(this);
}
}
Expand Down Expand Up @@ -371,7 +371,7 @@ void func_8086D9F8(BgBdanSwitch* this) {
void func_8086DA1C(BgBdanSwitch* this, PlayState* play) {
Actor* heldActor = GET_PLAYER(play)->heldActor;

if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) {
if (this->unk_1D8 <= 0) {
func_8086D944(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) {
void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) {
f32 sunkHeight = this->initPos.y - 150.0f;

if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
this->timer = 10;
}

Expand All @@ -85,7 +85,7 @@ void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play) {
s32 pad;
f32 randSign;

if (func_8004356C(&this->dyna)) { // Player standing on it
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { // Player standing on it
if (this->timer > 0) {
this->timer--;

Expand Down Expand Up @@ -114,7 +114,7 @@ void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Actor* thisx = &this->dyna.actor;

if ((player->currentBoots != PLAYER_BOOTS_HOVER) && func_8004356C(&this->dyna)) { // Player standing on it
if ((player->currentBoots != PLAYER_BOOTS_HOVER) && DynaPolyActor_IsPlayerOnTop(&this->dyna)) { // Player standing on it
if (thisx->world.pos.y < this->initPos.y) {
this->actionFunc = BgGndFiremeiro_Sink;
this->timer = 20;
Expand Down
2 changes: 1 addition & 1 deletion soh/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void BgHakaShip_CrashFall(BgHakaShip* this, PlayState* play) {
}
} else {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCKSINK - SFX_FLAG);
if ((this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 500.0f) && func_8004356C(&this->dyna)) {
if ((this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y > 500.0f) && DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
Play_TriggerVoidOut(play);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void func_80886FCC(BgHidanFslift* this, PlayState* play) {
if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) < 0.5f) {
heightBool = true;
}
if (func_80043590(&this->dyna) && (heightBool)) {
if (DynaPolyActor_IsPlayerAbove(&this->dyna) && (heightBool)) {
this->actionFunc = func_808870D8;
} else if (!heightBool) {
this->actionFunc = func_8088706C;
Expand All @@ -109,7 +109,7 @@ void func_8088706C(BgHidanFslift* this, PlayState* play) {
}

void func_808870D8(BgHidanFslift* this, PlayState* play) {
if (func_80043590(&this->dyna)) {
if (DynaPolyActor_IsPlayerAbove(&this->dyna)) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
func_80886FB4(this);
Expand All @@ -126,12 +126,12 @@ void BgHidanFslift_Update(Actor* thisx, PlayState* play) {
BgHidanFslift* this = (BgHidanFslift*)thisx;

this->actionFunc(this, play);
if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (this->unk_16A == 0) {
this->unk_16A = 3;
}
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM);
} else if (!func_8004356C(&this->dyna)) {
} else if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
if (this->unk_16A != 0) {
Camera_ChangeSetting(play->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void func_808896B8(BgHidanHrock* this, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}

if (func_8004356C(&this->dyna)) {
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 5.0f, 1.0f);
} else {
Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f);
Expand Down
Loading

0 comments on commit dd11751

Please sign in to comment.