mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-31 08:45:36 +02:00
fix switch state management
This commit is contained in:
@@ -513,7 +513,7 @@ struct Controller {
|
||||
}
|
||||
|
||||
virtual bool activate() {
|
||||
if (flags.state != TR::Entity::asNone)
|
||||
if (flags.state == TR::Entity::asActive)
|
||||
return false;
|
||||
flags.invisible = false;
|
||||
flags.state = TR::Entity::asActive;
|
||||
|
@@ -1813,7 +1813,7 @@ struct Lara : Character {
|
||||
case TR::Level::Trigger::SWITCH : {
|
||||
Switch *controller = (Switch*)level->entities[info.trigCmd[cmdIndex++].args].controller;
|
||||
|
||||
if (controller->flags.state == TR::Entity::asNone) {
|
||||
if (controller->flags.state != TR::Entity::asActive) {
|
||||
limit = state == STATE_STOP ? &TR::Limits::SWITCH : &TR::Limits::SWITCH_UNDERWATER;
|
||||
if (checkInteraction(controller, limit, Input::state[camera->cameraIndex][cAction])) {
|
||||
actionState = (controller->state == Switch::STATE_DOWN && stand == STAND_GROUND) ? STATE_SWITCH_UP : STATE_SWITCH_DOWN;
|
||||
|
@@ -18,13 +18,18 @@ struct Switch : Controller {
|
||||
if (flags.state == TR::Entity::asInactive) {
|
||||
if (state == STATE_DOWN && t > 0.0f) {
|
||||
timer = t;
|
||||
flags.state = TR::Entity::asActive;
|
||||
Controller::activate();
|
||||
} else
|
||||
deactivate(true);
|
||||
Controller::deactivate(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void deactivate(bool removeFromList) {
|
||||
Controller::deactivate(true);
|
||||
flags.state = TR::Entity::asInactive;
|
||||
}
|
||||
|
||||
virtual bool activate() {
|
||||
if (Controller::activate()) {
|
||||
|
Reference in New Issue
Block a user