From 266d6696eb0659065bd9d605f91dd4e2e72eabe0 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 28 Jul 2004 12:52:20 +0000 Subject: * Most of the changes in the forum thread "Shake up" --- src/cgame/cg_event.c | 9 +++++++++ src/game/bg_misc.c | 46 +++++++++++++++++++++++++++++++++++++++++----- src/game/bg_pmove.c | 2 +- src/game/bg_public.h | 2 ++ src/game/g_active.c | 9 +++++++++ src/game/g_buildable.c | 13 +++++++++++++ src/game/g_cmds.c | 16 ++++++++++++---- src/game/g_combat.c | 38 ++++++++++++++++++++------------------ src/game/g_local.h | 3 +++ src/game/tremulous.h | 8 +++++--- 10 files changed, 115 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index ccad75a4..9b60df70 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -851,6 +851,15 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) } break; + case EV_DCC_ATTACK: + DEBUGNAME( "EV_DCC_ATTACK" ); + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS ) + { + //trap_S_StartLocalSound( cgs.media.humanDCCAttack, CHAN_ANNOUNCER ); + CG_CenterPrint( "Our base is under attack!", 200, GIANTCHAR_WIDTH * 4 ); + } + break; + case EV_OVERMIND_SPAWNS: DEBUGNAME( "EV_OVERMIND_SPAWNS" ); if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 80186145..f39f1ec0 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3957,12 +3957,12 @@ upgradeAttributes_t bg_upgrades[ ] = WUT_HUMANS //WUTeam_t team; }, { - UP_BATTLESUIT, //int upgradeNum; - BSUIT_PRICE, //int price; - ( 1 << S2 )|( 1 << S3 ), //int stages + UP_BATTLESUIT, //int upgradeNum; + BSUIT_PRICE, //int price; + ( 1 << S3 ), //int stages SLOT_HEAD|SLOT_TORSO|SLOT_ARMS|SLOT_LEGS|SLOT_BACKPACK, //int slots; - "bsuit", //char *upgradeName; - "Battlesuit", //char *upgradeHumanName; + "bsuit", //char *upgradeName; + "Battlesuit", //char *upgradeHumanName; "icons/iconu_bsuit", WUT_HUMANS //WUTeam_t team; }, @@ -4347,6 +4347,8 @@ char *eventnames[ ] = "EV_OVERMIND_DYING", //TA: overmind close to death "EV_OVERMIND_SPAWNS", //TA: overmind needs spawns + "EV_DCC_ATTACK", //TA: dcc under attack + "EV_RPTUSE_SOUND" //TA: trigger a sound }; @@ -4852,3 +4854,37 @@ void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, VectorMA( entityOrigin, 0.1f, playerNormal, outOrigin ); vectoangles( forward, outAngles ); } + +/* +=============== +BG_GetValueOfHuman + +Returns the kills value of some human player +=============== +*/ +int BG_GetValueOfHuman( playerState_t *ps ) +{ + int i, worth = 0; + float portion; + + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + { + if( BG_gotItem( i, ps->stats ) ) + worth += BG_FindPriceForUpgrade( i ); + } + + for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) + { + if( BG_gotWeapon( i, ps->stats ) ) + worth += BG_FindPriceForWeapon( i ); + } + + portion = worth / (float)HUMAN_MAXED; + + if( portion < 0.01f ) + portion = 0.01f; + else if( portion > 1.0f ) + portion = 1.0f; + + return ceil( ALIEN_MAX_SINGLE_KILLS * portion ); +} diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 2fc225c2..24e6940d 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -3132,7 +3132,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) ps->viewangles[ i ] = tempang[ i ]; //pull the view into the lock point - if( ps->pm_type == PM_GRABBED ) + if( ps->pm_type == PM_GRABBED && !BG_gotItem( UP_BATTLESUIT, ps->stats ) ) { vec3_t dir, angles; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 17333648..3755c559 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -558,6 +558,8 @@ typedef enum EV_OVERMIND_DYING, //TA: overmind close to death EV_OVERMIND_SPAWNS, //TA: overmind needs spawns + EV_DCC_ATTACK, //TA: dcc under attack + EV_RPTUSE_SOUND //TA: trigger a sound } entity_event_t; diff --git a/src/game/g_active.c b/src/game/g_active.c index acd6a4f1..91f513d6 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1272,6 +1272,15 @@ void ClientThink_real( gentity_t *ent ) client->retriggerArmouryMenu = 0; } + if( ent->suicideTime > 0 && ent->suicideTime < level.time ) + { + ent->flags &= ~FL_GODMODE; + ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0; + player_die( ent, ent, ent, 100000, MOD_SUICIDE ); + + ent->suicideTime = 0; + } + // perform once-a-second actions ClientTimerActions( ent, msec ); } diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index b0586166..40604f6d 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1500,6 +1500,9 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) activator->client->lastRefilTime = level.time; } + +#define DCC_ATTACK_PERIOD 10000 + /* ================ HReactor_Think @@ -1540,6 +1543,16 @@ void HReactor_Think( gentity_t *self ) tent->s.clientNum = enemy->s.number; //dest } } + + //reactor under attack + if( self->health < self->lastHealth && + level.time > self->dccAttackTimer && G_isDCC( ) ) + { + self->dccAttackTimer = level.time + DCC_ATTACK_PERIOD; + G_BroadcastEvent( EV_DCC_ATTACK, 0 ); + } + + self->lastHealth = self->health; } self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index cbd10555..f10177d7 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -413,9 +413,17 @@ void Cmd_Kill_f( gentity_t *ent ) if( ent->health <= 0 ) return; - ent->flags &= ~FL_GODMODE; - ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0; - player_die( ent, ent, ent, 100000, MOD_SUICIDE ); + if( g_cheats.integer ) + { + ent->flags &= ~FL_GODMODE; + ent->client->ps.stats[ STAT_HEALTH ] = ent->health = 0; + player_die( ent, ent, ent, 100000, MOD_SUICIDE ); + } + else + { + trap_SendServerCommand( ent-g_entities, "print \"You will suicide in 10 seconds.\n\"" ); + ent->suicideTime = level.time + 10000; + } } /* @@ -1302,7 +1310,7 @@ void Cmd_Destroy_f( gentity_t *ent, qboolean deconstruct ) G_FreeEntity( traceEnt ); ent->client->ps.stats[ STAT_MISC ] += - BG_FindBuildDelayForWeapon( ent->s.weapon ) >> 1; + BG_FindBuildDelayForWeapon( ent->s.weapon ) >> 2; } } } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 0714eb8b..b90adde4 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -243,13 +243,10 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int else if( attacker->s.eType != ET_BUILDABLE ) AddScore( self, -1 ); - if( attacker && attacker->client && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && - self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + if( attacker && attacker->client ) { int clientNum = attacker->client->ps.clientNum; float denominator, numerator = self->credits[ clientNum ]; - int classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); int total = 0; gentity_t *player; @@ -263,27 +260,34 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int { player = g_entities + i; - if( player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && + player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { + int classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] ); numerator = self->credits[ i ]; //add credit - player->client->ps.persistant[ PERS_CREDIT ] += (int)( (float)classValue * ( numerator / denominator ) ); + player->client->ps.persistant[ PERS_CREDIT ] += + (int)( (float)classValue * ( numerator / denominator ) ); if( player->client->ps.persistant[ PERS_CREDIT ] > HUMAN_MAX_CREDITS ) player->client->ps.persistant[ PERS_CREDIT ] = HUMAN_MAX_CREDITS; } + else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && + player->client && player->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + int classValue = BG_GetValueOfHuman( self->client->ps ); + numerator = self->credits[ i ]; + + //add kills + player->client->ps.persistant[ PERS_CREDIT ] += + (int)round( (float)classValue * ( numerator / denominator ) ); + + if( player->client->ps.persistant[ PERS_CREDIT ] > ALIEN_MAX_KILLS ) + player->client->ps.persistant[ PERS_CREDIT ] = ALIEN_MAX_KILLS; + } } } - else if( attacker && attacker->client && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && - self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - { - attacker->client->ps.persistant[ PERS_CREDIT ]++; - - if( attacker->client->ps.persistant[ PERS_CREDIT ] > ALIEN_MAX_KILLS ) - attacker->client->ps.persistant[ PERS_CREDIT ] = ALIEN_MAX_KILLS; - } // Add team bonuses //Team_FragBonuses(self, inflictor, attacker); @@ -1030,9 +1034,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, } //TA: add to the attackers "account" on the target - if( targ->client && attacker->client && - targ->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && - attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + if( targ->client && attacker->client ) targ->credits[ attacker->client->ps.clientNum ] += take; if( targ->health <= 0 ) diff --git a/src/game/g_local.h b/src/game/g_local.h index 5972c356..4073e2e4 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -201,6 +201,7 @@ struct gentity_s int overmindAttackTimer; int overmindDyingTimer; int overmindSpawnsTimer; + int dccAttackTimer; int nextPhysicsTime; //TA: buildables don't need to check what they're sitting on // every single frame.. so only do it periodically int clientSpawnTime; //TA: the time until this spawn can spawn a client @@ -224,6 +225,8 @@ struct gentity_s upgrade_t uTriggers[ UP_NUM_UPGRADES ]; //TA: which upgrades are triggers int triggerGravity; //TA: gravity for this trigger + + int suicideTime; //TA: when the client will suicide }; typedef enum diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 3c8f1cd5..fa4c131e 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -307,7 +307,7 @@ * */ -#define HUMAN_WDMG_MODIFIER 1.09f +#define HUMAN_WDMG_MODIFIER 1.12f #define HDM(d) ((int)((float)d*HUMAN_WDMG_MODIFIER)) #define BLASTER_REPEAT 600 @@ -386,7 +386,7 @@ #define LCANNON_RADIUS 150 #define LCANNON_SECONDARY_DAMAGE HDM(30) #define LCANNON_SECONDARY_RADIUS 75 -#define LCANNON_SPEED 250 +#define LCANNON_SPEED 350 #define LCANNON_CHARGE_TIME 2000 #define LCANNON_TOTAL_CHARGE 255 @@ -420,7 +420,7 @@ #define JETPACK_DISABLE_TIME 1000 //time to disable the jetpack when player damaged #define JETPACK_DISABLE_CHANCE 0.3f -#define BSUIT_PRICE 200 +#define BSUIT_PRICE 400 #define MGCLIP_PRICE 0 @@ -542,5 +542,7 @@ #define MAX_FALL_DISTANCE 120.0f //the fall distance at which maximum damage is dealt #define AVG_FALL_DISTANCE ((MIN_FALL_DISTANCE+MAX_FALL_DISTANCE)/2.0f) +#define HUMAN_MAXED 900 //a human with a strong selection of weapons/upgrades #define HUMAN_MAX_CREDITS 2000 #define ALIEN_MAX_KILLS 9 +#define ALIEN_MAX_SINGLE_KILLS 3 -- cgit