Unify all crawl extra moves

This commit is contained in:
Lwmte 2021-12-01 16:28:40 +03:00
parent c211a858ca
commit ca6d2eab59
5 changed files with 48 additions and 60 deletions

View file

@ -16,11 +16,7 @@ settings.errorMode = ErrorMode.WARN;
SetSettings(settings);
local anims = Animations.new();
anims.crawlExtraExits = true;
anims.crawlExtraVaults = true;
anims.crawlFlexSubmerged = true;
anims.crawlFlexWaterPullUp = true;
anims.crawlStep = true;
anims.crawlExtra = true;
anims.crouchRoll = true;
anims.monkeyRoll = true;
anims.monkeyVault = true;

View file

@ -192,51 +192,51 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)
return;
}
if (TrInput & IN_JUMP && g_GameFlow->Animations.CrawlExtraExits)
if (g_GameFlow->Animations.CrawlExtra)
{
GAME_VECTOR s, d;
s.x = LaraItem->pos.xPos;
s.y = LaraItem->pos.yPos - 96;
s.z = LaraItem->pos.zPos;
s.roomNumber = LaraItem->roomNumber;
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
d.y = s.y + LARA_HEADROOM;
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
if (LOS(&s, &d) &&
item->animNumber != LA_CROUCH_TO_CRAWL_START &&
item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE &&
LaraCeilingFront(item, item->pos.yRot, CLICK(3), CLICK(2)) != NO_HEIGHT &&
LaraCeilingFront(item, item->pos.yRot, CLICK(3), CLICK(2)) <= 0)
if (TrInput & IN_JUMP)
{
auto floorFront = LaraFloorFront(item, item->pos.yRot, CLICK(1));
GAME_VECTOR s, d;
if (floorFront <= CLICK(1))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_1CLICK);
}
else if (floorFront <= CLICK(2))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_23CLICK);
}
else if (floorFront <= CLICK(3))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_23CLICK);
}
if (floorFront > CLICK(3))
{
SetAnimation(item, LA_CRAWL_JUMP_FLIP_DOWN);
}
s.x = LaraItem->pos.xPos;
s.y = LaraItem->pos.yPos - 96;
s.z = LaraItem->pos.zPos;
s.roomNumber = LaraItem->roomNumber;
Lara.gunStatus = LG_HANDS_BUSY;
d.x = s.x + 768 * phd_sin(LaraItem->pos.yRot);
d.y = s.y + LARA_HEADROOM;
d.z = s.z + 768 * phd_cos(LaraItem->pos.yRot);
if (LOS(&s, &d) &&
item->animNumber != LA_CROUCH_TO_CRAWL_START &&
item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE &&
LaraCeilingFront(item, item->pos.yRot, CLICK(3), CLICK(2)) != NO_HEIGHT &&
LaraCeilingFront(item, item->pos.yRot, CLICK(3), CLICK(2)) <= 0)
{
auto floorFront = LaraFloorFront(item, item->pos.yRot, CLICK(1));
if (floorFront <= CLICK(1))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_1CLICK);
}
else if (floorFront <= CLICK(2))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_23CLICK);
}
else if (floorFront <= CLICK(3))
{
SetAnimation(item, LA_CRAWL_JUMP_DOWN_23CLICK);
}
if (floorFront > CLICK(3))
{
SetAnimation(item, LA_CRAWL_JUMP_FLIP_DOWN);
}
Lara.gunStatus = LG_HANDS_BUSY;
}
}
}
if ((TrInput & IN_ACTION) && (TrInput & IN_FORWARD) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE)
{
if (g_GameFlow->Animations.CrawlStep)
if ((TrInput & IN_ACTION) && (TrInput & IN_FORWARD) && item->animNumber != LA_CROUCH_TO_CRAWL_START && item->animNumber != LA_CROUCH_TO_CRAWL_CONTINUE)
{
if (LaraFloorFront(item, item->pos.yRot, 256) == -256 &&
LaraCeilingFront(item, item->pos.yRot, 256, 256) != NO_HEIGHT &&

View file

@ -93,7 +93,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
if (coll->Front.Floor < 0 && coll->Front.Floor >= -256)
{
if (g_GameFlow->Animations.CrawlExtraVaults && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
if (g_GameFlow->Animations.CrawlExtra && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
{
item->animNumber = LA_VAULT_TO_CROUCH_1CLICK;
item->currentAnimState = LS_GRABBING;
@ -118,7 +118,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
Lara.gunStatus = LG_HANDS_BUSY;
success = true;
}
else if (g_GameFlow->Animations.CrawlExtraVaults && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
else if (g_GameFlow->Animations.CrawlExtra && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
{
item->animNumber = LA_VAULT_TO_CROUCH_2CLICK;
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
@ -143,7 +143,7 @@ bool TestLaraVault(ITEM_INFO* item, COLL_INFO* coll)
Lara.gunStatus = LG_HANDS_BUSY;
success = true;
}
else if (g_GameFlow->Animations.CrawlExtraVaults && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
else if (g_GameFlow->Animations.CrawlExtra && (abs(coll->Front.Ceiling - coll->Front.Floor) < 256))
{
item->animNumber = LA_VAULT_TO_CROUCH_3CLICK;
item->frameNumber = g_Level.Anims[item->animNumber].frameBase;
@ -1202,7 +1202,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
{
if (headroom < LARA_HEIGHT)
{
if (g_GameFlow->Animations.CrawlFlexWaterPullUp)
if (g_GameFlow->Animations.CrawlExtra)
SetAnimation(item, LA_ONWATER_TO_CROUCH_1CLICK);
else
return false;
@ -1214,7 +1214,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
{
if (headroom < LARA_HEIGHT)
{
if (g_GameFlow->Animations.CrawlFlexSubmerged)
if (g_GameFlow->Animations.CrawlExtra)
SetAnimation(item, LA_ONWATER_TO_CROUCH_M1CLICK);
else
return false;
@ -1227,7 +1227,7 @@ bool TestLaraWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)
{
if (headroom < LARA_HEIGHT)
{
if (g_GameFlow->Animations.CrawlFlexWaterPullUp)
if (g_GameFlow->Animations.CrawlExtra)
SetAnimation(item, LA_ONWATER_TO_CROUCH_0CLICK);
else
return false;

View file

@ -10,11 +10,7 @@ New custom animations which Lara can perform.
void GameScriptAnimations::Register(sol::state* lua)
{
lua->new_usertype<GameScriptAnimations>("Animations",
"crawlExtraExits", &GameScriptAnimations::CrawlExtraExits,
"crawlExtraVaults", &GameScriptAnimations::CrawlExtraVaults,
"crawlFlexSubmerged", &GameScriptAnimations::CrawlFlexSubmerged,
"crawlFlexWaterPullUp", &GameScriptAnimations::CrawlFlexWaterPullUp,
"crawlStep", &GameScriptAnimations::CrawlStep,
"crawlExtra", &GameScriptAnimations::CrawlExtra,
"crouchRoll", &GameScriptAnimations::CrouchRoll,
"monkeyRoll", &GameScriptAnimations::MonkeyRoll,
"monkeyVault", &GameScriptAnimations::MonkeyVault,

View file

@ -11,14 +11,10 @@ struct GameScriptAnimations
{
bool CrouchRoll; // Crouch roll
bool MonkeyRoll; // The 180 degrees roll on monkeybars
bool CrawlStep; // Going 1 click up/down in crawlspaces
bool CrawlExtraExits; // Crawlspace exits at 1/2/3 clicks
bool CrawlExtraVaults; // Vault into crawlspace at 1/2/3 clicks
bool CrawlExtra; // All extra crawl moves
bool MonkeyVault; // Vault up to monkeybars when pressing up + action underneath them
bool SwandiveRollRun; // The transition from swandive roll to run
bool OscillateHanging; // The thin ledge grab animation from TR1 and 2
bool CrawlFlexWaterPullUp;
bool CrawlFlexSubmerged;
static void Register(sol::state* lua);
};