public static void fire_bfg( edict_t self, float[] start, float[] dir, int damage, int speed, float damage_radius) { edict_t bfg; bfg = GameUtil.G_Spawn(); Math3D.VectorCopy(start, bfg.s.origin); Math3D.VectorCopy(dir, bfg.movedir); Math3D.vectoangles(dir, bfg.s.angles); Math3D.VectorScale(dir, speed, bfg.velocity); bfg.movetype = Defines.MOVETYPE_FLYMISSILE; bfg.clipmask = Defines.MASK_SHOT; bfg.solid = Defines.SOLID_BBOX; bfg.s.effects |= Defines.EF_BFG | Defines.EF_ANIM_ALLFAST; Math3D.VectorClear(bfg.mins); Math3D.VectorClear(bfg.maxs); bfg.s.modelindex = GameBase.gi.modelindex("sprites/s_bfg1.sp2"); bfg.owner = self; bfg.touch = bfg_touch; bfg.nextthink = GameBase.level.time + 8000 / speed; bfg.think = GameUtil.G_FreeEdictA; bfg.radius_dmg = damage; bfg.dmg_radius = damage_radius; bfg.classname = "bfg blast"; bfg.s.sound = GameBase.gi.soundindex("weapons/bfg__l1a.wav"); bfg.think = bfg_think; bfg.nextthink = GameBase.level.time + Defines.FRAMETIME; bfg.teammaster = bfg; bfg.teamchain = null; if (self.client != null) check_dodge(self, bfg.s.origin, dir, speed); GameBase.gi.linkentity(bfg); }
/** Returns the created target changelevel. */ public static Entity CreateTargetChangeLevel(String map) { Entity ent; ent = GameUtil.G_Spawn(); ent.classname = "target_changelevel"; level.nextmap = map; ent.map = level.nextmap; return ent; }
public static void fire_grenade2( edict_t self, float[] start, float[] aimdir, int damage, int speed, float timer, float damage_radius, boolean held) { edict_t grenade; float[] dir = {0, 0, 0}; float[] forward = {0, 0, 0}, right = {0, 0, 0}, up = {0, 0, 0}; Math3D.vectoangles(aimdir, dir); Math3D.AngleVectors(dir, forward, right, up); grenade = GameUtil.G_Spawn(); Math3D.VectorCopy(start, grenade.s.origin); Math3D.VectorScale(aimdir, speed, grenade.velocity); Math3D.VectorMA(grenade.velocity, 200f + Lib.crandom() * 10.0f, up, grenade.velocity); Math3D.VectorMA(grenade.velocity, Lib.crandom() * 10.0f, right, grenade.velocity); Math3D.VectorSet(grenade.avelocity, 300f, 300f, 300f); grenade.movetype = Defines.MOVETYPE_BOUNCE; grenade.clipmask = Defines.MASK_SHOT; grenade.solid = Defines.SOLID_BBOX; grenade.s.effects |= Defines.EF_GRENADE; Math3D.VectorClear(grenade.mins); Math3D.VectorClear(grenade.maxs); grenade.s.modelindex = GameBase.gi.modelindex("models/objects/grenade2/tris.md2"); grenade.owner = self; grenade.touch = Grenade_Touch; grenade.nextthink = GameBase.level.time + timer; grenade.think = Grenade_Explode; grenade.dmg = damage; grenade.dmg_radius = damage_radius; grenade.classname = "hgrenade"; if (held) grenade.spawnflags = 3; else grenade.spawnflags = 1; grenade.s.sound = GameBase.gi.soundindex("weapons/hgrenc1b.wav"); if (timer <= 0.0) Grenade_Explode.think(grenade); else { GameBase.gi.sound( self, Defines.CHAN_WEAPON, GameBase.gi.soundindex("weapons/hgrent1a.wav"), 1, Defines.ATTN_NORM, 0); GameBase.gi.linkentity(grenade); } }
public static void fire_blaster( edict_t self, float[] start, float[] dir, int damage, int speed, int effect, boolean hyper) { edict_t bolt; trace_t tr; Math3D.VectorNormalize(dir); bolt = GameUtil.G_Spawn(); bolt.svflags = Defines.SVF_DEADMONSTER; // yes, I know it looks weird that projectiles are deadmonsters // what this means is that when prediction is used against the object // (blaster/hyperblaster shots), the player won't be solid clipped // against // the object. Right now trying to run into a firing hyperblaster // is very jerky since you are predicted 'against' the shots. Math3D.VectorCopy(start, bolt.s.origin); Math3D.VectorCopy(start, bolt.s.old_origin); Math3D.vectoangles(dir, bolt.s.angles); Math3D.VectorScale(dir, speed, bolt.velocity); bolt.movetype = Defines.MOVETYPE_FLYMISSILE; bolt.clipmask = Defines.MASK_SHOT; bolt.solid = Defines.SOLID_BBOX; bolt.s.effects |= effect; Math3D.VectorClear(bolt.mins); Math3D.VectorClear(bolt.maxs); bolt.s.modelindex = GameBase.gi.modelindex("models/objects/laser/tris.md2"); bolt.s.sound = GameBase.gi.soundindex("misc/lasfly.wav"); bolt.owner = self; bolt.touch = blaster_touch; bolt.nextthink = GameBase.level.time + 2; bolt.think = GameUtil.G_FreeEdictA; bolt.dmg = damage; bolt.classname = "bolt"; if (hyper) bolt.spawnflags = 1; GameBase.gi.linkentity(bolt); if (self.client != null) check_dodge(self, bolt.s.origin, dir, speed); tr = GameBase.gi.trace(self.s.origin, null, null, bolt.s.origin, bolt, Defines.MASK_SHOT); if (tr.fraction < 1.0) { Math3D.VectorMA(bolt.s.origin, -10, dir, bolt.s.origin); bolt.touch.touch(bolt, tr.ent, GameBase.dummyplane, null); } }
public static void fire_grenade( edict_t self, float[] start, float[] aimdir, int damage, int speed, float timer, float damage_radius) { edict_t grenade; float[] dir = {0, 0, 0}; float[] forward = {0, 0, 0}, right = {0, 0, 0}, up = {0, 0, 0}; Math3D.vectoangles(aimdir, dir); Math3D.AngleVectors(dir, forward, right, up); grenade = GameUtil.G_Spawn(); Math3D.VectorCopy(start, grenade.s.origin); Math3D.VectorScale(aimdir, speed, grenade.velocity); Math3D.VectorMA(grenade.velocity, 200f + Lib.crandom() * 10.0f, up, grenade.velocity); Math3D.VectorMA(grenade.velocity, Lib.crandom() * 10.0f, right, grenade.velocity); Math3D.VectorSet(grenade.avelocity, 300, 300, 300); grenade.movetype = Defines.MOVETYPE_BOUNCE; grenade.clipmask = Defines.MASK_SHOT; grenade.solid = Defines.SOLID_BBOX; grenade.s.effects |= Defines.EF_GRENADE; Math3D.VectorClear(grenade.mins); Math3D.VectorClear(grenade.maxs); grenade.s.modelindex = GameBase.gi.modelindex("models/objects/grenade/tris.md2"); grenade.owner = self; grenade.touch = Grenade_Touch; grenade.nextthink = GameBase.level.time + timer; grenade.think = Grenade_Explode; grenade.dmg = damage; grenade.dmg_radius = damage_radius; grenade.classname = "grenade"; GameBase.gi.linkentity(grenade); }
public static void fire_rocket( edict_t self, float[] start, float[] dir, int damage, int speed, float damage_radius, int radius_damage) { edict_t rocket; rocket = GameUtil.G_Spawn(); Math3D.VectorCopy(start, rocket.s.origin); Math3D.VectorCopy(dir, rocket.movedir); Math3D.vectoangles(dir, rocket.s.angles); Math3D.VectorScale(dir, speed, rocket.velocity); rocket.movetype = Defines.MOVETYPE_FLYMISSILE; rocket.clipmask = Defines.MASK_SHOT; rocket.solid = Defines.SOLID_BBOX; rocket.s.effects |= Defines.EF_ROCKET; Math3D.VectorClear(rocket.mins); Math3D.VectorClear(rocket.maxs); rocket.s.modelindex = GameBase.gi.modelindex("models/objects/rocket/tris.md2"); rocket.owner = self; rocket.touch = rocket_touch; rocket.nextthink = GameBase.level.time + 8000 / speed; rocket.think = GameUtil.G_FreeEdictA; rocket.dmg = damage; rocket.radius_dmg = radius_damage; rocket.dmg_radius = damage_radius; rocket.s.sound = GameBase.gi.soundindex("weapons/rockfly.wav"); rocket.classname = "rocket"; if (self.client != null) check_dodge(self, rocket.s.origin, dir, speed); GameBase.gi.linkentity(rocket); }