home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_cap_infrared.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
6KB
|
247 lines
# DroidWorks
# Infrared capability cog
#
# Infrared ability is in inventory bin 10
# Power is in inventory bin 20
symbols
thing player
int effectHandle=-1
int handle=-1
message activated
message startup
message shutdown
message pulse
message timer
flex brite=0.00 local
flex curlite=0.0 local
int timermode=0 local
int set local
int step=10 local
int steam=0 local
flex offset=240.00 local
flex c_effect=0.0 local
int speak1=0 local
int speak2=0 local
int warn=0 local
int lite_max=155 local
sound on_w=NRGt8InfraOn.wav local
sound off_w=NRGt8InfraOff.wav local
sound loop_w=NRGt8InfraLp.WAV local
#sound on_c=T8ca004.wav local
#sound off_c=T8ca005.wav local
#sound brite_c=T8ca008.wav local
#sound better_c=T8ca009.wav local
end
# ========================================================================================
code
shutdown:
if (handle != -1)
FreeColorEffect(handle);
if (effectHandle != -1)
FreeColorEffect(effectHandle);
return;
startup:
setpulse(0);
SetInvActivated(player, 10, 0);
DisableIRMode();
brite = 0.00 ;
curlite = 0.0 ;
timermode = 0 ;
set ;
step = 10 ;
steam = 0 ;
offset = 240.00 ;
c_effect = 0.0 ;
speak1 = 0 ;
speak2 = 0 ;
warn = 0 ;
lite_max = 155 ;
warn = 0;
speak1 = 0;
speak2 = 0;
retrun;
activated:
player = GetSourceRef();
#print("headflow");
if(GetInv(player, 10))
{
if(IsInvActivated(player, 10) == 0)
{
if(GetInv(player, 20) > 0)
{
# Print("Infrared activated");
SetInvActivated(player, 10, 1);
#PlaySoundThing(goggleActivate, player, 1.0, -1, -1, 0x80);
effectHandle = newColorEffect(0, 1, 0, 0, 0, 0, 0, 0, 0, 1.0);
EnableIRMode(0.8, 1);
if (speak1 == 0)
{
speak1 = 1;
print("Speak 1");
dwPlayCammySpeech(0, "T8ca004.wav", 10, 1);
# garbage = playsoundlocal(on_c,1.0,0.0,0);
}
garbage = playsoundlocal(on_w,1.0,0.0,0);
sounder = playsoundlocal(loop_w,0.5,0.0,1);
brite = GetSectorAmbient(getthingsector(player))*offset;
brite = brite - (brite % 10); # Rounds the weight to a 10
curlite = brite; #Curlite is the value of the IR, while brite is how brite the sector is.
c_effect = curlite ;
handle = NewColorEffect(0, 0, 0, 0, 0, 0, c_effect, c_effect, c_effect, 1.0);
setpulse(0.25);
}
else
{
# Print("No power for Infrared");
# PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
}
}
else
{
# Print("Infrared deactivated");
SetInvActivated(player, 10, 0);
DisableIRMode();
#PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
if(effectHandle!=-1)
freeColorEffect(effectHandle);
effectHandle = -1;
garbage = playsoundlocal(off_w,1.0,0.0,0);
settimer(0);
if (sounder >-1) {stopsound(sounder,0.5); sounder = -1;}
if (speak2 == 0)
{
speak2 = 1;
print("Speak 2");
dwPlayCammySpeech(0, "T8ca005.wav", 10, 1);
# garbage = playsoundlocal(off_c,1.0,0.0,0);
}
else if ((warn == 2)) //if it was too brite but now it okay
{
timermode = 2;
settimer(1);
}
warn = 0;
SetPulse(0);
# IR overdrive
freeColorEffect(handle);
effectHandle = -1;
setpulse(0);
}
}
return;
# ........................................................................................
pulse:
ChangeInv(player, 20, -15);
if(GetInv(player, 20) == 0)
{
# Print("No power for Infrared");
SetInvActivated(player, 10, 0);
#PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
DisableIRMode();
if(effectHandle!=-1)
{
freeColorEffect(effectHandle);
effectHandle = -1;
}
SetPulse(0);
}
brite = GetSectorAmbient(getthingsector(player))*offset;
brite = brite - (brite % 10); # Rounds the weight to a 10
printint(brite);
if (curlite > brite)
{
curlite = curlite - step;
setpulse(0.01);
if (handle != -1)
FreeColorEffect(handle);
c_effect = curlite;
handle = NewColorEffect(0, 0, 0, 0, 0, 0, c_effect, c_effect, c_effect, 1.0);
}
else if (curlite < brite)
{
curlite = curlite + step;
setpulse(0.01);
if (handle != -1)
FreeColorEffect(handle);
c_effect = curlite;
handle = NewColorEffect(0, 0, 0, 0, 0, 0, c_effect, c_effect, c_effect, 1.0);
}
else if (curlite == brite)
{
setpulse(0.25);
}
if ((curlite > lite_max) && (warn == 0)) //if it's too brite and no warning has been issued
{
warn = 1;
timermode = 1;
settimer(3); //issue warning
print("set brite");
}
if ((curlite < lite_max) && (warn > 0)) //if it was too brite but now it okay
{
if (warn == 2)
{
print("continue");
timermode = 2;
settimer(1);
warn = 0;
}
else
{
print("reset");
warn = 0;
settimer(0);
}
}
return;
timer:
if (timermode == 1) //too brite
{
print("too brite");
dwPlayCammySpeech(0, "T8ca008.wav", 10, 1);
# garbage = playsoundlocal(brite_c,1.0,0.0,0);
warn = 2;
timermode = 3;
settimer(12);
}
else if (timermode == 2) //Better
{
dwPlayCammySpeech(0, "T8ca009.wav", 10, 1);
# garbage = playsoundlocal(better_c,1.0,0.0,0);
print("Better");
}
else if (timermode == 3) // Auto turn off.
{
speak2 = 0; // Have cammy speak
call activated;
}
return;
end