Skip to content

Commit

Permalink
TSAGE: Fix for bug #3541354 - Nico shooting player after being tied up
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 11, 2012
1 parent 14832ea commit 108e709
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 39 deletions.
73 changes: 37 additions & 36 deletions engines/tsage/blue_force/blueforce_scenes9.cpp
Expand Up @@ -794,12 +794,12 @@ bool Scene910::Lyle::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;

if (action == CURSOR_USE) {
if (BF_GLOBALS._v4CEE2 == 0)
if (BF_GLOBALS._nico910State == 0)
return NamedObject::startAction(action, event);
else
return false;
} else if (action == CURSOR_TALK) {
if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._v4CEE2 != 0)) {
if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._nico910State != 0)) {
scene->_stripManager.start(9100 + _field90, &BF_GLOBALS._stripProxy);
if (_field90 < 1)
_field90++;
Expand Down Expand Up @@ -833,7 +833,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case CURSOR_TALK:
if (BF_GLOBALS._v4CEE2 >= 4)
if (BF_GLOBALS._nico910State >= 4)
return NamedObject::startAction(action, event);

if (BF_GLOBALS._v4CEE6 < 4)
Expand All @@ -847,8 +847,8 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case INV_COLT45:
if (BF_GLOBALS._v4CEE2 > 1) {
if (BF_GLOBALS._v4CEE2 != 4) {
if (BF_GLOBALS._nico910State > 1) {
if (BF_GLOBALS._nico910State != 4) {
if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())) {
if (scene->_field2DE0 == 0) {
BF_GLOBALS._player.disableControl();
Expand Down Expand Up @@ -880,7 +880,7 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
break;
case INV_BADGE:
case INV_ID:
if (BF_GLOBALS._v4CEE2 >= 4)
if (BF_GLOBALS._nico910State >= 4)
return NamedObject::startAction(action, event);

if (BF_GLOBALS._v4CEE6 < 4)
Expand All @@ -895,11 +895,12 @@ bool Scene910::Nico::startAction(CursorType action, Event &event) {
return true;
break;
case INV_YELLOW_CORD:
if (BF_GLOBALS._v4CEE2 < 4) {
if (BF_GLOBALS._nico910State < 4) {
BF_GLOBALS._player.disableControl();
scene->_yellowCord.fixPriority(121);
scene->_sceneSubMode = 10;
scene->_sceneMode = 9123;
BF_GLOBALS._nico910State = 3;
if (BF_GLOBALS._player._visage == 1911)
scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
else
Expand Down Expand Up @@ -995,7 +996,7 @@ bool Scene910::Stuart::startAction(CursorType action, Event &event) {
return true;
} else {
BF_GLOBALS._player.disableControl();
if (BF_GLOBALS._v4CEE2 == 4) {
if (BF_GLOBALS._nico910State == 4) {
scene->_sceneSubMode = 11;
scene->_sceneMode = 9123;
if (BF_GLOBALS._player._visage == 1911)
Expand Down Expand Up @@ -1136,7 +1137,7 @@ bool Scene910::BreakerBox::startAction(CursorType action, Event &event) {
SceneItem::display2(910, 62);
return true;
} else if (scene->_sceneMode != 9120) {
if (BF_GLOBALS._v4CEE2 == 1) {
if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9118;
scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
Expand Down Expand Up @@ -1291,15 +1292,15 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) {

switch (_state) {
case 1:
if (BF_GLOBALS._v4CEE2 < 1) {
if (BF_GLOBALS._nico910State < 1) {
if (_frame == 2) {
if (!BF_GLOBALS.getFlag(fGotPointsForClosingDoor)) {
T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(fGotPointsForClosingDoor);
}
scene->_sceneMode = 0;
if (BF_GLOBALS._dayNumber == 5) {
if (BF_GLOBALS._v4CEE2 == 0) {
if (BF_GLOBALS._nico910State == 0) {
scene->_breakerBoxInset.remove();
// _objectList.draw();
BF_GLOBALS._player.disableControl();
Expand All @@ -1309,7 +1310,7 @@ bool Scene910::Object13::startAction(CursorType action, Event &event) {
scene->_nico.postInit();
scene->_sceneMode = 9129;
scene->setAction(&scene->_sequenceManager1, scene, 9129, &BF_GLOBALS._player, &scene->_nico, NULL);
} else if (BF_GLOBALS._v4CEE2 == 2) {
} else if (BF_GLOBALS._nico910State == 2) {
scene->_breakerBoxInset.remove();
// _objectList.draw();
BF_GLOBALS._player.disableControl();
Expand Down Expand Up @@ -1612,7 +1613,7 @@ bool Scene910::BlackPlug::startAction(CursorType action, Event &event) {
SET_EXT_FGCOLOR, 13, LIST_END);
return true;
}
if (BF_GLOBALS._v4CEE2 == 3) {
if (BF_GLOBALS._nico910State == 3) {
SceneItem::display(910, 84, SET_WIDTH, 312,
SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
Expand Down Expand Up @@ -1830,7 +1831,7 @@ bool Scene910::Generator::startAction(CursorType action, Event &event) {
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
SET_EXT_FGCOLOR, 13, LIST_END);
else if (BF_GLOBALS._v4CEE2 == 1) {
else if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9118;
scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
Expand Down Expand Up @@ -1869,7 +1870,7 @@ bool Scene910::Item2::startAction(CursorType action, Event &event) {
bool Scene910::Item3::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;

if ((action == CURSOR_TALK) && (BF_GLOBALS._v4CEE2 == 4) && (BF_GLOBALS._v4CEE4 == 0)) {
if ((action == CURSOR_TALK) && (BF_GLOBALS._nico910State == 4) && (BF_GLOBALS._v4CEE4 == 0)) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 15;
scene->_stripManager.start(9102, scene);
Expand Down Expand Up @@ -1907,7 +1908,7 @@ bool Scene910::Item15::startAction(CursorType action, Event &event) {
bool Scene910::Item16::startAction(CursorType action, Event &event) {
Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;

if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0))
if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0))
return false;

if (BF_GLOBALS._player._visage == 1911) {
Expand Down Expand Up @@ -2016,7 +2017,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
if (BF_GLOBALS._dayNumber < 5)
_item17.setDetails(Rect(0, 149, 29, 167), 910, -1, -1, -1, 1, NULL);

if (BF_GLOBALS._v4CEE2 == 0)
if (BF_GLOBALS._nico910State == 0)
_item16.setDetails(Rect(265, 18, 319, 102), 910, -1, -1, -1, 1, NULL);

_breakerBox.setDetails(910, 6, -1, -1, 1, (SceneItem *)NULL);
Expand Down Expand Up @@ -2048,7 +2049,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
|| (BF_GLOBALS._sceneManager._previousScene == 190)
|| (BF_GLOBALS._sceneManager._previousScene == 300)) {
BF_GLOBALS._sceneManager._previousScene = 900;
BF_GLOBALS._v4CEE2 = 0;
BF_GLOBALS._nico910State = 0;
BF_GLOBALS._v4CEE4 = 0;
}

Expand Down Expand Up @@ -2142,7 +2143,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
_nico.setPosition(Common::Point(262, 124));
_nico.setStrip(6);
BF_GLOBALS._v4CEE6 = 0;
BF_GLOBALS._v4CEE2 = 1;
BF_GLOBALS._nico910State = 1;
_nico.setDetails(910, 63, 64, 67, 5, &_item4);
BF_GLOBALS._v4CECA = 2;
if (BF_GLOBALS._v4CECC == 0)
Expand All @@ -2157,7 +2158,7 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.disableControl();
}

if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)){
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)){
_shadow.postInit();
_shadow.setAction(&_action2);
}
Expand Down Expand Up @@ -2297,7 +2298,7 @@ void Scene910::signal() {
case 13:
BF_GLOBALS._player.disableControl();
BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 9117, &_nico, NULL);
BF_GLOBALS._v4CEE2 = 2;
BF_GLOBALS._nico910State = 2;
// No break on purpose
case 15:
_stuart.postInit();
Expand All @@ -2314,7 +2315,7 @@ void Scene910::signal() {
_lyle._field90 = 1;
_sceneMode = 10;
addFader((const byte *)&black, 2, this);
BF_GLOBALS._v4CEE2 = 1;
BF_GLOBALS._nico910State = 1;
BF_GLOBALS._walkRegions.disableRegion(16);
BF_GLOBALS._walkRegions.disableRegion(14);
BF_GLOBALS._sceneItems.remove(&_item16);
Expand All @@ -2324,7 +2325,7 @@ void Scene910::signal() {
BF_GLOBALS._player._frame = 1;
if (_field2DE2 == 0) {
_field2DE2 = 1;
if (BF_GLOBALS._v4CEE2 == 4) {
if (BF_GLOBALS._nico910State == 4) {
_sceneMode = 9149;
setAction(&_sequenceManager1, this, 9149, &BF_GLOBALS._player, NULL);
} else {
Expand Down Expand Up @@ -2452,7 +2453,7 @@ void Scene910::signal() {
break;
case 9114:
_fakeWall.hide();
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) {
BF_GLOBALS._player.disableControl();
_nico.postInit();
_nico.setDetails(910, 63, 64, 65, 5, &_item4);
Expand Down Expand Up @@ -2496,7 +2497,7 @@ void Scene910::signal() {
case 9121:
_item3.setDetails(7, 910, 96, 60, 61, 3);
BF_GLOBALS._v4CEE4 = 2;
if (BF_GLOBALS._v4CEE2 == 4) {
if (BF_GLOBALS._nico910State == 4) {
_sceneMode = 20;
_stripManager.start(9115, this);
} else {
Expand Down Expand Up @@ -2527,7 +2528,7 @@ void Scene910::signal() {
setAction(&_sequenceManager1, this, 9111, &BF_GLOBALS._player, &_blackCord, NULL);
break;
case 5:
switch (BF_GLOBALS._v4CEE2 - 1) {
switch (BF_GLOBALS._nico910State - 1) {
case 0:
_sceneMode = 9118;
setAction(&_sequenceManager1, this, 9118, &BF_GLOBALS._player, &_nico, NULL);
Expand Down Expand Up @@ -2598,7 +2599,7 @@ void Scene910::signal() {
break;
case 9125:
BF_GLOBALS.setFlag(fBackupAt340);
BF_GLOBALS._v4CEE2 = 4;
BF_GLOBALS._nico910State = 4;
_stuart.postInit();
_nico.setDetails(910, 72, 73, 74, 3, (SceneItem *)NULL);
_stuart.setDetails(910, 66, 67, 68, 5, &_nico);
Expand Down Expand Up @@ -2645,7 +2646,7 @@ void Scene910::signal() {
}
_lyle.setAction(&_sequenceManager2, NULL, 9131, &_lyle, NULL);
BF_GLOBALS._walkRegions.enableRegion(16);
if (BF_GLOBALS._v4CEE2 == 4)
if (BF_GLOBALS._nico910State == 4)
BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 0);
else
BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910);
Expand Down Expand Up @@ -2679,7 +2680,7 @@ void Scene910::signal() {
}
break;
case 9143:
if (BF_GLOBALS._v4CEE2 == 0) {
if (BF_GLOBALS._nico910State == 0) {
BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(920);
} else {
Expand Down Expand Up @@ -2730,7 +2731,7 @@ void Scene910::process(Event &event) {
if (_item17._bounds.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
BF_GLOBALS._events.setCursor(surface);
} else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0)) {
} else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._nico910State != 0)) {
CursorType cursorId = BF_GLOBALS._events.getCursor();
BF_GLOBALS._events.setCursor(cursorId);
} else if (!_item16._bounds.contains(event.mousePos)) {
Expand All @@ -2755,7 +2756,7 @@ void Scene910::process(Event &event) {
_sceneMode = 9123;
setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
event.handled = true;
} else if (BF_GLOBALS._v4CEE2 <= 1) {
} else if (BF_GLOBALS._nico910State <= 1) {
if (BF_GLOBALS.getFlag(fCanDrawGun)) {
BF_GLOBALS._player.addMover(NULL);
BF_GLOBALS._player.disableControl();
Expand All @@ -2776,7 +2777,7 @@ void Scene910::process(Event &event) {
event.handled = true;
break;
case CURSOR_WALK:
if (BF_GLOBALS._v4CEE2 == 1) {
if (BF_GLOBALS._nico910State == 1) {
BF_GLOBALS._player.disableControl();
if (BF_GLOBALS._player._visage == 1911) {
BF_GLOBALS._player.disableControl();
Expand Down Expand Up @@ -2826,7 +2827,7 @@ void Scene910::dispatch() {
_sceneSubMode = 3;
_sceneMode = 9123;
setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
} else if (BF_GLOBALS._v4CEE2 == 0) {
} else if (BF_GLOBALS._nico910State == 0) {
_sceneMode = 9143;
setAction(&_sequenceManager1, this, 9143, &BF_GLOBALS._player, NULL);
} else {
Expand All @@ -2840,7 +2841,7 @@ void Scene910::dispatch() {
}
}

if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._v4CEE2 == 0)) {
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._nico910State == 0)) {
BF_GLOBALS._player.disableControl();
_shadow.remove();
_nico.remove();
Expand All @@ -2853,7 +2854,7 @@ void Scene910::dispatch() {
}

void Scene910::checkGun() {
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0) && (BF_GLOBALS._hiddenDoorStatus != 0))
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0) && (BF_GLOBALS._hiddenDoorStatus != 0))
SceneItem::display(910, 70, SET_WIDTH, 312,
SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
Expand Down Expand Up @@ -2900,7 +2901,7 @@ void Scene910::closeHiddenDoor() {
setAction(&_sequenceManager1, this, 9115, &_fakeWall, &_object5, NULL);
}

if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._nico910State == 0)) {
// _objectList.draw();
if (BF_GLOBALS._sceneObjects->contains(&_breakerBoxInset))
_breakerBoxInset.remove();
Expand Down
4 changes: 2 additions & 2 deletions engines/tsage/globals.cpp
Expand Up @@ -247,7 +247,7 @@ void BlueForceGlobals::synchronize(Serializer &s) {
for (int i = 0; i < 18; i++)
s.syncAsByte(_breakerBoxStatusArr[i]);
s.syncAsSint16LE(_hiddenDoorStatus);
s.syncAsSint16LE(_v4CEE2);
s.syncAsSint16LE(_nico910State);
s.syncAsSint16LE(_v4CEE4);
s.syncAsSint16LE(_v4CEE6);
s.syncAsSint16LE(_v4CEE8);
Expand Down Expand Up @@ -320,7 +320,7 @@ void BlueForceGlobals::reset() {
_breakerBoxStatusArr[16] = 3;
_breakerBoxStatusArr[17] = 0;
_hiddenDoorStatus = 0;
_v4CEE2 = 0;
_nico910State = 0;
_v4CEE4 = 0;
_v4CEE6 = 0;
_v4CEE8 = 0;
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/globals.h
Expand Up @@ -200,7 +200,7 @@ class BlueForceGlobals: public TsAGE2Globals {
int _v4CECC;
int8 _breakerBoxStatusArr[18];
int _hiddenDoorStatus;
int _v4CEE2;
int _nico910State;
int _v4CEE4;
int _v4CEE6;
int _v4CEE8;
Expand Down

0 comments on commit 108e709

Please sign in to comment.