diff options
author | Tim Angus <tim@ngus.net> | 2004-03-20 00:10:20 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2004-03-20 00:10:20 +0000 |
commit | 23e5d1b97402c638c2207031ed8e097e64b5342c (patch) | |
tree | dda3c62bda7499bc73ae0115f01c26cb26dcf0d5 | |
parent | 5c2af1789513e6f0144bb1136b8a047b50183aa5 (diff) |
* Added lcannon warning and blowup
* Fixed some serious bugs in the spawn queue code
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 3 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 11 | ||||
-rw-r--r-- | src/game/g_main.c | 85 | ||||
-rw-r--r-- | src/game/g_missile.c | 7 | ||||
-rw-r--r-- | src/game/g_trigger.c | 4 | ||||
-rw-r--r-- | src/game/tremulous.h | 2 |
8 files changed, 83 insertions, 33 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index c3fd240e..e637742e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1221,6 +1221,8 @@ typedef struct qhandle_t humanBuildableDestroyedPS; qhandle_t alienBuildableDamagedPS; qhandle_t alienBuildableDestroyedPS; + + sfxHandle_t lCannonWarningSound; } cgMedia_t; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 725cc195..54d6feac 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -673,6 +673,8 @@ static void CG_RegisterSounds( void ) cgs.media.buildableRepairSound = trap_S_RegisterSound( "sound/buildables/human/repair.wav", qfalse ); cgs.media.buildableRepairedSound = trap_S_RegisterSound( "sound/buildables/human/repaired.wav", qfalse ); + + cgs.media.lCannonWarningSound = trap_S_RegisterSound( "models/weapons/lcannon/warning.wav", qfalse ); } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index e01339db..87534f23 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1274,6 +1274,9 @@ void CG_AddViewWeapon( playerState_t *ps ) VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ], hand.origin ); VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ], hand.origin ); + + if( ps->stats[ STAT_MISC ] > ( LCANNON_TOTAL_CHARGE - ( LCANNON_TOTAL_CHARGE / 3 ) ) ) + trap_S_AddLoopingSound( ps->clientNum, ps->origin, vec3_origin, cgs.media.lCannonWarningSound ); } AnglesToAxis( angles, hand.axis ); diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 3c3983ea..2fc225c2 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2819,9 +2819,14 @@ static void PM_Weapon( void ) if( ( attack1 || pm->ps->stats[ STAT_MISC ] == 0 ) && !attack2 && !attack3 ) { - pm->ps->weaponTime = 0; - pm->ps->weaponstate = WEAPON_READY; - return; + if( pm->ps->stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE ) + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; + return; + } + else + attack1 = !attack1; } //erp this looks confusing diff --git a/src/game/g_main.c b/src/game/g_main.c index b0107826..c5670f32 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -747,28 +747,31 @@ qboolean G_RemoveFromSpawnQueue( spawnQueue_t *sq, int clientNum ) { int i = sq->front; - do + if( G_GetSpawnQueueLength( sq ) ) { - if( sq->clients[ i ] == clientNum ) + do { - //and this kids is why it would have - //been better to use an LL for internal - //representation - do + if( sq->clients[ i ] == clientNum ) { - sq->clients[ i ] = sq->clients[ QUEUE_PLUS1( i ) ]; - - i = QUEUE_PLUS1( i ); - } while( i != sq->back ); + //and this kids is why it would have + //been better to use an LL for internal + //representation + do + { + sq->clients[ i ] = sq->clients[ QUEUE_PLUS1( i ) ]; + + i = QUEUE_PLUS1( i ); + } while( i != sq->back ); - sq->back = QUEUE_MINUS1( sq->back ); - g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED; - - return qtrue; - } + sq->back = QUEUE_MINUS1( sq->back ); + g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED; + + return qtrue; + } - i = QUEUE_PLUS1( i ); - } while( i != QUEUE_PLUS1( sq->back ) ); + i = QUEUE_PLUS1( i ); + } while( i != QUEUE_PLUS1( sq->back ) ); + } return qfalse; } @@ -784,24 +787,54 @@ int G_GetPosInSpawnQueue( spawnQueue_t *sq, int clientNum ) { int i = sq->front; - do + if( G_GetSpawnQueueLength( sq ) ) { - if( sq->clients[ i ] == clientNum ) + do { - if( i < sq->front ) - return i + MAX_CLIENTS - sq->front + 1; - else - return i - sq->front + 1; - } + if( sq->clients[ i ] == clientNum ) + { + if( i < sq->front ) + return i + MAX_CLIENTS - sq->front + 1; + else + return i - sq->front + 1; + } - i = QUEUE_PLUS1( i ); - } while( i != QUEUE_PLUS1( sq->back ) ); + i = QUEUE_PLUS1( i ); + } while( i != QUEUE_PLUS1( sq->back ) ); + } return -1; } /* ============ +G_PrintSpawnQueue + +Print the contents of a spawn queue +============ +*/ +void G_PrintSpawnQueue( spawnQueue_t *sq ) +{ + int i = sq->front; + int length = G_GetSpawnQueueLength( sq ); + + G_Printf( "l: %d f: %d b: %d c: ", length, sq->front, sq->back ); + + if( length > 0 ) + { + do + { + G_Printf( "%d ", sq->clients[ i ] ); + + i = QUEUE_PLUS1( i ); + } while( i != QUEUE_PLUS1( sq->back ) ); + } + + G_Printf( "\n" ); +} + +/* +============ G_SpawnClients Spawn queued clients diff --git a/src/game/g_missile.c b/src/game/g_missile.c index d97b2fd3..9efbd3e1 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -423,7 +423,12 @@ gentity_t *fire_luciferCannon( gentity_t *self, vec3_t start, vec3_t dir, int da bolt = G_Spawn( ); bolt->classname = "lcannon"; - bolt->nextthink = level.time + 10000; + + if( damage == LCANNON_TOTAL_CHARGE ) + bolt->nextthink = level.time; + else + bolt->nextthink = level.time + 10000; + bolt->think = G_ExplodeMissile; bolt->s.eType = ET_MISSILE; bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index 1bd05a38..a1ebad84 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -510,8 +510,8 @@ void trigger_stage_use( gentity_t *self, gentity_t *other, gentity_t *activator void SP_trigger_stage( gentity_t *self ) { - G_SpawnInt( "team", "0", &self->stageTeam ); - G_SpawnInt( "stage", "0", &self->stageStage ); + G_SpawnInt( "team", "0", (int *)&self->stageTeam ); + G_SpawnInt( "stage", "0", (int *)&self->stageStage ); self->use = trigger_stage_use; diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 2f519cf2..8ea2b8be 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -387,7 +387,7 @@ #define LCANNON_SECONDARY_DAMAGE HDM(30) #define LCANNON_SECONDARY_RADIUS 75 #define LCANNON_SPEED 250 -#define LCANNON_CHARGE_TIME 1000 +#define LCANNON_CHARGE_TIME 2000 #define LCANNON_TOTAL_CHARGE 255 #define HBUILD_PRICE 0 |