home *** CD-ROM | disk | FTP | other *** search
/ Classic Fond 52 / ClassicFond52.iso / GAMES / DROIDW.RAR / DWCD.GOB / mission_cog_sy_magtramz.cog < prev    next >
Encoding:
Text File  |  1998-11-04  |  9.5 KB  |  355 lines

  1. # DrowWorks Cog Script
  2. #    
  3. # SY_MagTram A
  4. #
  5. # First attempt at MagTram cog
  6. #
  7. # Desc:
  8. #    
  9. #
  10. #
  11. # [01/18/97] DGS Created From Matt's TreadRX script.
  12. # [03/03/98] DGS Modified to work with sector thrusts. It got totally re-written. (Del-Fi Lost Treasures)
  13. # [04/02/98] DGS  Getting totally re-written again as so it's waiting for you at said "wait point".  (Captiol Ultra-Lounge: Bachelor Pad Royale)
  14. #                   and it's a piece of junk that I just hate. 
  15. # [04/09/98] DGS Created MagtramZ out of Magtram A to replace MagtramG. This just sucks. (Don Tiki).
  16.  
  17. symbols
  18.  
  19. ## ====================== Messages
  20. message        startup
  21. message     arrived
  22. message     entered
  23. message     exited 
  24. message        pulse
  25. message        touched
  26. message        timer
  27.  
  28. ## ====================== Things
  29. thing        tram   
  30. thing        door1_o                
  31. thing        door2_o        
  32. thing        door3_o    
  33. thing        door4_o
  34. thing        door5_o    
  35. thing        door6_o    
  36.  
  37. ##  ====================== Surfaces
  38. surface     tram1block1        nolink
  39. surface     tram1block2        nolink
  40. surface     tram1block3        nolink
  41. surface     tram1block4        nolink
  42.  
  43. ## ---------------------- Door sectors
  44. int            door1_s            local
  45. int            door2_s            local
  46. int            door3_s            local
  47. int            door4_s            local
  48. int            door5_s            local
  49. int            door6_s            local
  50.  
  51. ##    ===================== Vectors
  52. vector        up_v
  53.  
  54. ## ====================== Sectors
  55. sector      pickup1_s         linkid=21
  56. sector      pickup2_s        linkid=22
  57. int            tram_sect_i        local    
  58.  
  59.  
  60.  
  61. ## ====================== Misc. Variables
  62.  
  63. flex        t_speed=15.0    local
  64. flex        door_speed=12.0    local
  65. int            cargo1_i=0        local
  66. int            cargo2_i=0        local 
  67. int            cargot_i=0        local
  68. int            pickups_i=0        local
  69. int            moveframe=0        local
  70. int            in_tram=0        local
  71. int            touchy=0        local
  72.  
  73.  
  74. end
  75.  
  76. # ========================================================================================
  77.  
  78. code
  79.  
  80. startup:
  81.     //movetoframe(tram,1,t_speed);
  82.     moveframe = 1;
  83.     call open_adjoins;
  84.     
  85.     door1_s = GetThingSector(door1_o);
  86.     SetSectorAdjoins(door1_s, 0);
  87.     door2_s = GetThingSector(door2_o);
  88.     SetSectorAdjoins(door2_s, 0);
  89.     door3_s = GetThingSector(door3_o);
  90.     SetSectorAdjoins(door3_s, 0);
  91.     door4_s = GetThingSector(door4_o);
  92.     SetSectorAdjoins(door4_s, 0);
  93.     door5_s = GetThingSector(door5_o);
  94.     SetSectorAdjoins(door5_s, 0);
  95.     door6_s = GetThingSector(door6_o);
  96.     SetSectorAdjoins(door6_s, 0);
  97.     
  98.     
  99.     //call tramstop;
  100.  
  101.     return;
  102.  
  103. tramstop:
  104.     print("tramstop jerky");
  105.     //This routine is in charge of checking a tram stop and dropping something off it it needs
  106.     // to, or picking someone up if it needs to.
  107.     if (cargot_i == 0)        //if the tram is empty
  108.         {
  109.         if ((getthingsector(tram) == pickup1_s) && (cargo1_i !=0 ))    //if the sector the tram is in is pickup 1 and there's cargo to pick up
  110.             {
  111.             achthing = cargo1_i; // Let the achthing (the thing it picks up) = whatever the cargo is.
  112.             cargo1_i = 0;         // Empty the cargostop  variable 
  113.             pickups_i = pickup1_s;    // tell the touched message what sectorthrust to stop.
  114.             SectorThrust(pickup1_s, up_v, 5);
  115.                //settimer(3);
  116.             }
  117.         }
  118.     else // Else the cargo is holding something and it's way out wackity wacked
  119.         {
  120.         print("!");
  121.         //call dropoff1;
  122.         }
  123.     return;
  124. touched:
  125.     print("touched");
  126.     //printint(tram_pickup);
  127.     if (touchy == 0)
  128.     {
  129.     if (getsenderref() == tram)
  130.         {
  131.         call open_adjoins;
  132.         print("touched32");
  133.         touchy = 1;
  134.         tram_pickup = 0;
  135.         //print("touched");
  136.         achthing = getlocalplayerthing(); 
  137.         SectorThrust(pickups_i, up_v, 0);
  138.         sleep(0.01);
  139.         call pickup1;
  140.         settimer(1);
  141.         }
  142.     }
  143.     return;
  144.  
  145. entered:
  146.     // This routine handles setting up variables for when  the player (or potentially something else)
  147.     // enters a pickup zone. 
  148.     print("entered");
  149.     if (dwCheckDroidCaps(16))
  150.         {
  151.         If (getsenderref()== pickup1_s) //if something entered pickup 1
  152.             {
  153.             call close_adjoins;
  154.             SectorThrust(pickup1_s, up_v, 5);
  155.             //print("Sector 1:");
  156.             //printint(getsourceref());
  157.             //cargo1_i = getsourceref();
  158.             }
  159.         }
  160.     return;
  161.  
  162. exited:
  163.        //This routine handles clearing varibles that keep track of what's potential cargo. 
  164.     If (getsenderref()== pickup1_s)//if something exited pickup 1
  165.         {
  166.         if (cargo1_i == getsourceref()) 
  167.             {
  168.             cargo1_i = 0; //if it was potential cargo, then remove it
  169.             SectorThrust(pickup1_s, up_v, 0);
  170.             }
  171.         }
  172.         return;               
  173.  
  174. pickup1:
  175.     // This routine picks up the player (well, in therory anything)
  176.     // It was taken from Matt the Tat's tram cog. I modified it a little. -Doug
  177.     
  178.     if (dwCheckDroidCaps(16))
  179.         {
  180.         print("pick me up!");
  181.         printint(achthing);
  182.         t_speed = 7.5;
  183.         hangoffset=('0,0,0');
  184.         cargot_i = achthing;
  185.         //    setsectorthrust(thrustsector, thrustvector, 0);
  186.         totalradius = GetThingRadius(achthing) + GetThingRadius(tram);
  187.         VectorSet(hangoffset, 0, 0, (-totalradius)- 0.5);
  188.         //    hangoffset = VectorAdd(hangoffset, GetThingInsertOffset(magnettram));
  189.         hangoffset = VectorSub(hangoffset, GetThingInsertOffset(achthing));
  190.         //SetThingPos(achthing, VectorAdd(GetThingPos(tram), hangoffset));
  191.         AttachThingToThingEx(achthing, tram, 8);
  192.         dwdisablejump();
  193.         }
  194.     else
  195.         {
  196.         // Tell the player they're non-pharrous
  197.         }
  198.     return;
  199.  
  200. dropoff1:
  201.     print("dropOFF:");
  202.     printint(cargot_i);
  203.     cargot_i = 0;        //empty out the cargo variable 
  204.     t_speed = 15;
  205.     //Sleep(2);   
  206.     in_tram = 0;
  207.     detachthing(achthing);
  208.     setthingvel(achthing, '0,0,0.5');
  209.     SectorThrust(pickup2_s, up_v, 3);
  210.     setpulse(3);
  211.     dwenablejump();
  212.     return;
  213.  
  214. arrived:
  215.    if (getsenderref() == tram)
  216.         {
  217.         if ((getcurframe(tram))==1)
  218.             {
  219.             movetoframe(tram,6,t_speed);
  220.             } 
  221.         else if ((getcurframe(tram))==6)
  222.             {
  223.             SetSectorAdjoins(door1_s, 1);  //Turn on door adjoins
  224.             movetoframe(door1_o,1,door_speed);
  225.             movetoframe(tram,7,t_speed);
  226.             } 
  227.          else if ((getcurframe(tram))==7)
  228.             {
  229.             movetoframe(door1_o,0,door_speed);
  230.             movetoframe(tram,8,t_speed);
  231.             }
  232.          else if ((getcurframe(tram))==8)
  233.             {
  234.             SetSectorAdjoins(door2_s, 1);  //Turn on door adjoins
  235.             movetoframe(door2_o,1,door_speed);
  236.             movetoframe(tram,9,t_speed);
  237.             }
  238.          else if ((getcurframe(tram))==9)
  239.             {
  240.             movetoframe(door2_o,0,door_speed);  // Close door
  241.             movetoframe(tram,11,t_speed);
  242.             }   
  243.          else if ((getcurframe(tram))==11)
  244.             {
  245.             SetSectorAdjoins(door3_s, 1);  //Turn on door adjoins
  246.             movetoframe(door3_o,1,door_speed);
  247.             movetoframe(tram,12,t_speed);
  248.             } 
  249.          else if ((getcurframe(tram))==12)
  250.             {
  251.             movetoframe(door3_o,0,door_speed);  // Close door
  252.             movetoframe(tram,15,t_speed);
  253.             }
  254.          else if ((getcurframe(tram))==15)
  255.             {
  256.             call dropoff1;
  257.             moveframe = 13;
  258.             settimer(3);
  259.             //SetSectorAdjoins(door4_s, 1);  //Turn on door adjoins
  260.             //movetoframe(door4_o,1,door_speed);
  261.             //movetoframe(tram,10,t_speed);
  262.             } 
  263.          else if ((getcurframe(tram))==3310)
  264.             {
  265.             movetoframe(door4_o,0,door_speed);  // Close door
  266.             movetoframe(tram,12,t_speed);
  267.             }
  268.          else if ((getcurframe(tram))==3312)
  269.             {
  270.             }
  271.          else if ((getcurframe(tram))==3313)
  272.             {
  273.             SetSectorAdjoins(door5_s, 1);  //Turn on door adjoins
  274.             movetoframe(door5_o,1,door_speed);
  275.             movetoframe(tram,15,t_speed);
  276.             } 
  277.          else if ((getcurframe(tram))==3315)
  278.             {
  279.             movetoframe(door5_o,0,door_speed);  // Close door
  280.             movetoframe(tram,16,t_speed);
  281.             }
  282.          else if ((getcurframe(tram))==3316)
  283.             {
  284.             SetSectorAdjoins(door6_s, 1);  //Turn on door adjoins
  285.             movetoframe(door6_o,1,door_speed);
  286.             movetoframe(tram,17,t_speed);
  287.             } 
  288.          
  289.          else if ((getcurframe(tram))==3317)
  290.             {
  291.             movetoframe(door6_o,0,door_speed);  // Close door
  292.             skiptoframe(tram,0,t_speed);
  293.             }
  294.         
  295.                  
  296.  
  297.         }
  298.     else if (getsenderref() == door1_o) //if it's door 1 
  299.         {
  300.         if (getcurframe(door1_o) == 0) SetSectorAdjoins(door1_s, 0);  //Turn off door adjoins
  301.         }
  302.     else if (getsenderref() == door2_o) 
  303.         {                                            
  304.         if (getcurframe(door2_o) == 0) SetSectorAdjoins(door2_s, 0);  //Turn off door adjoins
  305.         }
  306.     else if (getsenderref() == door3_o)                            
  307.         {                                            
  308.         if (getcurframe(door3_o) == 0) SetSectorAdjoins(door3_s, 0);  //Turn off door adjoins
  309.         }
  310.     else if (getsenderref() == door4_o)                            
  311.         {                                            
  312.         if (getcurframe(door4_o) == 0) SetSectorAdjoins(door4_s, 0);  //Turn off door adjoins
  313.         }
  314.     else if (getsenderref() == door5_o)                            
  315.         {                                            
  316.         if (getcurframe(door5_o) == 0) SetSectorAdjoins(door5_s, 0);  //Turn off door adjoins
  317.         }
  318.     else if (getsenderref() == door6_o)                            
  319.         {                                            
  320.         if (getcurframe(door6_o) == 0) SetSectorAdjoins(door6_s, 0);  //Turn off door adjoins
  321.         }
  322.     
  323.     return;
  324. timer:
  325.     // this routine is used to control the movement of the tram after it's waited at 
  326.     // the stop for a settimer() amount of ti
  327.     print("I pity the fool");
  328.     tram_pickup = 0;
  329.     movetoframe(tram,moveframe,t_speed);
  330.     return;
  331.  
  332. pulse:
  333.     SectorThrust(pickup2_s, up_v, 0);
  334.     setpulse(0);
  335.     return;
  336.  
  337. open_adjoins:
  338.      print("clearing flags");
  339.      setadjoinflags(tram1block1, 2);
  340.      setadjoinflags(tram1block2, 2);
  341.      setadjoinflags(tram1block3, 2);
  342.      setadjoinflags(tram1block4, 2);
  343.      return;
  344.      
  345. close_adjoins:
  346.      print("setting flags");
  347.      clearadjoinflags(tram1block1, 2);
  348.      clearadjoinflags(tram1block2, 2);
  349.      clearadjoinflags(tram1block3, 2);
  350.      clearadjoinflags(tram1block4, 2);
  351.      return;
  352.  
  353.  
  354. end
  355.