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

  1. //-------
  2. // Stand
  3. //-------
  4. // Makes the character stand up, stop walking or running, stop shooting, just stand
  5. // there.  If the character is already standing, then this script plays standing
  6. // animations.
  7.  
  8. //println "Entering stand.scr"
  9. //println "Called Stand.scr with mood " self.mood\
  10.  
  11. waitexec anim/default_inithandler.scr
  12.  
  13. start:
  14.  
  15. self.blendtime = 0.5
  16.  
  17. switch (self.position)
  18. {
  19.     prone:
  20.     pronewalk:
  21.         // Get up to crouch first and then try this again
  22.         waitexec anim/crouch.scr::transition
  23.         //fall through
  24.     stand:
  25.     walk:
  26.     run:
  27.     crouch:
  28.     crouchwalk:
  29.     crouchrun:
  30.         self.position = stand
  31.         switch (self.weapongroup)
  32.         {
  33.             pistol:
  34.             rifle:
  35.             mp40:
  36.             mp44:
  37.             bar:
  38.             thompson:
  39.             bazooka:
  40.                 //println "Stand/Hold Rifle"
  41.                 if (self.ground == water)
  42.                 {
  43.                     self setmotionanim stand_water_idle
  44.                     self waittill flaggedanimdone
  45.                 }
  46.                 else if (self.ground == beach)
  47.                 {
  48.                     self setmotionanim stand_beach_idle
  49.                     self waittill flaggedanimdone
  50.                 }
  51.                 else
  52.                 {
  53.                     waitthread IdleStand
  54.                 }
  55.                 break
  56.  
  57.             grenade:
  58.                 //println "Stand/Hold Grenade"
  59.                 // This should never happen, so just manage as best you can.
  60.                 self setmotionanim pistol_stand_nervous_a
  61.                 self waittill flaggedanimdone
  62.                 break
  63.  
  64.             unarmed:
  65.                 if (self.isScientist==1)
  66.                 {
  67.                     waitthread IdleScientist
  68.                 }
  69.                 else
  70.                 {
  71.                     waitthread IdleStand
  72.                 }
  73.  
  74.                 break
  75.  
  76.             default:
  77.                 println ("^~^~^ Stand Idle/Default case for "+self.weapongroup+" weapon group - fix idle.scr")
  78.                 self setmotionanim generic_stand_bored_a
  79.                 self waittill flaggedanimdone
  80.                 break
  81.         }
  82.         self.position = stand
  83.         break
  84.  
  85.     dead:
  86.         // What do I do if he's dead?  Have to call setanim or it'll break!
  87.         println "^~^~^ Warning: stand.scr called on dead guy!"
  88.         break
  89.  
  90.     // Pain positions
  91.     // This is actually the main pain handling script.  People in pain will go through
  92.     // this script in an attempt to stand back up, and should, in the process, do lots
  93.     // of cool, agonized-looking stuff.  There is also a section in crouch.scr to handle
  94.     // going from knees to the crouch pose.
  95.     knees:
  96.     floor:
  97.     crawl:
  98.         waitexec anim/continue_pain.scr
  99.         goto start
  100.  
  101.     default:
  102.         // I meant to catch all cases, so print a warning
  103.         println "^~^~^ Stand.scr called while in unexpected position (" self.position ") fix stand.scr"
  104.         break
  105.  
  106. }    // End switch (position)
  107. end
  108.  
  109. //======================================================================
  110. //======================================================================
  111.  
  112. // allowed terminate immediately
  113. transition:
  114. self.blendtime = 0.5
  115.  
  116. switch (self.position)
  117. {
  118.     stand:
  119.     walk:
  120.     run:
  121.     crouch:
  122.     crouchwalk:
  123.     crouchrun:
  124.         self.position = stand
  125.         break // can crossblend directly from these
  126.  
  127.     prone:
  128.     pronewalk:
  129.         // Get up to crouch first
  130.         waitexec anim/crouch.scr::transition
  131.         self.position = stand
  132.         break // can crossblend directly now
  133.  
  134.     dead:
  135.         // What do I do if he's dead?  Have to call setanim or it'll break!
  136.         println "^~^~^ Warning: stand.scr called on dead guy!"
  137.         break
  138.  
  139.     // Pain positions
  140.     knees:
  141.     floor:
  142.     crawl:
  143.         waitexec anim/continue_pain.scr
  144.         goto transition
  145.  
  146.     default:
  147.         // I meant to catch all cases, so print a warning
  148.         println "^~^~^ Stand.scr called while in unexpected position (" self.position ") fix stand.scr"
  149.         break
  150.  
  151. }    // End switch (position)
  152. end
  153.  
  154. //======================================================================
  155. //======================================================================
  156.  
  157. IdleStandTransition:
  158. switch (self.mood)
  159. {
  160.     case bored:
  161.     case curious:
  162.         if (self.weapongroup == bazooka)
  163.         {
  164.             self.blendtime = 0.5
  165.             self setmotionanim (bazooka_stand_alert_legs)
  166.             self setupperanim (self.weapongroup + "_stand_alert")
  167.         }
  168.         else
  169.         {
  170.             self.blendtime = 0.5
  171.             self setmotionanim (self.weapongroup + "_stand_curious")
  172.         }
  173.         break
  174.     case alert:
  175.         self.blendtime = 0.5
  176.         self setmotionanim (self.weapongroup + "_stand_alert_legs")
  177.         self setupperanim (self.weapongroup + "_stand_alert")
  178.         wait 0.5
  179.         break
  180.     case nervous:
  181.         self.blendtime = 0.5
  182.         local.randnum = randomint 100
  183.         if (local.randnum < 33)
  184.         {
  185.             self setmotionanim (self.weapongroup + "_stand_nervous_a")
  186.         }
  187.         else if (local.randnum < 66)
  188.         {
  189.             self setmotionanim (self.weapongroup + "_stand_nervous_b")
  190.         }
  191.         else
  192.         {
  193.             self setmotionanim (self.weapongroup + "_stand_nervous_c")
  194.         }
  195.         wait 0.5
  196.         break
  197.  
  198.         waitthread IdleStandBoredTransition
  199.         break
  200.     default:
  201.         println "^~^~^ IdleStand default case for mood " self.mood
  202.         waitthread IdleStandBoredTransition
  203.         break
  204. }
  205. end
  206.  
  207. //======================================================================
  208. //======================================================================
  209.  
  210. IdleStand:
  211. switch (self.mood)
  212. {
  213.     case curious:
  214.         if (self.weapongroup == bazooka)
  215.         {
  216.             self.blendtime = 0.5
  217.             self setmotionanim (bazooka_stand_alert_legs)
  218.             self setupperanim (self.weapongroup + "_stand_alert")
  219.             self waittill upperanimdone
  220.         }
  221.         else
  222.         {
  223.             self.blendtime = 0.5
  224.             self setmotionanim (self.weapongroup + "_stand_curious")
  225.             self waittill flaggedanimdone
  226.         }
  227.         break
  228.     case alert:
  229.         self.blendtime = 0.5
  230.         self setmotionanim (self.weapongroup + "_stand_alert_legs")
  231.         self setupperanim (self.weapongroup + "_stand_alert")
  232.         self waittill upperanimdone
  233.         break
  234.     case nervous:
  235.         self.blendtime = 0.5
  236.         local.randnum = randomint 100
  237.         if (local.randnum < 33)
  238.         {
  239.             self setmotionanim (self.weapongroup + "_stand_nervous_a")
  240.         }
  241.         else if (local.randnum < 66)
  242.         {
  243.             self setmotionanim (self.weapongroup + "_stand_nervous_b")
  244.         }
  245.         else
  246.         {
  247.             self setmotionanim (self.weapongroup + "_stand_nervous_c")
  248.         }
  249.         self waittill flaggedanimdone
  250.         break
  251.     case bored:
  252.         waitthread IdleStandBored
  253.         break
  254.     default:
  255.         println "^~^~^ IdleStand default case for mood " self.mood
  256.         waitthread IdleStandBored
  257.         break
  258. }
  259. end
  260.  
  261. //======================================================================
  262. //======================================================================
  263.  
  264. IdleStandBored:
  265. waitexec anim/smoking.scr::SmokeCigaretteInit
  266.  
  267. local.randnum = randomint 100
  268.  
  269. // 2 cycles before smokin out
  270. local.loop = 2
  271. while(local.loop>0)
  272. {
  273.     if (local.randnum < 33)
  274.     {
  275.         self.blendtime = 0.5
  276.         self setmotionanim (self.weapongroup + "_stand_bored_a_intro")
  277.         self waittill flaggedanimdone
  278.  
  279.         local.i = randomint(2) + 3
  280.         while (local.i > 0)
  281.         {
  282.             self.blendtime = 0.5
  283.             self setmotionanim (self.weapongroup + "_stand_bored_a")
  284.             self waittill flaggedanimdone
  285.             local.i = local.i - 1
  286.         }
  287.  
  288.         self.blendtime = 0.5
  289.         self setmotionanim (self.weapongroup + "_stand_bored_a_outtro")
  290.         self waittill flaggedanimdone
  291.     }
  292.     else if (local.randnum < 66)
  293.     {
  294.         self.blendtime = 0.5
  295.         self setmotionanim (self.weapongroup + "_stand_bored_b_intro")
  296.         self waittill flaggedanimdone
  297.  
  298.         local.i = randomint(2) + 3
  299.         while (local.i > 0)
  300.         {
  301.             self.blendtime = 0.5
  302.             self setmotionanim (self.weapongroup + "_stand_bored_b")
  303.             self waittill flaggedanimdone
  304.             local.i = local.i - 1
  305.         }
  306.  
  307.         self.blendtime = 0.5
  308.         self setmotionanim (self.weapongroup + "_stand_bored_b_outtro")
  309.         self waittill flaggedanimdone
  310.     }
  311.     else
  312.     {
  313.         waitthread IdleStandBoredGeneric
  314.     }
  315.  
  316.     local.loop--
  317. }
  318.  
  319. waitexec anim/smoking.scr::SmokeCigarette
  320.  
  321. end
  322.  
  323. //======================================================================
  324. //======================================================================
  325. IdleStandBoredGeneric:
  326. local.i = randomint(2) + 2
  327. local.randnum = randomint 100
  328.  
  329. if (local.randnum < 50)
  330. {
  331.     while (local.i > 0)
  332.     {
  333.         self.blendtime = 0.5
  334.         self setmotionanim (generic_stand_bored_a)
  335.         self waittill flaggedanimdone
  336.         local.i = local.i - 1
  337.     }
  338. }
  339. else
  340. {
  341.     while (local.i > 0)
  342.     {
  343.         self.blendtime = 0.5
  344.         self setmotionanim (generic_stand_bored_b)
  345.         self waittill flaggedanimdone
  346.         local.i = local.i - 1
  347.     }
  348. }
  349. end
  350.  
  351.  
  352. //======================================================================
  353. //======================================================================
  354. IdleScientist:
  355.  
  356. local.rand1 = randomint 100
  357. local.rand2 = randomint 100
  358.  
  359. if (self.atChalkBoard != 1) local.rand1=99            // 25% chance of chalkboard idle, contingent upon being at the chalkboard
  360.  
  361. if (local.rand1 < 25)
  362. {
  363.     self setmotionanim scientist_chalkboard_start
  364.     self waittill flaggedanimdone
  365.  
  366.     local.randnum = (randomint 3) + 2
  367.     while(local.randnum > -1)
  368.     {
  369.         self setmotionanim scientist_chalkboard
  370.         self waittill flaggedanimdone
  371.         local.randnum--
  372.     }
  373.  
  374.     self setmotionanim scientist_chalkboard_end
  375.     self waittill flaggedanimdone
  376. }
  377. else if (local.rand2 < 33)
  378. {
  379.     self setmotionanim scientist_clipboard_start
  380.     self waittill flaggedanimdone
  381.  
  382.     local.randnum = (randomint 3) + 2
  383.     while(local.randnum > -1)
  384.     {
  385.         self setmotionanim scientist_clipboard
  386.         self waittill flaggedanimdone
  387.         local.randnum--
  388.     }
  389.  
  390.     self setmotionanim scientist_clipboard_end
  391.     self waittill flaggedanimdone
  392.  
  393. }
  394. else if (local.rand2 < 66)
  395. {
  396.     self setmotionanim scientist_scratch
  397.     self waittill flaggedanimdone
  398. }
  399. else
  400. {
  401.     self setmotionanim scientist_thought_start
  402.     self waittill flaggedanimdone
  403.  
  404.     local.randnum = (randomint 3) + 1
  405.     while(local.randnum > -1)
  406.     {
  407.         self setmotionanim scientist_thought
  408.         self waittill flaggedanimdone
  409.     }
  410.  
  411.     // 50% scratch
  412.     local.randnum = randomint 100
  413.     if (local.randnum < 50)
  414.     {
  415.         self setmotionanim scientist_scratch
  416.         self waittill flaggedanimdone
  417.     }
  418.  
  419.     self setmotionanim scientist_thought_end
  420.     self waittill flaggedanimdone
  421. }
  422.  
  423. end