mirror of https://github.com/zeldaret/mm.git
Document Overriding Player Input (#1489)
* Override Input * cleanup * cleanup * PR Review * PR Review, fix merge
This commit is contained in:
parent
5acaec4486
commit
61e2f12cf5
|
@ -295,7 +295,7 @@ f32 Actor_WorldDistXZToActor(Actor* actorA, Actor* actorB);
|
|||
f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint);
|
||||
void Actor_OffsetOfPointInActorCoords(Actor* actor, Vec3f* offset, Vec3f* point);
|
||||
f32 Actor_HeightDiff(Actor* actor1, Actor* actor2);
|
||||
void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw);
|
||||
void Actor_SetControlStickData(PlayState* play, Input* input, f32 controlStickMagnitude, s16 controlStickAngle);
|
||||
f32 Player_GetHeight(Player* player);
|
||||
f32 Player_GetRunSpeedLimit(Player* player);
|
||||
bool func_800B7118(Player* player);
|
||||
|
@ -767,8 +767,8 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
|
|||
void Path_CopyLastPoint(Path* path, Vec3f* dest);
|
||||
|
||||
s32 func_801226E0(PlayState* play, s32 arg1);
|
||||
s32 func_80122744(PlayState* play, struct_80122744_arg1* arg1, u32 arg2, Vec3s* arg3);
|
||||
s32 func_80122760(PlayState* play, struct_80122744_arg1* arg1, f32 arg2);
|
||||
s32 Player_InitOverrideInput(PlayState* play, PlayerOverrideInputEntry* inputEntry, u32 numPoints, Vec3s* targetPosList);
|
||||
s32 Player_UpdateOverrideInput(PlayState* play, PlayerOverrideInputEntry* inputEntry, f32 distXZRange);
|
||||
void func_80122868(PlayState* play, Player* player);
|
||||
void func_801229A0(PlayState* play, Player* player);
|
||||
void func_801229EC(Actor* thisx, PlayState* play);
|
||||
|
|
|
@ -433,9 +433,9 @@ typedef struct ActorContext {
|
|||
/* 0x24C */ UNK_TYPE1 unk_24C[0x4];
|
||||
/* 0x250 */ void* absoluteSpace; // Space used to allocate actor overlays of alloc type ALLOCTYPE_ABSOLUTE
|
||||
/* 0x254 */ struct EnTorch2* elegyShells[5]; // PLAYER_FORM_MAX
|
||||
/* 0x268 */ u8 unk268;
|
||||
/* 0x268 */ u8 isOverrideInputOn;
|
||||
/* 0x269 */ UNK_TYPE1 pad269[0x3];
|
||||
/* 0x26C */ Input unk_26C;
|
||||
/* 0x26C */ Input overrideInput;
|
||||
} ActorContext; // size = 0x284
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -598,13 +598,11 @@ typedef struct {
|
|||
/* 0x04 */ struct_80122D44_arg1_unk_04 unk_04[4];
|
||||
} struct_80122D44_arg1; // size >= 0x114
|
||||
|
||||
typedef struct struct_80122744_arg1 {
|
||||
/* 0x0 */ s8 unk_00;
|
||||
/* 0x1 */ s8 unk_01;
|
||||
/* 0x2 */ s8 unk_02;
|
||||
/* 0x3 */ s8 unk_03;
|
||||
/* 0x4 */ Vec3s* unk_04;
|
||||
} struct_80122744_arg1; // size = 0x8
|
||||
typedef struct PlayerOverrideInputEntry {
|
||||
/* 0x0 */ s8 numPoints;
|
||||
/* 0x1 */ s8 curPoint;
|
||||
/* 0x4 */ Vec3s* targetPosList;
|
||||
} PlayerOverrideInputEntry; // size = 0x8
|
||||
|
||||
typedef enum PlayerCsAction {
|
||||
/* -1 */ PLAYER_CSACTION_NEG1 = -1, // Specific to Kafei, any negative number works
|
||||
|
|
|
@ -1314,14 +1314,14 @@ f32 Actor_HeightDiff(Actor* actor1, Actor* actor2) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the current and new inputs.
|
||||
* Calculates and sets the control stick x/y values and writes these to input.
|
||||
*/
|
||||
void func_800B6F20(PlayState* play, Input* input, f32 magnitude, s16 baseYaw) {
|
||||
s16 relativeYaw = baseYaw - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
|
||||
void Actor_SetControlStickData(PlayState* play, Input* input, f32 controlStickMagnitude, s16 controlStickAngle) {
|
||||
s16 relativeAngle = controlStickAngle - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
|
||||
|
||||
input->cur.stick_x = -Math_SinS(relativeYaw) * magnitude;
|
||||
input->cur.stick_x = -Math_SinS(relativeAngle) * controlStickMagnitude;
|
||||
input->rel.stick_x = input->cur.stick_x;
|
||||
input->cur.stick_y = Math_CosS(relativeYaw) * magnitude;
|
||||
input->cur.stick_y = Math_CosS(relativeAngle) * controlStickMagnitude;
|
||||
input->rel.stick_y = input->cur.stick_y;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,8 @@ void KaleidoSetup_Update(PlayState* play) {
|
|||
if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
|
||||
!(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) {
|
||||
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
if (!play->actorCtx.isOverrideInputOn &&
|
||||
CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
|
||||
pauseCtx->itemDescriptionOn = false;
|
||||
pauseCtx->state = PAUSE_STATE_OPENING_0;
|
||||
|
|
|
@ -96,29 +96,32 @@ s32 func_801226E0(PlayState* play, s32 arg1) {
|
|||
return arg1;
|
||||
}
|
||||
|
||||
s32 func_80122744(PlayState* play, struct_80122744_arg1* arg1, u32 arg2, Vec3s* arg3) {
|
||||
arg1->unk_00 = arg2;
|
||||
arg1->unk_01 = 0;
|
||||
arg1->unk_04 = arg3;
|
||||
s32 Player_InitOverrideInput(PlayState* play, PlayerOverrideInputEntry* inputEntry, u32 numPoints,
|
||||
Vec3s* targetPosList) {
|
||||
inputEntry->numPoints = numPoints;
|
||||
inputEntry->curPoint = 0;
|
||||
inputEntry->targetPosList = targetPosList;
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 func_80122760(PlayState* play, struct_80122744_arg1* arg1, f32 arg2) {
|
||||
if (arg1->unk_01 < arg1->unk_00) {
|
||||
s32 Player_UpdateOverrideInput(PlayState* play, PlayerOverrideInputEntry* inputEntry, f32 distXZRange) {
|
||||
if (inputEntry->curPoint < inputEntry->numPoints) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
Vec3f sp30;
|
||||
Vec3f targetPos;
|
||||
s32 pad;
|
||||
s16 yaw;
|
||||
f32 distXZ;
|
||||
|
||||
Math_Vec3s_ToVec3f(&sp30, &arg1->unk_04[arg1->unk_01]);
|
||||
yaw = Math_Vec3f_Yaw(&player->actor.world.pos, &sp30);
|
||||
func_800B6F20(play, &play->actorCtx.unk_26C, arg2, yaw);
|
||||
play->actorCtx.unk268 = 1;
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &sp30);
|
||||
Math_Vec3s_ToVec3f(&targetPos, &inputEntry->targetPosList[inputEntry->curPoint]);
|
||||
yaw = Math_Vec3f_Yaw(&player->actor.world.pos, &targetPos);
|
||||
|
||||
if ((fabsf(player->actor.world.pos.y - sp30.y) < 50.0f) && (distXZ < arg2)) {
|
||||
arg1->unk_01++;
|
||||
Actor_SetControlStickData(play, &play->actorCtx.overrideInput, distXZRange, yaw);
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &targetPos);
|
||||
|
||||
if ((fabsf(player->actor.world.pos.y - targetPos.y) < 50.0f) && (distXZ < distXZRange)) {
|
||||
inputEntry->curPoint++;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -498,7 +501,7 @@ bool Player_InBlockingCsMode(PlayState* play, Player* player) {
|
|||
return (player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_200 | PLAYER_STATE1_20000000)) ||
|
||||
(player->csAction != PLAYER_CSACTION_NONE) || (play->transitionTrigger == TRANS_TRIGGER_START) ||
|
||||
(play->transitionMode != TRANS_MODE_OFF) || (player->stateFlags1 & PLAYER_STATE1_1) ||
|
||||
(player->stateFlags3 & PLAYER_STATE3_80) || (play->actorCtx.unk268 != 0);
|
||||
(player->stateFlags3 & PLAYER_STATE3_80) || play->actorCtx.isOverrideInputOn;
|
||||
}
|
||||
|
||||
bool Player_InCsMode(PlayState* play) {
|
||||
|
|
|
@ -40,7 +40,7 @@ void func_80963540(EnFu* this);
|
|||
void func_80963560(EnFu* this, PlayState* play);
|
||||
void func_80963610(EnFu* this);
|
||||
void func_80963630(EnFu* this, PlayState* play);
|
||||
s32 func_80963810(PlayState* play, Vec3f pos);
|
||||
s32 EnFu_MovePlayerToPos(PlayState* play, Vec3f targetPos);
|
||||
s32 func_809638F8(PlayState* play);
|
||||
void func_809639D0(EnFu* this, PlayState* play);
|
||||
void func_80963DE4(EnFu* this, PlayState* play);
|
||||
|
@ -839,7 +839,7 @@ void func_80963258(EnFu* this) {
|
|||
|
||||
void func_8096326C(EnFu* this, PlayState* play) {
|
||||
func_80963FF8(this, play);
|
||||
if (func_80963810(play, this->actor.world.pos)) {
|
||||
if (EnFu_MovePlayerToPos(play, this->actor.world.pos)) {
|
||||
func_809622FC(this);
|
||||
}
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ void func_80963350(EnFu* this, PlayState* play) {
|
|||
D_80964C24 = 0;
|
||||
fuKaiten->bounce = 0;
|
||||
func_80963F88(this, play);
|
||||
play->actorCtx.unk268 = 1;
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
func_80963258(this);
|
||||
}
|
||||
}
|
||||
|
@ -967,27 +967,27 @@ void func_80963630(EnFu* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 func_80963810(PlayState* play, Vec3f pos) {
|
||||
s32 EnFu_MovePlayerToPos(PlayState* play, Vec3f targetPos) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 sp28;
|
||||
f32 phi_f0;
|
||||
s16 sp22;
|
||||
f32 distXZ;
|
||||
f32 controlStickMagnitude;
|
||||
s16 controlStickAngle;
|
||||
|
||||
sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &pos);
|
||||
sp28 = Math_Vec3f_DistXZ(&player->actor.world.pos, &pos);
|
||||
controlStickAngle = Math_Vec3f_Yaw(&player->actor.world.pos, &targetPos);
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &targetPos);
|
||||
|
||||
if (sp28 < 80.0f) {
|
||||
phi_f0 = 10.0f;
|
||||
} else if (sp28 < 90.0f) {
|
||||
phi_f0 = 40.0f;
|
||||
if (distXZ < 80.0f) {
|
||||
controlStickMagnitude = 10.0f;
|
||||
} else if (distXZ < 90.0f) {
|
||||
controlStickMagnitude = 40.0f;
|
||||
} else {
|
||||
phi_f0 = 80.0f;
|
||||
controlStickMagnitude = 80.0f;
|
||||
}
|
||||
|
||||
play->actorCtx.unk268 = 1;
|
||||
func_800B6F20(play, &play->actorCtx.unk_26C, phi_f0, sp22);
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
Actor_SetControlStickData(play, &play->actorCtx.overrideInput, controlStickMagnitude, controlStickAngle);
|
||||
|
||||
if (sp28 < 80.0f) {
|
||||
if (distXZ < 80.0f) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1209,10 +1209,10 @@ void func_80963FF8(EnFu* this, PlayState* play) {
|
|||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (player->stateFlags1 & PLAYER_STATE1_100000) {
|
||||
play->actorCtx.unk268 = 1;
|
||||
play->actorCtx.unk_26C.press.button = BTN_A;
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
play->actorCtx.overrideInput.press.button = BTN_A;
|
||||
} else {
|
||||
play->actorCtx.unk268 = 1;
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -520,8 +520,8 @@ void EnJso2_IntroCutscene(EnJso2* this, PlayState* play) {
|
|||
Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext);
|
||||
Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext);
|
||||
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_END);
|
||||
func_80122744(play, &this->overrideInputEntry, ARRAY_COUNT(sPlayerOverrideInputPosList),
|
||||
sPlayerOverrideInputPosList);
|
||||
Player_InitOverrideInput(play, &this->overrideInputEntry, ARRAY_COUNT(sPlayerOverrideInputPosList),
|
||||
sPlayerOverrideInputPosList);
|
||||
this->cutsceneState++;
|
||||
}
|
||||
break;
|
||||
|
@ -541,7 +541,7 @@ void EnJso2_IntroCutscene(EnJso2* this, PlayState* play) {
|
|||
Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext);
|
||||
Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext);
|
||||
|
||||
if (func_80122760(play, &this->overrideInputEntry, 60.0f)) {
|
||||
if (Player_UpdateOverrideInput(play, &this->overrideInputEntry, 60.0f)) {
|
||||
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_19);
|
||||
this->cutsceneTimer = 10;
|
||||
this->cutsceneState++;
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct EnJso2 {
|
|||
/* 0x0188 */ Vec3s jointTable[GARO_MASTER_LIMB_MAX];
|
||||
/* 0x0200 */ Vec3s morphTable[GARO_MASTER_LIMB_MAX];
|
||||
/* 0x0278 */ EnJso2ActionFunc actionFunc;
|
||||
/* 0x027C */ struct_80122744_arg1 overrideInputEntry;
|
||||
/* 0x027C */ PlayerOverrideInputEntry overrideInputEntry;
|
||||
/* 0x0284 */ s16 action;
|
||||
/* 0x0286 */ s16 circlingAngle;
|
||||
/* 0x0288 */ s16 circlingAngularVelocity;
|
||||
|
|
|
@ -33,7 +33,7 @@ void func_80B276D8(EnKendoJs* this, PlayState* play);
|
|||
void func_80B27760(EnKendoJs* this);
|
||||
void func_80B27774(EnKendoJs* this, PlayState* play);
|
||||
void func_80B2783C(EnKendoJs* this, PlayState* play);
|
||||
s32 func_80B278C4(PlayState* play, Vec3f arg1);
|
||||
s32 EnKendoJs_MovePlayerToPos(PlayState* play, Vec3f targetPos);
|
||||
void func_80B279F0(EnKendoJs* this, PlayState* play, s32 arg2);
|
||||
void func_80B27A90(EnKendoJs* this, PlayState* play);
|
||||
|
||||
|
@ -512,7 +512,7 @@ void func_80B27030(EnKendoJs* this, PlayState* play) {
|
|||
|
||||
sp20.z += 200.0f;
|
||||
|
||||
if (func_80B278C4(play, sp20)) {
|
||||
if (EnKendoJs_MovePlayerToPos(play, sp20)) {
|
||||
this->actor.flags |= ACTOR_FLAG_10000;
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
|
@ -609,7 +609,7 @@ void func_80B2740C(EnKendoJs* this, PlayState* play) {
|
|||
|
||||
sp18.z += 300.0f;
|
||||
|
||||
if (func_80B278C4(play, sp18)) {
|
||||
if (EnKendoJs_MovePlayerToPos(play, sp18)) {
|
||||
this->unk_28C = 0;
|
||||
player->stateFlags1 &= ~PLAYER_STATE1_20;
|
||||
this->actionFunc = func_80B274BC;
|
||||
|
@ -718,30 +718,30 @@ void func_80B27880(EnKendoJs* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 func_80B278C4(PlayState* play, Vec3f arg1) {
|
||||
s32 EnKendoJs_MovePlayerToPos(PlayState* play, Vec3f targetPos) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 temp_f0;
|
||||
f32 sp28;
|
||||
s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1);
|
||||
f32 distXZ;
|
||||
f32 controlStickMagnitude;
|
||||
s16 controlStickAngle;
|
||||
|
||||
temp_f0 = Math_Vec3f_DistXZ(&player->actor.world.pos, &arg1);
|
||||
controlStickAngle = Math_Vec3f_Yaw(&player->actor.world.pos, &targetPos);
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &targetPos);
|
||||
|
||||
if (temp_f0 < 20.0f) {
|
||||
sp28 = 10.0f;
|
||||
} else if (temp_f0 < 40.0f) {
|
||||
sp28 = 40.0f;
|
||||
if (distXZ < 20.0f) {
|
||||
controlStickMagnitude = 10.0f;
|
||||
} else if (distXZ < 40.0f) {
|
||||
controlStickMagnitude = 40.0f;
|
||||
} else {
|
||||
sp28 = 80.0f;
|
||||
controlStickMagnitude = 80.0f;
|
||||
}
|
||||
|
||||
play->actorCtx.unk268 = 1;
|
||||
func_800B6F20(play, &play->actorCtx.unk_26C, sp28, sp22);
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
Actor_SetControlStickData(play, &play->actorCtx.overrideInput, controlStickMagnitude, controlStickAngle);
|
||||
|
||||
if (temp_f0 < 20.0f) {
|
||||
if (distXZ < 20.0f) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_80B279AC(EnKendoJs* this, PlayState* play) {
|
||||
|
|
|
@ -29,8 +29,8 @@ void EnLiftNuts_StartConversation(EnLiftNuts* this, PlayState* play);
|
|||
void EnLiftNuts_HandleConversation(EnLiftNuts* this, PlayState* play);
|
||||
void EnLiftNuts_SetupMove(EnLiftNuts* this);
|
||||
void EnLiftNuts_Move(EnLiftNuts* this, PlayState* play);
|
||||
void EnLiftNuts_SetupMovePlayer(EnLiftNuts* this);
|
||||
void EnLiftNuts_MovePlayer(EnLiftNuts* this, PlayState* play);
|
||||
void EnLiftNuts_SetupMovePlayerToActor(EnLiftNuts* this);
|
||||
void EnLiftNuts_MovePlayerToActor(EnLiftNuts* this, PlayState* play);
|
||||
void EnLiftNuts_SetupStartGame(EnLiftNuts* this);
|
||||
void EnLiftNuts_StartGame(EnLiftNuts* this, PlayState* play);
|
||||
void EnLiftNuts_SetupStartGameImmediately(EnLiftNuts* this);
|
||||
|
@ -774,45 +774,45 @@ void EnLiftNuts_Move(EnLiftNuts* this, PlayState* play) {
|
|||
this->actor.world.pos.y += this->actor.gravity;
|
||||
|
||||
if (dist == 0.0f) {
|
||||
EnLiftNuts_SetupMovePlayer(this);
|
||||
EnLiftNuts_SetupMovePlayerToActor(this);
|
||||
}
|
||||
}
|
||||
|
||||
void EnLiftNuts_SetupMovePlayer(EnLiftNuts* this) {
|
||||
this->actionFunc = EnLiftNuts_MovePlayer;
|
||||
void EnLiftNuts_SetupMovePlayerToActor(EnLiftNuts* this) {
|
||||
this->actionFunc = EnLiftNuts_MovePlayerToActor;
|
||||
}
|
||||
|
||||
void EnLiftNuts_MovePlayer(EnLiftNuts* this, PlayState* play) {
|
||||
void EnLiftNuts_MovePlayerToActor(EnLiftNuts* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 dist;
|
||||
f32 magnitude;
|
||||
s16 playerYaw;
|
||||
f32 distXZ;
|
||||
f32 controlStickMagnitude;
|
||||
s16 controlStickAngle;
|
||||
s16 yaw;
|
||||
s16 yawDiff;
|
||||
|
||||
yaw = this->actor.yawTowardsPlayer - 0x8000;
|
||||
playerYaw = Math_Vec3f_Yaw(&player->actor.world.pos, &this->actor.home.pos);
|
||||
yawDiff = playerYaw - yaw;
|
||||
dist = Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos);
|
||||
controlStickAngle = Math_Vec3f_Yaw(&player->actor.world.pos, &this->actor.home.pos);
|
||||
yawDiff = controlStickAngle - yaw;
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos);
|
||||
|
||||
if (this->actor.xzDistToPlayer < dist) {
|
||||
if (this->actor.xzDistToPlayer < distXZ) {
|
||||
if (ABS_ALT(yawDiff) < 0x2000) {
|
||||
playerYaw = (yawDiff > 0) ? (playerYaw + 0x2000) : (playerYaw - 0x2000);
|
||||
controlStickAngle = (yawDiff > 0) ? (controlStickAngle + 0x2000) : (controlStickAngle - 0x2000);
|
||||
}
|
||||
}
|
||||
|
||||
if (dist < 5.0f) {
|
||||
magnitude = 10.0f;
|
||||
} else if (dist < 30.0f) {
|
||||
magnitude = 40.0f;
|
||||
if (distXZ < 5.0f) {
|
||||
controlStickMagnitude = 10.0f;
|
||||
} else if (distXZ < 30.0f) {
|
||||
controlStickMagnitude = 40.0f;
|
||||
} else {
|
||||
magnitude = 80.0f;
|
||||
controlStickMagnitude = 80.0f;
|
||||
}
|
||||
|
||||
play->actorCtx.unk268 = true;
|
||||
func_800B6F20(play, &play->actorCtx.unk_26C, magnitude, playerYaw);
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
Actor_SetControlStickData(play, &play->actorCtx.overrideInput, controlStickMagnitude, controlStickAngle);
|
||||
|
||||
if (dist < 5.0f) {
|
||||
if (distXZ < 5.0f) {
|
||||
EnLiftNuts_SetupIdle(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -770,10 +770,10 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) {
|
|||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (player->stateFlags1 & PLAYER_STATE1_100000) {
|
||||
play->actorCtx.unk268 = 1;
|
||||
play->actorCtx.unk_26C.press.button = BTN_A;
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
play->actorCtx.overrideInput.press.button = BTN_A;
|
||||
} else {
|
||||
play->actorCtx.unk268 = 1;
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
}
|
||||
|
||||
if (sFrameCounter == 25) {
|
||||
|
@ -785,7 +785,7 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) {
|
|||
this->textId = 0x334B;
|
||||
}
|
||||
} else if (sFrameCounter == 50) {
|
||||
play->actorCtx.unk268 = 0;
|
||||
play->actorCtx.isOverrideInputOn = false;
|
||||
play->nextEntrance = ENTRANCE(ROMANI_RANCH, 1);
|
||||
gSaveContext.nextCutsceneIndex = 0;
|
||||
sFrameCounter = 0;
|
||||
|
|
|
@ -248,24 +248,25 @@ void EnSyatekiMan_Destroy(Actor* thisx, PlayState* play) {
|
|||
* Moves the player to the destination through automated control stick movements.
|
||||
* This is used to move the player to the right place to play the shooting game.
|
||||
*/
|
||||
s32 EnSyatekiMan_MovePlayerToPos(PlayState* play, Vec3f pos) {
|
||||
s32 EnSyatekiMan_MovePlayerToPos(PlayState* play, Vec3f targetPos) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 distXZ;
|
||||
f32 magnitude;
|
||||
s16 yaw = Math_Vec3f_Yaw(&player->actor.world.pos, &pos);
|
||||
f32 controlStickMagnitude;
|
||||
s16 controlStickAngle;
|
||||
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &pos);
|
||||
controlStickAngle = Math_Vec3f_Yaw(&player->actor.world.pos, &targetPos);
|
||||
distXZ = Math_Vec3f_DistXZ(&player->actor.world.pos, &targetPos);
|
||||
|
||||
if (distXZ < 5.0f) {
|
||||
magnitude = 10.0f;
|
||||
controlStickMagnitude = 10.0f;
|
||||
} else if (distXZ < 30.0f) {
|
||||
magnitude = 40.0f;
|
||||
controlStickMagnitude = 40.0f;
|
||||
} else {
|
||||
magnitude = 80.0f;
|
||||
controlStickMagnitude = 80.0f;
|
||||
}
|
||||
|
||||
play->actorCtx.unk268 = 1;
|
||||
func_800B6F20(play, &play->actorCtx.unk_26C, magnitude, yaw);
|
||||
play->actorCtx.isOverrideInputOn = true;
|
||||
Actor_SetControlStickData(play, &play->actorCtx.overrideInput, controlStickMagnitude, controlStickAngle);
|
||||
|
||||
if (distXZ < 5.0f) {
|
||||
return true;
|
||||
|
|
|
@ -265,9 +265,9 @@ static EnTest3_struct_D78 D_80A41854[] = {
|
|||
|
||||
s32 D_80A41D20;
|
||||
s32 D_80A41D24;
|
||||
Input sEnTest3_Input;
|
||||
f32 D_80A41D40;
|
||||
s16 D_80A41D44;
|
||||
Input sKafeiControlInput;
|
||||
f32 sKafeiControlStickMagnitude;
|
||||
s16 sKafeiControlStickAngle;
|
||||
s32 D_80A41D48;
|
||||
Vec3f D_80A41D50;
|
||||
s32 D_80A41D5C;
|
||||
|
@ -951,9 +951,9 @@ s32 func_80A40230(EnTest3* this, PlayState* play) {
|
|||
dy = this->player.actor.world.pos.z - this->player.actor.prevPos.z;
|
||||
this->player.linearVelocity = sqrtf(SQ(dx) + SQ(dy));
|
||||
this->player.linearVelocity *= 1.0f + (1.05f * fabsf(Math_SinS(this->player.floorPitch)));
|
||||
D_80A41D40 = (this->player.linearVelocity * 10.0f) + 20.0f;
|
||||
D_80A41D40 = CLAMP_MAX(D_80A41D40, 60.0f);
|
||||
D_80A41D44 = this->player.actor.world.rot.y;
|
||||
sKafeiControlStickMagnitude = (this->player.linearVelocity * 10.0f) + 20.0f;
|
||||
sKafeiControlStickMagnitude = CLAMP_MAX(sKafeiControlStickMagnitude, 60.0f);
|
||||
sKafeiControlStickAngle = this->player.actor.world.rot.y;
|
||||
this->player.actor.world.pos.x = this->player.actor.prevPos.x;
|
||||
this->player.actor.world.pos.z = this->player.actor.prevPos.z;
|
||||
if (!func_80A3F384(this, play)) {
|
||||
|
@ -1035,7 +1035,7 @@ void func_80A409D4(EnTest3* this, PlayState* play) {
|
|||
func_80A3F0B0(this, play);
|
||||
CutsceneManager_SetReturnCamera(CAM_ID_MAIN);
|
||||
} else {
|
||||
sEnTest3_Input = *CONTROLLER1(&play->state);
|
||||
sKafeiControlInput = *CONTROLLER1(&play->state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1047,15 +1047,16 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) {
|
|||
PlayState* play = play2;
|
||||
EnTest3* this = THIS;
|
||||
|
||||
sEnTest3_Input.rel.button = sEnTest3_Input.cur.button;
|
||||
sEnTest3_Input.cur.button = 0;
|
||||
sEnTest3_Input.rel.stick_x = 0;
|
||||
sEnTest3_Input.rel.stick_y = 0;
|
||||
sKafeiControlInput.rel.button = sKafeiControlInput.cur.button;
|
||||
sKafeiControlInput.cur.button = 0;
|
||||
sKafeiControlInput.rel.stick_x = 0;
|
||||
sKafeiControlInput.rel.stick_y = 0;
|
||||
|
||||
play->actorCtx.flags &= ~ACTORCTX_FLAG_7;
|
||||
this->player.actor.draw = EnTest3_Draw;
|
||||
D_80A41D48 = false;
|
||||
this->player.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY);
|
||||
|
||||
if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_506) &&
|
||||
!((this->player.actor.category == ACTORCAT_PLAYER) &&
|
||||
((play->actorCtx.flags & ACTORCTX_FLAG_5) || (play->actorCtx.flags & ACTORCTX_FLAG_4)))) {
|
||||
|
@ -1077,14 +1078,17 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) {
|
|||
this->unk_D84 = 0.0f;
|
||||
}
|
||||
} else {
|
||||
D_80A41D40 = 0.0f;
|
||||
D_80A41D44 = this->player.actor.shape.rot.y;
|
||||
sKafeiControlStickMagnitude = 0.0f;
|
||||
sKafeiControlStickAngle = this->player.actor.shape.rot.y;
|
||||
this->unk_D94(this, play);
|
||||
sEnTest3_Input.press.button =
|
||||
(sEnTest3_Input.rel.button ^ sEnTest3_Input.cur.button) & sEnTest3_Input.cur.button;
|
||||
func_800B6F20(play, &sEnTest3_Input, D_80A41D40, D_80A41D44);
|
||||
sKafeiControlInput.press.button =
|
||||
(sKafeiControlInput.rel.button ^ sKafeiControlInput.cur.button) & sKafeiControlInput.cur.button;
|
||||
|
||||
Actor_SetControlStickData(play, &sKafeiControlInput, sKafeiControlStickMagnitude, sKafeiControlStickAngle);
|
||||
}
|
||||
play->playerUpdate(&this->player, play, &sEnTest3_Input);
|
||||
|
||||
play->playerUpdate(&this->player, play, &sKafeiControlInput);
|
||||
|
||||
if (D_80A41D48) {
|
||||
this->player.actor.world.pos.x = D_80A41D50.x;
|
||||
this->player.actor.world.pos.z = D_80A41D50.z;
|
||||
|
|
|
@ -145,10 +145,10 @@ static EnTotoUnkStruct2 D_80BA50DC[] = {
|
|||
{ 0x2B2C, 0x2B2D, 0x2B2E, { 0xFFF1, 0x0016, 0xFE74 } },
|
||||
};
|
||||
|
||||
static Vec3s D_80BA510C[] = {
|
||||
{ 0xFF46, 0xFFF8, 0xFF40 },
|
||||
{ 0xFF21, 0xFFFD, 0xFF04 },
|
||||
{ 0xFF64, 0x0016, 0xFE7E },
|
||||
static Vec3s sPlayerOverrideInputPosList[] = {
|
||||
{ -186, -8, -192 },
|
||||
{ -223, -3, -252 },
|
||||
{ -156, 22, -386 },
|
||||
};
|
||||
|
||||
static u16 sOcarinaActionWindFishPrompts[] = {
|
||||
|
@ -452,30 +452,31 @@ s32 func_80BA4204(EnToto* this, PlayState* play) {
|
|||
|
||||
s32 func_80BA42BC(EnToto* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
u32 phi_s0 = 0;
|
||||
Vec3s* end = &D_80BA510C[3];
|
||||
u32 numPoints = 0;
|
||||
Vec3s* endPosListPtr = &sPlayerOverrideInputPosList[ARRAY_COUNT(sPlayerOverrideInputPosList)];
|
||||
|
||||
func_80BA3FB0(this, play);
|
||||
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_END);
|
||||
|
||||
if (player->actor.world.pos.z > -310.0f) {
|
||||
if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) {
|
||||
phi_s0 = 3;
|
||||
numPoints = ARRAY_COUNT(sPlayerOverrideInputPosList);
|
||||
} else if (player->actor.world.pos.z > -232.0f) {
|
||||
numPoints = ARRAY_COUNT(sPlayerOverrideInputPosList) - 1;
|
||||
} else {
|
||||
if (player->actor.world.pos.z > -232.0f) {
|
||||
phi_s0 = 2;
|
||||
} else {
|
||||
phi_s0 = 1;
|
||||
}
|
||||
numPoints = ARRAY_COUNT(sPlayerOverrideInputPosList) - 2;
|
||||
}
|
||||
}
|
||||
func_80122744(play, &this->unk_2BC, phi_s0, end - phi_s0);
|
||||
|
||||
Player_InitOverrideInput(play, &this->overrideInputEntry, numPoints, &endPosListPtr[0 - numPoints]);
|
||||
|
||||
this->spotlights = Actor_Spawn(&play->actorCtx, play, ACTOR_DM_CHAR07, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0xF02);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_80BA43F4(EnToto* this, PlayState* play) {
|
||||
func_80BA3C88(this);
|
||||
if (func_80122760(play, &this->unk_2BC, 60.0f)) {
|
||||
if (Player_UpdateOverrideInput(play, &this->overrideInputEntry, 60.0f)) {
|
||||
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_19);
|
||||
return func_80BA4204(this, play);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct EnToto {
|
|||
/* 0x2B6 */ u8 unk2B6;
|
||||
/* 0x2B7 */ u8 unk2B7;
|
||||
/* 0x2B8 */ EnTotoText* text;
|
||||
/* 0x2BC */ struct_80122744_arg1 unk_2BC;
|
||||
/* 0x2BC */ PlayerOverrideInputEntry overrideInputEntry;
|
||||
/* 0x2C4 */ Actor* spotlights;
|
||||
/* 0x2C8 */ s32 pad2C8;
|
||||
} EnToto; // size = 0x2CC
|
||||
|
|
|
@ -12412,8 +12412,8 @@ void Player_Update(Actor* thisx, PlayState* play) {
|
|||
Player_DetachHeldActor(play, this);
|
||||
}
|
||||
|
||||
if ((play->actorCtx.unk268 != 0) && (this == GET_PLAYER(play))) {
|
||||
input = play->actorCtx.unk_26C;
|
||||
if (play->actorCtx.isOverrideInputOn && (this == GET_PLAYER(play))) {
|
||||
input = play->actorCtx.overrideInput;
|
||||
} else if ((this->csAction == PLAYER_CSACTION_5) ||
|
||||
(this->stateFlags1 & (PLAYER_STATE1_20 | PLAYER_STATE1_20000000)) || (this != GET_PLAYER(play)) ||
|
||||
func_8082DA90(play) || (gSaveContext.save.saveInfo.playerData.health == 0)) {
|
||||
|
@ -12428,8 +12428,8 @@ void Player_Update(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
|
||||
Player_UpdateCommon(this, play, &input);
|
||||
play->actorCtx.unk268 = 0;
|
||||
bzero(&play->actorCtx.unk_26C, sizeof(Input));
|
||||
play->actorCtx.isOverrideInputOn = false;
|
||||
bzero(&play->actorCtx.overrideInput, sizeof(Input));
|
||||
|
||||
MREG(52) = this->actor.world.pos.x;
|
||||
MREG(53) = this->actor.world.pos.y;
|
||||
|
|
|
@ -734,7 +734,7 @@
|
|||
0x800B6E48:("Actor_WorldDistXZToPoint",),
|
||||
0x800B6E6C:("Actor_OffsetOfPointInActorCoords",),
|
||||
0x800B6F0C:("Actor_HeightDiff",),
|
||||
0x800B6F20:("func_800B6F20",),
|
||||
0x800B6F20:("Actor_SetControlStickData",),
|
||||
0x800B6FC8:("Player_GetHeight",),
|
||||
0x800B7090:("Player_GetRunSpeedLimit",),
|
||||
0x800B7118:("func_800B7118",),
|
||||
|
@ -2173,8 +2173,8 @@
|
|||
0x80122660:("FrameAdvance_Init",),
|
||||
0x80122670:("FrameAdvance_Update",),
|
||||
0x801226E0:("func_801226E0",),
|
||||
0x80122744:("func_80122744",),
|
||||
0x80122760:("func_80122760",),
|
||||
0x80122744:("Player_InitOverrideInput",),
|
||||
0x80122760:("Player_UpdateOverrideInput",),
|
||||
0x80122868:("func_80122868",),
|
||||
0x801229A0:("func_801229A0",),
|
||||
0x801229EC:("func_801229EC",),
|
||||
|
@ -7864,7 +7864,7 @@
|
|||
0x80963560:("func_80963560",),
|
||||
0x80963610:("func_80963610",),
|
||||
0x80963630:("func_80963630",),
|
||||
0x80963810:("func_80963810",),
|
||||
0x80963810:("EnFu_MovePlayerToPos",),
|
||||
0x809638F8:("func_809638F8",),
|
||||
0x809639D0:("func_809639D0",),
|
||||
0x80963DE4:("func_80963DE4",),
|
||||
|
@ -12526,8 +12526,8 @@
|
|||
0x80AEACF8:("EnLiftNuts_HandleConversation",),
|
||||
0x80AEAEAC:("EnLiftNuts_SetupMove",),
|
||||
0x80AEAF14:("EnLiftNuts_Move",),
|
||||
0x80AEAF8C:("EnLiftNuts_SetupMovePlayer",),
|
||||
0x80AEAFA0:("EnLiftNuts_MovePlayer",),
|
||||
0x80AEAF8C:("EnLiftNuts_SetupMovePlayerToActor",),
|
||||
0x80AEAFA0:("EnLiftNuts_MovePlayerToActor",),
|
||||
0x80AEB114:("EnLiftNuts_SetupStartGame",),
|
||||
0x80AEB148:("EnLiftNuts_StartGame",),
|
||||
0x80AEB1C8:("EnLiftNuts_SetupStartGameImmediately",),
|
||||
|
@ -13325,7 +13325,7 @@
|
|||
0x80B27774:("func_80B27774",),
|
||||
0x80B2783C:("func_80B2783C",),
|
||||
0x80B27880:("func_80B27880",),
|
||||
0x80B278C4:("func_80B278C4",),
|
||||
0x80B278C4:("EnKendoJs_MovePlayerToPos",),
|
||||
0x80B279AC:("func_80B279AC",),
|
||||
0x80B279F0:("func_80B279F0",),
|
||||
0x80B27A90:("func_80B27A90",),
|
||||
|
|
|
@ -11293,9 +11293,9 @@
|
|||
0x80A41938:("D_80A41938","f32","",0x4),
|
||||
0x80A41D20:("D_80A41D20","UNK_TYPE1","",0x1),
|
||||
0x80A41D24:("D_80A41D24","UNK_TYPE1","",0x1),
|
||||
0x80A41D28:("sEnTest3_Input","Input","",0x18),
|
||||
0x80A41D40:("D_80A41D40","f32","",0x4),
|
||||
0x80A41D44:("D_80A41D44","UNK_TYPE1","",0x1),
|
||||
0x80A41D28:("sKafeiControlInput","Input","",0x18),
|
||||
0x80A41D40:("sKafeiControlStickMagnitude","f32","",0x4),
|
||||
0x80A41D44:("sKafeiControlStickAngle","UNK_TYPE1","",0x1),
|
||||
0x80A41D48:("D_80A41D48","UNK_TYPE1","",0x1),
|
||||
0x80A41D50:("D_80A41D50","UNK_TYPE1","",0x1),
|
||||
0x80A41D5C:("D_80A41D5C","UNK_TYPE1","",0x1),
|
||||
|
@ -15232,7 +15232,7 @@
|
|||
0x80BA5088:("D_80BA5088","UNK_TYPE1","",0x1),
|
||||
0x80BA50BC:("D_80BA50BC","UNK_TYPE1","",0x1),
|
||||
0x80BA50DC:("D_80BA50DC","UNK_TYPE1","",0x1),
|
||||
0x80BA510C:("D_80BA510C","UNK_TYPE1","",0x1),
|
||||
0x80BA510C:("sPlayerOverrideInputPosList","UNK_TYPE1","",0x1),
|
||||
0x80BA5120:("sOcarinaActionWindFishPrompts","UNK_TYPE2","",0x2),
|
||||
0x80BA5128:("D_80BA5128","UNK_TYPE1","",0x1),
|
||||
0x80BA512C:("D_80BA512C","UNK_PTR","",0x4),
|
||||
|
|
|
@ -248,7 +248,7 @@ asm/non_matchings/code/z_actor/Actor_WorldDistXZToActor.s,Actor_WorldDistXZToAct
|
|||
asm/non_matchings/code/z_actor/Actor_WorldDistXZToPoint.s,Actor_WorldDistXZToPoint,0x800B6E48,0x9
|
||||
asm/non_matchings/code/z_actor/Actor_OffsetOfPointInActorCoords.s,Actor_OffsetOfPointInActorCoords,0x800B6E6C,0x28
|
||||
asm/non_matchings/code/z_actor/Actor_HeightDiff.s,Actor_HeightDiff,0x800B6F0C,0x5
|
||||
asm/non_matchings/code/z_actor/func_800B6F20.s,func_800B6F20,0x800B6F20,0x2A
|
||||
asm/non_matchings/code/z_actor/Actor_SetControlStickData.s,Actor_SetControlStickData,0x800B6F20,0x2A
|
||||
asm/non_matchings/code/z_actor/Player_GetHeight.s,Player_GetHeight,0x800B6FC8,0x32
|
||||
asm/non_matchings/code/z_actor/Player_GetRunSpeedLimit.s,Player_GetRunSpeedLimit,0x800B7090,0x22
|
||||
asm/non_matchings/code/z_actor/func_800B7118.s,func_800B7118,0x800B7118,0x4
|
||||
|
@ -1687,8 +1687,8 @@ asm/non_matchings/code/z_path/func_801225CC.s,func_801225CC,0x801225CC,0x25
|
|||
asm/non_matchings/code/z_pause/func_80122660.s,func_80122660,0x80122660,0x4
|
||||
asm/non_matchings/code/z_pause/func_80122670.s,func_80122670,0x80122670,0x1C
|
||||
asm/non_matchings/code/z_player_lib/func_801226E0.s,func_801226E0,0x801226E0,0x19
|
||||
asm/non_matchings/code/z_player_lib/func_80122744.s,func_80122744,0x80122744,0x7
|
||||
asm/non_matchings/code/z_player_lib/func_80122760.s,func_80122760,0x80122760,0x42
|
||||
asm/non_matchings/code/z_player_lib/Player_InitOverrideInput.s,Player_InitOverrideInput,0x80122744,0x7
|
||||
asm/non_matchings/code/z_player_lib/Player_UpdateOverrideInput.s,Player_UpdateOverrideInput,0x80122760,0x42
|
||||
asm/non_matchings/code/z_player_lib/func_80122868.s,func_80122868,0x80122868,0x4E
|
||||
asm/non_matchings/code/z_player_lib/func_801229A0.s,func_801229A0,0x801229A0,0x13
|
||||
asm/non_matchings/code/z_player_lib/func_801229EC.s,func_801229EC,0x801229EC,0x4
|
||||
|
|
|
Loading…
Reference in New Issue