1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 13:30:47 +00:00

Document ACTOR_FLAG_CAN_PRESS_SWITCHES (#2275)

* document switch activation

* format

* activate -> press

* fix comment
This commit is contained in:
fig02 2024-10-20 23:19:14 -04:00 committed by GitHub
parent f4210323a2
commit 3677c11140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 23 additions and 22 deletions

View file

@ -196,8 +196,9 @@ typedef struct ActorShape {
// This flag allows a given actor to be an exception.
#define ACTOR_FLAG_UPDATE_DURING_OCARINA (1 << 25)
//
#define ACTOR_FLAG_26 (1 << 26)
// Actor can press and hold down switches.
// See usages of `DynaPolyActor_SetSwitchPressed` and `DynaPolyActor_IsSwitchPressed` for more context on how switches work.
#define ACTOR_FLAG_CAN_PRESS_SWITCHES (1 << 26)
// Player is not able to lock onto the actor.
// Navi will still be able to hover over the actor, assuming `ACTOR_FLAG_ATTENTION_ENABLED` is set.
@ -311,7 +312,7 @@ if neither of the above are set : blue
#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_3 (1 << 3) // Like the ACTOR_ON_TOP flag but only actors with ACTOR_FLAG_26
#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;

View file

@ -481,11 +481,11 @@ void DynaPolyActor_UnsetAllInteractFlags(struct DynaPolyActor* dynaActor);
void DynaPolyActor_SetActorOnTop(struct DynaPolyActor* dynaActor);
void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId);
void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId);
void func_80043538(struct DynaPolyActor* dynaActor);
void DynaPolyActor_SetSwitchPressed(struct DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsActorOnTop(struct DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsPlayerOnTop(struct DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsPlayerAbove(struct DynaPolyActor* dynaActor);
s32 func_800435B4(struct DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsSwitchPressed(struct DynaPolyActor* dynaActor);
s32 func_800435D8(struct PlayState* play, struct DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4);
#endif

View file

@ -76,8 +76,8 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) {
if (dynaActor != NULL) {
DynaPolyActor_SetActorOnTop(dynaActor);
if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_26)) {
func_80043538(dynaActor);
if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_CAN_PRESS_SWITCHES)) {
DynaPolyActor_SetSwitchPressed(dynaActor);
}
}
}

View file

@ -44,8 +44,8 @@ void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId) {
}
}
void func_80043538(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_3;
void DynaPolyActor_SetSwitchPressed(DynaPolyActor* dynaActor) {
dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_SWITCH_PRESSED;
}
s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor) {
@ -72,8 +72,8 @@ s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor) {
}
}
s32 func_800435B4(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_3) {
s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor) {
if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_SWITCH_PRESSED) {
return true;
} else {
return false;

View file

@ -2,7 +2,7 @@
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \
ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_26)
ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_CAN_PRESS_SWITCHES)
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:128 pal-1.1:128"

View file

@ -251,7 +251,7 @@ void func_8086D5C4(BgBdanSwitch* this) {
void func_8086D5E0(BgBdanSwitch* this, PlayState* play) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
if (func_800435B4(&this->dyna)) {
if (DynaPolyActor_IsSwitchPressed(&this->dyna)) {
func_8086D67C(this);
func_8086D4B4(this, play);
}
@ -290,7 +290,7 @@ void func_8086D730(BgBdanSwitch* this) {
void func_8086D754(BgBdanSwitch* this, PlayState* play) {
switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) {
case BLUE:
if (!func_800435B4(&this->dyna)) {
if (!DynaPolyActor_IsSwitchPressed(&this->dyna)) {
if (this->unk_1D8 <= 0) {
func_8086D7FC(this);
func_8086D548(this, play);

View file

@ -8,7 +8,7 @@
#include "assets/objects/object_am/object_am.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_26)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES)
void EnAm_Init(Actor* thisx, PlayState* play);
void EnAm_Destroy(Actor* thisx, PlayState* play);

View file

@ -10,7 +10,7 @@
#include "versions.h"
#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_26)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES)
void EnRu1_Init(Actor* thisx, PlayState* play);
void EnRu1_Destroy(Actor* thisx, PlayState* play);

View file

@ -8,7 +8,7 @@
#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_26)
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_CAN_PRESS_SWITCHES)
void ObjKibako_Init(Actor* thisx, PlayState* play);
void ObjKibako_Destroy(Actor* thisx, PlayState* play2);

View file

@ -491,7 +491,7 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) {
dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId);
if (dynaPolyActor != NULL) {
DynaPolyActor_SetActorOnTop(dynaPolyActor);
func_80043538(dynaPolyActor);
DynaPolyActor_SetSwitchPressed(dynaPolyActor);
if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) {
if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, play) &&
@ -520,7 +520,7 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) {
if ((dynaPolyActor != NULL) && (dynaPolyActor->transformFlags & DYNA_TRANSFORM_POS)) {
DynaPolyActor_SetActorOnTop(dynaPolyActor);
func_80043538(dynaPolyActor);
DynaPolyActor_SetSwitchPressed(dynaPolyActor);
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
} else {
ObjOshihiki_SetupFall(this, play);

View file

@ -410,14 +410,14 @@ void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) {
break;
case OBJSWITCH_SUBTYPE_HOLD:
if (func_800435B4(&this->dyna)) {
if (DynaPolyActor_IsSwitchPressed(&this->dyna)) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOn(this, play);
}
break;
case OBJSWITCH_SUBTYPE_HOLD_INVERTED:
if (func_800435B4(&this->dyna)) {
if (DynaPolyActor_IsSwitchPressed(&this->dyna)) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOff(this, play);
}
@ -467,7 +467,7 @@ void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play) {
case OBJSWITCH_SUBTYPE_HOLD:
case OBJSWITCH_SUBTYPE_HOLD_INVERTED:
if (!func_800435B4(&this->dyna) && !Player_InCsMode(play)) {
if (!DynaPolyActor_IsSwitchPressed(&this->dyna) && !Player_InCsMode(play)) {
if (this->releaseTimer <= 0) {
ObjSwitch_FloorReleaseInit(this);
if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_HOLD) {