summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2003-09-03 22:50:40 +0000
committerTim Angus <tim@ngus.net>2003-09-03 22:50:40 +0000
commit8184497c1610bc9ac6727315d2981b83a5a32ae6 (patch)
tree18cc558560980ae5777848acc3fa99659e780c6a
parentadbcbeb9156141e02d182d00d91330f3f523664a (diff)
* Jetpack handling rejigged a bit to cooperate with other move types better
* All upgrades are deactivated upon death now * Bodies no longer dtf but have their model origins matched with the player
-rw-r--r--src/game/bg_pmove.c24
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_active.c4
-rw-r--r--src/game/g_client.c8
-rw-r--r--src/game/g_combat.c4
5 files changed, 25 insertions, 16 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index e5f59919..31f76844 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -264,7 +264,7 @@ static void PM_Friction( void )
drop += speed * pm_waterfriction * pm->waterlevel * pml.frametime;
// apply flying friction
- if( BG_gotItem( UP_JETPACK, pm->ps->stats ) && BG_activated( UP_JETPACK, pm->ps->stats ) )
+ if( pm->ps->pm_type == PM_JETPACK )
drop += speed * pm_flightfriction * pml.frametime;
if( pm->ps->pm_type == PM_SPECTATOR )
@@ -346,8 +346,7 @@ static float PM_CmdScale( usercmd_t *cmd )
float modifier = 1.0f;
int aForward, aRight;
- if( pm->ps->stats[ STAT_PTEAM ] == PTE_HUMANS && pm->ps->pm_type == PM_NORMAL &&
- !( BG_gotItem( UP_JETPACK, pm->ps->stats ) && BG_activated( UP_JETPACK, pm->ps->stats ) ) )
+ if( pm->ps->stats[ STAT_PTEAM ] == PTE_HUMANS && pm->ps->pm_type == PM_NORMAL )
{
if( !( pm->ps->stats[ STAT_STATE ] & SS_SPEEDBOOST ) )
{
@@ -2112,22 +2111,23 @@ static void PM_CheckDuck (void)
pm->mins[ 2 ] = PCmins[ 2 ];
- if (pm->ps->pm_type == PM_DEAD)
+ if( pm->ps->pm_type == PM_DEAD )
{
- pm->maxs[2] = -8;
+ pm->maxs[ 2 ] = -8;
pm->ps->viewheight = DEAD_VIEWHEIGHT;
return;
}
//TA: If the standing and crouching viewheights are the same the class can't crouch
- if( ( pm->cmd.upmove < 0 ) && ( PCvh != PCcvh ) &&
- !( BG_gotItem( UP_JETPACK, pm->ps->stats ) && BG_activated( UP_JETPACK, pm->ps->stats ) ) )
- { // duck
+ if( ( pm->cmd.upmove < 0 ) && ( PCvh != PCcvh ) && pm->ps->pm_type != PM_JETPACK )
+ {
+ // duck
pm->ps->pm_flags |= PMF_DUCKED;
}
else
- { // stand up if possible
- if (pm->ps->pm_flags & PMF_DUCKED)
+ {
+ // stand up if possible
+ if( pm->ps->pm_flags & PMF_DUCKED )
{
// try to stand up
pm->maxs[ 2 ] = PCmaxs[ 2 ];
@@ -3122,12 +3122,12 @@ void PmoveSingle (pmove_t *pmove)
// update the viewangles
PM_UpdateViewAngles( pm->ps, &pm->cmd );
- if ( pm->ps->pm_type == PM_DEAD || pm->ps->pm_type == PM_GRABBED )
+ if( pm->ps->pm_type == PM_DEAD || pm->ps->pm_type == PM_GRABBED )
PM_DeadMove( );
PM_DropTimers( );
- if( BG_gotItem( UP_JETPACK, pm->ps->stats ) && BG_activated( UP_JETPACK, pm->ps->stats ) )
+ if( pm->ps->pm_type == PM_JETPACK )
PM_JetPackMove( );
else if( pm->ps->pm_flags & PMF_GRAPPLE_PULL )
{
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 42d8f5bd..d0ae824f 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -107,6 +107,7 @@ typedef enum
PM_NORMAL, // can accelerate and turn
PM_NOCLIP, // noclip movement
PM_SPECTATOR, // still run into walls
+ PM_JETPACK, // jetpack physics
PM_GRABBED, // like dead, but for when the player is still live
PM_DEAD, // no acceleration or turning, but free falling
PM_FREEZE, // stuck in place with no control
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 4fd29f84..8f1971b7 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -888,7 +888,7 @@ void ClientThink_real( gentity_t *ent )
if( client->noclip )
client->ps.pm_type = PM_NOCLIP;
- else if( client->ps.stats[STAT_HEALTH] <= 0 )
+ else if( client->ps.stats[ STAT_HEALTH ] <= 0 )
client->ps.pm_type = PM_DEAD;
else if( client->ps.stats[ STAT_STATE ] & SS_INFESTING ||
client->ps.stats[ STAT_STATE ] & SS_HOVELING )
@@ -896,6 +896,8 @@ void ClientThink_real( gentity_t *ent )
else if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED ||
client->ps.stats[ STAT_STATE ] & SS_GRABBED )
client->ps.pm_type = PM_GRABBED;
+ else if( BG_gotItem( UP_JETPACK, client->ps.stats ) && BG_activated( UP_JETPACK, client->ps.stats ) )
+ client->ps.pm_type = PM_JETPACK;
else
client->ps.pm_type = PM_NORMAL;
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 1789ac4f..f56267c5 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -652,6 +652,7 @@ void SpawnCorpse( gentity_t *ent )
vec3_t origin, dest;
trace_t tr;
int i;
+ float vDiff;
VectorCopy( ent->r.currentOrigin, origin );
@@ -739,9 +740,10 @@ void SpawnCorpse( gentity_t *ent )
//change body dimensions
BG_FindBBoxForClass( ent->client->ps.stats[ STAT_PCLASS ], NULL, NULL, NULL, body->r.mins, body->r.maxs );
-
- //drop to floor
- VectorSet( dest, origin[0], origin[1], origin[2] - 4096 );
+ vDiff = body->r.mins[ 2 ] - ent->r.mins[ 2 ];
+
+ //drop down to match the *model* origins of ent and body
+ VectorSet( dest, origin[ 0 ], origin[ 1 ], origin[ 2 ] - vDiff );
trap_Trace( &tr, origin, body->r.mins, body->r.maxs, dest, body->s.number, body->clipmask );
VectorCopy( tr.endpos, origin );
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 46a579d1..e7088a00 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -212,6 +212,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//TA: close any menus the client has open
G_CloseMenus( self->client->ps.clientNum );
+ //TA: deactivate all upgrades
+ for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
+ BG_deactivateItem( i, self->client->ps.stats );
+
// broadcast the death event to everyone
ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY );
ent->s.eventParm = meansOfDeath;