2016-09-10 18:33:04 +02:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers , whose names
* are too numerous to list here . Please refer to the COPYRIGHT
* file distributed with this source distribution .
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
*
*/
2018-02-10 20:34:28 +01:00
# include "bladerunner/script/scene_script.h"
2016-09-10 18:33:04 +02:00
namespace BladeRunner {
2019-01-24 22:57:41 +01:00
enum kDR05Loops {
2019-04-27 19:57:55 +03:00
kDR05LoopMainLoop = 0 ,
2019-01-24 22:57:41 +01:00
kDR05LoopMainDestroyed = 2
} ;
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : InitializeScene ( ) {
2016-09-10 18:33:04 +02:00
Setup_Scene_Information ( - 22.0f , 0.3f , 221.0f , 0 ) ;
2019-01-24 22:57:41 +01:00
2019-01-19 23:12:45 +01:00
Game_Flag_Reset ( kFlagDR04toDR05 ) ;
2019-01-24 22:57:41 +01:00
2016-09-10 18:33:04 +02:00
Scene_Exit_Add_2D_Exit ( 0 , 0 , 38 , 80 , 467 , 3 ) ;
2019-01-24 22:57:41 +01:00
2019-04-06 00:02:32 +03:00
Ambient_Sounds_Add_Looping_Sound ( kSfxSKINBED1 , 25 , 0 , 1 ) ;
2019-01-24 22:57:41 +01:00
2019-01-19 23:12:45 +01:00
if ( ! Game_Flag_Query ( kFlagDR05BombExploded ) ) {
2019-01-24 22:57:41 +01:00
Overlay_Play ( " DR05OVER " , 0 , true , false , 0 ) ;
2016-09-10 18:33:04 +02:00
}
2019-01-19 23:12:45 +01:00
if ( Game_Flag_Query ( kFlagDR05BombExploded ) ) {
2019-01-24 22:57:41 +01:00
Scene_Loop_Set_Default ( kDR05LoopMainDestroyed ) ;
2016-09-10 18:33:04 +02:00
} else {
2019-04-27 19:57:55 +03:00
Scene_Loop_Set_Default ( kDR05LoopMainLoop ) ;
2016-09-10 18:33:04 +02:00
}
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : SceneLoaded ( ) {
2016-09-10 18:33:04 +02:00
Obstacle_Object ( " MAN PROPHI " , true ) ;
Unobstacle_Object ( " BOX06 " , true ) ;
Unobstacle_Object ( " BOX183 " , true ) ;
Clickable_Object ( " T2 DOORWAY " ) ;
2019-01-24 22:57:41 +01:00
2019-01-19 23:12:45 +01:00
if ( ! Game_Flag_Query ( kFlagDR05BombExploded ) ) {
2019-04-20 17:32:47 +03:00
Item_Add_To_World ( kItemBomb , kModelAnimationBomb , kSetDR05 , - 1.57f , 31.33f , 75.21f , 540 , 16 , 16 , true , true , false , true ) ;
2019-01-24 22:57:41 +01:00
if ( Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiDefault ) {
2019-04-20 17:32:47 +03:00
Item_Add_To_World ( kItemChain , kModelAnimationBadge , kSetDR05 , 37.35f , 1.59f , 46.72f , 0 , 20 , 20 , true , true , false , true ) ; // TODO a bug? reusing still animation of kModelAnimationBadge
2016-09-10 18:33:04 +02:00
}
}
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : MouseClick ( int x , int y ) {
2016-09-10 18:33:04 +02:00
return false ;
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : ClickedOn3DObject ( const char * objectName , bool a2 ) {
2016-09-10 18:33:04 +02:00
if ( Object_Query_Click ( " T2 DOORWAY " , objectName ) ) {
2019-01-24 22:57:41 +01:00
if ( ! Game_Flag_Query ( kFlagNotUsed276 )
& & Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiDefault
2019-01-19 23:12:45 +01:00
) {
2019-01-24 22:57:41 +01:00
Actor_Face_Object ( kActorMcCoy , " T2 DOORWAY " , true ) ;
Actor_Says ( kActorMcCoy , 1020 , 14 ) ;
Actor_Says ( kActorMoraji , 90 , 13 ) ;
} else {
2019-05-09 15:15:33 +03:00
if ( ! Loop_Actor_Walk_To_XYZ ( kActorMcCoy , 57.61f , 0.3f , 69.27f , 0 , true , false , false ) ) {
2017-03-29 01:50:47 +02:00
Actor_Face_Object ( kActorMcCoy , " T2 DOORWAY " , true ) ;
Actor_Says ( kActorMcCoy , 8522 , 13 ) ;
Actor_Says ( kActorMcCoy , 8521 , 14 ) ;
2016-09-10 18:33:04 +02:00
}
}
2019-01-24 22:57:41 +01:00
2016-09-10 18:33:04 +02:00
return true ;
}
return false ;
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : ClickedOnActor ( int actorId ) {
2016-09-10 18:33:04 +02:00
return false ;
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : ClickedOnItem ( int itemId , bool a2 ) {
2019-01-24 22:57:41 +01:00
if ( itemId = = kItemBomb ) {
2016-09-10 18:33:04 +02:00
if ( Player_Query_Combat_Mode ( ) ) {
2019-01-19 23:12:45 +01:00
Game_Flag_Set ( kFlagDR05BombWillExplode ) ;
2019-01-24 22:57:41 +01:00
Actor_Set_Goal_Number ( kActorMoraji , kGoalMorajiChooseFate ) ;
2019-01-19 23:12:45 +01:00
} else if ( ! Game_Flag_Query ( kFlagDR05BombExploded )
2019-01-24 22:57:41 +01:00
& & ! Loop_Actor_Walk_To_Item ( kActorMcCoy , kItemBomb , 24 , true , true )
& & Actor_Query_Goal_Number ( kActorMoraji ) ! = kGoalMorajiRunOut
2019-01-19 23:12:45 +01:00
) {
2017-03-29 01:50:47 +02:00
if ( ! Actor_Query_Goal_Number ( kActorMoraji ) ) {
Actor_Says_With_Pause ( kActorMcCoy , 1015 , 0.1f , 12 ) ;
Actor_Says ( kActorMoraji , 70 , 13 ) ;
2016-09-10 18:33:04 +02:00
}
2019-01-24 22:57:41 +01:00
Actor_Set_Goal_Number ( kActorMoraji , kGoalMorajiChooseFate ) ;
2016-09-10 18:33:04 +02:00
}
//return true; //bug?
}
2019-01-24 22:57:41 +01:00
if ( itemId = = kItemChain
2019-01-19 23:12:45 +01:00
& & Player_Query_Combat_Mode ( )
2019-05-17 14:26:03 +03:00
& & Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiDefault
2019-01-19 23:12:45 +01:00
) {
2019-01-24 22:57:41 +01:00
Overlay_Play ( " DR05OVER " , 1 , false , true , 0 ) ;
Item_Remove_From_World ( kItemChain ) ;
2019-01-19 23:12:45 +01:00
Game_Flag_Set ( kFlagDR05ChainShot ) ;
2019-01-24 22:57:41 +01:00
Actor_Set_Goal_Number ( kActorMoraji , kGoalMorajiFreed ) ;
2019-03-31 17:52:57 +03:00
Music_Play ( kMusicMoraji , 71 , 0 , 0 , - 1 , 0 , 2 ) ;
2016-09-10 18:33:04 +02:00
return true ;
}
return false ;
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : ClickedOnExit ( int exitId ) {
2016-09-10 18:33:04 +02:00
if ( exitId = = 0 ) {
2019-05-09 15:15:33 +03:00
if ( ! Loop_Actor_Walk_To_XYZ ( kActorMcCoy , - 22.0f , 0.3f , 221.0f , 0 , true , false , false ) ) {
2019-01-19 23:12:45 +01:00
Game_Flag_Reset ( kFlagNotUsed232 ) ;
Game_Flag_Set ( kFlagDR05toDR04 ) ;
2019-01-14 21:09:12 +01:00
Set_Enter ( kSetDR01_DR02_DR04 , kSceneDR04 ) ;
2016-09-10 18:33:04 +02:00
}
return true ;
}
return false ;
}
2017-03-23 16:20:10 +01:00
bool SceneScriptDR05 : : ClickedOn2DRegion ( int region ) {
2016-09-10 18:33:04 +02:00
return false ;
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : SceneFrameAdvanced ( int frame ) {
2016-09-10 18:33:04 +02:00
if ( frame = = 49 ) {
2019-04-05 21:33:47 +03:00
Sound_Play ( kSfxLABMISC3 , Random_Query ( 50 , 50 ) , 80 , 80 , 50 ) ;
2016-09-10 18:33:04 +02:00
}
2019-01-24 22:57:41 +01:00
2019-01-19 23:12:45 +01:00
if ( Game_Flag_Query ( kFlagDR05BombWillExplode ) ) {
2019-01-24 22:57:41 +01:00
Item_Remove_From_World ( kItemBomb ) ;
2019-01-19 23:12:45 +01:00
Game_Flag_Reset ( kFlagDR05BombWillExplode ) ;
Game_Flag_Set ( kFlagDR05BombExploded ) ;
2019-01-24 22:57:41 +01:00
Actor_Set_Goal_Number ( kActorMoraji , kGoalMorajiChooseFate ) ;
2016-09-10 18:33:04 +02:00
}
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : ActorChangedGoal ( int actorId , int newGoal , int oldGoal , bool currentSet ) {
2016-09-10 18:33:04 +02:00
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : PlayerWalkedIn ( ) {
2019-01-19 23:12:45 +01:00
if ( ! Game_Flag_Query ( kFlagDR05ExplodedEntered )
& & ! Game_Flag_Query ( kFlagDR05ChainShot )
& & Game_Flag_Query ( kFlagDR05BombExploded )
) {
2019-01-24 22:57:41 +01:00
Item_Remove_From_World ( kItemChain ) ;
2016-09-10 18:33:04 +02:00
}
2019-01-19 23:12:45 +01:00
if ( Game_Flag_Query ( kFlagDR05BombExploded ) ) {
2019-05-09 15:15:33 +03:00
Loop_Actor_Walk_To_XYZ ( kActorMcCoy , - 10.0f , 0.3f , 133.0f , 0 , false , false , false ) ;
2019-01-19 23:12:45 +01:00
if ( ! Game_Flag_Query ( kFlagDR05ExplodedEntered ) ) {
Game_Flag_Set ( kFlagDR05ExplodedEntered ) ;
2018-02-10 20:34:28 +01:00
if ( Game_Flag_Query ( kFlagSadikIsReplicant ) ) {
2017-03-29 01:50:47 +02:00
Actor_Voice_Over ( 730 , kActorVoiceOver ) ;
Actor_Voice_Over ( 740 , kActorVoiceOver ) ;
Actor_Voice_Over ( 750 , kActorVoiceOver ) ;
Actor_Voice_Over ( 760 , kActorVoiceOver ) ;
2019-01-19 23:12:45 +01:00
Actor_Clue_Acquire ( kActorMcCoy , kClueExpertBomber , true , - 1 ) ;
2016-09-10 18:33:04 +02:00
} else {
2017-03-29 01:50:47 +02:00
Actor_Voice_Over ( 670 , kActorVoiceOver ) ;
Actor_Voice_Over ( 680 , kActorVoiceOver ) ;
Actor_Voice_Over ( 700 , kActorVoiceOver ) ;
Actor_Voice_Over ( 710 , kActorVoiceOver ) ;
Actor_Voice_Over ( 720 , kActorVoiceOver ) ;
2019-01-19 23:12:45 +01:00
Actor_Clue_Acquire ( kActorMcCoy , kClueAmateurBomber , true , - 1 ) ;
2016-09-10 18:33:04 +02:00
}
}
} else {
2019-05-09 15:15:33 +03:00
Loop_Actor_Walk_To_XYZ ( kActorMcCoy , - 10.0f , 0.3f , 133.0f , 0 , false , true , false ) ;
2016-09-10 18:33:04 +02:00
}
2019-01-19 23:12:45 +01:00
if ( ! Game_Flag_Query ( kFlagDR05MorajiTalk )
2019-01-24 22:57:41 +01:00
& & Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiDefault
2019-01-19 23:12:45 +01:00
) {
2017-03-29 01:50:47 +02:00
Actor_Face_Actor ( kActorMcCoy , kActorMoraji , true ) ;
Actor_Says ( kActorMcCoy , 1010 , 13 ) ;
2019-01-24 22:57:41 +01:00
Actor_Face_Item ( kActorMcCoy , kItemBomb , true ) ;
2016-09-10 18:33:04 +02:00
Player_Set_Combat_Mode ( true ) ;
2017-03-29 01:50:47 +02:00
Actor_Says ( kActorMoraji , 60 , 12 ) ;
2019-01-24 22:57:41 +01:00
Actor_Change_Animation_Mode ( kActorMcCoy , kAnimationModeIdle ) ;
2019-01-19 23:12:45 +01:00
Game_Flag_Set ( kFlagDR05MorajiTalk ) ;
2016-09-10 18:33:04 +02:00
//return true;
}
//return false;
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : PlayerWalkedOut ( ) {
2019-01-21 21:57:44 +01:00
Ambient_Sounds_Remove_All_Non_Looping_Sounds ( true ) ;
2016-09-10 18:33:04 +02:00
Ambient_Sounds_Remove_All_Looping_Sounds ( 1 ) ;
2019-01-24 22:57:41 +01:00
if ( Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiFreed
| | Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiGetUp
| | Actor_Query_Goal_Number ( kActorMoraji ) = = kGoalMorajiScream
) {
Actor_Set_Goal_Number ( kActorMoraji , kGoalMorajiRunOut ) ;
2016-09-10 18:33:04 +02:00
//return true;
}
//return false;
}
2017-03-23 16:20:10 +01:00
void SceneScriptDR05 : : DialogueQueueFlushed ( int a1 ) {
2016-09-10 18:33:04 +02:00
}
} // End of namespace BladeRunner