Fix first person crouching speed and add TOTWC warp

This commit is contained in:
Agent X 2023-12-14 15:22:00 -05:00
parent 1d4bbc52a2
commit 276255a0f1

View file

@ -7,6 +7,8 @@
#include "object_list_processor.h" #include "object_list_processor.h"
#include "object_helpers.h" #include "object_helpers.h"
#include "mario.h" #include "mario.h"
#include "hardcoded.h"
#include "save_file.h"
#include "engine/math_util.h" #include "engine/math_util.h"
@ -104,7 +106,8 @@ void first_person_camera_update(void) {
// update crouch // update crouch
if (mario_is_crouching(m) || m->action == ACT_LEDGE_GRAB) { 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); gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch + inc, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT);
} else { } else {
gFirstPersonCamera.crouch = CLAMP(gFirstPersonCamera.crouch - 10, 0, FIRST_PERSON_MARIO_HEAD_POS - FIRST_PERSON_MARIO_HEAD_POS_SHORT); 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; 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; m->marioBodyState->modelState = 0x100;
if (m->heldObj) { if (m->heldObj) {
Vec3f camDir = { Vec3f camDir = {