home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / grenadekick.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  2.0 KB  |  77 lines

  1. //============
  2. //grenadekick.scr
  3. //============
  4.  
  5. //===============================
  6. //===============================
  7. GrenadeKickMain:
  8.     //println "Entering grenadekick.scr"
  9.  
  10.     waitexec "anim/default_inithandler.scr"
  11.     waitexec anim/smoking.scr::SmokeRemoveCigarette
  12.     
  13.     //make sure we are standing...
  14.     waitexec anim/stand.scr::transition
  15.     
  16.     //self setmotionanim grenade_kick
  17.     //self waittill flaggedanimdone
  18.  
  19.     if (self.kickdir != (0 0 0))
  20.     {
  21.         local.dotvec = self.forwardvector * self.kickdir
  22.         local.sidevec = self.leftvector * self.kickdir
  23.         // (Boon) Divide by forward+side since it's the "correct" thing to do.  Might not make any noticeable improvement though.
  24.         local.forwardbackblend = abs(local.dotvec) / ( abs(local.dotvec) + abs(local.sidevec) )
  25.         local.sideblend = 1.0 - local.forwardbackblend
  26.  
  27.         //sanity checks
  28.         if (local.sideblend < 0.00)
  29.         {
  30.             println "GrenadeKick: sideblend is less than 0, how did that happen!?"
  31.             println "self.movedir " self.movedir
  32.             println "self.forward " self.forwardvector
  33.             local.sideblend = 0.00
  34.             local.forwardbackblend = 1.00
  35.         }
  36.  
  37.         if (local.sideblend > 1.0)
  38.         {
  39.             println "GrenadeKick: sideblend is more than 1, how did that happen!?"
  40.             local.sideblend = 1.0
  41.             local.forwardbackblend = 0.005
  42.         }
  43.  
  44.         if (local.forwardbackblend <= 0.0)
  45.         {
  46.             println "GrenadeKick: forwardbackblend is less than 0, how did that happen!?"
  47.             local.forwardbackblend = 0.005
  48.         }
  49.  
  50.         //println "Forward: " local.forwardbackblend " Side: " local.sideblend
  51.  
  52.         self.blendtime = 0.20
  53.  
  54.         self setanim grenade_kick 0 local.forwardbackblend flagged
  55.  
  56.         if (local.sidevec >= 0.00)
  57.         {
  58.             //move left
  59.             self setanim grenade_kick_left 1 local.sideblend
  60.         }
  61.         else
  62.         {
  63.             //move right
  64.             self setanim grenade_kick_right 1 local.sideblend
  65.         }
  66.         
  67.         self waittill flaggedanimdone
  68.     }
  69.     else
  70.     {
  71.         //println "~^~^ Kicking grenade with kick dir of " self.kickdir
  72.         self setmotionanim grenade_kick
  73.         self waittill flaggedanimdone
  74.     }
  75.  
  76. end
  77.