water crawlspaces and crawl handling

This commit is contained in:
Woops 2020-05-20 22:07:27 -05:00
parent 08305a2885
commit d0b542b106
3 changed files with 80 additions and 5 deletions

View file

@ -5124,6 +5124,12 @@ void lara_as_all4s(ITEM_INFO* item, COLL_INFO* coll)//14970, 14A78 (F)
Lara.gunStatus = LG_HANDS_BUSY;
Camera.targetElevation = -ANGLE(23);
if (Rooms[LaraItem->roomNumber].flags & ENV_FLAG_WATER)
{
item->goalAnimState = STATE_LARA_CROUCH_IDLE;
item->requiredAnimState = STATE_LARA_STOP;
}
}
void lara_col_duck(ITEM_INFO* item, COLL_INFO* coll)//147C4, 148CC (F)
@ -5201,7 +5207,9 @@ void lara_as_duck(ITEM_INFO* item, COLL_INFO* coll)//14688, 14738 (F)
&& (TrInput & IN_DUCK || Lara.keepDucked)
&& Lara.gunStatus == LG_NO_ARMS
&& Lara.waterStatus != LW_WADE
&& !(Rooms[roomNum].flags & ENV_FLAG_WATER))
|| Lara.waterSurfaceDist == 256
&& !(Lara.waterSurfaceDist > 256)
/*&& !(Rooms[roomNum].flags & ENV_FLAG_WATER)*/)
{
if ((item->animNumber == ANIMATION_LARA_CROUCH_IDLE
@ -5223,7 +5231,9 @@ void lara_as_duck(ITEM_INFO* item, COLL_INFO* coll)//14688, 14738 (F)
&& (TrInput & IN_DUCK || Lara.keepDucked)
&& Lara.gunStatus == LG_NO_ARMS
&& Lara.waterStatus != LW_WADE
&& !(Rooms[roomNum].flags & ENV_FLAG_WATER)) //is this necessary?
|| Lara.waterSurfaceDist == 256
&& !(Lara.waterSurfaceDist > 256))
//&& !(Rooms[roomNum].flags & ENV_FLAG_WATER)) //is this necessary?- update: nope, it's not
{
lara_as_crouch_roll(item, coll);
}
@ -5235,7 +5245,7 @@ void lara_as_crouch_roll(ITEM_INFO* item, COLL_INFO* coll)
/*stop Lara from doing it in these conditions to avoid trouble*/
if (LaraFloorFront(item, item->pos.yRot, 1024) >= 384 || //4 clicks away from holes in the floor
TestWall(item, 1024, 0, -128)) //4 clicks away from walls
TestWall(item, 1024, 0, -256)) //4 clicks away from walls
{
return;
}

View file

@ -344,6 +344,7 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)//4D22C, 4D690
return 0;
int frontFloor = coll->frontFloor + 700;
int frontCeiling = coll->frontCeiling + 700;
if (frontFloor <= -512 || frontFloor > 316)
return 0;
@ -401,6 +402,53 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)//4D22C, 4D690
item->pos.zPos = (item->pos.zPos & 0xFFFFFC00) + 1124;
}
if (frontFloor <= -256)
{
if (LaraCeilingFront(item, item->pos.yRot, 256, 512) >= -512)
{
item->animNumber = ANIMATION_LARA_CLIMB_OUT_OF_WATER_TO_2CLICK;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = ANIMATION_LARA_CROUCH_IDLE;
}
else
{
item->animNumber = ANIMATION_LARA_CLIMB_OUT_OF_WATER;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = STATE_LARA_STOP;
}
}
else if (128 > frontFloor >= 0)
{
if (LaraCeilingFront(item, item->pos.yRot, 256, 512) >= -512)
{
item->animNumber = ANIMATION_LARA_ONWATER_TO_LAND_LOW_TO_2CLICK;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = ANIMATION_LARA_CROUCH_IDLE;
}
else
{
item->animNumber = ANIMATION_LARA_ONWATER_TO_LAND_LOW;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = STATE_LARA_STOP;
}
}
if (frontFloor > 128)
{
if (LaraCeilingFront(item, item->pos.yRot, 256, 512) >= -512)
{
item->animNumber = ANIMATION_LARA_WATER_TO_SUBMERGED_CRAWL;
item->frameNumber = Anims[item->animNumber].frameBase;
item->goalAnimState = ANIMATION_LARA_CROUCH_IDLE;
}
else
item->animNumber = ANIMATION_LARA_ONWATER_TO_WADE;
item->frameNumber = Anims[item->animNumber].frameBase;
// item->goalAnimState = STATE_LARA_STOP;
}
/*
if (frontFloor >= -128)
{
if (frontFloor >= 128)
@ -410,18 +458,32 @@ int LaraTestWaterClimbOut(ITEM_INFO* item, COLL_INFO* coll)//4D22C, 4D690
}
else
{
if (LaraFloorFront(item, item->pos.yRot, 256) == -256 &&
LaraCeilingFront(item, item->pos.yRot, 256, 256) != NO_HEIGHT &&
LaraCeilingFront(item, item->pos.yRot, 256, 256) <= -512)
{
item->animNumber = ANIMATION_LARA_ONWATER_TO_LAND_LOW_TO_2CLICK;
item->frameNumber = Anims[item->animNumber].frameBase;
}
item->animNumber = ANIMATION_LARA_ONWATER_TO_LAND_LOW;
item->frameNumber = Anims[item->animNumber].frameBase;
}
}
else
{
item->animNumber = ANIMATION_LARA_CLIMB_OUT_OF_WATER;
if (LaraFloorFront(item, item->pos.yRot, 256) == -256 &&
LaraCeilingFront(item, item->pos.yRot, 256, 256) != NO_HEIGHT &&
LaraCeilingFront(item, item->pos.yRot, 256, 256) <= -512)
{
item->animNumber = ANIMATION_LARA_CLIMB_OUT_OF_WATER_TO_2CLICK;
item->frameNumber = Anims[item->animNumber].frameBase;
}
item->animNumber = ANIMATION_LARA_CLIMB_OUT_OF_WATER;
item->frameNumber = Anims[item->animNumber].frameBase;
}*/
item->currentAnimState = STATE_LARA_ONWATER_EXIT;
item->goalAnimState = STATE_LARA_STOP;
// item->goalAnimState = STATE_LARA_STOP;
item->pos.yRot = rot;
Lara.gunStatus = LG_HANDS_BUSY;
item->pos.zRot = 0;

View file

@ -858,6 +858,9 @@ enum LARA_ANIM
ANIMATION_LARA_1CLICK_CRAWL_EXIT = 477, // 1 click crawlspace exit
ANIMATION_LARA_2CLICK_CRAWL_EXIT = 478, // 2 click crawlspace exit
ANIMATION_LARA_1CLICK_CRAWL_TO_CRAWL = 479, // maneuver up 1 click in crawlspace
ANIMATION_LARA_CLIMB_OUT_OF_WATER_TO_2CLICK = 480, // climb out of water to 2click crawlspace
ANIMATION_LARA_ONWATER_TO_LAND_LOW_TO_2CLICK = 481, // climb out of onwater to 2click crawlspace
ANIMATION_LARA_WATER_TO_SUBMERGED_CRAWL = 482, // wade out of water to submerged crawlspace
NUM_LARA_ANIMS
};