1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-12 08:04:09 +02:00

#8 fix cutscenes bug; #22 add spot shadows for darts

This commit is contained in:
XProger
2017-10-04 01:07:55 +03:00
parent c208ece45c
commit 77d96ccb05
3 changed files with 16 additions and 10 deletions

View File

@@ -47,6 +47,7 @@ struct Camera : ICamera {
if (owner->getEntity().type != TR::Entity::LARA && level->cameraFrames) {
state = STATE_CUTSCENE;
room = level->entities[level->cutEntity].room;
timer = 0.0f;
} else
state = STATE_FOLLOW;
destPos = owner->pos - owner->getDir() * 1024.0f;
@@ -144,6 +145,14 @@ struct Camera : ICamera {
target = viewPoint;
}
virtual void doCutscene(const vec3 &pos, float rotation) {
state = Camera::STATE_CUTSCENE;
level->cutMatrix.identity();
level->cutMatrix.rotateY(angle.y);
level->cutMatrix.setPos(pos);
timer = 0.0f;
}
virtual void update() {
if (shake > 0.0f)
shake = max(0.0f, shake - Core::deltaTime);

View File

@@ -681,7 +681,7 @@ namespace TR {
}
bool isBlock() const {
return type >= TR::Entity::BLOCK_1 && type <= TR::Entity::BLOCK_4;
return type >= BLOCK_1 && type <= BLOCK_4;
}
bool isLara() const {
@@ -689,7 +689,7 @@ namespace TR {
}
bool castShadow() const {
return isLara() || isEnemy() || isActor();
return isLara() || isEnemy() || isActor() || type == TRAP_DART;
}
void getAxis(int &dx, int &dz) {
@@ -1505,7 +1505,7 @@ namespace TR {
}
for (int i = 0; i < spriteSequencesCount; i++)
if (spriteSequences[i].type == TR::Entity::GLYPH) {
if (spriteSequences[i].type == Entity::GLYPH) {
extra.glyphSeq = i;
break;
}
@@ -2041,8 +2041,8 @@ namespace TR {
}
int16 getModelIndex(Entity::Type type) const {
if (type == TR::Entity::ENEMY_MUTANT_2 || type == TR::Entity::ENEMY_MUTANT_3)
type = TR::Entity::ENEMY_MUTANT_1; // hardcoded mutant models remapping
if (type == Entity::ENEMY_MUTANT_2 || type == Entity::ENEMY_MUTANT_3)
type = Entity::ENEMY_MUTANT_1; // hardcoded mutant models remapping
for (int i = 0; i < modelsCount; i++)
if (type == models[i].type)
@@ -2056,7 +2056,7 @@ namespace TR {
return 0;
}
int entityAdd(TR::Entity::Type type, int16 room, int32 x, int32 y, int32 z, angle rotation, int16 intensity) {
int entityAdd(Entity::Type type, int16 room, int32 x, int32 y, int32 z, angle rotation, int16 intensity) {
for (int i = entitiesBaseCount; i < entitiesCount; i++)
if (entities[i].type == Entity::NONE) {
Entity &e = entities[i];

View File

@@ -1506,10 +1506,7 @@ struct Lara : Character {
if (item.type == TR::Entity::SCION_QUALOPEC) {
animation.setAnim(level->models[TR::MODEL_LARA_SPEC].animation);
((Camera*)level->cameraController)->state = Camera::STATE_CUTSCENE;
level->cutMatrix.identity();
level->cutMatrix.rotateY(angle.y);
level->cutMatrix.setPos(pos);
((Camera*)level->cameraController)->doCutscene(pos, angle.y);
} else
state = STATE_PICK_UP;