void WP_FireBryarPistolMain(gentity_t*ent) { int damage = BRYAR_PISTOL_DAMAGE; gentity_t *missile; if((ent->client->ps.eFlags & EF_DUAL_WEAPONS)) { if(ent->client->leftPistol) missile = CreateMissile(muzzle2, forward, BRYAR_PISTOL_VEL, 10000, ent, qfalse); else missile = CreateMissile(muzzle, forward, BRYAR_PISTOL_VEL, 10000, ent, qfalse ); ent->client->leftPistol = (qboolean)(!ent->client->leftPistol); } else missile = CreateMissile( muzzle, forward, BRYAR_PISTOL_VEL, 10000, ent, qfalse ); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BRYAR_PISTOL; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // we don't want it to bounce forever missile->bounceCount = 8; }
VOID MissileUpdate() { if (m_hero.invincible) return; if (m_missile.active) { if (m_missile.countdown) { m_missile.countdown--; if (!m_missile.countdown) { m_missile = CreateMissile(WNDWIDTH, m_hero.pos.y + 10, 111, 42, TRUE, 0); } else { m_missile.pos.y = m_hero.pos.y + 3; } } else { m_missile.pos.x -= ScorePerFrame * 12; if (m_missile.pos.x + 167 < 0) m_missile.active = false; } } else if (!MissileGenerate && m_hero.alive) { int roll = GetRandomInt(0, LaserRandom); if (roll == 0) { m_missile = CreateMissile(WNDWIDTH - 85, m_hero.pos.y + 3, 64, 56, TRUE, 50); } } }
gentity_t *fire_grapple( gentity_t *self, vector3 *start, vector3 *dir ) { gentity_t *hook; VectorNormalize( dir ); hook = CreateMissile( start, dir, japp_hookSpeed.value, 10000, self, qfalse );//G_Spawn(); hook->classname = "hook"; hook->nextthink = level.time + 10000; hook->think = Weapon_HookFree; hook->s.eType = ET_MISSILE; hook->r.svFlags = SVF_USE_CURRENT_ORIGIN; hook->s.weapon = WP_STUN_BATON;//WP_BRYAR_PISTOL hook->r.ownerNum = self->s.number; hook->methodOfDeath = MOD_STUN_BATON; hook->clipmask = 267009/*MASK_SHOT*/; //From JA+ hook->parent = self; hook->target_ent = NULL; hook->s.pos.trType = TR_LINEAR; hook->s.pos.trTime = level.time - japp_hookSpeed.integer; hook->s.otherEntityNum = self->s.number; // Used to match beam in client if ( self->client->pers.adminData.isGhost ) { hook->r.svFlags |= SVF_SINGLECLIENT; hook->r.singleClient = self->s.number; } VectorCopy( start, &hook->s.pos.trBase ); VectorScale( dir, 800, &hook->s.pos.trDelta ); VectorSnap( &hook->s.pos.trDelta ); // Save net bandwidth VectorCopy( start, &hook->r.currentOrigin ); return hook; }
//--------------------------------------------------------- void WP_FireTurboLaserMissile( gentity_t *ent, vec3_t start, vec3_t dir ) //--------------------------------------------------------- { int velocity = ent->mass; //FIXME: externalize gentity_t *missile; missile = CreateMissile( start, dir, velocity, 10000, ent, qfalse ); //use a custom shot effect //missile->s.otherEntityNum2 = G_EffectIndex( "turret/turb_shot" ); //use a custom impact effect //missile->s.emplacedOwner = G_EffectIndex( "turret/turb_impact" ); missile->classname = "turbo_proj"; missile->s.weapon = WP_TIE_FIGHTER; missile->damage = ent->damage; //FIXME: externalize missile->splashDamage = ent->splashDamage; //FIXME: externalize missile->splashRadius = ent->splashRadius; //FIXME: externalize missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_EMPLACED; //MOD_TURBLAST; //count as a heavy weap missile->splashMethodOfDeath = MOD_EMPLACED; //MOD_TURBLAST;// ?SPLASH; missile->clipmask = MASK_SHOT; // we don't want it to bounce forever missile->bounceCount = 8; //set veh as cgame side owner for purpose of fx overrides //missile->s.owner = ent->s.number; //don't let them last forever missile->e_ThinkFunc = thinkF_G_FreeEntity; missile->nextthink = level.time + 10000;//at 20000 speed, that should be more than enough }
// ATST Main //--------------------------------------------------------- void WP_ATSTMainFire( gentity_t *ent ) //--------------------------------------------------------- { float vel = ATST_MAIN_VEL; // if ( ent->client && (ent->client->ps.eFlags & EF_IN_ATST )) // { // vel = 4500.0f; // } if ( !ent->s.number ) { // player shoots faster vel *= 1.6f; } gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent ); missile->classname = "atst_main_proj"; missile->s.weapon = WP_ATST_MAIN; missile->damage = weaponData[WP_ATST_MAIN].damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK|DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_ENERGY; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->owner = ent; VectorSet( missile->maxs, ATST_MAIN_SIZE, ATST_MAIN_SIZE, ATST_MAIN_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); }
//------------------------------------ void Seeker_Fire( void ) { vec3_t dir, enemy_org, muzzle; gentity_t *missile; CalcEntitySpot( NPCS.NPC->enemy, SPOT_HEAD, enemy_org ); VectorSubtract( enemy_org, NPCS.NPC->r.currentOrigin, dir ); VectorNormalize( dir ); // move a bit forward in the direction we shall shoot in so that the bolt doesn't poke out the other side of the seeker VectorMA( NPCS.NPC->r.currentOrigin, 15, dir, muzzle ); missile = CreateMissile( muzzle, dir, 1000, 10000, NPCS.NPC, qfalse ); G_PlayEffectID( G_EffectIndex("blaster/muzzle_flash"), NPCS.NPC->r.currentOrigin, dir ); missile->classname = "blaster"; missile->s.weapon = WP_BLASTER; missile->damage = 5; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BLASTER; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; if ( NPCS.NPC->r.ownerNum < ENTITYNUM_NONE ) { missile->r.ownerNum = NPCS.NPC->r.ownerNum; } }
/* ------------------------- Remote_Fire ------------------------- */ void Remote_Fire (void) { vec3_t delta1, enemy_org1, muzzle1; vec3_t angleToEnemy1; static vec3_t forward, vright, up; // static vec3_t muzzle; gentity_t *missile; CalcEntitySpot( NPC->enemy, SPOT_HEAD, enemy_org1 ); VectorCopy( NPC->r.currentOrigin, muzzle1 ); VectorSubtract (enemy_org1, muzzle1, delta1); vectoangles ( delta1, angleToEnemy1 ); AngleVectors (angleToEnemy1, forward, vright, up); missile = CreateMissile( NPC->r.currentOrigin, forward, 1000, 10000, NPC, qfalse ); G_PlayEffectID( G_EffectIndex("bryar/muzzle_flash"), NPC->r.currentOrigin, forward ); missile->classname = "briar"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = 10; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BRYAR_PISTOL; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
//------------------------------------------------------------------------------ static void WP_CreateFlechetteBouncyThing( vec3_t start, vec3_t fwd, gentity_t *self ) //------------------------------------------------------------------------------ { gentity_t *missile = CreateMissile( start, fwd, 950 + random() * 700, 1500 + random() * 2000, self, qtrue ); missile->e_ThinkFunc = thinkF_WP_flechette_alt_blow; missile->s.weapon = WP_FLECHETTE; missile->classname = "flech_alt"; missile->mass = 4; // How 'bout we give this thing a size... VectorSet( missile->mins, -3.0f, -3.0f, -3.0f ); VectorSet( missile->maxs, 3.0f, 3.0f, 3.0f ); missile->clipmask = MASK_SHOT; missile->clipmask &= ~CONTENTS_CORPSE; // normal ones bounce, alt ones explode on impact missile->s.pos.trType = TR_GRAVITY; missile->s.eFlags |= EF_BOUNCE_HALF; missile->damage = weaponData[WP_FLECHETTE].altDamage; missile->dflags = 0; missile->splashDamage = weaponData[WP_FLECHETTE].splashDamage; missile->splashRadius = weaponData[WP_FLECHETTE].splashRadius; missile->svFlags = SVF_USE_CURRENT_ORIGIN; missile->methodOfDeath = MOD_FLECHETTE_ALT; missile->splashMethodOfDeath = MOD_FLECHETTE_ALT; VectorCopy( start, missile->pos2 ); }
/* ------------------------- Mark1Dead_FireBlaster - Shoot the left weapon, the multi-blaster ------------------------- */ void Mark1Dead_FireBlaster (void) { vec3_t muzzle1,muzzle_dir; gentity_t *missile; mdxaBone_t boltMatrix; int bolt; bolt = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash1"); trap_G2API_GetBoltMatrix( NPC->ghoul2, 0, bolt, &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time, NULL, NPC->modelScale ); BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 ); BG_GiveMeVectorFromMatrix( &boltMatrix, NEGATIVE_Y, muzzle_dir ); G_PlayEffectID( G_EffectIndex("bryar/muzzle_flash"), muzzle1, muzzle_dir ); missile = CreateMissile( muzzle1, muzzle_dir, 1600, 10000, NPC, qfalse ); G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_fire")); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = 1; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BRYAR_PISTOL; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
/* ------------------------- Mark1Dead_FireBlaster - Shoot the left weapon, the multi-blaster ------------------------- */ void Mark1Dead_FireBlaster (void) { vec3_t muzzle1,muzzle_dir; gentity_t *missile; mdxaBone_t boltMatrix; int bolt; bolt = NPC->genericBolt1; gi.G2API_GetBoltMatrix( NPC->ghoul2, NPC->playerModel, bolt, &boltMatrix, NPC->currentAngles, NPC->currentOrigin, (cg.time?cg.time:level.time), NULL, NPC->s.modelScale ); gi.G2API_GiveMeVectorFromMatrix( boltMatrix, ORIGIN, muzzle1 ); gi.G2API_GiveMeVectorFromMatrix( boltMatrix, NEGATIVE_Y, muzzle_dir ); G_PlayEffect( "bryar/muzzle_flash", muzzle1, muzzle_dir ); missile = CreateMissile( muzzle1, muzzle_dir, 1600, 10000, NPC ); G_Sound( NPC, G_SoundIndex("sound/chars/mark1/misc/mark1_fire")); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = 1; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_ENERGY; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
// Emplaced Gun //--------------------------------------------------------- void WP_EmplacedFire( gentity_t *ent ) //--------------------------------------------------------- { float damage = weaponData[WP_EMPLACED_GUN].damage * ( ent->NPC ? 0.1f : 1.0f ); float vel = EMPLACED_VEL * ( ent->NPC ? 0.4f : 1.0f ); gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent ); missile->classname = "emplaced_proj"; missile->s.weapon = WP_EMPLACED_GUN; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK | DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_EMPLACED; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // do some weird switchery on who the real owner is, we do this so the projectiles don't hit the gun object missile->owner = ent->owner; VectorSet( missile->maxs, EMPLACED_SIZE, EMPLACED_SIZE, EMPLACED_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); // alternate wpMuzzles ent->fxID = !ent->fxID; }
/* ------------------------- ImperialProbe_FireBlaster ------------------------- */ void ImperialProbe_FireBlaster(void) { vec3_t muzzle1,enemy_org1,delta1,angleToEnemy1; static vec3_t forward, vright, up; // static vec3_t muzzle; int genBolt1; gentity_t *missile; mdxaBone_t boltMatrix; genBolt1 = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash"); //FIXME: use {0, NPC->client->ps.legsYaw, 0} trap_G2API_GetBoltMatrix( NPC->ghoul2, 0, genBolt1, &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time, NULL, NPC->modelScale ); BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 ); G_PlayEffectID( G_EffectIndex("bryar/muzzle_flash"), muzzle1, vec3_origin ); G_Sound( NPC, CHAN_AUTO, G_SoundIndex( "sound/chars/probe/misc/fire" )); if (NPC->health) { CalcEntitySpot( NPC->enemy, SPOT_CHEST, enemy_org1 ); enemy_org1[0]+= Q_irand(0,10); enemy_org1[1]+= Q_irand(0,10); VectorSubtract (enemy_org1, muzzle1, delta1); vectoangles ( delta1, angleToEnemy1 ); AngleVectors (angleToEnemy1, forward, vright, up); } else { AngleVectors (NPC->r.currentAngles, forward, vright, up); } missile = CreateMissile( muzzle1, forward, 1600, 10000, NPC, qfalse ); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; if ( g_spskill.integer <= 1 ) { missile->damage = 5; } else { missile->damage = 10; } missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_UNKNOWN; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
/* ------------------------- ImperialProbe_FireBlaster ------------------------- */ void ImperialProbe_FireBlaster(void) { vec3_t muzzle1,enemy_org1,delta1,angleToEnemy1; static vec3_t forward, vright, up; static vec3_t muzzle; gentity_t *missile; mdxaBone_t boltMatrix; //FIXME: use {0, NPC->client->ps.legsYaw, 0} gi.G2API_GetBoltMatrix( NPC->ghoul2, NPC->playerModel, NPC->genericBolt1, &boltMatrix, NPC->currentAngles, NPC->currentOrigin, (cg.time?cg.time:level.time), NULL, NPC->s.modelScale ); gi.G2API_GiveMeVectorFromMatrix( boltMatrix, ORIGIN, muzzle1 ); G_PlayEffect( "bryar/muzzle_flash", muzzle1 ); G_Sound( NPC, G_SoundIndex( "sound/chars/probe/misc/fire" )); if (NPC->health) { CalcEntitySpot( NPC->enemy, SPOT_CHEST, enemy_org1 ); enemy_org1[0]+= Q_irand(0,10); enemy_org1[1]+= Q_irand(0,10); VectorSubtract (enemy_org1, muzzle1, delta1); vectoangles ( delta1, angleToEnemy1 ); AngleVectors (angleToEnemy1, forward, vright, up); } else { AngleVectors (NPC->currentAngles, forward, vright, up); } missile = CreateMissile( muzzle1, forward, 1600, 10000, NPC ); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; if ( g_spskill->integer <= 1 ) { missile->damage = 5; } else { missile->damage = 10; } missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_ENERGY; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
// ATST Alt Side //--------------------------------------------------------- void WP_ATSTSideAltFire( gentity_t *ent ) //--------------------------------------------------------- { int damage = weaponData[WP_ATST_SIDE].altDamage; float vel = ATST_SIDE_ALT_NPC_VELOCITY; if ( ent->client && (ent->client->ps.eFlags & EF_IN_ATST )) { vel = ATST_SIDE_ALT_VELOCITY; } gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, vel, 10000, ent, qtrue ); missile->classname = "atst_rocket"; missile->s.weapon = WP_ATST_SIDE; missile->mass = 10; // Do the damages if ( ent->s.number != 0 ) { if ( g_spskill->integer == 0 ) { damage = ATST_SIDE_ROCKET_NPC_DAMAGE_EASY; } else if ( g_spskill->integer == 1 ) { damage = ATST_SIDE_ROCKET_NPC_DAMAGE_NORMAL; } else { damage = ATST_SIDE_ROCKET_NPC_DAMAGE_HARD; } } VectorCopy( wpFwd, missile->movedir ); // Make it easier to hit things VectorSet( missile->maxs, ATST_SIDE_ALT_ROCKET_SIZE, ATST_SIDE_ALT_ROCKET_SIZE, ATST_SIDE_ALT_ROCKET_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK | DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_EXPLOSIVE; missile->splashMethodOfDeath = MOD_EXPLOSIVE_SPLASH; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // Scale damage down a bit if it is coming from an NPC missile->splashDamage = weaponData[WP_ATST_SIDE].altSplashDamage * ( ent->s.number == 0 ? 1.0f : ATST_SIDE_ALT_ROCKET_SPLASH_SCALE ); missile->splashRadius = weaponData[WP_ATST_SIDE].altSplashRadius; // we don't want it to ever bounce missile->bounceCount = 0; }
//--------------------------------------------------------- static void WP_BowcasterAltFire( gentity_t *ent ) //--------------------------------------------------------- { vec3_t start; int damage = weaponData[WP_BOWCASTER].altDamage; VectorCopy( muzzle, start ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_MissileTargetHint(ent, start, forwardVec); gentity_t *missile = CreateMissile( start, forwardVec, BOWCASTER_VELOCITY, 10000, ent, qtrue ); missile->classname = "bowcaster_alt_proj"; missile->s.weapon = WP_BOWCASTER; // Do the damages if ( ent->s.number != 0 ) { if ( g_spskill->integer == 0 ) { damage = BOWCASTER_NPC_DAMAGE_EASY; } else if ( g_spskill->integer == 1 ) { damage = BOWCASTER_NPC_DAMAGE_NORMAL; } else { damage = BOWCASTER_NPC_DAMAGE_HARD; } } VectorSet( missile->maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); // if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time ) // { // // in overcharge mode, so doing double damage // missile->flags |= FL_OVERCHARGED; // damage *= 2; // } missile->s.eFlags |= EF_BOUNCE; missile->bounceCount = 3; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BOWCASTER_ALT; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = weaponData[WP_BOWCASTER].altSplashDamage; missile->splashRadius = weaponData[WP_BOWCASTER].altSplashRadius; }
void WP_FireTuskenRifle(gentity_t*ent,qboolean altFire) { int damage = TUSKEN_DAMAGE; gentity_t*missile = CreateMissile( muzzle, forward, 3650, 10000, ent, altFire ); missile->classname = "tusken_proj"; missile->s.weapon = WP_TUSKEN_RIFLE; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_STUN_BATON; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->bounceCount = 8; }
// Bot Laser //--------------------------------------------------------- void WP_BotLaser( gentity_t *ent ) //--------------------------------------------------------- { gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, BRYAR_PISTOL_VEL, 10000, ent ); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = weaponData[WP_BOT_LASER].damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_ENERGY; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
//--------------------------------------------------------- static void WP_DEMP2_MainFire( gentity_t *ent ) //--------------------------------------------------------- { vec3_t start; int damage = weaponData[WP_DEMP2].damage; VectorCopy( muzzle, start ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_MissileTargetHint(ent, start, forwardVec); gentity_t *missile = CreateMissile( start, forwardVec, DEMP2_VELOCITY, 10000, ent ); missile->classname = "demp2_proj"; missile->s.weapon = WP_DEMP2; // Do the damages if ( ent->s.number != 0 ) { if ( g_spskill->integer == 0 ) { damage = DEMP2_NPC_DAMAGE_EASY; } else if ( g_spskill->integer == 1 ) { damage = DEMP2_NPC_DAMAGE_NORMAL; } else { damage = DEMP2_NPC_DAMAGE_HARD; } } VectorSet( missile->maxs, DEMP2_SIZE, DEMP2_SIZE, DEMP2_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); // if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time ) // { // // in overcharge mode, so doing double damage // missile->flags |= FL_OVERCHARGED; // damage *= 2; // } missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_DEMP2; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // we don't want it to ever bounce missile->bounceCount = 0; }
//--------------------------------------------------------- static void WP_DEMP2_AltFire( gentity_t *ent ) //--------------------------------------------------------- { int damage = weaponData[WP_REPEATER].altDamage; int count; vec3_t start; trace_t tr; VectorCopy( muzzle, start ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall count = ( level.time - ent->client->ps.weaponChargeTime ) / DEMP2_CHARGE_UNIT; if ( count < 1 ) { count = 1; } else if ( count > 3 ) { count = 3; } damage *= ( 1 + ( count * ( count - 1 )));// yields damage of 12,36,84...gives a higher bonus for longer charge // the shot can travel a whopping 4096 units in 1 second. Note that the shot will auto-detonate at 4096 units...we'll see if this looks cool or not WP_MissileTargetHint(ent, start, forwardVec); gentity_t *missile = CreateMissile( start, forwardVec, DEMP2_ALT_RANGE, 1000, ent, qtrue ); // letting it know what the charge size is. missile->count = count; // missile->speed = missile->nextthink; VectorCopy( tr.plane.normal, missile->pos1 ); missile->classname = "demp2_alt_proj"; missile->s.weapon = WP_DEMP2; missile->e_ThinkFunc = thinkF_DEMP2_AltDetonate; missile->splashDamage = missile->damage = damage; missile->splashMethodOfDeath = missile->methodOfDeath = MOD_DEMP2_ALT; missile->splashRadius = weaponData[WP_DEMP2].altSplashRadius; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // we don't want it to ever bounce missile->bounceCount = 0; }
void WP_BowcasterMainFire( gentity_t *ent ) { int damage = BOWCASTER_DAMAGE, count=1,dp=0; float vel; vec3_t angs, dir; gentity_t *missile; int i=0; dp = (level.time - ent->client->ps.weaponChargeTime) / BOWCASTER_CHARGE_UNIT; if ( dp < 1 ) { dp = 1; } else if ( dp > BRYAR_MAX_CHARGE ) { dp = BRYAR_MAX_CHARGE; } // create a range of different velocities vel = BOWCASTER_VELOCITY * ( crandom() * BOWCASTER_VEL_RANGE + 1.0f ); vectoangles( forward, angs ); // add some slop to the alt-fire direction angs[PITCH] += crandom() * BOWCASTER_ALT_SPREAD * 0.2f; angs[YAW] += ((i+0.5f) * BOWCASTER_ALT_SPREAD - count * 0.5f * BOWCASTER_ALT_SPREAD ); AngleVectors( angs, dir, NULL, NULL ); missile = CreateMissile( muzzle, dir, vel, 10000, ent, qtrue ); missile->classname = "bowcaster_alt_proj"; missile->s.weapon = WP_BOWCASTER; VectorSet( missile->r.maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE ); VectorScale( missile->r.maxs, -1, missile->r.mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BOWCASTER; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->s.generic1 = dp; ent->client->ps.userInt2=dp; // we don't want it to bounce missile->bounceCount = 0; missile->damageDecreaseTime = level.time + 300; }
/* ------------------------- Mark1_FireRocket ------------------------- */ void Mark1_FireRocket(void) { mdxaBone_t boltMatrix; vec3_t muzzle1,enemy_org1,delta1,angleToEnemy1; static vec3_t forward, vright, up; int bolt = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash5"); gentity_t *missile; int damage = 50; trap_G2API_GetBoltMatrix( NPC->ghoul2, 0, bolt, &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time, NULL, NPC->modelScale ); BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 ); // G_PlayEffect( "blaster/muzzle_flash", muzzle1 ); CalcEntitySpot( NPC->enemy, SPOT_HEAD, enemy_org1 ); VectorSubtract (enemy_org1, muzzle1, delta1); vectoangles ( delta1, angleToEnemy1 ); AngleVectors (angleToEnemy1, forward, vright, up); G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_fire" )); missile = CreateMissile( muzzle1, forward, BOWCASTER_VELOCITY, 10000, NPC, qfalse ); missile->classname = "bowcaster_proj"; missile->s.weapon = WP_BOWCASTER; VectorSet( missile->r.maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE ); VectorScale( missile->r.maxs, -1, missile->r.mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_ROCKET; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = BOWCASTER_SPLASH_DAMAGE; missile->splashRadius = BOWCASTER_SPLASH_RADIUS; // we don't want it to bounce missile->bounceCount = 0; }
/* * AttemptFiring * * Have the alien fire at the hero. */ void AttemptFiring (typUnit *unit) { typUnit *missile; /* --- Close enough to shoot at --- */ if (DistanceBetween (hero, unit) < (nScreenWidth / 2)) { /* --- Random chance - less than unit's chance --- */ if ((rand () % 100) < unit->pctFiring) { /* --- Create the missle going after the hero --- */ missile = CreateMissile (unit, hero); /* --- Add to the list of units --- */ unitList = g_list_append (unitList, missile); } } }
//--------------------------------------------------------- static void WP_DropDetPack( gentity_t *self, vec3_t start, vec3_t dir ) //--------------------------------------------------------- { // Chucking a new one AngleVectors( self->client->ps.viewangles, forwardVec, vrightVec, up ); CalcMuzzlePoint( self, forwardVec, vrightVec, up, muzzle, 0 ); VectorNormalize( forwardVec ); VectorMA( muzzle, -4, forwardVec, muzzle ); VectorCopy( muzzle, start ); WP_TraceSetStart( self, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall gentity_t *missile = CreateMissile( start, forwardVec, 300, 10000, self, qfalse ); missile->fxID = G_EffectIndex( "detpack/explosion" ); // if we set an explosion effect, explode death can use that instead missile->classname = "detpack"; missile->s.weapon = WP_DET_PACK; missile->s.pos.trType = TR_GRAVITY; missile->s.eFlags |= EF_MISSILE_STICK; missile->e_TouchFunc = touchF_charge_stick; missile->damage = weaponData[WP_DET_PACK].damage; missile->methodOfDeath = MOD_DETPACK; missile->splashDamage = weaponData[WP_DET_PACK].splashDamage; missile->splashRadius = weaponData[WP_DET_PACK].splashRadius; missile->splashMethodOfDeath = MOD_DETPACK;// ?SPLASH; missile->clipmask = (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_SHOTCLIP);//MASK_SHOT; // we don't want it to ever bounce missile->bounceCount = 0; missile->s.radius = 30; VectorSet( missile->s.modelScale, 1.0f, 1.0f, 1.0f ); gi.G2API_InitGhoul2Model( missile->ghoul2, weaponData[WP_DET_PACK].missileMdl, G_ModelIndex( weaponData[WP_DET_PACK].missileMdl ), NULL_HANDLE, NULL_HANDLE, 0, 0); AddSoundEvent( NULL, missile->currentOrigin, 128, AEL_MINOR, qtrue ); AddSightEvent( NULL, missile->currentOrigin, 128, AEL_SUSPICIOUS, 10 ); }
void WP_BowcasterAltFire( gentity_t *ent ) { int damage = BOWCASTER_DAMAGE; gentity_t *missile = CreateMissile( muzzle, forward, BOWCASTER_VELOCITY, 10000, ent, qfalse); missile->classname = "bowcaster_proj"; missile->s.weapon = WP_BOWCASTER; VectorSet( missile->r.maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE ); VectorScale( missile->r.maxs, -1, missile->r.mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BOWCASTER; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->damageDecreaseTime = level.time + 300; }
/* ------------------------- Mark2_FireBlaster ------------------------- */ void Mark2_FireBlaster(qboolean advance) { vec3_t muzzle1,enemy_org1,delta1,angleToEnemy1; static vec3_t forward, vright, up; static vec3_t muzzle; gentity_t *missile; mdxaBone_t boltMatrix; int bolt = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash"); trap_G2API_GetBoltMatrix( NPC->ghoul2, 0, bolt, &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time, NULL, NPC->modelScale ); BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 ); if (NPC->health) { CalcEntitySpot( NPC->enemy, SPOT_HEAD, enemy_org1 ); VectorSubtract (enemy_org1, muzzle1, delta1); vectoangles ( delta1, angleToEnemy1 ); AngleVectors (angleToEnemy1, forward, vright, up); } else { AngleVectors (NPC->r.currentAngles, forward, vright, up); } G_PlayEffectID( G_EffectIndex("bryar/muzzle_flash"), muzzle1, forward ); G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark2/misc/mark2_fire")); missile = CreateMissile( muzzle1, forward, 1600, 10000, NPC, qfalse ); missile->classname = "bryar_proj"; missile->s.weapon = WP_BRYAR_PISTOL; missile->damage = 1; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BRYAR_PISTOL; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; }
//========================================================= // HandleAnimEvent - catches the monster-specific messages // that occur when tagged animation frames are played. //========================================================= void CShalrath :: HandleAnimEvent( MonsterEvent_t *pEvent ) { switch( pEvent->event ) { case SHALRATH_IDLE_SOUND: if( RANDOM_FLOAT( 0.0f, 1.0f ) < 0.05f ) EMIT_SOUND( edict(), CHAN_VOICE, "shalrath/idle.wav", 1.0, ATTN_IDLE ); break; case SHALRATH_ATTACK: CreateMissile(); break; case SHALRATH_ATTACK_SOUND: EMIT_SOUND( edict(), CHAN_VOICE, "shalrath/attack.wav", 1.0, ATTN_IDLE ); break; default: CQuakeMonster::HandleAnimEvent( pEvent ); break; } }
// ATST Side //--------------------------------------------------------- void WP_ATSTSideFire( gentity_t *ent ) //--------------------------------------------------------- { int damage = weaponData[WP_ATST_SIDE].damage; gentity_t *missile = CreateMissile( wpMuzzle, wpFwd, ATST_SIDE_MAIN_VELOCITY, 10000, ent, qfalse ); missile->classname = "atst_side_proj"; missile->s.weapon = WP_ATST_SIDE; // Do the damages if ( ent->s.number != 0 ) { if ( g_spskill->integer == 0 ) { damage = ATST_SIDE_MAIN_NPC_DAMAGE_EASY; } else if ( g_spskill->integer == 1 ) { damage = ATST_SIDE_MAIN_NPC_DAMAGE_NORMAL; } else { damage = ATST_SIDE_MAIN_NPC_DAMAGE_HARD; } } VectorSet( missile->maxs, ATST_SIDE_MAIN_SIZE, ATST_SIDE_MAIN_SIZE, ATST_SIDE_MAIN_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK|DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_ENERGY; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = weaponData[WP_ATST_SIDE].splashDamage * ( ent->s.number == 0 ? 1.0f : 0.6f ); missile->splashRadius = weaponData[WP_ATST_SIDE].splashRadius; // we don't want it to bounce missile->bounceCount = 0; }
/* ------------------------- Mark1Dead_FireRocket - Shoot the left weapon, the multi-blaster ------------------------- */ void Mark1Dead_FireRocket (void) { mdxaBone_t boltMatrix; vec3_t muzzle1,muzzle_dir; gentity_t *missile; int damage = 50; int bolt = trap_G2API_AddBolt(NPC->ghoul2, 0, "*flash5"); trap_G2API_GetBoltMatrix( NPC->ghoul2, 0, bolt, &boltMatrix, NPC->r.currentAngles, NPC->r.currentOrigin, level.time, NULL, NPC->modelScale ); BG_GiveMeVectorFromMatrix( &boltMatrix, ORIGIN, muzzle1 ); BG_GiveMeVectorFromMatrix( &boltMatrix, NEGATIVE_Y, muzzle_dir ); G_PlayEffectID( G_EffectIndex("bryar/muzzle_flash"), muzzle1, muzzle_dir ); G_Sound( NPC, CHAN_AUTO, G_SoundIndex("sound/chars/mark1/misc/mark1_fire")); missile = CreateMissile( muzzle1, muzzle_dir, BOWCASTER_VELOCITY, 10000, NPC, qfalse ); missile->classname = "bowcaster_proj"; missile->s.weapon = WP_BOWCASTER; VectorSet( missile->r.maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE ); VectorScale( missile->r.maxs, -1, missile->r.mins ); missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; //missile->methodOfDeath = MOD_ENERGY; missile->methodOfDeath = MOD_ROCKET; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = BOWCASTER_SPLASH_DAMAGE; missile->splashRadius = BOWCASTER_SPLASH_RADIUS; // we don't want it to bounce missile->bounceCount = 0; }
void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire ) { int velocity = BLASTER_VELOCITY; int damage = BLASTER_DAMAGE; gentity_t *missile; if (ent->s.eType == ET_NPC) damage = 90; missile = CreateMissile( start, dir, velocity, 10000, ent, altFire ); missile->classname = "blaster_proj"; missile->s.weapon = WP_BLASTER; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK; missile->methodOfDeath = MOD_BLASTER; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // we don't want it to bounce forever missile->bounceCount = 8; }
// Emplaced Gun //--------------------------------------------------------- void WP_EmplacedFire( gentity_t *ent ) //--------------------------------------------------------- { float damage = weaponData[WP_EMPLACED_GUN].damage * ( ent->NPC ? 0.1f : 1.0f ); float vel = EMPLACED_VEL * ( ent->NPC ? 0.4f : 1.0f ); WP_MissileTargetHint(ent, muzzle, forwardVec); gentity_t *missile = CreateMissile( muzzle, forwardVec, vel, 10000, ent ); missile->classname = "emplaced_proj"; missile->s.weapon = WP_EMPLACED_GUN; missile->damage = damage; missile->dflags = DAMAGE_DEATH_KNOCKBACK | DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_EMPLACED; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; // do some weird switchery on who the real owner is, we do this so the projectiles don't hit the gun object if ( ent && ent->client && !(ent->client->ps.eFlags&EF_LOCKED_TO_WEAPON) ) { missile->owner = ent; } else { missile->owner = ent->owner; } if ( missile->owner->e_UseFunc == useF_eweb_use ) { missile->alt_fire = qtrue; } VectorSet( missile->maxs, EMPLACED_SIZE, EMPLACED_SIZE, EMPLACED_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); // alternate muzzles ent->fxID = !ent->fxID; }