diff options
author | Tim Angus <tim@ngus.net> | 2003-08-15 02:59:39 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2003-08-15 02:59:39 +0000 |
commit | e227f846393e5f27d2ee1cc148a8ebfe2fab42c4 (patch) | |
tree | 8a717cc56a8c0a9c78444c67b8e04ea9afb380a6 /src | |
parent | 80de4f4d3406bf9af27dcd297f6bedb776b1fa18 (diff) |
* Prelim introduction of the blaster
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_ents.c | 9 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 5 | ||||
-rw-r--r-- | src/game/bg_misc.c | 22 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_client.c | 3 | ||||
-rw-r--r-- | src/game/g_cmds.c | 7 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_missile.c | 42 | ||||
-rw-r--r-- | src/game/g_weapon.c | 20 | ||||
-rw-r--r-- | src/game/tremulous.h | 19 |
13 files changed, 126 insertions, 9 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index c09f1c0f..9b57e627 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -361,6 +361,15 @@ static void CG_Missile( centity_t *cent ) switch( cent->currentState.weapon ) { + case WP_BLASTER: + ent.reType = RT_SPRITE; + ent.radius = 4; + ent.rotation = 0; + ent.customShader = cgs.media.blasterShader; + trap_R_AddRefEntityToScene( &ent ); + return; + break; + case WP_PULSE_RIFLE: ent.reType = RT_SPRITE; ent.radius = 4; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index c37d5f60..c5fbfbeb 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -817,6 +817,7 @@ typedef struct qhandle_t smokePuffRageProShader; qhandle_t shotgunSmokePuffShader; qhandle_t plasmaBallShader; + qhandle_t blasterShader; qhandle_t waterBubbleShader; qhandle_t bloodTrailShader; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index f070b4a3..f68c7da1 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -693,6 +693,7 @@ static void CG_RegisterGraphics( void ) cgs.media.smokePuffShader = trap_R_RegisterShader( "smokePuff" ); cgs.media.smokePuffRageProShader = trap_R_RegisterShader( "smokePuffRagePro" ); cgs.media.shotgunSmokePuffShader = trap_R_RegisterShader( "shotgunSmokePuff" ); + cgs.media.blasterShader = trap_R_RegisterShader( "sprites/plasma1" ); cgs.media.plasmaBallShader = trap_R_RegisterShader( "sprites/plasma1" ); cgs.media.bloodTrailShader = trap_R_RegisterShader( "bloodTrail" ); cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" ); diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 8e9cba9f..31685518 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -516,7 +516,8 @@ static void CG_SetUIVars( void ) //determine what the player is carrying for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( BG_gotWeapon( i, cg.snap->ps.stats ) ) + if( BG_gotWeapon( i, cg.snap->ps.stats ) && + BG_FindPurchasableForWeapon( i ) ) strcat( carriageCvar, va( "W%d ", i ) ); } for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 58bbcea1..1b9f7599 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1591,6 +1591,11 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im isSprite = qtrue; break; + case WP_BLASTER: + mark = cgs.media.burnMarkShader; + radius = 4; + break; + case WP_FLAMER: sfx = cgs.media.sfx_flamerexp; mark = cgs.media.burnMarkShader; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index d13bf40b..7286dc14 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2071,6 +2071,28 @@ int BG_FindValueOfClass( int pclass ) weaponAttributes_t bg_weapons[ ] = { { + WP_BLASTER, //int weaponNum; + 0, //int price; + ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages + 0, //int slots; + "blaster", //char *weaponName; + "Blaster", //char *weaponHumanName; + 0, //int quan; + 0, //int clips; + 0, //int maxClips; + qtrue, //int infiniteAmmo; + qfalse, //int usesEnergy; + BLASTER_REPEAT, //int repeatRate1; + 0, //int repeatRate2; + 0, //int repeatRate3; + 0, //int reloadTime; + qfalse, //qboolean hasAltMode; + qfalse, //qboolean hasThirdMode; + qfalse, //qboolean purchasable; + 0, //int buildDelay; + WUT_HUMANS //WUTeam_t team; + }, + { WP_MACHINEGUN, //int weaponNum; RIFLE_PRICE, //int price; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 20fced4b..db9e8569 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -323,6 +323,7 @@ typedef enum WP_DIRECT_ZAP, WP_GROUND_POUND, + WP_BLASTER, WP_MACHINEGUN, WP_CHAINGUN, WP_FLAMER, diff --git a/src/game/g_client.c b/src/game/g_client.c index a61cd200..173bcd54 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1422,7 +1422,10 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) // clear entity values if( ent->client->pers.pclass == PCL_H_BASE ) + { + BG_packWeapon( WP_BLASTER, client->ps.stats ); weapon = client->pers.pitem; + } else if( client->sess.sessionTeam != TEAM_SPECTATOR ) weapon = BG_FindStartWeaponForClass( ent->client->pers.pclass ); else diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 009caf81..6c73b863 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1522,6 +1522,13 @@ void Cmd_Sell_f( gentity_t *ent ) if( weapon != WP_NONE ) { + //are we /allowed/ to sell this? + if( !BG_FindPurchasableForWeapon( weapon ) ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"You can't sell this item\n\"" ) ); + return; + } + //remove weapon if carried if( BG_gotWeapon( weapon, ent->client->ps.stats ) ) { diff --git a/src/game/g_local.h b/src/game/g_local.h index 5eb10512..8865bf15 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -623,7 +623,7 @@ void G_InitDamageLocations( void ); void G_RunMissile( gentity_t *ent ); 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_blaster( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ); gentity_t *fire_luciferCannon( gentity_t *self, vec3_t start, vec3_t dir, int damage ); 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 9cbbad15..e106aff9 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -290,6 +290,48 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir ) /* ================= +fire_blaster + +================= +*/ +gentity_t *fire_blaster( gentity_t *self, vec3_t start, vec3_t dir ) +{ + gentity_t *bolt; + + VectorNormalize (dir); + + bolt = G_Spawn(); + bolt->classname = "blaster"; + 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_BLASTER; + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = BLASTER_DMG; + 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, BLASTER_SPEED, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth + + VectorCopy( start, bolt->r.currentOrigin ); + + return bolt; +} + +//============================================================================= + +/* +================= fire_pulseRifle ================= diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index e058a769..194d022b 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -212,6 +212,23 @@ void lockBlobLauncherFire( gentity_t *ent ) /* ====================================================================== +BLASTER PISTOL + +====================================================================== +*/ + +void blasterFire( gentity_t *ent ) +{ + gentity_t *m; + + m = fire_blaster( ent, muzzle, forward ); + +// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics +} + +/* +====================================================================== + PULSE RIFLE ====================================================================== @@ -1040,6 +1057,9 @@ void FireWeapon( gentity_t *ent ) meleeAttack( ent, BMOFO_CLAW_RANGE, BMOFO_CLAW_DMG ); break; + case WP_BLASTER: + blasterFire( ent ); + break; case WP_MACHINEGUN: bulletFire( ent, RIFLE_SPREAD, RIFLE_DMG, MOD_MACHINEGUN ); break; diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 884e6526..5c96d6da 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -279,6 +279,11 @@ #define HUMAN_WDMG_MODIFIER 1.5f #define HDM(d) ((int)((float)d*HUMAN_WDMG_MODIFIER)) +#define BLASTER_REPEAT 1000 +#define BLASTER_SPREAD 200 +#define BLASTER_SPEED 500 +#define BLASTER_DMG HDM(10) + #define RIFLE_CLIPSIZE 30 #define RIFLE_SPAWNCLIPS 3 #define RIFLE_MAXCLIPS 3 @@ -286,13 +291,13 @@ #define RIFLE_RELOAD 2000 #define RIFLE_PRICE 0 #define RIFLE_SPREAD 200 -#define RIFLE_DMG HDM(9) +#define RIFLE_DMG HDM(5) #define CHAINGUN_BULLETS 300 #define CHAINGUN_REPEAT 50 #define CHAINGUN_PRICE 200 #define CHAINGUN_SPREAD 1200 -#define CHAINGUN_DMG HDM(14) +#define CHAINGUN_DMG HDM(10) #define FLAMER_GAS 80 #define FLAMER_REPEAT 300 @@ -307,17 +312,17 @@ #define MDRIVER_SPAWNCLIPS 2 #define MDRIVER_MAXCLIPS 3 #define MDRIVER_PRICE 300 -#define MDRIVER_DMG HDM(50) +#define MDRIVER_DMG HDM(100) #define MDRIVER_REPEAT 1000 #define MDRIVER_RELOAD 2000 #define PRIFLE_CLIPS 50 #define PRIFLE_SPAWNCLIPS 3 #define PRIFLE_MAXCLIPS 3 -#define PRIFLE_PRICE 250 +#define PRIFLE_PRICE 300 #define PRIFLE_REPEAT 100 #define PRIFLE_RELOAD 2000 -#define PRIFLE_DMG HDM(15) +#define PRIFLE_DMG HDM(13) #define PRIFLE_SPEED 1500 #define LCANNON_PRICE 400 @@ -326,13 +331,13 @@ #define LCANNON_CHARGEREPEAT 1000 #define LCANNON_RELOAD 2000 #define LCANNON_DAMAGE HDM(200) -#define LCANNON_SECONDARY_DAMAGE 20 +#define LCANNON_SECONDARY_DAMAGE HDM(20) #define LCANNON_SPEED 250 #define LCANNON_CHARGE_TIME 2000 #define LASGUN_PRICE 200 #define LASGUN_AMMO 300 -#define LASGUN_REPEAT 100 +#define LASGUN_REPEAT 150 #define LASGUN_RELOAD 2000 #define LASGUN_DAMAGE HDM(10) |