home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- int Initialize(string type) {
- global int gProperty;
- global int mystate = 1;
- global string gMessage = "dummy";
- global int gNetwork = 0;
- global real gInRadius = 50.0;
- global real gOutRadius = 90.0;
- global int gNeedAction = 0;
- global int gToggle = 0;
- global real gOpeningTime = 1.5;
- global real gStayOpenTime = 2.0;
- global int gOneTime = 0;
- global int gTurnOff = 0;
- global int gStartSound = 0;
- global int gProgressSound = -1;
- global int gEndSound = -1;
- global int gVoiceOver = -1;
- global string gRemoveObject = "keycard";
- global int gLoopSoundHandle = 0;
- global int gRemoveFromPossesion = 0;
- global int gMsgSnd = -1;
- global real gDisplayTime;
- Reset("hello");
- }
-
- int Reset(string dummy)
- {
- CloseLowLevel();
- mystate = 1;
- SetCollidableProperties(thisObject,1,0);
- SetStyle(thisObject,1);
- gDisplayTime = 0.0;
- stopLoopSound();
- }
-
- int say(string soundname)
- {
- gVoiceOver = GetBrainVOSoundIndex(soundname);
- }
-
- int removeobject(string str)
- {
- gRemoveObject = str;
- }
-
- int removeheldobject(string hello)
- {
- gRemoveFromPossesion = 1;
- }
-
- int msgsnd(string soundname)
- {
- gMsgSnd = GetSoundIndex(soundname);
- }
-
- int stopLoopSound()
- {
- if (gLoopSoundHandle != 0)
- StopSound(thisObject,gLoopSoundHandle);
- gLoopSoundHandle = 0;
- }
-
- int startsound(string soundname)
- {
- gStartSound = GetSoundIndex(soundname);
- }
-
- int endsound(string soundname)
- {
- gEndSound = GetSoundIndex(soundname);
- }
-
- int progresssound(string soundname)
- {
- gProgressSound = GetSoundIndex(soundname);
- }
-
- int onetime(string dummy)
- {
- gOneTime = 1;
- }
-
- int start(string dummy)
- {
- if (gTurnOff == 0)
- {
- if (gOneTime == 1)
- gTurnOff = 1;
- TimedEvent(1);
- }
-
- }
-
- int needaction(string dummy)
- {
- gNeedAction = 1;
-
- }
-
- int toggle(string dummy)
- {
- gToggle = 1;
- }
-
- int TimedEvent(int input)
- {
- real time;
- real phase;
- time = GetTime(thisObject);
- switch (mystate)
- {
- case 1:
- if (input == 1)
- {
- if (gToggle == 1)
- {
- mystate = 4;
- wakeupTime = -1.0;
- if (gProgressSound != -1)
- {
- gLoopSoundHandle = PlaySound(thisObject,gProgressSound,0,1);
- }
- }
- else
- {
- wakeupTime = time + gStayOpenTime;
- mystate = 3;
- }
- OpenLowLevel();
- }
- break;
- case 2:
- {
- if (input == 0)
- {
- phase = AnimGetPhase(thisObject);
- if (phase == 0.0)
- {
- mystate = 1;
- wakeupTime = -1.0;
- }
- else
- {
- wakeupTime = time + 0.1;
- }
- }
- break;
- }
- case 3:
- if (input != 1)
- {
- mystate = 2;
- CloseLowLevel();
- wakeupTime = time + gOpeningTime;
- }
- break;
- case 4:
- if (input == 1)
- {
- mystate = 2;
- CloseLowLevel();
- wakeupTime = time + gOpeningTime;
- stopLoopSound();
- }
- break;
- default:
- break;
- }
-
- }
-
- int OpenLowLevel ()
- {
- Animate(thisObject,1,"flip");
- AnimSetPhase(thisObject,0.0);
- AnimSetDirection(thisObject,0);
- PlaySound(thisObject,gStartSound);
- return 0;
- }
-
- int CloseLowLevel ()
- {
- Animate(thisObject,1,"flip");
- AnimSetPhase(thisObject,1.0);
- AnimSetDirection(thisObject,1);
- PlaySound(thisObject,gEndSound);
- return 0;
- }
-
- int inradius(string str)
- {
- gInRadius = Str2Real(str);
- }
-
- int network(string str)
- {
- gNetwork = Str2Int(str);
- }
-
- int outradius(string str)
- {
- gOutRadius = Str2Real(str);
- }
-
- int Colliders(string dummy) {
- int result;
- int operated;
- map::iterator ix;
- map::iterator iy;
- map objInList;
- real time;
- time = GetTime(thisObject);
- result = 0;
- operated = 0;
- int op2;
-
- if (IsAuthoritative(thisObject) != 1)
- return result;
-
- if (gNeedAction != 1) {
-
- objInList = Collisions(thisObject,0,1,0);
-
- ix = begin(objInList);
- iy = end(objInList);
-
- if (ix != iy)
- {
- start("hello");
- SendMessage(thisObject,gOutRadius,gNetwork);
- }
- } else if (mystate == 1) {
- if (gDisplayTime < time) {
- gDisplayTime = time + 10.0;
- SendEnglishMessage(thisObject);
- PlayVoiceOver(gVoiceOver);
- PlaySound(thisObject, gMsgSnd);
-
- }
- }
- IgnoreCollision(thisObject);
- }
-
- int Action(string key)
- {
- if (IsAuthoritative(thisObject) != 1)
- return;
- start("hello");
- SendMessage(thisObject,gOutRadius,gNetwork);
- if (gRemoveFromPossesion == 1) {
- RemoveObject(thisObject,key,gRemoveObject);
- }
- return 0;
- }
-