From 9e0e1eeeb964f1eaf94622399695e4b4a2d0f1db Mon Sep 17 00:00:00 2001 From: enneract Date: Wed, 19 Nov 2014 19:57:31 +0100 Subject: Implement the Rocket Launcher. --- src/game/bg_misc.c | 25 +++++++++++++++++++++++++ src/game/bg_public.h | 3 +++ src/game/g_missile.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/game/g_weapon.c | 16 ++++++++++++++++ src/game/tremulous.h | 12 ++++++++++++ 5 files changed, 97 insertions(+) (limited to 'src/game') diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 3c19b15..92f3826 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3601,6 +3601,31 @@ static const weaponAttributes_t bg_weapons[ ] = qtrue, //qboolean longRanged; TEAM_HUMANS //team_t team; }, + { + WP_ROCKET_LAUNCHER, //int weaponNum; + ROCKETL_PRICE, //int price; + STAGE_GE_5, //int stages + SLOT_WEAPON, //int slots; + "rocketl", //char *weaponName; + "[yefarms]Rocket Launcher", //char *humanName; + "This is a rocket launcher. It launches rockets.", + ROCKETL_AMMO, //int maxAmmo; + ROCKETL_CLIPS, //int maxClips; + qfalse, //int infiniteAmmo; + qfalse, //int usesEnergy; + ROCKETL_REPEAT, //int repeatRate1; + 0, //int repeatRate2; + 0, //int repeatRate3; + ROCKETL_RELOAD, //int reloadTime; + ROCKETL_K_SCALE, //float knockbackScale; + qfalse, //qboolean hasAltMode; + qfalse, //qboolean hasThirdMode; + qfalse, //qboolean canZoom; + 90.0f, //float zoomFov; + qtrue, //qboolean purchasable; + qtrue, //qboolean longRanged; + TEAM_HUMANS //team_t team; + }, { WP_GRENADE, //int weaponNum; GRENADE_PRICE, //int price; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 3473924..e4f21ac 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -357,6 +357,7 @@ typedef enum WP_FLAMER, WP_PULSE_RIFLE, WP_LUCIFER_CANNON, + WP_ROCKET_LAUNCHER, WP_GRENADE, WP_SMOKE, WP_MINE, @@ -845,6 +846,8 @@ typedef enum MOD_LCANNON_SPLASH, MOD_FLAMER, MOD_FLAMER_SPLASH, + MOD_ROCKETL, + MOD_ROCKETL_SPLASH, MOD_GRENADE, MOD_PSAWBLADE, MOD_MINE, diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 74ee72b..959067e 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -965,6 +965,47 @@ gentity_t *fire_luciferCannon( gentity_t *self, vec3_t start, vec3_t dir, return bolt; } + +/* +================= +fire_rocket +================= +*/ +gentity_t *fire_rocket( gentity_t *self, vec3_t start, vec3_t dir ) +{ + gentity_t *bolt; + + VectorNormalize (dir); + + bolt = G_Spawn(); + bolt->classname = "rocket"; + bolt->pointAgainstWorld = qtrue; + bolt->nextthink = level.time + 10000; + bolt->think = G_ExplodeMissile; + bolt->s.eType = ET_MISSILE; + bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; + bolt->s.weapon = WP_ROCKET_LAUNCHER; + bolt->s.generic1 = self->s.generic1; //weaponMode + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = ROCKETL_DAMAGE; + bolt->splashDamage = ROCKETL_DAMAGE / 2; + bolt->splashRadius = ROCKETL_RADIUS; + bolt->methodOfDeath = MOD_ROCKETL; + bolt->splashMethodOfDeath = MOD_ROCKETL_SPLASH; + bolt->clipmask = MASK_SHOT; + bolt->target_ent = NULL; + bolt->r.mins[ 0 ] = bolt->r.mins[ 1 ] = bolt->r.mins[ 2 ] = -ROCKETL_SIZE; + bolt->r.maxs[ 0 ] = bolt->r.maxs[ 1 ] = bolt->r.maxs[ 2 ] = ROCKETL_SIZE; + bolt->s.pos.trType = TR_LINEAR; + bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame + VectorCopy( start, bolt->s.pos.trBase ); + VectorScale( dir, ROCKETL_SPEED, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth + VectorCopy( start, bolt->r.currentOrigin ); + return bolt; +} + /* ================= launch_grenade diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 4e08523..5453913 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -829,6 +829,19 @@ void LCChargeFire( gentity_t *ent, qboolean secondary ) ent->client->ps.stats[ STAT_MISC ] = 0; } +/* +====================================================================== + +PULSE RIFLE + +====================================================================== +*/ + +void rocketLauncherFire( gentity_t *ent ) +{ + fire_rocket( ent, muzzle, forward ); +} + /* ====================================================================== TESLA GENERATOR @@ -1972,6 +1985,9 @@ void FireWeapon( gentity_t *ent ) case WP_PAIN_SAW: painSawFire( ent ); break; + case WP_ROCKET_LAUNCHER: + rocketLauncherFire( ent ); + break; case WP_GRENADE: throwGrenade( ent ); break; diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 44450f2..bad35e6 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -538,6 +538,18 @@ TREMULOUS EDGE MOD SRC FILE #define FLAMER_CHARGE_AMMO 50 // ammo cost of a full charge shot #define FLAMER_SECONDARY_REPEAT 200 +#define ROCKETL_PRICE 800 +#define ROCKETL_AMMO 20 +#define ROCKETL_CLIPS 0 +#define ROCKETL_RELOAD 0 +#define ROCKETL_REPEAT 800 +#define ROCKETL_K_SCALE 5235251.0f +#define ROCKETL_DAMAGE HDM(100) +#define ROCKETL_RADIUS 120 +#define ROCKETL_SIZE 5 +#define ROCKETL_SPEED 900 + + #define HBUILD_PRICE 0 #define HBUILD_REPEAT 1000 #define HBUILD_HEALRATE 18 -- cgit