diff options
author | Tim Angus <tim@ngus.net> | 2001-12-24 02:24:01 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-12-24 02:24:01 +0000 |
commit | ed0dbc4a8dbcdf9a9c0d23eaad411099e38a7908 (patch) | |
tree | 44d62ec3fa1ef9397b956185cd21bdb3be3c9797 /src | |
parent | 37651838b6ed3731f50ce0c798b02161ca2919ab (diff) |
Alien Hovel
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 15 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 9 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 11 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 4 | ||||
-rw-r--r-- | src/game/bg_misc.c | 10 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 3 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_active.c | 77 | ||||
-rw-r--r-- | src/game/g_buildable.c | 75 | ||||
-rw-r--r-- | src/game/g_client.c | 12 | ||||
-rw-r--r-- | src/game/g_cmds.c | 9 | ||||
-rw-r--r-- | src/game/g_local.h | 2 |
12 files changed, 173 insertions, 55 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 7aee0784..5acb96d8 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1142,7 +1142,8 @@ static float CG_DrawScores( float y ) { x = 640; score = cg.snap->ps.persistant[PERS_SCORE]; spectator = ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) || - ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ); + ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) || + ( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ); // always show your score in the second box if not in first place if ( s1 != score ) { @@ -1856,9 +1857,9 @@ static void CG_DrawCrosshair(void) { } if( ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) || - ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) ) { + ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) || + ( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) ) return; - } if ( cg.renderingThirdPerson ) { return; @@ -2281,11 +2282,15 @@ static void CG_Draw2D( void ) { CG_DrawLighting(); if( ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) || - ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) ) { + ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) || + ( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) ) + { CG_DrawSpectator(); CG_DrawCrosshair(); CG_DrawCrosshairNames(); - } else { + } + else + { // don't draw any status if dead or the scoreboard is being explicitly shown if ( !cg.showScores && cg.snap->ps.stats[STAT_HEALTH] > 0 ) { CG_DrawStatusBar(); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 8ed1a054..5b972aa8 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -791,15 +791,6 @@ typedef struct { qhandle_t humanTorch3; qhandle_t humanTorch2; qhandle_t humanTorch1; - qhandle_t alienNav9; - qhandle_t alienNav8; - qhandle_t alienNav7; - qhandle_t alienNav6; - qhandle_t alienNav5; - qhandle_t alienNav4; - qhandle_t alienNav3; - qhandle_t alienNav2; - qhandle_t alienNav1; qhandle_t alienHealth; qhandle_t flameShader[ 32 ]; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 8f9a6668..c26564da 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -752,7 +752,7 @@ static void CG_RegisterGraphics( void ) { /*cgs.media.creepShader = trap_R_RegisterShader( "creep" );*/ - cgs.media.scannerBlipShader = trap_R_RegisterShader( "gfx/2d/alienhealth" ); + cgs.media.scannerBlipShader = trap_R_RegisterShader( "gfx/2d/droidhealth" ); cgs.media.scannerLineShader = trap_R_RegisterShader( "gfx/2d/func/mult2" ); /*cgs.media.scannerShader = trap_R_RegisterShader( "gfx/2d/scanner" );*/ @@ -815,15 +815,6 @@ static void CG_RegisterGraphics( void ) { cgs.media.humanTorch3 = trap_R_RegisterShader( "humanTorch3" ); cgs.media.humanTorch2 = trap_R_RegisterShader( "humanTorch2" ); cgs.media.humanTorch1 = trap_R_RegisterShader( "humanTorch1" ); - cgs.media.alienNav9 = trap_R_RegisterShader( "alienNav9" ); - cgs.media.alienNav8 = trap_R_RegisterShader( "alienNav8" ); - cgs.media.alienNav7 = trap_R_RegisterShader( "alienNav7" ); - cgs.media.alienNav6 = trap_R_RegisterShader( "alienNav6" ); - cgs.media.alienNav5 = trap_R_RegisterShader( "alienNav5" ); - cgs.media.alienNav4 = trap_R_RegisterShader( "alienNav4" ); - cgs.media.alienNav3 = trap_R_RegisterShader( "alienNav3" ); - cgs.media.alienNav2 = trap_R_RegisterShader( "alienNav2" ); - cgs.media.alienNav1 = trap_R_RegisterShader( "alienNav1" ); cgs.media.alienHealth = trap_R_RegisterShader( "gfx/2d/droidhealth.tga" ); cgs.media.armorModel = trap_R_RegisterModel( "models/powerups/armor/armor_yel.md3" ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index b8794354..8b832966 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1331,9 +1331,9 @@ void CG_AddViewWeapon( playerState_t *ps ) { weaponInfo_t *weapon; if( ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) || - ( ps->stats[ STAT_STATE ] & SS_INFESTING ) ) { + ( ps->stats[ STAT_STATE ] & SS_INFESTING ) || + ( ps->stats[ STAT_STATE ] & SS_HOVELING ) ) return; - } //TA: no weapon carried - can't draw it if( ps->weapon == WP_NONE ) diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index ac7973ee..071ceb7f 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1147,7 +1147,7 @@ buildableAttributes_t bg_buildableList[ ] = BIT_ALIENS, //int team; ( 1 << WP_ABUILD )|( 1 << WP_ABUILD2 ), //weapon_t buildWeapon; BANIM_IDLE1, //int idleAnim; - -1, //int nextthink; + 150, //int nextthink; 0, //int turretFireSpeed; 0, //int turretRange; WP_NONE, //weapon_t turretProjType; @@ -2045,9 +2045,9 @@ classAttributes_t bg_classList[ ] = 50, //int health; 0, //int armor; SCA_TAKESFALLDAMAGE|SCA_FOVWARPS, //int abilities; - 50.0f, //float buildDist; + 95.0f, //float buildDist; 80, //int fov; - 0.005f, //float bob; + 0.001f, //float bob; 350, //int steptime; 0.8f, //float speed; 1.0f, //float sticky; @@ -2070,9 +2070,9 @@ classAttributes_t bg_classList[ ] = 75, //int health; 10, //int armor; SCA_CANJUMP|SCA_FOVWARPS|SCA_WALLCLIMBER, //int abilities; - 50.0f, //float buildDist; + 95.0f, //float buildDist; 110, //int fov; - 0.005f, //float bob; + 0.001f, //float bob; 200, //int steptime; 1.0f, //float speed; 1.0f, //float sticky; diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index b802e817..9d570cb9 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2084,6 +2084,9 @@ static void PM_Weapon( void ) if( pm->ps->stats[ STAT_STATE ] & SS_INFESTING ) return; + if( pm->ps->stats[ STAT_STATE ] & SS_HOVELING ) + return; + // check for dead player if ( pm->ps->stats[STAT_HEALTH] <= 0 ) { diff --git a/src/game/bg_public.h b/src/game/bg_public.h index bdaaa9c7..c4239e6d 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -242,6 +242,7 @@ typedef enum { #define SS_GRABBED 64 #define SS_BLOBLOCKED 128 #define SS_POISONED 256 +#define SS_HOVELING 512 #define SB_VALID_TOGGLEBIT 16384 diff --git a/src/game/g_active.c b/src/game/g_active.c index ba1382ba..7e79b777 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -266,7 +266,8 @@ void G_TouchTriggers( gentity_t *ent ) { // ignore most entities if a spectator if( ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) || - ( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) ) { + ( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) || + ( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) ) { if ( hit->s.eType != ET_TELEPORT_TRIGGER && // this is ugly but adding a new ET_? type will // most likely cause network incompatibilities @@ -831,7 +832,8 @@ void ClientThink_real( gentity_t *ent ) { client->ps.pm_type = PM_NOCLIP; else if( client->ps.stats[STAT_HEALTH] <= 0 ) client->ps.pm_type = PM_DEAD; - else if( client->ps.stats[ STAT_STATE ] & SS_INFESTING ) + else if( client->ps.stats[ STAT_STATE ] & SS_INFESTING || + client->ps.stats[ STAT_STATE ] & SS_HOVELING ) client->ps.pm_type = PM_FREEZE; else if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED || client->ps.stats[ STAT_STATE ] & SS_GRABBED ) @@ -960,9 +962,10 @@ void ClientThink_real( gentity_t *ent ) { if ( pm.ps->pm_type == PM_DEAD ) { pm.tracemask = MASK_PLAYERSOLID; // & ~CONTENTS_BODY; } - if ( pm.ps->stats[ STAT_STATE ] & SS_INFESTING ) { + if( pm.ps->stats[ STAT_STATE ] & SS_INFESTING || + pm.ps->stats[ STAT_STATE ] & SS_HOVELING ) pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY; - } + else if ( ent->r.svFlags & SVF_BOT ) { pm.tracemask = MASK_PLAYERSOLID | CONTENTS_BOTCLIP; } @@ -1043,29 +1046,73 @@ void ClientThink_real( gentity_t *ent ) { vec3_t view, point; gentity_t *traceEnt; - AngleVectors( client->ps.viewangles, view, NULL, NULL ); - VectorMA( client->ps.origin, 200, view, point ); - trap_Trace( &trace, client->ps.origin, NULL, NULL, point, ent->s.number, MASK_SHOT ); + if( client->ps.stats[ STAT_STATE ] & SS_HOVELING ) + { + gentity_t *hovel = client->infestBody; + vec3_t forward, newOrigin, newAngles; + trace_t tr; + vec3_t mins, maxs; + + BG_FindBBoxForClass( client->ps.stats[ STAT_PCLASS ], mins, maxs, NULL, NULL, NULL ); + + AngleVectors( hovel->s.angles, forward, NULL, NULL ); + VectorInverse( forward ); + + VectorMA( hovel->s.origin, 95.0f, forward, newOrigin ); + vectoangles( forward, newAngles ); + + VectorMA( newOrigin, 1.0f, hovel->s.origin2, newOrigin ); + + trap_Trace( &tr, newOrigin, mins, maxs, newOrigin, 0, MASK_PLAYERSOLID ); + + //only let the player out if there is room + if( tr.fraction == 1.0 ) + { + //prevent lerping + ent->client->ps.eFlags ^= EF_TELEPORT_BIT; + + G_SetOrigin( ent, newOrigin ); + VectorCopy( newOrigin, ent->client->ps.origin ); + SetClientViewAngle( ent, newAngles ); + + //client leaves hovel + client->ps.stats[ STAT_STATE ] &= ~SS_HOVELING; + + //hovel is empty + G_setBuildableAnim( hovel, BANIM_ATTACK1, qfalse ); + hovel->active = qfalse; + } + } + else + { + AngleVectors( client->ps.viewangles, view, NULL, NULL ); + VectorMA( client->ps.origin, 200, view, point ); + trap_Trace( &trace, client->ps.origin, NULL, NULL, point, ent->s.number, MASK_SHOT ); - traceEnt = &g_entities[ trace.entityNum ]; + traceEnt = &g_entities[ trace.entityNum ]; - if( traceEnt->use ) - traceEnt->use( traceEnt, ent, ent ); //other and activator are the same in this context + if( traceEnt->use ) + traceEnt->use( traceEnt, ent, ent ); //other and activator are the same in this context + } } // check for respawning - if ( client->ps.stats[STAT_HEALTH] <= 0 ) { + if( client->ps.stats[STAT_HEALTH] <= 0 ) + { // wait for the attack button to be pressed - if ( level.time > client->respawnTime ) { + if( level.time > client->respawnTime ) + { // forcerespawn is to prevent users from waiting out powerups - if ( g_forcerespawn.integer > 0 && - ( level.time - client->respawnTime ) > 0 ) { //g_forcerespawn.integer * 1000 ) { + if( g_forcerespawn.integer > 0 && + ( level.time - client->respawnTime ) > 0 ) + { //g_forcerespawn.integer * 1000 ) { respawn( ent ); return; } // pressing attack or use is the normal respawn method - if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) { + if( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) + { respawn( ent ); } } diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 94cfea6d..57aa0b55 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -587,6 +587,72 @@ void AAcidTube_Think( gentity_t *self ) /* ================ +AHovel_Use + +Called when an alien uses a hovel +================ +*/ +void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + vec3_t hovelOrigin, hovelAngles, inverseNormal; + + if( self->active ) + { + //this hovel is in use + } + else if( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) || + ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) ) + { + self->active = qtrue; + G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); + + //prevent lerping + activator->client->ps.eFlags ^= EF_TELEPORT_BIT; + + activator->client->sess.sessionTeam = TEAM_FREE; + activator->client->ps.stats[ STAT_STATE ] |= SS_HOVELING; + activator->client->infestBody = self; + + VectorCopy( self->s.pos.trBase, hovelOrigin ); + VectorMA( hovelOrigin, 128.0f, self->s.origin2, hovelOrigin ); + + VectorCopy( self->s.origin2, inverseNormal ); + VectorInverse( inverseNormal ); + vectoangles( inverseNormal, hovelAngles ); + + VectorCopy( activator->s.pos.trBase, activator->hovelOrigin ); + + G_SetOrigin( activator, hovelOrigin ); + VectorCopy( hovelOrigin, activator->client->ps.origin ); + SetClientViewAngle( activator, hovelAngles ); + } +} + + +/* +================ +AHovel_Think + +Think for alien hovel +================ +*/ +void AHovel_Think( gentity_t *self ) +{ + if( self->active ) + G_setIdleBuildableAnim( self, BANIM_IDLE2 ); + else + G_setIdleBuildableAnim( self, BANIM_IDLE1 ); + + self->nextthink = level.time + 200; +} + + +//================================================================================== + + + +/* +================ ABooster_Touch Called when an alien touches a booster @@ -1293,6 +1359,8 @@ qboolean hdef_checktarget( gentity_t *self, gentity_t *target, int range ) return qfalse; if( target->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) // is the target alive? return qfalse; + if( target->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) // is the target alive? + return qfalse; if( target->health <= 0 ) // is the target still alive? return qfalse; if( self->dcced && target->targeted && target->targeted->powered ) //some turret has already selected this target @@ -1782,6 +1850,8 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin case BA_A_HOVEL: built->die = ASpawn_Die; + built->use = AHovel_Use; + built->think = AHovel_Think; built->pain = ASpawn_Pain; break; @@ -1867,12 +1937,13 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin VectorSet( normal, 0.0f, 0.0f, -1.0f ); else VectorCopy( builder->client->ps.grapplePoint, normal ); + + //gently nudge the buildable onto the surface :) + VectorScale( normal, -50.0f, built->s.pos.trDelta ); } else VectorSet( normal, 0.0f, 0.0f, 1.0f ); - VectorMA( origin, -50.0f, normal, built->s.pos.trDelta ); - VectorCopy( normal, built->s.origin2 ); G_AddEvent( built, EV_BUILD_CONSTRUCT, BANIM_CONSTRUCT1 ); diff --git a/src/game/g_client.c b/src/game/g_client.c index d58e7f85..8a57de4c 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -265,7 +265,8 @@ gentity_t *SelectAlienSpawnPoint( void ) count = 0; spot = NULL; - while( ( spot = G_Find( spot, FOFS( classname ), "team_alien_spawn" ) ) != NULL ) + while( ( spot = G_Find( spot, FOFS( classname ), + BG_FindEntityNameForBuildable( BA_A_SPAWN ) ) ) != NULL ) { if( SpotWouldTelefrag( spot ) || ( spot->health <= 0 ) ) continue; @@ -291,7 +292,8 @@ gentity_t *SelectAlienSpawnPoint( void ) if( !count ) { // no spots that won't telefrag - spot = G_Find( NULL, FOFS( classname ), "team_alien_spawn" ); + spot = G_Find( NULL, FOFS( classname ), + BG_FindEntityNameForBuildable( BA_A_SPAWN ) ); if( spot->health > 0 ) return spot; @@ -325,7 +327,8 @@ gentity_t *SelectHumanSpawnPoint( void ) { count = 0; spot = NULL; - while( ( spot = G_Find( spot, FOFS( classname ), "team_human_spawn" ) ) != NULL ) + while( ( spot = G_Find( spot, FOFS( classname ), + BG_FindEntityNameForBuildable( BA_H_SPAWN ) ) ) != NULL ) { if( SpotWouldTelefrag( spot ) || ( spot->health <= 0 ) ) continue; @@ -350,7 +353,8 @@ gentity_t *SelectHumanSpawnPoint( void ) { if( !count ) { // no spots that won't telefrag - spot = G_Find( NULL, FOFS( classname ), "team_human_spawn" ); + spot = G_Find( NULL, FOFS( classname ), + BG_FindEntityNameForBuildable( BA_H_SPAWN ) ); if( spot->health > 0 ) return spot; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 2c36243b..aea70bcb 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -422,6 +422,9 @@ void Cmd_Kill_f( gentity_t *ent ) { if( ent->client->ps.stats[ STAT_STATE ] & SS_INFESTING ) return; + if( ent->client->ps.stats[ STAT_STATE ] & SS_HOVELING ) + return; + if (ent->health <= 0) return; @@ -1594,6 +1597,9 @@ void Cmd_Class_f( gentity_t *ent ) if( ent->client->pers.pclass != PCL_NONE ) { + //prevent lerping + ent->client->ps.eFlags ^= EF_TELEPORT_BIT; + //evolve ent->client->ps.stats[ STAT_PCLASS ] = PCL_NONE; ent->client->sess.sessionTeam = TEAM_FREE; @@ -1605,15 +1611,12 @@ void Cmd_Class_f( gentity_t *ent ) VectorCopy( victim->s.pos.trBase, infestOrigin ); infestOrigin[ 2 ] += 128; - /*trap_Trace( &tr, victim->s.pos.trBase, NULL, NULL, infestOrigin, victim->s.number, MASK_PLAYERSOLID ); - VectorCopy( tr.endpos, infestOrigin );*/ VectorCopy( victim->s.angles, infestAngles ); infestAngles[ PITCH ] = 90; G_SetOrigin( ent, infestOrigin ); VectorCopy( infestOrigin, ent->client->ps.origin ); - SetClientViewAngle( ent, infestAngles ); } else diff --git a/src/game/g_local.h b/src/game/g_local.h index c176fc53..0ed7e9e0 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -186,6 +186,8 @@ struct gentity_s { vec4_t animation; //TA: animated map objects vec3_t turretAim; //TA: aim vector for turrets + + vec3_t hovelOrigin; //TA: player origin before entering hovel }; typedef enum { |