const int TILE_W = 32; const int TILE_H = 32; // Rod 3D game script by James Bunting // weapon numbers const int WEAPON_NONE = 0; const int WEAPON_CHAINSAW = 1; const int WEAPON_PISTOL = 2; const int WEAPON_MACHINE_GUN = 3; const int WEAPON_RIOT_GUN = 4; const int WEAPON_FLAMER = 5; const int WEAPON_RIOT_CANNON = 6; const int WEAPON_HEAT_SEEKER = 7; const int WEAPON_ENERGY_CANNON = 8; const int WEAPON_SUPER_MINIGUN = 9; const int WEAPON_GSX = 10; const int WEAPON_BLOB_PLASMA = 11; const int WEAPON_WORM_PLASMA = 12; // object type numbers int objPlayer; int objBlob; int objWorm; int objChinook; int objAirFighter; int objBird; // projectile type numbers int pSawGore; int pBullet; int pShot; int pEnergyPulse; int pFlames; int pRocket; int pBlobPlasma; int pWormPlasma; int pIon; // weapon sound numbers int sndChainsaw; int sndPistol; int sndMachineGun; int sndRiotGun; int sndFlamer; int sndHeatSeeker; int sndEnergyCannon; int sndGSX; int sndBlobPlasma; int sndWormPlasma; // contact sounds int sndContactRico; int sndContactBoom; int sndContactBeam; int sndContactClang; int sndContactBounce; // death sounds int sndPlayerDie; int sndBlobDie; int sndWormDie; int sndChinookDie; int sndAirFighterDie; int sndBirdDie; // other sound numbers int sndDoor; // ********************************************************************************************************************* void OnMapStart_Global() { // store object type numbers objPlayer = SC_GetObjectTypeNumber("Player"); objBlob = SC_GetObjectTypeNumber("Green Blob"); objWorm = SC_GetObjectTypeNumber("Giant Worm"); objChinook = SC_GetObjectTypeNumber("Chinook"); objAirFighter = SC_GetObjectTypeNumber("Air Fighter"); objBird = SC_GetObjectTypeNumber("Bird"); // store projectile type numbers pSawGore = SC_GetProjectileTypeNumber("Saw Gore"); pBullet = SC_GetProjectileTypeNumber("Bullet"); pShot = SC_GetProjectileTypeNumber("Shot"); pEnergyPulse = SC_GetProjectileTypeNumber("Energy Pulse"); pFlames = SC_GetProjectileTypeNumber("Flames"); pRocket = SC_GetProjectileTypeNumber("Rocket"); pBlobPlasma = SC_GetProjectileTypeNumber("Blob Plasma"); pWormPlasma = SC_GetProjectileTypeNumber("Worm Plasma"); pIon = SC_GetProjectileTypeNumber("Ion"); // store weapon fire sound numbers sndChainsaw = SC_GetSoundNumber("weapons\\chainsaw"); sndPistol = SC_GetSoundNumber("weapons\\pistol"); sndMachineGun = SC_GetSoundNumber("weapons\\uzi"); sndRiotGun = SC_GetSoundNumber("weapons\\shot"); sndFlamer = SC_GetSoundNumber("weapons\\FireFire"); sndHeatSeeker = SC_GetSoundNumber("weapons\\Rocket"); sndEnergyCannon = SC_GetSoundNumber("weapons\\beam"); sndGSX = SC_GetSoundNumber("weapons\\GSX"); sndBlobPlasma = SC_GetSoundNumber("weapons\\plasma"); sndWormPlasma = SC_GetSoundNumber("weapons\\plasmaw"); // store contact sound numbers sndContactRico = SC_GetSoundNumber("contact\\rico"); sndContactBoom = SC_GetSoundNumber("contact\\explode"); sndContactBeam = SC_GetSoundNumber("contact\\lsrhit"); sndContactClang = SC_GetSoundNumber("contact\\clang"); sndContactBounce = SC_GetSoundNumber("contact\\bounce"); // store object die sound numbers sndPlayerDie = SC_GetSoundNumber("objects\\Scream"); sndBlobDie = SC_GetSoundNumber("objects\\BLOBDIE"); sndWormDie = SC_GetSoundNumber("objects\\wormdie"); sndChinookDie = sndContactBoom; sndAirFighterDie = sndContactBoom; sndBirdDie = SC_GetSoundNumber("objects\\bird"); // store other sound numbers sndDoor = SC_GetSoundNumber("switches\\door"); } /* fires a weapon a the specific coordinates (called by the game directly). - WeaponNumber = The weapon number, normally defined by a constant at the top of this file. - OriginX, OriginZ = The 2D coorindates of the projectile's spawn location (the height 'Y' is automatic/common for all projectiles) - angle = The angle to fire at where 0 is up, 64 is right, 128 is down and so on (for example 32 = 45 deg). - OwnerObjectId = The object ID to not hit with the projectile! Use -1 for none. */ void OnFireWeapon( int WeaponNumber, int OriginX, int OriginY, int OriginZ, int angle, int OwnerObjectId) { int i; switch( WeaponNumber) { case WEAPON_CHAINSAW: SC_PlayDirectionalSound( sndChainsaw, OriginX, OriginZ, ""); angle = angle - 3 + SC_Rand(6); // random scatter of 6 SC_SpawnProjectile( pSawGore, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_PISTOL: SC_PlayDirectionalSound( sndPistol, OriginX, OriginZ, ""); SC_SpawnProjectile( pBullet, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_MACHINE_GUN: SC_PlayDirectionalSound( sndMachineGun, OriginX, OriginZ, ""); angle = angle - 1 + SC_Rand(2); // random scatter of 2 SC_SpawnProjectile( pBullet, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_RIOT_GUN: SC_PlayDirectionalSound( sndRiotGun, OriginX, OriginZ, ""); // spawn 6 seperate shot projectiles for( i=0; i<6; i++) { angle = angle - 2 + SC_Rand(4); // random scatter of 4 SC_SpawnProjectile( pShot, OriginX, OriginY, OriginZ, angle, OwnerObjectId); } break; case WEAPON_FLAMER: SC_PlayDirectionalSound( sndFlamer, OriginX, OriginZ, ""); SC_SpawnProjectile( pFlames, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_RIOT_CANNON: SC_PlayDirectionalSound( sndRiotGun, OriginX, OriginZ, ""); break; case WEAPON_HEAT_SEEKER: SC_PlayDirectionalSound( sndHeatSeeker, OriginX, OriginZ, ""); SC_SpawnProjectile( pRocket, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_ENERGY_CANNON: SC_PlayDirectionalSound( sndEnergyCannon, OriginX, OriginZ, ""); angle = angle - 1 + SC_Rand(2); // random scatter of 2 SC_SpawnProjectile( pEnergyPulse, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_SUPER_MINIGUN: SC_PlayDirectionalSound( sndPistol, OriginX, OriginZ, ""); angle = angle - 3 + SC_Rand(6); // random scatter of 6 SC_SpawnProjectile( pBullet, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_GSX: SC_PlayDirectionalSound( sndGSX, OriginX, OriginZ, ""); for( i=0; i<16; ++i) { SC_SpawnProjectile( pIon, OriginX, OriginY, OriginZ, angle, OwnerObjectId); angle += 16; } break; case WEAPON_BLOB_PLASMA: SC_PlayDirectionalSound( sndWormPlasma, OriginX, OriginZ, ""); SC_SpawnProjectile( pBlobPlasma, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; case WEAPON_WORM_PLASMA: SC_PlayDirectionalSound( sndWormPlasma, OriginX, OriginZ, ""); SC_SpawnProjectile( pWormPlasma, OriginX, OriginY, OriginZ, angle, OwnerObjectId); break; default: SC_ConsoleMessage( "FireWeapon: Unknown weapon number" + WeaponNumber); return; } } // ********************************************************************************************************************* void OnProjectileHit( int ProjectileTypeNumber, int PosX, int PosY, int PosZ, int angle, int OwnerObjectId) { if( ProjectileTypeNumber < 0) { return; } else if( ProjectileTypeNumber == pSawGore) { SC_PlayDirectionalSound( sndContactClang, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-4, PosZ-4, PosX+4, PosZ+4, 12, OwnerObjectId); } else if( ProjectileTypeNumber == pBullet) { SC_PlayDirectionalSound( sndContactRico, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-1, PosZ-1, PosX+1, PosZ+1, 7, OwnerObjectId);; } else if( ProjectileTypeNumber == pShot) { SC_PlayDirectionalSound( sndContactRico, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-1, PosZ-1, PosX+1, PosZ+1, 2, OwnerObjectId); } else if( ProjectileTypeNumber == pFlames) { SC_PlayDirectionalSound( sndContactBeam, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-4, PosZ-4, PosX+4, PosZ+4, 16, OwnerObjectId); } else if( ProjectileTypeNumber == pEnergyPulse) { SC_PlayDirectionalSound( sndContactBeam, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-4, PosZ-4, PosX+4, PosZ+4, 10, OwnerObjectId); } else if( ProjectileTypeNumber == pRocket) { SC_PlayDirectionalSound( sndContactBoom, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-20, PosZ-20, PosX+20, PosZ+20, 60, -1); } else if( ProjectileTypeNumber == pIon) { SC_PlayDirectionalSound( sndContactBoom, PosX, PosZ, ""); SC_ApplyDamageToArea( PosX-50, PosZ-50, PosX+50, PosZ+50, 120, -1); } } // ********************************************************************************************************************* void OnObjectTypeDie( int ObjectType, int ObjectId, int PosX, int PosY, int PosZ) { if( ObjectType == objPlayer) { SC_PlayDirectionalSound( sndPlayerDie, PosX, PosZ, ""); } else if( ObjectType == objBlob) { SC_PlayDirectionalSound( sndBlobDie, PosX, PosZ, ""); } else if( ObjectType == objWorm) { SC_PlayDirectionalSound( sndWormDie, PosX, PosZ, ""); } else if( ObjectType == objChinook) { SC_PlayDirectionalSound( sndChinookDie, PosX, PosZ, ""); } else if( ObjectType == objAirFighter) { SC_PlayDirectionalSound( sndAirFighterDie, PosX, PosZ, ""); } else if( ObjectType == objBird) { SC_PlayDirectionalSound( sndBirdDie, PosX, PosZ, ""); } } // ********************************************************************************************************************* // horizontal door void OnPlayerOverTile_109( int TileLocationX, int TileLocationY) { SC_PlayDirectionalSound( sndDoor, TileLocationX * TILE_W, TileLocationY * TILE_H, ""); SC_SetMapTile( TileLocationX, TileLocationY, 111); } // ********************************************************************************************************************* // vertical door void OnPlayerOverTile_110( int TileLocationX, int TileLocationY) { SC_PlayDirectionalSound( sndDoor, TileLocationX * TILE_W, TileLocationY * TILE_H, ""); SC_SetMapTile( TileLocationX, TileLocationY, 112); } // ********************************************************************************************************************* // b = a; // y = x; // j xboob cf b tiffq tippus