1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 12:54:51 +00:00

Small Actor_UpdateAll doc (#1432)

* Small `Actor_UpdateAll` doc

* improve, "freeze"

* rename "freeze category masks"

* shorten to "category freeze mask" everywhere
This commit is contained in:
Dragorn421 2022-11-21 01:58:20 +01:00 committed by GitHub
parent 39e4e63b4d
commit 9cdd1678e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1991,18 +1991,30 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play
func_8002FA60(play); func_8002FA60(play);
} }
u32 D_80116068[ACTORCAT_MAX] = { u32 sCategoryFreezeMasks[ACTORCAT_MAX] = {
// ACTORCAT_SWITCH
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_BG
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_PLAYER
0, 0,
// ACTORCAT_EXPLOSIVE
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
// ACTORCAT_NPC
PLAYER_STATE1_7, PLAYER_STATE1_7,
// ACTORCAT_ENEMY
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
// ACTORCAT_PROP
PLAYER_STATE1_7 | PLAYER_STATE1_28, PLAYER_STATE1_7 | PLAYER_STATE1_28,
// ACTORCAT_ITEMACTION
0, 0,
// ACTORCAT_MISC
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29,
// ACTORCAT_BOSS
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_10 | PLAYER_STATE1_28,
// ACTORCAT_DOOR
0, 0,
// ACTORCAT_CHEST
PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28, PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28,
}; };
@ -2010,9 +2022,9 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
Actor* refActor; Actor* refActor;
Actor* actor; Actor* actor;
Player* player; Player* player;
u32* sp80; u32* categoryFreezeMaskP;
u32 unkFlag; u32 requiredActorFlag;
u32 unkCondition; u32 canFreezeCategory;
Actor* sp74; Actor* sp74;
ActorEntry* actorEntry; ActorEntry* actorEntry;
s32 i; s32 i;
@ -2025,7 +2037,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
} }
sp74 = NULL; sp74 = NULL;
unkFlag = 0; requiredActorFlag = 0;
if (play->numActorEntries != 0) { if (play->numActorEntries != 0) {
actorEntry = &play->actorEntryList[0]; actorEntry = &play->actorEntryList[0];
@ -2046,18 +2058,18 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
refActor->world.pos.z, 0, 0, 0, 1); refActor->world.pos.z, 0, 0, 0, 1);
} }
sp80 = &D_80116068[0]; categoryFreezeMaskP = &sCategoryFreezeMasks[0];
if (player->stateFlags2 & PLAYER_STATE2_27) { if (player->stateFlags2 & PLAYER_STATE2_27) {
unkFlag = ACTOR_FLAG_25; requiredActorFlag = ACTOR_FLAG_25;
} }
if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) { if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) {
sp74 = player->targetActor; sp74 = player->targetActor;
} }
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, sp80++) { for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, categoryFreezeMaskP++) {
unkCondition = (*sp80 & player->stateFlags1); canFreezeCategory = (*categoryFreezeMaskP & player->stateFlags1);
actor = actorCtx->actorLists[i].head; actor = actorCtx->actorLists[i].head;
while (actor != NULL) { while (actor != NULL) {
@ -2077,9 +2089,10 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { } else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
Actor_Kill(actor); Actor_Kill(actor);
actor = actor->next; actor = actor->next;
} else if ((unkFlag && !(actor->flags & unkFlag)) || } else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) ||
(!unkFlag && unkCondition && (sp74 != actor) && (actor != player->naviActor) && (!requiredActorFlag && canFreezeCategory &&
(actor != player->heldActor) && (&player->actor != actor->parent))) { !((sp74 == actor) || (actor == player->naviActor) || (actor == player->heldActor) ||
(&player->actor == actor->parent)))) {
CollisionCheck_ResetDamage(&actor->colChkInfo); CollisionCheck_ResetDamage(&actor->colChkInfo);
actor = actor->next; actor = actor->next;
} else if (actor->update == NULL) { } else if (actor->update == NULL) {