diff options
author | Tim Angus <tim@ngus.net> | 2001-07-10 03:06:36 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-07-10 03:06:36 +0000 |
commit | 38095b5c02e3c9ab5cd45f817837f06b1da67ef2 (patch) | |
tree | bef6d539e5192dd7c2c57f54749ea1b91da87330 /src | |
parent | 1a5201cc01e66f0002f62ca06ddd62dc0d259283 (diff) |
Mechanism for locking players in place (for grab weapon)
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_view.c | 7 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 7 | ||||
-rw-r--r-- | src/game/bg_misc.c | 49 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 95 | ||||
-rw-r--r-- | src/game/bg_public.h | 19 | ||||
-rw-r--r-- | src/game/g_active.c | 15 | ||||
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 6 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_weapon.c | 127 |
10 files changed, 244 insertions, 94 deletions
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 3442f09b..712e5422 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -980,10 +980,9 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo } } - if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_DROIDS ) - { - trap_R_AddAdditiveLightToScene( cg.predictedPlayerState.origin, 300, 0.4, 0.2, 0.0 ); - } + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_DROIDS && + cg.predictedPlayerState.persistant[PERS_TEAM] != TEAM_SPECTATOR ) + trap_R_AddAdditiveLightToScene( cg.predictedPlayerState.origin, 500, 0.2, 0.2, 0.2 ); // actually issue the rendering calls CG_DrawActive( stereoView ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index a3a3d315..74a1ef6a 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -596,7 +596,12 @@ void CG_RegisterWeapon( int weaponNum ) { weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; - case WP_ABUILD: + case WP_GRABANDCSAW: + MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); + break; + + case WP_DBUILD: case WP_HBUILD: case WP_SCANNER: //nowt diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index db9d804c..dbe72df1 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -226,6 +226,22 @@ gitem_t bg_itemlist[] = "" }, +/*QUAKED weapon_grabandcsaw (.3 .3 1) (-16 -16 -16) (16 16 16) suspended +*/ + { + "weapon_grabandcsaw", + "sound/misc/w_pkup.wav", + { "models/weapons2/gauntlet/gauntlet.md3", + 0, 0, 0}, + "icons/iconw_gauntlet", + "Circular Saw", + 0, + IT_WEAPON, + WP_GRABANDCSAW, + "", + "" + }, + /*QUAKED weapon_abuild (.3 .3 1) (-16 -16 -16) (16 16 16) suspended */ { @@ -237,7 +253,7 @@ gitem_t bg_itemlist[] = "ABuild", 0, IT_WEAPON, - WP_ABUILD, + WP_DBUILD, "", "" }, @@ -2565,11 +2581,11 @@ weaponAttributes_t bg_weapons[ ] = qfalse }, { - WP_ABUILD, + WP_DBUILD, 100, SLOT_WEAPON, "dbuild", - "", + "Droid build weapon", 0, 0, 0, @@ -2577,6 +2593,30 @@ weaponAttributes_t bg_weapons[ ] = qfalse }, { + WP_VENOM, + 100, + SLOT_WEAPON, + "venom", + "Venom", + 0, + 0, + 0, + qfalse, + qfalse + }, + { + WP_GRABANDCSAW, + 100, + SLOT_WEAPON, + "grabandcsaw", + "Circular Saw", + 0, + 0, + 0, + qtrue, + qtrue + }, + { WP_SCANNER, 100, SLOT_WEAPON, @@ -3664,7 +3704,8 @@ qboolean BG_infiniteAmmo( int weapon ) switch( weapon ) { case WP_VENOM: - case WP_ABUILD: + case WP_GRABANDCSAW: + case WP_DBUILD: case WP_HBUILD: case WP_SCANNER: return qtrue; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index ba823830..85890e97 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2299,7 +2299,7 @@ static void PM_Weapon( void ) switch( pm->ps->weapon ) { case WP_VENOM: - if( !pm->autoWeaponHit[ WP_VENOM ] ) + if( !pm->autoWeaponHit[ pm->ps->weapon ] ) { pm->ps->weaponTime = 0; pm->ps->weaponstate = WEAPON_READY; @@ -2319,25 +2319,6 @@ static void PM_Weapon( void ) } // fire weapon -/* if( BG_WeaponHasAltMode( pm->ps->weapon ) ) - { - if( BG_WeaponModesAreSynced( pm->ps->weapon ) ) - { - if( ( pm->cmd.buttons & BUTTON_ATTACK ) && ( pm->cmd.buttons & BUTTON_ATTACK2 ) ) - PM_AddEvent( EV_FIRE_WEAPONBOTH ); - else if( pm->cmd.buttons & BUTTON_ATTACK2 ) - PM_AddEvent( EV_FIRE_WEAPON2 ); - else - PM_AddEvent( EV_FIRE_WEAPON ); - } - else if( pm->cmd.buttons & BUTTON_ATTACK2 ) - PM_AddEvent( EV_FIRE_WEAPON2 ); - else - PM_AddEvent( EV_FIRE_WEAPON ); - } - else - PM_AddEvent( EV_FIRE_WEAPON );*/ - if( pm->cmd.buttons & BUTTON_ATTACK2 ) { if( BG_WeaponHasAltMode( pm->ps->weapon ) ) @@ -2377,7 +2358,7 @@ static void PM_Weapon( void ) addTime = 1000; break; case WP_MACHINEGUN: - addTime = 200; + addTime = 100; break; case WP_CHAINGUN: addTime = 50; @@ -2403,7 +2384,10 @@ static void PM_Weapon( void ) case WP_VENOM: addTime = 500; break; - case WP_ABUILD: + case WP_GRABANDCSAW: + addTime = 50; + break; + case WP_DBUILD: addTime = 1000; break; case WP_HBUILD: @@ -2498,13 +2482,16 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) { float rotAngle; vec3_t tempang, tempang2; - if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION ) { + if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION ) return; // no view changes at all - } - if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) { + //TA: FIXME: perhaps do something a little more interesting here later + //i.e. allow a little view angle change to reflect struggling/stretching ...? + if( ps->pm_type == PM_GRABBED ) + return; + + if( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) return; // no view changes at all - } // circularly clamp the angles with deltas for (i=0 ; i<3 ; i++) { @@ -2716,7 +2703,8 @@ void PmoveSingle (pmove_t *pmove) pm->ps->pm_flags &= ~PMF_BACKWARDS_RUN; } - if ( pm->ps->pm_type >= PM_DEAD ) { + if ( pm->ps->pm_type >= PM_DEAD ) + { pm->cmd.forwardmove = 0; pm->cmd.rightmove = 0; pm->cmd.upmove = 0; @@ -2757,56 +2745,53 @@ void PmoveSingle (pmove_t *pmove) // update the viewangles PM_UpdateViewAngles( pm->ps, &pm->cmd ); - if ( pm->ps->pm_type == PM_DEAD ) { - PM_DeadMove (); - } + if ( pm->ps->pm_type == PM_DEAD || pm->ps->pm_type == PM_GRABBED ) + PM_DeadMove( ); - PM_DropTimers(); + PM_DropTimers( ); - /*if ( pm->ps->powerups[PW_FLIGHT] ) { - // flight powerup doesn't allow jump and has different friction - PM_FlyMove(); - } else*/ if (pm->ps->pm_flags & PMF_GRAPPLE_PULL) { - PM_GrappleMove(); + if( pm->ps->pm_flags & PMF_GRAPPLE_PULL ) + { + PM_GrappleMove( ); // We can wiggle a bit - PM_AirMove(); - } else if (pm->ps->pm_flags & PMF_TIME_WATERJUMP) { - PM_WaterJumpMove(); - } else if ( pm->waterlevel > 1 ) { - // swimming - PM_WaterMove(); - } else if ( pml.walking ) { + PM_AirMove( ); + } + else if( pm->ps->pm_flags & PMF_TIME_WATERJUMP ) + PM_WaterJumpMove( ); + else if ( pm->waterlevel > 1 ) + PM_WaterMove( ); + else if ( pml.walking ) + { if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && ( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) ) - PM_ClimbMove(); //TA: walking on any surface + PM_ClimbMove( ); //TA: walking on any surface else - PM_WalkMove(); // walking on ground - } else { - // airborne - PM_AirMove(); + PM_WalkMove( ); // walking on ground } + else + PM_AirMove( ); - PM_Animate(); + PM_Animate( ); // set groundentity, watertype, and waterlevel - PM_GroundTrace(); + PM_GroundTrace( ); //TA: must update after every GroundTrace() - yet more clock cycles down the drain :( (14 vec rotations/frame) // update the viewangles PM_UpdateViewAngles( pm->ps, &pm->cmd ); - PM_SetWaterLevel(); + PM_SetWaterLevel( ); // weapons - PM_Weapon(); + PM_Weapon( ); // torso animation - PM_TorsoAnimation(); + PM_TorsoAnimation( ); // footstep events / legs animations - PM_Footsteps(); + PM_Footsteps( ); // entering / leaving water splashes - PM_WaterEvents(); + PM_WaterEvents( ); // snap some parts of playerstate to save network bandwidth trap_SnapVector( pm->ps->velocity ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 094c7e12..16c9d29d 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -134,12 +134,13 @@ movement on the server game. */ typedef enum { - PM_NORMAL, // can accelerate and turn - PM_NOCLIP, // noclip movement - PM_SPECTATOR, // still run into walls - PM_DEAD, // no acceleration or turning, but free falling - PM_FREEZE, // stuck in place with no control - PM_INTERMISSION, // no movement or status bar + PM_NORMAL, // can accelerate and turn + PM_NOCLIP, // noclip movement + PM_SPECTATOR, // still run into walls + PM_DEAD, // no acceleration or turning, but free falling + PM_GRABBED, // like dead, but for when the player is still live + PM_FREEZE, // stuck in place with no control + PM_INTERMISSION, // no movement or status bar PM_SPINTERMISSION // no movement or status bar } pmtype_t; @@ -243,7 +244,8 @@ typedef enum { #define SS_WALLTRANSIDING 8 #define SS_SPEEDBOOST 16 #define SS_INFESTING 32 -#define SS_POISONED 64 +#define SS_GRABBED 64 +#define SS_POISONED 128 // player_state->persistant[] indexes @@ -332,8 +334,9 @@ typedef enum { WP_BFG, WP_GRAPPLING_HOOK, WP_VENOM, + WP_GRABANDCSAW, WP_HBUILD, - WP_ABUILD, + WP_DBUILD, WP_SCANNER, WP_GGRENADE, diff --git a/src/game/g_active.c b/src/game/g_active.c index 935e88dd..69007011 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -757,6 +757,8 @@ void ClientThink_real( gentity_t *ent ) { client->ps.pm_type = PM_DEAD; else if( client->ps.stats[ STAT_STATE ] & SS_INFESTING ) client->ps.pm_type = PM_FREEZE; + else if( client->ps.stats[ STAT_STATE ] & SS_GRABBED ) + client->ps.pm_type = PM_GRABBED; else client->ps.pm_type = PM_NORMAL; @@ -834,12 +836,25 @@ void ClientThink_real( gentity_t *ent ) { if( !( ucmd->buttons & BUTTON_TALK ) && client->ps.weaponTime <= 0 ) { + qboolean temp; + switch( client->ps.weapon ) { case WP_VENOM: pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent ); break; + case WP_GRABANDCSAW: + temp = CheckGrabAttack( ent ); + if( !pm.autoWeaponHit[ WP_GRABANDCSAW ] && temp ) + { + //enemy has *just* entered grab range + //only allow grab if attack2 button is UP + if( !( ucmd->buttons & BUTTON_ATTACK2 ) ) + pm.autoWeaponHit[ WP_GRABANDCSAW ] = qtrue; + } + break; + default: break; } diff --git a/src/game/g_client.c b/src/game/g_client.c index ae2b529a..440b5652 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1374,13 +1374,11 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) { case PCL_D_B_LEV21: case PCL_D_B_LEV22: case PCL_D_B_LEV23: - BG_packWeapon( WP_ABUILD, client->ps.stats ); - BG_packAmmoArray( WP_ABUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + BG_packWeapon( WP_DBUILD, client->ps.stats ); + BG_packAmmoArray( WP_DBUILD, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; case PCL_D_O_BASE: - case PCL_D_O_LEV11: - case PCL_D_O_LEV12: case PCL_D_O_LEV21: case PCL_D_O_LEV22: case PCL_D_O_LEV31: @@ -1389,6 +1387,12 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) { BG_packWeapon( WP_VENOM, client->ps.stats ); BG_packAmmoArray( WP_VENOM, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); break; + + case PCL_D_O_LEV11: + case PCL_D_O_LEV12: + BG_packWeapon( WP_GRABANDCSAW, client->ps.stats ); + BG_packAmmoArray( WP_GRABANDCSAW, client->ps.ammo, client->ps.powerups, 0, 0, 0 ); + break; case PCL_D_D_BASE: case PCL_D_D_LEV11: diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 5f05e554..bba155fc 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1702,7 +1702,7 @@ void Cmd_Destroy_f( gentity_t *ent ) if( tr.fraction < 1.0 && ( traceEnt->s.eType == ET_BUILDABLE ) && ( traceEnt->biteam == ent->client->pers.pteam ) && - ( ( ent->client->ps.weapon == WP_ABUILD ) || + ( ( ent->client->ps.weapon == WP_DBUILD ) || ( ent->client->ps.weapon == WP_HBUILD ) ) ) G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10000, 0, MOD_SUICIDE ); @@ -2006,8 +2006,8 @@ void Cmd_Build_f( gentity_t *ent ) trap_Argv( 1, s, sizeof( s ) ); if( ( ent->client->pers.pteam == PTE_DROIDS ) && - BG_gotWeapon( WP_ABUILD, ent->client->ps.stats ) && - ( ent->client->ps.weapon == WP_ABUILD ) ) + BG_gotWeapon( WP_DBUILD, ent->client->ps.stats ) && + ( ent->client->ps.weapon == WP_DBUILD ) ) { buildable = BG_FindBuildNumForName( s ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 1013ea83..d17dd223 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -629,6 +629,7 @@ qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ); void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint ); void SnapVectorTowards( vec3_t v, vec3_t to ); qboolean CheckVenomAttack( gentity_t *ent ); +qboolean CheckGrabAttack( gentity_t *ent ); void Weapon_HookFree (gentity_t *ent); void Weapon_HookThink (gentity_t *ent); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 960f375e..8684574c 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -614,7 +614,8 @@ VENOM CheckVenomAttack =============== */ -qboolean CheckVenomAttack( gentity_t *ent ) { +qboolean CheckVenomAttack( gentity_t *ent ) +{ trace_t tr; vec3_t end; gentity_t *tent; @@ -629,14 +630,14 @@ qboolean CheckVenomAttack( gentity_t *ent ) { VectorMA (muzzle, 32, forward, end); trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { + if ( tr.surfaceFlags & SURF_NOIMPACT ) return qfalse; - } traceEnt = &g_entities[ tr.entityNum ]; // send blood impact - if ( traceEnt->takedamage && traceEnt->client ) { + if ( traceEnt->takedamage && traceEnt->client ) + { tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); tent->s.otherEntityNum = traceEnt->s.number; tent->s.eventParm = DirToByte( tr.plane.normal ); @@ -668,8 +669,26 @@ qboolean CheckVenomAttack( gentity_t *ent ) { Weapon_Venom_Fire =============== */ -void Weapon_Venom_Fire( gentity_t *ent ) { -/* trace_t tr; +void Weapon_Venom_Fire( gentity_t *ent ) +{ +} + +/* +====================================================================== + +CIRCULAR SAW + +====================================================================== +*/ + +/* +=============== +Weapon_Csaw_Fire +=============== +*/ +void Weapon_CSaw_Fire( gentity_t *ent ) +{ + trace_t tr; vec3_t end; gentity_t *tent; gentity_t *traceEnt; @@ -679,27 +698,100 @@ void Weapon_Venom_Fire( gentity_t *ent ) { CalcMuzzlePoint( ent, forward, right, up, muzzle ); - VectorMA (muzzle, 32, forward, end); + VectorMA( muzzle, 32, forward, end ); - trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { + trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if ( tr.surfaceFlags & SURF_NOIMPACT ) return; - } traceEnt = &g_entities[ tr.entityNum ]; // send blood impact - if ( traceEnt->takedamage && traceEnt->client ) { + if ( traceEnt->takedamage && traceEnt->client ) + { tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); tent->s.otherEntityNum = traceEnt->s.number; tent->s.eventParm = DirToByte( tr.plane.normal ); tent->s.weapon = ent->s.weapon; } - if ( traceEnt->takedamage) { - G_Damage( traceEnt, ent, ent, forward, tr.endpos, 50, 0, MOD_VENOM ); + if ( traceEnt->takedamage ) + G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, 0, MOD_VENOM ); +} + +/* +=============== +Weapon_Grab_Fire +=============== +*/ +void Weapon_Grab_Fire( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + int damage; + + // set aiming directions + AngleVectors (ent->client->ps.viewangles, forward, right, up); + + CalcMuzzlePoint( ent, forward, right, up, muzzle ); + + VectorMA( muzzle, 32, 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 ]; + + if( !traceEnt->takedamage ) + return; + if( !traceEnt->client ) + return; + if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) + return; + + if( traceEnt->client ) + { + //lock client } +} + +/* +=============== +CheckGrabAttack +=============== */ +qboolean CheckGrabAttack( gentity_t *ent ) +{ + trace_t tr; + vec3_t end; + gentity_t *tent; + gentity_t *traceEnt; + int damage; + + // set aiming directions + AngleVectors (ent->client->ps.viewangles, forward, right, up); + + CalcMuzzlePoint( ent, forward, right, up, muzzle ); + + VectorMA (muzzle, 32, forward, end); + + trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); + if ( tr.surfaceFlags & SURF_NOIMPACT ) + return qfalse; + + traceEnt = &g_entities[ tr.entityNum ]; + + if( !traceEnt->takedamage) + return qfalse; + if( !traceEnt->client ) + return qfalse; + if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) + return qfalse; + + return qtrue; } //====================================================================== @@ -818,7 +910,9 @@ void FireWeapon2( gentity_t *ent ) case WP_VENOM: Weapon_Venom_Fire( ent ); break; - case WP_ABUILD: + case WP_GRABANDCSAW: + break; + case WP_DBUILD: Weapon_Abuild_Fire( ent ); break; case WP_HBUILD: @@ -892,7 +986,10 @@ void FireWeapon( gentity_t *ent ) case WP_VENOM: Weapon_Venom_Fire( ent ); break; - case WP_ABUILD: + case WP_GRABANDCSAW: + Weapon_CSaw_Fire( ent ); + break; + case WP_DBUILD: Weapon_Abuild_Fire( ent ); break; case WP_HBUILD: |