diff options
author | Tim Angus <tim@ngus.net> | 2001-09-25 22:27:28 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-09-25 22:27:28 +0000 |
commit | 688d528f2860d456248363cb1c041de7dabe1911 (patch) | |
tree | bb7dc0f1d009f29ed6ca91628523d7c442aaf371 /src/game | |
parent | d511ec1caee3717f9652c8366a054c3046f6e2f6 (diff) |
Added 2 experimental weapons
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_misc.c | 85 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 14 | ||||
-rw-r--r-- | src/game/bg_public.h | 6 | ||||
-rw-r--r-- | src/game/g_active.c | 14 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_missile.c | 40 | ||||
-rw-r--r-- | src/game/g_weapon.c | 122 |
7 files changed, 211 insertions, 71 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 32c20566..a2f521e3 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -322,22 +322,6 @@ gitem_t bg_itemlist[] = "" }, -/*QUAKED weapon_scanner (.3 .3 1) (-16 -16 -16) (16 16 16) suspended -*/ - { - "weapon_scanner", - "sound/misc/w_pkup.wav", - { "models/weapons2/shotgun/shotgun.md3", - 0, 0, 0}, - "icons/iconw_shotgun", - "Scanner", - 0, - IT_WEAPON, - WP_SCANNER, - "", - "" - }, - /*QUAKED weapon_shotgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ /*{ @@ -386,6 +370,38 @@ gitem_t bg_itemlist[] = "" }, +/*QUAKED weapon_massdriver (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +*/ + { + "weapon_massdriver", + "sound/misc/w_pkup.wav", + { "models/weapons2/bfg/bfg.md3", + 0, 0, 0}, + "icons/iconw_bfg", + "Mass Driver", + 40, + IT_WEAPON, + WP_MASS_DRIVER, + "", + "" + }, + +/*QUAKED weapon_pulserifle (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +*/ + { + "weapon_pulserifle", + "sound/misc/w_pkup.wav", + { "models/weapons2/plasma/plasma.md3", + 0, 0, 0}, + "icons/iconw_gauntlet", + "Pulse Rifle", + 40, + IT_WEAPON, + WP_PULSE_RIFLE, + "", + "" + }, + /*QUAKED weapon_ggrenade (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ { @@ -2884,6 +2900,30 @@ weaponAttributes_t bg_weapons[ ] = qfalse //qboolean synced; }, { + WP_MASS_DRIVER, //int weaponNum; + 100, //int price; + SLOT_WEAPON, //int slots; + "mdriver", //char *weaponName; + "Mass Driver", //char *weaponHumanName; + 5, //int quan; + 2, //int clips; + 3, //int maxClips; + qfalse, //qboolean hasAltMode; + qfalse //qboolean synced; + }, + { + WP_PULSE_RIFLE, //int weaponNum; + 100, //int price; + SLOT_WEAPON, //int slots; + "prifle", //char *weaponName; + "Pulse Rifle", //char *weaponHumanName; + 50, //int quan; + 3, //int clips; + 3, //int maxClips; + qfalse, //qboolean hasAltMode; + qfalse //qboolean synced; + }, + { WP_HBUILD, //int weaponNum; 100, //int price; SLOT_WEAPON, //int slots; @@ -2966,18 +3006,6 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qfalse, //qboolean hasAltMode; qfalse //qboolean synced; - }, - { - WP_SCANNER, //int weaponNum; - 100, //int price; - SLOT_WEAPON, //int slots; - "scanner", //char *weaponName; - "Scanner", //char *weaponHumanName; - 0, //int quan; - 0, //int clips; - 0, //int maxClips; - qfalse, //qboolean hasAltMode; - qfalse //qboolean synced; } }; @@ -4073,7 +4101,6 @@ qboolean BG_infiniteAmmo( int weapon ) case WP_DBUILD2: case WP_HBUILD: case WP_HBUILD2: - case WP_SCANNER: return qtrue; break; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 685a0617..8bad877c 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2161,9 +2161,6 @@ static void PM_Weapon( void ) return; } - if( pm->ps->weapon == WP_SCANNER ) - return; //doesn't actually do anything - // start the animation even if out of ammo BG_unpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); @@ -2182,6 +2179,8 @@ static void PM_Weapon( void ) switch( pm->ps->weapon ) { case WP_MACHINEGUN: + case WP_MASS_DRIVER: + case WP_PULSE_RIFLE: clips--; BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL ); break; @@ -2201,6 +2200,8 @@ static void PM_Weapon( void ) switch( pm->ps->weapon ) { case WP_MACHINEGUN: + case WP_MASS_DRIVER: + case WP_PULSE_RIFLE: addTime = 2000; break; @@ -2366,11 +2367,16 @@ static void PM_Weapon( void ) case WP_POUNCE: addTime = 750; break; + case WP_MASS_DRIVER: + addTime = 1000; + break; + case WP_PULSE_RIFLE: + addTime = 50; + break; case WP_DBUILD: case WP_DBUILD2: case WP_HBUILD: case WP_HBUILD2: - case WP_SCANNER: addTime = 1000; //abritutary since doesn't "fire" break; } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index b0acd7a7..284bbf86 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -328,7 +328,7 @@ typedef enum { } holdable_t; //TA: needed client side to size sprites -#define FIREBALL_LIFETIME 1500.0f +#define FIREBALL_LIFETIME 1000.0f typedef enum { @@ -350,6 +350,8 @@ typedef enum WP_VENOM, WP_GRABANDCSAW, WP_POUNCE, + WP_MASS_DRIVER, + WP_PULSE_RIFLE, //build weapons must remain in a block WP_DBUILD, @@ -358,7 +360,6 @@ typedef enum WP_HBUILD, //ok? - WP_SCANNER, WP_GGRENADE, WP_NUM_WEAPONS @@ -520,6 +521,7 @@ typedef enum { EV_BULLET_HIT_FLESH, EV_BULLET_HIT_WALL, + EV_MASS_DRIVER_HIT, EV_MISSILE_HIT, EV_MISSILE_MISS, diff --git a/src/game/g_active.c b/src/game/g_active.c index 5abeeaf8..3bff151b 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -412,6 +412,7 @@ qboolean ClientInactivityTimer( gclient_t *client ) { #define STAMINA_STOP_RESTORE 10 #define STAMINA_WALK_RESTORE 5 #define STAMINA_SPRINT_TAKE 10 +#define STAMINA_LARMOUR_TAKE 5 /* ================== @@ -446,7 +447,10 @@ void ClientTimerActions( gentity_t *ent, int msec ) if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 ) { //subtract stamina - client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; + if( BG_gotItem( UP_LIMBARMOUR, client->ps.stats ) ) + client->ps.stats[ STAT_STAMINA ] -= STAMINA_LARMOUR_TAKE; + else + client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; if( client->ps.stats[ STAT_STAMINA ] < -1000 ) client->ps.stats[ STAT_STAMINA ] = -1000; @@ -608,12 +612,12 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) { if ( item ) { drop = Drop_Item( ent, item, 0 ); // decide how many seconds it has left - drop->count = ( ent->client->ps.powerups[ j ] - level.time ) / 1000; + /*drop->count = ( ent->client->ps.powerups[ j ] - level.time ) / 1000;*/ if ( drop->count < 1 ) { drop->count = 1; } - ent->client->ps.powerups[ j ] = 0; + /*ent->client->ps.powerups[ j ] = 0;*/ } SelectSpawnPoint( ent->client->ps.origin, origin, angles ); @@ -1164,11 +1168,11 @@ void ClientEndFrame( gentity_t *ent ) { pers = &ent->client->pers; // turn off any expired powerups - for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { +/* for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { if ( ent->client->ps.powerups[ i ] < level.time ) { ent->client->ps.powerups[ i ] = 0; } - } + }*/ // save network bandwidth #if 0 diff --git a/src/game/g_local.h b/src/game/g_local.h index f70ade0b..cf5bb8f4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -615,6 +615,7 @@ void G_RunMissile( gentity_t *ent ); gentity_t *fire_blaster( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t aimdir ); +gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_grenade( gentity_t *self, vec3_t start, vec3_t aimdir ); gentity_t *fire_rocket( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir ); diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 8b2aba73..24c70390 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -378,6 +378,46 @@ gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t dir ) return bolt; } +/* +================= +fire_plasma + +================= +*/ +gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ) +{ + gentity_t *bolt; + + VectorNormalize (dir); + + bolt = G_Spawn(); + bolt->classname = "pulse"; + 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_PULSE_RIFLE; + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = 20; + bolt->splashDamage = 0; + bolt->splashRadius = 0; + //bolt->methodOfDeath = MOD_FLAMER; + //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; + bolt->clipmask = MASK_SHOT; + bolt->target_ent = NULL; + + 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, 1500, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth + + VectorCopy (start, bolt->r.currentOrigin); + + return bolt; +} + //============================================================================= /* diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 85a9b59d..d27adb73 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -146,14 +146,14 @@ void SnapVectorTowards( vec3_t v, vec3_t to ) { #define CHAINGUN_SPREAD 1200 #define CHAINGUN_DAMAGE 14 -void Bullet_Fire (gentity_t *ent, float spread, int damage, int mod ) { +void Bullet_Fire( gentity_t *ent, float spread, int damage, int mod ) +{ trace_t tr; vec3_t end; float r; float u; gentity_t *tent; gentity_t *traceEnt; - int i, passent; r = random() * M_PI * 2.0f; u = sin(r) * crandom() * spread * 16; @@ -162,40 +162,73 @@ void Bullet_Fire (gentity_t *ent, float spread, int damage, int mod ) { VectorMA (end, r, right, end); VectorMA (end, u, up, end); - passent = ent->s.number; - for (i = 0; i < 10; i++) { - - trap_Trace (&tr, muzzle, NULL, NULL, end, passent, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { - return; - } + trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); + if( tr.surfaceFlags & SURF_NOIMPACT ) + return; - traceEnt = &g_entities[ tr.entityNum ]; + traceEnt = &g_entities[ tr.entityNum ]; - // snap the endpos to integers, but nudged towards the line - SnapVectorTowards( tr.endpos, muzzle ); + // snap the endpos to integers, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); - // send bullet impact - if ( traceEnt->takedamage && traceEnt->client ) { - tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH ); - tent->s.eventParm = traceEnt->s.number; - if( LogAccuracyHit( traceEnt, ent ) ) { - ent->client->accuracy_hits++; - } - } else { - tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL ); - tent->s.eventParm = DirToByte( tr.plane.normal ); - } - tent->s.otherEntityNum = ent->s.number; + // send bullet impact + if( traceEnt->takedamage && traceEnt->client ) + { + tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH ); + tent->s.eventParm = traceEnt->s.number; + if( LogAccuracyHit( traceEnt, ent ) ) + ent->client->accuracy_hits++; + } + else + { + tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_WALL ); + tent->s.eventParm = DirToByte( tr.plane.normal ); + } + tent->s.otherEntityNum = ent->s.number; - if ( traceEnt->takedamage) { - G_Damage( traceEnt, ent, ent, forward, tr.endpos, - damage, 0, MOD_MACHINEGUN); - } - break; + if( traceEnt->takedamage ) + { + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + damage, 0, MOD_MACHINEGUN); } } +/* +====================================================================== + +MASS DRIVER + +====================================================================== +*/ + +void massDriverFire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + + VectorMA( muzzle, 8192*16, forward, end ); + + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr.surfaceFlags & SURF_NOIMPACT ) + return; + + traceEnt = &g_entities[ tr.entityNum ]; + + // snap the endpos to integers, but nudged towards the line + SnapVectorTowards( tr.endpos, muzzle ); + + // send impact + tent = G_TempEntity( tr.endpos, EV_MASS_DRIVER_HIT ); + tent->s.eventParm = DirToByte( tr.plane.normal ); + + if( traceEnt->takedamage ) + { + G_Damage( traceEnt, ent, ent, forward, tr.endpos, + 50, 0, MOD_MACHINEGUN); + } +} /* ====================================================================== @@ -374,6 +407,23 @@ void Weapon_Plasma_Fire (gentity_t *ent) { /* ====================================================================== +PULSE RIFLE + +====================================================================== +*/ + +void Weapon_PulseRifle_Fire (gentity_t *ent) +{ + gentity_t *m; + + m = fire_pulseRifle( ent, muzzle, forward ); + +// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics +} + +/* +====================================================================== + FLAME THROWER ====================================================================== @@ -1022,9 +1072,15 @@ void FireWeapon2( gentity_t *ent ) case WP_PLASMAGUN: Weapon_Plasma_Fire( ent ); break; + case WP_PULSE_RIFLE: + Weapon_PulseRifle_Fire( ent ); + break; case WP_RAILGUN: weapon_railgun_fire( ent ); break; + case WP_MASS_DRIVER: + massDriverFire( ent ); + break; case WP_LOCKBLOB_LAUNCHER: break; case WP_BFG: @@ -1053,7 +1109,6 @@ void FireWeapon2( gentity_t *ent ) case WP_HBUILD2: Weapon_Hbuild2_Fire( ent ); break; - case WP_SCANNER: //scanner doesn't "fire" default: // FIXME G_Error( "Bad ent->s.weapon" ); break; @@ -1109,9 +1164,15 @@ void FireWeapon( gentity_t *ent ) case WP_PLASMAGUN: Weapon_Plasma_Fire( ent ); break; + case WP_PULSE_RIFLE: + Weapon_PulseRifle_Fire( ent ); + break; case WP_RAILGUN: weapon_railgun_fire( ent ); break; + case WP_MASS_DRIVER: + massDriverFire( ent ); + break; case WP_LOCKBLOB_LAUNCHER: Weapon_LockBlobLauncher_Fire( ent ); break; @@ -1142,7 +1203,6 @@ void FireWeapon( gentity_t *ent ) case WP_HBUILD2: Weapon_Hbuild2_Fire( ent ); break; - case WP_SCANNER: //scanner doesn't "fire" default: // FIXME G_Error( "Bad ent->s.weapon" ); break; |