mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-16 01:54:38 +02:00
#22 fix falling boulder
This commit is contained in:
@@ -1705,7 +1705,7 @@ struct Lara : Character {
|
|||||||
TR::Level::FloorInfo info;
|
TR::Level::FloorInfo info;
|
||||||
level->getFloorInfo(e.room, e.x, e.y, e.z, info);
|
level->getFloorInfo(e.room, e.x, e.y, e.z, info);
|
||||||
|
|
||||||
if (info.lava && info.floor == e.y) {
|
if (e.type == TR::Entity::LARA && info.lava && info.floor == e.y) {
|
||||||
hit(LARA_MAX_HEALTH + 1, NULL, TR::HIT_LAVA);
|
hit(LARA_MAX_HEALTH + 1, NULL, TR::HIT_LAVA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -295,7 +295,10 @@ struct TrapBoulder : Controller {
|
|||||||
|
|
||||||
vec3 dir = getDir();
|
vec3 dir = getDir();
|
||||||
|
|
||||||
|
bool onGround = false;
|
||||||
|
|
||||||
if (pos.y >= info.floor - 256) {
|
if (pos.y >= info.floor - 256) {
|
||||||
|
onGround = true;
|
||||||
pos.y = float(info.floor);
|
pos.y = float(info.floor);
|
||||||
velocity = dir * animation.getSpeed();
|
velocity = dir * animation.getSpeed();
|
||||||
if (state != STATE_ROLL)
|
if (state != STATE_ROLL)
|
||||||
@@ -303,7 +306,7 @@ struct TrapBoulder : Controller {
|
|||||||
} else {
|
} else {
|
||||||
if (velocity.y == 0.0f)
|
if (velocity.y == 0.0f)
|
||||||
velocity.y = 10.0f;
|
velocity.y = 10.0f;
|
||||||
velocity.y += GRAVITY * Core::deltaTime;
|
applyGravity(velocity.y);
|
||||||
animation.setState(STATE_FALL);
|
animation.setState(STATE_FALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,15 +316,24 @@ struct TrapBoulder : Controller {
|
|||||||
if (info.roomNext != TR::NO_ROOM)
|
if (info.roomNext != TR::NO_ROOM)
|
||||||
getEntity().room = info.roomNext;
|
getEntity().room = info.roomNext;
|
||||||
|
|
||||||
|
if (onGround) {
|
||||||
game->checkTrigger(this, true);
|
game->checkTrigger(this, true);
|
||||||
|
}
|
||||||
|
|
||||||
vec3 v = pos + getDir() * 512.0f;
|
vec3 v = pos + getDir() * 512.0f;
|
||||||
level->getFloorInfo(getRoomIndex(), int(v.x), int(v.y), int(v.z), info);
|
level->getFloorInfo(getRoomIndex(), int(v.x), int(v.y), int(v.z), info);
|
||||||
if (pos.y > info.floor) {
|
if (pos.y > info.floor) {
|
||||||
|
if (onGround) {
|
||||||
pos = p;
|
pos = p;
|
||||||
deactivate();
|
deactivate();
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
pos.x = p.x;
|
||||||
|
pos.z = p.z;
|
||||||
|
velocity.x = velocity.z = 0.0f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Character *lara = (Character*)level->laraController;
|
Character *lara = (Character*)level->laraController;
|
||||||
if (lara->health > 0.0f && collide(lara)) {
|
if (lara->health > 0.0f && collide(lara)) {
|
||||||
|
Reference in New Issue
Block a user