2020-08-09 19:18:29 -05:00
|
|
|
#include "framework.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/Lara/lara_monkey.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
|
|
|
|
#include "Game/camera.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/collision/floordata.h"
|
|
|
|
#include "Game/collision/collide_room.h"
|
|
|
|
#include "Game/collision/collide_item.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/control/control.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/items.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/Lara/lara.h"
|
|
|
|
#include "Game/Lara/lara_collide.h"
|
2022-01-12 17:31:03 +11:00
|
|
|
#include "Game/Lara/lara_helpers.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Game/Lara/lara_tests.h"
|
|
|
|
#include "Specific/input.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/level.h"
|
2021-12-01 15:18:47 +03:00
|
|
|
#include "Scripting/GameFlowScript.h"
|
2021-09-25 11:27:47 +02:00
|
|
|
|
2021-08-30 18:03:21 +03:00
|
|
|
using namespace TEN::Floordata;
|
2021-01-17 17:54:52 -03:00
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
// -----------------------------
|
|
|
|
// MONKEY SWING
|
|
|
|
// Control & Collision Functions
|
|
|
|
// -----------------------------
|
2020-08-14 04:08:10 -05:00
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
// State: LS_MONKEY_IDLE (75)
|
|
|
|
// Collision: lara_col_monkey_idle()
|
2021-12-01 11:59:24 +03:00
|
|
|
void lara_as_monkey_idle(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 17:31:03 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2020-08-09 19:18:29 -05:00
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
2022-01-12 17:31:03 +11:00
|
|
|
item->goalAnimState = LS_IDLE; //
|
2020-08-09 19:18:29 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
if (TrInput & IN_LOOK)
|
|
|
|
LookUpDown();
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
2022-01-12 19:04:29 +11:00
|
|
|
if (info->turnRate < -LARA_MONKEY_MOVE_TURN_MAX / 2)
|
|
|
|
info->turnRate = -LARA_MONKEY_MOVE_TURN_MAX / 2;
|
2022-01-12 17:31:03 +11:00
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
info->turnRate += LARA_TURN_RATE;
|
2022-01-12 19:04:29 +11:00
|
|
|
if (info->turnRate > LARA_MONKEY_MOVE_TURN_MAX / 2)
|
|
|
|
info->turnRate = LARA_MONKEY_MOVE_TURN_MAX / 2;
|
2022-01-12 17:31:03 +11:00
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:04:29 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 17:31:03 +11:00
|
|
|
if (TrInput & IN_ROLL)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_TURN_180;
|
|
|
|
return;
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
if (TrInput & IN_FORWARD && TestLaraMonkeyForward(item, coll))
|
2022-01-12 17:31:03 +11:00
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_FORWARD;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Not yet.
|
|
|
|
/*else if (TrInput & IN_BACK && TestLaraMonkeyBack(item, coll))
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_BACK;
|
|
|
|
return;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_TURN_LEFT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_TURN_RIGHT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
if (TrInput & IN_LSTEP && TestLaraMonkeyShimmyLeft(item, coll))
|
2022-01-12 17:31:03 +11:00
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_LEFT;
|
|
|
|
return;
|
|
|
|
}
|
2022-01-12 22:30:43 +11:00
|
|
|
else if (TrInput & IN_RSTEP && TestLaraMonkeyShimmyRight(item, coll))
|
2022-01-12 17:31:03 +11:00
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_RIGHT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
SetLaraMonkeyFallState(item);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
// State: LS_MONKEY_IDLE (75)
|
|
|
|
// Control: lara_as_monkey_idle()
|
2021-12-01 11:59:24 +03:00
|
|
|
void lara_col_monkey_idle(ITEM_INFO* item, COLL_INFO* coll)
|
2022-01-12 22:30:43 +11:00
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->moveAngle = item->pos.yRot;
|
|
|
|
item->fallspeed = 0;
|
|
|
|
item->gravityStatus = false;
|
2022-01-16 02:34:09 +11:00
|
|
|
coll->Setup.BadFloorHeightDown = NO_BAD_POS;
|
|
|
|
coll->Setup.BadFloorHeightUp = NO_HEIGHT;
|
2022-01-16 01:28:49 +11:00
|
|
|
coll->Setup.BadCeilingHeightDown = CLICK(1);
|
|
|
|
coll->Setup.BadCeilingHeightUp = -CLICK(1);
|
2022-01-12 22:30:43 +11:00
|
|
|
coll->Setup.ForwardAngle = info->moveAngle;
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2022-01-15 22:48:35 +11:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_MONKEY;
|
2022-01-12 22:30:43 +11:00
|
|
|
GetCollisionInfo(coll, item);
|
|
|
|
|
|
|
|
ShiftItem(item, coll);
|
|
|
|
DoLaraMonkeySnap(item, coll);
|
|
|
|
}
|
|
|
|
|
|
|
|
// State: LS_MONKEY_FORWARD (76)
|
2022-01-12 19:33:41 +11:00
|
|
|
// Collision: lara_col_monkey_forward()
|
|
|
|
void lara_as_monkey_forward(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:33:41 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2020-08-09 19:18:29 -05:00
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
2022-01-12 19:33:41 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
2020-08-09 19:18:29 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
2022-01-12 19:33:41 +11:00
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
|
|
|
if (info->turnRate < -LARA_MONKEY_MOVE_TURN_MAX)
|
|
|
|
info->turnRate = -LARA_MONKEY_MOVE_TURN_MAX;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
2022-01-12 19:33:41 +11:00
|
|
|
info->turnRate += LARA_TURN_RATE;
|
|
|
|
if (info->turnRate > LARA_MONKEY_MOVE_TURN_MAX)
|
|
|
|
info->turnRate = LARA_MONKEY_MOVE_TURN_MAX;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:33:41 +11:00
|
|
|
if (TrInput & IN_FORWARD)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_FORWARD;
|
|
|
|
return;
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
|
|
|
return;
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
SetLaraMonkeyFallState(item);
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
// State: LS_MONKEY_FORWARD (76)
|
2022-01-12 19:33:41 +11:00
|
|
|
// Control: lara_as_monkey_forward()
|
|
|
|
void lara_col_monkey_forward(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
info->moveAngle = item->pos.yRot;
|
2022-01-16 02:34:09 +11:00
|
|
|
coll->Setup.BadFloorHeightDown = NO_BAD_POS;
|
|
|
|
coll->Setup.BadFloorHeightUp = NO_HEIGHT;
|
2022-01-15 23:21:45 +11:00
|
|
|
coll->Setup.BadCeilingHeightDown = CLICK(1);
|
|
|
|
coll->Setup.BadCeilingHeightUp = -CLICK(1);
|
2022-01-12 19:33:41 +11:00
|
|
|
coll->Setup.ForwardAngle = info->moveAngle;
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2022-01-15 22:48:35 +11:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_MONKEY;
|
2022-01-12 19:33:41 +11:00
|
|
|
GetCollisionInfo(coll, item);
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 20:25:02 +11:00
|
|
|
if (LaraDeflectEdgeMonkey(item, coll))
|
|
|
|
LaraCollideStopMonkey(item, coll);
|
2021-10-28 03:45:18 +03:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
DoLaraMonkeySnap(item, coll);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
// State: LS_MONKEY_BACK (143)
|
2022-01-12 20:25:02 +11:00
|
|
|
// Collision: lara_col_monkey_back()
|
|
|
|
void lara_as_monkey_back(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
|
|
|
if (info->turnRate < -LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = -LARA_SLOW_TURN_MAX;
|
|
|
|
}
|
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
info->turnRate += LARA_TURN_RATE;
|
|
|
|
if (info->turnRate > LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = LARA_SLOW_TURN_MAX;
|
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2022-01-12 20:25:02 +11:00
|
|
|
{
|
|
|
|
if (TrInput & IN_BACK)
|
|
|
|
{
|
2022-01-12 22:30:43 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_BACK;
|
2022-01-12 20:25:02 +11:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLaraMonkeyFallState(item);
|
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
// State: LS_MONKEY_BACK (143)
|
2022-01-12 20:25:02 +11:00
|
|
|
// State: lara_as_monkey_back()
|
|
|
|
void lara_col_monkey_back(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->moveAngle = item->pos.yRot + ANGLE(180.0f);
|
2022-01-16 02:34:09 +11:00
|
|
|
coll->Setup.BadFloorHeightDown = NO_BAD_POS;
|
|
|
|
coll->Setup.BadFloorHeightUp = NO_HEIGHT;
|
2022-01-15 23:21:45 +11:00
|
|
|
coll->Setup.BadCeilingHeightDown = CLICK(1);
|
|
|
|
coll->Setup.BadCeilingHeightUp = -CLICK(1);
|
2022-01-12 20:25:02 +11:00
|
|
|
coll->Setup.ForwardAngle = info->moveAngle;
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2022-01-15 22:48:35 +11:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_MONKEY;
|
2022-01-12 20:25:02 +11:00
|
|
|
GetCollisionInfo(coll, item);
|
|
|
|
|
|
|
|
if (LaraDeflectEdgeMonkey(item, coll))
|
|
|
|
LaraCollideStopMonkey(item, coll);
|
|
|
|
|
|
|
|
DoLaraMonkeySnap(item, coll);
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
// State: LS_MONKEY_SHIMMY_LEFT (77)
|
|
|
|
// Collision: lara_col_monkey_shimmy_left()
|
|
|
|
void lara_as_monkey_shimmy_left(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2020-08-09 19:18:29 -05:00
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
2020-08-09 19:18:29 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
if (TrInput & IN_LEFT)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
|
|
|
if (info->turnRate < -LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = -LARA_SLOW_TURN_MAX;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
else if (TrInput & IN_RIGHT)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
info->turnRate += LARA_TURN_RATE;
|
|
|
|
if (info->turnRate > LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = LARA_SLOW_TURN_MAX;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
if (TrInput & IN_LSTEP)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_LEFT;
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
SetLaraMonkeyFallState(item);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
// State: LS_MONKEY_SHIMMY_LEFT (7)
|
|
|
|
// Control: lara_as_monkey_shimmy_left()
|
|
|
|
void lara_col_monkey_shimmy_left(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
LaraInfo*& info = item->data;
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
info->moveAngle = item->pos.yRot - ANGLE(90.0f);
|
2022-01-16 02:34:09 +11:00
|
|
|
coll->Setup.BadFloorHeightDown = NO_BAD_POS;
|
|
|
|
coll->Setup.BadFloorHeightUp = NO_HEIGHT;
|
2022-01-15 23:21:45 +11:00
|
|
|
coll->Setup.BadCeilingHeightDown = CLICK(0.8f);
|
|
|
|
coll->Setup.BadCeilingHeightUp = -CLICK(0.8f);
|
2022-01-12 19:58:37 +11:00
|
|
|
coll->Setup.ForwardAngle = info->moveAngle;
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2022-01-15 22:48:35 +11:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_MONKEY;
|
2022-01-12 19:58:37 +11:00
|
|
|
GetCollisionInfo(coll, item);
|
|
|
|
|
2022-01-12 20:25:02 +11:00
|
|
|
if (LaraDeflectEdgeMonkey(item, coll))
|
|
|
|
LaraCollideStopMonkey(item, coll);
|
2022-01-15 22:48:35 +11:00
|
|
|
|
|
|
|
DoLaraMonkeySnap(item, coll);
|
2022-01-12 19:58:37 +11:00
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
// State: LS_MONKEY_SHIMMY_RIGHT (78)
|
|
|
|
// Collision: lara_col_monkey_shimmy_right()
|
|
|
|
void lara_as_monkey_shimmy_right(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
2022-01-12 19:58:37 +11:00
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 19:58:37 +11:00
|
|
|
if (item->hitPoints <= 0)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
|
|
|
if (info->turnRate < -LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = -LARA_SLOW_TURN_MAX;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
else if (TrInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
info->turnRate += LARA_TURN_RATE;
|
|
|
|
if (info->turnRate > LARA_SLOW_TURN_MAX)
|
|
|
|
info->turnRate = LARA_SLOW_TURN_MAX;
|
|
|
|
}
|
|
|
|
|
2022-01-12 22:30:43 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
if (TrInput & IN_RSTEP)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:58:37 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_RIGHT;
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
|
|
|
return;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
SetLaraMonkeyFallState(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
// State: LS_MONKEY_SHIMMY_RIGHT (78)
|
|
|
|
// Control: lara_as_monkey_shimmy_right()
|
|
|
|
void lara_col_monkey_shimmy_right(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->moveAngle = item->pos.yRot + ANGLE(90.0f);
|
2022-01-16 02:34:09 +11:00
|
|
|
coll->Setup.BadFloorHeightDown = NO_BAD_POS;
|
|
|
|
coll->Setup.BadFloorHeightUp = NO_HEIGHT;
|
2022-01-15 23:21:45 +11:00
|
|
|
coll->Setup.BadCeilingHeightDown = CLICK(0.8f);
|
|
|
|
coll->Setup.BadCeilingHeightUp = -CLICK(0.8f);
|
2022-01-12 19:58:37 +11:00
|
|
|
coll->Setup.ForwardAngle = info->moveAngle;
|
|
|
|
coll->Setup.Radius = LARA_RAD;
|
2022-01-15 22:48:35 +11:00
|
|
|
coll->Setup.Height = LARA_HEIGHT_MONKEY;
|
2022-01-12 19:58:37 +11:00
|
|
|
GetCollisionInfo(coll, item);
|
|
|
|
|
2022-01-12 20:25:02 +11:00
|
|
|
if (LaraDeflectEdgeMonkey(item, coll))
|
|
|
|
LaraCollideStopMonkey(item, coll);
|
2022-01-12 19:58:37 +11:00
|
|
|
|
|
|
|
DoLaraMonkeySnap(item, coll);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:04:29 +11:00
|
|
|
// State: LS_MONKEY_TURN_180 (79)
|
|
|
|
// Control: lara_col_monkey_turn_180()
|
|
|
|
void lara_as_monkey_turn_180(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2021-09-10 00:20:59 +03:00
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
2022-01-12 19:04:29 +11:00
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:04:29 +11:00
|
|
|
void lara_col_monkey_turn_180(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
|
|
|
/*state 79*/
|
|
|
|
/*state code: lara_as_monkey180*/
|
2022-01-12 19:33:41 +11:00
|
|
|
lara_col_monkey_forward(item, coll);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
// State: LS_MONKEY_TURN_LEFT (82)
|
2022-01-12 19:04:29 +11:00
|
|
|
// Collision: lara_as_monkey_turn_left()
|
|
|
|
void lara_as_monkey_turn_left(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:04:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2020-08-09 19:18:29 -05:00
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
2022-01-12 19:04:29 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
2020-08-09 19:18:29 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2022-01-12 19:04:29 +11:00
|
|
|
{
|
|
|
|
if (TrInput & IN_LSTEP && TestLaraMonkeyShimmyLeft(item, coll))
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_LEFT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (TrInput & IN_RSTEP && TestLaraMonkeyShimmyRight(item, coll))
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_RIGHT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TrInput & IN_LEFT)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_TURN_LEFT;
|
2022-01-16 02:08:20 +11:00
|
|
|
|
|
|
|
// TODO: When an immediate dispatch out of this state becomes possible from any frame,
|
|
|
|
// move the following block right beneath the death check. @Sezz 2022.01.16
|
|
|
|
info->turnRate -= LARA_TURN_RATE;
|
|
|
|
if (info->turnRate < -LARA_MONKEY_TURN_MAX)
|
|
|
|
info->turnRate = -LARA_MONKEY_TURN_MAX;
|
|
|
|
|
2022-01-12 19:04:29 +11:00
|
|
|
return;
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
2022-01-12 19:04:29 +11:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLaraMonkeyFallState(item);
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
// State: LS_MONKEY_TURN_LEFT (82)
|
2022-01-12 19:04:29 +11:00
|
|
|
// Control: lara_as_monkey_turn_left()
|
|
|
|
void lara_col_monkey_turn_left(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
lara_col_monkey_idle(item, coll);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|
2022-01-12 19:04:29 +11:00
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
// State: LS_MONKEY_TURN_RIGHT (83)
|
2022-01-12 19:04:29 +11:00
|
|
|
// Collision: lara_as_monkey_turn_right()
|
|
|
|
void lara_as_monkey_turn_right(ITEM_INFO* item, COLL_INFO* coll)
|
2020-08-09 19:18:29 -05:00
|
|
|
{
|
2022-01-12 19:04:29 +11:00
|
|
|
LaraInfo*& info = item->data;
|
|
|
|
|
|
|
|
info->torsoXrot = 0;
|
|
|
|
info->torsoYrot = 0;
|
|
|
|
info->torsoZrot = 0;
|
|
|
|
coll->Setup.EnableObjectPush = false;
|
|
|
|
coll->Setup.EnableSpaz = false;
|
|
|
|
Camera.targetElevation = -ANGLE(5.0f);
|
|
|
|
|
2020-08-09 19:18:29 -05:00
|
|
|
if (item->hitPoints <= 0)
|
|
|
|
{
|
2022-01-12 19:04:29 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE; //
|
2020-08-09 19:18:29 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
if (TrInput & IN_ACTION && info->canMonkeySwing)
|
2022-01-12 19:04:29 +11:00
|
|
|
{
|
|
|
|
if (TrInput & IN_LSTEP && TestLaraMonkeyShimmyLeft(item, coll))
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_LEFT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (TrInput & IN_RSTEP && TestLaraMonkeyShimmyRight(item, coll))
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_SHIMMY_RIGHT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TrInput & IN_RIGHT)
|
|
|
|
{
|
|
|
|
item->goalAnimState = LS_MONKEY_TURN_RIGHT;
|
2022-01-16 02:08:20 +11:00
|
|
|
|
|
|
|
// TODO: When an immediate dispatch out of this state becomes possible from any frame,
|
|
|
|
// move the following block right beneath the death check. @Sezz 2022.01.16
|
|
|
|
info->turnRate += LARA_TURN_RATE;
|
|
|
|
if (info->turnRate > LARA_MONKEY_TURN_MAX)
|
|
|
|
info->turnRate = LARA_MONKEY_TURN_MAX;
|
|
|
|
|
2022-01-12 19:04:29 +11:00
|
|
|
return;
|
|
|
|
}
|
2020-08-09 19:18:29 -05:00
|
|
|
|
2022-01-12 17:31:03 +11:00
|
|
|
item->goalAnimState = LS_MONKEY_IDLE;
|
2022-01-12 19:04:29 +11:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLaraMonkeyFallState(item);
|
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:41 +11:00
|
|
|
// State: LS_MONKEY_TURN_RIGHT (83)
|
2022-01-12 19:04:29 +11:00
|
|
|
// Control: lara_as_monkey_turn_right()
|
|
|
|
void lara_col_monkey_turn_right(ITEM_INFO* item, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
lara_col_monkey_idle(item, coll);
|
2020-08-09 19:18:29 -05:00
|
|
|
}
|