mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-07 05:37:01 +02:00
fix flaming death for two players mode
This commit is contained in:
@@ -2064,7 +2064,7 @@ struct Mutant : Enemy {
|
|||||||
if (!(flags.unused & FLAG_FLY)) {
|
if (!(flags.unused & FLAG_FLY)) {
|
||||||
int16 roomIndex = getRoomIndex();
|
int16 roomIndex = getRoomIndex();
|
||||||
TR::Room::Sector *sector = level->getSector(roomIndex, pos);
|
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)
|
if (pos.y >= floor)
|
||||||
return STATE_STOP;
|
return STATE_STOP;
|
||||||
}
|
}
|
||||||
|
@@ -608,6 +608,7 @@ struct Lara : Character {
|
|||||||
void reset(int room, const vec3 &pos, float angle, Stand forceStand = STAND_GROUND) {
|
void reset(int room, const vec3 &pos, float angle, Stand forceStand = STAND_GROUND) {
|
||||||
visibleMask = 0xFFFFFFFF;
|
visibleMask = 0xFFFFFFFF;
|
||||||
health = LARA_MAX_HEALTH;
|
health = LARA_MAX_HEALTH;
|
||||||
|
oxygen = LARA_MAX_OXYGEN;
|
||||||
|
|
||||||
if (room == TR::NO_ROOM) {
|
if (room == TR::NO_ROOM) {
|
||||||
stand = STAND_AIR;
|
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])) {
|
if (!dozy && ((Input::state[pid][cAction] && Input::state[pid][cJump] && Input::state[pid][cLook] && Input::state[pid][cDash]) || Input::down[ikO])) {
|
||||||
dozy = true;
|
dozy = true;
|
||||||
health = LARA_MAX_HEALTH;
|
|
||||||
oxygen = LARA_MAX_OXYGEN;
|
|
||||||
reset(getRoomIndex(), pos - vec3(0, 512, 0), angle.y, STAND_UNDERWATER);
|
reset(getRoomIndex(), pos - vec3(0, 512, 0), angle.y, STAND_UNDERWATER);
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
@@ -775,6 +775,15 @@ struct Level : IGame {
|
|||||||
Lara *lead = players[index ^ 1];
|
Lara *lead = players[index ^ 1];
|
||||||
if (!lead) return;
|
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);
|
players[index]->reset(lead->getRoomIndex(), lead->pos, lead->angle.y, lead->stand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -126,17 +126,25 @@ struct TrapDartEmitter : Controller {
|
|||||||
|
|
||||||
struct Flame : Sprite {
|
struct Flame : Sprite {
|
||||||
|
|
||||||
static Flame* add(IGame *game, Controller *controller, int jointIndex) {
|
static Flame* add(IGame *game, Controller *owner, int jointIndex) {
|
||||||
Flame *flame = (Flame*)game->addEntity(TR::Entity::FLAME, controller->getRoomIndex(), controller->pos);
|
ASSERT(owner);
|
||||||
if (flame)
|
|
||||||
flame->jointIndex = jointIndex;
|
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;
|
return flame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller *owner;
|
||||||
int32 jointIndex;
|
int32 jointIndex;
|
||||||
float sleep;
|
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;
|
time = randf() * 3.0f;
|
||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
@@ -159,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*)game->getLara(pos);
|
Character *lara = (Character*)(owner ? 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