1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 15:01:17 +00:00

Use defines for actor flags (#873)

* Add ACTOR_FLAG_ defines

* Add ACTOR_FLAGS_ALL macro and use ACTOR_FLAG_* constants everywhere

* Remove unused ACTOR_FLAG_* constants

* actor flags in bigokuta & ko

* actor flags in obj_mure

* actor flags in stalfos, twinrova & ganon2

* actor flags in morpha & barinade

* name some previously missed actor flags

* found some comments using hex for actor flags

* Actor flags in ovl_En_Ganon_Mant

* Actor flags in EnWf

* Flags in en_zf

* Actor flags in BossGanon (FeelsOKMan)

* Remove `ACTOR_FLAG_NONE`

* Wrap expansion of `FLAGS` in parentheses

* `ACTOR_FLAGS_ALL` -> `CHECK_FLAG_ALL`

* Move `CHECK_FLAG_ALL` to `macros.h`

* Run formatter
This commit is contained in:
Dragorn421 2021-12-06 01:11:38 +01:00 committed by GitHub
parent 79220ba58a
commit a9284494f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
439 changed files with 1342 additions and 1304 deletions

View file

@ -1,7 +1,7 @@
#include "z_en_box.h"
#include "objects/object_box/object_box.h"
#define FLAGS 0x00000000
#define FLAGS 0
// movement flags
@ -133,7 +133,7 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) {
EnBox_SetupAction(this, EnBox_FallOnSwitchFlag);
this->alpha = 0;
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
this->dyna.actor.flags |= 0x10;
this->dyna.actor.flags |= ACTOR_FLAG_4;
} else if ((this->type == ENBOX_TYPE_ROOM_CLEAR_BIG || this->type == ENBOX_TYPE_ROOM_CLEAR_SMALL) &&
!Flags_GetClear(globalCtx, this->dyna.actor.room)) {
EnBox_SetupAction(this, EnBox_AppearOnRoomClear);
@ -141,25 +141,25 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f;
this->alpha = 0;
this->dyna.actor.flags |= 0x10;
this->dyna.actor.flags |= ACTOR_FLAG_4;
} else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) {
EnBox_SetupAction(this, func_809C9700);
this->dyna.actor.flags |= 0x2000000;
this->dyna.actor.flags |= ACTOR_FLAG_25;
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f;
this->alpha = 0;
this->dyna.actor.flags |= 0x10;
this->dyna.actor.flags |= ACTOR_FLAG_4;
} else if (this->type == ENBOX_TYPE_SWITCH_FLAG_BIG && !Flags_GetSwitch(globalCtx, this->switchFlag)) {
EnBox_SetupAction(this, EnBox_AppearOnSwitchFlag);
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f;
this->alpha = 0;
this->dyna.actor.flags |= 0x10;
this->dyna.actor.flags |= ACTOR_FLAG_4;
} else {
if (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6) {
this->dyna.actor.flags |= 0x80;
this->dyna.actor.flags |= ACTOR_FLAG_7;
}
EnBox_SetupAction(this, EnBox_WaitOpen);
this->movementFlags |= ENBOX_MOVE_IMMOBILE;
@ -306,7 +306,7 @@ void func_809C9700(EnBox* this, GlobalContext* globalCtx) {
} else if (this->unk_1FB == ENBOX_STATE_2 && globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) {
if ((globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) ||
(globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) {
this->dyna.actor.flags &= ~0x2000000;
this->dyna.actor.flags &= ~ACTOR_FLAG_25;
EnBox_SetupAction(this, EnBox_AppearInit);
OnePointCutscene_Attention(globalCtx, &this->dyna.actor);
this->unk_1A8 = 0;
@ -437,7 +437,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) {
void EnBox_Open(EnBox* this, GlobalContext* globalCtx) {
u16 sfxId;
this->dyna.actor.flags &= ~0x80;
this->dyna.actor.flags &= ~ACTOR_FLAG_7;
if (SkelAnime_Update(&this->skelanime)) {
if (this->unk_1F4 > 0) {
@ -618,11 +618,12 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_box.c", 1581);
/*
this->dyna.actor.flags & 0x80 is set by Init (if type is 4 or 6)
this->dyna.actor.flags & ACTOR_FLAG_7 is set by Init (if type is 4 or 6)
and cleared by Open
*/
if ((this->alpha == 255 && !(this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6)) ||
((this->dyna.actor.flags & 0x80) != 0x80 && (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) {
(!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_7) &&
(this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_EmptyDList(globalCtx->state.gfxCtx));