mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-17 18:36:43 +02:00
#3 fix change slide direction
This commit is contained in:
10
src/lara.h
10
src/lara.h
@@ -2098,8 +2098,7 @@ struct Lara : Character {
|
|||||||
if (pos.y + 8 >= info.floor && (abs(info.slantX) > 2 || abs(info.slantZ) > 2)) {
|
if (pos.y + 8 >= info.floor && (abs(info.slantX) > 2 || abs(info.slantZ) > 2)) {
|
||||||
pos.y = info.floor;
|
pos.y = info.floor;
|
||||||
|
|
||||||
if (stand == STAND_GROUND)
|
slide();
|
||||||
slideStart();
|
|
||||||
|
|
||||||
return STAND_SLIDE;
|
return STAND_SLIDE;
|
||||||
}
|
}
|
||||||
@@ -2382,15 +2381,14 @@ struct Lara : Character {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void slideStart() {
|
void slide() {
|
||||||
if (state != STATE_SLIDE && state != STATE_SLIDE_BACK) {
|
|
||||||
TR::Level::FloorInfo info;
|
TR::Level::FloorInfo info;
|
||||||
getFloorInfo(getRoomIndex(), pos, info);
|
getFloorInfo(getRoomIndex(), pos, info);
|
||||||
|
|
||||||
int sx = abs(info.slantX), sz = abs(info.slantZ);
|
int sx = abs(info.slantX), sz = abs(info.slantZ);
|
||||||
// get direction
|
// get direction
|
||||||
float dir;
|
float dir;
|
||||||
if (sx > sz)
|
if (sx >= sz)
|
||||||
dir = info.slantX > 0 ? 3.0f : 1.0f;
|
dir = info.slantX > 0 ? 3.0f : 1.0f;
|
||||||
else
|
else
|
||||||
dir = info.slantZ > 0 ? 2.0f : 0.0f;
|
dir = info.slantZ > 0 ? 2.0f : 0.0f;
|
||||||
@@ -2403,9 +2401,9 @@ struct Lara : Character {
|
|||||||
}
|
}
|
||||||
|
|
||||||
angle.y = dir;
|
angle.y = dir;
|
||||||
|
if (animation.index != aIndex)
|
||||||
animation.setAnim(aIndex);
|
animation.setAnim(aIndex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual int getStateSlide() {
|
virtual int getStateSlide() {
|
||||||
if (input & JUMP)
|
if (input & JUMP)
|
||||||
|
Reference in New Issue
Block a user