diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_buildable.c | 6 | ||||
-rw-r--r-- | src/cgame/cg_event.c | 45 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 11 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 33 | ||||
-rw-r--r-- | src/game/bg_public.h | 9 | ||||
-rw-r--r-- | src/game/g_buildable.c | 29 | ||||
-rw-r--r-- | src/game/g_local.h | 5 | ||||
-rw-r--r-- | src/game/g_utils.c | 17 | ||||
-rw-r--r-- | src/game/g_weapon.c | 5 |
9 files changed, 130 insertions, 30 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 4c1db197..86353f12 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -340,7 +340,6 @@ static void CG_SetBuildableLerpFrameAnimation( buildable_t buildable, lerpFrame_ animation_t *anim; lf->animationNumber = newAnimation; - newAnimation &= ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT ); if( newAnimation < 0 || newAnimation >= MAX_BUILDABLE_ANIMATIONS ) CG_Error( "Bad animation number: %i", newAnimation ); @@ -373,6 +372,8 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) lerpFrame_t *lf = ¢->lerpFrame; animation_t *anim; buildableAnimNumber_t newAnimation = cent->buildableAnim; + + newAnimation &= ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT ); // debugging tool to get no animations if( cg_animSpeed.integer == 0 ) @@ -386,6 +387,9 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) { CG_SetBuildableLerpFrameAnimation( buildable, lf, newAnimation ); + CG_Printf( "new anim/sound: %d %d\n", !cg_buildables[ buildable ].sounds[ newAnimation ].looped, + cg_buildables[ buildable ].sounds[ newAnimation ].enabled ); + if( !cg_buildables[ buildable ].sounds[ newAnimation ].looped && cg_buildables[ buildable ].sounds[ newAnimation ].enabled ) trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 087dafc1..87f10a8d 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -799,19 +799,46 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) } break; - case EV_POISONCLOUD: - DEBUGNAME( "EV_POISONCLOUD" ); - cg.firstPoisonedTime = cg.time; + case EV_BUILD_REPAIR: + DEBUGNAME( "EV_BUILD_REPAIR" ); + trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairSound ); + break; + + case EV_BUILD_REPAIRED: + DEBUGNAME( "EV_BUILD_REPAIRED" ); + trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairedSound ); + break; + + case EV_OVERMIND_ATTACK: + DEBUGNAME( "EV_OVERMIND_ATTACK" ); + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + trap_S_StartLocalSound( cgs.media.alienOvermindAttack, CHAN_ANNOUNCER ); + CG_CenterPrint( "The Overmind is under attack!", 200, GIANTCHAR_WIDTH * 4 ); + } break; - case EV_KNOCKOVER: - DEBUGNAME( "EV_KNOCKOVER" ); - cg.firstKnockedTime = cg.time; + case EV_OVERMIND_DYING: + DEBUGNAME( "EV_OVERMIND_DYING" ); + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + trap_S_StartLocalSound( cgs.media.alienOvermindDying, CHAN_ANNOUNCER ); + CG_CenterPrint( "The Overmind is dying!", 200, GIANTCHAR_WIDTH * 4 ); + } break; - case EV_GETUP: - DEBUGNAME( "EV_GETUP" ); - cg.firstGetUpTime = cg.time; + case EV_OVERMIND_SPAWNS: + DEBUGNAME( "EV_OVERMIND_SPAWNS" ); + if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + trap_S_StartLocalSound( cgs.media.alienOvermindSpawns, CHAN_ANNOUNCER ); + CG_CenterPrint( "The Overmind needs spawns!", 200, GIANTCHAR_WIDTH * 4 ); + } + break; + + case EV_POISONCLOUD: + DEBUGNAME( "EV_POISONCLOUD" ); + cg.firstPoisonedTime = cg.time; break; case EV_PLAYER_RESPAWN: diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 177ab40c..d3aadb32 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -737,10 +737,6 @@ typedef struct int poisonedTime; //TA: poison cloud int firstPoisonedTime; //TA: poison cloud - int lastRumbleTime; //TA: knocked over time - vec3_t rumbleVector; //TA: vertical displacement whilst rumbling - int firstKnockedTime; //TA: knocked over time - int firstGetUpTime; //TA: getting up time float charModelFraction; //TA: loading percentages float mediaFraction; @@ -924,6 +920,10 @@ typedef struct sfxHandle_t alienStageTransition; sfxHandle_t humanStageTransition; + sfxHandle_t alienOvermindAttack; + sfxHandle_t alienOvermindDying; + sfxHandle_t alienOvermindSpawns; + sfxHandle_t humanBuildableExpl; qhandle_t cursor; @@ -948,6 +948,9 @@ typedef struct qhandle_t jetpackFlashModel; sfxHandle_t repeaterUseSound; + + sfxHandle_t buildableRepairSound; + sfxHandle_t buildableRepairedSound; } cgMedia_t; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index d52c77ec..0f1308b7 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -564,6 +564,10 @@ static void CG_RegisterSounds( void ) cgs.media.alienStageTransition = trap_S_RegisterSound( "sound/announcements/overmindevolved.wav", qtrue ); cgs.media.humanStageTransition = trap_S_RegisterSound( "sound/announcements/reinforcement.wav", qtrue ); + cgs.media.alienOvermindAttack = trap_S_RegisterSound( "sound/announcements/overmindattack.wav", qtrue ); + cgs.media.alienOvermindDying = trap_S_RegisterSound( "sound/announcements/overminddying.wav", qtrue ); + cgs.media.alienOvermindSpawns = trap_S_RegisterSound( "sound/announcements/overmindspawns.wav", qtrue ); + cgs.media.tracerSound = trap_S_RegisterSound( "sound/weapons/machinegun/buletby1.wav", qfalse ); cgs.media.selectSound = trap_S_RegisterSound( "sound/weapons/change.wav", qfalse ); cgs.media.wearOffSound = trap_S_RegisterSound( "sound/items/wearoff.wav", qfalse ); @@ -628,23 +632,26 @@ static void CG_RegisterSounds( void ) } //TA: - cgs.media.jetpackDescendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/low.wav", qfalse ); - cgs.media.jetpackIdleSound = trap_S_RegisterSound( "sound/upgrades/jetpack/idle.wav", qfalse ); - cgs.media.jetpackAscendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/hi.wav", qfalse ); + cgs.media.jetpackDescendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/low.wav", qfalse ); + cgs.media.jetpackIdleSound = trap_S_RegisterSound( "sound/upgrades/jetpack/idle.wav", qfalse ); + cgs.media.jetpackAscendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/hi.wav", qfalse ); - cgs.media.humanBuildableExpl = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); + cgs.media.humanBuildableExpl = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse ); // FIXME: only needed with item - cgs.media.sfx_ric1 = trap_S_RegisterSound( "sound/weapons/machinegun/ric1.wav", qfalse ); - cgs.media.sfx_ric2 = trap_S_RegisterSound( "sound/weapons/machinegun/ric2.wav", qfalse ); - cgs.media.sfx_ric3 = trap_S_RegisterSound( "sound/weapons/machinegun/ric3.wav", qfalse ); - cgs.media.sfx_plasmaexp = trap_S_RegisterSound( "sound/weapons/plasma/plasmx1a.wav", qfalse ); - cgs.media.sfx_flamerexp = trap_S_RegisterSound( "sound/weapons/flamer/fireimpc.wav", qfalse ); - - cgs.media.hgrenb1aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb1a.wav", qfalse ); - cgs.media.hgrenb2aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb2a.wav", qfalse ); + cgs.media.sfx_ric1 = trap_S_RegisterSound( "sound/weapons/machinegun/ric1.wav", qfalse ); + cgs.media.sfx_ric2 = trap_S_RegisterSound( "sound/weapons/machinegun/ric2.wav", qfalse ); + cgs.media.sfx_ric3 = trap_S_RegisterSound( "sound/weapons/machinegun/ric3.wav", qfalse ); + cgs.media.sfx_plasmaexp = trap_S_RegisterSound( "sound/weapons/plasma/plasmx1a.wav", qfalse ); + cgs.media.sfx_flamerexp = trap_S_RegisterSound( "sound/weapons/flamer/fireimpc.wav", qfalse ); + + cgs.media.hgrenb1aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb1a.wav", qfalse ); + cgs.media.hgrenb2aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb2a.wav", qfalse ); + + cgs.media.repeaterUseSound = trap_S_RegisterSound( "sound/buildables/repeater/use.wav", qfalse ); - cgs.media.repeaterUseSound = trap_S_RegisterSound( "sound/buildables/repeater/use.wav", qfalse ); + cgs.media.buildableRepairSound = trap_S_RegisterSound( "sound/buildables/human/repair.wav", qfalse ); + cgs.media.buildableRepairedSound = trap_S_RegisterSound( "sound/buildables/human/repaired.wav", qfalse ); } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index f2b63342..ff96700d 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -532,9 +532,14 @@ typedef enum EV_TAUNT, EV_BUILD_DELAY, //TA: can't build yet + EV_BUILD_REPAIR, //TA: repairing buildable + EV_BUILD_REPAIRED, //TA: buildable has full health + + EV_OVERMIND_ATTACK, //TA: overmind under attack + EV_OVERMIND_DYING, //TA: overmind close to death + EV_OVERMIND_SPAWNS, //TA: overmind needs spawns + EV_POISONCLOUD, //TA: client poisoned - EV_KNOCKOVER, //TA: client knocked over - EV_GETUP, //TA: client getting up EV_RPTUSE_SOUND //TA: trigger a sound } entity_event_t; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index cb48dc21..7ebd97d0 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -527,6 +527,10 @@ void ASpawn_Pain( gentity_t *self, gentity_t *attacker, int damage ) +#define OVERMIND_ATTACK_PERIOD 10000 +#define OVERMIND_DYING_PERIOD 5000 +#define OVERMIND_SPAWNS_PERIOD 30000 + /* ================ AOvermind_Think @@ -561,6 +565,29 @@ void AOvermind_Think( gentity_t *self ) G_setBuildableAnim( self, BANIM_ATTACK1, qfalse ); } } + + //low on spawns + if( level.numAlienSpawns <= 1 && level.time > self->overmindSpawnsTimer ) + { + self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD; + G_BroadcastEvent( EV_OVERMIND_SPAWNS, 0 ); + } + + //overmind dying + if( self->health < ( OVERMIND_HEALTH / 10.0f ) && level.time > self->overmindDyingTimer ) + { + self->overmindDyingTimer = level.time + OVERMIND_DYING_PERIOD; + G_BroadcastEvent( EV_OVERMIND_DYING, 0 ); + } + + //overmind under attack + if( self->health < self->lastHealth && level.time > self->overmindAttackTimer ) + { + self->overmindAttackTimer = level.time + OVERMIND_ATTACK_PERIOD; + G_BroadcastEvent( EV_OVERMIND_ATTACK, 0 ); + } + + self->lastHealth = self->health; } creepSlow( self->s.modelindex, self->s.origin ); @@ -2186,7 +2213,7 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin G_AddEvent( built, EV_BUILD_CONSTRUCT, 0 ); if( built->builtBy >= 0 ) - G_setBuildableAnim( built, BANIM_CONSTRUCT1, qfalse ); + G_setBuildableAnim( built, BANIM_CONSTRUCT1, qtrue ); trap_LinkEntity( built ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 165b9c90..411bdde1 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -143,6 +143,7 @@ struct gentity_s int last_move_time; int health; + int lastHealth; //TA: currently only used for overmind qboolean takedamage; @@ -182,6 +183,9 @@ struct gentity_s qboolean spawned; //TA: whether or not this buildable has finished spawning int buildTime; //TA: when this buildable was built int time1000; //TA: timer evaluated every second + int overmindAttackTimer; + int overmindDyingTimer; + int overmindSpawnsTimer; int credits[ MAX_CLIENTS ]; //TA: human credits for each client qboolean creditsHash[ MAX_CLIENTS ]; //TA: track who has claimed credit @@ -590,6 +594,7 @@ float vectoyaw( const vec3_t vec ); void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm ); void G_AddEvent( gentity_t *ent, int event, int eventParm ); +void G_BroadcastEvent( int event, int eventParm ); void G_SetOrigin( gentity_t *ent, vec3_t origin ); void AddRemap(const char *oldShader, const char *newShader, float timeOffset); const char *BuildShaderStateConfig(); diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 3c5ef2e2..7d9b362e 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -647,6 +647,23 @@ void G_AddEvent( gentity_t *ent, int event, int eventParm ) /* +=============== +G_BroadcastEvent + +Sends an event to every client +=============== +*/ +void G_BroadcastEvent( int event, int eventParm ) +{ + gentity_t *ent; + + ent = G_TempEntity( vec3_origin, event ); + ent->s.eventParm = eventParm; + ent->r.svFlags = SVF_BROADCAST; // send to everyone +} + + +/* ============= G_Sound ============= diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 79bd1cb7..3c10db5e 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -478,6 +478,11 @@ void cancelBuildFire( gentity_t *ent ) if( traceEnt->health > bHealth ) traceEnt->health = bHealth; + + if( traceEnt->health == bHealth ) + G_AddEvent( ent, EV_BUILD_REPAIRED, 0 ); + else + G_AddEvent( ent, EV_BUILD_REPAIR, 0 ); } } else if( ent->client->ps.weapon == WP_ABUILD2 ) |