mirror of
https://github.com/XProger/OpenLara.git
synced 2025-02-24 23:42:49 +01:00
save state for key in hole
This commit is contained in:
parent
bedc0df6ca
commit
776e4f31a3
20
src/lara.h
20
src/lara.h
@ -574,7 +574,9 @@ struct Lara : Character {
|
||||
}
|
||||
|
||||
bool canSaveGame() {
|
||||
return health > 0.0f && !burn;// && (state == STATE_STOP || state == STATE_TREAD || state == STATE_SURF_TREAD);
|
||||
return health > 0.0f && !burn
|
||||
&& state != STATE_USE_KEY
|
||||
&& state != STATE_USE_PUZZLE; // && (state == STATE_STOP || state == STATE_TREAD || state == STATE_SURF_TREAD);
|
||||
}
|
||||
|
||||
TR::Entity::Type getItemHands() {
|
||||
@ -1931,8 +1933,13 @@ struct Lara : Character {
|
||||
|
||||
keyHole = controller;
|
||||
|
||||
if (game->invUse(camera->cameraIndex, usedKey))
|
||||
if (game->invUse(camera->cameraIndex, usedKey)) {
|
||||
keyItem = game->addEntity(usedKey, getRoomIndex(), pos, 0);
|
||||
keyItem->lockMatrix = true;
|
||||
keyItem->pos = keyHole->pos + vec3(-484, -590, 0);
|
||||
keyItem->angle.x = PI * 0.5f;
|
||||
keyItem->angle.y = keyHole->angle.y;
|
||||
}
|
||||
|
||||
animation.setState(actionState);
|
||||
}
|
||||
@ -2831,12 +2838,9 @@ struct Lara : Character {
|
||||
if (animation.isFrameActive(state == STATE_USE_PUZZLE ? PUZZLE_FRAME : KEY_FRAME)) {
|
||||
keyHole->activate();
|
||||
if (keyItem) {
|
||||
if (state == STATE_USE_KEY) {
|
||||
mat4 &m = keyItem->matrix;
|
||||
m = keyHole->getMatrix();
|
||||
m.translate(vec3(0, -590, 484));
|
||||
m.rotateX(PI * 0.5f);
|
||||
} else
|
||||
if (state == STATE_USE_KEY)
|
||||
keyItem->lockMatrix = false;
|
||||
else
|
||||
game->removeEntity(keyItem);
|
||||
}
|
||||
|
||||
|
@ -968,6 +968,10 @@ struct Level : IGame {
|
||||
case TR::Entity::GEARS_1 :
|
||||
case TR::Entity::GEARS_2 :
|
||||
case TR::Entity::GEARS_3 : return new Gear(this, index);
|
||||
case TR::Entity::INV_KEY_1 :
|
||||
case TR::Entity::INV_KEY_2 :
|
||||
case TR::Entity::INV_KEY_3 :
|
||||
case TR::Entity::INV_KEY_4 : return new KeyItemInv(this, index);
|
||||
case TR::Entity::TRAP_FLOOR : return new TrapFloor(this, index);
|
||||
case TR::Entity::CRYSTAL : return new Crystal(this, index);
|
||||
case TR::Entity::TRAP_SWING_BLADE : return new TrapSwingBlade(this, index);
|
||||
|
@ -63,6 +63,12 @@ struct Gear : Controller {
|
||||
}
|
||||
};
|
||||
|
||||
struct KeyItemInv : Controller {
|
||||
KeyItemInv(IGame *game, int entity) : Controller(game, entity) {
|
||||
angle.x = PI * 0.5f;
|
||||
}
|
||||
};
|
||||
|
||||
#define DART_DAMAGE 50
|
||||
|
||||
struct Dart : Controller {
|
||||
|
Loading…
x
Reference in New Issue
Block a user