Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

g_arenas.c File Reference

#include "g_local.h"

Include dependency graph for g_arenas.c:

Include dependency graph

Go to the source code of this file.

Defines

#define TIMER_GESTURE   (34*66+50)

Functions

void CelebrateStart (gentity_t *player)
void CelebrateStop (gentity_t *player)
void PodiumPlacementThink (gentity_t *podium)
gentity_tSpawnModelOnVictoryPad (gentity_t *pad, vec3_t offset, gentity_t *ent, int place)
void SpawnModelsOnVictoryPads (void)
gentity_tSpawnPodium (void)
void Svcmd_AbortPodium_f (void)
void UpdateTournamentInfo (void)

Variables

vec3_t offsetFirst = {0, 0, 74}
vec3_t offsetSecond = {-10, 60, 54}
vec3_t offsetThird = {-19, -60, 45}
gentity_tpodium1
gentity_tpodium2
gentity_tpodium3


Define Documentation

#define TIMER_GESTURE   (34*66+50)
 

Definition at line 216 of file g_arenas.c.


Function Documentation

void CelebrateStart gentity_t player  )  [static]
 

Definition at line 217 of file g_arenas.c.

References EV_TAUNT, G_AddEvent(), gentity_t, level, gentity_s::nextthink, gentity_s::s, gentity_s::think, level_locals_t::time, and entityState_s::torsoAnim.

00217                                                 {
00218     player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | TORSO_GESTURE;
00219     player->nextthink = level.time + TIMER_GESTURE;
00220     player->think = CelebrateStop;
00221 
00222     /*
00223     player->client->ps.events[player->client->ps.eventSequence & (MAX_PS_EVENTS-1)] = EV_TAUNT;
00224     player->client->ps.eventParms[player->client->ps.eventSequence & (MAX_PS_EVENTS-1)] = 0;
00225     player->client->ps.eventSequence++;
00226     */
00227     G_AddEvent(player, EV_TAUNT, 0);
00228 }

Here is the call graph for this function:

void CelebrateStop gentity_t player  )  [static]
 

Definition at line 203 of file g_arenas.c.

References gentity_t, gentity_s::s, entityState_s::torsoAnim, and entityState_s::weapon.

00203                                                {
00204     int     anim;
00205 
00206     if( player->s.weapon == WP_GAUNTLET) {
00207         anim = TORSO_STAND2;
00208     }
00209     else {
00210         anim = TORSO_STAND;
00211     }
00212     player->s.torsoAnim = ( ( player->s.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
00213 }

void PodiumPlacementThink gentity_t podium  )  [static]
 

Definition at line 235 of file g_arenas.c.

References AngleVectors(), entityState_s::apos, entityShared_t::currentOrigin, f, G_SetOrigin(), gentity_t, level_locals_t::intermission_angle, level_locals_t::intermission_origin, level, gentity_s::nextthink, NULL, offsetFirst, offsetSecond, offsetThird, podium1, podium2, podium3, r, gentity_s::r, gentity_s::s, level_locals_t::time, trap_Cvar_VariableIntegerValue(), trajectory_t::trBase, vec3_t, vectoangles(), VectorMA, and VectorSubtract.

00235                                                       {
00236     vec3_t      vec;
00237     vec3_t      origin;
00238     vec3_t      f, r, u;
00239 
00240     podium->nextthink = level.time + 100;
00241 
00242     AngleVectors( level.intermission_angle, vec, NULL, NULL );
00243     VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin );
00244     origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" );
00245     G_SetOrigin( podium, origin );
00246 
00247     if( podium1 ) {
00248         VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
00249         vectoangles( vec, podium1->s.apos.trBase );
00250         podium1->s.apos.trBase[PITCH] = 0;
00251         podium1->s.apos.trBase[ROLL] = 0;
00252 
00253         AngleVectors( podium1->s.apos.trBase, f, r, u );
00254         VectorMA( podium->r.currentOrigin, offsetFirst[0], f, vec );
00255         VectorMA( vec, offsetFirst[1], r, vec );
00256         VectorMA( vec, offsetFirst[2], u, vec );
00257 
00258         G_SetOrigin( podium1, vec );
00259     }
00260 
00261     if( podium2 ) {
00262         VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
00263         vectoangles( vec, podium2->s.apos.trBase );
00264         podium2->s.apos.trBase[PITCH] = 0;
00265         podium2->s.apos.trBase[ROLL] = 0;
00266 
00267         AngleVectors( podium2->s.apos.trBase, f, r, u );
00268         VectorMA( podium->r.currentOrigin, offsetSecond[0], f, vec );
00269         VectorMA( vec, offsetSecond[1], r, vec );
00270         VectorMA( vec, offsetSecond[2], u, vec );
00271 
00272         G_SetOrigin( podium2, vec );
00273     }
00274 
00275     if( podium3 ) {
00276         VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
00277         vectoangles( vec, podium3->s.apos.trBase );
00278         podium3->s.apos.trBase[PITCH] = 0;
00279         podium3->s.apos.trBase[ROLL] = 0;
00280 
00281         AngleVectors( podium3->s.apos.trBase, f, r, u );
00282         VectorMA( podium->r.currentOrigin, offsetThird[0], f, vec );
00283         VectorMA( vec, offsetThird[1], r, vec );
00284         VectorMA( vec, offsetThird[2], u, vec );
00285 
00286         G_SetOrigin( podium3, vec );
00287     }
00288 }

Here is the call graph for this function:

gentity_t* SpawnModelOnVictoryPad gentity_t pad,
vec3_t  offset,
gentity_t ent,
int  place
[static]
 

Definition at line 139 of file g_arenas.c.

References entityShared_t::absmax, entityShared_t::absmin, AngleVectors(), entityState_s::apos, gentity_s::classname, gentity_s::client, gentity_s::clipmask, entityShared_t::contents, CONTENTS_SOLID, gentity_s::count, entityShared_t::currentOrigin, entityState_s::eFlags, entityState_s::eType, entityState_s::event, f, G_Printf(), G_SetOrigin(), G_Spawn(), gentity_t, entityState_s::groundEntityNum, level_locals_t::intermission_origin, entityState_s::legsAnim, level, entityState_s::loopSound, entityShared_t::maxs, entityShared_t::mins, clientPersistant_t::netname, entityState_s::number, offset, entityShared_t::ownerNum, gclient_s::pers, gentity_s::physicsBounce, gentity_s::physicsObject, entityState_s::pos, entityState_s::powerups, r, gentity_s::r, gentity_s::s, S_COLOR_RED, entityShared_t::svFlags, gentity_s::takedamage, level_locals_t::time, gentity_s::timestamp, entityState_s::torsoAnim, trap_LinkEntity(), trajectory_t::trBase, trajectory_t::trType, vec3_t, vectoangles(), VectorCopy, VectorMA, VectorSubtract, and entityState_s::weapon.

Referenced by SpawnModelsOnVictoryPads().

00139                                                                                                      {
00140     gentity_t   *body;
00141     vec3_t      vec;
00142     vec3_t      f, r, u;
00143 
00144     body = G_Spawn();
00145     if ( !body ) {
00146         G_Printf( S_COLOR_RED "ERROR: out of gentities\n" );
00147         return NULL;
00148     }
00149 
00150     body->classname = ent->client->pers.netname;
00151     body->client = ent->client;
00152     body->s = ent->s;
00153     body->s.eType = ET_PLAYER;      // could be ET_INVISIBLE
00154     body->s.eFlags = 0;             // clear EF_TALK, etc
00155     body->s.powerups = 0;           // clear powerups
00156     body->s.loopSound = 0;          // clear lava burning
00157     body->s.number = body - g_entities;
00158     body->timestamp = level.time;
00159     body->physicsObject = qtrue;
00160     body->physicsBounce = 0;        // don't bounce
00161     body->s.event = 0;
00162     body->s.pos.trType = TR_STATIONARY;
00163     body->s.groundEntityNum = ENTITYNUM_WORLD;
00164     body->s.legsAnim = LEGS_IDLE;
00165     body->s.torsoAnim = TORSO_STAND;
00166     if( body->s.weapon == WP_NONE ) {
00167         body->s.weapon = WP_MACHINEGUN;
00168     }
00169     if( body->s.weapon == WP_GAUNTLET) {
00170         body->s.torsoAnim = TORSO_STAND2;
00171     }
00172     body->s.event = 0;
00173     body->r.svFlags = ent->r.svFlags;
00174     VectorCopy (ent->r.mins, body->r.mins);
00175     VectorCopy (ent->r.maxs, body->r.maxs);
00176     VectorCopy (ent->r.absmin, body->r.absmin);
00177     VectorCopy (ent->r.absmax, body->r.absmax);
00178     body->clipmask = CONTENTS_SOLID | CONTENTS_PLAYERCLIP;
00179     body->r.contents = CONTENTS_BODY;
00180     body->r.ownerNum = ent->r.ownerNum;
00181     body->takedamage = qfalse;
00182 
00183     VectorSubtract( level.intermission_origin, pad->r.currentOrigin, vec );
00184     vectoangles( vec, body->s.apos.trBase );
00185     body->s.apos.trBase[PITCH] = 0;
00186     body->s.apos.trBase[ROLL] = 0;
00187 
00188     AngleVectors( body->s.apos.trBase, f, r, u );
00189     VectorMA( pad->r.currentOrigin, offset[0], f, vec );
00190     VectorMA( vec, offset[1], r, vec );
00191     VectorMA( vec, offset[2], u, vec );
00192 
00193     G_SetOrigin( body, vec );
00194 
00195     trap_LinkEntity (body);
00196 
00197     body->count = place;
00198 
00199     return body;
00200 }

Here is the call graph for this function:

void SpawnModelsOnVictoryPads void   ) 
 

Definition at line 328 of file g_arenas.c.

References level_locals_t::clients, g_entities, gentity_t, level, gentity_s::nextthink, level_locals_t::numNonSpectatorClients, offsetFirst, offsetSecond, offsetThird, PERS_RANK, podium1, podium2, podium3, RANK_TIED_FLAG, level_locals_t::sortedClients, SpawnModelOnVictoryPad(), SpawnPodium(), gentity_s::think, and level_locals_t::time.

Referenced by BeginIntermission().

00328                                       {
00329     gentity_t   *player;
00330     gentity_t   *podium;
00331 
00332     podium1 = NULL;
00333     podium2 = NULL;
00334     podium3 = NULL;
00335 
00336     podium = SpawnPodium();
00337 
00338     player = SpawnModelOnVictoryPad( podium, offsetFirst, &g_entities[level.sortedClients[0]],
00339                 level.clients[ level.sortedClients[0] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
00340     if ( player ) {
00341         player->nextthink = level.time + 2000;
00342         player->think = CelebrateStart;
00343         podium1 = player;
00344     }
00345 
00346     player = SpawnModelOnVictoryPad( podium, offsetSecond, &g_entities[level.sortedClients[1]],
00347                 level.clients[ level.sortedClients[1] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
00348     if ( player ) {
00349         podium2 = player;
00350     }
00351 
00352     if ( level.numNonSpectatorClients > 2 ) {
00353         player = SpawnModelOnVictoryPad( podium, offsetThird, &g_entities[level.sortedClients[2]],
00354                 level.clients[ level.sortedClients[2] ].ps.persistant[PERS_RANK] &~ RANK_TIED_FLAG );
00355         if ( player ) {
00356             podium3 = player;
00357         }
00358     }
00359 }

Here is the call graph for this function:

gentity_t* SpawnPodium void   )  [static]
 

Definition at line 291 of file g_arenas.c.

References AngleVectors(), entityState_s::apos, gentity_s::classname, gentity_s::clipmask, entityShared_t::contents, entityShared_t::currentOrigin, entityState_s::eType, G_ModelIndex(), G_SetOrigin(), G_Spawn(), gentity_t, level_locals_t::intermission_angle, level_locals_t::intermission_origin, level, entityState_s::modelindex, gentity_s::nextthink, NULL, entityState_s::number, gentity_s::r, gentity_s::s, SP_PODIUM_MODEL, gentity_s::think, level_locals_t::time, trap_Cvar_VariableIntegerValue(), trap_LinkEntity(), trajectory_t::trBase, vec3_t, VectorMA, VectorSubtract, and vectoyaw().

Referenced by SpawnModelsOnVictoryPads().

00291                                       {
00292     gentity_t   *podium;
00293     vec3_t      vec;
00294     vec3_t      origin;
00295 
00296     podium = G_Spawn();
00297     if ( !podium ) {
00298         return NULL;
00299     }
00300 
00301     podium->classname = "podium";
00302     podium->s.eType = ET_GENERAL;
00303     podium->s.number = podium - g_entities;
00304     podium->clipmask = CONTENTS_SOLID;
00305     podium->r.contents = CONTENTS_SOLID;
00306     podium->s.modelindex = G_ModelIndex( SP_PODIUM_MODEL );
00307 
00308     AngleVectors( level.intermission_angle, vec, NULL, NULL );
00309     VectorMA( level.intermission_origin, trap_Cvar_VariableIntegerValue( "g_podiumDist" ), vec, origin );
00310     origin[2] -= trap_Cvar_VariableIntegerValue( "g_podiumDrop" );
00311     G_SetOrigin( podium, origin );
00312 
00313     VectorSubtract( level.intermission_origin, podium->r.currentOrigin, vec );
00314     podium->s.apos.trBase[YAW] = vectoyaw( vec );
00315     trap_LinkEntity (podium);
00316 
00317     podium->think = PodiumPlacementThink;
00318     podium->nextthink = level.time + 100;
00319     return podium;
00320 }

Here is the call graph for this function:

void Svcmd_AbortPodium_f void   ) 
 

Definition at line 367 of file g_arenas.c.

References g_gametype, level, gentity_s::nextthink, podium1, gentity_s::think, and level_locals_t::time.

Referenced by ConsoleCommand().

00367                                  {
00368     if( g_gametype.integer != GT_SINGLE_PLAYER ) {
00369         return;
00370     }
00371 
00372     if( podium1 ) {
00373         podium1->nextthink = level.time;
00374         podium1->think = CelebrateStop;
00375     }
00376 }

void UpdateTournamentInfo void   ) 
 

Definition at line 40 of file g_arenas.c.

References gclient_s::accuracy_hits, gclient_s::accuracy_shots, CalculateRanks(), gentity_s::client, level_locals_t::clients, Com_sprintf(), EXEC_APPEND, g_entities, g_gametype, gentity_t, i, gentity_s::inuse, level, level_locals_t::maxclients, n, level_locals_t::numNonSpectatorClients, PERS_ASSIST_COUNT, PERS_CAPTURES, PERS_DEFEND_COUNT, PERS_EXCELLENT_COUNT, PERS_GAUNTLET_FRAG_COUNT, PERS_IMPRESSIVE_COUNT, PERS_RANK, PERS_SCORE, playerState_s::persistant, gclient_s::ps, qboolean, gentity_s::r, gclient_s::sess, clientSession_t::sessionTeam, level_locals_t::sortedClients, strcat(), strlen(), entityShared_t::svFlags, level_locals_t::teamScores, level_locals_t::time, and trap_SendConsoleCommand().

Referenced by BeginIntermission().

00040                                   {
00041     int         i;
00042     gentity_t   *player;
00043     int         playerClientNum;
00044     int         n, accuracy, perfect,   msglen;
00045     int         buflen;
00046 #ifdef MISSIONPACK // bk001205
00047   int score1, score2;
00048     qboolean won;
00049 #endif
00050     char        buf[32];
00051     char        msg[MAX_STRING_CHARS];
00052 
00053     // find the real player
00054     player = NULL;
00055     for (i = 0; i < level.maxclients; i++ ) {
00056         player = &g_entities[i];
00057         if ( !player->inuse ) {
00058             continue;
00059         }
00060         if ( !( player->r.svFlags & SVF_BOT ) ) {
00061             break;
00062         }
00063     }
00064     // this should never happen!
00065     if ( !player || i == level.maxclients ) {
00066         return;
00067     }
00068     playerClientNum = i;
00069 
00070     CalculateRanks();
00071 
00072     if ( level.clients[playerClientNum].sess.sessionTeam == TEAM_SPECTATOR ) {
00073 #ifdef MISSIONPACK
00074         Com_sprintf( msg, sizeof(msg), "postgame %i %i 0 0 0 0 0 0 0 0 0 0 0", level.numNonSpectatorClients, playerClientNum );
00075 #else
00076         Com_sprintf( msg, sizeof(msg), "postgame %i %i 0 0 0 0 0 0", level.numNonSpectatorClients, playerClientNum );
00077 #endif
00078     }
00079     else {
00080         if( player->client->accuracy_shots ) {
00081             accuracy = player->client->accuracy_hits * 100 / player->client->accuracy_shots;
00082         }
00083         else {
00084             accuracy = 0;
00085         }
00086 #ifdef MISSIONPACK
00087         won = qfalse;
00088         if (g_gametype.integer >= GT_CTF) {
00089             score1 = level.teamScores[TEAM_RED];
00090             score2 = level.teamScores[TEAM_BLUE];
00091             if (level.clients[playerClientNum].sess.sessionTeam == TEAM_RED) {
00092                 won = (level.teamScores[TEAM_RED] > level.teamScores[TEAM_BLUE]);
00093             } else {
00094                 won = (level.teamScores[TEAM_BLUE] > level.teamScores[TEAM_RED]);
00095             }
00096         } else {
00097             if (&level.clients[playerClientNum] == &level.clients[ level.sortedClients[0] ]) {
00098                 won = qtrue;
00099                 score1 = level.clients[ level.sortedClients[0] ].ps.persistant[PERS_SCORE];
00100                 score2 = level.clients[ level.sortedClients[1] ].ps.persistant[PERS_SCORE];
00101             } else {
00102                 score2 = level.clients[ level.sortedClients[0] ].ps.persistant[PERS_SCORE];
00103                 score1 = level.clients[ level.sortedClients[1] ].ps.persistant[PERS_SCORE];
00104             }
00105         }
00106         if (won && player->client->ps.persistant[PERS_KILLED] == 0) {
00107             perfect = 1;
00108         } else {
00109             perfect = 0;
00110         }
00111         Com_sprintf( msg, sizeof(msg), "postgame %i %i %i %i %i %i %i %i %i %i %i %i %i %i", level.numNonSpectatorClients, playerClientNum, accuracy,
00112             player->client->ps.persistant[PERS_IMPRESSIVE_COUNT], player->client->ps.persistant[PERS_EXCELLENT_COUNT],player->client->ps.persistant[PERS_DEFEND_COUNT],
00113             player->client->ps.persistant[PERS_ASSIST_COUNT], player->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT], player->client->ps.persistant[PERS_SCORE],
00114             perfect, score1, score2, level.time, player->client->ps.persistant[PERS_CAPTURES] );
00115 
00116 #else
00117         perfect = ( level.clients[playerClientNum].ps.persistant[PERS_RANK] == 0 && player->client->ps.persistant[PERS_KILLED] == 0 ) ? 1 : 0;
00118         Com_sprintf( msg, sizeof(msg), "postgame %i %i %i %i %i %i %i %i", level.numNonSpectatorClients, playerClientNum, accuracy,
00119             player->client->ps.persistant[PERS_IMPRESSIVE_COUNT], player->client->ps.persistant[PERS_EXCELLENT_COUNT],
00120             player->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT], player->client->ps.persistant[PERS_SCORE],
00121             perfect );
00122 #endif
00123     }
00124 
00125     msglen = strlen( msg );
00126     for( i = 0; i < level.numNonSpectatorClients; i++ ) {
00127         n = level.sortedClients[i];
00128         Com_sprintf( buf, sizeof(buf), " %i %i %i", n, level.clients[n].ps.persistant[PERS_RANK], level.clients[n].ps.persistant[PERS_SCORE] );
00129         buflen = strlen( buf );
00130         if( msglen + buflen + 1 >= sizeof(msg) ) {
00131             break;
00132         }
00133         strcat( msg, buf );
00134     }
00135     trap_SendConsoleCommand( EXEC_APPEND, msg );
00136 }

Here is the call graph for this function:


Variable Documentation

vec3_t offsetFirst = {0, 0, 74} [static]
 

Definition at line 231 of file g_arenas.c.

Referenced by PodiumPlacementThink(), and SpawnModelsOnVictoryPads().

vec3_t offsetSecond = {-10, 60, 54} [static]
 

Definition at line 232 of file g_arenas.c.

Referenced by PodiumPlacementThink(), and SpawnModelsOnVictoryPads().

vec3_t offsetThird = {-19, -60, 45} [static]
 

Definition at line 233 of file g_arenas.c.

Referenced by PodiumPlacementThink(), and SpawnModelsOnVictoryPads().

gentity_t* podium1
 

Definition at line 30 of file g_arenas.c.

Referenced by G_SpawnBots(), PodiumPlacementThink(), SpawnModelsOnVictoryPads(), and Svcmd_AbortPodium_f().

gentity_t* podium2
 

Definition at line 31 of file g_arenas.c.

Referenced by G_SpawnBots(), PodiumPlacementThink(), and SpawnModelsOnVictoryPads().

gentity_t* podium3
 

Definition at line 32 of file g_arenas.c.

Referenced by G_SpawnBots(), PodiumPlacementThink(), and SpawnModelsOnVictoryPads().


Generated on Thu Aug 25 13:47:46 2005 for Quake III Arena by  doxygen 1.3.9.1