diff --git a/bin/OpenLara.exe b/bin/OpenLara.exe index 0b84c24..c881689 100644 Binary files a/bin/OpenLara.exe and b/bin/OpenLara.exe differ diff --git a/src/controller.h b/src/controller.h index 669c1a1..f1498bf 100644 --- a/src/controller.h +++ b/src/controller.h @@ -114,9 +114,10 @@ struct Controller { int roomIndex; } *explodeParts; + vec3 lastPos; bool invertAim; - Controller(IGame *game, int entity) : next(NULL), game(game), level(game->getLevel()), entity(entity), animation(level, getModel()), state(animation.state), layers(0), explodeMask(0), explodeParts(0), invertAim(false) { + Controller(IGame *game, int entity) : next(NULL), game(game), level(game->getLevel()), entity(entity), animation(level, getModel()), state(animation.state), layers(0), explodeMask(0), explodeParts(0), lastPos(0), invertAim(false) { const TR::Entity &e = getEntity(); pos = vec3(float(e.x), float(e.y), float(e.z)); angle = vec3(0.0f, e.rotation, 0.0f); @@ -193,8 +194,8 @@ struct Controller { info.trigger = TR::Level::Trigger::ACTIVATE; info.trigCmdCount = 0; - if (s.floor == TR::NO_FLOOR) - return; + //if (s.floor == TR::NO_FLOOR) + // return; TR::Room::Sector *sBelow = &s; while (sBelow->roomBelow != TR::NO_ROOM) sBelow = &level->getSector(sBelow->roomBelow, x, z, dx, dz); @@ -613,8 +614,8 @@ struct Controller { return index; } - virtual vec3& getPos() { - return pos; + virtual vec3 getPos() { + return getEntity().isActor() ? animation.getJoints(getMatrix(), 0).pos : pos; } vec3 getDir() const { @@ -826,7 +827,15 @@ struct Controller { virtual void updateAnimation(bool commands) { animation.update(); - + + if (level->isCutsceneLevel() && getEntity().isActor()) { + vec3 p = getPos(); + if ((p - lastPos).length2() > 256 * 256) { + game->waterDrop(p, 96.0, 0.1f); + lastPos = p; + } + } + TR::Animation *anim = animation; // apply animation commands diff --git a/src/debug.h b/src/debug.h index 19aaa94..3125942 100644 --- a/src/debug.h +++ b/src/debug.h @@ -467,7 +467,7 @@ namespace Debug { if (!controller || controller->flags.invisible) return; sprintf(buf, "%s (%d)", getEntityName(level, e), i); - Debug::Draw::text(controller->pos + randf() * 64, controller->flags.active ? vec4(0, 0, 0.8f, 1) : vec4(0.8f, 0, 0, 1), buf); + Debug::Draw::text(controller->getPos() + randf() * 64, controller->flags.active ? vec4(0, 0, 0.8f, 1) : vec4(0.8f, 0, 0, 1), buf); } for (int i = 0; i < level.camerasCount; i++) { diff --git a/src/lara.h b/src/lara.h index 0d1e64f..bd9066b 100644 --- a/src/lara.h +++ b/src/lara.h @@ -2595,11 +2595,8 @@ struct Lara : Character { if (level->isCutsceneLevel()) { updateAnimation(true); - vec3 p = pos; - pos = getPos(); - //checkRoom(); updateLights(); - pos = p; + if (fixRoomIndex() && braid) braid->update(); } else { @@ -2801,7 +2798,7 @@ struct Lara : Character { move(); } - virtual vec3& getPos() { + virtual vec3 getPos() { return level->isCutsceneLevel() ? chestOffset : pos; } diff --git a/src/level.h b/src/level.h index a8f2d93..40e4d1e 100644 --- a/src/level.h +++ b/src/level.h @@ -1541,6 +1541,7 @@ struct Level : IGame { renderEntities(transp); } + Core::setBlending(bmNone); if (water && waterCache && waterCache->visible) { Core::Pass pass = Core::pass; waterCache->renderMask();