summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2002-06-21 23:07:48 +0000
committerTim Angus <tim@ngus.net>2002-06-21 23:07:48 +0000
commit9c84a1fc74a03edec430290a8da5d20b06a7d027 (patch)
tree802c06846d54357b1262a7dd58be0579f6aea78a /src/game
parent23a3cf67841b44ddfbdc482af08abc2142f66033 (diff)
Weapon additions???
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c65
-rw-r--r--src/game/bg_pmove.c31
-rw-r--r--src/game/bg_public.h25
-rw-r--r--src/game/g_active.c17
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_missile.c44
-rw-r--r--src/game/g_weapon.c41
7 files changed, 216 insertions, 8 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index e6243391..9d4e359d 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2126,6 +2126,69 @@ weaponAttributes_t bg_weapons[ ] =
WUT_HUMANS //WUTeam_t team;
},
{
+ WP_LUCIFER_CANON, //int weaponNum;
+ 100, //int price;
+ ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
+ SLOT_WEAPON, //int slots;
+ "lcanon", //char *weaponName;
+ "Lucifer Canon", //char *weaponHumanName;
+ { "models/weapons2/bfg/bfg.md3", 0, 0, 0 },
+ "icons/iconw_bfg",
+ 30, //int quan;
+ 0, //int clips;
+ 0, //int maxClips;
+ qfalse, //int infiniteAmmo;
+ qtrue, //int usesEnergy;
+ 500, //int repeatRate;
+ 2000, //int reloadTime;
+ qtrue, //qboolean hasAltMode;
+ qfalse, //qboolean synced;
+ qtrue, //qboolean purchasable;
+ WUT_HUMANS //WUTeam_t team;
+ },
+ {
+ WP_LAS_GUN, //int weaponNum;
+ 100, //int price;
+ ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
+ SLOT_WEAPON, //int slots;
+ "lgun", //char *weaponName;
+ "Las Gun", //char *weaponHumanName;
+ { "models/weapons2/grenadel/grenadel.md3", 0, 0, 0 },
+ "icons/iconw_plasma",
+ 300, //int quan;
+ 0, //int clips;
+ 0, //int maxClips;
+ qfalse, //int infiniteAmmo;
+ qtrue, //int usesEnergy;
+ 100, //int repeatRate;
+ 2000, //int reloadTime;
+ qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean synced;
+ qtrue, //qboolean purchasable;
+ WUT_HUMANS //WUTeam_t team;
+ },
+ {
+ WP_PAIN_SAW, //int weaponNum;
+ 100, //int price;
+ ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
+ SLOT_WEAPON, //int slots;
+ "psaw", //char *weaponName;
+ "Pain Saw", //char *weaponHumanName;
+ { "models/weapons2/gauntlet/gauntlet.md3", 0, 0, 0 },
+ "icons/iconw_gauntlet",
+ 0, //int quan;
+ 0, //int clips;
+ 0, //int maxClips;
+ qtrue, //int infiniteAmmo;
+ qfalse, //int usesEnergy;
+ 100, //int repeatRate;
+ 0, //int reloadTime;
+ qfalse, //qboolean hasAltMode;
+ qfalse, //qboolean synced;
+ qtrue, //qboolean purchasable;
+ WUT_HUMANS //WUTeam_t team;
+ },
+ {
WP_HBUILD, //int weaponNum;
100, //int price;
( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages
@@ -3042,6 +3105,8 @@ weapon_t BG_FindWeaponAmmoForUpgrade( int upgrade )
if( bg_upgrades[ i ].upgradeNum == upgrade )
return bg_upgrades[ i ].weaponAmmo;
}
+
+ return WP_NONE;
}
/*
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 017e9155..18fa084c 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -680,7 +680,7 @@ static void PM_JetPackMove( void ) {
if( pm->cmd.upmove > 0.0f )
wishvel[ 2 ] = 48.0f;
if( pm->cmd.upmove < 0.0f )
- wishvel[ 2 ] = -48.0f;
+ wishvel[ 2 ] = -96.0f;
VectorCopy( wishvel, wishdir );
wishspeed = VectorNormalize( wishdir );
@@ -2301,6 +2301,22 @@ static void PM_Weapon( void )
}
break;
+ case WP_LUCIFER_CANON:
+ attack1 = pm->cmd.buttons & BUTTON_ATTACK;
+ attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
+
+ if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 )
+ {
+ pm->ps->weaponTime = 0;
+ pm->ps->weaponstate = WEAPON_READY;
+ return;
+ }
+
+ //erp this looks confusing
+ if( pm->ps->stats[ STAT_MISC ] > 0 )
+ attack1 = !attack1;
+ break;
+
default:
//by default primary and secondary attacks are allowed
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
@@ -2360,7 +2376,18 @@ static void PM_Weapon( void )
// take an ammo away if not infinite
if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) )
{
- ammo--;
+ //special case for lCanon
+ if( pm->ps->weapon == WP_LUCIFER_CANON && attack1 )
+ {
+ ammo -= (int)( ceil( ( (float)pm->ps->stats[ STAT_MISC ] / (float)LC_TOTAL_CHARGE ) * 10.0f ) );
+
+ //stay on the safe side
+ if( ammo < 0 )
+ ammo = 0;
+ }
+ else
+ ammo--;
+
BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips );
}
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index add68d21..77ad6f2b 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -46,6 +46,9 @@
#define MAX_POUNCE_SPEED 750
#define POUNCE_TIME 1000.0f
+#define LC_TOTAL_CHARGE 255
+#define LC_CHARGE_TIME 2000.0f
+
//
// config strings are a general means of communicating variable length strings
// from the server to all connected clients.
@@ -341,6 +344,9 @@ typedef enum
WP_DIRECT_ZAP,
WP_MASS_DRIVER,
WP_PULSE_RIFLE,
+ WP_LUCIFER_CANON,
+ WP_LAS_GUN,
+ WP_PAIN_SAW,
//build weapons must remain in a block
WP_ABUILD,
@@ -982,7 +988,20 @@ typedef struct
WUTeam_t team;
} upgradeAttributes_t;
+
//TA:
+void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips );
+void BG_packAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips );
+void BG_packWeapon( int weapon, int stats[ ] );
+void BG_removeWeapon( int weapon, int stats[ ] );
+qboolean BG_gotWeapon( int weapon, int stats[ ] );
+void BG_packItem( int item, int stats[ ] );
+void BG_removeItem( int item, int stats[ ] );
+qboolean BG_gotItem( int item, int stats[ ] );
+void BG_activateItem( int item, int stats[ ] );
+void BG_deactivateItem( int item, int stats[ ] );
+qboolean BG_activated( int item, int stats[ ] );
+
int BG_FindBuildNumForName( char *name );
int BG_FindBuildNumForEntityName( char *name );
char *BG_FindNameForBuildable( int bclass );
@@ -1123,12 +1142,6 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *
qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime );
-//TA: extra bits: (which I apparently dont need)
-void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips );
-void BG_packAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips );
-void BG_packWeapon( int weapon, int stats[ ] );
-qboolean BG_gotWeapon( int weapon, int stats[ ] );
-
#define CREEP_BASESIZE 120
#define REACTOR_BASESIZE 1000
#define REPEATER_BASESIZE 500
diff --git a/src/game/g_active.c b/src/game/g_active.c
index ff229da7..89c45cf7 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -492,6 +492,23 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_MISC ] = MAX_POUNCE_SPEED;
}
+ //client is charging up an lcanon
+ if( client->ps.weapon == WP_LUCIFER_CANON )
+ {
+ int ammo;
+
+ BG_unpackAmmoArray( WP_LUCIFER_CANON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL );
+
+ if( client->ps.stats[ STAT_MISC ] < LC_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK )
+ client->ps.stats[ STAT_MISC ] += ( 100.0f / LC_CHARGE_TIME ) * LC_TOTAL_CHARGE;
+
+ if( client->ps.stats[ STAT_MISC ] > LC_TOTAL_CHARGE )
+ client->ps.stats[ STAT_MISC ] = LC_TOTAL_CHARGE;
+
+ if( client->ps.stats[ STAT_MISC ] > ( ammo * LC_TOTAL_CHARGE ) / 10 )
+ client->ps.stats[ STAT_MISC ] = ammo * LC_TOTAL_CHARGE / 10;
+ }
+
#define LAUNCH_TIME 2000
switch( client->ps.weapon )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 1628f5bd..2125291c 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -625,6 +625,7 @@ 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_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int damage );
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 942697eb..bbbf07cd 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -362,6 +362,50 @@ gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir )
/*
=================
+fire_luciferCanon
+
+=================
+*/
+gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int damage )
+{
+ gentity_t *bolt;
+ int localDamage = (int)( ceil( ( (float)damage /
+ (float)LC_TOTAL_CHARGE ) * 100.0f ) );
+
+ VectorNormalize( dir );
+
+ bolt = G_Spawn( );
+ bolt->classname = "lcanon";
+ 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_LUCIFER_CANON;
+ bolt->r.ownerNum = self->s.number;
+ bolt->parent = self;
+ bolt->damage = localDamage;
+ bolt->splashDamage = localDamage / 2;
+ bolt->splashRadius = localDamage;
+ bolt->s.generic1 = damage;
+ //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, 250, bolt->s.pos.trDelta );
+ SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
+
+ VectorCopy (start, bolt->r.currentOrigin);
+
+ return bolt;
+}
+
+//=============================================================================
+/*
+=================
fire_lockblob
=================
*/
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index cf1a0beb..4965fdb0 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -230,6 +230,31 @@ void flamerFire( gentity_t *ent )
/*
======================================================================
+LUCIFER CANON
+
+======================================================================
+*/
+
+/*
+===============
+LCChargeFire
+===============
+*/
+void LCChargeFire( gentity_t *ent, qboolean secondary )
+{
+ gentity_t *m;
+
+ if( secondary )
+ ent->client->ps.stats[ STAT_MISC ] = LC_TOTAL_CHARGE / 10;
+
+ m = fire_luciferCanon( ent, muzzle, forward, ent->client->ps.stats[ STAT_MISC ] );
+
+ ent->client->ps.stats[ STAT_MISC ] = 0;
+}
+
+/*
+======================================================================
+
TESLA GENERATOR
======================================================================
@@ -775,6 +800,13 @@ void FireWeapon2( gentity_t *ent )
case WP_VENOM:
case WP_POUNCE:
break;
+ case WP_LUCIFER_CANON:
+ LCChargeFire( ent, qtrue );
+ break;
+ case WP_LAS_GUN:
+ break;
+ case WP_PAIN_SAW:
+ break;
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
@@ -847,6 +879,15 @@ void FireWeapon( gentity_t *ent )
case WP_DIRECT_ZAP:
directZapFire( ent );
break;
+ case WP_LUCIFER_CANON:
+ LCChargeFire( ent, qfalse );
+ break;
+ case WP_LAS_GUN:
+ massDriverFire( ent );
+ break;
+ case WP_PAIN_SAW:
+ gClawFire( ent );
+ break;
case WP_ABUILD:
buildFire( ent, MN_A_BUILD );
break;