home *** CD-ROM | disk | FTP | other *** search
/ hobbes.nmsu.edu 2008 / 2008-06-02_hobbes.nmsu.edu.zip / new / scummc-0.2.0-os2.zip / ScummC / examples / openquest / secretroom.scc < prev    next >
Encoding:
Text File  |  2008-04-06  |  12.4 KB  |  363 lines

  1. /* ScummC
  2.  * Copyright (C) 2007  Alban Bedel, Gerrit Karius
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  17.  *
  18.  */
  19.  
  20.  
  21. #include <scummVars6.s>
  22. #include "common.sch"
  23. #include "secretroom.sch"
  24. #include "officeroom.sch"
  25. #include "inventoryitems.sch"
  26. #include "actors.sch"
  27.  
  28. #include "zob_anim.sch"
  29. #include "zif_anim.sch"
  30. #include "cube_anim.sch"
  31.  
  32.  
  33.  
  34. room SecretRoom {
  35.  
  36.     image = "graphics/rooms/back02_merged.bmp";
  37.  
  38.     boxd = "graphics/rooms/back02.box";
  39.  
  40.     zplane = {
  41.         "graphics/rooms/back02_mask1.bmp",
  42.         "graphics/rooms/back02_mask2.bmp",
  43.         "graphics/rooms/back02_mask3.bmp"
  44.     };
  45.  
  46.     //trans = 0;
  47.  
  48.     voice shootCageSnd = { "sounds/shoot_cage.voc" };
  49.     voice shootDeadSnd = { "sounds/shoot_dead.voc" };
  50.     voice fallDeadSnd = { "sounds/fall_dead.voc" };
  51.     voice mwwwahSnd = { "sounds/mwwwah_huh_huh.voc" };
  52.  
  53.     bit terminalActivated;
  54.  
  55.     object node;
  56.  
  57.     local script entry() {
  58.         putActorAt(VAR_EGO,40,100,SecretRoom);
  59.         walkActorTo(VAR_EGO,92,100);
  60.     }
  61.  
  62.     script outro() {
  63.         int i;
  64.         Actors::stopRoaming(commanderZif);
  65.         cutscene(1) {
  66.             try {
  67.                 egoSay("I'm having problems hitting the target, Sir.");
  68.                 waitForMessage();
  69.                 actorSay(commanderZif, "You're not a soldier. Give it here.");
  70.                 walkActorToObj(commanderZif,ensignZob,0);
  71.                 waitForMessage();
  72.                 waitForActor(commanderZif);
  73.                 actorFace(commanderZif,ensignZob);
  74.                 actorFace(ensignZob,commanderZif);
  75.                 setObjectOwner( InventoryItems::gun, commanderZif );
  76.                 animateActor(ensignZob, zob_anim_raiseArm);
  77.                 delay(15);
  78.                 animateActor(commanderZif, zif_anim_raiseArm);
  79.                 delay(15);
  80.                 animateActor(ensignZob, zob_anim_lowerArm);
  81.                 delay(15);
  82.                 animateActor(commanderZif, zif_anim_lowerArm);
  83.                 delay(15);
  84.                 actorSay(commanderZif, "Right, stand back.");
  85.                 waitForMessage();
  86.                 walkActorTo(ensignZob, 210, 120);
  87.                 waitForActor( ensignZob );
  88.                 walkActorToObj(commanderZif, node, 0);
  89.                 waitForActor(commanderZif);
  90.                 actorFace(ensignZob,commanderZif);
  91.                 actorSay(commanderZif, "I shall disable the suspension field thusly.");
  92.                 waitForMessage();
  93.                 delay(100);
  94.                 dbgPrint("%V{shootCageSnd}");
  95.                 animateActor(commanderZif,zif_anim_fireup);
  96.                 delay(30);
  97.                 setCurrentActor(bluecupActor);
  98.                 for(i = 11 ; i > 0 ; i--) {
  99.                     delay( 2 );
  100.                     setActorElevation( i*5 );
  101.                 }
  102.                 delay(100);
  103.                 walkActorToObj(commanderZif,bluecupActor,0);
  104.                 waitForActor( commanderZif );
  105.                 setCurrentActor(commanderZif);
  106.                 setActorDirection(180);
  107.                 delay(100);
  108.                 putActorAt( bluecupActor,0,0,InventoryItems );
  109.                 actorSay(commanderZif, "At last, the power of the relic is mine.");
  110.                 waitForMessage();
  111.                 egoSay("Expertly done, Sir.");
  112.                 waitForMessage();
  113.                 egoSay("Pass over the relic, and I shall place it in the containment vessel.");
  114.                 waitForMessage();
  115.                 walkActorTo(commanderZif, 100, 115);
  116.                 waitForActor( commanderZif );
  117.                 actorFace(commanderZif,ensignZob);
  118.                 actorSay(commanderZif, "Never!");
  119.                 waitForMessage();
  120.                 actorSay(commanderZif, "The relic shall never leave my side.");
  121.                 waitForMessage();
  122.                 egoSay("But commander, the power is too much for one man.");
  123.                 waitForMessage();
  124.                 egoSay("Yield it, before it destroys you!");
  125.                 waitForMessage();
  126.                 actorSay(commanderZif, "Error, number one.");
  127.                 waitForMessage();
  128.                 actorSay(commanderZif, "Never give up the gun.");
  129.                 waitForMessage();
  130.                 dbgPrint("%V{shootDeadSnd}");
  131.                 animateActor(commanderZif,zif_anim_firestraight);
  132.                 delay(50);
  133.                 dbgPrint("%V{fallDeadSnd}");
  134.                 animateActor( ensignZob, zob_anim_die );
  135.                 delay(150);
  136.                 walkActorTo(commanderZif, 170, 120);
  137.                 waitForActor( commanderZif );
  138.                 actorSay(commanderZif, "What a shame...");
  139.                 waitForMessage();
  140.                 actorSay(commanderZif, "We could have ruled the cosmos together.");
  141.                 waitForMessage();
  142.                 setCurrentActor(commanderZif);
  143.                 setActorDirection(180);
  144.                 Actors::setZifOnThePhone();
  145.                 animateActor( commanderZif, zif_anim_lookAround );
  146.                 delay(30);
  147.                 actorSay(commanderZif, "Commander's log, star date 432.2");
  148.                 waitForMessage();
  149.                 actorSay(commanderZif, "I have obtained the stolen artifact.");
  150.                 waitForMessage();
  151.                 actorSay(commanderZif, "In a slight contradiction to my orders, I have decided to enslave this planet.");
  152.                 waitForMessage();
  153.                 actorSay(commanderZif, "%V{mwwwahSnd}"
  154.                          "Mwaaah huh huh huh huh huh huh...");
  155.                 waitForMessage();
  156.                 Actors::setZifOffThePhone();
  157.  
  158.             }
  159.             override {
  160.                 if(VAR_OVERRIDE) {
  161.                     actorSay(0xFF, ""); //stopTalking();
  162.                     putActorAt(ensignZob,276,110,SecretRoom);
  163.                     putActorAt(commanderZif,170,120,SecretRoom);
  164.                     putActorAt( bluecupActor,0,0,InventoryItems );
  165.                     setCurrentActor(commanderZif);
  166.                     setActorDirection(180);
  167.                     Actors::setZifOffThePhone();
  168.                 }
  169.             }
  170.         }
  171.         
  172.         // Kill the mouseWatch
  173.         if(isScriptRunning(ResRoom::mouseWatch))
  174.             stopScript(ResRoom::mouseWatch);
  175.         VAR_VERB_SCRIPT = ResRoom::quit;
  176.     }
  177.  
  178.  
  179.     
  180.     object blueCup {
  181.         name = "blue cup";
  182.  
  183.         dir = SOUTH;
  184.  
  185.         verb(int vrb, int objA, int objB) {
  186.         case LookAt:
  187.             egoSay("The holy artifact!");
  188.             return;
  189.         case PickUp:
  190.             if(cubeDisappeared)
  191.                 egoSay("The artifact is still being held in place.");
  192.             else
  193.                 egoSay("The artifact is protected by some kind of forcefield container.");
  194.             return;
  195.         }
  196.     }
  197.  
  198.  
  199.     object computerTerminal {
  200.         x = 176;
  201.         y = 56;
  202.         w = 16;
  203.         h = 24;
  204.         hs_x = 30;
  205.         hs_y = 43;
  206.         name = "computer terminal";
  207.         dir = WEST;
  208.  
  209.         verb(int vrb, int objA, int objB) {
  210.         case LookAt:
  211.             egoSay("Looks pretty ordinary.");
  212.             return;
  213.         case Use:
  214.             if( terminalActivated && ! cubeDisappeared ) {
  215.                 Actors::pauseRoaming(commanderZif);
  216.                 cutscene(2) {
  217.                     try {
  218.                         animateActor(VAR_EGO, zif_anim_raiseArm);
  219.                         delay(25);
  220.                         animateActor(VAR_EGO, zif_anim_lowerArm);
  221.                         delay(25);
  222.                         animateActor(cubeActor, cube_anim_dissolve);
  223.                         delay(50);
  224.                         egoSay("Looks like I broke the encryption.");
  225.                         waitForMessage();
  226.                         putActorAt(commanderZif,40,100,SecretRoom);
  227.                         walkActorTo(commanderZif,95,100);
  228.                         waitForActor(commanderZif);
  229.                         actorFace(commanderZif,VAR_EGO);
  230.                         actorSay(commanderZif,"Well done, ensign.");
  231.                         waitForMessage();
  232.                         actorSay(commanderZif,"Now retrieve the relic!");
  233.                         waitForMessage();
  234.                         egoSay("Small problem, sir.");
  235.                         waitForMessage();
  236.                         actorSay(commanderZif,"What's that?");
  237.                         waitForMessage();
  238.                         egoSay("It is still held in place.");
  239.                         waitForMessage();
  240.                         actorSay(commanderZif,"Then find a way to bring it down.");
  241.                         waitForMessage();
  242.                         egoSay("Aye, sir!");
  243.                         waitForMessage();
  244.                     }
  245.                     override {
  246.                         if(VAR_OVERRIDE) {
  247.                             actorSay(0xFF, ""); //stopTalking();
  248.                             putActorAt(commanderZif,90,100,SecretRoom);
  249.                             actorFace(commanderZif,VAR_EGO);
  250.                         }
  251.                     }
  252.                     putActorAt(cubeActor,0,0,InventoryItems);
  253.                     cubeDisappeared = 1;
  254.                     Actors::startRoaming(commanderZif,80,220,105,130);
  255.                 }
  256.             }
  257.             else if( cubeDisappeared )
  258.                 egoSay("The terminal has shut down.");
  259.             else
  260.                 egoSay("The terminal is offline.");
  261.             return;
  262.         }
  263.  
  264.     }
  265.  
  266.     object keySlot {
  267.         x = 176;
  268.         y = 80;
  269.         w = 16;
  270.         h = 16;
  271.         hs_x = 25;
  272.         hs_y = 30;
  273.         name = "key slot";
  274.         dir = WEST;
  275.  
  276.         verb(int vrb, int objA, int objB) {
  277.         case LookAt:
  278.             if(terminalActivated)
  279.                 egoSay("There is a keycard in this slot.");
  280.             else
  281.                 egoSay("This looks like the recepticle for some kind of electronic key.");
  282.             return;
  283.         case UsedWith:
  284.             if(objB == InventoryItems::card) {
  285.                 cutscene(0) {
  286.                     egoSay("I think this should activate the terminal.");
  287.                     waitForMessage();
  288.                     animateActor(VAR_EGO, zob_anim_raiseArm);
  289.                     delay(25);
  290.                     animateActor(VAR_EGO, zob_anim_lowerArm);
  291.                     terminalActivated = 1;
  292.                     setObjectOwner( InventoryItems::card, 0 );
  293.                 }
  294.             }
  295.             return;
  296.         }
  297.  
  298.     }
  299.     
  300.     object node {
  301.         x = 152;
  302.         y = 16;
  303.         w = 16;
  304.         h = 8;
  305.         hs_x = -50;
  306.         hs_y = 75;
  307.         name = "node";
  308.         dir = EAST;
  309.  
  310.         verb(int vrb, int objA, int objB) {
  311.         case LookAt:
  312.             egoSay("It appears to assist in suspending the artifact.");
  313.             return;
  314.         case UsedWith:
  315.             if(objB == InventoryItems::gun) {
  316.                 if( getObjectState( InventoryItems::gun ) != 2 ) {
  317.                     egoSay("The weapon is not loaded.");
  318.                     return;
  319.                 }
  320.                 if( cubeDisappeared != 1 ) {
  321.                     egoSay("The suspension cage prevents a clear shot at the node.");
  322.                     return;
  323.                 }
  324.                 cutscene(2) {
  325.                     hasShotAtNode = 1;
  326.                     animateActor(VAR_EGO,zob_anim_fireup);
  327.                     dbgPrint("%V{shootCageSnd}");
  328.                     delay(120);
  329.                     egoSay("Missed!");
  330.                     waitForMessage();
  331.                 }
  332.                 egoSay("I am not familiar with the aiming reticule.");
  333.                 return;
  334.             }
  335.             return;
  336.         }
  337.     }
  338.  
  339.  
  340.     object exitToOfficeRoom {
  341.         x = 48;
  342.         y = 32;
  343.         w = 32;
  344.         h = 72;
  345.         hs_x = 42;
  346.         hs_y = 68;
  347.         name = "room";
  348.         dir = WEST;
  349.  
  350.         verb(int vrb, int objA, int objB) {
  351.         case WalkTo:
  352.             walkActorTo(VAR_EGO,50,100);
  353.             waitForActor(VAR_EGO);
  354.             screenEffect(0x0082);
  355.             startRoom(OfficeRoom);
  356.             return;
  357.         }
  358.  
  359.     }
  360.  
  361.  
  362. }
  363.