1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-07-31 18:30:19 +02:00

#23 cutscene actors interaction with water; fix refraction; #15 windows executable

This commit is contained in:
XProger
2017-11-30 06:45:57 +03:00
parent 588abaf42f
commit 493c1db0c7
5 changed files with 19 additions and 12 deletions

Binary file not shown.

View File

@@ -114,9 +114,10 @@ struct Controller {
int roomIndex; int roomIndex;
} *explodeParts; } *explodeParts;
vec3 lastPos;
bool invertAim; 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(); const TR::Entity &e = getEntity();
pos = vec3(float(e.x), float(e.y), float(e.z)); pos = vec3(float(e.x), float(e.y), float(e.z));
angle = vec3(0.0f, e.rotation, 0.0f); angle = vec3(0.0f, e.rotation, 0.0f);
@@ -193,8 +194,8 @@ struct Controller {
info.trigger = TR::Level::Trigger::ACTIVATE; info.trigger = TR::Level::Trigger::ACTIVATE;
info.trigCmdCount = 0; info.trigCmdCount = 0;
if (s.floor == TR::NO_FLOOR) //if (s.floor == TR::NO_FLOOR)
return; // return;
TR::Room::Sector *sBelow = &s; TR::Room::Sector *sBelow = &s;
while (sBelow->roomBelow != TR::NO_ROOM) sBelow = &level->getSector(sBelow->roomBelow, x, z, dx, dz); while (sBelow->roomBelow != TR::NO_ROOM) sBelow = &level->getSector(sBelow->roomBelow, x, z, dx, dz);
@@ -613,8 +614,8 @@ struct Controller {
return index; return index;
} }
virtual vec3& getPos() { virtual vec3 getPos() {
return pos; return getEntity().isActor() ? animation.getJoints(getMatrix(), 0).pos : pos;
} }
vec3 getDir() const { vec3 getDir() const {
@@ -826,7 +827,15 @@ struct Controller {
virtual void updateAnimation(bool commands) { virtual void updateAnimation(bool commands) {
animation.update(); 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; TR::Animation *anim = animation;
// apply animation commands // apply animation commands

View File

@@ -467,7 +467,7 @@ namespace Debug {
if (!controller || controller->flags.invisible) return; if (!controller || controller->flags.invisible) return;
sprintf(buf, "%s (%d)", getEntityName(level, e), i); 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++) { for (int i = 0; i < level.camerasCount; i++) {

View File

@@ -2595,11 +2595,8 @@ struct Lara : Character {
if (level->isCutsceneLevel()) { if (level->isCutsceneLevel()) {
updateAnimation(true); updateAnimation(true);
vec3 p = pos;
pos = getPos();
//checkRoom();
updateLights(); updateLights();
pos = p;
if (fixRoomIndex() && braid) if (fixRoomIndex() && braid)
braid->update(); braid->update();
} else { } else {
@@ -2801,7 +2798,7 @@ struct Lara : Character {
move(); move();
} }
virtual vec3& getPos() { virtual vec3 getPos() {
return level->isCutsceneLevel() ? chestOffset : pos; return level->isCutsceneLevel() ? chestOffset : pos;
} }

View File

@@ -1541,6 +1541,7 @@ struct Level : IGame {
renderEntities(transp); renderEntities(transp);
} }
Core::setBlending(bmNone);
if (water && waterCache && waterCache->visible) { if (water && waterCache && waterCache->visible) {
Core::Pass pass = Core::pass; Core::Pass pass = Core::pass;
waterCache->renderMask(); waterCache->renderMask();