Teamplay antistick system.

This commit is contained in:
Richard Allen 2002-01-27 13:33:28 +00:00
parent 3a304da2c0
commit efda1c2acd
6 changed files with 59 additions and 7 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.14 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.13 2002/01/14 01:19:23 niceass
// No more default 800 gravity on items - NiceAss
//
@ -467,7 +470,7 @@ void CG_PredictPlayerState( void ) {
}
// JBravo: fixing telefragging and shit during spawing (Thanks NiceAss! :)
if (RQ3_lca.integer) {
if ((cg.snap->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID) {
cg_pmove.tracemask &= ~CONTENTS_BODY;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.45 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.44 2002/01/24 14:20:53 jbravo
// Adding func_explosive and a few new surfaceparms
//
@ -542,7 +545,7 @@ typedef enum {
#define RQ3_LOCKRELOADS 128 // Lock-reloads at end of fast-reload cycle
#define RQ3_QUEUERELOAD 256 // auto-reload if set
#define RQ3_RELOADWEAPON1 512 // flag off EV_RELOAD_WEAPON1 event so no dupes occur
#define RQ3_PLAYERSOLID 1024 // JBravo: Flag set when player is solid.
// player_state->persistant[] indexes
// these fields are the only part of player_state that isn't

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.43 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.42 2002/01/11 20:20:58 jbravo
// Adding TP to main branch
//
@ -1252,8 +1255,9 @@ void ClientThink_real( gentity_t *ent ) {
}
// JBravo: fixing telefragging and shit during spawnig. (Thanks NiceAss! :)
if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action)
{
if (g_gametype.integer == GT_TEAMPLAY &&
((ent->client->ps.stats[STAT_RQ3] & RQ3_PLAYERSOLID) != RQ3_PLAYERSOLID)) {
UnstickPlayer (ent);
pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.27 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.26 2002/01/23 15:26:31 niceass
// body sinkage removed
// weapon reset fixed
@ -1053,6 +1056,9 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
client->pers.connected = CON_CONNECTING;
// JBravo: Antistick
client->ps.stats[STAT_RQ3] &= ~RQ3_PLAYERSOLID;
// read or initialize the session data
if ( firstTime || level.newSession ) {
G_InitSessionData( client, userinfo );
@ -1186,7 +1192,7 @@ void ClientSpawn(gentity_t *ent) {
// char *savedAreaBits;
int accuracy_hits, accuracy_shots;
int eventSequence;
int savedWeapon, savedItem; // JBravo: to save weapon/item info
int savedWeapon, savedItem, savedSolid; // JBravo: to save weapon/item info
char userinfo[MAX_INFO_STRING];
index = ent - g_entities;
@ -1293,10 +1299,12 @@ void ClientSpawn(gentity_t *ent) {
// JBravo: save weapon/item info
savedWeapon = client->teamplayWeapon;
savedItem = client->teamplayItem;
// savedSolid = client->IsSolid;
memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset?
// JBravo: restore weapon/item info
// client->IsSolid = savedSolid;
client->teamplayWeapon = savedWeapon;
client->teamplayItem = savedItem;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.5 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.4 2002/01/23 15:59:43 jbravo
// Make use of NiceAsses ClearBodyQue() between rounds
//
@ -23,6 +26,7 @@
#include "g_local.h"
gitem_t *BG_FindItemForHoldable( holdable_t pw );
char *ConcatArgs( int start );
int touch[MAX_GENTITIES];
void CheckTeamRules()
{
@ -382,7 +386,6 @@ void SpawnPlayers()
gclient_t *client;
int clientNum, i;
client->sess.teamSpawn = qtrue;
level.spawnPointsLocated = qfalse;
for (i = 0; i < level.maxclients; i++) {
player = &g_entities[i];
@ -392,15 +395,17 @@ void SpawnPlayers()
client = player->client;
clientNum = client - level.clients;
client->sess.teamSpawn = qtrue;
if (client->sess.savedTeam == TEAM_RED) {
client->sess.sessionTeam = TEAM_RED;
} else if (client->sess.savedTeam == TEAM_BLUE) {
client->sess.sessionTeam = TEAM_BLUE;
}
client->ps.stats[STAT_RQ3] &= ~RQ3_PLAYERSOLID;
ClientSpawn(player);
ClientUserinfoChanged(clientNum);
client->sess.teamSpawn = qfalse;
}
client->sess.teamSpawn = qfalse;
}
/* Let the player Choose the weapon and/or item he wants */
@ -550,3 +555,28 @@ void EquipPlayer (gentity_t *ent)
ent->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( ent->client->teamplayItem ) - bg_itemlist;
ent->client->uniqueItems = 1;
}
void UnstickPlayer( gentity_t *ent )
{
int i, num, count;
gentity_t *hit;
vec3_t mins, maxs;
count = 0;
VectorAdd( ent->client->ps.origin, (ent->r.mins + 10), mins );
VectorAdd( ent->client->ps.origin, (ent->r.maxs + 10), maxs );
num = trap_EntitiesInBox( mins, maxs, touch, MAX_GENTITIES );
for (i=0 ; i<num ; i++) {
hit = &g_entities[touch[i]];
if ( hit->client && hit != ent ) {
count++;
}
}
if (count == 0) {
G_Printf ("making %s solid!\n", ent->client->pers.netname);
ent->client->ps.stats[STAT_RQ3] |= RQ3_PLAYERSOLID;
}
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.2 2002/01/27 13:33:28 jbravo
// Teamplay antistick system.
//
// Revision 1.1 2002/01/11 20:23:41 jbravo
// Added the two new files for TP I forgot during the main TP commit
//
@ -31,3 +34,4 @@ void CheckForUnevenTeams(gentity_t *player);
void EquipPlayer (gentity_t *ent);
void RQ3_Cmd_Choose_f(gentity_t *ent);
void RQ3_Cmd_Drop_f( gentity_t *ent );
void UnstickPlayer( gentity_t *ent );