home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 52
/
ClassicFond52.iso
/
GAMES
/
DROIDW.RAR
/
DWCD.GOB
/
mission_cog_b0_gear.cog
< prev
next >
Wrap
Text File
|
1998-11-04
|
19KB
|
558 lines
# Droids Cog Script
#
# b0_Gear.cog
#
# Gear Cog controlling movement of the bridge and gears assmebly.
#
# Desc:
# bin 25 Small Gears
# bin 26 Medium Gear
# bin 27 Large Gear
#
# This cog is responsible for keeping track of what gears are in the Gear assembly
# and where. It's also in charge of mocing the bridge either up or down depending on
# how the gears are in place. There are seperate cogs for the gear pieces themselves
# when found on the ground. After they've been placed in the gear assembly, they're
# part of this script.
#
#
# 10/23/97 [DGS] Created
# 01/19/97 [DGS] Updated for new controls.
# 01/21/97 [DGS] Rewrote majority of it; added new Used and Taken sections
# ========================================================================================
symbols
message used
message startup
message arrived
message user0
message taken
message timer
## ================Parts
thing screw0 linkid=11
thing screw1 linkid=11
thing screw2 linkid=11
thing screw3 linkid=11
thing gear_top linkid=11
thing gear_bot linkid=11
thing platform linkid=3
thing spind linkid=11
surface Button0 linkid=2
## ==================Ghost objects
thing l_spindle_g linkid=30
thing r_spindle1_g linkid=31
thing r_spindle2_g linkid=32
## ===================Ghost creation integers
int l_spindle_i=0 linkid=11 local
int r_spindle1_i=0 local
int r_spindle2_i=0 local
## ====================Spin Directon integers
flex l_spindle_d=0.0 local
flex r_spindle1_d=0.0 local
flex r_spindle2_d=0.0 local
flex t_gear_d=0.0 local
## =====================templates
template gear_large_t
template gear_small_t
template gear_med_t
## ======================Sectors
sector L_Sector
sector R_sector
## ======================Sounds
sound gearon_snd
sound gearongfsdfsf_snd
sound gearoff_snd
sound mstart_snd
sound mstop_snd
sound mfree_snd
sound mstress_snd
sound gearbog_snd
## ======================Cogs
cog button_cog
thing ghost_cam
int l_spindle_m=0 local
int r_spindle1_m=0 local
int r_spindle1_m=0 local
## ======================Internal variables
float speed=2.0 local
int on_button=0 local
int rotate local
int l_spindle=0 local
int r_spindle1=0 local
int r_spindle2=0 local
int timermode=0 local
int part_id=0 local
int g_sound=0 local
end
# ========================================================================================
code
startup:
//
//print("rotate it");
//rotate = 1;
//l_spindle_d = 1;
//r_spindle1_d = -0.5;
//r_spindle2_d = 0.5;
//call rotate_gears;
AttachThingToThing(screw0, gear_top);
AttachThingToThing(screw1, gear_top);
AttachThingToThing(screw2, gear_top);
AttachThingToThing(ghost_cam, platform);
//AttachThingToThing(screw3, screw0);
MoveToFrame(platform, 1, 50);
//RotatePivot(screw0, 1, 1);
sleep(5);
print("Gear mode:");
printint(screw0);
printint(screw1);
printint(screw2);
return;
# ........................................................................................
user0:
// User0 gets called when the player hits the motor switch. See gear_activate.cog
print("user0");
if (rotate == 0) call start_motor;
return;
used:
// Section is executed when the user uses an inventory object. Cool.
print("USED:");
printint(dwGetActivateBin());
printint(getsenderid());
if (rotate == 0)
{
if ( getinv(getlocalplayerthing(),dwGetActivateBin()) > 0) //if the bin has more than 0 in it;
{
if ((GetSenderId() == 11) || (getsenderref() == r_spindle1_i) || (getsenderref() == r_spindle2_i)) // It's used on the gear_bot
{
// The Gear Assembly was activated
if (getthingsector(getlocalplayerthing()) == l_sector)
{
//=================== Player is on the Large gear side of the gear assembly
print("Activated L sector");
call handle_l;
}
if (getthingsector(getlocalplayerthing()) == r_sector)
{
//=================== Player is on the Small gear side of the gear assembly
print("Activated R sector");
call handle_r;
}
}
}
}
return;
taken:
print("taken");
printint(r_spindle1_i);
printint(r_spindle2_i);
printint(getsenderref());
printint ((GetSenderId() == 11) || (getsenderref() == r_spindle1_i) || (getsenderref() == r_spindle1_i));
// Taken gets called when the user attempts to take a gear from left or right of the gear assembly.
if (rotate == 0)
{
if ((GetSenderId() == 11)) // if it's the gear_bot that got activated
{
print("Inside");
// The Gear Assembly was activated
if (getthingsector(getlocalplayerthing()) == l_sector)
{
//=================== Player is taking stuff from the left side of the gear assembly
if (l_spindle != 0)
{
// inc the bin to add it back to the inv, destroy the environment one ans set l_spindle to 0.
ChangeInv(getlocalplayerthing(), l_spindle, 1);
destroything(l_spindle_i);
l_spindle = 0;
//dwSetPlayerMass(dwGetPlayerMass() + l_spindle_m);
l_spindle_m = 0;
call update_bins;
PlaySoundThing(gearoff_snd, l_spindle_g, 1, -1, -1, 0);
}
else
{
// TELL THE PLAYER THERE'S NOTHING TO TAKE
dwPlayCammySpeech(17305, "t9ca006.wav", 10, 0);
timermode = 2;
settimer(10);
}
}
if (getthingsector(getlocalplayerthing()) == r_sector)
{
//=================== Player is on the Small gear side of the gear assembly
if (r_spindle1 != 0) //if the top spindle (1) has something on it.
{
// inc the bin to add it back to the inv, destroy the environment one ans set r_spindle1 to 0.
ChangeInv(getlocalplayerthing(), r_spindle1, 1);
//releasething(r_spindle1_i);
destroything(r_spindle1_i);
r_spindle1 = 0;
//dwSetPlayerMass(dwGetPlayerMass() + r_spindle1_m);
r_spindle1_m - 0;
call update_bins;
PlaySoundThing(gearoff_snd, r_spindle1_g, 1, -1, -1, 0);
}
else if (r_spindle2 != 0) //if the bottom spindle (2) has something on it
{
// inc the bin to add it back to the inv, destroy the environment one ans set r_spindle2 to 0.
ChangeInv(getlocalplayerthing(), r_spindle2, 1);
//releasething(r_spindle2_i);
destroything(r_spindle2_i);
r_spindle2 = 0;
//dwSetPlayerMass(dwGetPlayerMass() + r_spindle2_m);
r_spindle2_m - 0;
PlaySoundThing(gearoff_snd, r_spindle1_g, 1, -1, -1, 0);
call update_bins;
}
else //else there's nothing on this side. Both spindles are empty.
{
dwPlayCammySpeech(17305, "t9ca006.wav", 10, 0); //There's nothing to take
timermode = 2;
settimer(10);
}
}
}
}
return;
grind_gears:
// Controls causing the grind sound .
garbage = PlaySoundThing(gearbog_snd, gear_bot, 1, -1, -1, 0);
dwPlayCammySpeech(17313, "t9ca014.wav", 10, 0);
timermode = 3;
settimer(1);
return;
start_motor:
if ( (l_spindle == 27) && (r_spindle1 == 25) && (r_spindle2 == 25) ) // if all the grears are in place
{
r_spindle2_d = 0;
r_spindle1_d = 0;
l_spindle_d = 0;
//
call grind_gears;
}
else // Else set up the way it's all gonna spin
{ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Set motion/direction
t_gear_d = 0; //Assume that if the top gear is going to move, the below lines will set it that way.
// These if/else statements set up the speeds and directions for the gears on the 3 spindles.
if (l_spindle == 27)//if it's the large gear in the left spindle
{
l_spindle_d = -1; //set the direction to -0.5
t_gear_d = -0.5; //set the top gears direction.
}
else l_spindle_d = 0;// else set the gears speed to 0, since md. and sm. gears don't touch the upper and lower gears when th