home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / axe_of_c / ai.qc next >
Encoding:
Text File  |  1996-07-31  |  17.0 KB  |  851 lines

  1. void() movetarget_f;
  2. void() t_movetarget;
  3. void() knight_walk1;
  4. void() knight_bow6;
  5. void() knight_bow1;
  6. void(entity etemp, entity stemp, entity stemp, float dmg) T_Damage;
  7. /*
  8.  
  9. .enemy
  10. Will be world if not currently angry at anyone.
  11.  
  12. .movetarget
  13. The next path spot to walk toward.  If .enemy, ignore .movetarget.
  14. When an enemy is killed, the monster will try to return to it's path.
  15.  
  16. .huntt_ime
  17. Set to time + something when the player is in sight, but movement straight for
  18. him is blocked.  This causes the monster to use wall following code for
  19. movement direction instead of sighting on the player.
  20.  
  21. .ideal_yaw
  22. A yaw angle of the intended direction, which will be turned towards at up
  23. to 45 deg / state.  If the enemy is in view and hunt_time is not active,
  24. this will be the exact line towards the enemy.
  25.  
  26. .pausetime
  27. A monster will leave it's stand state and head towards it's .movetarget when
  28. time > .pausetime.
  29.  
  30. walkmove(angle, speed) primitive is all or nothing
  31. */
  32.  
  33.  
  34. //
  35. // globals
  36. //
  37. float    current_yaw;
  38.  
  39. //
  40. // when a monster becomes angry at a player, that monster will be used
  41. // as the sight target the next frame so that monsters near that one
  42. // will wake up even if they wouldn't have noticed the player
  43. //
  44. entity    sight_entity;
  45. float    sight_entity_time;
  46.  
  47. float(float v) anglemod =
  48. {
  49.     while (v >= 360)
  50.         v = v - 360;
  51.     while (v < 0)
  52.         v = v + 360;
  53.     return v;
  54. };
  55.  
  56. /*
  57. ==============================================================================
  58.  
  59. MOVETARGET CODE
  60.  
  61. The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
  62.  
  63. targetname
  64. must be present.  The name of this movetarget.
  65.  
  66. target
  67. the next spot to move to.  If not present, stop here for good.
  68.  
  69. pausetime
  70. The number of seconds to spend standing or bowing for path_stand or path_bow
  71.  
  72. ==============================================================================
  73. */
  74.  
  75.  
  76. void() movetarget_f =
  77. {
  78.     if (!self.targetname)
  79.         objerror ("monster_movetarget: no targetname");
  80.         
  81.     self.solid = SOLID_TRIGGER;
  82.     self.touch = t_movetarget;
  83.     setsize (self, '-8 -8 -8', '8 8 8');
  84.     
  85. };
  86.  
  87. /*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
  88. Monsters will continue walking towards the next target corner.
  89. */
  90. void() path_corner =
  91. {
  92.     movetarget_f ();
  93. };
  94.  
  95.  
  96. /*
  97. =============
  98. t_movetarget
  99.  
  100. Something has bumped into a movetarget.  If it is a monster
  101. moving towards it, change the next destination and continue.
  102. ==============
  103. */
  104. void() t_movetarget =
  105. {
  106. local entity    temp;
  107.  
  108.     if (other.movetarget != self)
  109.         return;
  110.     
  111.     if (other.enemy)
  112.         return;        // fighting, not following a path
  113.  
  114.     temp = self;
  115.     self = other;
  116.     other = temp;
  117.  
  118.     if (self.classname == "monster_ogre")
  119.         sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
  120.  
  121. //dprint ("t_movetarget\n");
  122.     self.goalentity = self.movetarget = find (world, targetname, other.target);
  123.     self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
  124.     if (!self.movetarget)
  125.     {
  126.         self.pausetime = time + 999999;
  127.         self.th_stand ();
  128.         return;
  129.     }
  130. };
  131.  
  132.  
  133.  
  134. //============================================================================
  135.  
  136. /*
  137. =============
  138. range
  139.  
  140. returns the range catagorization of an entity reletive to self
  141. 0    melee range, will become hostile even if back is turned
  142. 1    visibility and infront, or visibility and show hostile
  143. 2    infront and show hostile
  144. 3    only triggered by damage
  145. =============
  146. */
  147. float(entity targ) range =
  148. {
  149. local vector    spot1, spot2;
  150. local float        r;    
  151.     spot1 = self.origin + self.view_ofs;
  152.     spot2 = targ.origin + targ.view_ofs;
  153.     
  154.     r = vlen (spot1 - spot2);
  155.     if (r < 120)
  156.         return RANGE_MELEE;
  157.     if (r < 500)
  158.         return RANGE_NEAR;
  159.     if (r < 1000)
  160.         return RANGE_MID;
  161.     return RANGE_FAR;
  162. };
  163.  
  164. /*
  165. =============
  166. visible
  167.  
  168. returns 1 if the entity is visible to self, even if not infront ()
  169. =============
  170. */
  171. float (entity targ) visible =
  172. {
  173.     local vector    spot1, spot2;
  174.     
  175.     spot1 = self.origin + self.view_ofs;
  176.     spot2 = targ.origin + targ.view_ofs;
  177.     traceline (spot1, spot2, TRUE, self);    // see through other monsters
  178.     
  179.     if (trace_inopen && trace_inwater)
  180.         return FALSE;            // sight line crossed contents
  181.  
  182.     if (trace_fraction == 1)
  183.         return TRUE;
  184.     return FALSE;
  185. };
  186.  
  187.  
  188. /*
  189. =============
  190. infront
  191.  
  192. returns 1 if the entity is in front (in sight) of self
  193. =============
  194. */
  195. float(entity targ) infront =
  196. {
  197.     local vector    vec;
  198.     local float        dot;
  199.     
  200.     makevectors (self.angles);
  201.     vec = normalize (targ.origin - self.origin);
  202.     dot = vec * v_forward;
  203.     
  204.     if ( dot > 0.3)
  205.     {
  206.         return TRUE;
  207.     }
  208.     return FALSE;
  209. };
  210.  
  211.  
  212. //============================================================================
  213.  
  214. /*
  215. ===========
  216. ChangeYaw
  217.  
  218. Turns towards self.ideal_yaw at self.yaw_speed
  219. Sets the global variable current_yaw
  220. Called every 0.1 sec by monsters
  221. ============
  222. */
  223. /*
  224.  
  225. void() ChangeYaw =
  226. {
  227.     local float        ideal, move;
  228.  
  229. //current_yaw = self.ideal_yaw;
  230. // mod down the current angle
  231.     current_yaw = anglemod( self.angles_y );
  232.     ideal = self.ideal_yaw;
  233.     
  234.     if (current_yaw == ideal)
  235.         return;
  236.     
  237.     move = ideal - current_yaw;
  238.     if (ideal > current_yaw)
  239.     {
  240.         if (move > 180)
  241.             move = move - 360;
  242.     }
  243.     else
  244.     {
  245.         if (move < -180)
  246.             move = move + 360;
  247.     }
  248.         
  249.     if (move > 0)
  250.     {
  251.         if (move > self.yaw_speed)
  252.             move = self.yaw_speed;
  253.     }
  254.     else
  255.     {
  256.         if (move < 0-self.yaw_speed )
  257.             move = 0-self.yaw_speed;
  258.     }
  259.  
  260.     current_yaw = anglemod (current_yaw + move);
  261.  
  262.     self.angles_y = current_yaw;
  263. };
  264.  
  265. */
  266.  
  267.  
  268. //============================================================================
  269.  
  270. void() HuntTarget =
  271. {
  272.     self.goalentity = self.enemy;
  273.     self.think = self.th_run;
  274.     self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
  275.     self.nextthink = time + 0.1;
  276.     SUB_AttackFinished (1);    // wait a while before first attack
  277. };
  278.  
  279. void() SightSound =
  280. {
  281. local float    rsnd;
  282.  
  283.     if (self.classname == "monster_ogre")    
  284.         sound (self, CHAN_VOICE, "ogre/ogwake.wav", 1, ATTN_NORM);
  285.     else if (self.classname == "monster_knight")
  286.         sound (self, CHAN_VOICE, "knight/ksight.wav", 1, ATTN_NORM);
  287.     else if (self.classname == "monster_shambler")
  288.         sound (self, CHAN_VOICE, "shambler/ssight.wav", 1, ATTN_NORM);
  289.     else if (self.classname == "monster_demon1")
  290.         sound (self, CHAN_VOICE, "demon/sight2.wav", 1, ATTN_NORM);
  291.     else if (self.classname == "monster_wizard")
  292.         sound (self, CHAN_VOICE, "wizard/wsight.wav", 1, ATTN_NORM);
  293.     else if (self.classname == "monster_zombie")
  294.         sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_NORM);
  295.     else if (self.classname == "monster_dog")
  296.         sound (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
  297.     else if (self.classname == "monster_hell_knight")
  298.         sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
  299.     else if (self.classname == "monster_tarbaby")
  300.         sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
  301.     else if (self.classname == "monster_vomit")
  302.         sound (self, CHAN_VOICE, "vomitus/v_sight1.wav", 1, ATTN_NORM);
  303.     else if (self.classname == "monster_enforcer")
  304.     {
  305.         rsnd = rint(random() * 3);            
  306.         if (rsnd == 1)
  307.             sound (self, CHAN_VOICE, "enforcer/sight1.wav", 1, ATTN_NORM);
  308.         else if (rsnd == 2)
  309.             sound (self, CHAN_VOICE, "enforcer/sight2.wav", 1, ATTN_NORM);
  310.         else if (rsnd == 0)
  311.             sound (self, CHAN_VOICE, "enforcer/sight3.wav", 1, ATTN_NORM);
  312.         else
  313.             sound (self, CHAN_VOICE, "enforcer/sight4.wav", 1, ATTN_NORM);
  314.     }
  315.     else if (self.classname == "monster_army")
  316.         sound (self, CHAN_VOICE, "soldier/sight1.wav", 1, ATTN_NORM);
  317.     else if (self.classname == "monster_shalrath")
  318.         sound (self, CHAN_VOICE, "shalrath/sight.wav", 1, ATTN_NORM);
  319. };
  320.  
  321. void() FoundTarget =
  322. {
  323.     if (self.enemy.classname == "player")
  324.     {    // let other monsters see this monster for a while
  325.         sight_entity = self;
  326.         sight_entity_time = time;
  327.     }
  328.  
  329.     self.show_hostile = time + 1;        // wake up other monsters
  330.  
  331.     SightSound ();
  332.     HuntTarget ();
  333. };
  334.  
  335. /*
  336. ===========
  337. FindTarget
  338.  
  339. Self is currently not attacking anything, so try to find a target
  340.  
  341. Returns TRUE if an enemy was sighted
  342.  
  343. When a player fires a missile, the point of impact becomes a fakeplayer so
  344. that monsters that see the impact will respond as if they had seen the
  345. player.
  346.  
  347. To avoid spending too much time, only a single client (or fakeclient) is
  348. checked each frame.  This means multi player games will have slightly
  349. slower noticing monsters.
  350. ============
  351. */
  352.  
  353.  
  354.  
  355. // added procedure; bits of this taken from the homing missile code
  356.  
  357. float() Pet_FindTarget =
  358. {
  359.     local entity    client;
  360.     local float        r;
  361.         local entity head, selected;
  362.     local float dist;
  363.  
  364.  
  365.  
  366.         dist = 10000;
  367.     selected = world;
  368.     head = findradius(self.origin, 10000);
  369.     while(head)
  370.     {
  371.         if( (head.health > 1) && (head != self) && (head != self.owner) )
  372.         {
  373.             traceline(self.origin,head.origin,TRUE,self);
  374.             if ( (trace_fraction >= 1) && (vlen(head.origin - self.origin) < dist) && (head.owner != self.owner))
  375.             {
  376.                 selected = head;
  377.                 dist = vlen(head.origin - self.origin);
  378.             }
  379.         }
  380.         head = head.chain;
  381.     }
  382.     if (selected != world)
  383.     {
  384.         sprint (self.owner,"Pet attacking -> ");
  385.         if (selected.classname == "player")
  386.         {
  387.             sprint (self.owner,selected.netname);
  388.             sprint (selected,self.owner.netname);
  389.             sprint (selected," sent one of his minions after you!\n");
  390.         }
  391.         else
  392.             sprint (self.owner,selected.classname);
  393.         sprint (self.owner,"\n");
  394.                 self.enemy = selected;
  395.                 FoundTarget ();
  396.  
  397.                 return TRUE;
  398.     }
  399.  
  400.  
  401.     if (self.goalentity != self.owner)
  402.       {
  403.         self.goalentity = self.owner;
  404.         self.think = self.th_run;
  405.       }
  406.     self.ideal_yaw = vectoyaw(self.owner.origin - self.origin);
  407.     self.nextthink = time+0.1;
  408.     return FALSE;
  409.  
  410.  
  411. };
  412.  
  413.  
  414. float() FindTarget =
  415. {
  416.     local entity    client;
  417.     local float        r;
  418.  
  419. // if the first spawnflag bit is set, the monster will only wake up on
  420. // really seeing the player, not another monster getting angry
  421.  
  422. // spawnflags & 3 is a big hack, because zombie crucified used the first
  423. // spawn flag prior to the ambush flag, and I forgot about it, so the second
  424. // spawn flag works as well
  425.  
  426.  
  427.  
  428. // added lines
  429.  
  430.         if (self.owner) return Pet_FindTarget ();
  431.  
  432. //
  433.  
  434.  
  435.     if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3) )
  436.     {
  437.         client = sight_entity;
  438.         if (client.enemy == self.enemy)
  439.             return;
  440.     }
  441.     else
  442.     {
  443.         client = checkclient ();
  444.         if (!client)
  445.             return FALSE;    // current check entity isn't in PVS
  446.     }
  447.  
  448.     if (client == self.enemy)
  449.         return FALSE;
  450.  
  451.     if (client.flags & FL_NOTARGET)
  452.         return FALSE;
  453.     if (client.items & IT_INVISIBILITY)
  454.         return FALSE;
  455.  
  456.     r = range (client);
  457.     if (r == RANGE_FAR)
  458.         return FALSE;
  459.         
  460.     if (!visible (client))
  461.         return FALSE;
  462.  
  463.     if (r == RANGE_NEAR)
  464.     {
  465.         if (client.show_hostile < time && !infront (client))
  466.             return FALSE;
  467.     }
  468.     else if (r == RANGE_MID)
  469.     {
  470.         if ( /* client.show_hostile < time || */ !infront (client))
  471.             return FALSE;
  472.     }
  473.     
  474. //
  475. // got one
  476. //
  477.     self.enemy = client;
  478.     if (self.enemy.classname != "player")
  479.     {
  480.         self.enemy = self.enemy.enemy;
  481.         if (self.enemy.classname != "player")
  482.         {
  483.             self.enemy = world;
  484.             return FALSE;
  485.         }
  486.     }
  487.     
  488.     FoundTarget ();
  489.  
  490.     return TRUE;
  491. };
  492.  
  493.  
  494. //=============================================================================
  495.  
  496. void(float dist) ai_forward =
  497. {
  498.     walkmove (self.angles_y, dist);
  499. };
  500.  
  501. void(float dist) ai_back =
  502. {
  503.     walkmove ( (self.angles_y+180), dist);
  504. };
  505.  
  506.  
  507. /*
  508. =============
  509. ai_pain
  510.  
  511. stagger back a bit
  512. =============
  513. */
  514. void(float dist) ai_pain =
  515. {
  516.     ai_back (dist);
  517. /*
  518.     local float    away;
  519.     
  520.     away = anglemod (vectoyaw (self.origin - self.enemy.origin) 
  521.     + 180*(random()- 0.5) );
  522.     
  523.     walkmove (away, dist);
  524. */
  525. };
  526.  
  527. /*
  528. =============
  529. ai_painforward
  530.  
  531. stagger back a bit
  532. =============
  533. */
  534. void(float dist) ai_painforward =
  535. {
  536.     walkmove (self.ideal_yaw, dist);
  537. };
  538.  
  539. /*
  540. =============
  541. ai_walk
  542.  
  543. The monster is walking it's beat
  544. =============
  545. */
  546. void(float dist) ai_walk =
  547. {
  548.     local vector        mtemp;
  549.     
  550.     movedist = dist;
  551.     
  552.     if (self.classname == "monster_dragon")
  553.     {
  554.         movetogoal (dist);
  555.         return;
  556.     }
  557.     // check for noticing a player
  558.     if (FindTarget ())
  559.         return;
  560.  
  561.     movetogoal (dist);
  562. };
  563.  
  564.  
  565. /*
  566. =============
  567. ai_stand
  568.  
  569. The monster is staying in one place for a while, with slight angle turns
  570. =============
  571. */
  572. void() ai_stand =
  573. {
  574.     if (FindTarget ())
  575.         return;
  576.     
  577.     if (time > self.pausetime)
  578.     {
  579.         self.th_walk ();
  580.         return;
  581.     }
  582.  
  583. // change angle slightly
  584.  
  585. };
  586.  
  587. /*
  588. =============
  589. ai_turn
  590.  
  591. don't move, but turn towards ideal_yaw
  592. =============
  593. */
  594. void() ai_turn =
  595. {
  596.     if (FindTarget ())
  597.         return;
  598.     
  599.     ChangeYaw ();
  600. };
  601.  
  602. //=============================================================================
  603.  
  604. /*
  605. =============
  606. ChooseTurn
  607. =============
  608. */
  609. void(vector dest3) ChooseTurn =
  610. {
  611.     local vector    dir, newdir;
  612.     
  613.     dir = self.origin - dest3;
  614.  
  615.     newdir_x = trace_plane_normal_y;
  616.     newdir_y = 0 - trace_plane_normal_x;
  617.     newdir_z = 0;
  618.     
  619.     if (dir * newdir > 0)
  620.     {
  621.         dir_x = 0 - trace_plane_normal_y;
  622.         dir_y = trace_plane_normal_x;
  623.     }
  624.     else
  625.     {
  626.         dir_x = trace_plane_normal_y;
  627.         dir_y = 0 - trace_plane_normal_x;
  628.     }
  629.  
  630.     dir_z = 0;
  631.     self.ideal_yaw = vectoyaw(dir);    
  632. };
  633.  
  634. /*
  635. ============
  636. FacingIdeal
  637.  
  638. ============
  639. */
  640. float() FacingIdeal =
  641. {
  642.     local    float    delta;
  643.     
  644.     delta = anglemod(self.angles_y - self.ideal_yaw);
  645.     if (delta > 45 && delta < 315)
  646.         return FALSE;
  647.     return TRUE;
  648. };
  649.  
  650.  
  651. //=============================================================================
  652.  
  653. float()    WizardCheckAttack;
  654. float()    DogCheckAttack;
  655.  
  656. float() CheckAnyAttack =
  657. {
  658.     if (!enemy_vis)
  659.         return;
  660.     if (self.classname == "monster_army")
  661.         return SoldierCheckAttack ();
  662.     if (self.classname == "monster_ogre")
  663.         return OgreCheckAttack ();
  664.     if (self.classname == "monster_shambler")
  665.         return ShamCheckAttack ();
  666.     if (self.classname == "monster_demon1")
  667.         return DemonCheckAttack ();
  668.     if (self.classname == "monster_dog")
  669.         return DogCheckAttack ();
  670.     if (self.classname == "monster_wizard")
  671.         return WizardCheckAttack ();
  672.     return CheckAttack ();
  673. };
  674.  
  675.  
  676. /*
  677. =============
  678. ai_run_melee
  679.  
  680. Turn and close until within an angle to launch a melee attack
  681. =============
  682. */
  683. void() ai_run_melee =
  684. {
  685.     self.ideal_yaw = enemy_yaw;
  686.     ChangeYaw ();
  687.  
  688.     if (FacingIdeal())
  689.     {
  690.         self.th_melee ();
  691.         self.attack_state = AS_STRAIGHT;
  692.     }
  693. };
  694.  
  695.  
  696. /*
  697. =============
  698. ai_run_missile
  699.  
  700. Turn in place until within an angle to launch a missile attack
  701. =============
  702. */
  703. void() ai_run_missile =
  704. {
  705.     self.ideal_yaw = enemy_yaw;
  706.     ChangeYaw ();
  707.     if (FacingIdeal())
  708.     {
  709.         self.th_missile ();
  710.         self.attack_state = AS_STRAIGHT;
  711.     }
  712. };
  713.  
  714.  
  715. /*
  716. =============
  717. ai_run_slide
  718.  
  719. Strafe sideways, but stay at aproximately the same range
  720. =============
  721. */
  722. void() ai_run_slide =
  723. {
  724.     local float    ofs;
  725.     
  726.     self.ideal_yaw = enemy_yaw;
  727.     ChangeYaw ();
  728.     if (self.lefty)
  729.         ofs = 90;
  730.     else
  731.         ofs = -90;
  732.     
  733.     if (walkmove (self.ideal_yaw + ofs, movedist))
  734.         return;
  735.  
  736.     self.lefty = 1 - self.lefty;
  737.  
  738.     walkmove (self.ideal_yaw - ofs, movedist);
  739. };
  740.  
  741.  
  742. /*
  743. =============
  744. ai_run
  745.  
  746. The monster has an enemy it is trying to kill
  747. =============
  748. */
  749.  
  750.  
  751. // added procedure
  752.  
  753. void(float dist) ai_petrun =
  754. {
  755.     local    vector    delta;
  756.     local    float    axis;
  757.     local    float    direct, ang_rint, ang_floor, ang_ceil;
  758.  
  759.     movedist = dist;
  760.  
  761.         self.ideal_yaw = vectoyaw(self.owner.origin - self.origin);
  762.         ChangeYaw ();
  763.         if (FacingIdeal())
  764.     movetogoal (dist);        // done in C code...
  765. };
  766.  
  767.  
  768. void(float dist) ai_run =
  769. {
  770.     local    vector    delta;
  771.     local    float    axis;
  772.     local    float    direct, ang_rint, ang_floor, ang_ceil;
  773.  
  774.  
  775. // added lines
  776.  
  777.         if ( (self.owner != world) && (self.owner==self.goalentity)) {
  778.                                         ai_petrun (dist);
  779.                                         FindTarget();
  780.                                         return;
  781.                                 }
  782. //
  783.  
  784.  
  785.     movedist = dist;
  786. // see if the enemy is dead
  787.     if (self.enemy.health <= 0)
  788.     {
  789.         self.enemy = world;
  790.     // FIXME: look all around for other targets
  791.         if (self.oldenemy.health > 0)
  792.         {
  793.             self.enemy = self.oldenemy;
  794.             HuntTarget ();
  795.         }
  796.         else
  797.         {
  798.             if (self.movetarget)
  799.                 self.th_walk ();
  800.             else
  801.                 self.th_stand ();
  802.             return;
  803.         }
  804.     }
  805.  
  806.     self.show_hostile = time + 1;        // wake up other monsters
  807.  
  808. // check knowledge of enemy
  809.     enemy_vis = visible(self.enemy);
  810.     if (enemy_vis)
  811.         self.search_time = time + 5;
  812.  
  813. // look for other coop players
  814.     if (coop && self.search_time < time)
  815.     {
  816.         if (FindTarget ())
  817.             return;
  818.     }
  819.  
  820.     enemy_infront = infront(self.enemy);
  821.     enemy_range = range(self.enemy);
  822.     enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
  823.     
  824.     if (self.attack_state == AS_MISSILE)
  825.     {
  826. //dprint ("ai_run_missile\n");
  827.         ai_run_missile ();
  828.         return;
  829.     }
  830.     if (self.attack_state == AS_MELEE)
  831.     {
  832. //dprint ("ai_run_melee\n");
  833.         ai_run_melee ();
  834.         return;
  835.     }
  836.  
  837.     if (CheckAnyAttack ())
  838.         return;                    // beginning an attack
  839.         
  840.     if (self.attack_state == AS_SLIDING)
  841.     {
  842.         ai_run_slide ();
  843.         return;
  844.     }
  845.  
  846. // head straight in
  847.     movetogoal (dist);        // done in C code...
  848. };
  849.  
  850.  
  851.