summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_lib.c16
-rw-r--r--src/game/bg_lib.h1
-rw-r--r--src/game/bg_pmove.c15
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_active.c13
-rw-r--r--src/game/g_client.c4
-rw-r--r--src/game/g_cmds.c10
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_missile.c38
-rw-r--r--src/game/g_weapon.c57
10 files changed, 89 insertions, 70 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c
index 7041aa39..cd241f77 100644
--- a/src/game/bg_lib.c
+++ b/src/game/bg_lib.c
@@ -256,6 +256,22 @@ int strcmp( const char *string1, const char *string2 ) {
return *string1 - *string2;
}
+//TA:
+char *strrchr( const char *string, int c )
+{
+ int i, length = strlen( string );
+ char *p;
+
+ for( i = length - 1; i >= 0; i-- )
+ {
+ p = (char *)&string[ i ];
+
+ if( *p == c )
+ return (char *)p;
+ }
+
+ return (char *)0;
+}
char *strchr( const char *string, int c ) {
while ( *string ) {
diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h
index 55fc25a0..b651c9a6 100644
--- a/src/game/bg_lib.h
+++ b/src/game/bg_lib.h
@@ -51,6 +51,7 @@ char *strcat( char *strDestination, const char *strSource );
char *strcpy( char *strDestination, const char *strSource );
int strcmp( const char *string1, const char *string2 );
char *strchr( const char *string, int c );
+char *strrchr( const char *string, int c );
char *strstr( const char *string, const char *strCharSet );
char *strncpy( char *strDest, const char *strSource, size_t count );
int tolower( int c );
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 18fa084c..40399dd7 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2286,21 +2286,6 @@ static void PM_Weapon( void )
}
break;
- case WP_GRAB_CLAW:
- attack1 = pm->cmd.buttons & BUTTON_ATTACK;
-
- //secondary attack is only permitted if target is in range
- if( pm->autoWeaponHit[ pm->ps->weapon ] )
- attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
-
- if( !attack1 && !attack2 )
- {
- pm->ps->weaponTime = 0;
- pm->ps->weaponstate = WEAPON_READY;
- return;
- }
- break;
-
case WP_LUCIFER_CANON:
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index c474357e..3d9be4b9 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -576,8 +576,8 @@ typedef enum {
EV_TAUNT_GUARDBASE,
EV_TAUNT_PATROL,
- EV_MENU //TA: menu event
-
+ EV_MENU, //TA: menu event
+ EV_BUILD_DELAY //TA: can't build yet
} entity_event_t;
typedef enum
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 89c45cf7..d423ca74 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -509,8 +509,6 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_MISC ] = ammo * LC_TOTAL_CHARGE / 10;
}
-#define LAUNCH_TIME 2000
-
switch( client->ps.weapon )
{
case WP_ABUILD:
@@ -529,6 +527,13 @@ void ClientTimerActions( gentity_t *ent, int msec )
else
client->ps.stats[ STAT_BUILDABLE ] &= ~SB_VALID_TOGGLEBIT;
}
+
+ //update build timer
+ if( client->ps.stats[ STAT_MISC ] > 0 )
+ client->ps.stats[ STAT_MISC ] -= 100;
+
+ if( client->ps.stats[ STAT_MISC ] < 0 )
+ client->ps.stats[ STAT_MISC ] = 0;
break;
default:
@@ -971,10 +976,6 @@ void ClientThink_real( gentity_t *ent ) {
pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent );
break;
- case WP_GRAB_CLAW:
- pm.autoWeaponHit[ WP_GRAB_CLAW ] = CheckGrabAttack( ent );
- break;
-
case WP_POUNCE:
if( client->ps.weaponTime <= 0 )
pm.autoWeaponHit[ WP_POUNCE ] = CheckPounceAttack( ent );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 46850044..942aba66 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1100,12 +1100,12 @@ void ClientUserinfoChanged( int clientNum ) {
// print scoreboards, display models, and play custom sounds
if ( ent->r.svFlags & SVF_BOT ) {
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d",
- client->pers.netname, client->sess.sessionTeam, model, model, c1, c2,
+ client->pers.netname, client->ps.stats[ STAT_PTEAM ], model, model, c1, c2,
client->pers.maxHealth, client->sess.wins, client->sess.losses,
Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader );
} else {
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d",
- client->pers.netname, client->sess.sessionTeam, model, model, redTeam, blueTeam, c1, c2,
+ client->pers.netname, client->ps.stats[ STAT_PTEAM ], model, model, redTeam, blueTeam, c1, c2,
client->pers.maxHealth, client->sess.wins, client->sess.losses, teamTask, teamLeader);
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9cadf288..c4c63f2d 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -31,12 +31,10 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) {
int i, j;
gclient_t *cl;
int numSorted;
- int scoreFlags;
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
- scoreFlags = 0;
numSorted = level.numConnectedClients;
@@ -51,9 +49,8 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) {
ping = cl->ps.ping < 999 ? cl->ps.ping : 999;
}
Com_sprintf (entry, sizeof(entry),
- " %i %i %i %i %i %i", level.sortedClients[i],
- cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000,
- scoreFlags, g_entities[level.sortedClients[i]].s.powerups);
+ " %i %i %i %i", level.sortedClients[i],
+ cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000 );
j = strlen(entry);
if (stringlength + j > 1024)
break;
@@ -634,6 +631,9 @@ void Cmd_Team_f( gentity_t *ent )
ClientSpawn( ent, NULL );
}
+ //update ClientInfo
+ ClientUserinfoChanged( ent->client->ps.clientNum );
+
//FIXME: put some team change broadcast code here.
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 2125291c..c163b20f 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -629,6 +629,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam
gentity_t *fire_grenade( gentity_t *self, vec3_t start, vec3_t aimdir );
gentity_t *fire_rocket( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir );
+gentity_t *fire_paraLockBlob( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_bfg( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_grapple( gentity_t *self, vec3_t start, vec3_t dir );
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index bbbf07cd..b885a628 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -404,6 +404,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam
}
//=============================================================================
+
/*
=================
fire_lockblob
@@ -442,3 +443,40 @@ gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir )
return bolt;
}
+/*
+=================
+fire_paraLockBlob
+=================
+*/
+gentity_t *fire_paraLockBlob( gentity_t *self, vec3_t start, vec3_t dir )
+{
+ gentity_t *bolt;
+
+ VectorNormalize ( dir );
+
+ bolt = G_Spawn( );
+ bolt->classname = "lockblob";
+ bolt->nextthink = level.time + 15000;
+ bolt->think = G_ExplodeMissile;
+ bolt->s.eType = ET_MISSILE;
+ bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
+ bolt->s.weapon = WP_LOCKBLOB_LAUNCHER;
+ bolt->r.ownerNum = self->s.number;
+ bolt->parent = self;
+ bolt->damage = 0;
+ bolt->splashDamage = 0;
+ bolt->splashRadius = 0;
+ bolt->methodOfDeath = MOD_ROCKET;
+ bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH;
+ bolt->clipmask = MASK_SHOT;
+ bolt->target_ent = NULL;
+
+ bolt->s.pos.trType = TR_GRAVITY;
+ bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
+ VectorCopy( start, bolt->s.pos.trBase );
+ VectorScale( dir, 800, bolt->s.pos.trDelta );
+ SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
+ VectorCopy (start, bolt->r.currentOrigin);
+
+ return bolt;
+}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index f75a33d6..3b65ddb6 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -411,12 +411,19 @@ void cancelBuildFire( gentity_t *ent )
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
}
-void buildFire( gentity_t *ent, dynMenu_t menu )
+void buildFire( gentity_t *ent, dynMenu_t menu, int delay )
{
if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
+ if( ent->client->ps.stats[ STAT_MISC ] > 0 )
+ {
+ G_AddPredictableEvent( ent, EV_BUILD_DELAY, 0 );
+ return;
+ }
+
G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
+ ent->client->ps.stats[ STAT_MISC ] += delay;
return;
}
@@ -528,43 +535,13 @@ void gClawFire( gentity_t *ent )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
}
-void grabFire( gentity_t *ent )
+void lockBlobFire( gentity_t *ent )
{
- trace_t tr;
- vec3_t end;
- gentity_t *tent;
- gentity_t *traceEnt;
- int damage;
-
- // set aiming directions
- AngleVectors (ent->client->ps.viewangles, forward, right, up);
-
- CalcMuzzlePoint( ent, forward, right, up, muzzle );
-
- VectorMA( muzzle, 32, forward, end );
-
- trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
- if ( tr.surfaceFlags & SURF_NOIMPACT )
- return;
+ gentity_t *m;
- traceEnt = &g_entities[ tr.entityNum ];
+ m = fire_paraLockBlob( ent, muzzle, forward );
- if( !traceEnt->takedamage )
- return;
- if( !traceEnt->client )
- return;
- if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- return;
-
- if( traceEnt->client )
- {
- //lock client
- traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
- traceEnt->client->lastGrabTime = level.time;
-
- if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
- VectorCopy( traceEnt->client->ps.viewangles, traceEnt->client->ps.grapplePoint );
- }
+// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
/*
@@ -918,7 +895,7 @@ void FireWeapon2( gentity_t *ent )
case WP_LOCKBLOB_LAUNCHER:
break;
case WP_GRAB_CLAW:
- grabFire( ent );
+ lockBlobFire( ent );
break;
case WP_AREA_ZAP:
case WP_DIRECT_ZAP:
@@ -1016,16 +993,16 @@ void FireWeapon( gentity_t *ent )
painSawFire( ent );
break;
case WP_ABUILD:
- buildFire( ent, MN_A_BUILD );
+ buildFire( ent, MN_A_BUILD, 10000 );
break;
case WP_ABUILD2:
- buildFire( ent, MN_A_BUILD );
+ buildFire( ent, MN_A_BUILD, 5000 );
break;
case WP_HBUILD:
- buildFire( ent, MN_H_BUILD );
+ buildFire( ent, MN_H_BUILD, 10000 );
break;
case WP_HBUILD2:
- buildFire( ent, MN_H_BUILD );
+ buildFire( ent, MN_H_BUILD, 5000 );
break;
default:
// FIXME G_Error( "Bad ent->s.weapon" );