2020-12-21 13:16:29 -03:00
|
|
|
#include "framework.h"
|
2021-09-10 00:18:47 +03:00
|
|
|
|
2021-11-20 17:15:48 +11:00
|
|
|
#include "lara.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
#include "lara_basic.h"
|
2021-11-27 23:15:26 +11:00
|
|
|
#include "lara_helpers.h"
|
2021-11-20 17:15:48 +11:00
|
|
|
#include "lara_jump.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
#include "lara_tests.h"
|
|
|
|
#include "lara_monkey.h"
|
|
|
|
#include "lara_crawl.h"
|
|
|
|
#include "lara_objects.h"
|
|
|
|
#include "lara_hang.h"
|
|
|
|
#include "lara_slide.h"
|
|
|
|
#include "lara_fire.h"
|
|
|
|
#include "lara_surface.h"
|
|
|
|
#include "lara_swim.h"
|
|
|
|
#include "lara_one_gun.h"
|
|
|
|
#include "lara_cheat.h"
|
|
|
|
#include "lara_climb.h"
|
|
|
|
#include "lara_initialise.h"
|
|
|
|
|
|
|
|
#include "motorbike.h"
|
|
|
|
#include "biggun.h"
|
|
|
|
#include "quad.h"
|
|
|
|
#include "snowmobile.h"
|
|
|
|
#include "jeep.h"
|
|
|
|
#include "upv.h"
|
|
|
|
#include "kayak.h"
|
|
|
|
#include "minecart.h"
|
|
|
|
|
2021-09-16 05:06:03 +03:00
|
|
|
#include "animation.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
#include "GameFlowScript.h"
|
2021-12-19 05:24:12 +03:00
|
|
|
#include "control/flipeffect.h"
|
2021-11-22 18:55:29 +03:00
|
|
|
#include "Sound/sound.h"
|
2020-12-21 13:16:29 -03:00
|
|
|
#include "savegame.h"
|
|
|
|
#include "rope.h"
|
2021-09-16 05:06:03 +03:00
|
|
|
#include "misc.h"
|
2021-11-22 18:55:29 +03:00
|
|
|
#include "control/volume.h"
|
2021-12-19 05:24:12 +03:00
|
|
|
#include "collision/collide_item.h"
|
2021-08-28 13:27:58 +02:00
|
|
|
#include "Renderer11.h"
|
|
|
|
#include "camera.h"
|
2021-09-25 16:00:30 +03:00
|
|
|
#include "items.h"
|
2021-11-16 15:51:50 +03:00
|
|
|
#include "gui.h"
|
2021-09-10 00:18:47 +03:00
|
|
|
|
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-09-28 13:01:28 +02:00
|
|
|
|
2021-11-22 18:55:29 +03:00
|
|
|
using namespace TEN::Effects::Lara;
|
2021-09-30 12:03:39 +02:00
|
|
|
using namespace TEN::Entities::Generic;
|
2021-11-22 18:55:29 +03:00
|
|
|
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;
|
2021-09-16 01:12:19 +03:00
|
|
|
COLL_INFO 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,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_forwardjump,
|
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
|
|
|
|
lara_as_fastfall,
|
|
|
|
lara_as_hang,
|
|
|
|
lara_as_reach,
|
|
|
|
lara_as_splat,
|
|
|
|
lara_as_tread,
|
|
|
|
lara_void_func,
|
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
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_swim,//17
|
|
|
|
lara_as_glide,//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
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_backjump,//25
|
|
|
|
lara_as_rightjump,//26
|
|
|
|
lara_as_leftjump,//27
|
|
|
|
lara_as_upjump,//28
|
2021-12-20 21:37:38 +11:00
|
|
|
lara_as_fall_back,//29
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_hangleft,//30
|
|
|
|
lara_as_hangright,//31
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_as_slide_back,//32
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_surftread,
|
|
|
|
lara_as_surfswim,
|
|
|
|
lara_as_dive,
|
|
|
|
lara_as_pushblock,//36
|
|
|
|
lara_as_pullblock,//37
|
|
|
|
lara_as_ppready,//38
|
|
|
|
lara_as_pickup,//39
|
|
|
|
lara_as_switchon,//40
|
|
|
|
lara_as_switchoff,//41
|
|
|
|
lara_as_usekey,//42
|
|
|
|
lara_as_usepuzzle,//43
|
|
|
|
lara_as_uwdeath,//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
|
|
|
|
lara_as_surfback,//47
|
|
|
|
lara_as_surfleft,//48
|
|
|
|
lara_as_surfright,//49
|
|
|
|
lara_void_func,//50
|
|
|
|
lara_void_func,//51
|
|
|
|
lara_as_swandive,//52
|
|
|
|
lara_as_fastdive,//53
|
|
|
|
lara_as_gymnast,//54
|
|
|
|
lara_as_waterout,
|
|
|
|
lara_as_climbstnc,
|
|
|
|
lara_as_climbing,
|
|
|
|
lara_as_climbleft,
|
|
|
|
lara_as_climbend,
|
|
|
|
lara_as_climbright,
|
|
|
|
lara_as_climbdown,//
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_wade_forward,//65
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_waterroll,//66
|
|
|
|
lara_as_pickupflare,//67
|
|
|
|
lara_void_func,//68
|
|
|
|
lara_void_func,//69
|
|
|
|
lara_as_deathslide,//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
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_as_sprint,
|
2021-12-02 18:52:00 +11:00
|
|
|
lara_as_sprint_dive,
|
2021-12-01 11:59:24 +03:00
|
|
|
lara_as_monkey_idle,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_monkeyswing,
|
|
|
|
lara_as_monkeyl,
|
|
|
|
lara_as_monkeyr,
|
|
|
|
lara_as_monkey180,
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_as_crawl_idle,//80
|
|
|
|
lara_as_crawl_forward,//81
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_hangturnl,
|
|
|
|
lara_as_hangturnr,
|
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,
|
|
|
|
lara_as_ropel,
|
|
|
|
lara_as_roper,
|
|
|
|
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
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_rope,//111
|
|
|
|
lara_as_climbrope,//112
|
|
|
|
lara_as_climbroped,//113
|
|
|
|
lara_as_rope,//114
|
|
|
|
lara_as_rope,//115
|
|
|
|
lara_void_func,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_swimcheat,
|
|
|
|
lara_as_trpose,//119
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,//120
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_trwalk,//121
|
|
|
|
lara_as_trfall,//122
|
|
|
|
lara_as_trfall,//123
|
|
|
|
lara_as_null,//124
|
2021-09-05 14:49:00 +02:00
|
|
|
#ifdef NEW_TIGHTROPE
|
|
|
|
lara_as_trexit,//125
|
|
|
|
#else // !NEW_TIGHTROPE
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,//125
|
2021-09-05 14:49:00 +02:00
|
|
|
#endif
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_switchon,//126
|
|
|
|
lara_as_null,//127
|
|
|
|
lara_as_parallelbars,//128
|
|
|
|
lara_as_pbleapoff,//129
|
|
|
|
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-01 15:36:49 +03:00
|
|
|
lara_as_null,// 143 - Unused
|
|
|
|
lara_as_null,// 144 - Unused
|
|
|
|
lara_as_null,// 145 - Unused
|
2021-12-10 22:31:34 +11:00
|
|
|
lara_as_controlled_no_look,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_as_null,
|
|
|
|
lara_as_null,
|
|
|
|
lara_as_null,
|
|
|
|
lara_as_stepoff_left,
|
2021-10-08 20:08:55 +11:00
|
|
|
lara_as_stepoff_right,
|
2021-10-18 00:33:46 +11:00
|
|
|
lara_as_turn_left_fast,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_controlled,
|
|
|
|
lara_as_controlled
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
2021-09-15 16:58:53 +03:00
|
|
|
|
2020-12-21 13:16:29 -03: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,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_forwardjump,
|
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,
|
|
|
|
lara_col_fastfall,
|
|
|
|
lara_col_hang,
|
|
|
|
lara_col_reach,
|
|
|
|
lara_col_splat,
|
|
|
|
lara_col_tread,
|
|
|
|
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,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_swim,
|
|
|
|
lara_col_glide,
|
|
|
|
lara_default_col,
|
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
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_backjump,
|
|
|
|
lara_col_rightjump,
|
|
|
|
lara_col_leftjump,
|
|
|
|
lara_col_upjump,
|
2021-12-20 21:37:38 +11:00
|
|
|
lara_col_fall_back,//29
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_hangleft,
|
|
|
|
lara_col_hangright,
|
2021-12-18 20:42:15 +11:00
|
|
|
lara_col_slide_back,//32
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_surftread,
|
|
|
|
lara_col_surfswim,
|
|
|
|
lara_col_dive,
|
|
|
|
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_col_uwdeath,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_roll_forward,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_col_surfback,
|
|
|
|
lara_col_surfleft,
|
|
|
|
lara_col_surfright,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_col_swandive,
|
|
|
|
lara_col_fastdive,
|
|
|
|
lara_default_col,
|
|
|
|
lara_default_col,
|
|
|
|
lara_col_climbstnc,
|
|
|
|
lara_col_climbing,
|
|
|
|
lara_col_climbleft,
|
|
|
|
lara_col_climbend,
|
|
|
|
lara_col_climbright,
|
|
|
|
lara_col_climbdown,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
2021-11-25 23:38:59 +11:00
|
|
|
lara_col_wade_forward,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_waterroll,
|
|
|
|
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,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_monkeyswing,
|
|
|
|
lara_col_monkeyl,
|
|
|
|
lara_col_monkeyr,
|
|
|
|
lara_col_monkey180,
|
2021-10-30 12:45:52 +11:00
|
|
|
lara_col_crawl_idle,
|
|
|
|
lara_col_crawl_forward,
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_col_hangturnlr,
|
|
|
|
lara_col_hangturnlr,
|
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,
|
|
|
|
lara_col_turnswitch,
|
|
|
|
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,
|
|
|
|
lara_col_rope,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_col_ropefwd,
|
|
|
|
lara_col_ropefwd,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_col_swim,
|
|
|
|
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-01 11:59:24 +03:00
|
|
|
lara_void_func, // 143 - Unused
|
|
|
|
lara_void_func, // 144 - Unused
|
|
|
|
lara_void_func, // 145 - Unused
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
lara_void_func,
|
|
|
|
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,
|
|
|
|
lara_default_col
|
2020-12-21 13:16:29 -03:00
|
|
|
};
|
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
if (info->hasFired)
|
2021-09-16 01:12:19 +03:00
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
AlertNearbyGuards(item);
|
2021-11-26 00:28:29 +11:00
|
|
|
info->hasFired = false;
|
2021-09-16 01:12:19 +03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->poisoned)
|
2021-09-16 01:12:19 +03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->poisoned > 4096)
|
|
|
|
info->poisoned = 4096;
|
2021-09-16 01:12:19 +03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->poisoned >= 256 && !(Wibble & 0xFF))
|
|
|
|
item->hitPoints -= info->poisoned >> 8;
|
2021-09-16 01:12:19 +03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->isMoving)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->moveCount > 90)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->isMoving = false;
|
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
++info->moveCount;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (!info->uncontrollable)
|
|
|
|
info->locationPad = 128;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
int oldX = item->pos.xPos;
|
|
|
|
int oldY = item->pos.yPos;
|
|
|
|
int oldZ = item->pos.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->gunStatus == LG_HANDS_BUSY &&
|
2021-11-25 23:38:59 +11:00
|
|
|
item->currentAnimState == LS_IDLE &&
|
|
|
|
item->goalAnimState == LS_IDLE &&
|
2021-11-09 16:03:56 +11:00
|
|
|
item->animNumber == LA_STAND_IDLE &&
|
|
|
|
!item->gravityStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (item->currentAnimState != LS_SPRINT && info->sprintTimer < LARA_SPRINT_MAX)
|
|
|
|
info->sprintTimer++;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->isDucked = false;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-07 04:54:48 +03:00
|
|
|
bool isWater = TestLaraWater(item);
|
|
|
|
bool isSwamp = TestLaraSwamp(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-12-15 13:44:05 +11:00
|
|
|
int waterDepth = GetWaterDepth(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber);
|
|
|
|
int waterHeight = GetWaterHeight(item->pos.xPos, item->pos.yPos, item->pos.zPos, item->roomNumber);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
int heightFromWater;
|
|
|
|
if (waterHeight != NO_HEIGHT)
|
|
|
|
heightFromWater = item->pos.yPos - waterHeight;
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-09 16:03:56 +11:00
|
|
|
heightFromWater = NO_HEIGHT;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterSurfaceDist = -heightFromWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->Vehicle == NO_ITEM)
|
2021-11-09 16:03:56 +11:00
|
|
|
WadeSplash(item, waterHeight, waterDepth);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->Vehicle == NO_ITEM && info->ExtraAnim == -1)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
switch (info->waterStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
case LW_ABOVE_WATER:
|
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.
|
2021-12-14 23:45:03 +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
|
|
|
{
|
2021-12-10 12:30:23 +11:00
|
|
|
info->air = LARA_AIR_MAX;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_UNDERWATER;
|
2021-11-07 16:07:16 +03:00
|
|
|
item->gravityStatus = false;
|
|
|
|
item->pos.yPos += 100;
|
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
|
|
|
|
2021-11-07 16:07:16 +03:00
|
|
|
if (item->currentAnimState == LS_SWANDIVE_START)
|
|
|
|
{
|
2021-12-11 00:09:53 +11:00
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.xRot = -ANGLE(45.0f);
|
2021-11-07 16:07:16 +03:00
|
|
|
item->goalAnimState = LS_DIVE;
|
|
|
|
AnimateLara(item);
|
|
|
|
item->fallspeed *= 2;
|
|
|
|
}
|
|
|
|
else if (item->currentAnimState == LS_SWANDIVE_END)
|
|
|
|
{
|
2021-12-11 00:09:53 +11:00
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.xRot = -ANGLE(85.0f);
|
2021-11-07 16:07:16 +03:00
|
|
|
item->goalAnimState = LS_DIVE;
|
|
|
|
AnimateLara(item);
|
|
|
|
item->fallspeed *= 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.xRot = -ANGLE(45.0f);
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_FREEFALL_DIVE);
|
2021-11-07 16:07:16 +03:00
|
|
|
item->fallspeed = 3 * item->fallspeed / 2;
|
|
|
|
}
|
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
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_WADE;
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2021-12-15 13:44:05 +11:00
|
|
|
// Make splash ONLY within this particular threshold before swim depth while airborne (WadeSplash() above interferes otherwise).
|
|
|
|
if (waterDepth > (SWIM_DEPTH - STEP_SIZE) &&
|
|
|
|
!isSwamp &&
|
|
|
|
item->gravityStatus)
|
2021-12-14 23:45:03 +11:00
|
|
|
{
|
|
|
|
Splash(item);
|
|
|
|
item->goalAnimState = LS_IDLE;
|
|
|
|
}
|
2021-12-15 13:44:05 +11:00
|
|
|
// Lara is grounded; block land-to-run.
|
2021-12-14 23:45:03 +11:00
|
|
|
else if (!item->gravityStatus)
|
2021-11-25 23:38:59 +11:00
|
|
|
item->goalAnimState = LS_IDLE;
|
2021-11-07 04:54:48 +03:00
|
|
|
else if (isSwamp)
|
|
|
|
{
|
2021-11-09 20:03:40 +11:00
|
|
|
if (item->currentAnimState == LS_SWANDIVE_START ||
|
|
|
|
item->currentAnimState == LS_SWANDIVE_END)
|
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.yPos = waterHeight + (WALL_SIZE - 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;
|
|
|
|
|
|
|
|
case LW_UNDERWATER:
|
2021-11-09 16:03:56 +11:00
|
|
|
if (isWater ||
|
|
|
|
waterDepth == DEEP_WATER ||
|
|
|
|
abs(heightFromWater) >= STEP_SIZE ||
|
|
|
|
item->animNumber == LA_UNDERWATER_RESURFACE ||
|
|
|
|
item->animNumber == LA_ONWATER_DIVE)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
if (!isWater)
|
|
|
|
{
|
2021-11-09 16:03:56 +11:00
|
|
|
if (waterDepth == DEEP_WATER || abs(heightFromWater) >= STEP_SIZE)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_FALL_START);
|
2020-12-21 13:16:29 -03:00
|
|
|
item->speed = item->fallspeed / 4;
|
|
|
|
item->gravityStatus = true;
|
|
|
|
item->fallspeed = 0;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.xRot = 0;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_ABOVE_WATER;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_RESURFACE);
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.yPos = waterHeight;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->fallspeed = 0;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.xRot = 0;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_SURFACE;
|
|
|
|
info->diveCount = 11;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-09 16:03:56 +11:00
|
|
|
UpdateItemRoom(item, -(STEPUP_HEIGHT - 3));
|
|
|
|
SoundEffect(SFX_TR4_LARA_BREATH, &item->pos, 2);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_UNDERWATER_RESURFACE);
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.yPos = waterHeight + 1;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->fallspeed = 0;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.xRot = 0;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_SURFACE;
|
|
|
|
info->diveCount = 11;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-17 15:32:55 +03:00
|
|
|
UpdateItemRoom(item, 0);
|
2021-11-09 16:03:56 +11:00
|
|
|
SoundEffect(SFX_TR4_LARA_BREATH, &item->pos, 2);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LW_SURFACE:
|
|
|
|
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);
|
2020-12-21 13:16:29 -03:00
|
|
|
item->speed = item->fallspeed / 4;
|
|
|
|
item->gravityStatus = true;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_ABOVE_WATER;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:41:59 +03:00
|
|
|
SetAnimation(item, LA_STAND_IDLE);
|
2021-11-10 12:26:27 +03:00
|
|
|
item->goalAnimState = LS_WADE_FORWARD; // TODO: Check if really needed? -- Lwmte, 10.11.21
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_WADE;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
AnimateItem(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
item->fallspeed = 0;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.xRot = 0;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
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;
|
|
|
|
|
|
|
|
case LW_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);
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_SURFACE;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.yPos += 1 - heightFromWater;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->gravityStatus = false;
|
|
|
|
item->fallspeed = 0;
|
2021-11-09 16:03:56 +11:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.xRot = 0;
|
2021-11-26 00:28:29 +11:00
|
|
|
info->diveCount = 0;
|
2021-12-10 12:30:23 +11:00
|
|
|
ResetLaraFlex(item);
|
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
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_ABOVE_WATER;
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
if (item->currentAnimState == LS_WADE_FORWARD)
|
|
|
|
item->goalAnimState = LS_RUN_FORWARD;
|
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
|
|
|
item->hitPoints = -1;
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->deathCount == 0)
|
2021-09-16 01:12:19 +03:00
|
|
|
StopSoundTracks();
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->deathCount++;
|
2021-11-09 16:03:56 +11:00
|
|
|
if ((item->flags & 0x100))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->deathCount++;
|
2021-11-09 16:03:56 +11:00
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
switch (info->waterStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
case LW_ABOVE_WATER:
|
|
|
|
case LW_WADE:
|
2021-11-26 00:28:29 +11:00
|
|
|
if (isSwamp && info->waterSurfaceDist < -(LARA_HEIGHT + 8)) // TODO: Find best height. @Sezz 2021.11.10
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
if (item->hitPoints >= 0)
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->air -= 6;
|
|
|
|
if (info->air < 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->air = -1;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->hitPoints -= 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-11-26 00:28:29 +11:00
|
|
|
else if (info->air < LARA_AIR_MAX && item->hitPoints >= 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->Vehicle == NO_ITEM) // only for the upv !!
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->air += 10;
|
|
|
|
if (info->air > LARA_AIR_MAX)
|
|
|
|
info->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;
|
|
|
|
|
|
|
|
case LW_UNDERWATER:
|
|
|
|
if (item->hitPoints >= 0)
|
|
|
|
{
|
2021-11-11 01:16:27 +03:00
|
|
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
|
|
|
if (level->LaraType != LaraType::Divesuit)
|
2021-11-26 00:28:29 +11:00
|
|
|
info->air--;
|
2021-11-11 01:16:27 +03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->air < 0)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
// if (LaraDrawType == LARA_TYPE::DIVESUIT && info->anxiety < 251)
|
|
|
|
// info->anxiety += 4;
|
|
|
|
info->air = -1;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->hitPoints -= 5;
|
|
|
|
}
|
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
|
|
|
LaraUnderWater(item, coll);
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LW_SURFACE:
|
|
|
|
if (item->hitPoints >= 0)
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->air += 10;
|
|
|
|
if (info->air > LARA_AIR_MAX)
|
|
|
|
info->air = LARA_AIR_MAX;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-09 16:03:56 +11:00
|
|
|
|
|
|
|
LaraSurface(item, coll);
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LW_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(
|
2020-12-21 13:16:29 -03:00
|
|
|
SQUARE(item->pos.xPos - oldX) +
|
|
|
|
SQUARE(item->pos.yPos - oldY) +
|
|
|
|
SQUARE(item->pos.zPos - oldZ));
|
|
|
|
}
|
|
|
|
|
2021-10-07 17:11:01 +03:00
|
|
|
void LaraAboveWater(ITEM_INFO* item, COLL_INFO* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-19 22:48:47 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->pos.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->pos.zPos;
|
|
|
|
coll->Setup.OldAnimState = item->currentAnimState;
|
2021-10-09 19:19:02 +03:00
|
|
|
coll->Setup.OldAnimNumber = item->animNumber;
|
|
|
|
coll->Setup.OldFrameNumber = item->frameNumber;
|
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = true;
|
|
|
|
coll->Setup.EnableSpaz = true;
|
|
|
|
coll->Setup.SlopesAreWalls = false;
|
|
|
|
coll->Setup.SlopesArePits = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2021-10-27 09:48:31 +03:00
|
|
|
coll->Setup.Mode = COLL_PROBE_MODE::QUADRANTS;
|
2021-10-09 19:19:02 +03:00
|
|
|
|
2021-11-19 22:48:47 +11:00
|
|
|
if (TrInput & IN_LOOK && info->look &&
|
|
|
|
info->ExtraAnim == NO_ITEM)
|
2021-11-10 16:11:36 +11:00
|
|
|
{
|
2020-12-21 13:16:29 -03:00
|
|
|
LookLeftRight();
|
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
|
|
|
|
2021-12-10 22:31:34 +11:00
|
|
|
// TODO: Move radius and height default resets above look checks when
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
|
|
|
coll->Setup.Height = LARA_HEIGHT;
|
2021-11-19 22:48:47 +11:00
|
|
|
info->look = 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.
|
2021-11-19 22:48:47 +11:00
|
|
|
if (info->Vehicle != NO_ITEM)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-19 22:48:47 +11:00
|
|
|
switch (g_Level.Items[info->Vehicle].objectNumber)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
case ID_QUAD:
|
2021-11-17 00:17:25 +11:00
|
|
|
if (QuadBikeControl(item, coll))
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_JEEP:
|
|
|
|
if (JeepControl())
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MOTORBIKE:
|
|
|
|
if (MotorbikeControl())
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_KAYAK:
|
|
|
|
if (KayakControl())
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_SNOWMOBILE:
|
2021-11-17 23:56:34 +11:00
|
|
|
if (SkidooControl(item, coll))
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_UPV:
|
2021-12-08 15:27:46 +11:00
|
|
|
if (SubControl(item, coll))
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MINECART:
|
|
|
|
if (MineCartControl())
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BIGGUN:
|
2021-11-16 22:30:37 +11:00
|
|
|
if (BigGunControl(item, coll))
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2021-11-04 18:31:17 +11:00
|
|
|
// Boats are processed like normal items in loop.
|
2021-11-20 15:39:05 +11:00
|
|
|
LaraGun(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-20 00:11:04 +11:00
|
|
|
// Temp. debug stuff
|
|
|
|
//---
|
|
|
|
|
|
|
|
static PHD_3DPOS posO = { 0, 0, 0, 0, 0, 0 };
|
|
|
|
static short roomNumO = item->roomNumber;
|
|
|
|
static CAMERA_INFO camO = Camera;
|
|
|
|
|
|
|
|
if (KeyMap[DIK_Q] && TrInput & IN_WALK)
|
|
|
|
{
|
|
|
|
posO = item->pos;
|
|
|
|
roomNumO = item->roomNumber;
|
|
|
|
camO = Camera;
|
|
|
|
}
|
|
|
|
else if (KeyMap[DIK_E])//
|
|
|
|
{
|
|
|
|
item->pos = posO;
|
|
|
|
item->roomNumber - roomNumO;
|
|
|
|
Camera = camO;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Forward 1 unit.
|
|
|
|
if (KeyMap[DIK_I])
|
|
|
|
{
|
|
|
|
item->pos.xPos += phd_sin(item->pos.yRot);
|
|
|
|
item->pos.zPos += phd_cos(item->pos.yRot);
|
|
|
|
}
|
|
|
|
// Back 1 unit.
|
|
|
|
else if (KeyMap[DIK_K])
|
|
|
|
{
|
|
|
|
item->pos.xPos += phd_sin(item->pos.yRot + ANGLE(180.0f));
|
|
|
|
item->pos.zPos += phd_cos(item->pos.yRot + ANGLE(180.0f));
|
|
|
|
}
|
|
|
|
// Left 1 unit.
|
|
|
|
else if (KeyMap[DIK_J])
|
|
|
|
{
|
|
|
|
item->pos.xPos += phd_sin(item->pos.yRot - ANGLE(90.0f));
|
|
|
|
item->pos.zPos += phd_cos(item->pos.yRot - ANGLE(90.0f));
|
|
|
|
}
|
|
|
|
// Right 1 unit.
|
|
|
|
else if (KeyMap[DIK_L])
|
|
|
|
{
|
|
|
|
item->pos.xPos += phd_sin(item->pos.yRot + ANGLE(90.0f));
|
|
|
|
item->pos.zPos += phd_cos(item->pos.yRot + ANGLE(90.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
//---
|
|
|
|
|
2021-11-04 18:31:17 +11:00
|
|
|
// Handle current Lara status.
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_control_routines[item->currentAnimState](item, coll);
|
|
|
|
|
2021-12-10 12:30:23 +11:00
|
|
|
HandleLaraMovementParameters(item, coll);
|
2021-11-04 18:31:17 +11:00
|
|
|
|
2021-11-28 18:07:51 +11:00
|
|
|
// Animate Lara.
|
2020-12-21 13:16:29 -03:00
|
|
|
AnimateLara(item);
|
|
|
|
|
2021-11-19 22:48:47 +11:00
|
|
|
if (info->ExtraAnim == -1)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-04 18:31:17 +11:00
|
|
|
// Check for collision with items.
|
2021-09-02 11:20:41 +03:00
|
|
|
DoObjectCollision(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-04 18:31:17 +11:00
|
|
|
// Handle Lara collision.
|
2021-11-19 22:48:47 +11:00
|
|
|
if (info->Vehicle == NO_ITEM)
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_collision_routines[item->currentAnimState](item, coll);
|
|
|
|
}
|
|
|
|
|
2021-11-19 22:48:47 +11:00
|
|
|
//if (info->gunType == WEAPON_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
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
2021-09-19 17:48:32 +03:00
|
|
|
coll->Setup.BadHeightDown = 32512;
|
|
|
|
coll->Setup.BadHeightUp = -400;
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.BadCeilingHeight = 400;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->pos.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->pos.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.SlopesAreWalls = false;
|
|
|
|
coll->Setup.SlopesArePits = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = true;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
2021-10-27 09:48:31 +03:00
|
|
|
coll->Setup.Mode = COLL_PROBE_MODE::QUADRANTS;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 01:19:15 +03:00
|
|
|
coll->Setup.Radius = LARA_RAD_UNDERWATER;
|
2021-09-19 06:42:24 +03:00
|
|
|
coll->Setup.Height = LARA_HEIGHT;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (TrInput & IN_LOOK && info->look)
|
2020-12-21 13:16:29 -03:00
|
|
|
LookLeftRight();
|
|
|
|
else
|
2021-11-27 20:35:16 +11:00
|
|
|
ResetLook(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->look = true;
|
|
|
|
info->poseCount = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
lara_control_routines[item->currentAnimState](item, coll);
|
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
|
|
|
|
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->turnRate < -ANGLE(0.5f))
|
|
|
|
info->turnRate += ANGLE(0.5f);
|
|
|
|
else if (info->turnRate > ANGLE(0.5f))
|
|
|
|
info->turnRate -= ANGLE(0.5f);
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-26 00:28:29 +11:00
|
|
|
info->turnRate = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
2021-11-26 00:28:29 +11:00
|
|
|
else if (info->turnRate < -ANGLE(2.0f))
|
|
|
|
info->turnRate += ANGLE(2.0f);
|
|
|
|
else if (info->turnRate > ANGLE(2.0f))
|
|
|
|
info->turnRate -= ANGLE(2.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
else
|
2021-11-26 00:28:29 +11:00
|
|
|
info->turnRate = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
item->pos.yRot += info->turnRate;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2020-12-21 13:16:29 -03:00
|
|
|
UpdateSubsuitAngles();
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (!info->isMoving && !(TrInput & (IN_LEFT | IN_RIGHT)))
|
2021-09-26 12:23:58 +10:00
|
|
|
{
|
2021-09-29 18:35:21 +10:00
|
|
|
if (abs(item->pos.zRot) > ANGLE(0.0f))
|
|
|
|
item->pos.zRot += item->pos.zRot / -8;
|
2021-09-26 12:23:58 +10:00
|
|
|
}
|
|
|
|
|
2021-11-10 16:11:36 +11:00
|
|
|
if (item->pos.xRot < -ANGLE(85.0f))
|
|
|
|
item->pos.xRot = -ANGLE(85.0f);
|
|
|
|
else if (item->pos.xRot > ANGLE(85.0f))
|
|
|
|
item->pos.xRot = ANGLE(85.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-11 01:16:27 +03:00
|
|
|
if (level->LaraType == LaraType::Divesuit)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-10 16:11:36 +11:00
|
|
|
if (item->pos.zRot > ANGLE(44.0f))
|
|
|
|
item->pos.zRot = ANGLE(44.0f);
|
|
|
|
else if (item->pos.zRot < -ANGLE(44.0f))
|
|
|
|
item->pos.zRot = -ANGLE(44.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 16:11:36 +11:00
|
|
|
if (item->pos.zRot > ANGLE(22.0f))
|
|
|
|
item->pos.zRot = ANGLE(22.0f);
|
|
|
|
else if (item->pos.zRot < -ANGLE(22.0f))
|
|
|
|
item->pos.zRot = -ANGLE(22.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->currentActive && info->waterStatus != LW_FLYCHEAT)
|
2020-12-21 13:16:29 -03:00
|
|
|
LaraWaterCurrent(coll);
|
|
|
|
|
|
|
|
AnimateLara(item);
|
|
|
|
|
|
|
|
item->pos.xPos += phd_cos(item->pos.xRot) * item->fallspeed * phd_sin(item->pos.yRot) / 4;
|
|
|
|
item->pos.yPos -= item->fallspeed * phd_sin(item->pos.xRot) / 4;
|
|
|
|
item->pos.zPos += phd_cos(item->pos.xRot) * item->fallspeed * phd_cos(item->pos.yRot) / 4;
|
|
|
|
|
2021-09-02 11:20:41 +03:00
|
|
|
DoObjectCollision(item, coll);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (/*info->ExtraAnim == -1 &&*/ info->Vehicle == NO_ITEM)
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_collision_routines[item->currentAnimState](item, coll);
|
|
|
|
|
2021-09-17 15:32:55 +03: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
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void LaraSurface(ITEM_INFO* item, COLL_INFO* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
2021-11-10 16:11:36 +11:00
|
|
|
Camera.targetElevation = -ANGLE(22.0f);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-19 17:48:32 +03:00
|
|
|
coll->Setup.BadHeightDown = 32512;
|
|
|
|
coll->Setup.BadHeightUp = -128;
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.BadCeilingHeight = 100;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.OldPosition.x = item->pos.xPos;
|
|
|
|
coll->Setup.OldPosition.y = item->pos.yPos;
|
|
|
|
coll->Setup.OldPosition.z = item->pos.zPos;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.SlopesAreWalls = false;
|
|
|
|
coll->Setup.SlopesArePits = false;
|
2021-09-13 09:55:54 +03:00
|
|
|
coll->Setup.DeathFlagIsPit = false;
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
2021-10-27 09:48:31 +03:00
|
|
|
coll->Setup.Mode = COLL_PROBE_MODE::FREE_FORWARD;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-09-10 01:19:15 +03:00
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2021-09-19 07:38:15 +03:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_SURFACE;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (TrInput & IN_LOOK && info->look)
|
2020-12-21 13:16:29 -03:00
|
|
|
LookLeftRight();
|
|
|
|
else
|
2021-11-27 20:35:16 +11:00
|
|
|
ResetLook(item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->look = true;
|
|
|
|
info->poseCount = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
lara_control_routines[item->currentAnimState](item, coll);
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (!info->isMoving && !(TrInput & (IN_LEFT | IN_RIGHT)))
|
2021-09-29 18:35:21 +10:00
|
|
|
{
|
|
|
|
if (abs(item->pos.zRot) > ANGLE(0.0f))
|
|
|
|
item->pos.zRot += item->pos.zRot / -8;
|
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->currentActive && info->waterStatus != LW_FLYCHEAT)
|
2020-12-21 13:16:29 -03:00
|
|
|
LaraWaterCurrent(coll);
|
|
|
|
|
|
|
|
AnimateLara(item);
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
item->pos.xPos += item->fallspeed * phd_sin(info->moveAngle) / 4;
|
|
|
|
item->pos.zPos += item->fallspeed * phd_cos(info->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
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->Vehicle == NO_ITEM)
|
2020-12-21 13:16:29 -03:00
|
|
|
lara_collision_routines[item->currentAnimState](item, coll);
|
|
|
|
|
2021-09-17 15:32:55 +03:00
|
|
|
UpdateItemRoom(item, 100);
|
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
|
|
|
}
|
|
|
|
|
2021-02-03 01:50:59 -03:00
|
|
|
void LaraCheat(ITEM_INFO* item, COLL_INFO* coll)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
2021-12-10 12:30:23 +11:00
|
|
|
item->hitPoints = LARA_HEALTH_MAX;
|
2020-12-21 13:16:29 -03: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))
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
if (TestLaraWater(item) || (info->waterSurfaceDist > 0 && info->waterSurfaceDist != NO_HEIGHT))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_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
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
info->waterStatus = LW_ABOVE_WATER;
|
2021-11-16 17:25:17 +03:00
|
|
|
SetAnimation(item, LA_STAND_SOLID);
|
2020-12-21 13:16:29 -03:00
|
|
|
item->pos.zRot = 0;
|
|
|
|
item->pos.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
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2020-12-21 13:16:29 -03:00
|
|
|
LaraInitialiseMeshes();
|
2021-12-10 12:30:23 +11:00
|
|
|
item->hitPoints = LARA_HEALTH_MAX;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimateLara(ITEM_INFO* item)
|
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
2020-12-21 13:16:29 -03:00
|
|
|
item->frameNumber++;
|
|
|
|
|
|
|
|
ANIM_STRUCT* anim = &g_Level.Anims[item->animNumber];
|
|
|
|
if (anim->numberChanges > 0 && GetChange(item, anim))
|
|
|
|
{
|
|
|
|
anim = &g_Level.Anims[item->animNumber];
|
|
|
|
item->currentAnimState = anim->currentAnimState;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item->frameNumber > anim->frameEnd)
|
|
|
|
{
|
|
|
|
if (anim->numberCommands > 0)
|
|
|
|
{
|
|
|
|
short* cmd = &g_Level.Commands[anim->commandIndex];
|
|
|
|
for (int i = anim->numberCommands; i > 0; i--)
|
|
|
|
{
|
|
|
|
switch (*(cmd++))
|
|
|
|
{
|
|
|
|
case COMMAND_MOVE_ORIGIN:
|
|
|
|
TranslateItem(item, cmd[0], cmd[1], cmd[2]);
|
2021-09-17 15:32:55 +03:00
|
|
|
UpdateItemRoom(item, -LARA_HEIGHT / 2);
|
2020-12-21 13:16:29 -03:00
|
|
|
cmd += 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_JUMP_VELOCITY:
|
|
|
|
item->fallspeed = *(cmd++);
|
|
|
|
item->speed = *(cmd++);
|
|
|
|
item->gravityStatus = true;
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->calcFallSpeed)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-26 00:28:29 +11:00
|
|
|
item->fallspeed = info->calcFallSpeed;
|
|
|
|
info->calcFallSpeed = 0;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_ATTACK_READY:
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->gunStatus != LG_SPECIAL)
|
|
|
|
info->gunStatus = LG_HANDS_FREE;
|
2020-12-21 13:16:29 -03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_SOUND_FX:
|
|
|
|
case COMMAND_EFFECT:
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
item->animNumber = anim->jumpAnimNum;
|
|
|
|
item->frameNumber = anim->jumpFrameNum;
|
|
|
|
|
|
|
|
anim = &g_Level.Anims[item->animNumber];
|
|
|
|
item->currentAnimState = anim->currentAnimState;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (anim->numberCommands > 0)
|
|
|
|
{
|
|
|
|
short* cmd = &g_Level.Commands[anim->commandIndex];
|
|
|
|
int flags;
|
|
|
|
int effectID = 0;
|
|
|
|
|
|
|
|
for (int i = anim->numberCommands; i > 0; i--)
|
|
|
|
{
|
|
|
|
switch (*(cmd++))
|
|
|
|
{
|
|
|
|
case COMMAND_MOVE_ORIGIN:
|
|
|
|
cmd += 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_JUMP_VELOCITY:
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_SOUND_FX:
|
|
|
|
if (item->frameNumber != *cmd)
|
|
|
|
{
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
flags = cmd[1] & 0xC000;
|
2021-10-29 02:22:26 +03:00
|
|
|
if ( flags == (int)SOUND_PLAYCONDITION::LandAndWater ||
|
2021-11-26 00:28:29 +11:00
|
|
|
(flags == (int)SOUND_PLAYCONDITION::Land && (info->waterSurfaceDist >= 0 || info->waterSurfaceDist == NO_HEIGHT)) ||
|
|
|
|
(flags == (int)SOUND_PLAYCONDITION::Water && info->waterSurfaceDist < 0 && info->waterSurfaceDist != NO_HEIGHT && !TestLaraSwamp(item)))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
SoundEffect(cmd[1] & 0x3FFF, &item->pos, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMMAND_EFFECT:
|
|
|
|
if (item->frameNumber != *cmd)
|
|
|
|
{
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
effectID = cmd[1] & 0x3FFF;
|
2021-09-15 17:49:01 +03:00
|
|
|
DoFlipEffect(effectID, item);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
cmd += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int lateral = anim->Xvelocity;
|
|
|
|
if (anim->Xacceleration)
|
|
|
|
lateral += anim->Xacceleration * (item->frameNumber - anim->frameBase);
|
2021-08-30 15:13:18 -05:00
|
|
|
lateral >>= 16;
|
2020-12-21 13:16:29 -03:00
|
|
|
|
2021-11-07 04:54:48 +03:00
|
|
|
if (item->gravityStatus)
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-11-07 04:54:48 +03:00
|
|
|
if (TestLaraSwamp(item))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-08-30 15:13:18 -05:00
|
|
|
item->speed -= item->speed >> 3;
|
2020-12-21 13:16:29 -03:00
|
|
|
if (abs(item->speed) < 8)
|
|
|
|
{
|
|
|
|
item->speed = 0;
|
|
|
|
item->gravityStatus = false;
|
|
|
|
}
|
|
|
|
if (item->fallspeed > 128)
|
|
|
|
item->fallspeed /= 2;
|
|
|
|
item->fallspeed -= item->fallspeed / 4;
|
|
|
|
if (item->fallspeed < 4)
|
|
|
|
item->fallspeed = 4;
|
|
|
|
item->pos.yPos += item->fallspeed;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int velocity = (anim->velocity + anim->acceleration * (item->frameNumber - anim->frameBase - 1));
|
2021-08-30 15:13:18 -05:00
|
|
|
item->speed -= velocity >> 16;
|
|
|
|
item->speed += (velocity + anim->acceleration) >> 16;
|
2020-12-21 13:16:29 -03:00
|
|
|
item->fallspeed += (item->fallspeed >= 128 ? 1 : GRAVITY);
|
|
|
|
item->pos.yPos += item->fallspeed;
|
|
|
|
}
|
|
|
|
}
|
2021-11-07 04:54:48 +03:00
|
|
|
else
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
|
|
|
int velocity;
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->waterStatus == LW_WADE && TestLaraSwamp(item))
|
2020-12-21 13:16:29 -03:00
|
|
|
{
|
2021-08-30 15:13:18 -05:00
|
|
|
velocity = (anim->velocity >> 1);
|
2020-12-21 13:16:29 -03:00
|
|
|
if (anim->acceleration)
|
2021-08-30 15:13:18 -05:00
|
|
|
velocity += (anim->acceleration * (item->frameNumber - anim->frameBase)) >> 2;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
velocity = anim->velocity;
|
|
|
|
if (anim->acceleration)
|
|
|
|
velocity += anim->acceleration * (item->frameNumber - anim->frameBase);
|
|
|
|
}
|
|
|
|
|
2021-08-30 15:13:18 -05:00
|
|
|
item->speed = velocity >> 16;
|
2020-12-21 13:16:29 -03:00
|
|
|
}
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (info->ropePtr != -1)
|
2020-12-21 13:16:29 -03:00
|
|
|
DelAlignLaraToRope(item);
|
|
|
|
|
2021-11-26 00:28:29 +11:00
|
|
|
if (!info->isMoving)
|
|
|
|
MoveItem(item, info->moveAngle, item->speed, lateral);
|
2020-12-21 13:16:29 -03:00
|
|
|
|
|
|
|
// Update matrices
|
|
|
|
g_Renderer.updateLaraAnimations(true);
|
|
|
|
}
|