Skip to content

Commit

Permalink
BLADERUNNER: Fix Hasan behavior post Act 2
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniou79 committed Sep 8, 2019
1 parent a51efbf commit a6401e8
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 57 deletions.
6 changes: 3 additions & 3 deletions engines/bladerunner/game_constants.h
Expand Up @@ -2523,9 +2523,9 @@ enum GoalZuben {
enum GoalHasan {
kGoalHasanDefault = 0,
kGoalHasanIsAway = 300, // original final goal for Hasan
kGoalHasanIsWalkingAroundIsAtCT02 = 301, // new goal for restored content
kGoalHasanIsWalkingAroundStayAwayFromCT02 = 302, // new goal for restored content
kGoalHasanIsWalkingAroundStaysAtCT02 = 303, // new goal for restored content
kGoalHasanIsWalkingAroundIsAtAR02 = 301, // new goal for restored content
kGoalHasanIsWalkingAroundStayAwayFromAR02 = 302, // new goal for restored content
kGoalHasanIsWalkingAroundStaysAtAR02 = 303, // new goal for restored content
kGoalHasanIsWalkingAroundIsAway = 304 // new goal for restored content
};

Expand Down
21 changes: 11 additions & 10 deletions engines/bladerunner/script/ai/hasan.cpp
Expand Up @@ -65,8 +65,8 @@ bool AIScriptHasan::Update() {
Actor_Set_Goal_Number(kActorHasan, kGoalHasanDefault);
return true;
} else if (Global_Variable_Query(kVariableChapter) > 2
&& Actor_Query_Goal_Number(kActorHasan) < kGoalHasanIsWalkingAroundIsAtCT02) {
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtCT02);
&& Actor_Query_Goal_Number(kActorHasan) < kGoalHasanIsWalkingAroundIsAtAR02) {
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtAR02);
return true;
}
return false;
Expand Down Expand Up @@ -99,7 +99,7 @@ void AIScriptHasan::CompletedMovementTrack() {
maxHasanLeaveProb = 10;
}

if (Actor_Query_Goal_Number(kActorHasan) == kGoalHasanIsWalkingAroundIsAtCT02) {
if (Actor_Query_Goal_Number(kActorHasan) == kGoalHasanIsWalkingAroundIsAtAR02) {
if (Random_Query(1, maxHasanLeaveProb) == 1
&& Player_Query_Current_Scene() != kSceneAR01
&& Player_Query_Current_Scene() != kSceneAR02
Expand All @@ -109,7 +109,7 @@ void AIScriptHasan::CompletedMovementTrack() {
return; // true;
} else {
// stay (change goal to a temp one to trigger GoalChanged() (so that we can reset the "track")
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundStaysAtCT02);
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundStaysAtAR02);
return; // true;
}
}
Expand All @@ -120,11 +120,11 @@ void AIScriptHasan::CompletedMovementTrack() {
&& Player_Query_Current_Scene() != kSceneAR02
) {
// Hasan returns tp Animoid Row
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtCT02);
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtAR02);
return; // true;
} else {
// stay away (change goal to a temp one to trigger GoalChanged() (so that we can reset the "track")
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundStayAwayFromCT02);
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundStayAwayFromAR02);
return; // true;
}
}
Expand Down Expand Up @@ -184,8 +184,9 @@ bool AIScriptHasan::GoalChanged(int currentGoalNumber, int newGoalNumber) {
Actor_Put_In_Set(kActorHasan, kSetFreeSlotH);
Actor_Set_At_Waypoint(kActorHasan, 40, 0); // kSetFreeSlotH
break;
case kGoalHasanIsWalkingAroundIsAtCT02:
case kGoalHasanIsWalkingAroundIsAtAR02:
AI_Movement_Track_Flush(kActorHasan);
World_Waypoint_Set(554, kSetAR01_AR02, -214.0f, 0.0f, -1379.0f);
AI_Movement_Track_Append(kActorHasan, 554, Random_Query(60, 180)); // kSetAR01_AR02
Actor_Face_Heading(kActorHasan, 371, false);
AI_Movement_Track_Repeat(kActorHasan);
Expand All @@ -195,11 +196,11 @@ bool AIScriptHasan::GoalChanged(int currentGoalNumber, int newGoalNumber) {
AI_Movement_Track_Append(kActorHasan, 40, Random_Query(10, 40)); // kSetFreeSlotH
AI_Movement_Track_Repeat(kActorHasan);
break;
case kGoalHasanIsWalkingAroundStayAwayFromCT02:
case kGoalHasanIsWalkingAroundStayAwayFromAR02:
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAway);
break;
case kGoalHasanIsWalkingAroundStaysAtCT02:
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtCT02);
case kGoalHasanIsWalkingAroundStaysAtAR02:
Actor_Set_Goal_Number(kActorHasan, kGoalHasanIsWalkingAroundIsAtAR02);
break;
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion engines/bladerunner/script/scene/ar01.cpp
Expand Up @@ -204,7 +204,8 @@ bool SceneScriptAR01::ClickedOnActor(int actorId) {
case 0:
Global_Variable_Increment(kVariableFishDealerBanterTalk, 1);
Actor_Says(kActorFishDealer, 230, 14);
Item_Pickup_Spin_Effect(kModelAnimationGoldfish, 88, 400); // TODO check co-ordinates

Item_Pickup_Spin_Effect_From_Actor(kModelAnimationGoldfish, kActorFishDealer, 0, -40);
dialogueWithFishDealerBuyGoldfish();
break;
case 1:
Expand Down
91 changes: 48 additions & 43 deletions engines/bladerunner/script/scene/ar02.cpp
Expand Up @@ -202,7 +202,7 @@ bool SceneScriptAR02::ClickedOnActor(int actorId) {
if (Actor_Query_Friendliness_To_Other(kActorInsectDealer, kActorMcCoy) > 40) {
Actor_Says(kActorInsectDealer, 460, 14);
Actor_Says(kActorInsectDealer, 470, 13); // This slug, perhaps.
Item_Pickup_Spin_Effect(kModelAnimationSlug, 288, 257);
Item_Pickup_Spin_Effect_From_Actor(kModelAnimationSlug, kActorInsectDealer, 0, -40);
dialogueWithInsectDealerBuySlug();
}
break;
Expand Down Expand Up @@ -252,49 +252,54 @@ bool SceneScriptAR02::ClickedOnActor(int actorId) {
if (actorId == kActorHasan
&& Global_Variable_Query(kVariableChapter) > 2) {

if (Actor_Clue_Query(kActorMcCoy, kClueStrangeScale1)
&& !Game_Flag_Query(kFlagWrongInvestigation)
) {
dialogueWithHassan();
} else {
switch (Global_Variable_Query(kVariableHasanBanterTalk)) {
case 0:
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
Actor_Says(kActorMcCoy, 155, 13); // How's business?
Actor_Says(kActorHasan, 10, 13);
Actor_Says(kActorHasan, 20, 14);
break;
case 1:
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
Actor_Says(kActorMcCoy, 6980, 13); // What's the word
Actor_Says(kActorHasan, 290, 13);
if (Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) > 49) {
Actor_Says(kActorHasan, 300, 14);
Actor_Says(kActorHasan, 310, 13);
Item_Pickup_Spin_Effect(kModelAnimationGarterSnake, 328, 237); // TODO check co-ordinates
dialogueWithHassanBuySnake();
}
break;
case 2:
// offer to buy snake
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
if (Player_Query_Agenda() == kPlayerAgendaSurly
|| Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) <= 49 ) {
Actor_Says(kActorMcCoy, 8915, 14); // You got a minute, pal?
Actor_Says(kActorHasan, 260, 14); // My time is quite valuable, noble one
Actor_Modify_Friendliness_To_Other(kActorHasan, kActorMcCoy, -5);
} else {
Actor_Says(kActorMcCoy, 8615, 13); // Heard anything on the street?
Actor_Says(kActorHasan, 250, 13); // I'm afraid not, noble one. But you shall surely be the first to know, if I do hear something.
}
break;
default:
if (Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) <= 45 ) {
Actor_Says(kActorMcCoy, 8940, 13);
} else {
Actor_Says(kActorMcCoy, 1315, 13);
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -240.79f, 0.0f, -1328.89f, 12, true, false, false)) {
Actor_Face_Actor(kActorMcCoy, kActorHasan, true);
Actor_Face_Actor(kActorHasan, kActorMcCoy, true);

if (Actor_Clue_Query(kActorMcCoy, kClueStrangeScale1)
&& !Game_Flag_Query(kFlagWrongInvestigation)
) {
dialogueWithHassan();
} else {
switch (Global_Variable_Query(kVariableHasanBanterTalk)) {
case 0:
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
Actor_Says(kActorMcCoy, 155, 13); // How's business?
Actor_Says(kActorHasan, 10, 13);
Actor_Says(kActorHasan, 20, 14);
break;
case 1:
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
Actor_Says(kActorMcCoy, 6980, 13); // What's the word
Actor_Says(kActorHasan, 290, 13);
if (Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) > 49) {
Actor_Says(kActorHasan, 300, 14);
Actor_Says(kActorHasan, 310, 13);
Item_Pickup_Spin_Effect_From_Actor(kModelAnimationGarterSnake, kActorHasan, 0, -40);
dialogueWithHassanBuySnake();
}
break;
case 2:
// offer to buy snake
Global_Variable_Increment(kVariableHasanBanterTalk, 1);
if (Player_Query_Agenda() == kPlayerAgendaSurly
|| Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) <= 49 ) {
Actor_Says(kActorMcCoy, 8915, 14); // You got a minute, pal?
Actor_Says(kActorHasan, 260, 14); // My time is quite valuable, noble one
Actor_Modify_Friendliness_To_Other(kActorHasan, kActorMcCoy, -5);
} else {
Actor_Says(kActorMcCoy, 8615, 13); // Heard anything on the street?
Actor_Says(kActorHasan, 250, 13); // I'm afraid not, noble one. But you shall surely be the first to know, if I do hear something.
}
break;
default:
if (Actor_Query_Friendliness_To_Other(kActorHasan, kActorMcCoy) <= 45 ) {
Actor_Says(kActorMcCoy, 8940, 13);
} else {
Actor_Says(kActorMcCoy, 1315, 13);
}
break;
}
break;
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions engines/bladerunner/script/script.cpp
Expand Up @@ -870,6 +870,13 @@ void ScriptBase::Item_Pickup_Spin_Effect(int animationId, int x, int y) {
_vm->_itemPickup->setup(animationId, x, y);
}

void ScriptBase::Item_Pickup_Spin_Effect_From_Actor(int animationId, int actorId, int xOffset, int yOffset) {
debugC(kDebugScript, "Item_Pickup_Spin_Effect_From_Actor(%d, %d, %d, %d)", animationId, actorId, xOffset, yOffset);

const Common::Rect &rect = _vm->_actors[actorId]->getScreenRectangle();
_vm->_itemPickup->setup(animationId, CLIP((rect.right + rect.left) / 2 + xOffset, 0, 639), CLIP((rect.bottom + rect.top) / 2 + yOffset, 0, 479));
}

bool ScriptBase::Item_Query_Visible(int itemId) {
debugC(kDebugScript, "Item_Query_Visible(%d)", itemId);
return _vm->_items->isVisible(itemId);
Expand Down
1 change: 1 addition & 0 deletions engines/bladerunner/script/script.h
Expand Up @@ -127,6 +127,7 @@ friend class SceneScript;
void Item_Flag_As_Target(int itemId);
void Item_Flag_As_Non_Target(int itemId);
void Item_Pickup_Spin_Effect(int animationId, int x, int y);
void Item_Pickup_Spin_Effect_From_Actor(int animationId, int actorId, int xOffset = 0, int yOffset = 0); // new for restored content mostly
bool Item_Query_Visible(int itemId);
void Set_Subtitle_Text_On_Screen(Common::String displayText);
#if BLADERUNNER_ORIGINAL_BUGS
Expand Down

0 comments on commit a6401e8

Please sign in to comment.