From 276255a0f18deaa6b9f35abb98f2f0749bb3bfe1 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Thu, 14 Dec 2023 15:22:00 -0500 Subject: [PATCH] Fix first person crouching speed and add TOTWC warp --- src/game/first_person_cam.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/game/first_person_cam.c b/src/game/first_person_cam.c index 8c9588be7..dd9b3e9e5 100644 --- a/src/game/first_person_cam.c +++ b/src/game/first_person_cam.c @@ -7,6 +7,8 @@ #include "object_list_processor.h" #include "object_helpers.h" #include "mario.h" +#include "hardcoded.h" +#include "save_file.h" #include "engine/math_util.h" @@ -104,7 +106,8 @@ void first_person_camera_update(void) { // update crouch if (mario_is_crouching(m) || m->action == ACT_LEDGE_GRAB) { - f32 inc = 10 * (m->controller->buttonDown & Z_TRIG) != 0 || m->action == ACT_CROUCH_SLIDE || m->action == ACT_LEDGE_GRAB ? 1 : -1; + bool up = (m->controller->buttonDown & Z_TRIG) != 0 || m->action == ACT_CROUCH_SLIDE || m->action == ACT_LEDGE_GRAB; + f32 inc = 10 * (up ? 1 : -1); gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch + inc, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT); } else { gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch - 10, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT); @@ -156,6 +159,14 @@ void first_person_update(void) { m->area->camera->mode = CAMERA_MODE_FREE_ROAM; } + if (gFirstPersonCamera.pitch <= -0x3F00 && + m->floor && m->floor->type == SURFACE_LOOK_UP_WARP && + save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= gLevelValues.wingCapLookUpReq && + m->forwardVel == 0 && + sCurrPlayMode != PLAY_MODE_PAUSED) { + level_trigger_warp(m, WARP_OP_LOOK_UP); + } + m->marioBodyState->modelState = 0x100; if (m->heldObj) { Vec3f camDir = {