BLADERUNNER: A better fix for Sebastian's doll

Use just the existing box 31. Implement a way to override object placement.

Remove the item 77 (Holden's badge) completely.
This commit is contained in:
Thanasis Antoniou 2019-02-28 15:24:37 +02:00
parent 833e1d11c0
commit 571ddf46cd
4 changed files with 41 additions and 25 deletions

View file

@ -170,7 +170,7 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) {
}
}
_set->addObjectsToScene(_vm->_sceneObjects);
_set->addObjectsToScene(_vm->_sceneObjects, _sceneId);
_vm->_items->addToSet(setId);
_vm->_sceneObjects->updateObstacles();
// TODO: add all items to scene

View file

@ -87,10 +87,8 @@ void SceneScriptBB06::SceneLoaded() {
// otherwise the doll item is not placed in the current set
Item_Add_To_World(kItemBB06ControlBox, 931, kSetBB06_BB07, -127.0f, 68.42f, 57.0f, 0, 8, 8, true, true, false, true);
#else
// Add doll item based on which SET version of the "room" we are in
Item_Add_To_World(kItemBB06ControlBox, 931, Player_Query_Current_Set(), -117.24f, 46.41f, 76.66f, 256, 28, 16, true, true, false, true);
if (Game_Flag_Query(kFlagBB06AndroidDestroyed)) {
Item_Flag_As_Non_Target(kItemBB06ControlBox);
if (!Game_Flag_Query(kFlagBB06AndroidDestroyed)) {
Combat_Target_Object("BOX31"); //
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
@ -101,6 +99,23 @@ bool SceneScriptBB06::MouseClick(int x, int y) {
bool SceneScriptBB06::ClickedOn3DObject(const char *objectName, bool a2) {
if (Object_Query_Click("BOX31", objectName)) {
#if BLADERUNNER_ORIGINAL_BUGS // Sebastian's Doll Fix
if (!Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BOX31", 24, true, false)) {
Actor_Face_Object(kActorMcCoy, "BOX31", true);
if (Game_Flag_Query(kFlagBB06AndroidDestroyed)) {
Actor_Voice_Over(60, kActorVoiceOver);
Actor_Voice_Over(70, kActorVoiceOver);
} else {
Actor_Voice_Over(50, kActorVoiceOver);
}
}
#else
if (Player_Query_Combat_Mode()) {
Overlay_Play("BB06OVER", 0, false, true, 0); // explosion - don't loop
Game_Flag_Set(kFlagBB06AndroidDestroyed);
Un_Combat_Target_Object("BOX31");
return true;
} else {
if (!Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BOX31", 24, true, false)) {
Actor_Face_Object(kActorMcCoy, "BOX31", true);
if (Game_Flag_Query(kFlagBB06AndroidDestroyed)) {
@ -111,6 +126,8 @@ bool SceneScriptBB06::ClickedOn3DObject(const char *objectName, bool a2) {
}
}
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
return false;
}
@ -119,26 +136,16 @@ bool SceneScriptBB06::ClickedOnActor(int actorId) {
}
bool SceneScriptBB06::ClickedOnItem(int itemId, bool a2) {
if (itemId == kItemBB06ControlBox) {
#if BLADERUNNER_ORIGINAL_BUGS // Sebastian's Doll Fix
if (itemId == kItemBB06ControlBox) {
if (Player_Query_Combat_Mode()) {
Overlay_Play("BB06OVER", 1, true, true, 0);
Game_Flag_Set(kFlagBB06AndroidDestroyed);
Item_Remove_From_World(kItemBB06ControlBox);
return true;
}
#else
if (Player_Query_Combat_Mode()) {
Overlay_Play("BB06OVER", 0, false, true, 0); // explosion - don't loop
Game_Flag_Set(kFlagBB06AndroidDestroyed);
// flag item kItemBB06ControlBox as non-combat-target
Item_Flag_As_Non_Target(kItemBB06ControlBox);
return true;
} else {
ClickedOn3DObject("BOX31", false); // clone behavior of box31
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
return false;
}
@ -217,12 +224,6 @@ void SceneScriptBB06::PlayerWalkedIn() {
}
void SceneScriptBB06::PlayerWalkedOut() {
#if BLADERUNNER_ORIGINAL_BUGS // Sebastian's Doll Fix
#else
// this might be redundant -- the item is not visible in BB07 even if it was drawn in BB06
Item_Remove_From_World(kItemBB06ControlBox); // this removes the item from the set so it won't exist in the next scene
// mainly to remove it completely from BB07
#endif // BLADERUNNER_ORIGINAL_BUGS
}
void SceneScriptBB06::DialogueQueueFlushed(int a1) {

View file

@ -127,8 +127,9 @@ bool Set::open(const Common::String &name) {
return true;
}
void Set::addObjectsToScene(SceneObjects *sceneObjects) const {
void Set::addObjectsToScene(SceneObjects *sceneObjects, int sceneId) const {
for (int i = 0; i < _objectCount; i++) {
overrideSceneObjectInfo(sceneId, i); // For bugfixes with respect to clickable/targetable box positioning/bounding box
sceneObjects->addObject(i + kSceneObjectOffsetObjects, _objects[i].bbox, _objects[i].isClickable, _objects[i].isObstacle, _objects[i].unknown1, _objects[i].isTarget);
}
}
@ -396,4 +397,17 @@ void Set::load(SaveFileReadStream &f) {
_footstepSoundOverride = f.readInt();
}
/**
* Used for bugfixes mainly with respect to bad box positioning / bounding box fixes
* TODO If we have many such cases, perhaps we could use a lookup table
* using sceneId, objectId (or name) as keys
*/
void Set::overrideSceneObjectInfo(int sceneId, int objectId) const { // For bugfixes with respect to clickable/targetable box positioning/bounding box
if (sceneId == kSceneBB06) { /// Sebastian's room with doll
if (_objects[objectId].name == "BOX31") { // dollhouse box in BB06
_objects[objectId].bbox.setXYZ(-161.47f, 30.0f, 53.75f, -110.53f, 69.81f, 90.90f);
}
}
}
} // End of namespace BladeRunner

View file

@ -78,7 +78,7 @@ public:
bool open(const Common::String &name);
void addObjectsToScene(SceneObjects *sceneObjects) const;
void addObjectsToScene(SceneObjects *sceneObjects, int sceneId) const;
uint32 getObjectCount() const { return _objectCount; }
float getAltitudeAtXZ(float x, float z, bool *inWalkbox) const;
@ -107,6 +107,7 @@ public:
private:
static bool isXZInWalkbox(float x, float z, const Walkbox &walkbox);
void overrideSceneObjectInfo(int sceneId, int objectId) const;
};
} // End of namespace BladeRunner