mirror of
https://github.com/XProger/OpenLara.git
synced 2025-02-24 23:42:49 +01:00
#3 fix death in the air, fix enemies target after removing the second player, fix flame emitters
This commit is contained in:
parent
bc55f32541
commit
fa44799138
@ -167,8 +167,13 @@ struct Character : Controller {
|
||||
virtual bool useHeadAnimation() { return false; }
|
||||
|
||||
int getNextState() {
|
||||
if (input & DEATH)
|
||||
return getStateDeath();
|
||||
if (input & DEATH) {
|
||||
int deathState = getStateDeath();
|
||||
if (animation.canSetState(deathState)) {
|
||||
velocity = vec3(0.0f);
|
||||
return deathState;
|
||||
}
|
||||
}
|
||||
|
||||
switch (stand) {
|
||||
case STAND_AIR : return getStateAir();
|
||||
|
@ -1497,8 +1497,8 @@ struct Lara : Character {
|
||||
arms[0].tracking = arms[1].tracking = NULL;
|
||||
arms[0].target = arms[1].target = NULL;
|
||||
viewTarget = NULL;
|
||||
velocity = vec3(0.0f);
|
||||
animation.overrideMask = 0;
|
||||
int oldState = state;
|
||||
|
||||
switch (hitType) {
|
||||
case TR::HIT_FALL : {
|
||||
@ -1574,6 +1574,9 @@ struct Lara : Character {
|
||||
for (int i = 0; i < 10; i++)
|
||||
Flame::add(game, this, int(randf() * 24.0f));
|
||||
}
|
||||
|
||||
if (state != oldState)
|
||||
velocity = vec3(0.0f);
|
||||
};
|
||||
|
||||
bool useItem(TR::Entity::Type item) {
|
||||
@ -2513,7 +2516,6 @@ struct Lara : Character {
|
||||
}
|
||||
|
||||
virtual int getStateDeath() {
|
||||
velocity = vec3(0.0f);
|
||||
return (stand == STAND_UNDERWATER || stand == STAND_ONWATER) ? STATE_UNDERWATER_DEATH : (state == STATE_MIDAS_DEATH ? STATE_MIDAS_DEATH : STATE_DEATH);
|
||||
}
|
||||
|
||||
|
16
src/level.h
16
src/level.h
@ -797,8 +797,7 @@ struct Level : IGame {
|
||||
players[index]->camera->cameraIndex = index;
|
||||
Sound::listenersCount = 2;
|
||||
} else if (index == 1) {
|
||||
removeEntity(players[index]);
|
||||
players[index] = NULL;
|
||||
removePlayer(index);
|
||||
Sound::listenersCount = 1;
|
||||
return;
|
||||
}
|
||||
@ -817,6 +816,19 @@ struct Level : IGame {
|
||||
players[index]->reset(lead->getRoomIndex(), lead->pos, lead->angle.y, lead->stand);
|
||||
}
|
||||
|
||||
void removePlayer(int index) {
|
||||
for (int i = 0; i < level.entitiesCount; i++) {
|
||||
if (level.entities[i].controller && level.entities[i].isEnemy()) {
|
||||
Enemy *e = (Enemy*)level.entities[i].controller;
|
||||
if (e->target == players[index]) {
|
||||
e->target = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
removeEntity(players[index]);
|
||||
players[index] = NULL;
|
||||
}
|
||||
|
||||
Controller* initController(int index) {
|
||||
if (level.entities[index].type == TR::Entity::CUT_1 && (level.version & TR::VER_TR1))
|
||||
return new Lara(this, index);
|
||||
|
@ -167,7 +167,7 @@ struct Flame : Sprite {
|
||||
Sprite::update();
|
||||
game->playSound(TR::SND_FLAME, pos, Sound::PAN);
|
||||
|
||||
Character *lara = (Character*)(owner ? owner : game->getLara(pos));
|
||||
Character *lara = (Character*)((owner && owner->getEntity().isLara()) ? owner : game->getLara(pos));
|
||||
|
||||
if (jointIndex > -1) {
|
||||
if (lara->stand == Character::STAND_UNDERWATER) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user