z_horse.c OK (#1245)

* func_800F3940

* func_800F3B2C, func_800F415C and func_800F41E4

* func_800F40A0

* func_800F3ED4

* func_800F3C44

* func_800F3B68 NON_MATCHING

* func_800F3A64 kinda

* func_800F39B4

* cleanups

* import data

* fix fake match

* format

* Scene enum

* minor cleanup on data usage

* Horse_RotateToPoint and ENHORSE_PARAMS

* scene setup index

Co-authored-by: Tom Overton <tom-overton@users.noreply.github.com>

* fix merge

* z64horse.h

* Renames

* and even more renames

* format

* fix

* review

* Horse_IsActive

* review

* bss

* fix

* remove comments

* Update src/code/z_horse.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* review

* Update src/code/z_horse.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* review

---------

Co-authored-by: Tom Overton <tom-overton@users.noreply.github.com>
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-06-01 15:11:11 -04:00
committed by GitHub
parent 64959177d9
commit eb24680be3
22 changed files with 341 additions and 129 deletions
+4 -3
View File
@@ -4,6 +4,7 @@
*/
#include "global.h"
#include "z64horse.h"
#include "z64load.h"
#include "z64quake.h"
#include "z64rumble.h"
@@ -1357,8 +1358,8 @@ s32 func_800B7200(Player* player) {
return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_20000000)) || (player->csMode != PLAYER_CSMODE_0);
}
void func_800B722C(GameState* gameState, Player* player) {
func_800F40A0(gameState, player);
void Actor_SpawnHorse(PlayState* play, Player* player) {
Horse_Spawn(play, player);
}
s32 func_800B724C(PlayState* play, Actor* actor, u8 csMode) {
@@ -2304,7 +2305,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto
Actor_TargetContextInit(&actorCtx->targetContext, actorCtx->actorLists[ACTORCAT_PLAYER].first, play);
Actor_InitHalfDaysBit(actorCtx);
Fault_AddClient(&sActorFaultClient, (void*)Actor_PrintLists, actorCtx, NULL);
func_800B722C(&play->state, (Player*)actorCtx->actorLists[ACTORCAT_PLAYER].first);
Actor_SpawnHorse(play, (Player*)actorCtx->actorLists[ACTORCAT_PLAYER].first);
}
/**
+222 -10
View File
@@ -1,21 +1,233 @@
#include "global.h"
#include "z64horse.h"
#include "overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3940.s")
s32 Horse_GetJumpingFencePathIndex(PlayState* play) {
Actor* actor;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F39B4.s")
for (actor = NULL;; actor = actor->next) {
actor = SubS_FindActor(play, actor, ACTORCAT_PROP, ACTOR_BG_UMAJUMP);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3A64.s")
if (actor == NULL) {
break;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3B2C.s")
if (actor->params == BG_UMAJUMP_TYPE_2) {
return ((BgUmajump*)actor)->pathIndex;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3B68.s")
return -1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3C44.s")
// unused
s32 Horse_CopyPointFromPathList(PlayState* play, s32 pathIndex, s32 pointIndex, Vec3s* dst, s16* arg4) {
Path* path = &play->setupPathList[pathIndex];
Vec3s* points;
s32 count = path->count;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F3ED4.s")
dst->x = 0;
dst->y = 0;
dst->z = 0;
*arg4 = 0;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F40A0.s")
if (count == 0) {
return false;
}
if (pointIndex >= count) {
return false;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F415C.s")
points = Lib_SegmentedToVirtual(path->points);
points += pointIndex;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_800F41E4.s")
dst->x = points->x;
dst->y = points->y;
dst->z = points->z;
*arg4 = 0;
return true;
}
typedef struct HorseValidScene {
/* 0x0 */ s16 sceneId;
/* 0x2 */ s16 sceneLayerMinusOne;
} HorseValidScene; // size = 0x4
HorseValidScene sHorseValidScenes[] = {
{ SCENE_00KEIKOKU, 0 }, // Termina Field
{ SCENE_24KEMONOMITI, 0 }, // Road to southern swap
{ SCENE_F01, 0 }, // Romani ranch
{ SCENE_KOEPONARACE, 0 }, // Gorman track
{ SCENE_20SICHITAI, 0 }, // Southern swamp poisoned
{ SCENE_20SICHITAI2, 0 }, // Souther swamp clear
{ SCENE_30GYOSON, 0 }, // Great bay coast
{ SCENE_31MISAKI, 0 }, // Zora cape
{ SCENE_ROMANYMAE, 0 }, // Milk road
{ SCENE_IKANAMAE, 0 }, // Road to Ikana
{ SCENE_13HUBUKINOMITI, 0 }, // Path to Mountain Village
};
s32 Horse_IsValidSpawn(s16 sceneId) {
s32 i;
for (i = 0; i < ARRAY_COUNT(sHorseValidScenes); i++) {
if (sceneId == sHorseValidScenes[i].sceneId) {
return true;
}
}
return false;
}
void Horse_ResetHorseData(PlayState* play) {
gSaveContext.save.saveInfo.horseData.sceneId = SCENE_F01;
gSaveContext.save.saveInfo.horseData.pos.x = -1420;
gSaveContext.save.saveInfo.horseData.pos.y = 257;
gSaveContext.save.saveInfo.horseData.pos.z = -1285;
gSaveContext.save.saveInfo.horseData.yaw = 0x2AAA;
}
s32 gHorseIsMounted = false;
s32 D_801BDAA0 = false;
s32 gHorsePlayedEponasSong = false;
HorseValidScene sHorseValidSceneLayers[] = {
{ SCENE_00KEIKOKU, 5 - 1 }, // Termina Field - First Cycle
{ SCENE_30GYOSON, 1 - 1 }, // Great Bay Coast - Post-Gyorg
{ SCENE_31MISAKI, 1 - 1 }, // Zora Cape - Post-Gyorg
{ SCENE_13HUBUKINOMITI, 1 - 1 }, // Path to Mountain Village - Post-Goht
};
s32 Horse_IsValidSceneLayer(PlayState* play, Player* player) {
s32 i;
if (gSaveContext.sceneLayer == 0) {
return true;
}
for (i = 0; i < ARRAY_COUNT(sHorseValidSceneLayers); i++) {
if ((sHorseValidSceneLayers[i].sceneId == play->sceneId) &&
(gSaveContext.sceneLayer == sHorseValidSceneLayers[i].sceneLayerMinusOne + 1)) {
return true;
}
}
return false;
}
void Horse_SpawnOverworld(PlayState* play, Player* player) {
if (!Horse_IsValidSceneLayer(play, player)) {
return;
}
if (gHorseIsMounted && CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
s32 pad;
Vec3f pos = player->actor.world.pos;
f32 yIntersect;
CollisionPoly* poly;
s32 pad2[3];
pos.y += 5.0f;
yIntersect = BgCheck_EntityRaycastFloor1(&play->colCtx, &poly, &pos);
if (yIntersect == BGCHECK_Y_MIN) {
yIntersect = player->actor.world.pos.y;
}
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x, yIntersect,
player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y,
player->actor.shape.rot.z, ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_11));
Actor_MountHorse(play, player, player->rideActor);
Actor_SetCameraHorseSetting(play, player);
} else if ((play->sceneId == gSaveContext.save.saveInfo.horseData.sceneId) && CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
if (Horse_IsValidSpawn(gSaveContext.save.saveInfo.horseData.sceneId)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.save.saveInfo.horseData.pos.x,
gSaveContext.save.saveInfo.horseData.pos.y, gSaveContext.save.saveInfo.horseData.pos.z, 0,
gSaveContext.save.saveInfo.horseData.yaw, 0, ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_1));
} else {
Horse_ResetHorseData(play);
}
} else if ((play->sceneId == SCENE_F01) && !CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1420.0f, 257.0f, -1285.0f, 0, 0x2AAA, 0,
ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_1));
} else if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && Horse_IsValidSpawn(play->sceneId)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x, player->actor.world.pos.y,
player->actor.world.pos.z, 0, player->actor.shape.rot.y, 0,
ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_2));
}
}
void Horse_SpawnMinigame(PlayState* play, Player* player) {
if ((play->sceneId == SCENE_KOEPONARACE) &&
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_START)) {
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1262.0f, -106.0f, 470.0f, 0, 0x7FFF, 0,
ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_13));
Actor_MountHorse(play, player, player->rideActor);
Actor_SetCameraHorseSetting(play, player);
} else if ((play->sceneId == SCENE_KOEPONARACE) &&
((GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) ||
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2))) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1741.0f, -106.0f, -641.0f, 0, -0x4FA4, 0,
ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_1));
} else if ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0) &&
(player->transformation == PLAYER_FORM_HUMAN)) {
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1106.0f, 260.0f, -1185.0f, 0, 0x13, 0,
ENHORSE_PARAMS(ENHORSE_PARAM_4000, ENHORSE_7));
Actor_MountHorse(play, player, player->rideActor);
Actor_SetCameraHorseSetting(play, player);
}
}
void Horse_Spawn(PlayState* play, Player* player) {
if (((play->sceneId == SCENE_KOEPONARACE) &&
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_START)) ||
((play->sceneId == SCENE_F01) && (((gSaveContext.sceneLayer == 1)) || (gSaveContext.sceneLayer == 5)) &&
(player->transformation == PLAYER_FORM_HUMAN)) ||
((play->sceneId == SCENE_KOEPONARACE) &&
(((GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3)) ||
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2)))) {
// Gorman Track and horse state is either STATE_START, STATE_2 or STATE_3
// or Romani Ranch, Player is Human and scene layer is either 1 or 5
Horse_SpawnMinigame(play, player);
} else {
Horse_SpawnOverworld(play, player);
}
D_801BDAA0 = false;
}
void Horse_RotateToPoint(Actor* actor, Vec3f* pos, s16 turnYaw) {
s16 yaw = Math_Vec3f_Yaw(&actor->world.pos, pos) - actor->world.rot.y;
if (yaw > turnYaw) {
actor->world.rot.y += turnYaw;
} else if (yaw < -turnYaw) {
actor->world.rot.y -= turnYaw;
} else {
actor->world.rot.y += yaw;
}
actor->shape.rot.y = actor->world.rot.y;
}
s32 Horse_IsActive(PlayState* play, ActorContext* actorCtx) {
Actor* bgActor = actorCtx->actorLists[ACTORCAT_BG].first;
if (bgActor != NULL) {
while (true) {
if ((bgActor->update != NULL) && (bgActor->init == NULL)) {
if (Object_IsLoaded(&play->objectCtx, bgActor->objBankIndex)) {
if ((bgActor->id == ACTOR_EN_HORSE) && (((EnHorse*)bgActor)->action != ENHORSE_ACTION_INACTIVE)) {
return true;
}
}
}
bgActor = bgActor->next;
if (bgActor == NULL) {
break;
}
}
}
return false;
}
+4 -3
View File
@@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64horse.h"
#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
void func_80146EBC(SramContext* sramCtx, s32 curPage, s32 numPages);
@@ -454,7 +455,7 @@ void Sram_SaveEndOfCycle(PlayState* play) {
gSaveContext.jinxTimer = 0;
gSaveContext.rupeeAccumulator = 0;
func_800F3B2C(play);
Horse_ResetHorseData(play);
}
void Sram_IncrementDay(void) {
@@ -884,8 +885,8 @@ void Sram_ResetSaveFromMoonCrash(SramContext* sramCtx) {
gSaveContext.timerPausedOsTimes[i] = 0;
}
D_801BDAA0 = 1;
D_801BDA9C = 0;
D_801BDAA0 = true;
gHorseIsMounted = false;
gSaveContext.powderKegTimer = 0;
gSaveContext.unk_1014 = 0;
gSaveContext.jinxTimer = 0;
@@ -89,13 +89,12 @@ void BgUmajump_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
this->objectIndex = BG_UMAJUMP_GET_OBJECT_INDEX(thisx);
thisx->params = BG_UMAJUMP_GET_FF(thisx);
this->pathIndex = BG_UMAJUMP_GET_PATH_INDEX(thisx);
thisx->params = BG_UMAJUMP_GET_TYPE(thisx);
if ((thisx->params == BG_UMAJUMP_TYPE_2)) {
if ((((play->sceneId == SCENE_F01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_89_20)) &&
!CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) &&
(thisx->csId != CS_ID_NONE)) {
if (thisx->params == BG_UMAJUMP_TYPE_2) {
if ((play->sceneId == SCENE_F01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_89_20) &&
!CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && (thisx->csId != CS_ID_NONE)) {
this->actionFunc = BgUmajump_CheckDistance;
thisx->update = func_8091A5A0;
thisx->flags |= ACTOR_FLAG_10;
@@ -3,8 +3,8 @@
#include "global.h"
#define BG_UMAJUMP_GET_OBJECT_INDEX(thisx) (((thisx)->params >> 8) & 0xFF)
#define BG_UMAJUMP_GET_FF(thisx) ((thisx)->params & 0xFF)
#define BG_UMAJUMP_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF)
#define BG_UMAJUMP_GET_TYPE(thisx) ((thisx)->params & 0xFF)
typedef enum {
BG_UMAJUMP_TYPE_1 = 1,
@@ -24,7 +24,8 @@ typedef struct BgUmajump {
/* 0x15C */ BgUmajumpActionFunc actionFunc;
/* 0x160 */ union {
s32 objectIndex;
s32 rotationTimer; // y rotation
s32 rotationTimer; // y rotation
s32 pathIndex;
};
/* 0x164 */ s32 hasSoundPlayed;
/* 0x168 */ Actor* horse;
+5 -4
View File
@@ -5,6 +5,7 @@
*/
#include "z_en_cow.h"
#include "z64horse.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
@@ -130,7 +131,7 @@ void EnCow_Init(Actor* thisx, PlayState* play) {
this->animationCycle = 0;
this->actor.targetMode = 6;
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
func_801A5080(4);
break;
case EN_COW_TYPE_TAIL:
@@ -264,13 +265,13 @@ void EnCow_Talk(EnCow* this, PlayState* play) {
void EnCow_Idle(EnCow* this, PlayState* play) {
if ((play->msgCtx.ocarinaMode == 0) || (play->msgCtx.ocarinaMode == 4)) {
if (D_801BDAA4 != 0) {
if (gHorsePlayedEponasSong) {
if (this->flags & EN_COW_FLAG_WONT_GIVE_MILK) {
this->flags &= ~EN_COW_FLAG_WONT_GIVE_MILK;
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
} else if ((this->actor.xzDistToPlayer < 150.0f) &&
ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)) < 25000) {
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
this->actionFunc = EnCow_Talk;
this->actor.flags |= ACTOR_FLAG_10000;
func_800B8614(&this->actor, play, 170.0f);
+14 -13
View File
@@ -5,6 +5,7 @@
*/
#include "z_en_horse.h"
#include "z64horse.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_In/z_en_in.h"
#include "overlays/actors/ovl_Obj_Um/z_obj_um.h"
@@ -278,8 +279,8 @@ void EnHorse_RaceWaypointPos(RaceWaypoint* waypoints, s32 idx, Vec3f* pos) {
pos->z = waypoints[idx].z;
}
void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnAmount) {
func_800F415C(&this->actor, pos, turnAmount);
void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnYaw) {
Horse_RotateToPoint(&this->actor, pos, turnYaw);
}
void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) {
@@ -582,15 +583,15 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) {
f32 minDist = 1.0e+38;
Player* player = GET_PLAYER(play);
Vec3f spawnPos;
s32 pathIdx = func_800F3940(play);
s32 pathIndex = Horse_GetJumpingFencePathIndex(play);
s32 pathCount;
Vec3s* pathPoints;
if (pathIdx == -1) {
if (pathIndex == -1) {
return false;
}
path = &play->setupPathList[pathIdx];
path = &play->setupPathList[pathIndex];
pathCount = path->count;
pathPoints = Lib_SegmentedToVirtual(path->points);
@@ -691,7 +692,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
Actor_ProcessInitChain(&this->actor, sInitChain);
EnHorse_ClearDustFlags(&this->dustFlags);
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
Skin_Setup(&this->skin);
this->riderPos = thisx->world.pos;
this->unk_52C = 0;
@@ -1874,8 +1875,8 @@ void EnHorse_InitInactive(EnHorse* this) {
}
void EnHorse_Inactive(EnHorse* this, PlayState* play) {
if ((D_801BDAA4 != 0) && (this->type == HORSE_TYPE_2)) {
D_801BDAA4 = 0;
if (gHorsePlayedEponasSong && (this->type == HORSE_TYPE_2)) {
gHorsePlayedEponasSong = false;
if (EnHorse_Spawn(this, play)) {
if (this->type == HORSE_TYPE_2) {
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH);
@@ -1954,8 +1955,8 @@ void EnHorse_Idle(EnHorse* this, PlayState* play) {
this->actor.speed = 0.0f;
EnHorse_IdleAnimSounds(this, play);
if ((D_801BDAA4 != 0) && (this->type == HORSE_TYPE_2)) {
D_801BDAA4 = 0;
if (gHorsePlayedEponasSong && (this->type == HORSE_TYPE_2)) {
gHorsePlayedEponasSong = false;
if (!func_8087C38C(play, this, &this->actor.world.pos)) {
if (EnHorse_Spawn(this, play)) {
if (this->type == HORSE_TYPE_2) {
@@ -2050,7 +2051,7 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) {
void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) {
f32 distToPlayer;
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
if (((this->playerDir == PLAYER_DIR_BACK_R) || (this->playerDir == PLAYER_DIR_BACK_L)) && (distToPlayer > 300.0f) &&
@@ -2959,7 +2960,7 @@ void EnHorse_FleePlayer(EnHorse* this, PlayState* play) {
s32 animFinished;
s16 yaw;
if ((D_801BDAA4 != 0) || (this->type == HORSE_TYPE_HNI)) {
if (gHorsePlayedEponasSong || (this->type == HORSE_TYPE_HNI)) {
EnHorse_StartIdleRidable(this);
if (this->type == HORSE_TYPE_2) {
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH);
@@ -3318,7 +3319,7 @@ void func_808848C8(EnHorse* this, PlayState* play) {
EnHorse_PlayWalkingSound(this);
this->actor.speed = 4.0f;
func_800F415C(&this->actor, &sp24, 2000);
Horse_RotateToPoint(&this->actor, &sp24, 0x7D0);
this->skin.skelAnime.playSpeed = this->actor.speed * 0.75f;
SkelAnime_Update(&this->skin.skelAnime);
if (Math3D_Distance(&sp24, &this->actor.world.pos) < 30.0f) {
@@ -112,7 +112,7 @@ typedef enum HorseType {
#define ENHORSE_IS_4000_TYPE(thisx) ((thisx)->params & ENHORSE_PARAM_4000)
#define ENHORSE_IS_DONKEY_TYPE(thisx) ((thisx)->params & ENHORSE_PARAM_DONKEY)
typedef enum {
typedef enum EnHorseParam {
/* 0 */ ENHORSE_0,
/* 1 */ ENHORSE_1,
/* 2 */ ENHORSE_2,
@@ -5,6 +5,7 @@
*/
#include "z_en_horse_game_check.h"
#include "z64horse.h"
#include "objects/object_horse_game_check/object_horse_game_check.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -168,9 +169,9 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) {
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
D_801BDA9C = 0;
gHorseIsMounted = false;
if (player->stateFlags1 & PLAYER_STATE1_800000) {
D_801BDAA0 = 1;
D_801BDAA0 = true;
}
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 2);
play->transitionTrigger = TRANS_TRIGGER_START;
@@ -5,6 +5,7 @@
*/
#include "z_en_horse_link_child.h"
#include "z64horse.h"
#include "objects/object_horse_link_child/object_horse_link_child.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000)
@@ -417,7 +418,7 @@ void func_808DF560(EnHorseLinkChild* this) {
this->unk_148 = 1;
}
D_801BDAA4 = 0;
gHorsePlayedEponasSong = false;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f);
}
@@ -425,8 +426,8 @@ void func_808DF560(EnHorseLinkChild* this) {
void func_808DF620(EnHorseLinkChild* this, PlayState* play) {
s16 sp36;
if (D_801BDAA4 != 0) {
D_801BDAA4 = 0;
if (gHorsePlayedEponasSong) {
gHorsePlayedEponasSong = false;
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH);
func_808DF788(this);
return;
@@ -436,7 +437,7 @@ void func_808DF620(EnHorseLinkChild* this, PlayState* play) {
sp36 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y;
if ((Math_CosS(sp36) < 0.7071f) && (this->unk_148 == 2)) {
func_800F415C(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C);
Horse_RotateToPoint(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C);
}
if (SkelAnime_Update(&this->skin.skelAnime)) {
@@ -472,9 +473,9 @@ void func_808DF838(EnHorseLinkChild* this, PlayState* play) {
if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) {
if (this->unk_1E0 == 0) {
func_800F415C(&this->actor, &player->actor.world.pos, 0x12C);
Horse_RotateToPoint(&this->actor, &player->actor.world.pos, 0x12C);
} else {
func_800F415C(&this->actor, &this->actor.home.pos, 0x12C);
Horse_RotateToPoint(&this->actor, &this->actor.home.pos, 0x12C);
}
}
+4 -3
View File
@@ -5,6 +5,7 @@
*/
#include "z_en_in.h"
#include "z64horse.h"
#include "objects/object_in/object_in.h"
#include "overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h"
@@ -1286,7 +1287,7 @@ void func_808F5A34(EnIn* this, PlayState* play) {
}
void func_808F5A94(EnIn* this, PlayState* play) {
if (func_800F41E4(play, &play->actorCtx)) {
if (Horse_IsActive(play, &play->actorCtx)) {
if (gSaveContext.save.day == 3) {
func_808F5728(play, this, 7, &this->unk48C);
} else {
@@ -1302,7 +1303,7 @@ void func_808F5A94(EnIn* this, PlayState* play) {
}
void func_808F5B58(EnIn* this, PlayState* play) {
if (func_800F41E4(play, &play->actorCtx)) {
if (Horse_IsActive(play, &play->actorCtx)) {
if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) {
if (gSaveContext.save.day == 3) {
@@ -1394,7 +1395,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
this->unk4AC |= 2;
func_808F35AC(this, play);
this->unk23C = 0;
D_801BDAA0 = 0;
D_801BDAA0 = false;
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) {
EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_6);
@@ -6,6 +6,7 @@
#include "prevent_bss_reordering.h"
#include "z_en_test4.h"
#include "z64horse.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
@@ -405,9 +406,9 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
if ((rideActor->type == HORSE_TYPE_EPONA) || (rideActor->type == HORSE_TYPE_2)) {
if (CURRENT_DAY < 3) {
D_801BDA9C = 1;
gHorseIsMounted = true;
} else {
D_801BDA9C = 0;
gHorseIsMounted = false;
}
}
}
+3 -2
View File
@@ -5,6 +5,7 @@
*/
#include "z_obj_um.h"
#include "z64horse.h"
#include "overlays/actors/ovl_En_In/z_en_in.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -835,7 +836,7 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) {
SET_WEEKEVENTREG(WEEKEVENTREG_31_80);
play->nextEntrance = ENTRANCE(ROMANI_RANCH, 11);
if (player->stateFlags1 & PLAYER_STATE1_800000) {
D_801BDAA0 = 1;
D_801BDAA0 = true;
}
play->transitionType = TRANS_TYPE_64;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
@@ -1093,7 +1094,7 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) {
if (this->donkey != NULL) {
this->dyna.actor.world.rot.y = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &sp50);
func_800F415C(&this->donkey->actor, &sp50, 0x190);
Horse_RotateToPoint(&this->donkey->actor, &sp50, 0x190);
if (1) {}
@@ -6,6 +6,7 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64horse.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
@@ -5795,7 +5796,7 @@ s32 func_8083562C(PlayState* play, Player* this, CollisionPoly* poly, s32 bgId)
if (D_801BDAA0) {
D_801BDAA0 = false;
} else {
D_801BDA9C = true;
gHorseIsMounted = true;
}
}
}
@@ -15790,7 +15791,7 @@ void func_808505D0(Player* this, PlayState* play) {
this->stateFlags1 &= ~PLAYER_STATE1_800000;
this->actor.parent = NULL;
D_801BDA9C = false;
gHorseIsMounted = false;
if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA) || (DREG(1) != 0)) {
gSaveContext.save.saveInfo.horseData.sceneId = play->sceneId;