mirror of
https://github.com/XProger/OpenLara.git
synced 2025-04-22 03:51:58 +02:00
fix flaming death for two players mode
This commit is contained in:
parent
c7c86fae6f
commit
3885af71f5
@ -2064,7 +2064,7 @@ struct Mutant : Enemy {
|
||||
if (!(flags.unused & FLAG_FLY)) {
|
||||
int16 roomIndex = getRoomIndex();
|
||||
TR::Room::Sector *sector = level->getSector(roomIndex, pos);
|
||||
float floor = level->getFloor(sector, pos) - 1.0f;
|
||||
float floor = level->getFloor(sector, pos) - 128.0f;
|
||||
if (pos.y >= floor)
|
||||
return STATE_STOP;
|
||||
}
|
||||
|
@ -608,6 +608,7 @@ struct Lara : Character {
|
||||
void reset(int room, const vec3 &pos, float angle, Stand forceStand = STAND_GROUND) {
|
||||
visibleMask = 0xFFFFFFFF;
|
||||
health = LARA_MAX_HEALTH;
|
||||
oxygen = LARA_MAX_OXYGEN;
|
||||
|
||||
if (room == TR::NO_ROOM) {
|
||||
stand = STAND_AIR;
|
||||
@ -2573,8 +2574,6 @@ struct Lara : Character {
|
||||
|
||||
if (!dozy && ((Input::state[pid][cAction] && Input::state[pid][cJump] && Input::state[pid][cLook] && Input::state[pid][cDash]) || Input::down[ikO])) {
|
||||
dozy = true;
|
||||
health = LARA_MAX_HEALTH;
|
||||
oxygen = LARA_MAX_OXYGEN;
|
||||
reset(getRoomIndex(), pos - vec3(0, 512, 0), angle.y, STAND_UNDERWATER);
|
||||
return input;
|
||||
}
|
||||
|
@ -775,6 +775,15 @@ struct Level : IGame {
|
||||
Lara *lead = players[index ^ 1];
|
||||
if (!lead) return;
|
||||
|
||||
Controller *c = Controller::first;
|
||||
while (c) {
|
||||
Controller *next = c->next;
|
||||
if (c->getEntity().type == TR::Entity::FLAME && ((Flame*)c)->owner == players[index])
|
||||
removeEntity(c);
|
||||
c = next;
|
||||
}
|
||||
|
||||
players[index]->dozy = false;
|
||||
players[index]->reset(lead->getRoomIndex(), lead->pos, lead->angle.y, lead->stand);
|
||||
}
|
||||
|
||||
|
@ -126,17 +126,25 @@ struct TrapDartEmitter : Controller {
|
||||
|
||||
struct Flame : Sprite {
|
||||
|
||||
static Flame* add(IGame *game, Controller *controller, int jointIndex) {
|
||||
Flame *flame = (Flame*)game->addEntity(TR::Entity::FLAME, controller->getRoomIndex(), controller->pos);
|
||||
if (flame)
|
||||
flame->jointIndex = jointIndex;
|
||||
static Flame* add(IGame *game, Controller *owner, int jointIndex) {
|
||||
ASSERT(owner);
|
||||
|
||||
Flame *flame = (Flame*)game->addEntity(TR::Entity::FLAME, owner->getRoomIndex(), owner->pos);
|
||||
|
||||
int jCount = owner->getModel()->mCount;
|
||||
|
||||
if (flame) {
|
||||
flame->owner = owner;
|
||||
flame->jointIndex = jointIndex & jCount;
|
||||
}
|
||||
return flame;
|
||||
}
|
||||
|
||||
Controller *owner;
|
||||
int32 jointIndex;
|
||||
float sleep;
|
||||
|
||||
Flame(IGame *game, int entity) : Sprite(game, entity, false, Sprite::FRAME_ANIMATED), jointIndex(0), sleep(0.0f) {
|
||||
Flame(IGame *game, int entity) : Sprite(game, entity, false, Sprite::FRAME_ANIMATED), owner(NULL), jointIndex(0), sleep(0.0f) {
|
||||
time = randf() * 3.0f;
|
||||
activate();
|
||||
}
|
||||
@ -159,7 +167,7 @@ struct Flame : Sprite {
|
||||
Sprite::update();
|
||||
game->playSound(TR::SND_FLAME, pos, Sound::PAN);
|
||||
|
||||
Character *lara = (Character*)game->getLara(pos);
|
||||
Character *lara = (Character*)(owner ? owner : game->getLara(pos));
|
||||
|
||||
if (jointIndex > -1) {
|
||||
if (lara->stand == Character::STAND_UNDERWATER) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user