home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- int Initialize(string type)
- {
- global int state = 0;
- global real repeatTime = 1.00;
- global string gProjType = "grenade";
- global int gGravity = 0;
- global int gBulletCount = 20;
- global int gClipSize = 5;
- global int gStartSound = 7;
- global int gProgressSound = 18;
- global int gEndSound = -1;
- global int gReloadSound = -1;
- global real gMass = 5.0;
-
-
-
-
-
-
- Reset("dummy");
- return 0;
-
- }
-
- int Reset(string dummy)
- {
- Animate(thisObject,0,"fire");
- wakeupTime = 2.0;
- gBulletCount = gClipSize;
- SetStyle(thisObject,2);
-
- state = 0;
- return 0;
- }
-
- int startsound(string soundname)
- {
- gStartSound = GetSoundIndex(soundname);
-
- }
-
- int endsound(string soundname)
- {
- gEndSound = GetSoundIndex(soundname);
-
- }
-
- int progresssound(string soundname)
- {
- gProgressSound = GetSoundIndex(soundname);
-
- }
-
- int reloadsound(string soundname)
- {
- gReloadSound = GetSoundIndex(soundname);
-
- }
-
- int projtype(string str)
- {
- gProjType = str;
- }
-
- int repeattime(string str)
- {
- repeatTime = Str2Real(str);
- return 0;
- }
-
- int gravity(string flag)
- {
- int value;
- value = Str2Int(flag);
-
- gGravity = value;
- SetCollidableProperties(thisObject,gGravity,0);
- }
-
- int clipsize(string count)
- {
- gClipSize = Str2Int(count);
- gBulletCount = gClipSize;
- }
-
- int GetMaxAmmo(string dummy)
- {
- ReturnValue(thisObject, gClipSize);
- }
-
- int addammo(string count)
- {
- int value = Str2Int(count);
- gBulletCount = gBulletCount + value;
- }
-
- int reload(string count)
- {
- int add;
- add = Str2Int(count);
- if (add > 0)
- {
- PlaySound(thisObject,gReloadSound);
- gBulletCount += add;
- }
- }
-
- int AmmoCount(string dum)
- {
- ReturnValue(thisObject,gBulletCount);
- }
-
- int SetBulletCount(int count)
- {
- gBulletCount = count;
- }
-
- int Drop(string dummy)
- {
- int returnBullet;
- SetScale(thisObject,2.0);
- PlaySound(thisObject,38);
- SetStyle(thisObject,2);
-
- ReturnValue(thisObject,0);
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
- int Draw(string ammoCount)
- {
- gBulletCount = Str2Int(ammoCount);
- }
-
- int Pickup(string dummy)
- {
- ReturnValue(thisObject,gBulletCount);
- gBulletCount = 0;
- }
-
- int Holster(string dummy)
- {
- ReturnValue(thisObject,gBulletCount);
- gBulletCount = 0;
- }
-
- int Colliders(string dummy)
- {
-
- map::iterator ix;
- map objInList;
- int value;
- print("proj 1");
- objInList = Collisions(thisObject,0,1,0);
- print("proj 2");
-
- for (ix = begin(objInList) ;ix != end(objInList); ++ix)
- {
- print("proj 3");
- value = AddObjectTo(first(dereference(ix)),thisObject);
- print("proj 4");
- if (value != 0)
- {
- print("proj 5");
- PlaySound(thisObject,35);
- print("proj 6");
- SetScale(thisObject,1.0);
- print("proj 7");
- break;
- }
- }
-
- return 0;
- }
-
- int GetFireTime(string dummy)
- {
- ReturnValueReal(thisObject,repeatTime);
- return 0;
- }
-
- int FireFulfill(int hit)
- {
- real time;
- int theGrenade;
- time = GetTime(thisObject);
-
- state = 2;
- gBulletCount--;
- Animate(thisObject,1,"fire");
-
- theGrenade = MakeProjectile(thisObject,gProjType);
- LaunchMuzzleFlash(thisObject);
-
- ParentFire(thisObject);
- if (theGrenade != 0)
- Launch(thisObject,theGrenade,1,80.0,5.0);
-
- wakeupTime = time + repeatTime;
- }
-
- int Fire(int flag)
- {
- int result = 0;
-
- if (UnlimitedAmmo(thisObject) == 1)
- gBulletCount = gClipSize;
- if (state == 0)
- {
-
- {
- if (gBulletCount >= 1)
- {
- state = 2;
- FireSaveInfo(thisObject,1,gBulletCount,gMass);
- FireCommand(thisObject);
-
- result = 1;
- }
- else
- {
- ParentReloadCommand(thisObject);
- }
- }
- }
- ReturnValue(thisObject,result);
- return result;
- }
-
- int TimedEvent(int input)
- {
- Animate(thisObject,0,"fire");
- PlaySound(thisObject,gEndSound);
- state = 0;
- wakeupTime = -1.0;
- return 0;
- }
-
-
-