2020-12-21 13:16:29 -03:00
|
|
|
#include "framework.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/Lara/lara.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/Lara/lara_basic.h"
|
|
|
|
#include "Game/Lara/lara_helpers.h"
|
|
|
|
#include "Game/Lara/lara_jump.h"
|
|
|
|
#include "Game/Lara/lara_tests.h"
|
|
|
|
#include "Game/Lara/lara_monkey.h"
|
|
|
|
#include "Game/Lara/lara_crawl.h"
|
|
|
|
#include "Game/Lara/lara_objects.h"
|
|
|
|
#include "Game/Lara/lara_hang.h"
|
2022-03-19 02:32:22 +11:00
|
|
|
#include "Game/Lara/lara_helpers.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/Lara/lara_slide.h"
|
|
|
|
#include "Game/Lara/lara_fire.h"
|
|
|
|
#include "Game/Lara/lara_surface.h"
|
|
|
|
#include "Game/Lara/lara_swim.h"
|
|
|
|
#include "Game/Lara/lara_one_gun.h"
|
|
|
|
#include "Game/Lara/lara_cheat.h"
|
|
|
|
#include "Game/Lara/lara_climb.h"
|
2022-03-19 02:32:22 +11:00
|
|
|
#include "Game/Lara/lara_collide.h"
|
2021-12-22 16:26:13 +03:00
|
|
|
#include "Game/Lara/lara_overhang.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/Lara/lara_initialise.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/animation.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/camera.h"
|
|
|
|
#include "Game/collision/collide_item.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/control/flipeffect.h"
|
|
|
|
#include "Game/control/volume.h"
|
2021-11-22 18:55:29 +03:00
|
|
|
#include "Game/effects/lara_fx.h"
|
2021-11-23 02:53:52 +03:00
|
|
|
#include "Game/effects/tomb4fx.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/gui.h"
|
|
|
|
#include "Game/items.h"
|
|
|
|
#include "Game/misc.h"
|
|
|
|
#include "Game/savegame.h"
|
|
|
|
#include "Scripting/GameFlowScript.h"
|
|
|
|
#include "Sound/sound.h"
|
|
|
|
#include "Renderer/Renderer11.h"
|
2021-09-28 13:01:28 +02:00
|
|
|
|
2021-11-22 18:55:29 +03:00
|
|
|
using namespace TEN::Effects::Lara;
|
|
|
|
using namespace TEN::Control::Volumes;
|
2020-12-21 13:16:29 -03:00
|
|
|
using std::function;
|
2021-08-30 18:03:21 +03:00
|
|
|
using TEN::Renderer::g_Renderer;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
LaraInfo Lara;
|
|
|
|
ITEM_INFO* LaraItem;
|
2022-03-14 01:20:51 +11:00
|
|
|
CollisionInfo LaraCollision = {};
|
2020-12-21 13:16:29 -03:00
|
|
|
byte LaraNodeUnderwater[NUM_LARA_MESHES];
|
|
|
|
|
2021-09-15 16:58:53 +03:00
|
|
|
function<LaraRoutineFunction> lara_control_routines[NUM_LARA_STATES + 1] =
|
|
|
|
{
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_walk_forward,
|
|
|
|
lara_as_run_forward,
|
|
|
|
lara_as_idle,
|
2021-12-21 23:07:15 +11:00
|
|
|
lara_as_jump_forward,//33
|
2021-10-31 18:33:39 +11:00
|
|
|
lara_as_pose,//4
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_run_back,//5
|
|
|
|
lara_as_turn_right_slow,//6
|
|
|
|
lara_as_turn_left_slow,//7
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_death,//8
|
2021-12-21 23:29:51 +11:00
|
|
|
lara_as_freefall,//9
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_hang,
|
|
|
|
lara_as_reach,
|
|
|
|
lara_as_splat,
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_as_underwater_idle,//13
|
|
|
|
lara_void_func,//14
|
2021-12-20 00:11:04 +11:00
|
|
|
lara_as_jump_prepare,//15
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_walk_back,//16
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_as_underwater_swim_forward,//17
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_as_underwater_inertia,//18
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,//19
|
2021-10-08 20:08:55 +11:00
|
|
|
lara_as_turn_right_fast,//20
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_step_right,//21
|
|
|
|
lara_as_step_left,//22
|
|
|
|
lara_as_roll_back,
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_as_slide_forward,//24
|
2021-12-22 00:39:03 +11:00
|
|
|
lara_as_jump_back,//25
|
|
|
|
lara_as_jump_right,//26
|
|
|
|
lara_as_jump_left,//27
|
2021-12-22 16:00:13 +11:00
|
|
|
lara_as_jump_up,//28
|
2021-12-20 21:37:38 +11:00
|
|
|
lara_as_fall_back,//29
|
2022-03-06 15:32:11 +11:00
|
|
|
lara_as_shimmy_left,//30
|
|
|
|
lara_as_shimmy_right,//31
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_as_slide_back,//32
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_as_surface_idle,//33
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_as_surface_swim_forward,//34
|
|
|
|
lara_as_surface_dive,//35
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_pushable_push,//36
|
|
|
|
lara_as_pushable_pull,//37
|
|
|
|
lara_as_pushable_grab,//38
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_pickup,//39
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_switch_on,//40
|
|
|
|
lara_as_switch_off,//41
|
|
|
|
lara_as_use_key,//42
|
|
|
|
lara_as_use_puzzle,//43
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_as_underwater_death,//44
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_roll_forward,//45
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_special,//46
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_as_surface_swim_back,//47
|
|
|
|
lara_as_surface_swim_left,//48
|
|
|
|
lara_as_surface_swim_right,//49
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,//50
|
|
|
|
lara_void_func,//51
|
2021-12-28 12:50:04 +11:00
|
|
|
lara_as_swan_dive,//52
|
|
|
|
lara_as_freefall_dive,//53
|
2022-03-06 15:32:11 +11:00
|
|
|
lara_as_handstand,//54
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_as_surface_climb_out,//55
|
2022-03-06 14:43:33 +11:00
|
|
|
lara_as_climb_idle,//56
|
|
|
|
lara_as_climb_up,//57
|
|
|
|
lara_as_climb_left,//58
|
|
|
|
lara_as_climb_end,//59
|
|
|
|
lara_as_climb_right,//60
|
|
|
|
lara_as_climb_down,//61
|
2022-02-17 15:01:48 +11:00
|
|
|
lara_as_auto_jump,//62
|
2022-02-05 23:13:31 +11:00
|
|
|
lara_void_func,//63
|
|
|
|
lara_void_func,//64
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_wade_forward,//65
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_as_underwater_roll_180,//66
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_pickup_flare,//67
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,//68
|
|
|
|
lara_void_func,//69
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_zip_line,//70
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_as_crouch_idle,//71
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_crouch_roll,//72
|
2022-02-05 23:13:31 +11:00
|
|
|
lara_as_sprint,//73
|
|
|
|
lara_as_sprint_dive,//74
|
|
|
|
lara_as_monkey_idle,//75
|
2022-01-12 19:33:41 +11:00
|
|
|
lara_as_monkey_forward,//76
|
2022-01-12 19:58:37 +11:00
|
|
|
lara_as_monkey_shimmy_left,//77
|
|
|
|
lara_as_monkey_shimmy_right,//78
|
2022-01-12 19:04:29 +11:00
|
|
|
lara_as_monkey_turn_180,//79
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_as_crawl_idle,//80
|
|
|
|
lara_as_crawl_forward,//81
|
2022-01-12 19:04:29 +11:00
|
|
|
lara_as_monkey_turn_left,//82
|
|
|
|
lara_as_monkey_turn_right,//83
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_as_crawl_turn_left,//84
|
|
|
|
lara_as_crawl_turn_right,//85
|
|
|
|
lara_as_crawl_back,//86
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,
|
|
|
|
lara_as_controlled_no_look,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_controlled,
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_rope_turn_clockwise,
|
|
|
|
lara_as_rope_turn_counter_clockwise,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_controlled,
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,
|
|
|
|
lara_as_controlled_no_look,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_pickup,//98
|
2021-11-21 20:50:17 +11:00
|
|
|
lara_as_pole_idle,//99
|
|
|
|
lara_as_pole_up,//100
|
|
|
|
lara_as_pole_down,//101
|
|
|
|
lara_as_pole_turn_clockwise,//102
|
|
|
|
lara_as_pole_turn_counter_clockwise,//103
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_pulley,//104
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_as_crouch_turn_left,//105
|
|
|
|
lara_as_crouch_turn_right,//106
|
2021-11-30 03:39:24 +03:00
|
|
|
lara_as_corner,//107
|
|
|
|
lara_as_corner,//108
|
|
|
|
lara_as_corner,//109
|
|
|
|
lara_as_corner,//110
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_rope_idle,//111
|
|
|
|
lara_as_rope_up,//112
|
|
|
|
lara_as_rope_down,//113
|
|
|
|
lara_as_rope_idle,//114
|
|
|
|
lara_as_rope_idle,//115
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_swimcheat,
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_tightrope_idle,//119
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,//120
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_tightrope_walk,//121
|
|
|
|
lara_as_tightrope_fall,//122
|
|
|
|
lara_as_tightrope_fall,//123
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//124
|
2021-09-05 14:49:00 +02:00
|
|
|
#ifdef NEW_TIGHTROPE
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_tightrope_dismount,//125
|
2021-09-05 14:49:00 +02:00
|
|
|
#else // !NEW_TIGHTROPE
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//125
|
2021-09-05 14:49:00 +02:00
|
|
|
#endif
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_switch_on,//126
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//127
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_as_horizontal_bar_swing,//128
|
|
|
|
lara_as_horizontal_bar_leap,//129
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//130
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,//131
|
|
|
|
lara_as_controlled_no_look,//132
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//133
|
|
|
|
lara_as_null,//134
|
|
|
|
lara_as_null,//135
|
|
|
|
lara_as_null,//136
|
|
|
|
lara_as_null,//137
|
|
|
|
lara_as_null,//138
|
2021-12-01 17:18:31 +03:00
|
|
|
lara_as_null,//139
|
|
|
|
lara_as_null,//140
|
|
|
|
lara_as_null,//141
|
|
|
|
lara_as_null,//142
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_as_slopeclimb,//143
|
|
|
|
lara_as_slopeclimbup,//144
|
|
|
|
lara_as_slopeclimbdown,//145
|
2022-02-05 23:13:31 +11:00
|
|
|
lara_as_controlled_no_look,//146
|
|
|
|
lara_as_null,//147
|
|
|
|
lara_as_null,//148
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_as_slopefall,//149
|
2022-03-06 14:43:33 +11:00
|
|
|
lara_as_climb_stepoff_left,
|
|
|
|
lara_as_climb_stepoff_right,
|
2021-10-18 00:33:46 +11:00
|
|
|
lara_as_turn_left_fast,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_controlled,
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_as_controlled,//155
|
|
|
|
lara_as_slopehang,
|
|
|
|
lara_as_slopeshimmy,
|
|
|
|
lara_as_sclimbstart,
|
|
|
|
lara_as_sclimbstop,
|
2022-01-26 21:45:36 +11:00
|
|
|
lara_as_sclimbend,
|
2022-01-27 20:56:05 +11:00
|
|
|
lara_as_null,//161
|
|
|
|
lara_as_null,//162
|
2022-02-04 19:06:59 +11:00
|
|
|
lara_as_monkey_back,//163
|
2022-02-17 15:01:48 +11:00
|
|
|
lara_as_vault,//164
|
|
|
|
lara_as_vault,//165
|
|
|
|
lara_as_vault,//166
|
|
|
|
lara_as_vault,//167
|
|
|
|
lara_as_vault,//168
|
|
|
|
lara_as_vault,//169
|
2022-02-16 14:20:26 +11:00
|
|
|
lara_as_idle,//170
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
2021-09-15 16:58:53 +03:00
|
|
|
|
2021-12-21 23:07:15 +11:00
|
|
|
function<LaraRoutineFunction> lara_collision_routines[NUM_LARA_STATES + 1] =
|
|
|
|
{
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_walk_forward,
|
|
|
|
lara_col_run_forward,
|
|
|
|
lara_col_idle,
|
2021-12-21 23:07:15 +11:00
|
|
|
lara_col_jump_forward,//3
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_col_idle,//4
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_run_back,
|
|
|
|
lara_col_turn_right_slow,
|
|
|
|
lara_col_turn_left_slow,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_death,
|
2021-12-21 23:29:51 +11:00
|
|
|
lara_col_freefall,//9
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_hang,
|
|
|
|
lara_col_reach,
|
|
|
|
lara_col_splat,
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_col_underwater_idle,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_land,
|
2021-12-20 00:11:04 +11:00
|
|
|
lara_col_jump_prepare,//15
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_walk_back,
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_col_underwater_swim_forward,
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_col_underwater_inertia,
|
2022-02-07 13:06:02 +11:00
|
|
|
lara_default_col,//19
|
2021-10-08 20:08:55 +11:00
|
|
|
lara_col_turn_right_fast,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_step_right,
|
|
|
|
lara_col_step_left,
|
|
|
|
lara_col_roll_back,
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_col_slide_forward,//24
|
2021-12-22 00:39:03 +11:00
|
|
|
lara_col_jump_back,//25
|
|
|
|
lara_col_jump_right,//26
|
|
|
|
lara_col_jump_left,//27
|
2021-12-22 16:00:13 +11:00
|
|
|
lara_col_jump_up,//28
|
2021-12-20 21:37:38 +11:00
|
|
|
lara_col_fall_back,//29
|
2022-03-06 15:32:11 +11:00
|
|
|
lara_col_shimmy_left,
|
|
|
|
lara_col_shimmy_right,
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_col_slide_back,//32
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_col_surface_idle,//33
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_col_surface_swim_forward,//34
|
|
|
|
lara_col_surface_dive,//35
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_col_underwater_death,//44
|
|
|
|
lara_col_roll_forward,//45
|
|
|
|
lara_void_func,//46
|
|
|
|
lara_col_surface_swim_back,//47
|
|
|
|
lara_col_surface_swim_left,//48
|
|
|
|
lara_col_surface_swim_right,//49
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-12-28 12:50:04 +11:00
|
|
|
lara_col_swan_dive,//52
|
|
|
|
lara_col_freefall_dive,//53
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
2022-03-18 02:35:03 +11:00
|
|
|
lara_default_col,//55
|
2022-03-06 14:43:33 +11:00
|
|
|
lara_col_climb_idle,
|
|
|
|
lara_col_climb_up,
|
|
|
|
lara_col_climb_left,
|
|
|
|
lara_col_climb_end,
|
|
|
|
lara_col_climb_right,
|
|
|
|
lara_col_climb_down,
|
2022-02-17 15:01:48 +11:00
|
|
|
lara_void_func,//62
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_wade_forward,
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_col_underwater_roll_180,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_col_crouch_idle,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_crouch_roll,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_sprint,
|
2021-12-02 18:52:00 +11:00
|
|
|
lara_col_sprint_dive,
|
2021-12-01 11:59:24 +03:00
|
|
|
lara_col_monkey_idle,
|
2022-01-12 19:33:41 +11:00
|
|
|
lara_col_monkey_forward,//76
|
2022-01-12 19:58:37 +11:00
|
|
|
lara_col_monkey_shimmy_left,//77
|
|
|
|
lara_col_monkey_shimmy_right,//78
|
2022-01-12 19:04:29 +11:00
|
|
|
lara_col_monkey_turn_180,//79
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_col_crawl_idle,
|
|
|
|
lara_col_crawl_forward,
|
2022-01-12 19:04:29 +11:00
|
|
|
lara_col_monkey_turn_left,//81
|
|
|
|
lara_col_monkey_turn_right,//82
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_col_crawl_turn_left,
|
|
|
|
lara_col_crawl_turn_right,
|
|
|
|
lara_col_crawl_back,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
2021-12-04 14:41:17 +11:00
|
|
|
lara_col_crawl_to_hang,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_default_col,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_col_turn_switch,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_default_col,
|
2021-11-21 20:50:17 +11:00
|
|
|
lara_col_pole_idle,
|
|
|
|
lara_col_pole_up,
|
|
|
|
lara_col_pole_down,
|
|
|
|
lara_col_pole_turn_clockwise,
|
|
|
|
lara_col_pole_turn_counter_clockwise,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_col_crouch_turn_left,
|
|
|
|
lara_col_crouch_turn_right,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_col_rope_idle,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2022-02-21 20:27:30 +11:00
|
|
|
lara_col_rope_swing,
|
|
|
|
lara_col_rope_swing,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2022-03-17 18:57:46 +11:00
|
|
|
lara_col_underwater_swim_forward,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-12-01 17:18:31 +03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_col_slopeclimb,
|
|
|
|
lara_default_col, // lara_col_slopeclimbup
|
|
|
|
lara_default_col, // lara_col_slopeclimbdown
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_default_col, // lara_col_slopefall
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_default_col,
|
2021-10-08 20:08:55 +11:00
|
|
|
lara_default_col,
|
2021-10-18 00:33:46 +11:00
|
|
|
lara_col_turn_left_fast,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
2021-12-21 18:34:44 +03:00
|
|
|
lara_default_col,
|
|
|
|
lara_col_slopehang, // lara_col_slopehang
|
|
|
|
lara_col_slopeshimmy, // lara_col_slopeshimmy
|
|
|
|
lara_default_col, // lara_col_sclimbstart
|
|
|
|
lara_default_col, // lara_col_sclimbstop
|
2022-01-26 21:45:36 +11:00
|
|
|
lara_default_col, // lara_col_sclimbend
|
|
|
|
lara_void_func,//161
|
|
|
|
lara_void_func,//162
|
2022-02-04 19:06:59 +11:00
|
|
|
lara_col_monkey_back,//163
|
2022-02-17 15:01:48 +11:00
|
|
|
lara_void_func,//164
|
|
|
|
lara_void_func,//165
|
|
|
|
lara_void_func,//166
|
|
|
|
lara_void_func,//167
|
|
|
|
lara_void_func,//168
|
|
|
|
lara_void_func,//169
|
2022-02-16 14:20:26 +11:00
|
|
|
lara_col_idle,//170
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
void LaraControl(ITEM_INFO* item, CollisionInfo* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
auto* lara = GetLaraInfo(item);
|
2021-11-26 00:28:29 +11:00
|
|
|
|
2022-03-09 17:04:19 +11:00
|
|
|
if (lara->Control.Weapon.HasFired)
|
2021-09-16 01:12:19 +03:00
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
AlertNearbyGuards(item);
|
2022-03-09 17:04:19 +11:00
|
|
|
lara->Control.Weapon.HasFired = false;
|
2021-09-16 01:12:19 +03:00
|
|
|
}
|
|
|
|
|
2022-03-09 17:04:19 +11:00
|
|
|
if (lara->PoisonPotency)
|
2021-09-16 01:12:19 +03:00
|
|
|
{
|
2022-03-09 17:04:19 +11:00
|
|
|
if (lara->PoisonPotency > LARA_POISON_POTENCY_MAX)
|
|
|
|
lara->PoisonPotency = LARA_POISON_POTENCY_MAX;
|
2021-09-16 01:12:19 +03:00
|
|
|
|
2022-03-09 17:04:19 +11:00
|
|
|
if (!(Wibble & 0xFF))
|
|
|
|
item->HitPoints -= lara->PoisonPotency;
|
2021-09-16 01:12:19 +03:00
|
|
|
}
|
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Control.IsMoving)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-03-17 18:57:46 +11:00
|
|
|
if (lara->Control.Count.PositionAdjust > LARA_POSITION_ADJUST_MAX_TIME)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.IsMoving = false;
|
|
|
|
lara->Control.HandStatus = HandStatus::Free;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
++lara->Control.Count.PositionAdjust;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (!lara->Control.Locked)
|
2022-03-09 17:04:19 +11:00
|
|
|
lara->LocationPad = 128;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
int oldX = item->Position.xPos;
|
|
|
|
int oldY = item->Position.yPos;
|
|
|
|
int oldZ = item->Position.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-26 14:51:50 +11:00
|
|
|
// Set hands free failsafe.
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Control.HandStatus == HandStatus::Busy &&
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.ActiveState == LS_IDLE &&
|
|
|
|
item->Animation.TargetState == LS_IDLE &&
|
|
|
|
item->Animation.AnimNumber == LA_STAND_IDLE &&
|
|
|
|
!item->Animation.Airborne)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.HandStatus = HandStatus::Free;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
if (lara->SprintEnergy < LARA_SPRINT_MAX && item->Animation.ActiveState != LS_SPRINT)
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->SprintEnergy++;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.IsLow = false;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-25 18:02:22 +11:00
|
|
|
bool isWater = TestEnvironment(ENV_FLAG_WATER, item);
|
|
|
|
bool isSwamp = TestEnvironment(ENV_FLAG_SWAMP, item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-01 21:46:58 +11:00
|
|
|
int waterDepth = GetWaterDepth(item);
|
|
|
|
int waterHeight = GetWaterHeight(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
int heightFromWater;
|
|
|
|
if (waterHeight != NO_HEIGHT)
|
2022-02-09 16:55:46 +11:00
|
|
|
heightFromWater = item->Position.yPos - waterHeight;
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-09 16:03:56 +11:00
|
|
|
heightFromWater = NO_HEIGHT;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->WaterSurfaceDist = -heightFromWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Vehicle == NO_ITEM)
|
2021-11-09 16:03:56 +11:00
|
|
|
WadeSplash(item, waterHeight, waterDepth);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Vehicle == NO_ITEM && lara->ExtraAnim == -1)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
switch (lara->Control.WaterStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::Dry:
|
2021-11-09 16:03:56 +11:00
|
|
|
if (heightFromWater == NO_HEIGHT || heightFromWater < WADE_DEPTH)
|
2021-11-07 04:54:48 +03:00
|
|
|
break;
|
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
Camera.targetElevation = -ANGLE(22.0f);
|
|
|
|
|
2021-12-15 13:44:05 +11:00
|
|
|
// Water is deep enough to swim; dispatch dive.
|
2022-03-19 22:55:23 +11:00
|
|
|
if (waterDepth >= SWIM_DEPTH && !isSwamp)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-07 16:07:16 +03:00
|
|
|
if (isWater)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-03-19 22:55:23 +11:00
|
|
|
item->Position.yPos += 100;
|
|
|
|
item->Animation.Airborne = false;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air = LARA_AIR_MAX;
|
|
|
|
lara->Control.WaterStatus = WaterStatus::Underwater;
|
2021-11-07 04:54:48 +03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
UpdateItemRoom(item, 0);
|
2021-11-07 16:07:16 +03:00
|
|
|
StopSoundEffect(SFX_TR4_LARA_FALL);
|
2021-11-07 04:54:48 +03:00
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
if (item->Animation.ActiveState == LS_SWAN_DIVE)
|
2021-11-07 16:07:16 +03:00
|
|
|
{
|
2022-03-19 02:32:22 +11:00
|
|
|
SetAnimation(item, LA_SWANDIVE_DIVE);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.xRot = -ANGLE(45.0f);
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity *= 2;
|
2022-03-19 02:32:22 +11:00
|
|
|
lara->Control.HandStatus = HandStatus::Free;
|
2021-11-07 16:07:16 +03:00
|
|
|
}
|
2022-03-13 02:04:24 +11:00
|
|
|
else if (item->Animation.ActiveState == LS_FREEFALL_DIVE)
|
2021-11-07 16:07:16 +03:00
|
|
|
{
|
2022-03-19 02:32:22 +11:00
|
|
|
SetAnimation(item, LA_SWANDIVE_DIVE);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.xRot = -ANGLE(85.0f);
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity *= 2;
|
2022-03-19 02:32:22 +11:00
|
|
|
lara->Control.HandStatus = HandStatus::Free;
|
2021-11-07 16:07:16 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_FREEFALL_DIVE);
|
2022-03-19 02:32:22 +11:00
|
|
|
item->Position.xRot = -ANGLE(45.0f);
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity = 3 * item->Animation.VerticalVelocity / 2;
|
2021-11-07 16:07:16 +03:00
|
|
|
}
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2021-11-09 16:03:56 +11:00
|
|
|
Splash(item);
|
2021-11-07 04:54:48 +03:00
|
|
|
}
|
|
|
|
}
|
2021-12-15 13:44:05 +11:00
|
|
|
// Water is at wade depth; update water status and do special handling.
|
|
|
|
else if (heightFromWater >= WADE_DEPTH)
|
2021-11-07 04:54:48 +03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Wade;
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2022-02-13 15:58:12 +11:00
|
|
|
// Make splash ONLY within this particular threshold before swim depth while airborne (WadeSplash() above interferes otherwise).
|
2022-02-01 21:46:58 +11:00
|
|
|
if (waterDepth > (SWIM_DEPTH - CLICK(1)) &&
|
2022-03-19 02:32:22 +11:00
|
|
|
item->Animation.Airborne && !isSwamp)
|
2021-12-14 23:45:03 +11:00
|
|
|
{
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.TargetState = LS_IDLE;
|
2022-03-19 02:32:22 +11:00
|
|
|
Splash(item);
|
2021-12-14 23:45:03 +11:00
|
|
|
}
|
2021-12-21 23:07:15 +11:00
|
|
|
// Lara is grounded; don't splash again.
|
2022-03-13 02:04:24 +11:00
|
|
|
else if (!item->Animation.Airborne)
|
|
|
|
item->Animation.TargetState = LS_IDLE;
|
2021-11-07 04:54:48 +03:00
|
|
|
else if (isSwamp)
|
|
|
|
{
|
2022-03-13 02:04:24 +11:00
|
|
|
if (item->Animation.ActiveState == LS_SWAN_DIVE ||
|
|
|
|
item->Animation.ActiveState == LS_FREEFALL_DIVE)
|
2021-11-09 20:03:40 +11:00
|
|
|
{
|
2022-03-18 19:49:25 +11:00
|
|
|
item->Position.yPos = waterHeight + (SECTOR(1) - 24);
|
2021-11-10 23:27:37 +11:00
|
|
|
}
|
2021-11-07 04:54:48 +03:00
|
|
|
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_WADE);
|
2021-11-07 04:54:48 +03:00
|
|
|
}
|
|
|
|
}
|
2021-12-14 14:35:42 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::Underwater:
|
2021-11-09 16:03:56 +11:00
|
|
|
if (isWater ||
|
2022-03-19 22:55:23 +11:00
|
|
|
waterDepth == DEEP_WATER || abs(heightFromWater) >= CLICK(1) ||
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.AnimNumber == LA_UNDERWATER_RESURFACE ||
|
|
|
|
item->Animation.AnimNumber == LA_ONWATER_DIVE)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
if (!isWater)
|
|
|
|
{
|
2022-02-01 21:46:58 +11:00
|
|
|
if (waterDepth == DEEP_WATER || abs(heightFromWater) >= CLICK(1))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_FALL_START);
|
2022-03-19 02:32:22 +11:00
|
|
|
ResetLaraLean(item);
|
|
|
|
ResetLaraFlex(item);
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.Velocity = item->Animation.VerticalVelocity / 4;
|
|
|
|
item->Animation.VerticalVelocity = 0;
|
|
|
|
item->Animation.Airborne = true;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Dry;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_RESURFACE);
|
2022-03-19 02:32:22 +11:00
|
|
|
ResetLaraLean(item);
|
|
|
|
ResetLaraFlex(item);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.yPos = waterHeight;
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity = 0;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::TreadWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
UpdateItemRoom(item, -(STEPUP_HEIGHT - 3));
|
2022-02-09 16:55:46 +11:00
|
|
|
SoundEffect(SFX_TR4_LARA_BREATH, &item->Position, 2);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_RESURFACE);
|
2022-03-19 22:55:23 +11:00
|
|
|
ResetLaraLean(item);
|
|
|
|
ResetLaraFlex(item);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.yPos = waterHeight + 1;
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity = 0;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::TreadWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-17 15:32:55 +03:00
|
|
|
UpdateItemRoom(item, 0);
|
2022-02-09 16:55:46 +11:00
|
|
|
SoundEffect(SFX_TR4_LARA_BREATH, &item->Position, 2);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2022-02-14 17:05:52 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-12 00:25:05 +11:00
|
|
|
case WaterStatus::TreadWater:
|
2020-12-21 13:16:29 -03:00
|
|
|
if (!isWater)
|
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
if (heightFromWater <= WADE_DEPTH)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_FALL_START);
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.Velocity = item->Animation.VerticalVelocity / 4;
|
|
|
|
item->Animation.Airborne = true;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Dry;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_STAND_IDLE);
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Wade;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-02-14 17:05:52 +11:00
|
|
|
ResetLaraLean(item);
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2022-03-19 02:32:22 +11:00
|
|
|
item->Animation.VerticalVelocity = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::Wade:
|
2021-11-09 16:03:56 +11:00
|
|
|
Camera.targetElevation = -ANGLE(22.0f);
|
|
|
|
|
|
|
|
if (heightFromWater >= WADE_DEPTH)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
if (heightFromWater > SWIM_DEPTH && !isSwamp)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_ONWATER_IDLE);
|
2022-03-19 02:32:22 +11:00
|
|
|
ResetLaraLean(item);
|
|
|
|
ResetLaraFlex(item);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.yPos += 1 - heightFromWater;
|
2022-03-13 02:04:24 +11:00
|
|
|
item->Animation.VerticalVelocity = 0;
|
|
|
|
item->Animation.Airborne = false;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::TreadWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-17 15:32:55 +03:00
|
|
|
UpdateItemRoom(item, 0);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Dry;
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
if (item->Animation.ActiveState == LS_WADE_FORWARD)
|
|
|
|
item->Animation.TargetState = LS_RUN_FORWARD;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
if (item->HitPoints <= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints = -1;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Control.Count.Death == 0)
|
2021-09-16 01:12:19 +03:00
|
|
|
StopSoundTracks();
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.Count.Death++;
|
2022-02-09 16:55:46 +11:00
|
|
|
if ((item->Flags & 0x100))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.Count.Death++;
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
switch (lara->Control.WaterStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::Dry:
|
|
|
|
case WaterStatus::Wade:
|
2022-02-28 21:02:19 +11:00
|
|
|
if (isSwamp && lara->WaterSurfaceDist < -(LARA_HEIGHT + 8)) // TODO: Find best height. @Sezz 2021.11.10
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-09 16:55:46 +11:00
|
|
|
if (item->HitPoints >= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air -= 6;
|
|
|
|
if (lara->Air < 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air = -1;
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints -= 10;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-28 21:02:19 +11:00
|
|
|
else if (lara->Air < LARA_AIR_MAX && item->HitPoints >= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Vehicle == NO_ITEM) // only for the upv !!
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air += 10;
|
|
|
|
if (lara->Air > LARA_AIR_MAX)
|
|
|
|
lara->Air = LARA_AIR_MAX;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
|
|
|
LaraAboveWater(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::Underwater:
|
2022-02-09 16:55:46 +11:00
|
|
|
if (item->HitPoints >= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-14 17:05:52 +11:00
|
|
|
auto* level = g_GameFlow->GetLevel(CurrentLevel);
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType != LaraType::Divesuit)
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air--;
|
2021-11-11 01:16:27 +03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Air < 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
// if (LaraDrawType == LARA_TYPE::DIVESUIT && lara->anxiety < 251)
|
|
|
|
// lara->anxiety += 4;
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints -= 5;
|
2022-03-19 22:55:23 +11:00
|
|
|
lara->Air = -1;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
LaraUnderwater(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-12 00:25:05 +11:00
|
|
|
case WaterStatus::TreadWater:
|
2022-02-09 16:55:46 +11:00
|
|
|
if (item->HitPoints >= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Air += 10;
|
|
|
|
if (lara->Air > LARA_AIR_MAX)
|
|
|
|
lara->Air = LARA_AIR_MAX;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
LaraWaterSurface(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
2022-02-11 01:31:54 +11:00
|
|
|
case WaterStatus::FlyCheat:
|
2021-11-09 16:03:56 +11:00
|
|
|
LaraCheat(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-10-31 21:36:13 +03:00
|
|
|
Statistics.Game.Distance += sqrt(
|
2022-02-28 21:02:19 +11:00
|
|
|
pow(item->Position.xPos - oldX, 2) +
|
|
|
|
pow(item->Position.yPos - oldY, 2) +
|
|
|
|
pow(item->Position.zPos - oldZ, 2));
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
void LaraAboveWater(ITEM_INFO* item, CollisionInfo* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
auto* lara = GetLaraInfo(item);
|
2021-11-19 22:48:47 +11:00
|
|
|
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.UpperCeilingBound = NO_UPPER_BOUND;
|
2022-01-23 18:16:29 +11:00
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
coll->Setup.OldPosition.x = item->Position.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->Position.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->Position.zPos;
|
2022-03-13 02:04:24 +11:00
|
|
|
coll->Setup.OldState = item->Animation.ActiveState;
|
|
|
|
coll->Setup.OldAnimNumber = item->Animation.AnimNumber;
|
|
|
|
coll->Setup.OldFrameNumber = item->Animation.FrameNumber;
|
2021-10-09 19:19:02 +03:00
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = true;
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.EnableSpasm = true;
|
|
|
|
coll->Setup.FloorSlopeIsWall = false;
|
|
|
|
coll->Setup.FloorSlopeIsPit = false;
|
|
|
|
coll->Setup.CeilingSlopeIsWall = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2022-01-16 22:57:14 +11:00
|
|
|
coll->Setup.NoMonkeyFlagIsWall = false;
|
2022-03-13 02:04:24 +11:00
|
|
|
coll->Setup.Mode = CollisionProbeMode::Quadrants;
|
2021-10-09 19:19:02 +03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (TrInput & IN_LOOK && lara->Control.CanLook &&
|
|
|
|
lara->ExtraAnim == NO_ITEM)
|
2021-11-10 16:11:36 +11:00
|
|
|
{
|
2022-02-16 18:13:07 +11:00
|
|
|
LookLeftRight(item);
|
2021-11-10 16:11:36 +11:00
|
|
|
}
|
2021-12-10 22:31:34 +11:00
|
|
|
else if (coll->Setup.Height > LARA_HEIGHT - LARA_HEADROOM) // TEMP HACK: Look feature will need a dedicated refactor; ResetLook() interferes with crawl flexing. @Sezz 2021.12.10
|
2021-11-27 20:35:16 +11:00
|
|
|
ResetLook(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-19 22:55:23 +11:00
|
|
|
// TODO: Move radius and height default resets above look checks once look feature is refactored.
|
2021-12-10 22:31:34 +11:00
|
|
|
coll->Setup.Radius = LARA_RAD;
|
|
|
|
coll->Setup.Height = LARA_HEIGHT;
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.CanLook = true;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-10-01 10:40:29 +03:00
|
|
|
UpdateItemRoom(item, -LARA_HEIGHT / 2);
|
|
|
|
|
2021-11-04 18:31:17 +11:00
|
|
|
// Process vehicles.
|
2022-02-20 14:22:26 +11:00
|
|
|
if (HandleLaraVehicle(item, coll))
|
|
|
|
return;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-12-20 00:11:04 +11:00
|
|
|
// Temp. debug stuff
|
|
|
|
//---
|
|
|
|
|
2022-01-23 15:06:05 +11:00
|
|
|
// Kill Lara.
|
2022-01-19 22:45:38 +11:00
|
|
|
if (KeyMap[DIK_D])
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints = 0;
|
2022-01-19 22:45:38 +11:00
|
|
|
|
2022-01-23 15:06:05 +11:00
|
|
|
// Say no.
|
|
|
|
static bool dbNo = false;
|
|
|
|
if (KeyMap[DIK_N] && !dbNo)
|
|
|
|
SayNo();
|
|
|
|
dbNo = KeyMap[DIK_N] ? true : false;
|
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
static PHD_3DPOS posO = item->Position;
|
|
|
|
static short roomNumO = item->RoomNumber;
|
2021-12-20 00:11:04 +11:00
|
|
|
static CAMERA_INFO camO = Camera;
|
|
|
|
|
2022-01-23 15:06:05 +11:00
|
|
|
// Save position.
|
2021-12-20 00:11:04 +11:00
|
|
|
if (KeyMap[DIK_Q] && TrInput & IN_WALK)
|
|
|
|
{
|
2022-02-09 16:55:46 +11:00
|
|
|
posO = item->Position;
|
|
|
|
roomNumO = item->RoomNumber;
|
2021-12-20 00:11:04 +11:00
|
|
|
camO = Camera;
|
|
|
|
}
|
2022-01-23 15:06:05 +11:00
|
|
|
|
|
|
|
// Restore position.
|
|
|
|
if (KeyMap[DIK_E])
|
2021-12-20 00:11:04 +11:00
|
|
|
{
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position = posO;
|
|
|
|
item->RoomNumber = roomNumO;
|
2021-12-20 00:11:04 +11:00
|
|
|
Camera = camO;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Forward 1 unit.
|
|
|
|
if (KeyMap[DIK_I])
|
2022-03-03 15:10:07 +11:00
|
|
|
MoveItem(item, item->Position.yRot, 1);
|
2021-12-20 00:11:04 +11:00
|
|
|
// Back 1 unit.
|
|
|
|
else if (KeyMap[DIK_K])
|
2022-03-03 15:10:07 +11:00
|
|
|
MoveItem(item, item->Position.yRot + ANGLE(180.0f), 1);
|
2021-12-20 00:11:04 +11:00
|
|
|
// Left 1 unit.
|
|
|
|
else if (KeyMap[DIK_J])
|
2022-03-03 15:10:07 +11:00
|
|
|
MoveItem(item, item->Position.yRot - ANGLE(90.0f), 1);
|
2021-12-20 00:11:04 +11:00
|
|
|
// Right 1 unit.
|
|
|
|
else if (KeyMap[DIK_L])
|
2022-03-03 15:10:07 +11:00
|
|
|
MoveItem(item, item->Position.yRot + ANGLE(90.0f), 1);
|
2021-12-20 00:11:04 +11:00
|
|
|
|
|
|
|
//---
|
|
|
|
|
2022-01-17 17:09:21 +11:00
|
|
|
// Temp. debug stuff.
|
|
|
|
static bool doRoutines = true;
|
|
|
|
static bool dbT = false;
|
|
|
|
if (KeyMap[DIK_T] && !dbT)
|
|
|
|
doRoutines = !doRoutines;
|
|
|
|
dbT = KeyMap[DIK_T] ? true : false;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-17 17:09:21 +11:00
|
|
|
static bool dbU = false;
|
|
|
|
if (doRoutines || KeyMap[DIK_U] && !dbU)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-03-22 20:41:01 +11:00
|
|
|
HandleLaraMovementParameters(item, coll);
|
|
|
|
|
2022-01-18 16:52:52 +11:00
|
|
|
// Handle current Lara status.
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_control_routines[item->Animation.ActiveState](item, coll);
|
2022-01-18 16:52:52 +11:00
|
|
|
|
2022-01-17 17:09:21 +11:00
|
|
|
AnimateLara(item);
|
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->ExtraAnim == -1)
|
2022-01-17 17:09:21 +11:00
|
|
|
{
|
|
|
|
// Check for collision with items.
|
|
|
|
DoObjectCollision(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-17 17:09:21 +11:00
|
|
|
// Handle Lara collision.
|
2022-02-28 21:02:19 +11:00
|
|
|
if (lara->Vehicle == NO_ITEM)
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_collision_routines[item->Animation.ActiveState](item, coll);
|
2022-01-17 17:09:21 +11:00
|
|
|
}
|
2022-03-10 02:27:11 +11:00
|
|
|
|
|
|
|
lara->ExtraVelocity = PHD_VECTOR();
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2022-01-17 17:09:21 +11:00
|
|
|
dbU = KeyMap[DIK_U] ? true : false;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-09 20:37:26 +11:00
|
|
|
//if (lara->gunType == LaraWeaponType::Crossbow && !LaserSight)
|
2020-12-21 13:16:29 -03:00
|
|
|
// TrInput &= ~IN_ACTION;
|
|
|
|
|
2021-11-04 18:31:17 +11:00
|
|
|
// Handle weapons.
|
2021-11-20 15:39:05 +11:00
|
|
|
LaraGun(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-23 12:43:20 +11:00
|
|
|
// Handle breath.
|
2021-11-22 18:55:29 +03:00
|
|
|
LaraBreath(item);
|
|
|
|
|
2021-11-04 18:31:17 +11:00
|
|
|
// Test for flags and triggers.
|
2021-08-26 12:12:05 +03:00
|
|
|
ProcessSectorFlags(item);
|
2021-09-15 16:58:53 +03:00
|
|
|
TestTriggers(item, false);
|
2021-08-30 15:35:00 +03:00
|
|
|
TestVolumes(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
void LaraWaterSurface(ITEM_INFO* item, CollisionInfo* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
auto* lara = GetLaraInfo(item);
|
2021-11-26 00:28:29 +11:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
Camera.targetElevation = -ANGLE(22.0f);
|
|
|
|
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.LowerFloorBound = NO_LOWER_BOUND;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.UpperFloorBound = -CLICK(0.5f);
|
|
|
|
coll->Setup.LowerCeilingBound = LARA_RAD;
|
2022-02-01 21:46:58 +11:00
|
|
|
coll->Setup.UpperCeilingBound = NO_UPPER_BOUND;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
coll->Setup.OldPosition.x = item->Position.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->Position.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->Position.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.FloorSlopeIsWall = false;
|
|
|
|
coll->Setup.FloorSlopeIsPit = false;
|
|
|
|
coll->Setup.CeilingSlopeIsWall = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2022-01-16 22:57:14 +11:00
|
|
|
coll->Setup.NoMonkeyFlagIsWall = false;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.EnableObjectPush = false;
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.EnableSpasm = false;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.Mode = CollisionProbeMode::FreeForward;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.Radius = LARA_RAD;
|
|
|
|
coll->Setup.Height = LARA_HEIGHT_SURFACE;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (TrInput & IN_LOOK && lara->Control.CanLook)
|
2022-02-16 18:13:07 +11:00
|
|
|
LookLeftRight(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-27 20:35:16 +11:00
|
|
|
ResetLook(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.CanLook = true;
|
|
|
|
lara->Control.Count.Pose = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_control_routines[item->Animation.ActiveState](item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
// Reset turn rate.
|
|
|
|
int sign = copysign(1, lara->Control.TurnRate);
|
|
|
|
if (abs(lara->Control.TurnRate) > ANGLE(2.0f))
|
|
|
|
lara->Control.TurnRate -= ANGLE(2.0f) * sign;
|
|
|
|
else if (abs(lara->Control.TurnRate) > ANGLE(0.5f))
|
|
|
|
lara->Control.TurnRate -= ANGLE(0.5f) * sign;
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.TurnRate = 0;
|
|
|
|
item->Position.yRot += lara->Control.TurnRate;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-19 22:55:23 +11:00
|
|
|
// Reset lean.
|
2022-02-28 21:02:19 +11:00
|
|
|
if (!lara->Control.IsMoving && !(TrInput & (IN_LEFT | IN_RIGHT)))
|
2022-03-19 22:55:23 +11:00
|
|
|
ResetLaraLean(item, 8.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-09 17:04:19 +11:00
|
|
|
if (lara->WaterCurrentActive && lara->Control.WaterStatus != WaterStatus::FlyCheat)
|
2022-02-15 20:36:27 +11:00
|
|
|
LaraWaterCurrent(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
AnimateLara(item);
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
item->Position.xPos += item->Animation.VerticalVelocity * phd_sin(lara->Control.MoveAngle) / 4;
|
|
|
|
item->Position.zPos += item->Animation.VerticalVelocity * phd_cos(lara->Control.MoveAngle) / 4;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-02 11:20:41 +03:00
|
|
|
DoObjectCollision(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
if (lara->Vehicle == NO_ITEM)
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_collision_routines[item->Animation.ActiveState](item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-10 02:27:11 +11:00
|
|
|
lara->ExtraVelocity = PHD_VECTOR();
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
UpdateItemRoom(item, LARA_RAD);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-20 15:39:05 +11:00
|
|
|
LaraGun(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-08-26 12:12:05 +03:00
|
|
|
ProcessSectorFlags(item);
|
2021-09-15 16:58:53 +03:00
|
|
|
TestTriggers(item, false);
|
2021-08-30 15:35:00 +03:00
|
|
|
TestVolumes(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
void LaraUnderwater(ITEM_INFO* item, CollisionInfo* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
auto* lara = GetLaraInfo(item);
|
2021-11-26 00:28:29 +11:00
|
|
|
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.LowerFloorBound = NO_LOWER_BOUND;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.UpperFloorBound = -(LARA_RAD_UNDERWATER + (LARA_RAD_UNDERWATER / 3));
|
|
|
|
coll->Setup.LowerCeilingBound = LARA_RAD_UNDERWATER + (LARA_RAD_UNDERWATER / 3);
|
2022-02-01 21:46:58 +11:00
|
|
|
coll->Setup.UpperCeilingBound = NO_UPPER_BOUND;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
coll->Setup.OldPosition.x = item->Position.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->Position.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->Position.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.FloorSlopeIsWall = false;
|
|
|
|
coll->Setup.FloorSlopeIsPit = false;
|
|
|
|
coll->Setup.CeilingSlopeIsWall = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2022-01-16 22:57:14 +11:00
|
|
|
coll->Setup.NoMonkeyFlagIsWall = false;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.EnableObjectPush = true;
|
2022-01-30 14:43:33 +11:00
|
|
|
coll->Setup.EnableSpasm = false;
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.Mode = CollisionProbeMode::Quadrants;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
coll->Setup.Radius = LARA_RAD_UNDERWATER;
|
|
|
|
coll->Setup.Height = LARA_HEIGHT;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (TrInput & IN_LOOK && lara->Control.CanLook)
|
2022-02-16 18:13:07 +11:00
|
|
|
LookLeftRight(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-27 20:35:16 +11:00
|
|
|
ResetLook(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.CanLook = true;
|
|
|
|
lara->Control.Count.Pose = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_control_routines[item->Animation.ActiveState](item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-19 02:32:22 +11:00
|
|
|
auto* level = g_GameFlow->GetLevel(CurrentLevel);
|
2022-03-18 19:49:25 +11:00
|
|
|
|
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
|
|
|
{
|
|
|
|
if (lara->Control.TurnRate < -ANGLE(0.5f))
|
|
|
|
lara->Control.TurnRate += ANGLE(0.5f);
|
|
|
|
else if (lara->Control.TurnRate > ANGLE(0.5f))
|
|
|
|
lara->Control.TurnRate -= ANGLE(0.5f);
|
|
|
|
else
|
|
|
|
lara->Control.TurnRate = 0;
|
|
|
|
}
|
|
|
|
else if (lara->Control.TurnRate < -ANGLE(2.0f))
|
|
|
|
lara->Control.TurnRate += ANGLE(2.0f);
|
|
|
|
else if (lara->Control.TurnRate > ANGLE(2.0f))
|
|
|
|
lara->Control.TurnRate -= ANGLE(2.0f);
|
|
|
|
else
|
|
|
|
lara->Control.TurnRate = 0;
|
|
|
|
|
|
|
|
item->Position.yRot += lara->Control.TurnRate;
|
|
|
|
|
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2022-03-19 02:32:22 +11:00
|
|
|
UpdateLaraSubsuitAngles(item);
|
2022-03-18 19:49:25 +11:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
if (!lara->Control.IsMoving && !(TrInput & (IN_LEFT | IN_RIGHT)))
|
2022-03-19 22:55:23 +11:00
|
|
|
ResetLaraLean(item, 8.0f, true, false);
|
2022-03-18 19:49:25 +11:00
|
|
|
|
|
|
|
if (item->Position.xRot < -ANGLE(85.0f))
|
|
|
|
item->Position.xRot = -ANGLE(85.0f);
|
|
|
|
else if (item->Position.xRot > ANGLE(85.0f))
|
|
|
|
item->Position.xRot = ANGLE(85.0f);
|
|
|
|
|
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2021-09-29 18:35:21 +10:00
|
|
|
{
|
2022-03-18 19:49:25 +11:00
|
|
|
if (item->Position.zRot > ANGLE(44.0f))
|
|
|
|
item->Position.zRot = ANGLE(44.0f);
|
|
|
|
else if (item->Position.zRot < -ANGLE(44.0f))
|
|
|
|
item->Position.zRot = -ANGLE(44.0f);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (item->Position.zRot > ANGLE(22.0f))
|
|
|
|
item->Position.zRot = ANGLE(22.0f);
|
|
|
|
else if (item->Position.zRot < -ANGLE(22.0f))
|
|
|
|
item->Position.zRot = -ANGLE(22.0f);
|
2021-09-29 18:35:21 +10:00
|
|
|
}
|
|
|
|
|
2022-03-09 17:04:19 +11:00
|
|
|
if (lara->WaterCurrentActive && lara->Control.WaterStatus != WaterStatus::FlyCheat)
|
2022-02-15 20:36:27 +11:00
|
|
|
LaraWaterCurrent(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
AnimateLara(item);
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
item->Position.xPos += phd_cos(item->Position.xRot) * item->Animation.VerticalVelocity * phd_sin(item->Position.yRot) / 4;
|
|
|
|
item->Position.yPos -= item->Animation.VerticalVelocity * phd_sin(item->Position.xRot) / 4;
|
|
|
|
item->Position.zPos += phd_cos(item->Position.xRot) * item->Animation.VerticalVelocity * phd_cos(item->Position.yRot) / 4;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-02 11:20:41 +03:00
|
|
|
DoObjectCollision(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
if (/*lara->ExtraAnim == -1 &&*/ lara->Vehicle == NO_ITEM)
|
2022-03-13 02:04:24 +11:00
|
|
|
lara_collision_routines[item->Animation.ActiveState](item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2022-03-10 02:27:11 +11:00
|
|
|
lara->ExtraVelocity = PHD_VECTOR();
|
|
|
|
|
2022-03-18 19:49:25 +11:00
|
|
|
UpdateItemRoom(item, 0);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-20 15:39:05 +11:00
|
|
|
LaraGun(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-08-26 12:12:05 +03:00
|
|
|
ProcessSectorFlags(item);
|
2021-09-15 16:58:53 +03:00
|
|
|
TestTriggers(item, false);
|
2021-08-30 15:35:00 +03:00
|
|
|
TestVolumes(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
void LaraCheat(ITEM_INFO* item, CollisionInfo* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
auto* lara = GetLaraInfo(item);
|
2021-11-26 00:28:29 +11:00
|
|
|
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints = LARA_HEALTH_MAX;
|
2022-03-18 19:49:25 +11:00
|
|
|
LaraUnderwater(item, coll);
|
2021-12-10 12:30:23 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
if (TrInput & IN_WALK && !(TrInput & IN_LOOK))
|
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
if (TestEnvironment(ENV_FLAG_WATER, item) || (lara->WaterSurfaceDist > 0 && lara->WaterSurfaceDist != NO_HEIGHT))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Underwater;
|
2021-11-16 17:25:17 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_IDLE);
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.WaterStatus = WaterStatus::Dry;
|
2021-11-16 17:25:17 +03:00
|
|
|
SetAnimation(item, LA_STAND_SOLID);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->Position.zRot = 0;
|
|
|
|
item->Position.xRot = 0;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-12-10 12:30:23 +11:00
|
|
|
|
2022-02-28 21:02:19 +11:00
|
|
|
lara->Control.HandStatus = HandStatus::Free;
|
2022-02-15 20:36:27 +11:00
|
|
|
LaraInitialiseMeshes(item);
|
2022-02-09 16:55:46 +11:00
|
|
|
item->HitPoints = LARA_HEALTH_MAX;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|