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