home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_cc_controlmirror.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
4KB
|
118 lines
#
# cc_controlMirror.cog
#
# Crystal Information Center Center 3 Position Mirror script
#
# Desc:
# Bonehead. It rotates the mirror to one of three positions.
# okay, it's not as bonehead as I thought it was. It's a little more complex. But pretty much it
# rotates the mirror into 3 different positions.
# 03/27/98 DGS Created.
#
# (C) 1998 Lucas Learning Limited All Rights Reserved
# ========================================================================================
symbols
message activated
Message arrived
message startup
message timer
message pulse
thing Mirror_o
cog laser_c
surface North_s
surface East_s
surface South_s
sound rot_snd=ELV00LftLp01.WAV local
sound compute_snd=CMP04Calc.WAV local
sound act_snd=SWT00DrSwtch.WAV local
int playit=0 local
int position_i=0 local
int moving=0 local
flex m_speed=0.2 local
int selection=0 local
end
code
startup:
global8 = -45; // Setz it up
position_i = north_s; // This line sets up the variable so that it's ready for it's default position (north).
setwallcel(north_s,1); // This marks the switch as being on.
return;
activated:
selection = getsenderref(); //sets "selection" to what button was pressed.
garbage = playsoundpos(act_snd,getsurfacecenter(selection),0.5,-1,-1,0);
call rotate_mirror;
return;
rotate_mirror:
// called from activated and from timer. Rotates the mirror.
if (position_i != selection) // If the current mirror position does not match the button that was pressed
{
if (global9 == 1) //if the laser's turned on
{
sendmessage(laser_c,user0); // Tell the laser cog to turn off
settimer(2); // Wait two seconds then try this again.
setwallcel(selection,2); // Meanwhile set the controls to blank.
}
else if (moving != 1) //else the laser is off. If the mirror's not moving.
{
setwallcel(position_i,0); // Turn off the currently "on" button
if (selection == north_s) //=============North Specific Stuf
{
movetoframe(mirror_o,0,m_speed);
global8 = -45;
}
if (selection == east_s) //=============East Specific Stuf
{
movetoframe(mirror_o,1,m_speed);
global8 = 0;
}
if (selection == south_s) //=============South Specific Stuf
{
movetoframe(mirror_o,2,m_speed);
global8 = 45;
}
sounder = playsoundthing(rot_snd,mirror_o,1.0,-1,-1,1);
if (playit == 0)
{
dwPlayCammySpeech(16022, "M4ca020.wav", 10, 0); //I can hear the mirrror turning up there.
playit = 1;
}
position_i = selection; // Let the new position match the button that was pressed
moving = 1; // tells the script that it's moving
setwallcel(position_i,2); // Turn on the switch that pressed.
setpulse(0.25); // Turn on the pulse to flash the button.
}
}
return;
pulse:
// Handles flashing the controls
setwallcel(position_i,2 - getwallcel(position_i)); // This line toggles the button between frame 0 and 2.
return;
timer:
// This routine is called after (supposedly) the laser is turned off, and it calls rotate_mirror again.
call rotate_mirror;
return;
arrived:
if (sounder >-1) {stopsound(sounder,0.2); sounder = -1;}
garbage = playsoundpos(act_snd,getsurfacecenter(selection),0.5,-1,-1,0);
// Handles turning on and off lights and stuff
setpulse(0); // Turn off the flashing controls.
setwallcel(position_i,1); // Set the switch to a green lite
moving = 0; // Set moving to 0 so that rotate_mirror can accept messages.
return;
end