From 4ea7283ccac9853e3a583cac06f040636434ebfc Mon Sep 17 00:00:00 2001 From: TeslaRus Date: Thu, 29 Dec 2016 21:38:49 +0400 Subject: [PATCH] walls climbing: fixed hanging to climb on; --- autoexec.lua | 2 +- src/anim_state_control.cpp | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/autoexec.lua b/autoexec.lua index 1056ac3ad..e657c95d6 100644 --- a/autoexec.lua +++ b/autoexec.lua @@ -17,7 +17,7 @@ mlook(1); freelook(0); cam_distance(1024.0); noclip(0); ---loadMap(base_path .. "data/LEVEL1.PHD"); +--loadMap(base_path .. "data/tr1/data/CUT1.PHD"); --loadMap(base_path .. "tests/altroom2/LEVEL1.PHD"); --loadMap(base_path .. "tests/heavy1/LEVEL1.PHD"); --loadMap(base_path .. "tests/TRIGGERS.PHD"); diff --git a/src/anim_state_control.cpp b/src/anim_state_control.cpp index b3ab7288d..97114e79a 100644 --- a/src/anim_state_control.cpp +++ b/src/anim_state_control.cpp @@ -1827,7 +1827,24 @@ int State_Control_Lara(struct entity_s *ent, struct ss_animation_s *ss_anim) ent->dir_flag = ENT_MOVE_FORWARD; if(ss_anim->current_animation != TR_ANIMATION_LARA_LADDER_UP_HANDS) { - Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_LARA_LADDER_UP_HANDS, 0); + if(climb->edge_hit && (climb->next_z_space >= 512.0) && ((climb->next_z_space < ent->character->Height - LARA_HANG_VERTICAL_EPSILON) || (cmd->crouch == 1))) + { + vec3_copy(climb->point, climb->edge_point); + ss_anim->next_state = TR_STATE_LARA_CLIMB_TO_CRAWL; // crawlspace climb + ss_anim->onEndFrame = ent_to_edge_climb; + ent->move_type = MOVE_CLIMBING; + } + else if(climb->edge_hit && (climb->next_z_space >= ent->character->Height - LARA_HANG_VERTICAL_EPSILON)) + { + vec3_copy(climb->point, climb->edge_point); + ss_anim->next_state = (cmd->shift) ? (TR_STATE_LARA_HANDSTAND) : (TR_STATE_LARA_GRABBING); // climb up + ss_anim->onEndFrame = ent_to_edge_climb; + ent->move_type = MOVE_CLIMBING; + } + else + { + Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_LARA_LADDER_UP_HANDS, 0); + } } } else if(cmd->move[0] ==-1) // DOWN @@ -1936,7 +1953,7 @@ int State_Control_Lara(struct entity_s *ent, struct ss_animation_s *ss_anim) vec3_mul_scalar(move, ent->transform + 0, -PENETRATION_TEST_OFFSET); if((Entity_CheckNextPenetration(ent, move, reaction, COLLISION_FILTER_CHARACTER) == 0) || (resp->horizontal_collide == 0x00)) //we only want lara to shimmy when last frame is reached! { - ent->move_type = ENT_MOVE_LEFT; + ent->dir_flag = ENT_MOVE_LEFT; Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_LARA_CLIMB_LEFT, 0); } else @@ -1949,7 +1966,7 @@ int State_Control_Lara(struct entity_s *ent, struct ss_animation_s *ss_anim) vec3_mul_scalar(move, ent->transform + 0, PENETRATION_TEST_OFFSET); if((Entity_CheckNextPenetration(ent, move, reaction, COLLISION_FILTER_CHARACTER) == 0) || (resp->horizontal_collide == 0x00)) //we only want lara to shimmy when last frame is reached! { - ent->move_type = ENT_MOVE_RIGHT; + ent->dir_flag = ENT_MOVE_RIGHT; Entity_SetAnimation(ent, ANIM_TYPE_BASE, TR_ANIMATION_LARA_CLIMB_RIGHT, 0); } else