1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-17 02:24:07 +02:00

#3 fix change slide direction

This commit is contained in:
XProger
2018-07-21 03:32:02 +03:00
parent 15f0a0d220
commit 2954ef894f

View File

@@ -2098,8 +2098,7 @@ struct Lara : Character {
if (pos.y + 8 >= info.floor && (abs(info.slantX) > 2 || abs(info.slantZ) > 2)) {
pos.y = info.floor;
if (stand == STAND_GROUND)
slideStart();
slide();
return STAND_SLIDE;
}
@@ -2382,15 +2381,14 @@ struct Lara : Character {
return res;
}
void slideStart() {
if (state != STATE_SLIDE && state != STATE_SLIDE_BACK) {
void slide() {
TR::Level::FloorInfo info;
getFloorInfo(getRoomIndex(), pos, info);
int sx = abs(info.slantX), sz = abs(info.slantZ);
// get direction
float dir;
if (sx > sz)
if (sx >= sz)
dir = info.slantX > 0 ? 3.0f : 1.0f;
else
dir = info.slantZ > 0 ? 2.0f : 0.0f;
@@ -2403,9 +2401,9 @@ struct Lara : Character {
}
angle.y = dir;
if (animation.index != aIndex)
animation.setAnim(aIndex);
}
}
virtual int getStateSlide() {
if (input & JUMP)