home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 September / GSSH0904CD2.iso / Doom3 / Mods / Fireballs / fireballs.exe / script / weapon_fists.script
Text File  |  2004-08-05  |  2KB  |  86 lines

  1. /***********************************************************************
  2.  
  3. weapon_fists.script
  4.  
  5. ***********************************************************************/
  6.  
  7. #define FISTS_FIRERATE                    1
  8. #define FISTS_NUMPROJECTILES            1
  9. #define    FISTS_FLAME_WALL_NUM            20
  10. #define    FISTS_FLAME_WALL_SEPERATION        48
  11. #define    FISTS_FLAME_WALL_RANGE            ( FISTS_FLAME_WALL_NUM * FISTS_FLAME_WALL_SEPERATION )
  12.  
  13. // blend times
  14. #define FISTS_IDLE_TO_LOWER                4
  15. #define FISTS_IDLE_TO_PUNCH                0
  16. #define FISTS_RAISE_TO_IDLE                4
  17. #define FISTS_PUNCH_TO_IDLE                1
  18.  
  19. object weapon_fists : weapon_base {
  20.     float        side;
  21.  
  22.     void        init();
  23.     
  24.     void        Lower();
  25.     void        Raise();
  26.     void        Idle();
  27.     void        Fire();
  28.     void        ExitCinematic();
  29.     string        GetFireAnim();
  30. };
  31.  
  32. void weapon_fists::init() {
  33.     weaponState( "Raise", 0 );
  34. }
  35.  
  36. void weapon_fists::Raise() {
  37.     weaponRising();
  38.     playAnim( ANIMCHANNEL_ALL, "raise" );
  39.     waitUntil( animDone( ANIMCHANNEL_ALL, FISTS_RAISE_TO_IDLE ) );
  40.     weaponState( "Idle", FISTS_RAISE_TO_IDLE );
  41. }
  42.  
  43. void weapon_fists::Lower() {
  44.     weaponLowering();
  45.     playAnim( ANIMCHANNEL_ALL, "putaway" );
  46.     waitUntil( animDone( ANIMCHANNEL_ALL, 0 ) );
  47.     weaponHolstered();
  48.     waitUntil( WEAPON_RAISEWEAPON );
  49.     weaponState( "Raise", 0 );
  50. }
  51.  
  52. void weapon_fists::Idle() {
  53.     weaponReady();
  54.     playCycle( ANIMCHANNEL_ALL, "idle" );
  55.     while( 1 ) {
  56.         if ( WEAPON_LOWERWEAPON ) {
  57.             weaponState( "Lower", FISTS_IDLE_TO_LOWER );
  58.         }
  59.         if ( WEAPON_ATTACK ) {
  60.             weaponState( "Fire", FISTS_IDLE_TO_PUNCH );
  61.         }
  62.         waitFrame();
  63.     }
  64. }
  65.  
  66. void weapon_fists::Fire() {
  67.     playAnim( ANIMCHANNEL_ALL, GetFireAnim() );
  68.     sys.wait( 0.1 );
  69.     launchProjectiles( FISTS_NUMPROJECTILES, 0, 0, 1.0, 1.0 );
  70.     waitUntil( animDone( ANIMCHANNEL_ALL, FISTS_PUNCH_TO_IDLE ) );
  71.     side = !side;
  72.     weaponState( "Idle", FISTS_PUNCH_TO_IDLE );
  73. }
  74.  
  75. void weapon_fists::ExitCinematic() {
  76.     weaponState( "Idle", 0 );
  77. }
  78.  
  79. string weapon_fists::GetFireAnim() {
  80.     if ( side ) {
  81.         return "punch_left";
  82.     } else {
  83.         return "punch_right";
  84.     }
  85. }
  86.