Core.Object | +--Engine.Actor | +--Engine.Controller | +--XIDCine.CineController2 | +--XIDCine.MangousteSSH1Controller
name
AntiFuite_PreviousStateName,
int
AttackSides[SideAttackCount]
DesiredPosition,
DesiredOrientation
MangousteSSH1Pawn
Mangouste
MissileFakeSSH1
MangousteNearestMissile,
float
PlayerNearestMissileDistance,
PlayerNearestMissileIndex,
bAntiFuite,
bTextFinished
ROTATOR
AdjustAim(Ammunition FA, VECTOR PS, INT AE)
void
AvoidObstacle(vector TargetLocation, out vector)
BurstFirePlayer(float BurstTime, float PauseTime, optional bool)
ChooseASide()
CineWarn(Actor other)
//{}
ComputeMangousteNearestMissile()
ComputePlayerNearestMissile()
EndOfMove()
vector
HVector(vector A, vector B)
Initialize()
SetWantedSpeed(float wspeed)
SimpleSteering(float dt, float tmpDetectionDistance, optional bool)
VaporHurts()
CineWarn(Actor Other)
// Hitwall( v,a ), } */
Reflex()
00001 00002 // ============================================================================= 00003 // 00004 // dMMMMMMMMb .aMMMb dMMMMb .aMMMMP aMMMb dMP dMP .dMMMb dMMMMMMP dMMMMMP -------- 00005 // dMP"dMP"dMP dMP"dMP dMP dMP dMP" dMP"dMP dMP dMP MP" VP dMP dMP --- 00006 // dMP dMP dMP dMMMMMP dMP dMP dMP MMP"dMP dMP dMP dMP VMMMb dMP dMMMP ----- 00007 // dMP dMP dMP dMP dMP dMP dMP dMP.dMP dMP.dMP dMP.dMP dP .dMP dMP dMP --- 00008 // dMP dMP dMP dMP dMP dMP dMP VMMMP" VMMMP" VMMMP" VMMMP" dMP dMMMMMP -------- CONTROLLER 00009 // by iKi 00010 //============================================================================= 00011 00012 class MangousteSSH1Controller extends CineController2; 00013 00014 // ########################################################################### 00015 // ## #### 00016 // ## dMP dMP .aMMMb dMMMMb dMP .aMMMb dMMMMb dMP dMMMMMP .dMMMb #### 00017 // ## dMP dMP dMP"dMP dMP.dMP amr dMP"dMP dMP"dMP dMP dMP dMP" VP #### 00018 // ## dMP dMP dMMMMMP dMMMMK" dMP dMMMMMP dMMMMK" dMP dMMMP VMMMb #### 00019 // ## YMvAP" dMP dMP dMP"AMF dMP dMP dMP dMP.aMF dMP dMP dP .dMP #### 00020 // ## VP" dMP dMP dMP dMP dMP dMP dMP dMMMMP" dMMMMMP dMMMMMP VMMMP" #### 00021 // ## #### 00022 //############################################################################# 00023 // ########################################################################## 00024 00025 // My Pawn actor 00026 VAR MangousteSSH1Pawn Mangouste; 00027 00028 VAR TRANSIENT bool bInvicible, bSwitchAttackSide, bAntiFuite, bTextFinished; 00029 VAR TRANSIENT VECTOR DesiredPosition, DesiredOrientation; 00030 VAR TRANSIENT MissileFakeSSH1 MangousteNearestMissile, 00031 PlayerNearestMissile, 00032 Missiles[5]; // CT, NE, NW, SE, SW 00033 VAR TRANSIENT float PlayerNearestMissileDistance, 00034 MangousteNearestMissileDistance, 00035 LastTimeShoot, 00036 VaporTroubleEndTime, 00037 ReloadingEndTime, 00038 UnseenTime, 00039 XIIIHiddenTime, 00040 NextTauntTime; 00041 VAR TRANSIENT int PlayerNearestMissileIndex, 00042 MangousteWantedMissileIndex, 00043 AttackNumber, CurrentSide, Phase, 00044 TauntIndex; 00045 VAR TRANSIENT name AntiFuite_PreviousStateName, 00046 Vapor_PreviousStateName; 00047 00048 CONST SideAttackCount=5; 00049 CONST DifficultyRate=0.20; 00050 VAR int AttackSides[SideAttackCount]; 00051 00052 00053 CONST HoleRadius=512;// real 512 00054 //CONST MissileRadius=256; 00055 //CONST PlatformRadius=1800; // real 1824 or 1750 00056 00057 // ##################################################### 00058 // ## #### 00059 // ## .aMMMMP dMP .aMMMb dMMMMb .aMMMb dMP #### 00060 // ## dMP" dMP dMP"dMP dMP"dMP dMP"dMP dMP #### 00061 // ## dMP MMP"dMP dMP dMP dMMMMK" dMMMMMP dMP #### 00062 // ## dMP.dMP dMP dMP.aMP dMP.aMF dMP dMP dMP #### 00063 // ## VMMMP" dMMMMMP VMMMP" dMMMMP" dMP dMP dMMMMMP #### 00064 // ## #### 00065 //######################################################## 00066 // ##################################################### 00067 00068 EVENT BeginState() 00069 { 00070 LOG( "###################################" ); 00071 LOG( self@"is in STATE :"@GetStateName( ) ); 00072 LOG( "-----------------------------------" ); 00073 } 00074 00075 FUNCTION Initialize() 00076 { 00077 LOCAL MissileFakeSSH1 mis; 00078 00079 Mangouste=MangousteSSH1Pawn(Pawn); 00080 00081 foreach DynamicActors(class'MissileFakeSSH1',mis) 00082 { 00083 switch(mis.tag) 00084 { 00085 case 'Central': Missiles[0]=mis; break; 00086 case 'NE': Missiles[1]=mis; break; 00087 case 'NW': Missiles[2]=mis; break; 00088 case 'SE': Missiles[3]=mis; break; 00089 case 'SW': Missiles[4]=mis; break; 00090 default: Log("Unknown missile tag"@mis.tag); 00091 } 00092 } 00093 Super.Initialize(); 00094 } 00095 00096 00097 EVENT SeePlayer( Pawn Seen ); //{} 00098 00099 FUNCTION CineWarn(actor other) 00100 { 00101 // Log( "GLOBAL::CineWarn(...) => STA_Phase01_A_HideOut" ); 00102 // Mangouste.KillVignettes(); 00103 // GotoState('STA_Phase01_Start'); 00104 GotoState('STA_Phase00_To_Phase01'); 00105 } 00106 00107 FUNCTION ROTATOR AdjustAim(Ammunition FA, VECTOR PS, INT AE) { return rotation; } 00108 00109 static final FUNCTION vector HVector(vector A,vector B) { return (B-A)*vect(1,1,0); } 00110 00111 EVENT HearNoise(float Loudness, Actor NoiseMaker); 00112 00113 FUNCTION ComputePlayerNearestMissile() 00114 { 00115 LOCAL float d; 00116 LOCAL int i; 00117 00118 PlayerNearestMissileDistance = 1000000; 00119 00120 for ( i=0; i<5; ++i ) 00121 { 00122 if ( Missiles[i].bIsUp ) 00123 { 00124 d = vSize( HVector( Missiles[i].Location, PC.Pawn.Location ) ); 00125 if ( PlayerNearestMissileDistance>d ) 00126 { 00127 PlayerNearestMissile = Missiles[i]; 00128 PlayerNearestMissileDistance = d; 00129 PlayerNearestMissileIndex = i; 00130 } 00131 } 00132 } 00133 } 00134 00135 FUNCTION ComputeMangousteNearestMissile() 00136 { 00137 LOCAL float d; 00138 LOCAL int i; 00139 00140 MangousteNearestMissileDistance=1000000; 00141 00142 for (i=0;i<5;++i) 00143 { 00144 if ( Missiles[i].bIsUp ) 00145 { 00146 d = vSize( HVector( Missiles[i].Location, Pawn.Location ) ); 00147 if ( MangousteNearestMissileDistance>d ) 00148 { 00149 MangousteNearestMissile = Missiles[i]; 00150 MangousteNearestMissileDistance = d; 00151 } 00152 } 00153 } 00154 } 00155 00156 FUNCTION BurstFirePlayer( float BurstTime, float PauseTime, optional bool bLeftOnly) 00157 { 00158 LOCAL float TimeCorrection; 00159 00160 TimeCorrection = DifficultyRate * BurstTime; 00161 BurstTime -= TimeCorrection; 00162 PauseTime += TimeCorrection; 00163 00164 if ( NextTauntTime==0 ) 00165 NextTauntTime = Level.TimeSeconds + 10 + 5*FRand(); 00166 else 00167 { 00168 if ( Level.TimeSeconds > NextTauntTime && !Mangouste.DM.bSpeaking/* && TauntIndex<3 */ ) 00169 { 00170 Mangouste.DM.StartDialogue( Min ( 7+TauntIndex, 9 ) ); // ... 00171 NextTauntTime = Level.TimeSeconds + 20 + 5*FRand(); 00172 TauntIndex = (TauntIndex+1)&7; 00173 } 00174 } 00175 00176 if ( Level.TimeSeconds >= ReloadingEndTime ) 00177 Mangouste.bReloadingWeapon = false; 00178 00179 if ( Level.TimeSeconds < VaporTroubleEndTime ) 00180 { 00181 bFire=0; 00182 } 00183 else 00184 { 00185 if ( ( bFire==0 ) && ( Level.TimeSeconds-LastTimeShoot>(BurstTime+PauseTime) ) && CanSee( PC.Pawn ) ) 00186 { 00187 bFire=1; 00188 LastTimeShoot = Level.TimeSeconds; 00189 } 00190 //Mangouste.ControlSpineRotation(true); 00191 if ( bFire==1 && Level.TimeSeconds-LastTimeShoot>BurstTime ) 00192 { 00193 if ( CanSee(PC.Pawn) ) 00194 { 00195 if ( !Mangouste.bReloadingWeapon ) 00196 { 00197 // Mangouste.bFireLeft = true; 00198 // Mangouste.bFireRight = true; 00199 Mangouste.LeftUziFire(PC.Pawn.Location); 00200 if (!bLeftOnly) 00201 Mangouste.RightUziFire(PC.Pawn.Location); 00202 } 00203 else 00204 { 00205 ReloadingEndTime = Level.TimeSeconds + 2.0; 00206 bFire=0; 00207 LastTimeShoot = 0; //Level.TimeSeconds; 00208 } 00209 } 00210 else 00211 { 00212 bFire=0; 00213 } 00214 } 00215 } 00216 } 00217 00218 FUNCTION SimpleSteering( float dt, float tmpDetectionDistance, optional bool tmpAvoid ) 00219 { 00220 Plane = HVector( Pawn.Location, DesiredPosition ); 00221 Steering( DesiredPosition, dt, tmpDetectionDistance, tmpAvoid ); 00222 } 00223 00224 FUNCTION AvoidObstacle( vector TargetLocation,out vector wanted_acceleration ) 00225 { 00226 LOCAL vector vTemp, vTemp2, MissileLocation; 00227 LOCAL float a, mini, emergency_factor; 00228 LOCAL int i,n; 00229 00230 mini=1750000; 00231 n=-1; 00232 00233 for (i=0;i<5;i++) 00234 { 00235 vTemp = HVector( Missiles[i].Location, Pawn.Location ); 00236 if ( vTemp dot Hvector( TargetLocation, Pawn.Location ) < 0 ) 00237 continue; 00238 a=vSize(vTemp)-HoleRadius; 00239 if (a<mini) 00240 { 00241 mini=a; 00242 n=i; 00243 MissileLocation = Missiles[i].Location; 00244 } 00245 } 00246 00247 if ( n==-1 ) 00248 return; 00249 00250 if ( mini>64 ) 00251 return; 00252 00253 vTemp = HVector( MissileLocation, Pawn.Location ); 00254 00255 if ( ( vTemp cross HVector( TargetLocation, Pawn.Location ) ).Z > 0 ) 00256 { 00257 vTemp2.X=vTemp.Y; 00258 vTemp2.Y=-vTemp.X; 00259 vTemp2.Z=0; 00260 } 00261 else 00262 { 00263 vTemp2.X=-vTemp.Y; 00264 vTemp2.Y=vTemp.X; 00265 vTemp2.Z=0; 00266 } 00267 vTemp2 = Normal(vTemp2); 00268 00269 // Mangouste.DEBUG_TargetDirection = Mangouste.Location + 100 * vTemp2; 00270 00271 Pawn.Velocity = fmax( /*0.6*MyPawnGroundSpeed*/Pawn.GroundSpeed,vSize(Pawn.Velocity)) * vTemp2; // annule la composante radiale 00272 } 00273 00274 FUNCTION EndOfMove() 00275 { 00276 Pawn.Acceleration = vect( 0, 0, 0 ); 00277 Pawn.Velocity = vect( 0, 0, 0 ); 00278 Pawn.PlayMoving( ); 00279 } 00280 00281 FUNCTION VaporHurts(); 00282 00283 FUNCTION NotifyTakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ); 00284 00285 FUNCTION SetWantedSpeed(float wspeed) 00286 { 00287 wantedspeed=wspeed; 00288 Pawn.GroundSpeed=600 * wantedspeed; // MaximumSpeed 00289 } 00290 00291 FUNCTION ChooseASide() 00292 { 00293 LOCAL int side; 00294 00295 side = AttackSides[ AttackNumber ]; 00296 if ( bSwitchAttackSide ) 00297 side = -side; 00298 AttackNumber++; 00299 if ( AttackNumber==SideAttackCount ) 00300 { 00301 AttackNumber = 0; 00302 bSwitchAttackSide = !bSwitchAttackSide; 00303 } 00304 CurrentSide = side; 00305 } 00306 00307 EVENT Tick(float dt) 00308 { 00309 LOCAL VECTOR vTemp; 00310 00311 FocalPoint = Pawn.Location + 256 * NORMAL( DesiredOrientation ); 00312 00313 if ( bAntiFuite /*Phase>0 && Phase<3*/ ) 00314 { 00315 if ( GetStateName()!='STA_AntiFuite' ) 00316 { 00317 vTemp = PC.Pawn.Location - Missiles[0].Location; 00318 vTemp.Z = 0; 00319 if ( vSize( vTemp )>1750 ) 00320 { 00321 AntiFuite_PreviousStateName = GetStateName(); 00322 GotoState( 'STA_AntiFuite' ); 00323 } 00324 } 00325 00326 if ( UnSeenTime>=0 ) 00327 { 00328 if ( !PC.CanSee( Mangouste ) ) 00329 { 00330 UnseenTime += dt; 00331 if ( UnseenTime > 8.0 && !Mangouste.DM.bSpeaking ) 00332 { 00333 Mangouste.DM.StartDialogue( 1 ); // Alors on a peut le sens de l'orientation 00334 UnseenTime = -1; 00335 } 00336 00337 } 00338 else 00339 UnseenTime = 0; 00340 } 00341 00342 if ( XIIIHiddenTime>=0 ) 00343 { 00344 if ( CanSee( PC.Pawn ) ) 00345 { 00346 XIIIHiddenTime += dt; 00347 if ( XIIIHiddenTime > 8.0 && !Mangouste.DM.bSpeaking ) 00348 { 00349 Mangouste.DM.StartDialogue( 4 ); // Espèce de lache, montre-toi 00350 XIIIHiddenTime = -1; 00351 } 00352 } 00353 else 00354 XIIIHiddenTime = 0; 00355 } 00356 00357 } 00358 00359 } 00360 00361 STATE STA_AntiFuite 00362 { 00363 EVENT BeginState( ) 00364 { 00365 Global.BeginState(); 00366 SetWantedSpeed(1.00); 00367 // PC.GotoState('PlayerWalking'); 00368 } 00369 00370 EVENT Tick( float dt ) 00371 { 00372 LOCAL VECTOR vTemp; 00373 LOCAL FLOAT f; 00374 00375 vTemp = PC.Pawn.Location - Missiles[0].Location; 00376 vTemp.Z = 0; 00377 // Log( vSize( (PC.Pawn.Location - Missiles[0].Location )*vect(1,1,0)) ); 00378 00379 f = vSize( vTemp )-1750; 00380 00381 if ( f<0 ) 00382 { 00383 LOG ( "RETURN"@AntiFuite_PreviousStateName ); 00384 GotoState( AntiFuite_PreviousStateName ); 00385 return; 00386 } 00387 00388 00389 DesiredPosition = PC.Pawn.Location; 00390 00391 SimpleSteering( dt, f+500 ); 00392 BurstFirePlayer( 1.0, 0.0 ); 00393 BurstFirePlayer( 1.0, 0.0 ); 00394 Global.Tick( dt ); 00395 } 00396 00397 EVENT EndState() 00398 { 00399 bFire=0; 00400 } 00401 } 00402 00403 STATE STA_Phase00 00404 { 00405 EVENT BeginState() 00406 { 00407 // LOCAL CWndFocusTrigger wnd; 00408 PC.Pawn.bCanClimbLadders=false; 00409 if ( PC.Pawn.OnLadder!=none ) 00410 PC.Pawn.OnLadder.PawnLeavingVolume( PC.Pawn ); 00411 XIIIBaseHud(PC.MyHud).AddHudCartoonFocus( Mangouste, 0, false, 5.0, false, /*zoomFOV*/ 10, /*zoomDistance*/ 1200, /*bDanger*/ true); 00412 00413 Global.BeginState(); 00414 SetWantedSpeed(0.48); 00415 Focus = PC.Pawn; 00416 } 00417 00418 EVENT Tick(float dt) 00419 { 00420 PC.SetRotation( PC.Rotation + RotDiff( ROTATOR( Mangouste.Location-vect(0,0,25) - PC.Pawn.Location ), PC.Rotation, 90*182*dt ) ); 00421 00422 DesiredPosition = PC.Pawn.Location; 00423 00424 SimpleSteering( dt, 1200 ); 00425 00426 Global.Tick( dt ); 00427 } 00428 } 00429 00430 STATE STA_Phase00_To_Phase01 00431 { 00432 EVENT BeginState() 00433 { 00434 Pawn.RotationRate.Yaw=270*182; 00435 Global.BeginState(); 00436 SetWantedSpeed(1.09); 00437 Mangouste.GotoState( '' ); 00438 Phase++; 00439 // GotoState( 'STA_Dying'); 00440 } 00441 00442 EVENT EndState() 00443 { 00444 // SetTimer( 0, false ); 00445 // bFire=0; 00446 XIIIBaseHud(PC.MyHud).AddBossBar( Pawn ); 00447 Level.AdjustDifficulty = -(Level.Game.Difficulty)*10; 00448 PC.GotoState( 'PlayerWalking' ); 00449 bAntiFuite=true; 00450 } 00451 00452 EVENT Tick(float dt) 00453 { 00454 LOCAL VECTOR vTemp; 00455 00456 // DesiredOrientation = Pawn.Velocity; 00457 00458 // ComputePlayerNearestMissile(); 00459 00460 DesiredPosition = Missiles[0].Location+620*Normal(Hvector(PC.Pawn.Location,Missiles[0].Location)); 00461 00462 SimpleSteering( dt, 100 ); 00463 00464 // BurstFirePlayer( 0.1, 2.9, true ); 00465 00466 Global.Tick( dt ); 00467 } 00468 00469 EVENT EndOfMove() 00470 { 00471 GotoState( 'STA_Phase01_A_HideOut' ); 00472 } 00473 } 00474 00475 // ======================================================= 00476 // 00477 // dMMMMb dMP dMP .aMMMb .dMMMb dMMMMMP aMP 00478 // dMP.dMP dMP.dMP dMP"dMP dMP" VP dMP adMMP 00479 // dMMMMP" dMMMMK" dMMMMMP VMMMb dMMMP dMMP dMP 00480 // dMP dMP"AMF dMP dMP dP .dMP dMP dMP 00481 // dMP dMP dMP dMP dMP VMMMP" dMMMMMP dMMMMMP 00482 // 00483 //======================================================= 00484 /* 00485 STATE STA_Phase01_Start 00486 { 00487 EVENT BeginState( ) 00488 { 00489 Phase++; 00490 GotoState( 'STA_Phase01_A_HideOut' ); 00491 } 00492 }*/ 00493 00494 STATE STA_Phase01_A_HideOut 00495 { 00496 EVENT BeginState() 00497 { 00498 // Pawn.bDelayDisplay=true; 00499 Pawn.RotationRate.Yaw=270*182; 00500 Global.BeginState(); 00501 SetWantedSpeed(1.09); 00502 Pawn.GotoState( '' ); 00503 if (TimerRate==0.0) 00504 SetTimer(5.0,false); 00505 // Focus = PC.Pawn; 00506 Mangouste.PeripheralVision=0.70; 00507 } 00508 00509 EVENT EndState() 00510 { 00511 SetTimer( 0, false ); 00512 bFire=0; 00513 } 00514 00515 EVENT Tick(float dt) 00516 { 00517 LOCAL VECTOR vTemp; 00518 00519 DesiredOrientation = Pawn.Velocity; 00520 00521 ComputePlayerNearestMissile(); 00522 00523 DesiredPosition = Missiles[0].Location+620*Normal(Hvector(PC.Pawn.Location,Missiles[0].Location)); 00524 00525 SimpleSteering( dt, 100 ); 00526 00527 BurstFirePlayer( 0.2, 0.8, true ); 00528 00529 Global.Tick( dt ); 00530 } 00531 00532 FUNCTION VaporHurts() 00533 { 00534 GotoState('STA_Phase01_C_VaporTrouble'); 00535 } 00536 00537 EVENT Timer() 00538 { 00539 GotoState('STA_Phase01_B_FastAttack'); 00540 } 00541 00542 } 00543 00544 STATE STA_Phase01_B_FastAttack 00545 { 00546 EVENT BeginState() 00547 { 00548 Global.BeginState(); 00549 SetWantedSpeed(1.00); 00550 Pawn.GotoState( '' ); 00551 ChooseASide(); 00552 XIIIBaseHud(PC.MyHud).AddHudCartoonFocus( Mangouste, 0, false, 4.0, false, 10, 1200, true); 00553 } 00554 00555 EVENT EndState() 00556 { 00557 // Mangouste.KillVignettes(); 00558 SetTimer( 0, false ); 00559 // SetTimer2( 0, false ); 00560 bFire=0; 00561 } 00562 00563 EVENT Tick(float dt) 00564 { 00565 if (CanSee(PC.Pawn) /*&& !Mangouste.bReloadingWeapon*/ ) 00566 { 00567 if (TimerRate==0.0) 00568 { 00569 SetTimer( 0.8, false ); 00570 } 00571 } 00572 BurstFirePlayer( 0.4, 0.6 ); 00573 00574 /* bFire=1; 00575 Mangouste.LeftUziFire(PC.Pawn.Location); 00576 Mangouste.RightUziFire(PC.Pawn.Location); 00577 } 00578 */ 00579 DesiredOrientation = PC.Pawn.Location - Pawn.Location; 00580 DesiredPosition = PC.Pawn.Location + CurrentSide*128 * Normal( vect(0,0,1) cross HVector( Mangouste.Location, PC.Pawn.Location ) ); 00581 00582 SimpleSteering( dt, HoleRadius*1.8 ); 00583 00584 Global.Tick( dt ); 00585 } 00586 00587 EVENT EndOfMove() 00588 { 00589 ChooseASide(); 00590 } 00591 00592 EVENT Timer() 00593 { 00594 GotoState('STA_Phase01_A_HideOut'); 00595 } 00596 00597 FUNCTION VaporHurts() 00598 { 00599 GotoState('STA_Phase01_C_VaporTrouble'); 00600 } 00601 /* 00602 EVENT ReceiveWarning(Pawn shooter, float projSpeed, vector FireDir) 00603 { 00604 SetTimer( 0.15, false ); 00605 }*/ 00606 } 00607 00608 STATE STA_Phase01_C_VaporTrouble 00609 { 00610 EVENT BeginState() 00611 { 00612 Global.BeginState(); 00613 // SetWantedSpeed(0.15); 00614 00615 Pawn.velocity = vect(0,0,0); 00616 Pawn.acceleration = vect(0,0,0); 00617 Pawn.GotoState( 'STA_Phase01_VaporPaf' ); 00618 SetTimer( 5.0, false ); 00619 } 00620 00621 EVENT EndState() 00622 { 00623 SetTimer( 0, false ); 00624 } 00625 00626 FUNCTION NotifyTakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) 00627 { 00628 Log( "STA_Phase01_C_VaporTrouble::NotifyTakeDamage() => STA_Phase01_A_HideOut" ); 00629 if ( TimerRate!=0.25 ) 00630 SetTimer( 0.25, false ); 00631 // GotoState('STA_Phase01_A_HideOut'); 00632 } 00633 00634 EVENT Timer() 00635 { 00636 Log( "STA_Phase01_C_VaporTrouble::Timer() => STA_Phase01_A_HideOut" ); 00637 VaporTroubleEndTime = Level.TimeSeconds + 0.5; 00638 GotoState('STA_Phase01_A_HideOut'); 00639 } 00640 } 00641 00642 STATE STA_Phase01_To_Phase02 00643 { 00644 EVENT BeginState() 00645 { 00646 Global.BeginState(); 00647 bAntiFuite=false; 00648 bInvicible=true; 00649 Phase++; 00650 Missiles[0].GoDown( ); 00651 Pawn.GotoState( '' ); 00652 ComputePlayerNearestMissile(); 00653 MangousteWantedMissileIndex = 5-PlayerNearestMissileIndex; 00654 TriggerEvent( 'Jones_Fight', self, Mangouste ); 00655 SetWantedSpeed(1.09); 00656 Mangouste.DM.StartDialogue( 2 ); // Trouve-moi si tu es si malin 00657 SetTimer( 20.0, false ); 00658 // GotoState( 'STA_Phase02_A_HideOut' ); 00659 } 00660 00661 EVENT EndState() 00662 { 00663 bAntiFuite=true; 00664 bInvicible=false; 00665 } 00666 00667 EVENT Timer( ) 00668 { 00669 Mangouste.DM.StartDialogue( 6 ); // Surprise !! 00670 SetTimer2( 1.0, false ); 00671 } 00672 00673 EVENT Timer2( ) 00674 { 00675 GotoState( 'STA_Phase02_D_FastAttack' ); 00676 } 00677 00678 EVENT Tick( float dt ) 00679 { 00680 DesiredPosition = 00681 Missiles[ MangousteWantedMissileIndex ].Location 00682 + 00683 620 00684 * 00685 Normal( 00686 Hvector( 00687 PC.Pawn.Location, 00688 Missiles[ MangousteWantedMissileIndex ].Location 00689 ) 00690 ); 00691 00692 SimpleSteering( dt, 100 ); 00693 00694 Global.Tick( dt ); 00695 } 00696 } 00697 00698 // ======================================================= 00699 // 00700 // dMMMMb dMP dMP .aMMMb .dMMMb dMMMMMP aMMMb 00701 // dMP.dMP dMP.dMP dMP"dMP dMP" VP dMP dP 00702 // dMMMMP" dMMMMK" dMMMMMP VMMMb dMMMP dMMP aMMP 00703 // dMP dMP"AMF dMP dMP dP .dMP dMP dMP 00704 // dMP dMP dMP dMP dMP VMMMP" dMMMMMP dMMMMP 00705 // 00706 //======================================================= 00707 00708 STATE STA_Phase02_A_HideOut 00709 { 00710 EVENT BeginState() 00711 { 00712 Global.BeginState(); 00713 SetWantedSpeed(1.09); 00714 Mangouste.PeripheralVision=0.70; 00715 } 00716 00717 EVENT EndState() 00718 { 00719 bFire=0; 00720 // SetTimer( 0, false ); 00721 } 00722 00723 EVENT Tick(float dt) 00724 { 00725 BurstFirePlayer( 0.3, 0.7, true ); 00726 00727 DesiredOrientation = Pawn.Velocity; 00728 00729 DesiredPosition = Missiles[ MangousteWantedMissileIndex ].Location ; 00730 DesiredPosition = DesiredPosition + 1.08 * HoleRadius * Normal( Hvector( Missiles[0].Location,DesiredPosition ) ); 00731 00732 SimpleSteering( dt, 100 ); 00733 00734 Global.Tick( dt ); 00735 } 00736 00737 EVENT EndOfMove() 00738 { 00739 Global.EndOfMove(); 00740 00741 if ( FRand()>0.25 ) 00742 GotoState( 'STA_Phase02_B_WaitAndSee' ); 00743 else 00744 GotoState( 'STA_Phase02_C_StayHidden' ); 00745 } 00746 00747 FUNCTION VaporHurts() 00748 { 00749 Vapor_PreviousStateName = GetStateName(); 00750 GotoState( 'STA_Phase02_E_Vapor' ); 00751 } 00752 00753 } 00754 00755 FUNCTION Reflex() 00756 { 00757 // if ( FRand()<0.5 ) 00758 // { 00759 Missiles[ MangousteWantedMissileIndex ].bIsUp=false; 00760 Missiles[ 5-MangousteWantedMissileIndex ].bIsUp=false; 00761 ComputePlayerNearestMissile(); 00762 Missiles[ MangousteWantedMissileIndex ].bIsUp=true; 00763 Missiles[ 5-MangousteWantedMissileIndex ].bIsUp=true; 00764 MangousteWantedMissileIndex=5-PlayerNearestMissileIndex; 00765 // } 00766 // else 00767 // MangousteWantedMissileIndex=5-MangousteWantedMissileIndex; 00768 GotoState( 'STA_Phase02_A_HideOut' ); 00769 } 00770 00771 STATE STA_Phase02_B_WaitAndSee 00772 { 00773 EVENT BeginState() 00774 { 00775 Global.BeginState(); 00776 Pawn.velocity = vect(0,0,0); 00777 Pawn.acceleration = vect(0,0,0); 00778 DesiredOrientation = Missiles[ MangousteWantedMissileIndex ].Location - Mangouste.Location; 00779 // Mangouste.LoopAnim( 'Attente' ); 00780 // Mangouste.SFXVapor.CWndDuration[0]=10000; 00781 // Mangouste.SFXVapor.AnimationDuration[0]=10000; 00782 // Mangouste.SFXVapor.Trigger( self, Mangouste ); 00783 Mangouste.PeripheralVision=0.86; 00784 // if (TimerRate==0.0) 00785 SetTimer( 5.0, false ); 00786 } 00787 00788 EVENT EndState() 00789 { 00790 LOCAL Rotator rl; 00791 // Mangouste.KillVignettes( ); 00792 SetTimer( 0.0, false ); 00793 Mangouste.SetBoneRotation('X HEAD',rl,0,0.0); 00794 SetRotation( Mangouste.Rotation ); 00795 } 00796 00797 EVENT Tick( float dt ) 00798 { 00799 LOCAL Rotator rl; 00800 LOCAL int n; 00801 00802 n = 10000 * ( cos( 1.5*Level.TimeSeconds ) - 0.5 ); 00803 00804 rl.Yaw=0; 00805 rl.Pitch=0; 00806 rl.Roll=n+10000; 00807 00808 Mangouste.SetBoneRotation('X HEAD',rl,1,0.75); 00809 00810 rl = Mangouste.Rotation; 00811 rl.Yaw = n; 00812 SetRotation( Mangouste.Rotation+rl ); 00813 // if ( CanSee( PC.Pawn ) /*&& !Mangouste.bReloadingWeapon*/ ) 00814 // { 00815 BurstFirePlayer( 0.2, 0.8 ); 00816 // 00817 // GotoState( 'STA_Phase02_C_Attack' ); 00818 // } 00819 00820 Mangouste.ChangeAnimation(); 00821 00822 Global.Tick( dt ); 00823 } 00824 00825 00826 EVENT HearNoise(float Loudness, Actor NoiseMaker) 00827 { 00828 if ( NoiseMaker.IsA( 'XIIIPlayerPawn' ) || NoiseMaker.Instigator.IsA( 'XIIIPlayerPawn' ) ) 00829 { 00830 // Log( "STA_Phase02_B_WaitAndSee::HearNoise() => STA_Phase02_A_HideOut" ); 00831 Reflex( ); 00832 } 00833 } 00834 00835 EVENT SeePlayer( Pawn Seen ) 00836 { 00837 if ( Seen.IsA( 'XIIIPlayerPawn' ) && vSize(Seen.Location-Mangouste.Location)<512 ) 00838 { 00839 Reflex( ); 00840 } 00841 } 00842 00843 FUNCTION NotifyTakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) 00844 { 00845 Reflex( ); 00846 } 00847 00848 FUNCTION CineWarn( actor Other ); 00849 00850 EVENT Timer() 00851 { 00852 GotoState('STA_Phase02_D_FastAttack'); 00853 } 00854 00855 FUNCTION VaporHurts() 00856 { 00857 Vapor_PreviousStateName = GetStateName(); 00858 GotoState( 'STA_Phase02_E_Vapor' ); 00859 } 00860 } 00861 00862 STATE STA_Phase02_D_FastAttack 00863 { 00864 EVENT BeginState() 00865 { 00866 Global.BeginState(); 00867 SetWantedSpeed(1.00); 00868 Pawn.GotoState( '' ); 00869 ChooseASide(); 00870 } 00871 00872 EVENT EndState() 00873 { 00874 // SetTimer( 0, false ); 00875 bFire=0; 00876 } 00877 00878 EVENT Tick(float dt) 00879 { 00880 BurstFirePlayer( 0.4, 0.6 ); 00881 00882 DesiredOrientation = PC.Pawn.Location - Pawn.Location; 00883 DesiredPosition = PC.Pawn.Location + CurrentSide*128 * Normal( vect(0,0,1) cross HVector( Mangouste.Location, PC.Pawn.Location ) ); 00884 00885 SimpleSteering( dt, 800 ); 00886 00887 Global.Tick( dt ); 00888 } 00889 00890 EVENT EndOfMove() 00891 { 00892 GotoState( 'STA_Phase02_A_HideOut' ); 00893 } 00894 00895 EVENT Timer() 00896 { 00897 GotoState( 'STA_Phase02_A_HideOut' ); 00898 } 00899 00900 FUNCTION VaporHurts() 00901 { 00902 Vapor_PreviousStateName = GetStateName(); 00903 GotoState( 'STA_Phase02_E_Vapor' ); 00904 } 00905 } 00906 00907 STATE STA_Phase02_C_StayHidden 00908 { 00909 EVENT BeginState() 00910 { 00911 Global.BeginState(); 00912 bAntiFuite=false; 00913 SetTimer( 5.0, false ); 00914 } 00915 00916 EVENT EndState() 00917 { 00918 bAntiFuite=true; 00919 } 00920 00921 EVENT Timer( ) 00922 { 00923 Mangouste.DM.StartDialogue( 6 ); // Surprise !! 00924 SetTimer2( 1.0, false ); 00925 } 00926 00927 EVENT Timer2( ) 00928 { 00929 GotoState( 'STA_Phase02_D_FastAttack' ); 00930 } 00931 00932 EVENT Tick( float dt ) 00933 { 00934 DesiredPosition = 00935 Missiles[ MangousteWantedMissileIndex ].Location 00936 + 00937 620 00938 * 00939 Normal( 00940 Hvector( 00941 PC.Pawn.Location, 00942 Missiles[ MangousteWantedMissileIndex ].Location 00943 ) 00944 ); 00945 00946 SimpleSteering( dt, 100 ); 00947 00948 Global.Tick( dt ); 00949 } 00950 00951 FUNCTION NotifyTakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) 00952 { 00953 Reflex( ); 00954 } 00955 } 00956 00957 STATE STA_Phase02_E_Vapor 00958 { 00959 EVENT BeginState() 00960 { 00961 Global.BeginState(); 00962 00963 Pawn.velocity = vect(0,0,0); 00964 Pawn.acceleration = vect(0,0,0); 00965 Pawn.GotoState( 'STA_Phase01_VaporPaf' ); 00966 SetTimer( 3.0, false ); 00967 } 00968 00969 EVENT EndState() 00970 { 00971 SetTimer( 0, false ); 00972 } 00973 00974 FUNCTION NotifyTakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) 00975 { 00976 if ( TimerRate!=0.25 ) 00977 SetTimer( 0.25, false ); 00978 } 00979 00980 EVENT Timer() 00981 { 00982 VaporTroubleEndTime = Level.TimeSeconds + 0.5; 00983 GotoState('STA_Phase02_C_StayHidden'); 00984 } 00985 } 00986 00987 STATE STA_Phase02_To_Phase03 00988 { 00989 EVENT BeginState() 00990 { 00991 bAntiFuite=false; 00992 bInvicible=true; 00993 Phase++; 00994 Global.BeginState(); 00995 00996 Pawn.velocity = vect(0,0,0); 00997 Pawn.acceleration = vect(0,0,0); 00998 Mangouste.DM.StartDialogue( 5 ); // C'est ça qu' l'on appelle un héros 00999 GotoState( 'STA_Phase03_A_StayHidden' ); 01000 01001 Missiles[1].GoDown( 0.0 ); 01002 Missiles[2].GoDown( 1.8 ); 01003 Missiles[3].GoDown( 1.8 * 2); 01004 Missiles[4].GoDown( 1.8 * 3); 01005 } 01006 01007 EVENT EndState() 01008 { 01009 } 01010 } 01011 01012 // ======================================================= 01013 // 01014 // dMMMMb dMP dMP .aMMMb .dMMMb dMMMMMP aMMMb 01015 // dMP.dMP dMP.dMP dMP"dMP dMP" VP dMP dP 01016 // dMMMMP" dMMMMK" dMMMMMP VMMMb dMMMP dMMP aMMb 01017 // dMP dMP"AMF dMP dMP dP .dMP dMP dP 01018 // dMP dMP dMP dMP dMP VMMMP" dMMMMMP dMMMP 01019 // 01020 //======================================================= 01021 01022 STATE STA_Phase03_A_StayHidden 01023 { 01024 EVENT BeginState() 01025 { 01026 Global.BeginState(); 01027 SetTimer( 10.0, false ); 01028 bAntiFuite=false; 01029 } 01030 01031 EVENT EndState() 01032 { 01033 bInvicible=false; 01034 // bAntiFuite=true; 01035 } 01036 01037 EVENT Timer( ) 01038 { 01039 Mangouste.DM.StartDialogue( 3 ); // On va arreter de jouer maintenant 01040 SetTimer2( 1.0, false ); 01041 } 01042 01043 EVENT Timer2( ) 01044 { 01045 GotoState( 'STA_Phase03_B_FreeFight' ); 01046 } 01047 01048 EVENT Tick( float dt ) 01049 { 01050 DesiredPosition = 01051 Missiles[ MangousteWantedMissileIndex ].Location 01052 + 01053 620 01054 * 01055 Normal( 01056 Hvector( 01057 PC.Pawn.Location, 01058 Missiles[ MangousteWantedMissileIndex ].Location 01059 ) 01060 ); 01061 01062 SimpleSteering( dt, 100 ); 01063 01064 Global.Tick( dt ); 01065 } 01066 } 01067 01068 STATE STA_Phase03_B_FreeFight 01069 { 01070 EVENT BeginState() 01071 { 01072 SetWantedSpeed(0.50); 01073 Global.BeginState(); 01074 Mangouste.PeripheralVision=0.70; 01075 } 01076 01077 EVENT EndState() 01078 { 01079 // SetTimer( 0, false ); 01080 bFire=0; 01081 } 01082 01083 EVENT Tick(float dt) 01084 { 01085 LOCAL VECTOR vTemp; 01086 LOCAL FLOAT f; 01087 01088 vTemp = PC.Pawn.Location - Missiles[0].Location; 01089 vTemp.Z = 0; 01090 // Log( vSize( (PC.Pawn.Location - Missiles[0].Location )*vect(1,1,0)) ); 01091 01092 f = FMax( 0, vSize( vTemp )-1750 ); 01093 01094 DesiredPosition = PC.Pawn.Location; 01095 DesiredOrientation = PC.Pawn.Location - Mangouste.Location; 01096 01097 BurstFirePlayer( 0.45, 0.55 ); 01098 01099 SimpleSteering( dt, 800+f ); 01100 01101 Global.Tick( dt ); 01102 } 01103 } 01104 01105 STATE STA_Phase03_To_Fall 01106 { 01107 EVENT BeginState() 01108 { 01109 Global.BeginState(); 01110 Phase++; 01111 Pawn.velocity = vect(0,0,0); 01112 Pawn.acceleration = vect(0,0,0); 01113 01114 PC.GotoState( 'NoControl' ); 01115 Level.bCineFrame=false; 01116 bInvicible=true; 01117 XIIIBaseHud(PC.MyHud).AddBossBar( none ); 01118 Level.AdjustDifficulty = 0; 01119 GotoState( 'STA_Dying' ); 01120 01121 } 01122 } 01123 01124 // ========================================================================== 01125 // 01126 // dMMMMMP .aMMMb dMP dMP dMMMMMP dMMMMb dMP dMP dMP dMMMMb .aMMMMP 01127 // dMP dMP"dMP dMP.dMP dMP dMP VMP dMP.dMP amr dMP dMP dMP" 01128 // dMMMP dMMMMMP dMMMMK" dMMMP dMP dMP VMMMMP dMP dMP dMP dMP MMP" 01129 // dMP dMP dMP dMP"AMF dMP dMP.aMP dA .dMP dMP dMP dMP dMP.dMP 01130 // dMP dMP dMP dMP dMP dMMMMMP dMMMMP" VMMMP" dMP dMP dMP VMMMP" 01131 // 01132 //========================================================================== 01133 01134 STATE STA_Dying 01135 { 01136 EVENT BeginState() 01137 { 01138 Global.BeginState(); 01139 Missiles[0].bIsUp=true; 01140 Missiles[1].bIsUp=true; 01141 Missiles[2].bIsUp=true; 01142 Missiles[3].bIsUp=true; 01143 Missiles[4].bIsUp=true; 01144 ComputeMangousteNearestMissile(); 01145 SetWantedSpeed(0.08); 01146 Focus=MangousteNearestMissile; 01147 if ( Mangouste.DM.bSpeaking ) 01148 { 01149 StopVoice( ); 01150 XIIIBaseHud( PC.MyHud ).HudDlg.RemoveMe(); 01151 Mangouste.DM.EndOfVoice( ); 01152 } 01153 01154 Mangouste.DM.Lines[10].SpeakersToWarnAtTheEndOfThisLine="0"; 01155 Mangouste.DM.StartDialogue( 10 ); // ... 01156 Mangouste.GotoState( 'STA_STAGGERING' ); 01157 bTextFinished=false; 01158 // Mangouste.SetCollision(false, false, false ); 01159 } 01160 01161 EVENT EndState() 01162 { 01163 PC.GotoState( 'PlayerWalking' ); 01164 PC.Pawn.bCanClimbLadders=true; 01165 } 01166 01167 EVENT Tick(float dt) 01168 { 01169 // Focus=none; 01170 // FocalPoint=FocalPoint*0.75+0.25*(Pawn.Location+Normal(Pawn.Velocity)*250); 01171 01172 DesiredOrientation = HVector(Pawn.Location,MangousteNearestMissile.Location); 01173 FocalPoint = MangousteNearestMissile.Location; //Pawn.Location + 256 * NORMAL( DesiredOrientation ); 01174 01175 DesiredPosition = MangousteNearestMissile.Location-500*Normal(DesiredOrientation); 01176 SimpleSteering( dt, 10, true ); 01177 PC.SetRotation( PC.Rotation + RotDiff( ROTATOR( Mangouste.Location - PC.Pawn.Location ), PC.Rotation, 90*182*dt ) ); 01178 } 01179 /* 01180 EVENT Hitwall( vector v, actor a ) 01181 { 01182 GotoState('STA_StartFalling'); 01183 // Hitwall( v,a ), 01184 } 01185 */ 01186 FUNCTION CineWarn( actor Other ) 01187 { 01188 bTextFinished = true; 01189 GotoState( 'STA_Falling' ); 01190 } 01191 01192 FUNCTION EndOfMove() 01193 { 01194 Global.EndOfMove(); 01195 GotoState('STA_StartFalling'); 01196 } 01197 } 01198 01199 STATE STA_StartFalling 01200 { 01201 EVENT BeginState( ) 01202 { 01203 Global.BeginState(); 01204 // SetTimer(3,false); 01205 Pawn.LoopAnim('MortMangousteDebut',,0.1); 01206 // Mangouste.SetCollision(false, false, false ); 01207 Mangouste.SetCollisionSize( 24, Mangouste.CollisionHeight ); 01208 SetWantedSpeed(0.15); 01209 DesiredPosition=Pawn.Location; 01210 } 01211 01212 EVENT Tick( float dt ) 01213 { 01214 if ( vSize( DesiredPosition-Pawn.Location )>5 ) 01215 Pawn.ChangeAnimation(); 01216 else 01217 if ( bTextFinished ) 01218 GotoState( 'STA_Falling' ); 01219 01220 DesiredPosition=Pawn.Location; 01221 Pawn.Velocity=vect(15.0,0,0)>>Pawn.Rotation; 01222 } 01223 01224 FUNCTION CineWarn( actor Other ) 01225 { 01226 bTextFinished = true; 01227 } 01228 } 01229 01230 STATE STA_Falling 01231 { 01232 EVENT BeginState() 01233 { 01234 Global.BeginState(); 01235 TriggerEvent( Pawn.Event, self, Pawn ); 01236 Pawn.PlayAnim('MortMangousteFin',,0.1); 01237 Pawn.SetCollision( false, false, false ); 01238 // Pawn.Acceleration=vect(0,0,-10); 01239 } 01240 01241 EVENT AnimEnd( int Channel ) 01242 { 01243 if ( Channel==0 && Mangouste.SimAnim.AnimSequence=='MortMangousteFin' ) 01244 { 01245 /* LOG ( "ANIMEND" ); 01246 LOG ( "Channel"@Channel ); 01247 LOG ( "Mangouste.SimAnim.AnimSequence"@Mangouste.SimAnim.AnimSequence ); 01248 LOG ( "Mangouste.SimAnim.AnimFrame"@Mangouste.SimAnim.AnimFrame ); 01249 Log( "gna gna");*/ 01250 Mangouste.SetInvisibility( true ); 01251 Mangouste.DM.StartDialogue( 11 ); // ... 01252 // GotoState( '' ); 01253 // GotoState( 'Final' ); 01254 } 01255 } 01256 01257 } 01258 /* 01259 STATE STA_Final 01260 { 01261 EVENT BeginState( ) 01262 { 01263 Enable( 'Tick' ); 01264 } 01265 01266 EVENT Tick(float dt) 01267 { 01268 // if ( !Mangouste.DM.bSpeaking ) 01269 // { 01270 // } 01271 } 01272 } 01273 */ 01274 01275 // ======================================= 01276 // 01277 // dMMMMMMMMb dMP .dMMMb .aMMMb 01278 // dMP"dMP"dMP amr dMP" VP dMP"VMP 01279 // dMP dMP dMP dMP VMMMb dMP 01280 // dMP dMP dMP dMP dP .dMP dMP.aMP amr 01281 // dMP dMP dMP MP VMMMP" VMMMP" dMP 01282 // 01283 //======================================= 01284 01285 01286 01287 01288 defaultproperties 01289 { 01290 AttackSides(0)=-1 01291 AttackSides(1)=-1 01292 AttackSides(2)=1 01293 AttackSides(3)=1 01294 AttackSides(4)=-1 01295 bCineControlAnims=False 01296 }