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

#3 fix onwater / waterout bug

This commit is contained in:
XProger
2017-02-20 00:33:08 +03:00
parent 57fc3f44f1
commit c99c2716a5

View File

@@ -1049,13 +1049,18 @@ struct Lara : Character {
vec3 dst = pos + getDir() * (LARA_RADIUS + 32.0f); vec3 dst = pos + getDir() * (LARA_RADIUS + 32.0f);
TR::Level::FloorInfo info; TR::Level::FloorInfo info;
level->getFloorInfo(collision.info[Collision::NONE].roomAbove, int(dst.x), int(dst.y), int(dst.z), info); level->getFloorInfo(getRoomIndex(), int(pos.x), int(pos.y), int(pos.z), info);
int roomAbove = info.roomAbove;
if (roomAbove == TR::NO_ROOM)
return false;
level->getFloorInfo(roomAbove, int(dst.x), int(dst.y), int(dst.z), info);
int h = int(pos.y - info.floor); int h = int(pos.y - info.floor);
if (h >= 0 && h <= (256 + 128) && (state == STATE_SURF_TREAD || animation.setState(STATE_SURF_TREAD)) && animation.setState(STATE_STOP)) { if (h >= 0 && h <= (256 + 128) && (state == STATE_SURF_TREAD || animation.setState(STATE_SURF_TREAD)) && animation.setState(STATE_STOP)) {
alignToWall(LARA_RADIUS); alignToWall(LARA_RADIUS);
getEntity().room = collision.info[Collision::NONE].roomAbove; getEntity().room = roomAbove;
pos.y = float(info.floor); pos.y = float(info.floor);
specular = LARA_WET_SPECULAR; specular = LARA_WET_SPECULAR;
updateEntity(); updateEntity();
@@ -1832,8 +1837,10 @@ struct Lara : Character {
maxDescent = maxAscent; maxDescent = maxAscent;
if (state == STATE_STEP_LEFT || state == STATE_STEP_RIGHT) if (state == STATE_STEP_LEFT || state == STATE_STEP_RIGHT)
maxAscent = maxDescent = 64; maxAscent = maxDescent = 64;
if (stand == STAND_ONWATER) if (stand == STAND_ONWATER) {
maxAscent = -1; maxAscent = -1;
offset.y = -64;
}
if (stand == STAND_HANG) { if (stand == STAND_HANG) {
maxHeight = 0; maxHeight = 0;
maxAscent = maxDescent = 64; maxAscent = maxDescent = 64;
@@ -1862,7 +1869,6 @@ struct Lara : Character {
pos = opos; pos = opos;
} }
/* /*
if (canPassGap) { if (canPassGap) {
level->getFloorInfo(e.room, (int)pos.x, (int)pos.y, (int)pos.z, info); level->getFloorInfo(e.room, (int)pos.x, (int)pos.y, (int)pos.z, info);