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

#8 fix static camera; #22 fix puzzle holes active state, fix pickups;

This commit is contained in:
XProger
2017-10-21 19:20:46 +03:00
parent 496e6641ff
commit cb04afb7bd
5 changed files with 24 additions and 14 deletions

View File

@@ -256,24 +256,23 @@ struct Camera : ICamera {
angle.x -= 60.0f * DEG2RAD;
Controller *lookAt = viewTarget;
lookAt = NULL;
Controller *lookAt = NULL;
if (state != STATE_STATIC) {
if (!owner->viewTarget) {
if (viewTarget && !viewTarget->getEntity().flags.invisible) {
vec3 targetVec = (viewTarget->pos - owner->pos).normal();
if (targetVec.dot(owner->getDir()) > 0.5f)
lookAt = viewTarget;
}
} else
lookAt = owner->viewTarget;
}
owner->lookAt(lookAt);
owner->lookAt(lookAt);
} else {
lookAt = viewTarget;
owner->lookAt(NULL);
}
vec3 viewPoint = getViewPoint();

View File

@@ -693,7 +693,7 @@ namespace TR {
}
bool isPuzzleHole() const {
return type >= PUZZLE_HOLE_1 && type <= PUZZLE_HOLE_2;
return type >= PUZZLE_HOLE_1 && type <= PUZZLE_HOLE_4;
}
bool isBlock() const {

View File

@@ -673,7 +673,7 @@ struct Inventory {
}
bool canFlipPage(int dir) {
if (((Character*)game->getLara())->health <= 0.0f)
if (game->getLevel()->id == TR::TITLE || ((Character*)game->getLara())->health <= 0.0f)
return false;
if (dir == -1) return page < PAGE_ITEMS && getItemsCount(page + 1);
if (dir == 1) return page > PAGE_OPTION && getItemsCount(page - 1);

View File

@@ -1659,14 +1659,20 @@ struct Lara : Character {
vec3 targetPos = controller->pos + (m * vec4(fx, limit->dy, limit->dz, 0.0f)).xyz;
vec3 deltaAbs = pos - targetPos;
vec3 deltaRel = (controller->getMatrix().transpose() * vec4(pos - controller->pos, 0.0f)).xyz; // inverse transform
// set item orientation to hack limits check
vec3 tmpAngle = controller->angle;
vec3 ctrlAngle = controller->angle;
if (stand == STAND_UNDERWATER)
ctrlAngle.x = -25 * DEG2RAD;
if (!limit->alignAngle)
ctrlAngle.y = angle.y;
controller->angle = ctrlAngle;
vec3 deltaRel = (controller->getMatrix().transpose() * vec4(pos - controller->pos, 0.0f)).xyz; // inverse transform
controller->angle = tmpAngle;
// set item orientation to hack limits check
if (limit->box.contains(deltaRel)) {
float deltaAngY = shortAngle(angle.y, ctrlAngle.y);
@@ -2429,6 +2435,9 @@ struct Lara : Character {
// scion debug (TODO: remove)
if (Input::down[ikP]) {
switch (level->id) {
case TR::LEVEL_3A :
reset(51, vec3(41015, 3584, 34494), -PI); // level 3a (t-rex)
break;
case TR::LEVEL_3B :
reset(5, vec3(73394, 3840, 60758), 0); // level 3b (scion)
break;

View File

@@ -1061,9 +1061,11 @@ struct Level : IGame {
// TODO: opqque/transparent pass for rooms and entities
void renderEntities(bool opaque) {
for (int i = 0; i < level.entitiesCount; i++) {
int modelIndex = level.entities[i].modelIndex;
TR::Entity &e = level.entities[i];
if (!e.controller) continue;
int modelIndex = e.modelIndex;
if ((modelIndex < 0 && !opaque) || (modelIndex > 0 && mesh->models[modelIndex - 1].opaque == opaque))
renderEntity(level.entities[i]);
renderEntity(e);
}
}