aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/ai
diff options
context:
space:
mode:
authorPeter Kohaut2019-02-02 12:35:26 +0100
committerPeter Kohaut2019-02-03 00:14:09 +0100
commit1df1eefc3e9584516fec7d7b4f09f5216f84de00 (patch)
treef8b1f498a93b484434e1a56ba4ce889a8c8e0022 /engines/bladerunner/script/ai
parent5e5eb39197b8bc2fbba55ff01ecdd456c04ab97c (diff)
downloadscummvm-rg350-1df1eefc3e9584516fec7d7b4f09f5216f84de00.tar.gz
scummvm-rg350-1df1eefc3e9584516fec7d7b4f09f5216f84de00.tar.bz2
scummvm-rg350-1df1eefc3e9584516fec7d7b4f09f5216f84de00.zip
BLADERUNNER: Fixed Rat interaction at UG15
Diffstat (limited to 'engines/bladerunner/script/ai')
-rw-r--r--engines/bladerunner/script/ai/free_slot_a.cpp210
-rw-r--r--engines/bladerunner/script/ai/mccoy.cpp87
2 files changed, 154 insertions, 143 deletions
diff --git a/engines/bladerunner/script/ai/free_slot_a.cpp b/engines/bladerunner/script/ai/free_slot_a.cpp
index 6c3e9e2c80..f31fbaa550 100644
--- a/engines/bladerunner/script/ai/free_slot_a.cpp
+++ b/engines/bladerunner/script/ai/free_slot_a.cpp
@@ -27,9 +27,9 @@ namespace BladeRunner {
AIScriptFreeSlotA::AIScriptFreeSlotA(BladeRunnerEngine *vm) : AIScriptBase(vm) {
_var1 = 0;
_var2 = 1;
- _var3 = 0.0f;
- _var4 = 0.0f; // not initialized in original
- _var5 = 0.0f; // not initialized in original
+ _fallSpeed = 0.0f;
+ _fallHeightCurrent = 0.0f; // not initialized in original
+ _fallHeightTarget = 0.0f; // not initialized in original
}
void AIScriptFreeSlotA::Initialize() {
@@ -40,9 +40,9 @@ void AIScriptFreeSlotA::Initialize() {
_var1 = 0;
_var2 = 1;
- _var3 = 0.0f;
- _var4 = 0.0f; // not initialized in original
- _var5 = 0.0f; // not initialized in original
+ _fallSpeed = 0.0f;
+ _fallHeightCurrent = 0.0f; // not initialized in original
+ _fallHeightTarget = 0.0f; // not initialized in original
World_Waypoint_Set(525, 45, -780.0f, -615.49f, 2611.0f);
World_Waypoint_Set(526, 45, -780.0f, -615.49f, 2759.0f);
@@ -51,68 +51,73 @@ void AIScriptFreeSlotA::Initialize() {
bool AIScriptFreeSlotA::Update() {
switch (Global_Variable_Query(kVariableChapter)) {
case 4:
- if (Actor_Query_Which_Set_In(kActorMcCoy) == kSceneUG02
- && Actor_Query_Which_Set_In(kActorFreeSlotA) == kSceneUG02
+ if (Actor_Query_Which_Set_In(kActorMcCoy) == kSetUG15
+ && Actor_Query_Which_Set_In(kActorFreeSlotA) == kSetUG15
) {
int goal = Actor_Query_Goal_Number(kActorFreeSlotA);
- if ((goal == 302
- || goal == 303
+ if ((goal == kGoalFreeSlotAUG15RunToOtherSide
+ || goal == kGoalFreeSlotAUG15RunBack
)
&& Actor_Query_Inch_Distance_From_Actor(kActorFreeSlotA, kActorMcCoy) <= 48
) {
- Actor_Set_Goal_Number(kActorFreeSlotA, 304);
- } else if (goal == 309) {
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Attack);
+ } else if (goal == kGoalFreeSlotAUG15Fall) {
float x, y, z;
Actor_Query_XYZ(kActorMcCoy, &x, &y, &z);
- _var4 += _var3;
- if (_var5 < _var4) {
- _var3 -= 0.2f;
+ _fallHeightCurrent += _fallSpeed;
+ if (_fallHeightTarget < _fallHeightCurrent) {
+ _fallSpeed -= 0.2f;
} else {
- _var4 = _var5;
+ _fallHeightCurrent = _fallHeightTarget;
Actor_Set_Goal_Number(kActorFreeSlotA, 0);
}
- Actor_Set_At_XYZ(kActorFreeSlotA, x, _var4, z, Actor_Query_Facing_1024(kActorFreeSlotA));
+ Actor_Set_At_XYZ(kActorFreeSlotA, x, _fallHeightCurrent, z, Actor_Query_Facing_1024(kActorFreeSlotA));
}
- } else {
- switch (Actor_Query_Goal_Number(kActorFreeSlotA)) {
- case 306:
- if (Actor_Query_Which_Set_In(kActorFreeSlotA) == Player_Query_Current_Set()
- && Actor_Query_Inch_Distance_From_Actor(kActorFreeSlotA, kActorMcCoy) <= 48
- ) {
- Actor_Set_Goal_Number(kActorFreeSlotA, 308);
- }
- break;
- case 308:
- if (Actor_Query_Which_Set_In(kActorFreeSlotA) != Player_Query_Current_Set()) {
- Actor_Set_Goal_Number(kActorFreeSlotA, 306);
- }
- break;
+ return true;
+ }
- case 599:
- if (Actor_Query_Which_Set_In(kActorFreeSlotA) != Player_Query_Current_Set()) {
- Game_Flag_Reset(631);
- Game_Flag_Reset(677);
- Actor_Set_Goal_Number(kActorFreeSlotA, 0);
- }
- break;
+ switch (Actor_Query_Goal_Number(kActorFreeSlotA)) {
+ case kGoalFreeSlotAWalkAround:
+ if (Actor_Query_Which_Set_In(kActorFreeSlotA) == Player_Query_Current_Set()
+ && Actor_Query_Inch_Distance_From_Actor(kActorFreeSlotA, kActorMcCoy) <= 48
+ ) {
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAAttackMcCoy);
+ }
+ break;
- default:
- if (!Game_Flag_Query(631)) {
- Game_Flag_Set(631);
- Actor_Set_Goal_Number(kActorFreeSlotA, 306);
- Actor_Set_Targetable(kActorFreeSlotA, 1);
- }
+ case kGoalFreeSlotAAttackMcCoy:
+ if (Actor_Query_Which_Set_In(kActorFreeSlotA) != Player_Query_Current_Set()) {
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAWalkAround);
+ }
+ break;
+
+ case kGoalFreeSlotAGone:
+ if (Actor_Query_Which_Set_In(kActorFreeSlotA) != Player_Query_Current_Set()) {
+ Game_Flag_Reset(kFlagRatWalkingAround);
+ Game_Flag_Reset(kFlagUG15BridgeWillBreak);
+ Actor_Set_Goal_Number(kActorFreeSlotA, false);
+ }
+ break;
+
+ default:
+ if (!Game_Flag_Query(kFlagRatWalkingAround)) {
+ Game_Flag_Set(kFlagRatWalkingAround);
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAWalkAround);
+ Actor_Set_Targetable(kActorFreeSlotA, true);
}
}
+
return true;
case 5:
if (Actor_Query_Goal_Number(kActorFreeSlotA) < 400) {
AI_Movement_Track_Flush(kActorFreeSlotA);
Actor_Set_Goal_Number(kActorFreeSlotA, 400);
- } else if (Actor_Query_Goal_Number(kActorFreeSlotA) == 405 && Actor_Query_Which_Set_In(kActorMcCoy) == kSceneKP05) {
+ } else if (Actor_Query_Goal_Number(kActorFreeSlotA) == 405
+ && Actor_Query_Which_Set_In(kActorMcCoy) == kSceneKP05
+ ) {
Actor_Set_Targetable(kActorFreeSlotA, 1);
Actor_Set_Goal_Number(kActorFreeSlotA, 406);
}
@@ -129,24 +134,24 @@ void AIScriptFreeSlotA::TimerExpired(int timer) {
void AIScriptFreeSlotA::CompletedMovementTrack() {
switch (Actor_Query_Goal_Number(kActorFreeSlotA)) {
- case 301:
- Actor_Set_Goal_Number(kActorFreeSlotA, 302);
+ case kGoalFreeSlotAUG15WalkOut:
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15RunToOtherSide);
break;
- case 302:
- Actor_Set_Goal_Number(kActorFreeSlotA, 303);
+ case kGoalFreeSlotAUG15RunToOtherSide:
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15RunBack);
break;
- case 303:
- Actor_Set_Goal_Number(kActorFreeSlotA, 300);
+ case kGoalFreeSlotAUG15RunBack:
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Wait);
break;
- case 306:
- Actor_Set_Goal_Number(kActorFreeSlotA, 307);
+ case kGoalFreeSlotAWalkAround:
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAWalkAroundRestart);
break;
- case 307:
- Actor_Set_Goal_Number(kActorFreeSlotA, 306);
+ case kGoalFreeSlotAWalkAroundRestart:
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAWalkAround);
break;
case 400:
@@ -169,16 +174,15 @@ void AIScriptFreeSlotA::ReceivedClue(int clueId, int fromActorId) {
}
void AIScriptFreeSlotA::ClickedByPlayer() {
- if (Actor_Query_Goal_Number(kActorFreeSlotA) != 599) {
- return; //false;
- }
-
- Actor_Face_Actor(kActorMcCoy, kActorFreeSlotA, 1);
- if (Random_Query(1, 2) == 1) {
- Actor_Says(kActorMcCoy, 8655, 16);
- } else {
- Actor_Says(kActorMcCoy, 8665, 16);
+ if (Actor_Query_Goal_Number(kActorFreeSlotA) == kGoalFreeSlotAGone) {
+ Actor_Face_Actor(kActorMcCoy, kActorFreeSlotA, true);
+ if (Random_Query(1, 2) == 1) {
+ Actor_Says(kActorMcCoy, 8655, 16);
+ } else {
+ Actor_Says(kActorMcCoy, 8665, 16);
+ }
}
+ //return false;
}
void AIScriptFreeSlotA::EnteredScene(int sceneId) {
@@ -205,7 +209,7 @@ void AIScriptFreeSlotA::ShotAtAndMissed() {
bool AIScriptFreeSlotA::ShotAtAndHit() {
if (Actor_Query_In_Set(kActorFreeSlotA, kSetUG15)) {
calcHit();
- Actor_Set_Goal_Number(kActorFreeSlotA, 305);
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Die);
return true;
}
@@ -213,7 +217,7 @@ bool AIScriptFreeSlotA::ShotAtAndHit() {
}
void AIScriptFreeSlotA::Retired(int byActorId) {
- Actor_Set_Goal_Number(kActorFreeSlotA, 599);
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAGone);
}
int AIScriptFreeSlotA::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
@@ -222,13 +226,13 @@ int AIScriptFreeSlotA::GetFriendlinessModifierIfGetsClue(int otherActorId, int c
bool AIScriptFreeSlotA::GoalChanged(int currentGoalNumber, int newGoalNumber) {
switch (newGoalNumber) {
- case 300:
+ case kGoalFreeSlotAUG15Wait:
AI_Movement_Track_Flush(kActorFreeSlotA);
- Actor_Change_Animation_Mode(kActorFreeSlotA, 0);
- Actor_Set_Targetable(kActorFreeSlotA, 0);
+ Actor_Change_Animation_Mode(kActorFreeSlotA, kAnimationModeIdle);
+ Actor_Set_Targetable(kActorFreeSlotA, false);
break;
- case 301:
+ case kGoalFreeSlotAUG15WalkOut:
Actor_Force_Stop_Walking(kActorMcCoy);
AI_Movement_Track_Flush(kActorFreeSlotA);
World_Waypoint_Set(444, 87, -48.75f, 44.66f, 87.57f);
@@ -236,72 +240,74 @@ bool AIScriptFreeSlotA::GoalChanged(int currentGoalNumber, int newGoalNumber) {
AI_Movement_Track_Repeat(kActorFreeSlotA);
break;
- case 302:
+ case kGoalFreeSlotAUG15RunToOtherSide:
AI_Movement_Track_Flush(kActorFreeSlotA);
World_Waypoint_Set(444, 87, -237.0f, 48.07f, 208.0f);
AI_Movement_Track_Append(kActorFreeSlotA, 444, 1);
AI_Movement_Track_Repeat(kActorFreeSlotA);
- Actor_Set_Targetable(kActorFreeSlotA, 1);
+ Actor_Set_Targetable(kActorFreeSlotA, true);
break;
- case 303:
+ case kGoalFreeSlotAUG15RunBack:
AI_Movement_Track_Flush(kActorFreeSlotA);
World_Waypoint_Set(444, 87, 3.52f, 52.28f, 90.68f);
AI_Movement_Track_Append(kActorFreeSlotA, 444, 0);
AI_Movement_Track_Repeat(kActorFreeSlotA);
break;
- case 304:
+ case kGoalFreeSlotAUG15Attack:
Player_Loses_Control();
Actor_Force_Stop_Walking(kActorMcCoy);
AI_Movement_Track_Flush(kActorFreeSlotA);
- Actor_Face_Actor(kActorFreeSlotA, kActorMcCoy, 1);
- Actor_Change_Animation_Mode(kActorFreeSlotA, 6);
- Actor_Change_Animation_Mode(kActorMcCoy, 48);
+ Actor_Face_Actor(kActorFreeSlotA, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorFreeSlotA, kAnimationModeCombatAttack);
+ Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie);
break;
- case 305:
+ case kGoalFreeSlotAUG15Die:
AI_Movement_Track_Flush(kActorFreeSlotA);
- Actor_Set_Targetable(kActorFreeSlotA, 0);
- Game_Flag_Set(676);
+ Actor_Set_Targetable(kActorFreeSlotA, false);
+ Game_Flag_Set(kFlagUG15RatShot);
_animationState = 7;
_animationFrame = 0;
break;
- case 306:
+ case kGoalFreeSlotAWalkAround:
AI_Movement_Track_Flush(kActorFreeSlotA);
- processGoal306();
+ goToRandomUGxx();
AI_Movement_Track_Repeat(kActorFreeSlotA);
break;
- case 307:
+ case kGoalFreeSlotAWalkAroundRestart:
AI_Movement_Track_Flush(kActorFreeSlotA);
AI_Movement_Track_Append(kActorFreeSlotA, 39, 1);
AI_Movement_Track_Repeat(kActorFreeSlotA);
break;
- case 308:
- Actor_Set_Targetable(kActorFreeSlotA, 1);
+ case kGoalFreeSlotAAttackMcCoy:
+ Actor_Set_Targetable(kActorFreeSlotA, true);
Non_Player_Actor_Combat_Mode_On(kActorFreeSlotA, 0, 0, 0, 8, 4, 7, 8, 25, 0, 75, 5, 300, 0);
break;
- case 309:
+ case kGoalFreeSlotAUG15Fall:
Actor_Force_Stop_Walking(kActorFreeSlotA);
AI_Movement_Track_Flush(kActorFreeSlotA);
- _var4 = 52.46f;
- _var3 = -4.0f;
- _var5 = -10.0f;
- if (_animationState != 7 && _animationState != 8) {
+ _fallHeightCurrent = 52.46f;
+ _fallSpeed = -4.0f;
+ _fallHeightTarget = -10.0f;
+ if (_animationState != 7
+ && _animationState != 8
+ ) {
_animationState = 7;
_animationFrame = 0;
}
break;
- case 310:
+ case kGoalFreeSlotAUG15Prepare:
AI_Movement_Track_Flush(kActorFreeSlotA);
Actor_Put_In_Set(kActorFreeSlotA, kSetUG15);
Actor_Set_At_XYZ(kActorFreeSlotA, 3.52f, 52.28f, 90.68f, 700);
- Actor_Set_Goal_Number(kActorFreeSlotA, 300);
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Wait);
break;
case 400:
@@ -315,7 +321,7 @@ bool AIScriptFreeSlotA::GoalChanged(int currentGoalNumber, int newGoalNumber) {
AI_Movement_Track_Repeat(kActorFreeSlotA);
break;
- case 599:
+ case kGoalFreeSlotAGone:
Actor_Set_Health(kActorFreeSlotA, 20, 20);
Actor_Set_Friendliness_To_Other(kActorFreeSlotA, kActorMcCoy, 40);
break;
@@ -395,7 +401,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(857)) {
_animationState = 0;
_animationFrame = 0;
- Actor_Change_Animation_Mode(kActorFreeSlotA, 4);
+ Actor_Change_Animation_Mode(kActorFreeSlotA, kAnimationModeCombatIdle);
}
break;
@@ -403,7 +409,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
*animation = 874;
_animationFrame++;
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(874) - 1) { // bug? shuld not be '-1'
- Actor_Change_Animation_Mode(kActorFreeSlotA, 0);
+ Actor_Change_Animation_Mode(kActorFreeSlotA, kAnimationModeIdle);
}
break;
@@ -416,7 +422,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(860)) {
_animationFrame = 0;
_animationState = 0;
- Actor_Change_Animation_Mode(kActorFreeSlotA, 0);
+ Actor_Change_Animation_Mode(kActorFreeSlotA, kAnimationModeIdle);
}
break;
@@ -429,7 +435,7 @@ bool AIScriptFreeSlotA::UpdateAnimation(int *animation, int *frame) {
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(859) - 1) { // bug? shuld not be '-1'
_animationFrame = Slice_Animation_Query_Number_Of_Frames(859) - 1;
_animationState = 8;
- Actor_Set_Goal_Number(kActorFreeSlotA, 599);
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAGone);
}
break;
@@ -523,7 +529,7 @@ bool AIScriptFreeSlotA::ReachedMovementTrackWaypoint(int waypointId) {
Actor_Change_Animation_Mode(kActorFreeSlotA, 43);
}
} else if (Actor_Query_Goal_Number(kActorFreeSlotA) == 302) {
- Actor_Face_Actor(kActorFreeSlotA, kActorMcCoy, 1);
+ Actor_Face_Actor(kActorFreeSlotA, kActorMcCoy, true);
}
return true;
@@ -538,12 +544,14 @@ void AIScriptFreeSlotA::calcHit() {
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
- if (x >= -30.0f && x < -150.0f) {
- Game_Flag_Set(677);
+ if (x >= -30.0f
+ && x < -150.0f
+ ) {
+ Game_Flag_Set(kFlagUG15BridgeWillBreak);
}
}
-void AIScriptFreeSlotA::processGoal306() {
+void AIScriptFreeSlotA::goToRandomUGxx() {
switch (Random_Query(1, 14)) {
case 1:
AI_Movement_Track_Append(kActorFreeSlotA, 450, 1);
diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp
index 7edb6393ee..d5fb581cf5 100644
--- a/engines/bladerunner/script/ai/mccoy.cpp
+++ b/engines/bladerunner/script/ai/mccoy.cpp
@@ -33,7 +33,7 @@ AIScriptMcCoy::AIScriptMcCoy(BladeRunnerEngine *vm) : AIScriptBase(vm) {
dword_45A0E8 = 0;
_animationStateNextSpecial = 0;
_animationNextSpecial = 0;
- dword_45A0F8 = 0;
+ _nextSoundId = 0;
_NR10SteeleShooting = false;
_fallSpeed = 0.0f;
_fallHeightCurrent = 0.0f;
@@ -51,16 +51,16 @@ void AIScriptMcCoy::Initialize() {
dword_45A0E8 = 3;
_animationStateNextSpecial = 3;
_animationNextSpecial = 20;
- dword_45A0F8 = -1;
+ _nextSoundId = -1;
_NR10SteeleShooting = false;
_fallSpeed = 0;
Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyDefault);
}
bool AIScriptMcCoy::Update() {
- if (dword_45A0F8 != -1) {
- Sound_Play(dword_45A0F8, 100, 0, 0, 50);
- dword_45A0F8 = -1;
+ if (_nextSoundId != -1) {
+ Sound_Play(_nextSoundId, 100, 0, 0, 50);
+ _nextSoundId = -1;
}
switch (Actor_Query_Goal_Number(kActorMcCoy)) {
@@ -109,13 +109,13 @@ bool AIScriptMcCoy::Update() {
fallDown();
break;
- case 309:
+ case kGoalMcCoyUG15Fall:
fallDown();
break;
- case 391:
- Actor_Retired_Here(kActorMcCoy, 12, 48, 1, -1);
- Actor_Set_Goal_Number(kActorMcCoy, 599);
+ case kGoalMcCoyUG15Die:
+ Actor_Retired_Here(kActorMcCoy, 12, 48, true, -1);
+ Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyGone);
break;
}
return false;
@@ -163,21 +163,21 @@ void AIScriptMcCoy::ReceivedClue(int clueId, int fromActorId) {
case kClueWeaponsOrderForm:
case kClueShippingForm:
case kCluePoliceIssueWeapons:
- Global_Variable_Increment(49, 1);
+ Global_Variable_Increment(kVariableCorruptedGuzzaEvidence, 1);
break;
case kClueFolder:
- Global_Variable_Increment(49, 5);
+ Global_Variable_Increment(kVariableCorruptedGuzzaEvidence, 5);
break;
case kClueHomelessManKid:
case kClueOriginalRequisitionForm:
- Global_Variable_Increment(49, 3);
+ Global_Variable_Increment(kVariableCorruptedGuzzaEvidence, 3);
break;
case kClueScaryChair:
case kClueIzosStashRaided:
- Global_Variable_Increment(49, 2);
+ Global_Variable_Increment(kVariableCorruptedGuzzaEvidence, 2);
break;
case kClueDNATyrell:
@@ -186,11 +186,11 @@ void AIScriptMcCoy::ReceivedClue(int clueId, int fromActorId) {
case kClueDNAMoraji:
case kClueDNALutherLance:
case kClueDNAMarcus:
- Global_Variable_Increment(kVariableDNAEvidences, 1);
+ Global_Variable_Increment(kVariableDNAEvidence, 1);
break;
}
- if ( Global_Variable_Query(49) > 6
+ if ( Global_Variable_Query(kVariableCorruptedGuzzaEvidence) > 6
&& Global_Variable_Query(kVariableChapter) > 3
&& !Actor_Clue_Query(kActorMcCoy, kClueGuzzaFramedMcCoy)
) {
@@ -328,7 +328,8 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
return true;
case 2:
- sub_405920();
+ _animationFrame = 0;
+ _animationState = 47;
return true;
case kGoalMcCoyBB11GetUp:
@@ -391,7 +392,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
Actor_Change_Animation_Mode(kActorMcCoy, 75);
return true;
- case 230:
+ case kGoalMcCoyNR11Shoot:
_NR10SteeleShooting = Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR11Shoot;
Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeCombatAttack);
return true;
@@ -427,7 +428,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
_animationFrame = 0;
return true;
- case 350:
+ case kGoalMcCoyCallWithGuzza:
Sound_Play(123, 50, 0, 0, 50);
Delay(1000);
Sound_Play(403, 30, 0, 0, 50);
@@ -465,13 +466,15 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
Sound_Play(123, 50, 0, 0, 50);
return true;
- case 390:
+ case kGoalMcCoyUG15Fall:
Actor_Force_Stop_Walking(kActorMcCoy);
Player_Loses_Control();
_fallHeightCurrent = 48.07f;
_fallSpeed = -4.0f;
_fallHeightTarget = -20.0f;
- if (_animationState != 27 && _animationState != 50) {
+ if (_animationState != 27
+ && _animationState != 50
+ ) {
_animationState = 50;
_animationFrame = Slice_Animation_Query_Number_Of_Frames(18) - 1;
}
@@ -1004,7 +1007,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(5)) {
_animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
_animationState = 50;
- sub_4054F0();
+ UG15fall();
}
break;
case 27:
@@ -1013,7 +1016,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(18)) {
_animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
_animationState = 50;
- sub_4054F0();
+ UG15fall();
if (Actor_Query_Goal_Number(kActorMcCoy) == kGoalMcCoyNR04Drink) {
Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyNR04PassOut);
}
@@ -1068,16 +1071,16 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {
*animation = 12;
_animationFrame++;
if (_animationFrame == 1
- && Actor_Query_Goal_Number(kActorMcCoy) == 230
+ && Actor_Query_Goal_Number(kActorMcCoy) == kGoalMcCoyNR11Shoot
&& _NR10SteeleShooting
) {
- dword_45A0F8 = 27;
+ _nextSoundId = 27;
}
if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(12)) {
_animationState = 17;
_animationFrame = 0;
*animation = 12;
- if (Actor_Query_Goal_Number(kActorMcCoy) == 230) {
+ if (Actor_Query_Goal_Number(kActorMcCoy) == kGoalMcCoyNR11Shoot) {
_animationFrame = 0;
_animationState = 21;
_NR10SteeleShooting = true;
@@ -1790,24 +1793,29 @@ void AIScriptMcCoy::fallDown() {
return Actor_Set_At_XYZ(kActorMcCoy, x, _fallHeightCurrent, z, Actor_Query_Facing_1024(kActorMcCoy));
}
-void AIScriptMcCoy::sub_4054F0() {
- if (Actor_Query_Which_Set_In(kActorMcCoy) == kSetUG15
- && Actor_Query_Goal_Number(kActorMcCoy) != 390
- && !Game_Flag_Query(682)
+void AIScriptMcCoy::UG15fall() {
+ if ( Actor_Query_Which_Set_In(kActorMcCoy) == kSetUG15
+ && Actor_Query_Goal_Number(kActorMcCoy) != kGoalMcCoyUG15Fall
+ && !Game_Flag_Query(kFlagUG15BridgeBroken)
) {
float x, y, z;
Actor_Query_XYZ(kActorMcCoy, &x, &y, &z);
- if ((z < 220.0f) && (-210.0f < x) && (-70.0f > x)) {
- Game_Flag_Set(682);
- Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(kSceneLoopModeOnce, 2, true);
- Actor_Set_Goal_Number(kActorMcCoy, 390);
+ if ( 220.0f > z
+ && -210.0f < x
+ && -70.0f > x
+ ) {
+ Game_Flag_Set(kFlagUG15BridgeBroken);
+ Scene_Loop_Set_Default(3); // kUG15LoopMainLoopBridgeBroken
+ Scene_Loop_Start_Special(kSceneLoopModeOnce, 2, true); // kUG15LoopBridgeBreaks
+ Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyUG15Fall);
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
- if (-200.0 < x && -62.0f > x) {
- Actor_Set_Goal_Number(kActorFreeSlotA, 309);
+ if (-200.0 < x
+ && -62.0f > x
+ ) {
+ Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Fall);
}
} else {
- Actor_Set_Goal_Number(kActorMcCoy, 391);
+ Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyUG15Die);
}
}
}
@@ -1929,11 +1937,6 @@ void AIScriptMcCoy::dodge() {
}
}
-void AIScriptMcCoy::sub_405920() {
- _animationFrame = 0;
- _animationState = 47;
-}
-
void AIScriptMcCoy::sub_405940(float a1) {
float x, y, z;
int currentAngle = Actor_Query_Facing_1024(kActorMcCoy);