Merge branch 'master' of git@github.com:UberGames/rpgxEF.git

This commit is contained in:
Harry Young 2012-11-16 01:58:52 +01:00
commit 27ae701260
18 changed files with 700 additions and 1458 deletions

View file

@ -22,7 +22,7 @@ static void TryUse( gentity_t *ent )
trace_t trace;
vec3_t src, dest, vf;
clientSession_t *sess;
if(!ent || !ent->client) return;
sess = &ent->client->sess;
@ -60,10 +60,10 @@ static void TryUse( gentity_t *ent )
}
//FIXME: play sound?
target->use( target, ent, ent );
#ifdef G_LUA
#ifdef G_LUA
if(target->luaUse)
LuaHook_G_EntityUse(target->luaUse, target-g_entities, ent-g_entities, ent-g_entities);
#endif
#endif
return;
}
else if ( target && target->use && Q_stricmp("misc_ammo_station", target->classname) == 0 )
@ -80,10 +80,10 @@ static void TryUse( gentity_t *ent )
}
}
target->use( target, ent, ent );
#ifdef G_LUA
#ifdef G_LUA
if(target->luaUse)
LuaHook_G_EntityUse(target->luaUse, target-g_entities, ent-g_entities, ent-g_entities);
#endif
#endif
return;
}
else if ( (target && target->s.number == ENTITYNUM_WORLD) || (target->s.pos.trType == TR_STATIONARY && !(trace.surfaceFlags & SURF_NOIMPACT) && !target->takedamage) )
@ -233,19 +233,19 @@ static void P_WorldEffects( gentity_t *ent ) {
//
if (waterlevel &&
(ent->watertype&(CONTENTS_LAVA|CONTENTS_SLIME)) ) {
if (ent->health > 0
&& ent->pain_debounce_time < level.time ) {
if (ent->health > 0
&& ent->pain_debounce_time < level.time ) {
if (ent->watertype & CONTENTS_LAVA) {
G_Damage (ent, NULL, NULL, NULL, NULL,
30*waterlevel, 0, MOD_LAVA);
}
if (ent->watertype & CONTENTS_LAVA) {
G_Damage (ent, NULL, NULL, NULL, NULL,
30*waterlevel, 0, MOD_LAVA);
}
if (ent->watertype & CONTENTS_SLIME) {
G_Damage (ent, NULL, NULL, NULL, NULL,
10*waterlevel, 0, MOD_SLIME);
if (ent->watertype & CONTENTS_SLIME) {
G_Damage (ent, NULL, NULL, NULL, NULL,
10*waterlevel, 0, MOD_SLIME);
}
}
}
}
}
@ -344,12 +344,12 @@ void G_TouchTriggers( gentity_t *ent ) {
for ( i=0 ; i<num ; i++ ) {
hit = &g_entities[touch[i]];
#ifdef G_LUA
#ifdef G_LUA
if(hit->luaTouch)
{
LuaHook_G_EntityTouch(hit->luaTouch, hit->s.number, ent->s.number);
}
#endif
#endif
if ( !hit->touch && !ent->touch ) {
continue;
@ -363,7 +363,7 @@ void G_TouchTriggers( gentity_t *ent ) {
{
// this is ugly but adding a new ET_? type will
// most likely cause network incompatibilities
if ( hit->s.eType != ET_TELEPORT_TRIGGER && hit->touch != Touch_DoorTrigger)
if ( hit->s.eType != ET_TELEPORT_TRIGGER && hit->touch != G_Mover_TouchDoorTrigger)
{
continue;
}
@ -463,10 +463,10 @@ static qboolean ClientInactivityTimer( gclient_t *client )
client->inactivityWarning = qfalse;
}
else if ( cmd->forwardmove ||
cmd->rightmove ||
cmd->upmove ||
(cmd->buttons & BUTTON_ATTACK) ||
(cmd->buttons & BUTTON_ALT_ATTACK) )
cmd->rightmove ||
cmd->upmove ||
(cmd->buttons & BUTTON_ATTACK) ||
(cmd->buttons & BUTTON_ALT_ATTACK) )
{
client->inactivityTime = level.time + g_inactivity.integer * 1000;
client->inactivityWarning = qfalse;
@ -548,7 +548,7 @@ static void ClientTimerActions( gentity_t *ent, int msec ) {
if( rpg_timedmessagetime.value ){
//Make sure its not less then one //TiM: Well... we can have under 1, just not toooo far under 1
if(rpg_timedmessagetime.value < 0.2) { //1
messageTime = 0.2;
}else{
@ -557,7 +557,7 @@ static void ClientTimerActions( gentity_t *ent, int msec ) {
if (level.time > (level.message + (messageTime * 60000)) ) {
level.message = level.time;
//TiM - There. So with this working in conjunction with that reset
//code above, this should be more efficient. :)
message = TimedMessage(); //Since we're working with a gloabl scope variable, there's no need for this thing to have parameters:)
@ -618,27 +618,6 @@ static void ClientIntermissionThink( gclient_t *client ) {
}
}
/*
====================
Cmd_Ready_f
====================
*/
/**
* This function is called from the ui_sp_postgame.c as a result of clicking on the
* "next" button in non GT_TOURNAMENT games. This replaces the old system of waiting
* for the user to click an ATTACK or USE button to signal ready
* (see ClientIntermissionThink())
*
* when all clients have signaled ready, the game continues to the next match.
*/
void Cmd_Ready_f (gentity_t *ent)
{
gclient_t *client;
client = ent->client;
client->readyToExit = qtrue;
}
typedef struct detHit_s
@ -954,7 +933,7 @@ static qhandle_t shieldDeactivateSound=0;
/**
* Remove a forcefield
*/
void ShieldRemove(gentity_t *self)
void G_Active_ShieldRemove(gentity_t *self)
{
self->think = G_FreeEntity;
self->nextthink = level.time + 300;
@ -989,7 +968,7 @@ void ShieldDie(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int d
// Play damaging sound...
G_AddEvent(self, EV_GENERAL_SOUND, shieldDamageSound);
ShieldRemove(self);
G_Active_ShieldRemove(self);
}
@ -1019,7 +998,7 @@ void ShieldGoSolid(gentity_t *self)
if (self->health <= 0)
{
ShieldRemove(self);
G_Active_ShieldRemove(self);
return;
}
@ -1037,7 +1016,7 @@ void ShieldGoSolid(gentity_t *self)
self->nextthink = level.time + 1000;
self->think = ShieldThink;
self->takedamage = qtrue;//RPG-X: - RedTechie use to be qtrue //TiM - made true again. should be okay so long as the health isn't decremented
trap_LinkEntity(self);
}
@ -1128,19 +1107,19 @@ void ShieldTouch(gentity_t *self, gentity_t *other, trace_t *trace)
rpg_forcefielddamage.integer = 999;
}
other->health -= rpg_forcefielddamage.integer;
//RPG-X: RedTechie - Fixed free ent if medic revive on
if(rpg_medicsrevive.integer == 1){
if(other->health <= 1){
other->client->ps.stats[STAT_WEAPONS] = ( 1 << WP_0 );
other->client->ps.stats[STAT_HOLDABLE_ITEM] = HI_NONE;
other->client->ps.stats[STAT_HEALTH] = other->health = 1;
player_die (other, other, other, 1, MOD_FORCEFIELD);
G_Client_Die (other, other, other, 1, MOD_FORCEFIELD);
}
}else{
if(other->health <= 1){
other->client->ps.stats[STAT_HEALTH] = other->health = 0;
player_die (other, other, other, 100000, MOD_FORCEFIELD);
G_Client_Die (other, other, other, 100000, MOD_FORCEFIELD);
}
}
}
@ -1225,10 +1204,10 @@ void CreateShield(gentity_t *ent)
}
ent->clipmask = MASK_SHOT;
// xaxis - 1 bit
// height - 0-254 8 bits //10
// posWidth - 0-255 8 bits //10
// negWidth - 0 - 255 8 bits
// xaxis - 1 bit
// height - 0-254 8 bits //10
// posWidth - 0-255 8 bits //10
// negWidth - 0 - 255 8 bits
paramData = (xaxis << 30) | ((height&1023) << 20) | ((posWidth&1023) << 10) | (negWidth&1023); //24 16 8
ent->s.time2 = paramData;
@ -1241,14 +1220,14 @@ void CreateShield(gentity_t *ent)
{
ent->team = "2";
}
ent->health = ceil(SHIELD_HEALTH*g_dmgmult.value);
ent->s.time = ent->health;//???
ent->pain = ShieldPain;
ent->die = ShieldDie;
ent->touch = ShieldTouch;
ent->r.svFlags |= SVF_SHIELD_BBOX;
// see if we're valid
@ -1409,18 +1388,18 @@ void flushDecoys( gentity_t *ent ) {
while ( (decoy = G_Find( decoy, FOFS(classname), "decoy" )) != NULL )
{
if ( decoy->parent != ent )
//if ( decoy->s.clientNum != ent->client->ps.clientNum )
//if ( decoy->s.clientNum != ent->client->ps.clientNum )
{
continue;
}
foundDecoys[decoyCount++] = decoy->s.clientNum;
}
//now remove first ones we find until there are only 9 left
decoy = NULL;
orgCount = decoyCount;
lowestTimeStamp = level.time;
//RPG-X: TiM - Let's limit it to say... 64 decoys per player
while ( decoyCount > 64 ) //9
{
@ -1432,7 +1411,7 @@ void flushDecoys( gentity_t *ent ) {
continue;
}
decoy = &g_entities[foundDecoys[i]];
if ( decoy && decoy->timestamp < lowestTimeStamp )
{
removeMe = i;
@ -1460,7 +1439,7 @@ void flushDecoys( gentity_t *ent ) {
}
}
}
/**
* entities spawn non solid and through this function,
* they'll become solid once nothing's detected in their boundaries. :)
@ -1534,7 +1513,7 @@ qboolean PlaceDecoy(gentity_t *ent)
gentity_t *oldDecoy;
for ( i = 0; i<level.num_entities; i++ ) {
oldDecoy = &g_entities[i];
oldDecoy = &g_entities[i];
if ( !Q_stricmp( oldDecoy->classname, "decoy" ) && oldDecoy->s.eventParm == level.decoyIndex ) {
G_FreeEntity( oldDecoy );
@ -1609,7 +1588,7 @@ qboolean PlaceDecoy(gentity_t *ent)
char height[9];
char weight[9];
char offset[6];
//TiM - ensure that we encapsulate this data better or else it sometimes
//becomes null
Q_strncpyz( model, Info_ValueForKey( userinfo, "model" ), sizeof( model ) );
@ -1618,11 +1597,11 @@ qboolean PlaceDecoy(gentity_t *ent)
Q_strncpyz( offset, Info_ValueForKey( userinfo, "modelOffset" ), sizeof( offset ) );
Com_sprintf( buffer, sizeof( buffer ), "model\\%s\\height\\%s\\weight\\%s\\moOf\\%s\\c\\%i",
model,
height,
weight,
offset,
ent->client->sess.sessionClass );
model,
height,
weight,
offset,
ent->client->sess.sessionClass );
trap_SetConfigstring( CS_DECOYS + level.decoyIndex, buffer );
}
@ -1727,7 +1706,7 @@ static void ClientEvents( gentity_t *ent, int oldEventSequence ) {
//TiM: Since we purge the vectors each cycle. I'll save us some memory by using the vectors themselves as a check.
if ( TransDat[ps->clientNum].beamTime == 0 &&
VectorCompare( vec3_origin, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].origin ) &&
VectorCompare( vec3_origin, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].angles ) )
VectorCompare( vec3_origin, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].angles ) )
{
VectorCopy( ps->origin, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].origin );
VectorCopy( ps->viewangles, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].angles );
@ -1739,7 +1718,7 @@ static void ClientEvents( gentity_t *ent, int oldEventSequence ) {
if ( TransDat[ps->clientNum].beamTime == 0 && level.time > ps->powerups[PW_QUAD] ) {
G_InitTransport( ps->clientNum, TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].origin,
TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].angles );
TransDat[ps->clientNum].storedCoord[TPT_PORTABLE].angles );
memset( &TransDat[ps->clientNum].storedCoord[TPT_PORTABLE], 0, sizeof( TransDat[ps->clientNum].storedCoord[TPT_PORTABLE]) );
}
@ -1748,7 +1727,7 @@ static void ClientEvents( gentity_t *ent, int oldEventSequence ) {
}
ps->stats[STAT_USEABLE_PLACED] = 0;
if (g_classData[client->sess.sessionClass].isMarine)
{
client->teleportTime = level.time + ( 3 * 1000 ); // 15 * 1000
@ -1853,25 +1832,25 @@ void ThrowWeapon( gentity_t *ent, char *txt )
ucmd = &ent->client->pers.cmd;
ps = &client->ps;
if ( rpg_allowWeaponDrop.integer == 0) {
return;
}
if ( rpg_allowWeaponDrop.integer == 0) {
return;
}
if ( numTotalDropped >= MAX_DROPPED ) {
WARNING(("RPG-X Warning: maximum of dropped items of %i reached.\n", MAX_DROPPED));
return;
}
if ( ps->weapon == WP_1 || ( ucmd->buttons & BUTTON_ATTACK )) {
if ( ps->weapon == WP_1 || ( ucmd->buttons & BUTTON_ATTACK )) {
return;
}
}
numTotalDropped++;
item = BG_FindItemForWeapon( ps->weapon );
// admins don't lose weapon when thrown
if ( IsAdmin( ent ) == qfalse ) {
// admins don't lose weapon when thrown
if ( IsAdmin( ent ) == qfalse ) {
ps->ammo[ ps->weapon ] -= 1;
if (ps->ammo[ ps->weapon ] <= 0) {
ps->stats[STAT_WEAPONS] &= ~( 1 << ps->weapon );
@ -1883,10 +1862,10 @@ void ThrowWeapon( gentity_t *ent, char *txt )
}
}
}
}
}
drop = DropWeapon( ent, item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM, txt );
drop->parent = ent;
drop->parent = ent;
drop->count = 1;
}
@ -1925,7 +1904,7 @@ static void SendPendingPredictableEvents( playerState_t *ps ) {
static void ClientCamThink(gentity_t *client) {
if(!client->client->cam) return;
G_SetOrigin(client, client->client->cam->s.origin);
SetClientViewAngle(client, client->client->cam->s.angles);
G_Client_SetViewAngle(client, client->client->cam->s.angles);
trap_LinkEntity(client);
}
@ -1935,17 +1914,17 @@ ClientThink
==============
*/
/**
* This will be called once for each client frame, which will
* usually be a couple times for each server frame on fast clients.
* This will be called once for each client frame, which will
* usually be a couple times for each server frame on fast clients.
*
* If "g_synchronousClients 1" is set, this will be called exactly
* once for each server frame, which makes for smooth demo recording.
* If "g_synchronousClients 1" is set, this will be called exactly
* once for each server frame, which makes for smooth demo recording.
*/
static void ClientThink_real( gentity_t *ent ) {
gclient_t *client;
pmove_t pm;
int oldEventSequence;
int msec;
pmove_t pm;
int oldEventSequence;
int msec;
usercmd_t *ucmd;
playerState_t *ps;
@ -2013,7 +1992,7 @@ static void ClientThink_real( gentity_t *ent ) {
ent->r.contents = CONTENTS_CORPSE;
}
}
//RPG-X: Checked to see if medics revive is on if so do as following
if(rpg_medicsrevive.integer == 1){
if ( client->noclip ) {
@ -2032,7 +2011,7 @@ static void ClientThink_real( gentity_t *ent ) {
ps->pm_type = PM_NORMAL;
}
}
//RPG-X: J2J & Phenix - For the gravity ent
if(client->SpecialGrav != qtrue)
{
@ -2053,15 +2032,15 @@ static void ClientThink_real( gentity_t *ent ) {
else if ( ps->stats[STAT_HEALTH] <= 20 ) {
ps->speed *= 0.55;
}
if (( ps->powerups[PW_EVOSUIT] ) && ( ps->gravity == 0 ))
{//Evosuit time.. RPG-X | Phenix | 8/8/2004
ps->speed *= 1.3;
}
//RPG-X: Redtechie - n00bie stay.....good boy!
if ( g_classData[client->sess.sessionClass].isn00b ){
ps->speed = 0;
ps->speed = 0;
}
//TiM : SP Style Transporter. :)
@ -2072,9 +2051,9 @@ static void ClientThink_real( gentity_t *ent ) {
//so bullets and other players will pass thru the transportee. :)
if ( (level.time > TransDat[ps->clientNum].beamTime - 6000) &&
( level.time < TransDat[ps->clientNum].beamTime - 2000 ) ) {
if ( ps->stats[STAT_HEALTH] > 1 ) {
ent->r.contents = CONTENTS_NONE;
}
if ( ps->stats[STAT_HEALTH] > 1 ) {
ent->r.contents = CONTENTS_NONE;
}
}
else {
if ( ps->stats[STAT_HEALTH] > 1 ) {
@ -2083,13 +2062,13 @@ static void ClientThink_real( gentity_t *ent ) {
}
//If we're half-way thru the cycle, teleport the player now
if ( level.time > TransDat[ps->clientNum].beamTime - 4000 &&
!TransDat[ps->clientNum].beamed ) {
TeleportPlayer( ent, TransDat[ps->clientNum].currentCoord.origin,
TransDat[ps->clientNum].currentCoord.angles,
TP_TRI_TP );
if ( level.time > TransDat[ps->clientNum].beamTime - 4000 &&
!TransDat[ps->clientNum].beamed ) {
TeleportPlayer( ent, TransDat[ps->clientNum].currentCoord.origin,
TransDat[ps->clientNum].currentCoord.angles,
TP_TRI_TP );
TransDat[ps->clientNum].beamed = qtrue;
TransDat[ps->clientNum].beamed = qtrue;
}
}
else {
@ -2100,8 +2079,8 @@ static void ClientThink_real( gentity_t *ent ) {
ps->powerups[PW_QUAD] = 0;
TransDat[ps->clientNum].beamed = qfalse;
memset( &TransDat[ps->clientNum].currentCoord, 0,
sizeof( TransDat[ps->clientNum].currentCoord.origin ) );
memset( &TransDat[ps->clientNum].currentCoord, 0,
sizeof( TransDat[ps->clientNum].currentCoord.origin ) );
if(g_entities[ps->clientNum].flags & FL_CLAMPED) {
//reset everything if player was beamed by trigger_transporter
@ -2111,13 +2090,13 @@ static void ClientThink_real( gentity_t *ent ) {
}
//TiM : Freeze their movement if they're halfway through a transport cycle
if ( level.time < TransDat[ps->clientNum].beamTime &&
if ( level.time < TransDat[ps->clientNum].beamTime &&
level.time > TransDat[ps->clientNum].beamTime - 4000 )
{
vec3_t endPoint;
trace_t tr;
VectorSet( endPoint, ps->origin[0], ps->origin[1], ps->origin[2] - 48 );
//Do a trace down. If we're near ground, just re-enable gravity. Else we we get weird animations O_o
//Do a trace down. If we're near ground, just re-enable gravity. Else we we get weird animations O_o
trap_Trace( &tr, ps->origin, NULL, NULL, endPoint, ps->clientNum, CONTENTS_SOLID );
if ( tr.fraction == 1.0 ) {
@ -2126,7 +2105,7 @@ static void ClientThink_real( gentity_t *ent ) {
}
ps->speed = 0;
ps->velocity[0] = ps->velocity[1] = 0.0;
}
@ -2155,7 +2134,7 @@ static void ClientThink_real( gentity_t *ent ) {
pm.admin = (qboolean)(g_classData[client->sess.sessionClass].isAdmin || client->LoggedAsAdmin);
//pm.admin = g_classData[client->sess.sessionClass].isAdmin;
pm.medic = (qboolean)g_classData[client->sess.sessionClass].isMedical;
pm.borg = (qboolean)g_classData[client->sess.sessionClass].isBorg;
pm.borg = (qboolean)g_classData[client->sess.sessionClass].isBorg;
// perform a pmove
Pmove (&pm);
@ -2181,7 +2160,7 @@ static void ClientThink_real( gentity_t *ent ) {
ClientEvents( ent, oldEventSequence );
if ( pm.useEvent )
{ //TODO: Use
{ //TODO: Use
TryUse( ent );
}
@ -2214,7 +2193,7 @@ static void ClientThink_real( gentity_t *ent ) {
if ( level.time > client->respawnTime ) {
// pressing attack or use is the normal respawn method
if ( ucmd->buttons & ( BUTTON_ATTACK | BUTTON_USE_HOLDABLE ) ) {
respawn( ent );
G_Client_Respawn( ent );
return;
}
}
@ -2309,7 +2288,7 @@ static void SpectatorClientEndFrame( gentity_t *ent ) {
// drop them to free spectators unless they are dedicated camera followers
if ( sess->spectatorClient >= 0 ) {
sess->spectatorState = SPECTATOR_FREE;
ClientBegin( ent->client - level.clients, qfalse, qfalse, qfalse );
G_Client_Begin( ent->client - level.clients, qfalse, qfalse, qfalse );
}
}
}

View file

@ -117,7 +117,7 @@ void UpdateTournamentInfo( void ) {
}
playerClientNum = i;
CalculateRanks( qfalse );
G_Client_CalculateRanks( qfalse );
// put info for the top three players into the msg
Com_sprintf(msg, AWARDS_MSG_LENGTH, "awards %d", level.numNonSpectatorClients);
for( j = 0; j < level.numNonSpectatorClients; j++ )

View file

@ -470,7 +470,7 @@ void G_CheckBotSpawn( void ) {
if ( botSpawnQueue[n].spawnTime > level.time ) {
continue;
}
ClientBegin( botSpawnQueue[n].clientNum, qfalse, qtrue, qfalse );
G_Client_Begin( botSpawnQueue[n].clientNum, qfalse, qtrue, qfalse );
botSpawnQueue[n].spawnTime = 0;
if( g_gametype.integer == GT_SINGLE_PLAYER ) {
@ -498,7 +498,7 @@ static void AddBotToSpawnQueue( int clientNum, int delay ) {
}
G_Printf( S_COLOR_YELLOW "Unable to delay spawn\n" );
ClientBegin( clientNum, qfalse, qtrue, qfalse );
G_Client_Begin( clientNum, qfalse, qtrue, qfalse );
}
@ -632,7 +632,7 @@ static void G_AddBot( const char *name, float skill, const char *team, const cha
// initialize the bot settings
if( !team || !*team ) {
if( g_gametype.integer >= GT_TEAM ) {
if( PickTeam(clientNum) == TEAM_RED) {
if( G_Client_PickTeam(clientNum) == TEAM_RED) {
team = "red";
}
else {
@ -666,14 +666,14 @@ static void G_AddBot( const char *name, float skill, const char *team, const cha
}
else
{
bot->client->sess.sessionTeam = PickTeam( -1 );
bot->client->sess.sessionTeam = G_Client_PickTeam( -1 );
}
}
preTeam = bot->client->sess.sessionTeam;
// have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
if ( G_Client_Connect( clientNum, qtrue, qtrue ) ) {
return;
}
@ -702,11 +702,11 @@ static void G_AddBot( const char *name, float skill, const char *team, const cha
bot->client->ps.persistant[ PERS_TEAM ] = bot->client->sess.sessionTeam;
G_ReadSessionData( bot->client );
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
}
if( delay == 0 ) {
ClientBegin( clientNum, qfalse, qfalse, qfalse );
G_Client_Begin( clientNum, qfalse, qfalse, qfalse );
return;
}

View file

@ -32,7 +32,7 @@ void Cinematic_ActivateCameraMode(gentity_t *ent, gentity_t *target) {
client->cam = target;
VectorCopy(client->ps.viewangles, client->origViewAngles);
VectorCopy(ent->r.currentOrigin, client->origOrigin);
SetClientViewAngle(ent, target->s.angles);
G_Client_SetViewAngle(ent, target->s.angles);
G_SetOrigin(ent, target->r.currentOrigin);
VectorCopy(target->r.currentOrigin, ent->client->ps.origin);
trap_LinkEntity(ent);
@ -46,7 +46,7 @@ void Cinematic_DeactivateCameraMode(gentity_t *ent) {
ent->flags ^= FL_CCAM;
G_SetOrigin(ent, client->origOrigin);
SetClientViewAngle(ent, client->origViewAngles);
G_Client_SetViewAngle(ent, client->origViewAngles);
trap_LinkEntity(ent);
}

View file

@ -18,7 +18,7 @@ extern pclass_t ValueNameForClass ( /*gentity_t *ent,*/ char* s );
extern qboolean levelExiting;
// g_client.c -- client functions that don't happen every frame
void G_StoreClientInitialStatus( gentity_t *ent );
void G_Client_StoreClientInitialStatus( gentity_t *ent );
//! players mins
static vec3_t playerMins = {-12, -12, -24}; //RPG-X : TiM - {-15, -15, -24}
@ -26,7 +26,6 @@ static vec3_t playerMins = {-12, -12, -24}; //RPG-X : TiM - {-15, -15, -24}
static vec3_t playerMaxs = {12, 12, 32}; // {15, 15, 32}
clInitStatus_t clientInitialStatus[MAX_CLIENTS];
team_t borgTeam = TEAM_FREE;
//TiM: For easier transport setup
/**
@ -67,6 +66,10 @@ potential spawning position for deathmatch games.
void SP_info_player_deathmatch( gentity_t *ent ) {
int i;
if(strcmp(ent->classname, "info_player_deathmatch")) {
ent->classname = G_NewString("info_player_deathmatch");
}
G_SpawnInt( "nobots", "0", &i);
if ( i ) {
ent->flags |= FL_NO_BOTS;
@ -96,7 +99,7 @@ On spawn will reset classname sppropriately and respawn itself.
* Spawn function for player start spawnpoint which actually the same as deatchmatch spawnpoint
*/
void SP_info_player_start(gentity_t *ent) {
ent->classname = "info_player_deathmatch";
ent->classname = G_NewString("info_player_deathmatch");
SP_info_player_deathmatch( ent );
}
@ -124,21 +127,21 @@ void SP_info_player_intermission( gentity_t *ent ) {
/*
=======================================================================
SelectSpawnPoint
G_Client_SelectSpawnPoint
=======================================================================
*/
/*
================
SpotWouldTelefrag
G_Client_SpotWouldTelefrag
================
*/
/**
* Check if beaming to a point will result in a teleporter frag.
*/
qboolean SpotWouldTelefrag( gentity_t *spot ) {
qboolean G_Client_SpotWouldTelefrag( gentity_t *spot ) {
int i, num;
int touch[MAX_GENTITIES];
gentity_t *hit;
@ -219,7 +222,7 @@ static gentity_t *SelectRandomDeathmatchSpawnPoint( void ) {
spot = NULL;
while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {
if ( SpotWouldTelefrag( spot ) ) {
if ( G_Client_SpotWouldTelefrag( spot ) ) {
continue;
}
spots[ count ] = spot;
@ -237,7 +240,7 @@ static gentity_t *SelectRandomDeathmatchSpawnPoint( void ) {
/*
===========
SelectSpawnPoint
G_Client_SelectSpawnPoint
Chooses a player start, deathmatch start, etc
============
@ -245,7 +248,7 @@ Chooses a player start, deathmatch start, etc
/**
* Chooses a player start, deathmatch start, etc
*/
gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ) {
gentity_t *G_Client_SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles ) {
gentity_t *spot;
gentity_t *nearestSpot;
@ -296,8 +299,8 @@ static gentity_t *SelectInitialSpawnPoint( vec3_t origin, vec3_t angles ) {
}
}
if ( !spot || SpotWouldTelefrag( spot ) ) {
return SelectSpawnPoint( vec3_origin, origin, angles );
if ( !spot || G_Client_SpotWouldTelefrag( spot ) ) {
return G_Client_SelectSpawnPoint( vec3_origin, origin, angles );
}
VectorCopy (spot->s.origin, origin);
@ -335,10 +338,10 @@ static int bodyFadeSound=0;
/*
===============
InitBodyQue
G_Client_InitBodyQue
===============
*/
void InitBodyQue (void) {
void G_Client_InitBodyQue (void) {
int i;
gentity_t *ent;
@ -490,11 +493,11 @@ static void CopyToBodyQue( gentity_t *ent ) {
/*
==================
SetClientViewAngle
G_Client_SetViewAngle
==================
*/
void SetClientViewAngle( gentity_t *ent, vec3_t angle ) {
void G_Client_SetViewAngle( gentity_t *ent, vec3_t angle ) {
int i;
// set the delta angle
@ -510,18 +513,18 @@ void SetClientViewAngle( gentity_t *ent, vec3_t angle ) {
/*
================
respawn
G_Client_Respawn
================
*/
extern char *ClassNameForValue( pclass_t pClass );
void respawn( gentity_t *ent ) {
void G_Client_Respawn( gentity_t *ent ) {
qboolean borg = qfalse;
gentity_t *tent;
playerState_t *ps;
CopyToBodyQue (ent);
ClientSpawn(ent, 0, qfalse);//RPG-X: RedTechie - Modifyed
G_Client_Spawn(ent, 0, qfalse);//RPG-X: RedTechie - Modifyed
ps = &ent->client->ps;
@ -539,7 +542,7 @@ void respawn( gentity_t *ent ) {
/*
================
TeamCount
G_Client_TeamCount
Returns number of players on a team
================
@ -547,7 +550,7 @@ Returns number of players on a team
/**
* Returns number of players on a team
*/
team_t TeamCount( int ignoreClientNum, int team ) {
team_t G_Client_TeamCount( int ignoreClientNum, int team ) {
int i;
int count = 0;
@ -569,15 +572,15 @@ team_t TeamCount( int ignoreClientNum, int team ) {
/*
================
PickTeam
G_Client_PickTeam
================
*/
team_t PickTeam( int ignoreClientNum ) {
team_t G_Client_PickTeam( int ignoreClientNum ) {
int counts[TEAM_NUM_TEAMS];
counts[TEAM_BLUE] = TeamCount( ignoreClientNum, TEAM_BLUE );
counts[TEAM_RED] = TeamCount( ignoreClientNum, TEAM_RED );
counts[TEAM_BLUE] = G_Client_TeamCount( ignoreClientNum, TEAM_BLUE );
counts[TEAM_RED] = G_Client_TeamCount( ignoreClientNum, TEAM_RED );
if ( counts[TEAM_BLUE] > counts[TEAM_RED] ) {
return TEAM_RED;
@ -962,17 +965,17 @@ void SetCSTeam( team_t team, char *teamname )
}
/*
===========
ClientUserInfoChanged
G_Client_UserinfoChanged
============
*/
/**
* Called from ClientConnect when the player first connects and
* Called from G_Client_Connect when the player first connects and
* directly by the server system when the player updates a userinfo variable.
*
* The game can override any of the settings and call trap_SetUserinfo
* if desired.
*/
void ClientUserinfoChanged( int clientNum ) {
void G_Client_UserinfoChanged( int clientNum ) {
gentity_t *ent;
int i;
char *s;
@ -1277,7 +1280,7 @@ void ClientUserinfoChanged( int clientNum ) {
/*
===========
ClientConnect
G_Client_Connect
============
*/
/**
@ -1290,13 +1293,13 @@ ClientConnect
* a string with the reason for denial.
*
* Otherwise, the client will be sent the current gamestate
* and will eventually get to ClientBegin.
* and will eventually get to G_Client_Begin.
*
* firstTime will be qtrue the very first time a client connects
* to the server machine, but qfalse on map changes and tournement
* restarts.
*/
char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
char *G_Client_Connect( int clientNum, qboolean firstTime, qboolean isBot ) {
char *value;
gclient_t *client;
char userinfo[MAX_INFO_STRING];
@ -1441,7 +1444,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
//========================================================
}
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
//RPG-X: Save the ip for later - has to be down here, since it gets flushed in the above function
Q_strncpyz( ent->client->pers.ip, ip, sizeof( ent->client->pers.ip ) );
@ -1488,7 +1491,7 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) {
}
// count current clients and rank for scoreboard
//CalculateRanks( qfalse );
//G_Client_CalculateRanks( qfalse );
//RPG-X: J2J - Reset Variables
DragDat[clientNum].AdminId = -1;
@ -1599,7 +1602,7 @@ static void G_SendTransData(int clientNum) {
/*
===========
ClientBegin
G_Client_Begin
============
*/
/**
@ -1607,7 +1610,7 @@ ClientBegin
* to be placed into the level. This will happen every level load,
* and on transition between teams, but doesn't happen on respawns
*/
void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qboolean first ) {
void G_Client_Begin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qboolean first ) {
gentity_t *ent;
gclient_t *client;
gentity_t *tent;
@ -1658,7 +1661,7 @@ void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qbool
SetScore( ent, score );
// locate ent at a spawn point
ClientSpawn( ent, 0, qfalse );//RPG-X: RedTechie - Modifyed
G_Client_Spawn( ent, 0, qfalse );//RPG-X: RedTechie - Modifyed
if ( client->sess.sessionTeam != TEAM_SPECTATOR /*&& g_holoIntro.integer==0 */ )
{ // Don't use transporter FX for spectators or those watching the holodoors.
@ -1671,7 +1674,7 @@ void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qbool
G_LogPrintf( "ClientBegin: %i (%s)\n", clientNum, g_entities[clientNum].client->pers.ip );
// count current clients and rank for scoreboard
CalculateRanks( qfalse );
G_Client_CalculateRanks( qfalse );
//TiM - This appears to be a flaw in Raven's design
//When a client connects, or if they enter admin or medics class
@ -1819,7 +1822,7 @@ void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qbool
}
// WEAPONS - PHENIX1
void ClientWeaponsForClass ( gclient_t *client, pclass_t pclass )
void G_Client_WeaponsForClass ( gclient_t *client, pclass_t pclass )
{
int i;
int Bits;
@ -1842,7 +1845,7 @@ void ClientWeaponsForClass ( gclient_t *client, pclass_t pclass )
}
}
void ClientHoldablesForClass ( gclient_t *client, pclass_t pclass )
void G_Client_HoldablesForClass ( gclient_t *client, pclass_t pclass )
{
if ( g_classData[pclass].isMarine )
client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( HI_TRANSPORTER ) - bg_itemlist;
@ -1851,7 +1854,7 @@ void ClientHoldablesForClass ( gclient_t *client, pclass_t pclass )
client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItemForHoldable( HI_SHIELD ) - bg_itemlist;
}
void G_StoreClientInitialStatus( gentity_t *ent )
void G_Client_StoreClientInitialStatus( gentity_t *ent )
{
char userinfo[MAX_INFO_STRING];
@ -1912,17 +1915,17 @@ void G_RestoreClientInitialStatus( gentity_t *ent )
/*
===========
ClientSpawn
G_Client_Spawn
Called every time a client is placed fresh in the world:
after the first ClientBegin, and after each respawn
after the first G_Client_Begin, and after each respawn
Initializes all non-persistant parts of playerState
------------------------------------
Modifyed By: RedTechie
And also by Marcin - 30/12/2008
============
*/
void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
void G_Client_Spawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
int index=0;
vec3_t spawn_origin, spawn_angles;
gclient_t *client=NULL;
@ -1948,12 +1951,6 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
if ( client->sess.sessionTeam == TEAM_SPECTATOR ) {
spawnPoint = SelectSpectatorSpawnPoint (
spawn_origin, spawn_angles);
} else if (g_gametype.integer >= GT_TEAM) {
spawnPoint = SelectCTFSpawnPoint (
ent,
client->sess.sessionTeam,
client->pers.teamState.state,
spawn_origin, spawn_angles);
} else {
do {
// the first spawn should be at a good looking spot
@ -1962,7 +1959,7 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
spawnPoint = SelectInitialSpawnPoint( spawn_origin, spawn_angles );
} else {
// don't spawn near existing origin if possible
spawnPoint = SelectSpawnPoint (
spawnPoint = G_Client_SelectSpawnPoint (
client->ps.origin,
spawn_origin, spawn_angles);
}
@ -2042,7 +2039,7 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
ent->r.contents = CONTENTS_BODY;
ent->clipmask = MASK_PLAYERSOLID;
ent->die = player_die;
ent->die = G_Client_Die;
ent->waterlevel = 0;
ent->watertype = 0;
ent->flags = 0;
@ -2061,7 +2058,7 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
if ( oClass != client->sess.sessionClass )
{//need to send the class change
ClientUserinfoChanged( client->ps.clientNum );
G_Client_UserinfoChanged( client->ps.clientNum );
}
client->ps.persistant[PERS_CLASS] = client->sess.sessionClass;
@ -2073,11 +2070,11 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
}
if ( !fromDeath || !rpg_dropOnDeath.integer || !rpg_allowWeaponDrop.integer ) {
ClientWeaponsForClass( client, pClass );
G_Client_WeaponsForClass( client, pClass );
} else { // Marcin: just a hand
ClientWeaponsForClass( client, 0 );
G_Client_WeaponsForClass( client, 0 );
}
ClientHoldablesForClass( client, pClass );
G_Client_HoldablesForClass( client, pClass );
if(rpgx_spawn != 1){
G_SetOrigin( ent, spawn_origin );
@ -2091,7 +2088,7 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
trap_GetUsercmd( client - level.clients, &ent->client->pers.cmd );
if(rpgx_spawn != 1){
SetClientViewAngle( ent, spawn_angles );
G_Client_SetViewAngle( ent, spawn_angles );
}
if(rpgx_spawn != 1){
@ -2254,7 +2251,7 @@ void ClientSpawn(gentity_t *ent, int rpgx_spawn, qboolean fromDeath ) {
//store intial client values
//FIXME: when purposely change teams, this gets confused?
G_StoreClientInitialStatus( ent );
G_Client_StoreClientInitialStatus( ent );
//RPG-X: Marcin: stuff was here previously - 22/12/2008
}
@ -2294,7 +2291,7 @@ gentity_t *SpawnBeamOutPlayer( gentity_t *ent ) {
/*
===========
ClientDisconnect
G_Client_Disconnect
Called when a player drops from the server.
Will not be called between levels.
@ -2304,7 +2301,7 @@ call trap_DropClient(), which will call this and do
server system housekeeping.
============
*/
void ClientDisconnect( int clientNum ) {
void G_Client_Disconnect( int clientNum ) {
gentity_t *ent;
gentity_t *tent;
int i;
@ -2392,7 +2389,7 @@ void ClientDisconnect( int clientNum ) {
if ( g_gametype.integer == GT_TOURNAMENT && !level.intermissiontime
&& !level.warmupTime && level.sortedClients[1] == clientNum ) {
level.clients[ level.sortedClients[0] ].sess.wins++;
ClientUserinfoChanged( level.sortedClients[0] );
G_Client_UserinfoChanged( level.sortedClients[0] );
}
if ( g_gametype.integer == GT_TOURNAMENT && ent->client->sess.sessionTeam == TEAM_FREE && level.intermissiontime )
@ -2416,7 +2413,7 @@ void ClientDisconnect( int clientNum ) {
trap_SetConfigstring( CS_PLAYERS + clientNum, "");
CalculateRanks( qfalse );
G_Client_CalculateRanks( qfalse );
if ( ent->r.svFlags & SVF_BOT ) {
BotAIShutdownClient( clientNum );
@ -2460,4 +2457,253 @@ qboolean IsAdmin( gentity_t *ent)
}
}
/*
===========
G_Client_GetLocation
Report a location for the player. Uses placed nearby target_location entities
============
*/
gentity_t *G_Client_GetLocation(gentity_t *ent)
{
gentity_t *eloc, *best;
float bestlen, len;
vec3_t origin;
best = NULL;
bestlen = 3*8192.0*8192.0;
VectorCopy( ent->r.currentOrigin, origin );
for (eloc = level.locationHead; eloc; eloc = eloc->nextTrain) {
len = ( origin[0] - eloc->r.currentOrigin[0] ) * ( origin[0] - eloc->r.currentOrigin[0] )
+ ( origin[1] - eloc->r.currentOrigin[1] ) * ( origin[1] - eloc->r.currentOrigin[1] )
+ ( origin[2] - eloc->r.currentOrigin[2] ) * ( origin[2] - eloc->r.currentOrigin[2] );
if ( len > bestlen ) {
continue;
}
if ( !trap_InPVS( origin, eloc->r.currentOrigin ) ) {
continue;
}
bestlen = len;
best = eloc;
}
return best;
}
/*
===========
G_Client_GetLocationMsg
Report a location for the player. Uses placed nearby target_location entities
============
*/
qboolean G_Client_GetLocationMsg(gentity_t *ent, char *loc, int loclen)
{
gentity_t *best;
best = G_Client_GetLocation( ent );
if (!best)
return qfalse;
if (best->count) {
if (best->count < 0)
best->count = 0;
if (best->count > 7)
best->count = 7;
Com_sprintf(loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE, best->count + '0', best->message );
} else
Com_sprintf(loc, loclen, "%s", best->message);
return qtrue;
}
/*
==================
G_Client_CheckHealthInfoMessage
Sends Health Changes to proper clients
Format:
clientNum health
==================
*/
void G_Client_CheckHealthInfoMessage( void )
{
char entry[1024];
char string[1400];
int stringlength;
int i, j, t;
gentity_t *player, *ent;
int sendToCnt, cnt, sentCnt;
int h;
int clients[MAX_CLIENTS];
int sendToClients[MAX_CLIENTS];
//only send this to medics or spectators or adminz
for (i = 0, sendToCnt = 0; i < g_maxclients.integer; i++)
{
if ( level.clients[i].pers.connected == CON_CONNECTED && level.clients[i].ps.stats[STAT_HEALTH] > 0 &&//make sure they've actually spawned in already
(level.clients[i].sess.sessionTeam == TEAM_SPECTATOR || g_classData[level.clients[i].sess.sessionClass].isMedical || g_classData[level.clients[i].sess.sessionClass].isAdmin ) )
{
sendToClients[sendToCnt++] = i;
}
}
if ( !sendToCnt )
{//no-one to send to
return;
}
//only send those clients whose health has changed this cycle
//NB: there's a prob with client 0 in here....
for (i = 0, cnt = 0; i < g_maxclients.integer; i++)
{
player = g_entities + i;
if ( player->inuse && player->old_health != player->health && ( player->health > 0 || player->old_health > 0 ))
{
clients[cnt++] = i;
player->old_health = player->health;
}
}
if ( !cnt )
{//no-one relevant changed health
return;
}
for ( t = 0; t < sendToCnt; t++ )
{
ent = g_entities + sendToClients[t];
sentCnt = 0;
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0; i < cnt; i++)
{
player = g_entities + clients[i];
if ( ent == player )
{//don't send the ent his own health
continue;
}
//send this one
sentCnt++;
h = player->health;
if (h < 0) h = 0;
Com_sprintf (entry, sizeof(entry), " %i %i", clients[i], h);
j = strlen(entry);
if (stringlength + j > sizeof(string))
break;
strcpy (string + stringlength, entry);
stringlength += j;
}
if ( sentCnt )
{
trap_SendServerCommand( sendToClients[t], va("hinfo %i%s", sentCnt, string) );
}
}
}
//TiM - Modified to work with RPG-X
void G_Client_CheckClientStatus(void)
{
int i;
gentity_t *loc, *ent;
if (level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME) {
level.lastTeamLocationTime = level.time;
for (i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if (ent->inuse) {
loc = G_Client_GetLocation( ent );
if (loc)
ent->client->pers.teamState.location = loc->health;
else
ent->client->pers.teamState.location = 0;
}
}
for (i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if (ent->inuse) {
G_Client_LocationsMessage( ent );
}
}
G_Client_CheckHealthInfoMessage();
}
}
/*
==================
G_Client_LocationsMessage
Format:
clientNum location health armor weapon powerups
==================
*/
void G_Client_LocationsMessage( gentity_t *ent ) {
char entry[1024];
char string[1400];
int stringlength;
int i, j;
gentity_t *player;
int cnt;
//don't bother sending during intermission?
if ( level.intermissiontime )
return;
// figure out what client should be on the display
// we are limited to 8, but we want to use the top eight players
// but in client order (so they don't keep changing position on the overlay)
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + level.sortedClients[i];
if (player->inuse && player->client->sess.sessionTeam ==
ent->client->sess.sessionTeam ) {
}
}
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + i;
//RPG-X | Phenix | 05/03/2005
if (player->inuse) {
//to counter for the fact we could pwn the server doing this, remove all superfluous data
Com_sprintf (entry, sizeof(entry), " %i %i ", i, player->client->pers.teamState.location);
j = strlen(entry);
if (stringlength + j > sizeof(string))
break;
strcpy (string + stringlength, entry);
stringlength += j;
cnt++;
}
}
trap_SendServerCommand( ent-g_entities, va("tinfo %i%s", cnt, string) );
}

View file

@ -539,7 +539,7 @@ static void Cmd_LevelShot_f( gentity_t *ent ) {
level.intermissiontime = -1;
// Special 'level shot' setting -- Terrible ABUSE!!! HORRIBLE NASTY HOBBITTESSSES
BeginIntermission();
G_Client_BeginIntermission();
trap_SendServerCommand( ent-g_entities, "clientLevelShot" );
}
@ -608,10 +608,10 @@ static void Cmd_Kill_f( gentity_t *ent )
ps->stats[STAT_WEAPONS] = ( 1 << WP_0 );
ps->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
ps->stats[STAT_HEALTH] = ent->health = 1;
player_die (ent, ent, ent, 1, meansOfDeath ); //MOD_SUICIDE
G_Client_Die (ent, ent, ent, 1, meansOfDeath ); //MOD_SUICIDE
}else{
ps->stats[STAT_HEALTH] = ent->health = 0;
player_die (ent, ent, ent, 100000, meansOfDeath ); //MOD_SUICIDE
G_Client_Die (ent, ent, ent, 100000, meansOfDeath ); //MOD_SUICIDE
}
if ( rpg_kicksuiciders.integer > 0 )
@ -733,7 +733,7 @@ qboolean SetTeam( gentity_t *ent, char *s ) {
// pick the team with the least number of players
if ( isBot )
{
team = PickTeam( clientNum );
team = G_Client_PickTeam( clientNum );
}
else
{
@ -746,8 +746,8 @@ qboolean SetTeam( gentity_t *ent, char *s ) {
{
int counts[TEAM_NUM_TEAMS];
counts[TEAM_BLUE] = TeamCount( clNum, TEAM_BLUE );
counts[TEAM_RED] = TeamCount( clNum, TEAM_RED );
counts[TEAM_BLUE] = G_Client_TeamCount( clNum, TEAM_BLUE );
counts[TEAM_RED] = G_Client_TeamCount( clNum, TEAM_RED );
// We allow a spread of two
if ( team == TEAM_RED && counts[TEAM_RED] - counts[TEAM_BLUE] > 1 )
@ -800,7 +800,7 @@ qboolean SetTeam( gentity_t *ent, char *s ) {
// Kill him (makes sure he loses flags, etc)
ent->flags &= ~FL_GODMODE;
ent->client->ps.stats[STAT_HEALTH] = ent->health = 0;
player_die (ent, NULL, NULL, 100000, MOD_RESPAWN);
G_Client_Die (ent, NULL, NULL, 100000, MOD_RESPAWN);
}
// they go to the end of the line for tournements
@ -815,9 +815,9 @@ qboolean SetTeam( gentity_t *ent, char *s ) {
BroadcastTeamChange( client, oldTeam );
// get and distribute relevent paramters
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
ClientBegin( clientNum, qfalse, qfalse, qfalse );
G_Client_Begin( clientNum, qfalse, qfalse, qfalse );
return qtrue;
}
@ -953,7 +953,7 @@ qboolean SetClass( gentity_t *ent, char *s, char *teamName, qboolean SaveToCvar
else
{//not changing teams or couldn't change teams
// get and distribute relevent paramters
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
//if in the game already, kill and respawn him, else just wait to join
if ( sess->sessionTeam == TEAM_SPECTATOR )
@ -965,7 +965,7 @@ qboolean SetClass( gentity_t *ent, char *s, char *teamName, qboolean SaveToCvar
//RPG-X: RedTechie - No respawn for n00bs set all info and frap that a n00b needs HERE this eliminates respawns for n00bs
if(g_classData[pclass].isn00b/*pclass == PC_N00B*/){
ClientSpawn(ent, 1, qfalse);
G_Client_Spawn(ent, 1, qfalse);
ps->stats[STAT_WEAPONS] = ( 1 << WP_0 );
ps->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
@ -990,8 +990,8 @@ qboolean SetClass( gentity_t *ent, char *s, char *teamName, qboolean SaveToCvar
ent->flags &= ~FL_GODMODE;
ps->stats[STAT_HEALTH] = ent->health = 0;
player_die (ent, NULL, NULL, 100000, MOD_RESPAWN);
ClientBegin( clientNum, qfalse, qfalse, qfalse );
G_Client_Die (ent, NULL, NULL, 100000, MOD_RESPAWN);
G_Client_Begin( clientNum, qfalse, qfalse, qfalse );
}
}
}
@ -1023,8 +1023,6 @@ void StopFollowing( gentity_t *ent ) {
ps->stats[STAT_HEALTH] = ps->stats[STAT_MAX_HEALTH];
}
extern team_t borgTeam;
/*
=================
Cmd_Team_f
@ -1088,6 +1086,26 @@ static void Cmd_Team_f( gentity_t *ent ) {
ent->client->switchTeamTime = level.time + 2000;
}
/*
====================
Cmd_Ready_f
====================
*/
/**
* This function is called from the ui_sp_postgame.c as a result of clicking on the
* "next" button in non GT_TOURNAMENT games. This replaces the old system of waiting
* for the user to click an ATTACK or USE button to signal ready
* (see ClientIntermissionThink())
*
* when all clients have signaled ready, the game continues to the next match.
*/
void Cmd_Ready_f (gentity_t *ent)
{
gclient_t *client;
client = ent->client;
client->readyToExit = qtrue;
}
/*
=================
@ -1471,12 +1489,10 @@ static void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chat
clientPersistant_t *entPers = &entClient->pers;
clientPersistant_t *tarPers = NULL;
clientSession_t *entSess = &entClient->sess;
clientSession_t *tarSess =NULL;
if(target && target->client) {
tarClient = target->client;
tarPers = &tarClient->pers;
tarSess =&tarClient->sess;
}
if ( g_gametype.integer < GT_TEAM && mode == SAY_TEAM ) {
@ -1530,21 +1546,13 @@ static void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chat
color = COLOR_WHITE;
break;
case SAY_TELL:
if (target && g_gametype.integer >= GT_TEAM && tarSess &&
tarSess->sessionTeam == entSess->sessionTeam && tarPers &&
Team_GetLocationMsg(ent, location, sizeof(location)))
Com_sprintf (name, sizeof(name), "^7%s ^7from %s%c%c (%s): ", tarPers->netname, entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );
else if(tarPers)
if(tarPers)
Com_sprintf (name, sizeof(name), "^7%s ^7from %s%c%c: ", tarPers->netname, entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE );
else return;
color = COLOR_MAGENTA;
break;
case SAY_TELL2:
if (target && g_gametype.integer >= GT_TEAM && tarSess &&
tarSess->sessionTeam == entSess->sessionTeam && tarPers &&
Team_GetLocationMsg(ent, location, sizeof(location)))
Com_sprintf (name, sizeof(name), "^7%s ^7from %s%c%c (%s): ", tarPers->netname, entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );
else if(tarPers)
if(tarPers)
Com_sprintf (name, sizeof(name), "^7%s ^7from %s%c%c: ", tarPers->netname, entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE );
else return;
color = COLOR_MAGENTA;
@ -1560,7 +1568,7 @@ static void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chat
color = COLOR_YELLOW;
break;
case SAY_ADMIN:
if (Team_GetLocationMsg(ent, location, sizeof(location)) && tarPers)
if (G_Client_GetLocationMsg(ent, location, sizeof(location)) && tarPers)
Com_sprintf (name, sizeof(name), "[%s%c%c] [%s] (%s): ", entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE, tarPers->netname, location );
else if(tarPers)
Com_sprintf (name, sizeof(name), "[%s%c%c ^7To %s^7]: ", entPers->netname, Q_COLOR_ESCAPE, COLOR_WHITE, tarPers->netname );
@ -2274,10 +2282,10 @@ static void Cmd_ForceKill_f( gentity_t *ent ) {
ps->stats[STAT_WEAPONS] = ( 1 << WP_0 );
ps->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
ps->stats[STAT_HEALTH] = target->health = 1;
player_die (target, target, target, 100000, MOD_FORCEDSUICIDE);
G_Client_Die (target, target, target, 100000, MOD_FORCEDSUICIDE);
}else{
ps->stats[STAT_HEALTH] = target->health = 0;
player_die (target, target, target, 100000, MOD_FORCEDSUICIDE);
G_Client_Die (target, target, target, 100000, MOD_FORCEDSUICIDE);
}
} // end iterations
@ -2311,10 +2319,10 @@ static void Cmd_ForceKill_f( gentity_t *ent ) {
ps->stats[STAT_WEAPONS] = ( 1 << WP_0 );
ps->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
ps->stats[STAT_HEALTH] = target->health = 1;
player_die (target, target, target, 100000, MOD_FORCEDSUICIDE);
G_Client_Die (target, target, target, 100000, MOD_FORCEDSUICIDE);
}else{
ps->stats[STAT_HEALTH] = target->health = 0;
player_die (target, target, target, 100000, MOD_FORCEDSUICIDE);
G_Client_Die (target, target, target, 100000, MOD_FORCEDSUICIDE);
}
Com_sprintf (send, sizeof(send), "%s ^7forced %s^7's death", ent->client->pers.netname, target->client->pers.netname);
@ -2445,10 +2453,10 @@ static void Cmd_ForceKillRadius_f( gentity_t *ent)
oPs->stats[STAT_WEAPONS] = ( 1 << WP_0 );
oPs->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
oPs->stats[STAT_HEALTH] = OtherPlayer->health = 1;
player_die(OtherPlayer,OtherPlayer,OtherPlayer,100000, MOD_FORCEDSUICIDE);
G_Client_Die(OtherPlayer,OtherPlayer,OtherPlayer,100000, MOD_FORCEDSUICIDE);
}else{
oPs->stats[STAT_HEALTH] = OtherPlayer->health = 0;
player_die(OtherPlayer,OtherPlayer,OtherPlayer,100000, MOD_FORCEDSUICIDE);
G_Client_Die(OtherPlayer,OtherPlayer,OtherPlayer,100000, MOD_FORCEDSUICIDE);
}
}
@ -2465,10 +2473,10 @@ static void Cmd_ForceKillRadius_f( gentity_t *ent)
ePs->stats[STAT_WEAPONS] = ( 1 << WP_0 );
ePs->stats[STAT_HOLDABLE_ITEM] = HI_NONE;
ePs->stats[STAT_HEALTH] = ent->health = 1;
player_die(ent,ent,ent,100000, MOD_FORCEDSUICIDE);
G_Client_Die(ent,ent,ent,100000, MOD_FORCEDSUICIDE);
}else{
ePs->stats[STAT_HEALTH] = ent->health = 0;
player_die(ent,ent,ent,100000, MOD_FORCEDSUICIDE);
G_Client_Die(ent,ent,ent,100000, MOD_FORCEDSUICIDE);
}
}
@ -3134,7 +3142,7 @@ static void Cmd_AdminLogin_f( gentity_t *ent)
if(!arg[0] && ent->client->LoggedAsAdmin) {
ent->client->LoggedAsAdmin = qfalse;
trap_SendServerCommand( ent-g_entities, va("print \"You are now logged out.\n\"") );
ClientUserinfoChanged( ent-g_entities );
G_Client_UserinfoChanged( ent-g_entities );
return;
}
else if ( !arg[0] ) { //if user added no args (ie wanted the parameters)
@ -3152,7 +3160,7 @@ static void Cmd_AdminLogin_f( gentity_t *ent)
if ( IsAdmin( ent ) == qfalse ) {
ent->client->LoggedAsAdmin = qtrue;
trap_SendServerCommand( ent-g_entities, va("print \"You are logged in as an admin.\n\"") );
ClientUserinfoChanged( ent-g_entities );
G_Client_UserinfoChanged( ent-g_entities );
return;
} else {
trap_SendServerCommand( ent-g_entities, va("print \"You are already logged in as an admin or in the admin class.\n\"") );
@ -3245,7 +3253,7 @@ static void Cmd_Revive_f( gentity_t *ent)
{
if( (g_entities[i].client) && (g_entities[i].health == 1) && (g_entities[i].client->ps.pm_type == PM_DEAD))
{
ClientSpawn(&g_entities[i], 1, qtrue);
G_Client_Spawn(&g_entities[i], 1, qtrue);
ps = &g_entities[i].client->ps;
@ -3281,7 +3289,7 @@ static void Cmd_Revive_f( gentity_t *ent)
//Just me
if( (ent && ent->client) && (ent->health <= 1) && (ent->client->ps.pm_type == PM_DEAD))
{
ClientSpawn(ent, 1, qtrue);
G_Client_Spawn(ent, 1, qtrue);
ps = &ent->client->ps;
@ -3316,7 +3324,7 @@ static void Cmd_Revive_f( gentity_t *ent)
if( (other && other->client) && (other->health == 1) && (other->client->ps.pm_type == PM_DEAD))
{
ClientSpawn(other, 1, qtrue);
G_Client_Spawn(other, 1, qtrue);
ps = &other->client->ps;
@ -5561,7 +5569,7 @@ static void Cmd_Respawn_f(gentity_t *ent) {
if(!ent->client)
return;
ClientSpawn(ent, 0, qfalse);
G_Client_Spawn(ent, 0, qfalse);
if(ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
ent->client->ps.powerups[PW_QUAD] = level.time + 4000;
tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TRANSPORT_IN );
@ -7437,10 +7445,10 @@ void Cmd_CamtestEnd_f(gentity_t *ent) {
/*
=================
ClientCommand
G_Client_Command
=================
*/
void ClientCommand( int clientNum )
void G_Client_Command( int clientNum )
{
gentity_t *ent;
char cmd[MAX_TOKEN_CHARS];

View file

@ -11,12 +11,12 @@ extern void SetClass( gentity_t *ent, char *s, char *teamName, qboolean SaveToCv
/*
============
AddScore
G_Client_AddScore
Adds score to both the client and his team
============
*/
void AddScore( gentity_t *ent, int score ) {
void G_Client_AddScore( gentity_t *ent, int score ) {
if ( !ent )
{
return;
@ -36,7 +36,7 @@ void AddScore( gentity_t *ent, int score ) {
{//this isn't capture score
level.teamScores[ ent->client->ps.persistant[PERS_TEAM] ] += score;
}
CalculateRanks( qfalse );
G_Client_CalculateRanks( qfalse );
//RPG-X: RedTechie - Lets enable score updating without this scores will not be updated
ent->client->UpdateScore = qfalse;
@ -64,7 +64,7 @@ void SetScore( gentity_t *ent, int score ) {
}
ent->client->ps.persistant[PERS_SCORE] = score;
CalculateRanks( qfalse );
G_Client_CalculateRanks( qfalse );
// TiM: send the current scoring to all clients
SendScoreboardMessageToAllClients();
@ -251,14 +251,14 @@ extern void DetonateDetpack(gentity_t *ent);
/*
==================
player_die
G_Client_Die
Heavly Modifyed By: RedTechie
RPG-X: Marcin: a little bit modified - 30/12/2008
==================
*/
extern char *ClassNameForValue( pclass_t pClass );
extern qboolean IsAdmin( gentity_t *ent);
void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {
void G_Client_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) {
//---------------------
//RPG-X: RedTechie - Check to see if medics revive people and not respawn if true use my fake death insead :)
//---------------------
@ -479,11 +479,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
BG_PlayerStateToEntityState( &self->client->ps, &self->s, qtrue );
ClientUserinfoChanged( self->s.clientNum );
G_Client_UserinfoChanged( self->s.clientNum );
ClientEndFrame( self );
G_StoreClientInitialStatus( self );
G_Client_StoreClientInitialStatus( self );
//---------------------
//RPG-X: RedTechie - If it dose equal 0 use regular die
//---------------------
@ -601,17 +601,17 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
////////////////////////////////////////////////////////////////////////
if (attacker && attacker->client)
{
if ( attacker == self || OnSameTeam (self, attacker ) )
if ( attacker == self )
{
if ( meansOfDeath != MOD_RESPAWN )
{//just changing class
AddScore( attacker, -1 );
G_Client_AddScore( attacker, -1 );
}
}
else
{
attacker->client->pers.teamState.frags++;
AddScore( attacker, 1 );
G_Client_AddScore( attacker, 1 );
// Check to see if the player is on a streak.
attacker->client->streakCount++;
@ -623,7 +623,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
{
if ( meansOfDeath != MOD_RESPAWN )
{//not just changing class
AddScore( self, -1 );
G_Client_AddScore( self, -1 );
}
}
////////////////////////////////////////////////////////////////////////
@ -1079,7 +1079,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
gclient_t *client;
int take=0;
int knockback;
qboolean bFriend = (targ && attacker) ? OnSameTeam( targ, attacker ) : qfalse;
qboolean bFriend = qfalse;
if(!targ) return;
@ -1176,7 +1176,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
if ( knockback && targ->client )
{
//if it's non-radius damage knockback from a teammate, don't do it if the damage won't be taken
if ( (dflags&DAMAGE_ALL_TEAMS) || (dflags&DAMAGE_RADIUS) || g_friendlyFire.integer || !attacker->client || !OnSameTeam (targ, attacker) )
if ( (dflags&DAMAGE_ALL_TEAMS) || (dflags&DAMAGE_RADIUS) || g_friendlyFire.integer || !attacker->client )
{
vec3_t kvel;
float mass;
@ -1215,7 +1215,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
// if the attacker was on the same team
// check for completely getting out of the damage
if ( !(dflags & DAMAGE_NO_PROTECTION) ) {
if ( !(dflags&DAMAGE_ALL_TEAMS) && mod != MOD_TELEFRAG && mod != MOD_DETPACK && targ != attacker && OnSameTeam (targ, attacker) )
if ( !(dflags&DAMAGE_ALL_TEAMS) && mod != MOD_TELEFRAG && mod != MOD_DETPACK && targ != attacker )
{
if ( attacker->client && targ->client )
{//this only matters between clients
@ -1294,9 +1294,6 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
}
}
// See if it's the player hurting the emeny flag carrier
Team_CheckHurtCarrier(targ, attacker);
if (targ->client) {
// set the last client who damaged the target
targ->client->lasthurt_client = attacker->s.number;
@ -1352,7 +1349,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_0 ); //?!!!!!
client->ps.stats[STAT_HOLDABLE_ITEM] = HI_NONE;
targ->health = 1;
player_die( targ, inflictor, attacker, take, mod );
G_Client_Die( targ, inflictor, attacker, take, mod );
}
}else{
if ( targ->health <= 0 ) {
@ -1515,7 +1512,7 @@ qboolean G_RadiusDamage ( vec3_t origin, gentity_t *attacker, float damage, floa
}
}
if( LogAccuracyHit( ent, attacker ) ) {
if( G_Weapon_LogAccuracyHit( ent, attacker ) ) {
hitClient = qtrue;
}
VectorSubtract (ent->r.currentOrigin, origin, dir);

View file

@ -567,7 +567,7 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
respawn = Pickup_Powerup(ent, other);
break;
case IT_TEAM:
respawn = Pickup_Team(ent, other);
respawn = 0; // TODO remove?
break;
case IT_HOLDABLE:
respawn = Pickup_Holdable(ent, other);
@ -710,24 +710,8 @@ gentity_t *LaunchItem( gitem_t *item, gentity_t *who, vec3_t origin, vec3_t velo
Padd_Add(dropped, who, txt);
}
if (item->giType == IT_TEAM) { // Special case for CTF flags
gentity_t *te;
VectorSet (dropped->r.mins, -23, -23, -15);
VectorSet (dropped->r.maxs, 23, 23, 31);
dropped->think = Team_DroppedFlagThink;
dropped->nextthink = level.time + 30000;
Team_CheckDroppedItem( dropped );
// make the sound call for a dropped flag
te = G_TempEntity( dropped->s.pos.trBase, EV_TEAM_SOUND );
te->s.eventParm = DROPPED_FLAG_SOUND;
te->r.svFlags |= SVF_BROADCAST;
} else { // auto-remove after 30 seconds
dropped->think = G_FreeEntity;
dropped->nextthink = level.time + 6000000; //30000; // RPG-X: Marcin: increased - 03/12/2008
}
dropped->think = G_FreeEntity;
dropped->nextthink = level.time + 6000000; //30000; // RPG-X: Marcin: increased - 03/12/2008
dropped->flags = flags; // FL_DROPPED_ITEM; // RPG-X: Marcin: for ThrowWeapon - 03/12/2008
@ -991,31 +975,6 @@ qboolean FinishSpawningDecoy( gentity_t *ent, int itemIndex )
qboolean itemRegistered[MAX_ITEMS];
/*
==================
G_CheckTeamItems
==================
*/
void G_CheckTeamItems( void ) {
// Set up team stuff
Team_InitGame();
if ( g_gametype.integer == GT_CTF ) {
gitem_t *item;
// make sure we actually have two flags...
item = BG_FindItem( "team_CTF_redflag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( "^1WARNING: No team_CTF_redflag in map" );
}
item = BG_FindItem( "team_CTF_blueflag" );
if ( !item || !itemRegistered[ item - bg_itemlist ] ) {
G_Printf( "^1WARNING: No team_CTF_blueflag in map" );
}
}
}
/*
==============
ClearRegisteredItems
@ -1248,11 +1207,7 @@ void G_RunItem( gentity_t *ent ) {
// if it is in a nodrop volume, remove it
contents = trap_PointContents( ent->r.currentOrigin, -1 );
if ( contents & CONTENTS_NODROP ) {
if (ent->item && ent->item->giType == IT_TEAM) {
Team_FreeEntity(ent);
} else {
G_FreeEntity( ent );
}
G_FreeEntity( ent );
return;
}

View file

@ -480,7 +480,7 @@ void SetScore( gentity_t *ent, int score );
/**
* \brief client data that stays across multiple respawns,
*
* but is cleared on each level change or team change at ClientBegin()
* but is cleared on each level change or team change at G_Client_Begin()
*/
typedef struct {
clientConnected_t connected;
@ -502,7 +502,7 @@ typedef struct {
/** \struct gclient_s
*
* this structure is cleared on each ClientSpawn(),
* this structure is cleared on each G_Client_Spawn(),
* except for 'client->pers' and 'client->sess'
*/
struct gclient_s {
@ -727,6 +727,7 @@ void StopFollowing( gentity_t *ent );
void BroadcastTeamChange( gclient_t *client, int oldTeam );
qboolean SetTeam( gentity_t *ent, char *s );
void Cmd_FollowCycle_f( gentity_t *ent, int dir );
void Cmd_Ready_f (gentity_t *ent);
//
// g_roff.c
@ -762,8 +763,6 @@ void Padd_Add( gentity_t *key, gentity_t *who, char *txt);
char *Padd_Get( gentity_t *key, gentity_t *who );
void Padd_Remove( gentity_t *key );
void G_CheckTeamItems( void );
void G_RunItem( gentity_t *ent );
void RespawnItem( gentity_t *ent );
@ -855,8 +854,7 @@ void G_Repair(gentity_t *ent, gentity_t *tr_ent, float rate); //RPG-X | GSIO01 |
//
// g_missile.c
//
void G_RunMissile( gentity_t *ent );
void G_Missile_Run( gentity_t *ent );
gentity_t *fire_blaster (gentity_t *self, vec3_t start, vec3_t aimdir);
gentity_t *fire_plasma (gentity_t *self, vec3_t start, vec3_t aimdir);
gentity_t *fire_quantum (gentity_t *self, vec3_t start, vec3_t aimdir);
@ -864,16 +862,15 @@ 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_grapple (gentity_t *self, vec3_t start, vec3_t dir);
gentity_t *fire_comprifle (gentity_t *self, vec3_t start, vec3_t dir);
//RPG-X: - RedTechie Added this for curiosity
void ShieldRemove(gentity_t *self);
//
// g_mover.c
//
void G_RunMover( gentity_t *ent );
void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace );
void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator );
void G_Mover_Run( gentity_t *ent );
void G_Mover_TouchDoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace );
void G_Mover_UseBinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator );
//
// g_trigger.c
@ -893,35 +890,105 @@ void target_turbolift_start( gentity_t *ent );
//
// g_weapon.c
//
qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker );
void CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint, float projsize);
void SnapVectorTowards( vec3_t v, vec3_t to );
//qboolean SeekerAcquiresTarget ( gentity_t *ent, vec3_t pos );
//void FireSeeker( gentity_t *owner, gentity_t *target, vec3_t origin);
qboolean G_Weapon_LogAccuracyHit( gentity_t *target, gentity_t *attacker );
void G_Weapon_CalcMuzzlePoint ( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint, float projsize);
void G_Weapon_SnapVectorTowards( vec3_t v, vec3_t to );
//
// g_client.c
//
team_t TeamCount( int ignoreClientNum, int team );
team_t PickTeam( int ignoreClientNum );
void SetClientViewAngle( gentity_t *ent, vec3_t angle );
gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles );
void respawn (gentity_t *ent);
void BeginIntermission (void);
void InitClientPersistant (gclient_t *client);
void InitClientResp (gclient_t *client);
void InitBodyQue (void);
void ClientSpawn( gentity_t *ent, int rpgx_spawn, qboolean fromDeath );
void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
void AddScore( gentity_t *ent, int score );
void CalculateRanks( qboolean fromExit );
qboolean SpotWouldTelefrag( gentity_t *spot );
//RPG-X: RedTechie - Class info
//void ClientMaxHealthForClass ( gclient_t *client, pclass_t pclass );
//void ClientPowerupsForClass ( gentity_t *ent, pclass_t pclass );
void ClientWeaponsForClass ( gclient_t *client, pclass_t pclass );
void ClientHoldablesForClass ( gclient_t *client, pclass_t pclass );
void G_StoreClientInitialStatus( gentity_t *ent );
/**
* Get number of clients in team.
*/
team_t G_Client_TeamCount( int ignoreClientNum, int team );
/**
* Pick a random team.
*/
team_t G_Client_PickTeam( int ignoreClientNum );
/**
* Set the clients view angle.
*/
void G_Client_SetViewAngle( gentity_t *ent, vec3_t angle );
/**
* Select a spawnpoint.
*/
gentity_t* G_Client_SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles );
/**
* Respawn client.
*/
void G_Client_Respawn(gentity_t *ent);
/**
* Begin intermission.
*/
void G_Client_BeginIntermission(void);
/**
* Init the body que.
*/
void G_Client_InitBodyQue(void);
/**
* Spawn client.
*/
void G_Client_Spawn( gentity_t *ent, int rpgx_spawn, qboolean fromDeath );
/**
* Let the client die.
*/
void G_Client_Die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod);
/**
* Add score for the client.
*/
void G_Client_AddScore( gentity_t *ent, int score );
/**
* Calculate clients ranks.
*/
void G_Client_CalculateRanks( qboolean fromExit );
/**
* Determine whether spot would telefrag.
*/
qboolean G_Client_SpotWouldTelefrag( gentity_t *spot );
/**
* Get weapons for a class.
*/
void G_Client_WeaponsForClass( gclient_t *client, pclass_t pclass );
/**
* Get holdable items for a class.
*/
void G_Client_HoldablesForClass( gclient_t *client, pclass_t pclass );
/**
* Store the clients initial status.
*/
void G_Client_StoreClientInitialStatus( gentity_t *ent );
/**
* Get location message for a client.
*/
qboolean G_Client_GetLocationMsg(gentity_t *ent, char *loc, int loclen);
/**
* Check client statuses.
*/
void G_Client_CheckClientStatus(void);
/**
* Send client location information.
*/
void G_Client_LocationsMessage( gentity_t *ent );
/**
* Client connect.
*/
char* G_Client_Connect( int clientNum, qboolean firstTime, qboolean isBot );
/**
* Clients user info changed.
*/
void G_Client_UserinfoChanged( int clientNum );
/**
* Disconnect client.
*/
void G_Client_Disconnect( int clientNum );
/**
* Initialize client.
*/
void G_Client_Begin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qboolean first );
/**
* Client command.
*/
void G_Client_Command( int clientNum );
//
// g_svcmds.c
@ -1130,18 +1197,57 @@ typedef enum
#define AWARDS_MSG_LENGTH 256
/**
* Print message to log.
*/
void QDECL G_LogPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
/**
* Log weapon pickup.
*/
void QDECL G_LogWeaponPickup(int client, int weaponid);
/**
* Log weapon fire.
*/
void QDECL G_LogWeaponFire(int client, int weaponid);
/**
* Log weapon damage.
*/
void QDECL G_LogWeaponDamage(int client, int mod, int amount);
/**
* Log weapon kill.
*/
void QDECL G_LogWeaponKill(int client, int mod);
/**
* Log weapon death.
*/
void QDECL G_LogWeaponDeath(int client, int weaponid);
/**
* Log weapon frag.
*/
void QDECL G_LogWeaponFrag(int attacker, int deadguy);
/**
* Log weapon powerup.
*/
void QDECL G_LogWeaponPowerup(int client, int powerupid);
/**
* Log weapon item.
*/
void QDECL G_LogWeaponItem(int client, int itemid);
/**
* Log weapon init.
*/
void QDECL G_LogWeaponInit(void);
/**
* Log weapon output.
*/
void QDECL G_LogWeaponOutput(void);
/**
* Log exit.
*/
void QDECL G_LogExit( const char *string );
/**
* Clear client log.
*/
void QDECL G_ClearClientLog(int client);
void CalculateAwards(gentity_t *ent, char *msg);
@ -1152,17 +1258,7 @@ int GetFavoriteTargetForClient(int nClient);
int GetWorstEnemyForClient(int nClient);
int GetFavoriteWeaponForClient(int nClient);
//
// g_client.c
//
char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot );
//TiM - changed to allow override of 'clampinfo'
void ClientUserinfoChanged( int clientNum );
void ClientDisconnect( int clientNum );
void ClientBegin( int clientNum, qboolean careAboutWarmup, qboolean isBot, qboolean first );
void ClientCommand( int clientNum );
/*----------------------------------------------------------------------------------------*/
//TiM - Delayed Transport Beam
void G_InitTransport( int clientNum, vec3_t origin, vec3_t angles );
@ -1182,22 +1278,15 @@ typedef struct
// g_active.c
//
void ClientThink( int clientNum );
void ClientEndFrame( gentity_t *ent );
void G_RunClient( gentity_t *ent );
void Cmd_Ready_f (gentity_t *ent);
void ClientThink( int clientNum ); // TODO move me to g_client.c
void ClientEndFrame( gentity_t *ent ); // TODO move me to g_client.c
void G_RunClient( gentity_t *ent ); // TODO move me to g_client.c
void G_Active_ShieldRemove(gentity_t *self);
//RPG-X | Marcin | 03/12/2008
void ThrowWeapon( gentity_t *ent, char *txt );
gentity_t *DropWeapon( gentity_t *ent, gitem_t *item, float angle, int flags, char *txt );
//
// g_team.c
//
qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
void Team_CheckDroppedItem( gentity_t *dropped );
//
// g_mem.c
//

View file

@ -514,21 +514,21 @@ intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4,
G_ShutdownGame( arg0 );
return 0;
case GAME_CLIENT_CONNECT:
return (size_t)ClientConnect( arg0, (qboolean)arg1, (qboolean)arg2 );
return (size_t)G_Client_Connect( arg0, (qboolean)arg1, (qboolean)arg2 );
case GAME_CLIENT_THINK:
ClientThink( arg0 );
return 0;
case GAME_CLIENT_USERINFO_CHANGED:
ClientUserinfoChanged( arg0 ); //TiM - this means a user just tried to change it
G_Client_UserinfoChanged( arg0 ); //TiM - this means a user just tried to change it
return 0;
case GAME_CLIENT_DISCONNECT:
ClientDisconnect( arg0 );
G_Client_Disconnect( arg0 );
return 0;
case GAME_CLIENT_BEGIN:
ClientBegin( arg0, qtrue, qfalse, qtrue );
G_Client_Begin( arg0, qtrue, qfalse, qtrue );
return 0;
case GAME_CLIENT_COMMAND:
ClientCommand( arg0 );
G_Client_Command( arg0 );
return 0;
case GAME_RUN_FRAME:
G_RunFrame( arg0 );
@ -1665,8 +1665,6 @@ static void G_UpdateCvars( void )
}
extern int altAmmoUsage[];
extern team_t borgTeam;
extern team_t initialBorgTeam;
static void G_InitModRules( void )
{
numKilled = 0;
@ -1827,7 +1825,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
&level.clients[0].ps, sizeof( level.clients[0] ) );
// reserve some spots for dead player bodies
InitBodyQue();
G_Client_InitBodyQue();
ClearRegisteredItems();
@ -1855,9 +1853,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
// general initialization
G_FindTeams();
// make sure we have flags for CTF, etc
G_CheckTeamItems();
SaveRegisteredItems();
G_Printf ("-----------------------------------\n");
@ -2084,13 +2079,13 @@ static void AdjustTournamentScores( void ) {
clientNum = level.sortedClients[0];
if ( level.clients[ clientNum ].pers.connected == CON_CONNECTED ) {
level.clients[ clientNum ].sess.wins++;
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
}
clientNum = level.sortedClients[1];
if ( level.clients[ clientNum ].pers.connected == CON_CONNECTED ) {
level.clients[ clientNum ].sess.losses++;
ClientUserinfoChanged( clientNum );
G_Client_UserinfoChanged( clientNum );
}
}
@ -2165,7 +2160,7 @@ int QDECL SortRanks( const void *a, const void *b ) {
/*
============
CalculateRanks
G_Client_CalculateRanks
Recalculates the score ranks of all players
This will be called on every client connect, begin, disconnect, death,
@ -2174,7 +2169,7 @@ and team change.
FIXME: for elimination, the last man standing must be ranked first
============
*/
void CalculateRanks( qboolean fromExit ) {
void G_Client_CalculateRanks( qboolean fromExit ) {
int i;
int rank;
int score;
@ -2291,7 +2286,7 @@ MAP CHANGING
========================
SendScoreboardMessageToAllClients
Do this at BeginIntermission time and whenever ranks are recalculated
Do this at G_Client_BeginIntermission time and whenever ranks are recalculated
due to enters/exits/forced team changes
========================
*/
@ -2356,7 +2351,7 @@ void FindIntermissionPoint( void ) {
// find the intermission spot
ent = G_Find (NULL, FOFS(classname), "info_player_intermission");
if ( !ent ) { // the map creator forgot to put in an intermission point...
SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle );
G_Client_SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle );
} else {
VectorCopy (ent->s.origin, level.intermission_origin);
VectorCopy (ent->s.angles, level.intermission_angle);
@ -2397,10 +2392,10 @@ static void ClearFiringFlags(void)
/*
==================
BeginIntermission
G_Client_BeginIntermission
==================
*/
void BeginIntermission( void ) {
void G_Client_BeginIntermission( void ) {
int i;
gentity_t *client;
qboolean doingLevelshot;
@ -2439,7 +2434,7 @@ void BeginIntermission( void ) {
if (!client->inuse)
continue;
if (client->health <= 0) {
respawn(client);
G_Client_Respawn(client);
}
MoveClientToIntermission( client );
@ -2722,7 +2717,7 @@ void G_RunFrame( int levelTime ) {
}
if ( (es->eType == ET_MISSILE) || (es->eType == ET_ALT_MISSILE) ) {
G_RunMissile( ent );
G_Missile_Run( ent );
continue;
}
@ -2732,7 +2727,7 @@ void G_RunFrame( int levelTime ) {
}
if ( es->eType == ET_MOVER || es->eType == ET_MOVER_STR ) { //RPG-X | GSIO01 | 13/05/2009
G_RunMover( ent );
G_Mover_Run( ent );
continue;
}
@ -2758,8 +2753,8 @@ void G_RunFrame( int levelTime ) {
// see if it is time to end the level
CheckExitRules();
// update to team status?
CheckTeamStatus();
// update to client status?
G_Client_CheckClientStatus();
// cancel vote if timed out
CheckVote();

View file

@ -96,7 +96,7 @@ void TransportPlayer( gentity_t *player, vec3_t origin, vec3_t angles, int speed
ps->eFlags ^= EF_TELEPORT_BIT;
// set angles
SetClientViewAngle( player, angles );
G_Client_SetViewAngle( player, angles );
// kill anything at the destination
if ( sess->sessionTeam != TEAM_SPECTATOR /*&& !(ps->eFlags&EF_ELIMINATED)*/) {
@ -204,7 +204,7 @@ void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles, tpType_t t
ps->eFlags ^= EF_TELEPORT_BIT;
// set angles
SetClientViewAngle( player, angles );
G_Client_SetViewAngle( player, angles );
// kill anything at the destination
if ( sess->sessionTeam != TEAM_SPECTATOR ) {

View file

@ -237,10 +237,10 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
if(other && ((other->classname && !Q_stricmp(other->classname, "holdable_shield")))){
if(IsAdmin(ent->parent)){
G_FreeEntity(ent);
ShieldRemove(other);
G_Active_ShieldRemove(other);
return;
}else{
// can't call grenadeSpewShrapnel right here or G_RunMissile will puke
// can't call grenadeSpewShrapnel right here or G_Missile_Run will puke
ent->think = grenadeSpewShrapnel;
// set our next think to right now. our think fn will get called this frame.
ent->nextthink = level.time;
@ -248,7 +248,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
return;
}
}else{
// can't call grenadeSpewShrapnel right here or G_RunMissile will puke
// can't call grenadeSpewShrapnel right here or G_Missile_Run will puke
ent->think = grenadeSpewShrapnel;
// set our next think to right now. our think fn will get called this frame.
ent->nextthink = level.time;
@ -301,7 +301,7 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) {
// change over to a normal entity right at the point of impact
ent->s.eType = ET_GENERAL;
SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth
G_Weapon_SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth
G_SetOrigin( ent, trace->endpos );
@ -367,11 +367,11 @@ static void G_RunStuckMissile( gentity_t *ent )
/*
================
G_RunMissile
G_Missile_Run
================
*/
void G_RunMissile( gentity_t *ent ) {
void G_Missile_Run( gentity_t *ent ) {
vec3_t origin;
trace_t tr;

View file

@ -359,11 +359,11 @@ static void G_MoverTeam( gentity_t *ent ) {
/*
================
G_RunMover
G_Mover_Run
================
*/
void G_RunMover( gentity_t *ent ) {
void G_Mover_Run( gentity_t *ent ) {
// if not a team captain, don't do anything, because
// the captain will handle everything
if ( ent->flags & FL_TEAMSLAVE ) {
@ -703,7 +703,7 @@ void Reached_BinaryMover( gentity_t *ent ) {
}
if ( ent->wait < 0 )
ent->use = Use_BinaryMover;
ent->use = G_Mover_UseBinaryMover;
// close areaportals
if ( ent->teammaster == ent || !ent->teammaster ) {
@ -745,7 +745,7 @@ void Reached_BinaryMover( gentity_t *ent ) {
}
if(ent->wait < 0)
ent->use = Use_BinaryMover;
ent->use = G_Mover_UseBinaryMover;
// close areaportals
if ( ent->teammaster == ent || !ent->teammaster ) {
@ -777,10 +777,10 @@ void Reached_BinaryMover( gentity_t *ent ) {
/*
================
Use_BinaryMover
G_Mover_UseBinaryMover
================
*/
void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
void G_Mover_UseBinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
int total;
int partial;
@ -825,7 +825,7 @@ void Use_BinaryMover( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
// only the master should be used
if ( ent->flags & FL_TEAMSLAVE ) {
Use_BinaryMover( ent->teammaster, other, activator );
G_Mover_UseBinaryMover( ent->teammaster, other, activator );
return;
}
@ -1017,7 +1017,7 @@ void InitMover( gentity_t *ent ) {
}
ent->use = Use_BinaryMover;
ent->use = G_Mover_UseBinaryMover;
if(Q_stricmp(ent->classname, "func_mover"))
ent->reached = Reached_BinaryMover;
else
@ -1126,7 +1126,7 @@ void InitRotator( gentity_t *ent ) {
}
ent->use = Use_BinaryMover;
ent->use = G_Mover_UseBinaryMover;
ent->reached = Reached_BinaryMover;
ent->moverState = ROTATOR_POS1;
@ -1171,11 +1171,6 @@ Blocked_Door
void Blocked_Door( gentity_t *ent, gentity_t *other ) {
// remove anything other than a client
if ( !other->client ) {
// except CTF flags!!!!
if( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) {
Team_DroppedFlagThink( other );
return;
}
G_TempEntity( other->s.origin, EV_ITEM_POP );
G_FreeEntity( other );
return;
@ -1189,7 +1184,7 @@ void Blocked_Door( gentity_t *ent, gentity_t *other ) {
}
// reverse direction
Use_BinaryMover( ent, ent, other );
G_Mover_UseBinaryMover( ent, ent, other );
}
/*
@ -1224,10 +1219,10 @@ void DoorTriggerReactivate(gentity_t *ent);
/*
================
Touch_DoorTrigger
G_Mover_TouchDoorTrigger
================
*/
void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) {
void G_Mover_TouchDoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) {
#if 0
vec3_t vec, doorcenter, movedir;
float dot, dist ;
@ -1275,7 +1270,7 @@ void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) {
else if ( ent->parent->moverState != MOVER_1TO2 &&
ent->parent->moverState != ROTATOR_1TO2 )
{
Use_BinaryMover( ent->parent, ent, other );
G_Mover_UseBinaryMover( ent->parent, ent, other );
}
if(ent->parent->flags & FL_LOCKED) {
ent->touch = 0;
@ -1284,7 +1279,7 @@ void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ) {
}
void DoorTriggerReactivate(gentity_t *ent) {
ent->touch = Touch_DoorTrigger;
ent->touch = G_Mover_TouchDoorTrigger;
ent->nextthink = -1;
}
@ -1353,7 +1348,7 @@ void Think_SpawnNewDoorTrigger( gentity_t *ent ) {
VectorCopy (maxs, other->r.maxs);
other->parent = ent;
other->r.contents = CONTENTS_TRIGGER;
other->touch = Touch_DoorTrigger;
other->touch = G_Mover_TouchDoorTrigger;
// remember the thinnest axis
other->count = best;
//RPG-X | GSIO01 | 08/05/2009 | SOE = START OF EDIT ... lol
@ -1625,13 +1620,13 @@ void Touch_PlatCenterTrigger(gentity_t *ent, gentity_t *other, trace_t *trace )
#endif
if ( ent->parent->moverState == MOVER_POS1 ) {
Use_BinaryMover( ent->parent, ent, other );
G_Mover_UseBinaryMover( ent->parent, ent, other );
}
}
void func_plat_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
if (ent->parent->moverState == MOVER_POS1 ) {
Use_BinaryMover(ent->parent, other, activator);
G_Mover_UseBinaryMover(ent->parent, other, activator);
}
}
@ -1775,7 +1770,7 @@ void Touch_Button(gentity_t *ent, gentity_t *other, trace_t *trace ) {
#endif
if ( ent->moverState == MOVER_POS1 ) {
Use_BinaryMover( ent, other, other );
G_Mover_UseBinaryMover( ent, other, other );
}
}
@ -2451,7 +2446,7 @@ void SP_func_rotating (gentity_t *ent) {
ent->distance = 0;
}
//ent->use = func_rotating_use; //RPG-X | GSIO01 --- weren't you aware that InitMover sets the use func to Use_BinaryMover Phenix??
//ent->use = func_rotating_use; //RPG-X | GSIO01 --- weren't you aware that InitMover sets the use func to G_Mover_UseBinaryMover Phenix??
if (!ent->booleanstate)
{
@ -2968,7 +2963,7 @@ ADVANCED MOVER
*/
void Move_AdvancedMover(gentity_t *ent) {
Use_BinaryMover(ent, NULL, ent->activator);
G_Mover_UseBinaryMover(ent, NULL, ent->activator);
}
@ -3005,7 +3000,7 @@ void Reached_AdvancedMover(gentity_t *ent) {
if( touched->wait < 0) {
ent->nextthink = -1; // wait here until used again
ent->use = Use_BinaryMover;
ent->use = G_Mover_UseBinaryMover;
if(ent->damage) {
temp = G_Find(NULL, FOFS(targetname), touched->target);
if(!temp) {

View file

@ -159,7 +159,6 @@ void SP_target_speaker (gentity_t *ent);
void SP_target_print (gentity_t *ent);
void SP_target_laser (gentity_t *self);
void SP_target_character (gentity_t *ent);
void SP_target_score( gentity_t *ent );
void SP_target_teleporter( gentity_t *ent );
void SP_target_relay (gentity_t *ent);
void SP_target_kill (gentity_t *ent);
@ -205,12 +204,6 @@ void SP_shooter_plasma( gentity_t *ent );
void SP_shooter_grenade( gentity_t *ent );
void SP_shooter_torpedo( gentity_t *ent );
void SP_team_CTF_redplayer( gentity_t *ent );
void SP_team_CTF_blueplayer( gentity_t *ent );
void SP_team_CTF_redspawn( gentity_t *ent );
void SP_team_CTF_bluespawn( gentity_t *ent );
// extra Trek stuff
void SP_fx_spark ( gentity_t *ent );
void SP_fx_steam ( gentity_t *ent );
@ -353,7 +346,6 @@ spawn_t spawns[] = {
{"target_speaker", SP_target_speaker},
{"target_print", SP_target_print},
{"target_laser", SP_target_laser},
{"target_score", SP_target_score},
{"target_teleporter", SP_target_teleporter},
{"target_relay", SP_target_relay},
{"target_kill", SP_target_kill},
@ -396,11 +388,11 @@ spawn_t spawns[] = {
{"shooter_plasma", SP_shooter_plasma},
{"shooter_torpedo", SP_shooter_torpedo},
{"team_CTF_redplayer", SP_team_CTF_redplayer},
{"team_CTF_blueplayer", SP_team_CTF_blueplayer},
{"team_CTF_redplayer", SP_info_player_deathmatch},
{"team_CTF_blueplayer", SP_info_player_deathmatch},
{"team_CTF_redspawn", SP_team_CTF_redspawn},
{"team_CTF_bluespawn", SP_team_CTF_bluespawn},
{"team_CTF_redspawn", SP_info_player_deathmatch},
{"team_CTF_bluespawn", SP_info_player_deathmatch},
// extra Trek stuff
{"fx_spark", SP_fx_spark},

View file

@ -168,45 +168,6 @@ void SP_target_delay( gentity_t *ent ) {
trap_LinkEntity(ent);
}
//==========================================================
/*QUAKED target_score (1 0 0) (-8 -8 -8) (8 8 8) TEAMSCORE
-----DESCRIPTION-----
The Activator is given 'count' points.
This is useless in RPG-X
-----SPAWNFLAGS-----
1: TEAMSCORE - points are added to activator's team's score, not the individual
-----KEYS-----
"count" - number of points to add, default 1
*/
void Team_AddScore( int team, int points );
void Use_Target_Score (gentity_t *ent, gentity_t *other, gentity_t *activator) {
if(!activator) return;
if ( ent->spawnflags & 1 )
{
if ( activator->client )
{
Team_AddScore( activator->client->sess.sessionTeam, ent->count );
}
}
else
{
AddScore( activator, ent->count );
}
CalculateRanks( qfalse );
}
void SP_target_score( gentity_t *ent ) {
if ( !ent->count ) {
ent->count = 1;
}
ent->use = Use_Target_Score;
}
//==========================================================
/*QUAKED target_print (1 0 0) (-8 -8 -8) (8 8 8) redteam blueteam private

View file

@ -3,947 +3,28 @@
#include "g_local.h"
team_t initialBorgTeam = TEAM_FREE;
int borgQueenStartPoint = ENTITYNUM_NONE;
typedef enum _flag_status {
FLAG_ATBASE = 0,
FLAG_TAKEN,
FLAG_DROPPED
} flagStatus_t;
typedef struct teamgame_s
{
float last_flag_capture;
int last_capture_team;
flagStatus_t redStatus;
flagStatus_t blueStatus;
} teamgame_t;
teamgame_t teamgame;
void Team_SetFlagStatus( int team, flagStatus_t status );
void Team_InitGame(void)
{
memset(&teamgame, 0, sizeof teamgame);
teamgame.redStatus = teamgame.blueStatus = -1; // Invalid to force update
Team_SetFlagStatus( TEAM_RED, FLAG_ATBASE );
Team_SetFlagStatus( TEAM_BLUE, FLAG_ATBASE );
// set config strings for what the two teams are for use in the cgame that renders the CTF flags
trap_SetConfigstring( CS_RED_GROUP, g_team_group_red.string);
trap_SetConfigstring( CS_BLUE_GROUP, g_team_group_blue.string);
}
int OtherTeam(int team) {
if (team==TEAM_RED)
return TEAM_BLUE;
else if (team==TEAM_BLUE)
return TEAM_RED;
return team;
}
const char *TeamName(int team) {
if (team==TEAM_RED)
return "RED";
else if (team==TEAM_BLUE)
return "BLUE";
else if (team==TEAM_SPECTATOR)
if (team==TEAM_SPECTATOR)
return "SPECTATOR";
return "FREE";
}
const char *OtherTeamName(int team) {
if (team==TEAM_RED)
return "BLUE";
else if (team==TEAM_BLUE)
return "RED";
else if (team==TEAM_SPECTATOR)
if (team==TEAM_SPECTATOR)
return "SPECTATOR";
return "FREE";
}
const char *TeamColorString(int team) {
if (team==TEAM_RED)
return S_COLOR_RED;
else if (team==TEAM_BLUE)
return S_COLOR_BLUE;
else if (team==TEAM_SPECTATOR)
if (team==TEAM_SPECTATOR)
return S_COLOR_YELLOW;
return S_COLOR_WHITE;
}
// NULL for everyone
void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) {
char msg[1024];
va_list argptr;
char *p;
va_start (argptr,fmt);
if (vsprintf (msg, fmt, argptr) > sizeof(msg)) {
G_Error ( "%s", "PrintMsg overrun" );
}
va_end (argptr);
// double quotes are bad
while ((p = strchr(msg, '"')) != NULL)
*p = '\'';
trap_SendServerCommand ( ( (ent == NULL) ? -1 : ent-g_entities ), va("print \"%s\"", msg ));
}
/*
==============
OnSameTeam
==============
*/
qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 ) {
if (( g_gametype.integer == GT_FFA ) || (g_gametype.integer == GT_TOURNAMENT) || (g_gametype.integer == GT_SINGLE_PLAYER))
{
return qfalse;
}
if ( !ent1->client || !ent2->client ) {
if ( !ent1->client && !ent2->client )
{
if ( ent1->team && ent2->team && atoi( ent1->team ) == atoi( ent2->team ) )
{
return qtrue;
}
}
else if ( !ent1->client )
{
if ( ent1->team && atoi( ent1->team ) == ent2->client->sess.sessionTeam )
{
return qtrue;
}
}
else// if ( !ent2->client )
{
if ( ent2->team && ent1->client->sess.sessionTeam == atoi( ent2->team ) )
{
return qtrue;
}
}
return qfalse;
}
if ( ent1->client->sess.sessionTeam == ent2->client->sess.sessionTeam ) {
return qtrue;
}
return qfalse;
}
void Team_SetFlagStatus( int team, flagStatus_t status )
{
qboolean modified = qfalse;
switch (team) {
case TEAM_RED :
if ( teamgame.redStatus != status ) {
teamgame.redStatus = status;
modified = qtrue;
}
break;
case TEAM_BLUE :
if ( teamgame.blueStatus != status ) {
teamgame.blueStatus = status;
modified = qtrue;
}
break;
}
if (modified) {
char st[4];
st[0] = '0' + (int)teamgame.redStatus;
st[1] = '0' + (int)teamgame.blueStatus;
st[2] = 0;
trap_SetConfigstring( CS_FLAGSTATUS, st );
}
}
void Team_CheckDroppedItem( gentity_t *dropped )
{
/*if (dropped->item->giTag == PW_REDFLAG)
Team_SetFlagStatus( TEAM_RED, FLAG_DROPPED );
else if (dropped->item->giTag == PW_BORG_ADAPT)
Team_SetFlagStatus( TEAM_BLUE, FLAG_DROPPED );*/
}
/*
================
Team_FragBonuses
Calculate the bonuses for flag defense, flag carrier defense, etc.
Note that bonuses are not cumlative. You get one, they are in importance
order.
================
*/
void Team_FragBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker)
{
//int i;
//gentity_t *ent;
//int flag_pw, enemy_flag_pw;
int otherteam;
gentity_t *flag, *carrier = NULL;
char *c;
vec3_t v1, v2;
int team;
// no bonus for fragging yourself
if (!targ->client || attacker == NULL || !attacker->client || targ == attacker)
return;
team = targ->client->sess.sessionTeam;
otherteam = OtherTeam(targ->client->sess.sessionTeam);
if (otherteam < 0)
return; // whoever died isn't on a team
// same team, if the flag at base, check to he has the enemy flag
/*if (team == TEAM_RED) {
flag_pw = PW_REDFLAG;
enemy_flag_pw = PW_REDFLAG;
} else {
flag_pw = PW_REDFLAG;
enemy_flag_pw = PW_REDFLAG;
}*/
// did the attacker frag the flag carrier?
/*if (targ->client->ps.powerups[enemy_flag_pw]) {
attacker->client->pers.teamState.lastfraggedcarrier = level.time;
AddScore(attacker, CTF_FRAG_CARRIER_BONUS);
attacker->client->pers.teamState.fragcarrier++;
PrintMsg(NULL, "%s" S_COLOR_WHITE " eliminated %s's flag carrier!\n",
attacker->client->pers.netname, TeamName(team));
// the target had the flag, clear the hurt carrier
// field on the other team
for (i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if (ent->inuse && ent->client->sess.sessionTeam == otherteam)
ent->client->pers.teamState.lasthurtcarrier = 0;
}
return;
}*/
if (targ->client->pers.teamState.lasthurtcarrier &&
level.time - targ->client->pers.teamState.lasthurtcarrier < CTF_CARRIER_DANGER_PROTECT_TIMEOUT /*&&
!attacker->client->ps.powerups[flag_pw]*/) {
// attacker is on the same team as the flag carrier and
// fragged a guy who hurt our flag carrier
AddScore(attacker, CTF_CARRIER_DANGER_PROTECT_BONUS);
attacker->client->pers.teamState.carrierdefense++;
targ->client->pers.teamState.lasthurtcarrier = 0;
team = attacker->client->sess.sessionTeam;
PrintMsg(NULL, "%s" S_COLOR_WHITE " defends %s's flag carrier against an aggressive enemy\n",
attacker->client->pers.netname, TeamName(team));
return;
}
// flag and flag carrier area defense bonuses
// we have to find the flag and carrier entities
// find the flag
switch (attacker->client->sess.sessionTeam) {
case TEAM_RED:
c = "team_CTF_redflag";
break;
case TEAM_BLUE:
c = "team_CTF_blueflag";
break;
default:
return;
}
flag = NULL;
while ((flag = G_Find (flag, FOFS(classname), c)) != NULL) {
if (!(flag->flags & FL_DROPPED_ITEM))
break;
}
if (!flag)
return; // can't find attacker's flag
// find attacker's team's flag carrier
/*for (i = 0; i < g_maxclients.integer; i++) {
carrier = g_entities + i;
if (carrier->inuse && carrier->client->ps.powerups[flag_pw])
break;
carrier = NULL;
}*/
// ok we have the attackers flag and a pointer to the carrier
// check to see if we are defending the base's flag
VectorSubtract(targ->r.currentOrigin, flag->r.currentOrigin, v1);
VectorSubtract(attacker->r.currentOrigin, flag->r.currentOrigin, v2);
if ( ( ( VectorLength(v1) < CTF_TARGET_PROTECT_RADIUS &&
trap_InPVS(flag->r.currentOrigin, targ->r.currentOrigin ) ) ||
( VectorLength(v2) < CTF_TARGET_PROTECT_RADIUS &&
trap_InPVS(flag->r.currentOrigin, attacker->r.currentOrigin ) ) ) &&
attacker->client->sess.sessionTeam != targ->client->sess.sessionTeam) {
// we defended the base flag
AddScore(attacker, CTF_FLAG_DEFENSE_BONUS);
attacker->client->pers.teamState.basedefense++;
if (flag->r.svFlags & SVF_NOCLIENT) {
PrintMsg(NULL, "%s" S_COLOR_WHITE " defends the %s base.\n",
attacker->client->pers.netname,
TeamName(attacker->client->sess.sessionTeam));
} else {
PrintMsg(NULL, "%s" S_COLOR_WHITE " defends the %s flag.\n",
attacker->client->pers.netname,
TeamName(attacker->client->sess.sessionTeam));
}
return;
}
if (carrier && carrier != attacker) {
VectorSubtract(targ->r.currentOrigin, carrier->r.currentOrigin, v1);
VectorSubtract(attacker->r.currentOrigin, carrier->r.currentOrigin, v1);
if ( ( ( VectorLength(v1) < CTF_ATTACKER_PROTECT_RADIUS &&
trap_InPVS(carrier->r.currentOrigin, targ->r.currentOrigin ) ) ||
( VectorLength(v2) < CTF_ATTACKER_PROTECT_RADIUS &&
trap_InPVS(carrier->r.currentOrigin, attacker->r.currentOrigin ) ) ) &&
attacker->client->sess.sessionTeam != targ->client->sess.sessionTeam) {
AddScore(attacker, CTF_CARRIER_PROTECT_BONUS);
attacker->client->pers.teamState.carrierdefense++;
PrintMsg(NULL, "%s" S_COLOR_WHITE " defends the %s's flag carrier.\n",
attacker->client->pers.netname,
TeamName(attacker->client->sess.sessionTeam));
return;
}
}
}
/*
================
Team_CheckHurtCarrier
Check to see if attacker hurt the flag carrier. Needed when handing out bonuses for assistance to flag
carrier defense.
================
*/
void Team_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker)
{
//int flag_pw;
if (!targ->client || !attacker->client)
return;
/*if (targ->client->sess.sessionTeam == TEAM_RED)
flag_pw = PW_REDFLAG;
else
flag_pw = PW_REDFLAG;*/
/*if (targ->client->ps.powerups[flag_pw] &&
targ->client->sess.sessionTeam != attacker->client->sess.sessionTeam)
attacker->client->pers.teamState.lasthurtcarrier = level.time;*/
}
gentity_t *Team_ResetFlag(int team)
{
char *c;
gentity_t *ent, *rent = NULL;
switch (team) {
case TEAM_RED:
c = "team_CTF_redflag";
break;
case TEAM_BLUE:
c = "team_CTF_blueflag";
break;
default:
return NULL;
}
ent = NULL;
while ((ent = G_Find (ent, FOFS(classname), c)) != NULL) {
if (ent->flags & FL_DROPPED_ITEM)
G_FreeEntity(ent);
else {
rent = ent;
RespawnItem(ent);
}
}
Team_SetFlagStatus( team, FLAG_ATBASE );
return rent;
}
void Team_ResetFlags(void)
{
Team_ResetFlag(TEAM_RED);
Team_ResetFlag(TEAM_BLUE);
}
void Team_ReturnFlagSound(gentity_t *ent, int team)
{
// play powerup spawn sound to all clients
gentity_t *te;
if (ent == NULL) {
G_Printf ("Warning: NULL passed to Team_ReturnFlagSound\n");
return;
}
te = G_TempEntity( ent->s.pos.trBase, EV_TEAM_SOUND );
te->s.eventParm = RETURN_FLAG_SOUND;
te->s.otherEntityNum = team;
te->r.svFlags |= SVF_BROADCAST;
}
void Team_ReturnFlag(int team)
{
Team_ReturnFlagSound(Team_ResetFlag(team), team);
PrintMsg(NULL, "The %s flag has returned!\n", TeamName(team));
}
void Team_FreeEntity(gentity_t *ent)
{
/*if (ent->item->giTag == PW_REDFLAG)
Team_ReturnFlag(TEAM_RED);
else if (ent->item->giTag == PW_BORG_ADAPT)
Team_ReturnFlag(TEAM_BLUE);*/
}
/*
==============
Team_DroppedFlagThink
Automatically set in Launch_Item if the item is one of the flags
Flags are unique in that if they are dropped, the base flag must be respawned when they time out
==============
*/
void Team_DroppedFlagThink(gentity_t *ent)
{
/*if (ent->item->giTag == PW_REDFLAG)
Team_ReturnFlagSound(Team_ResetFlag(TEAM_RED), TEAM_RED);
else if (ent->item->giTag == PW_BORG_ADAPT)
Team_ReturnFlagSound(Team_ResetFlag(TEAM_BLUE), TEAM_BLUE);*/
// Reset Flag will delete this entity
}
void Team_AddScore( int team, int points )
{
teamgame.last_flag_capture = level.time;
teamgame.last_capture_team = team;
// Increase the team's score
level.teamScores[team] += points;
}
/* TODO: unused! remove me? */
int Team_TouchOurFlag( gentity_t *ent, gentity_t *other, int team ) {
return 0;
}
int Team_TouchEnemyFlag( gentity_t *ent, gentity_t *other, int team ) {
gclient_t *cl = other->client;
// hey, its not our flag, pick it up
PrintMsg (NULL, "%s" S_COLOR_WHITE " got the %s flag!\n",
other->client->pers.netname, TeamName(team));
AddScore(other, CTF_FLAG_BONUS);
//if (team == TEAM_RED)
//cl->ps.powerups[PW_REDFLAG] = INT_MAX; // flags never expire
//else
//cl->ps.powerups[PW_BORG_ADAPT] = INT_MAX; // flags never expire
cl->pers.teamState.flagsince = level.time;
Team_SetFlagStatus( team, FLAG_TAKEN );
return -1; // Do not respawn this automatically, but do delete it if it was FL_DROPPED
}
int Pickup_Team( gentity_t *ent, gentity_t *other ) {
int team;
gclient_t *cl = other->client;
// figure out what team this flag is
if (strcmp(ent->classname, "team_CTF_redflag") == 0)
team = TEAM_RED;
else if (strcmp(ent->classname, "team_CTF_blueflag") == 0)
team = TEAM_BLUE;
else {
PrintMsg ( other, "Don't know what team the flag is on.\n");
return 0;
}
return ((team == cl->sess.sessionTeam) ?
Team_TouchOurFlag : Team_TouchEnemyFlag)
(ent, other, team);
}
/*
===========
Team_GetLocation
Report a location for the player. Uses placed nearby target_location entities
============
*/
gentity_t *Team_GetLocation(gentity_t *ent)
{
gentity_t *eloc, *best;
float bestlen, len;
vec3_t origin;
best = NULL;
bestlen = 3*8192.0*8192.0;
VectorCopy( ent->r.currentOrigin, origin );
for (eloc = level.locationHead; eloc; eloc = eloc->nextTrain) {
len = ( origin[0] - eloc->r.currentOrigin[0] ) * ( origin[0] - eloc->r.currentOrigin[0] )
+ ( origin[1] - eloc->r.currentOrigin[1] ) * ( origin[1] - eloc->r.currentOrigin[1] )
+ ( origin[2] - eloc->r.currentOrigin[2] ) * ( origin[2] - eloc->r.currentOrigin[2] );
if ( len > bestlen ) {
continue;
}
if ( !trap_InPVS( origin, eloc->r.currentOrigin ) ) {
continue;
}
bestlen = len;
best = eloc;
}
return best;
}
/*
===========
Team_GetLocation
Report a location for the player. Uses placed nearby target_location entities
============
*/
qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen)
{
gentity_t *best;
best = Team_GetLocation( ent );
if (!best)
return qfalse;
if (best->count) {
if (best->count < 0)
best->count = 0;
if (best->count > 7)
best->count = 7;
Com_sprintf(loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE, best->count + '0', best->message );
} else
Com_sprintf(loc, loclen, "%s", best->message);
return qtrue;
}
/*---------------------------------------------------------------------------*/
/*
================
SelectRandomDeathmatchSpawnPoint
go to a random point that doesn't telefrag
================
*/
#define MAX_TEAM_SPAWN_POINTS 32
gentity_t *SelectRandomTeamSpawnPoint( gentity_t *ent, int teamstate, team_t team ) {
gentity_t *spot;
int count;
int selection;
gentity_t *spots[MAX_TEAM_SPAWN_POINTS];
char *classname;
if (teamstate == TEAM_BEGIN) {
if (team == TEAM_RED)
classname = "team_CTF_redplayer";
else if (team == TEAM_BLUE)
classname = "team_CTF_blueplayer";
else
return NULL;
} else {
if (team == TEAM_RED)
classname = "team_CTF_redspawn";
else if (team == TEAM_BLUE)
classname = "team_CTF_bluespawn";
else
return NULL;
}
count = 0;
spot = NULL;
while ((spot = G_Find (spot, FOFS(classname), classname)) != NULL) {
if ( teamstate != TEAM_BEGIN) {
if ( spot->spawnflags & 1 ) {
//not an active spawn point
continue;
}
}
if ( SpotWouldTelefrag( spot ) ) {
continue;
}
spots[ count ] = spot;
if (++count == MAX_TEAM_SPAWN_POINTS)
break;
}
if ( !count ) { // no spots that won't telefrag
return G_Find( NULL, FOFS(classname), classname);
}
selection = rand() % count;
return spots[ selection ];
}
/*
===========
SelectCTFSpawnPoint
============
*/
gentity_t *SelectCTFSpawnPoint ( gentity_t *ent, team_t team, int teamstate, vec3_t origin, vec3_t angles ) {
gentity_t *spot;
spot = SelectRandomTeamSpawnPoint ( ent, teamstate, team );
if (!spot) {
return SelectSpawnPoint( vec3_origin, origin, angles );
}
VectorCopy (spot->s.origin, origin);
origin[2] += 9;
VectorCopy (spot->s.angles, angles);
return spot;
}
/*---------------------------------------------------------------------------*/
/*static int QDECL SortClients( const void *a, const void *b ) {
return *(int *)a - *(int *)b;
}*/
/*
==================
CheckHealthInfoMessage
Sends Health Changes to proper clients
Format:
clientNum health
==================
*/
void CheckHealthInfoMessage( void )
{
char entry[1024];
char string[1400];
int stringlength;
int i, j, t;
gentity_t *player, *ent;
int sendToCnt, cnt, sentCnt;
int h;
int clients[MAX_CLIENTS];
int sendToClients[MAX_CLIENTS];
//only send this to medics or spectators or adminz
for (i = 0, sendToCnt = 0; i < g_maxclients.integer; i++)
{
if ( level.clients[i].pers.connected == CON_CONNECTED && level.clients[i].ps.stats[STAT_HEALTH] > 0 &&//make sure they've actually spawned in already
(level.clients[i].sess.sessionTeam == TEAM_SPECTATOR || g_classData[level.clients[i].sess.sessionClass].isMedical || g_classData[level.clients[i].sess.sessionClass].isAdmin ) )
{
sendToClients[sendToCnt++] = i;
}
}
if ( !sendToCnt )
{//no-one to send to
return;
}
//only send those clients whose health has changed this cycle
//NB: there's a prob with client 0 in here....
for (i = 0, cnt = 0; i < g_maxclients.integer; i++)
{
player = g_entities + i;
if ( player->inuse && player->old_health != player->health && ( player->health > 0 || player->old_health > 0 ))
{
clients[cnt++] = i;
player->old_health = player->health;
}
}
if ( !cnt )
{//no-one relevant changed health
return;
}
for ( t = 0; t < sendToCnt; t++ )
{
ent = g_entities + sendToClients[t];
sentCnt = 0;
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0; i < cnt; i++)
{
player = g_entities + clients[i];
//RPG-X | Phenix | 05/03/2005
/*if ( ent->client->sess.sessionTeam == player->client->sess.sessionTeam && ent->client->pers.teamInfo )
{//already sent this player's health to this client because teaminfo is on
continue;
}*/
if ( ent == player )
{//don't send the ent his own health
continue;
}
//send this one
sentCnt++;
h = player->health;
if (h < 0) h = 0;
Com_sprintf (entry, sizeof(entry), " %i %i", clients[i], h);
j = strlen(entry);
if (stringlength + j > sizeof(string))
break;
strcpy (string + stringlength, entry);
stringlength += j;
}
if ( sentCnt )
{
trap_SendServerCommand( sendToClients[t], va("hinfo %i%s", sentCnt, string) );
//trap_SendServerCommand( -1, va( "print \"^1hinfo %i%s\n\"", sentCnt, string ));
}
}
}
/*
==================
TeamplayLocationsMessage
Format:
clientNum location health armor weapon powerups
==================
*/
void TeamplayInfoMessage( gentity_t *ent ) {
char entry[1024];
char string[1400];
int stringlength;
int i, j;
gentity_t *player;
int cnt;
//int h, a;
//TiM : Send data regardless
/*if ( ! ent->client->pers.teamInfo )
return;*/
//don't bother sending during intermission?
if ( level.intermissiontime )
return;
// figure out what client should be on the display
// we are limited to 8, but we want to use the top eight players
// but in client order (so they don't keep changing position on the overlay)
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + level.sortedClients[i];
if (player->inuse && player->client->sess.sessionTeam ==
ent->client->sess.sessionTeam ) {
}
}
// We have the top eight players, sort them by clientNum
//TiM
//qsort( clients, cnt, sizeof( clients[0] ), SortClients );
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + i;
//RPG-X | Phenix | 05/03/2005
if (player->inuse /*&& player->client->sess.sessionTeam ==
ent->client->sess.sessionTeam*/ ) {
/*h = player->client->ps.stats[STAT_HEALTH];
a = player->client->ps.stats[STAT_ARMOR];
if (h < 0) h = 0;
if (a < 0) a = 0;*/
//to counter for the fact we could pwn the server doing this, remove all superfluous data
Com_sprintf (entry, sizeof(entry),
" %i %i ", //%i %i %i %i
// level.sortedClients[i], player->client->pers.teamState.location, h, a,
i, player->client->pers.teamState.location/*, h, a,
player->client->ps.weapon, player->s.powerups*/);
j = strlen(entry);
if (stringlength + j > sizeof(string))
break;
strcpy (string + stringlength, entry);
stringlength += j;
cnt++;
}
}
trap_SendServerCommand( ent-g_entities, va("tinfo %i%s", cnt, string) );
}
//TiM - Modified to work with RPG-X
void CheckTeamStatus(void)
{
int i;
gentity_t *loc, *ent;
if (level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME) {
level.lastTeamLocationTime = level.time;
for (i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if (ent->inuse /*&&
(ent->client->sess.sessionTeam == TEAM_RED ||
ent->client->sess.sessionTeam == TEAM_BLUE)*/ ) {
loc = Team_GetLocation( ent );
if (loc)
ent->client->pers.teamState.location = loc->health;
else
ent->client->pers.teamState.location = 0;
}
}
for (i = 0; i < g_maxclients.integer; i++) {
ent = g_entities + i;
if (ent->inuse /*&&
(ent->client->sess.sessionTeam == TEAM_RED ||
ent->client->sess.sessionTeam == TEAM_BLUE)*/) {
TeamplayInfoMessage( ent );
}
}
CheckHealthInfoMessage();
}
}
/*-----------------------------------------------------------------*/
/*QUAKED team_CTF_redplayer (1 0 0) (-16 -16 -16) (16 16 32) BORGQUEEN
-----DESCRIPTION-----
Only in CTF games. Red players spawn here at game start.
This is not used in RPG-X.
-----SPAWNFLAGS-----
1: BORGQUEEN - The player that is the Borg Queen will spawn here
-----KEYS-----
none
*/
void SP_team_CTF_redplayer( gentity_t *ent ) {
if ( ent->spawnflags & 1 )
{
initialBorgTeam = TEAM_RED;
borgQueenStartPoint = ent->s.number;
}
}
/*QUAKED team_CTF_blueplayer (0 0 1) (-16 -16 -16) (16 16 32) BORGQUEEN
-----DESCRIPTION-----
Only in CTF games. Blue players spawn here at game start.
This is not used in RPG-X.
-----SPAWNFLAGS-----
1: BORGQUEEN - The player that is the Borg Queen will spawn here
-----KEYS-----
none
*/
void SP_team_CTF_blueplayer( gentity_t *ent ) {
if ( ent->spawnflags & 1 )
{
initialBorgTeam = TEAM_BLUE;
borgQueenStartPoint = ent->s.number;
}
}
void spawnpoint_toggle_active( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
ent->spawnflags ^= 1;
}
/*QUAKED team_CTF_redspawn (1 0 0) (-16 -16 -24) (16 16 32) STARTOFF
-----DESCRIPTION-----
potential spawning position for red team in CTF games, AFTER game start
Targets will be fired when someone spawns in on them.
This is not used in RPG-X.
-----SPAWNFLAGS-----
STARTOFF - won't be considered as a spawn point until used
-----KEYS-----
targetname - when used, toggles between active and incative spawn point
*/
void SP_team_CTF_redspawn(gentity_t *ent) {
if ( ent->targetname )
{
ent->use = spawnpoint_toggle_active;
}
}
/*QUAKED team_CTF_bluespawn (0 0 1) (-16 -16 -24) (16 16 32) STARTOFF
-----DESCRIPTION-----
potential spawning position for blue team in CTF games, AFTER game start
Targets will be fired when someone spawns in on them.
-----SPAWNFLAGS-----
STARTOFF - won't be considered as a spawn point until used
-----KEYS-----
targetname - when used, toggles between active and incative spawn point
*/
void SP_team_CTF_bluespawn(gentity_t *ent) {
if ( ent->targetname )
{
ent->use = spawnpoint_toggle_active;
}
}

View file

@ -1,47 +1,8 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#define CTF_CAPTURE_BONUS 100 // what you get for capture
#define CTF_TEAM_BONUS 0 // what your team gets for capture
#define CTF_RECOVERY_BONUS 10 // what you get for recovery
#define CTF_FLAG_BONUS 10 // what you get for picking up enemy flag
#define CTF_FRAG_CARRIER_BONUS 20 // what you get for fragging enemy flag carrier
#define CTF_FLAG_RETURN_TIME 40000 // seconds until auto return
#define CTF_CARRIER_DANGER_PROTECT_BONUS 5 // bonus for fraggin someone who has recently hurt your flag carrier
#define CTF_CARRIER_PROTECT_BONUS 2 // bonus for fraggin someone while either you or your target are near your flag carrier
#define CTF_FLAG_DEFENSE_BONUS 10 // bonus for fraggin someone while either you or your target are near your flag
#define CTF_RETURN_FLAG_ASSIST_BONUS 10 // awarded for returning a flag that causes a capture to happen almost immediately
#define CTF_FRAG_CARRIER_ASSIST_BONUS 10 // award for fragging a flag carrier if a capture happens almost immediately
#define CTF_TARGET_PROTECT_RADIUS 1000 // the radius around an object being defended where a target will be worth extra frags
#define CTF_ATTACKER_PROTECT_RADIUS 1000 // the radius around an object being defended where an attacker will get extra frags when making kills
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8000
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10000
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10000
#define CTF_GRAPPLE_SPEED 750 // speed of grapple in flight
#define CTF_GRAPPLE_PULL_SPEED 750 // speed player is pulled at
// Prototypes
int OtherTeam(int team);
const char *TeamName(int team);
const char *OtherTeamName(int team);
const char *TeamColorString(int team);
//void AddTeamScore(vec3_t origin, int team, int score);
void Team_DroppedFlagThink(gentity_t *ent);
void Team_FragBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker);
void Team_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker);
void Team_InitGame(void);
void Team_ReturnFlag(int team);
void Team_FreeEntity(gentity_t *ent);
gentity_t *SelectCTFSpawnPoint ( gentity_t *ent, team_t team, int teamstate, vec3_t origin, vec3_t angles );
gentity_t *Team_GetLocation(gentity_t *ent);
qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen);
void TeamplayInfoMessage( gentity_t *ent );
void CheckTeamStatus(void);
int Pickup_Team( gentity_t *ent, gentity_t *other );

View file

@ -70,7 +70,7 @@ into a wall.
@param v vector to round
@param to rounded vector
*/
void SnapVectorTowards( vec3_t v, vec3_t to ) {
void G_Weapon_SnapVectorTowards( vec3_t v, vec3_t to ) {
int i;
for ( i = 0 ; i < 3 ; i++ ) {
@ -1110,7 +1110,7 @@ static qboolean SearchTarget(gentity_t *ent, vec3_t start, vec3_t end)
trap_Trace (&tr, start, NULL, NULL, end, ent->s.number, MASK_SHOT );
traceEnt = &g_entities[ tr.entityNum ];
if (traceEnt->takedamage && traceEnt->client && !OnSameTeam(traceEnt, &g_entities[ent->r.ownerNum]))
if (traceEnt->takedamage && traceEnt->client)
{
ent->target_ent = traceEnt;
VectorSubtract(ent->target_ent->r.currentOrigin, ent->r.currentOrigin, fwd);
@ -1318,7 +1318,7 @@ static void WP_FireQuantumBurst( gentity_t *ent, qboolean alt_fire )
* @param target the target entity
* @param attacker the attacker entity
*/
qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ) {
qboolean G_Weapon_LogAccuracyHit( gentity_t *target, gentity_t *attacker ) {
if( !target->takedamage ) {
return qfalse;
}
@ -1339,10 +1339,6 @@ qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ) {
return qfalse;
}
if ( OnSameTeam( target, attacker ) ) {
return qfalse;
}
return qtrue;
}
@ -1398,7 +1394,7 @@ static void CorrectForwardVector(gentity_t *ent, vec3_t fwd, vec3_t muzzlePoint,
/*
===============
CalcMuzzlePoint
G_Weapon_CalcMuzzlePoint
set muzzle location relative to pivoting eye
===============
@ -1497,7 +1493,7 @@ static float WP_ShotAltSize[WP_NUM_WEAPONS] =
* @param muzzlePoint the muzzle point
* @param projsize projsize
*/
void CalcMuzzlePoint ( gentity_t *ent, vec3_t fwd, vec3_t rt, vec3_t vup, vec3_t muzzlePoint, float projsize)
void G_Weapon_CalcMuzzlePoint ( gentity_t *ent, vec3_t fwd, vec3_t rt, vec3_t vup, vec3_t muzzlePoint, float projsize)
{
int weapontype;
@ -1670,9 +1666,10 @@ static void WP_SprayVoyagerHypo( gentity_t *ent, qboolean alt_fire )
tr_ent = &g_entities[tr.entityNum];
/* RPG-X: RedTechie - Medics can revive dead people */
if( (tr_ent && tr_ent->client) && (tr_ent->health == 1) && (tr_ent->client->ps.pm_type == PM_DEAD)){ tr_entPs = &tr_ent->client->ps;
if( (tr_ent && tr_ent->client) && (tr_ent->health == 1) && (tr_ent->client->ps.pm_type == PM_DEAD)){
tr_entPs = &tr_ent->client->ps;
if(rpg_medicsrevive.integer == 1){
ClientSpawn(tr_ent, 1, qtrue);
G_Client_Spawn(tr_ent, 1, qtrue);
/* TiM : Hard coded emote. Makes the player play a 'get up' animation :) */
/* G_MoveBox( tr_ent ); */
@ -1691,30 +1688,16 @@ static void WP_SprayVoyagerHypo( gentity_t *ent, qboolean alt_fire )
/*tr_entPs->stats[STAT_HOLDABLE_ITEM] = HI_NONE;*/
}
/* RPG-X: RedTechie - Regular functions still work */
}else if ( tr_ent && tr_ent->client && tr_ent->health > 0 )
{
} else if ( tr_ent && tr_ent->client && tr_ent->health > 0 ) {
tr_entPs = &tr_ent->client->ps;
if ( rpg_rpg.integer > 0 && g_gametype.integer < GT_TEAM )
{
if(alt_fire && rpg_hypoMelee.integer) { /* alt fire and hypo melee enabled */
tr_ent->health = 0;
G_Client_Die( tr_ent, ent, ent, 100, MOD_KNOCKOUT );
G_LogWeaponFire( ent->s.number, WP_12 );
} else { /* else just heal */
if ( tr_ent->health < tr_entPs->stats[STAT_MAX_HEALTH] )
{
tr_ent->health = tr_entPs->stats[STAT_MAX_HEALTH]; /*+20*/
}
}
else
{
if ( !OnSameTeam(tr_ent, ent) || g_gametype.integer < GT_TEAM )
{
tr_ent->health = 0;
player_die( tr_ent, ent, ent, 100, MOD_KNOCKOUT );
G_LogWeaponFire( ent->s.number, WP_12 );
}
else if ( OnSameTeam(tr_ent, ent) )
{
if ( tr_ent->health < tr_entPs->stats[STAT_MAX_HEALTH] )
{
tr_ent->health = tr_ent->health + 20;
}
tr_ent->health = tr_entPs->stats[STAT_MAX_HEALTH];
}
}
}
@ -1759,7 +1742,7 @@ void FireWeapon( gentity_t *ent, qboolean alt_fire )
{
projsize = WP_ShotSize[ent->s.weapon];
}
CalcMuzzlePoint ( ent, forward, right, up, muzzle, projsize);
G_Weapon_CalcMuzzlePoint ( ent, forward, right, up, muzzle, projsize);
/* fire the specific weapon */
switch( ent->s.weapon )