check for freestanding item directly below player while swimming

don't detect sun actor
This commit is contained in:
Demur Rumed 2025-04-18 02:53:48 +00:00
parent 167a3b5576
commit a96adc4a9a

View file

@ -200,16 +200,28 @@ void RegisterOnInterfaceUpdateHook() {
Actor* readOut = NULL; Actor* readOut = NULL;
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
if (player != NULL) { if (player != NULL) {
for (int i = 0; i < ACTORCAT_MAX; i++) { if (player->focusActor != NULL) {
if (i == ACTORCAT_PLAYER) readOut = player->focusActor;
continue; } else {
for (Actor* actor = gPlayState->actorCtx.actorLists[i].head; actor != NULL; actor = actor->next) { for (int i = 0; i < ACTORCAT_MAX; i++) {
if (actor->id == ACTOR_EN_ELF && actor->params == FAIRY_NAVI) if (i == ACTORCAT_PLAYER)
continue; continue;
u16 reverseYaw = (actor->yawTowardsPlayer + 0x8000) - player->actor.world.rot.y; for (Actor* actor = gPlayState->actorCtx.actorLists[i].head; actor != NULL;
if ((reverseYaw < 0x2000 || reverseYaw > 0xE000) && actor->xyzDistToPlayerSq < minDist) { actor = actor->next) {
readOut = actor; if ((actor->id == ACTOR_EN_ELF && actor->params == FAIRY_NAVI) ||
minDist = actor->xyzDistToPlayerSq; actor->id == ACTOR_SHOT_SUN)
continue;
if (actor->id == ACTOR_EN_ITEM00 && (player->stateFlags1 & PLAYER_STATE1_IN_WATER) &&
player->currentBoots != PLAYER_BOOTS_IRON && actor->xzDistToPlayer < 40 &&
actor->world.pos.z < player->actor.world.pos.z) {
SpeechSynthesizer::Instance->Speak("item below", "en-US");
goto spoke;
}
u16 reverseYaw = (actor->yawTowardsPlayer + 0x8000) - player->actor.world.rot.y;
if ((reverseYaw < 0x2000 || reverseYaw > 0xE000) && actor->xyzDistToPlayerSq < minDist) {
readOut = actor;
minDist = actor->xyzDistToPlayerSq;
}
} }
} }
} }
@ -225,6 +237,7 @@ void RegisterOnInterfaceUpdateHook() {
} }
} }
} }
spoke:
static int16_t lostHealth = 0; static int16_t lostHealth = 0;
static int16_t prevHealth = 0; static int16_t prevHealth = 0;