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