home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 April / Gamestar_83_2006-04_dvd.iso / Dema / demowot_english.exe / Script / Source / visualeffects.inc < prev   
Text File  |  2005-03-11  |  5KB  |  171 lines

  1. // Call this .inc only if you really use it, 
  2. // since it loads everything into the memory!
  3.  
  4. // You can call this with the following command:
  5. // BulletTime(TheUnit'sDrID), if no Unit is specified it will do at the camera's current location.
  6.  
  7. // ADDITIONAL PARAMETERS:
  8. // BulletTime(TargetDrID, UI_STATE(optional!), PAUSE(optional!), LEAVE_THERE(optional!), BT_DISTANCE(optional!))
  9. // UI_STATE - turn off the User Interface during the effect -> default true
  10. // PAUSE - 'Pause' the game during the effect -> default false
  11. // LEAVE_THERE - If the Camera should stay at the end of BT
  12. // BT_Distance - The Distance BT should use
  13.  
  14. // IMPORTANT: NEVER EVER ADD THE LAST BOOLEAN AT BULLETTIME CALL!!!
  15. //--------------------MATRIX POWWA!--------------------START
  16. stock BulletTime(DrID:OurTarget=DrID:0, bool:BT_UIState=true, bool:BT_Pause=false, bool:BT_LeaveThere=false, Float:BT_Distance=15.0, Float:BT_FBSize=0.0, bool:BulletTimeController=true)
  17. {
  18.     static Float:CamActPos[vec3];
  19.     static Float:CamActRot;
  20.     static Float:CamActDist;
  21.     static Float:CamActPitch;
  22.     static Float:ActGameSpeed;
  23.      static bool:BT_UIStatus;
  24.     static bool:BT_Pauz;
  25.     static bool:BT_Lock=false;
  26.     static bool:BT_LeaveAlone;
  27.     //    imre
  28. //    static DrID:BT_DasFowBaca;
  29.     static BT_DasFowBacaStringID[100] = {0, ...};
  30.     new DrID:BT_DasFowBaca;
  31.     BT_DasFowBaca = GetEntity(BT_DasFowBacaStringID);
  32.     //    \imre
  33.     DebugMessage( "BulletTime called", DL_MESSAGE )
  34.     if (BulletTimeController)
  35.         {
  36.             if(BT_Lock)
  37.             {
  38.                 DebugMessage( "Attention!!! BulletTime called while an other BulletTime was already running!!!!", DL_WARNING );
  39.                 return;
  40.             }
  41.                 
  42.             BT_Lock=true;
  43.             DebugMessage( "BulletTime init", DL_MESSAGE )
  44.               ActGameSpeed=GetGameSpeed();
  45.             if (BT_UIStatus)
  46.             {
  47.                 SetCutScene(true);
  48.                  }
  49.              SetGameSpeed(0.05);
  50.              GetCameraActualPos(CamActPos);
  51.             CamActRot = GetCameraActualRotate();
  52.             CamActDist = GetCameraActualDistance();
  53.               CamActPitch = GetCameraActualPitch();
  54.             TeleportCameraToEnt(OurTarget);
  55.             CameraFollow(OurTarget);
  56.             SetCameraTargetPitch( 55.0 );
  57.             SetCameraTargetDistance( BT_Distance );
  58.                BT_UIStatus = BT_UIState;
  59.                BT_Pauz = BT_Pause;
  60.                BT_LeaveAlone = BT_LeaveThere;
  61.             if(BT_Pauz)
  62.                 AddTimerEvent( "ActBulletTime", 0.1, "AnimLogic" );
  63.             else
  64.                 AddTimerEvent( "WeNeededPause", 0.5, "AnimLogic" );
  65.                 
  66.             if(BT_FBSize!=0.0)
  67.             {
  68.                 DebugMessage( "BulletTime: FOW Bacon requested! Creating ...", DL_MESSAGE )
  69.                 new Float:BT_TempPos[vec3];
  70.                 GetPropertyVec3( OurTarget, "LogicalPos_", BT_TempPos );
  71.                 BT_DasFowBaca=CreateEntity( "fowbacon_20", BT_TempPos );
  72.                 GetPropertyString(BT_DasFowBaca, "StringID", 100, BT_DasFowBacaStringID);
  73.                 SetPropertyInt( BT_DasFowBaca, "Team", gPlayerTeam );
  74.                 SetPropertyFloat( BT_DasFowBaca, "FOWRangeRadius", (BT_FBSize+5.5) );
  75.                 SetPropertyFloat( BT_DasFowBaca, "FOWRangeInnerRadius", BT_FBSize );
  76.                 RefreshFOW();
  77.                 RefreshFOW();
  78.             }
  79.             else
  80.             {
  81.                 BT_DasFowBaca=DrID:0;
  82.                 BT_DasFowBacaStringID = "";
  83.             }
  84.         }
  85.     else
  86.         {
  87.             if(BT_Pauz)
  88.             {
  89.                 BT_Lock=false;
  90.                  CameraFollow( DrID:0 );
  91.                 ResetCameraSpeed();    
  92. //                 if(ActGameSpeed<0.125)
  93. //                 {
  94. //                     ActGameSpeed=0.125;
  95. //                     DebugMessage( "ActGameSpeed resetted",DL_MESSAGE );
  96. //                 }
  97.                 SetGameSpeed(ActGameSpeed);
  98.                 if (BT_UIStatus)
  99.                 {
  100.                     SetCutScene(false);
  101.                 }
  102.                 if(!BT_LeaveAlone)
  103.                 {
  104.                      SetCameraTargetPos(CamActPos);
  105.                      SetCameraTargetRotate(CamActRot);
  106.                     SetCameraTargetDistance(CamActDist);
  107.                     SetCameraTargetPitch(CamActPitch);
  108.                 }
  109.                 if(BT_DasFowBaca!=DrID:0)
  110.                 {
  111.                     SetPropertyInt( BT_DasFowBaca, "Team", 0 );
  112.                     DestructEntity( BT_DasFowBaca );
  113.                     BT_DasFowBaca=DrID:0;
  114.                 }
  115.                 CallUserEvent(UE_BULLETTIME_END);        
  116.             }
  117.             else
  118.             {
  119.                 SetGameSpeed(0.5)
  120.                 AddTimerEvent( "CloseBulletTime", 1.5, "AnimLogic", bool:true);
  121.                 BT_Pauz = true;
  122.             }
  123.         }
  124. }
  125.  
  126. public WeNeededPause()
  127. {
  128.       SetGameSpeed(0.2);
  129.     AddTimerEvent( "WeNeededAnother", 1.5, "AnimLogic" );
  130.     RemoveEvent( "WeNeededPause" );
  131. }
  132.  
  133. public WeNeededAnother()
  134. {
  135.     SetGameSpeed( 0.1 );
  136.     AddTimerEvent( "ActBulletTime", 0.1, "AnimLogic" );
  137.     RemoveEvent( "WeNeededAnother" );
  138. }
  139.  
  140. public ActBulletTime()
  141. {
  142.     static BulletTimer = 0;
  143.     static Float:lTmpActRot;
  144.     switch(BulletTimer)
  145.     {
  146.         case 0: //init
  147.         {
  148.             SetCameraRotSpeed(55.0);
  149.             lTmpActRot=    GetCameraActualRotate();
  150.         }
  151.         case 41: //end
  152.         {
  153.             RemoveEvent( "ActBulletTime" );
  154.             BulletTimer = -1;
  155.             BulletTime(DrID:0,true,true,true,15.0,0.0,false);            
  156.         }
  157.         default:
  158.         {
  159.             SetCameraTargetRotate( lTmpActRot+(9*BulletTimer));
  160.         }
  161.     }
  162.     BulletTimer++;
  163. }
  164.  
  165. public CloseBulletTime()
  166. {
  167.     BulletTime(DrID:0,true,true,true,15.0,0.0,false);            
  168.     RemoveEvent( "CloseBulletTime" );
  169. }
  170. //--------------------MATRIX POWWA!--------------------END
  171.