summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-05-01 02:03:55 +0000
committerTim Angus <tim@ngus.net>2004-05-01 02:03:55 +0000
commit127ade46d41e599b55d4359eae5eebf69f638aee (patch)
tree6e154fde3fc1dae0c167aa1cfc96181f5e3862f8 /src/game
parent36ceed63fed29968e418ac4d4bd60d1c1a14bec8 (diff)
* A plethora of assorted fiddles
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_misc.c2
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_buildable.c65
-rw-r--r--src/game/g_cmds.c18
-rw-r--r--src/game/g_combat.c1
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c10
-rw-r--r--src/game/tremulous.h17
8 files changed, 90 insertions, 26 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index ec8f2df6..80186145 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -519,7 +519,7 @@ buildableAttributes_t bg_buildableList[ ] =
BIT_HUMANS, //int team;
( 1 << WP_HBUILD )|( 1 << WP_HBUILD2 ), //weapon_t buildWeapon;
BANIM_IDLE1, //int idleAnim;
- -1, //int nextthink;
+ REACTOR_ATTACK_REPEAT, //int nextthink;
REACTOR_BT, //int buildTime;
qtrue, //qboolean usable;
0, //int turretRange;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 6a279cf5..1021cdf6 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -851,6 +851,7 @@ typedef enum
MOD_HSPAWN,
MOD_TESLAGEN,
MOD_MGTURRET,
+ MOD_REACTOR,
MOD_ASPAWN,
MOD_ATUBE,
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 3cebcd08..f8e83826 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -281,8 +281,8 @@ static qboolean findOvermind( gentity_t *self )
if( self->biteam != BIT_ALIENS )
return qfalse;
- //if this already has dcc then stop now
- if( self->overmindNode )
+ //if this already has overmind then stop now
+ if( self->overmindNode && self->overmindNode->health > 0 )
return qtrue;
//reset parent
@@ -294,7 +294,7 @@ static qboolean findOvermind( gentity_t *self )
if( ent->s.eType != ET_BUILDABLE )
continue;
- //if entity is a dcc calculate the distance to it
+ //if entity is an overmind calculate the distance to it
if( ent->s.modelindex == BA_A_OVERMIND && ent->spawned )
{
self->overmindNode = ent;
@@ -567,6 +567,9 @@ void ASpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
attacker->client->ps.persistant[ PERS_CREDIT ] += OVERMIND_VALUE;
else if( self->s.modelindex == BA_A_SPAWN )
attacker->client->ps.persistant[ PERS_CREDIT ] += ASPAWN_VALUE;
+
+ if( attacker->client->ps.persistant[ PERS_CREDIT ] > HUMAN_MAX_CREDITS )
+ attacker->client->ps.persistant[ PERS_CREDIT ] = HUMAN_MAX_CREDITS;
}
}
@@ -1071,7 +1074,7 @@ void AHovel_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
else if( ( ( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_BASE ) ||
( activator->client->ps.stats[ STAT_PCLASS ] == PCL_A_B_LEV1 ) ) &&
- activator->health > 0 )
+ activator->health > 0 && self->health > 0 )
{
if( AHovel_Blocked( self, activator, qfalse ) )
{
@@ -1460,7 +1463,7 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
if( BG_gotItem( UP_BATTPACK, ps->stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
- BG_unpackAmmoArray( weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL );
+/* BG_unpackAmmoArray( weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL );
if( ammo == maxAmmo && clips < maxClips )
{
@@ -1472,14 +1475,58 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
ammo += maxAmmo >> 1;
if( ammo > maxAmmo )
- ammo = maxAmmo;
+ ammo = maxAmmo;*/
- BG_packAmmoArray( weapon, ps->ammo, ps->powerups, ammo, clips, maxClips );
+ BG_packAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips );
G_AddEvent( activator, EV_RPTUSE_SOUND, 0 );
activator->client->lastRefilTime = level.time;
}
+/*
+================
+HReactor_Think
+
+Think function for Human Reactor
+================
+*/
+void HReactor_Think( gentity_t *self )
+{
+ int entityList[ MAX_GENTITIES ];
+ vec3_t range = { REACTOR_ATTACK_RANGE, REACTOR_ATTACK_RANGE, REACTOR_ATTACK_RANGE };
+ vec3_t mins, maxs;
+ int i, num;
+ gentity_t *enemy, *tent;
+
+ VectorAdd( self->s.origin, range, maxs );
+ VectorSubtract( self->s.origin, range, mins );
+
+ if( self->spawned && ( self->health > 0 ) )
+ {
+ //do some damage
+ num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
+ for( i = 0; i < num; i++ )
+ {
+ enemy = &g_entities[ entityList[ i ] ];
+
+ if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
+ {
+ self->timestamp = level.time;
+ G_SelectiveRadiusDamage( self->s.pos.trBase, self, REACTOR_ATTACK_DAMAGE,
+ REACTOR_ATTACK_RANGE, self, MOD_REACTOR, PTE_HUMANS );
+
+ tent = G_TempEntity( enemy->s.pos.trBase, EV_TESLATRAIL );
+
+ VectorCopy( self->s.pos.trBase, tent->s.origin2 );
+
+ tent->s.generic1 = self->s.number; //src
+ tent->s.clientNum = enemy->s.number; //dest
+ }
+ }
+ }
+
+ self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
+}
//==================================================================================
@@ -2067,6 +2114,9 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
attacker->client->ps.persistant[ PERS_CREDIT ] += REACTOR_VALUE;
else if( self->s.modelindex == BA_H_SPAWN )
attacker->client->ps.persistant[ PERS_CREDIT ] += HSPAWN_VALUE;
+
+ if( attacker->client->ps.persistant[ PERS_CREDIT ] > ALIEN_MAX_KILLS )
+ attacker->client->ps.persistant[ PERS_CREDIT ] = ALIEN_MAX_KILLS;
}
}
@@ -2503,6 +2553,7 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
break;
case BA_H_REACTOR:
+ built->think = HReactor_Think;
built->die = HSpawn_Die;
built->use = HRpt_Use;
built->powered = built->active = qtrue;
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 6327ece5..1a631389 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1051,7 +1051,7 @@ void Cmd_SetViewpos_f( gentity_t *ent )
}
#define EVOLVE_TRACE_HEIGHT 128.0f
-#define AS_OVER_RT3 (ALIENSENSE_RANGE/M_ROOT3)
+#define AS_OVER_RT3 ((ALIENSENSE_RANGE*0.5f)/M_ROOT3)
/*
=================
@@ -1622,20 +1622,20 @@ void Cmd_Sell_f( gentity_t *ent )
//remove weapon if carried
if( BG_gotWeapon( weapon, ent->client->ps.stats ) )
{
+ //guard against selling the HBUILD weapons exploit
+ if( ( weapon == WP_HBUILD || weapon == WP_HBUILD2 ) &&
+ ent->client->ps.stats[ STAT_MISC ] > 0 )
+ {
+ trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires.\n\"" ) );
+ return;
+ }
+
BG_removeWeapon( weapon, ent->client->ps.stats );
//add to funds
ent->client->ps.persistant[ PERS_CREDIT ] += (short)BG_FindPriceForWeapon( weapon );
}
- //guard against selling the HBUILD weapons exploit
- if( weapon == WP_HBUILD || weapon == WP_HBUILD2 &&
- ent->client->ps.stats[ STAT_MISC ] != 0 )
- {
- trap_SendServerCommand( ent-g_entities, va( "print \"Cannot sell until build timer expires.\n\"" ) );
- return;
- }
-
//if we have this weapon selected, force a new selection
if( weapon == ent->client->ps.weapon )
{
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 592ecc67..0714eb8b 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -133,6 +133,7 @@ char *modNames[ ] =
"MOD_HSPAWN",
"MOD_TESLAGEN",
"MOD_MGTURRET",
+ "MOD_REACTOR",
"MOD_ASPAWN",
"MOD_ATUBE",
diff --git a/src/game/g_local.h b/src/game/g_local.h
index db6e64d6..38d7f6b6 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -402,7 +402,7 @@ typedef struct spawnQueue_s
} spawnQueue_t;
#define QUEUE_PLUS1(x) (((x)+1)%MAX_CLIENTS)
-#define QUEUE_MINUS1(x) (((x)-1)%MAX_CLIENTS)
+#define QUEUE_MINUS1(x) (((x)+MAX_CLIENTS-1)%MAX_CLIENTS)
void G_InitSpawnQueue( spawnQueue_t *sq );
int G_GetSpawnQueueLength( spawnQueue_t *sq );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index c5670f32..c5546168 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -697,7 +697,15 @@ Return tha length of a spawn queue
*/
int G_GetSpawnQueueLength( spawnQueue_t *sq )
{
- return ( sq->back - sq->front + 1 ) % MAX_CLIENTS;
+ int length = sq->back - sq->front + 1;
+
+ while( length < 0 )
+ length += MAX_CLIENTS;
+
+ while( length >= MAX_CLIENTS )
+ length -= MAX_CLIENTS;
+
+ return length;
}
/*
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index a188fcba..a384852f 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -307,7 +307,7 @@
*
*/
-#define HUMAN_WDMG_MODIFIER 1.07f
+#define HUMAN_WDMG_MODIFIER 1.09f
#define HDM(d) ((int)((float)d*HUMAN_WDMG_MODIFIER))
#define BLASTER_REPEAT 600
@@ -316,8 +316,8 @@
#define BLASTER_DMG HDM(10)
#define RIFLE_CLIPSIZE 30
-#define RIFLE_SPAWNCLIPS 3
-#define RIFLE_MAXCLIPS 3
+#define RIFLE_SPAWNCLIPS 4
+#define RIFLE_MAXCLIPS 4
#define RIFLE_REPEAT 90
#define RIFLE_RELOAD 2000
#define RIFLE_PRICE 0
@@ -337,10 +337,10 @@
#define SHOTGUN_REPEAT 1200
#define SHOTGUN_RELOAD 2000
#define SHOTGUN_SPREAD 900
-#define SHOTGUN_DMG HDM(9)
+#define SHOTGUN_DMG HDM(7)
#define LASGUN_PRICE 250
-#define LASGUN_AMMO 100
+#define LASGUN_AMMO 150
#define LASGUN_REPEAT 150
#define LASGUN_RELOAD 2000
#define LASGUN_DAMAGE HDM(10)
@@ -356,8 +356,8 @@
#define CHAINGUN_PRICE 400
#define CHAINGUN_BULLETS 200
#define CHAINGUN_REPEAT 75
-#define CHAINGUN_SPREAD 1200
-#define CHAINGUN_DMG HDM(6)
+#define CHAINGUN_SPREAD 1000
+#define CHAINGUN_DMG HDM(9)
#define PRIFLE_PRICE 400
#define PRIFLE_CLIPS 50
@@ -505,6 +505,9 @@
#define REACTOR_HEALTH HBHM(1250)
#define REACTOR_SPLASHDAMAGE 200
#define REACTOR_SPLASHRADIUS 300
+#define REACTOR_ATTACK_RANGE 100.0f
+#define REACTOR_ATTACK_REPEAT 1000
+#define REACTOR_ATTACK_DAMAGE 40
#define REACTOR_VALUE 2
#define REPEATER_BP 10