mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2026-04-29 13:41:51 +00:00
Added scaled radial deadzone to analog cam and fixed issue walking after ledge grabs with analog cam
This commit is contained in:
parent
cb68256151
commit
140ae6cc32
2 changed files with 26 additions and 1 deletions
|
|
@ -1860,10 +1860,16 @@ void analog_cam_post_play_update(PlayState* play) {
|
|||
Camera *active_cam = play->cameraPtrs[play->activeCamId];
|
||||
// recomp_printf("prev_analog_cam_active: %d can_use_analog_cam: %d\n", prev_analog_cam_active, can_use_analog_cam);
|
||||
// recomp_printf("setting: %d mode: %d func: %d\n", active_cam->setting, active_cam->mode, sCameraSettings[active_cam->setting].cameraModes[active_cam->mode].funcId);
|
||||
// recomp_printf("active cam yaw %d\n", Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)));
|
||||
|
||||
// Update parameters for the analog cam if the game is unpaused.
|
||||
if (play->pauseCtx.state == PAUSE_STATE_OFF && R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_OFF) {
|
||||
update_analog_camera_params(active_cam);
|
||||
can_use_analog_cam = false;
|
||||
}
|
||||
|
||||
if (analog_cam_active) {
|
||||
active_cam->inputDir.x = analog_camera_pos.pitch;
|
||||
active_cam->inputDir.y = analog_camera_pos.yaw + DEG_TO_BINANG(180);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,26 @@ extern "C" void recomp_get_camera_inputs(uint8_t* rdram, recomp_context* ctx) {
|
|||
float* x_out = _arg<0, float*>(rdram, ctx);
|
||||
float* y_out = _arg<1, float*>(rdram, ctx);
|
||||
|
||||
recomp::get_right_analog(x_out, y_out);
|
||||
// TODO expose this in the menu
|
||||
constexpr float radial_deadzone = 0.05f;
|
||||
|
||||
float x, y;
|
||||
|
||||
recomp::get_right_analog(&x, &y);
|
||||
|
||||
float magnitude = std::sqrtf(x * x + y * y);
|
||||
|
||||
if (magnitude < radial_deadzone) {
|
||||
*x_out = 0.0f;
|
||||
*y_out = 0.0f;
|
||||
}
|
||||
else {
|
||||
float x_normalized = x / magnitude;
|
||||
float y_normalized = y / magnitude;
|
||||
|
||||
*x_out = x_normalized * ((magnitude - radial_deadzone) / (1 - radial_deadzone));
|
||||
*y_out = y_normalized * ((magnitude - radial_deadzone) / (1 - radial_deadzone));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void recomp_set_right_analog_suppressed(uint8_t* rdram, recomp_context* ctx) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue