int Team_TouchEnemyFlag(gentity_t *ent, gentity_t *other, int team) { gclient_t *cl = other->client; gentity_t *tmp; ent->s.density--; tmp = ent->parent; ent->parent = other; if (cl->sess.sessionTeam == TEAM_AXIS) { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_AXIS; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "allied_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); } else { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_ALLIES; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "axis_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); } ent->parent = tmp; if (team == TEAM_AXIS) { cl->ps.powerups[PW_REDFLAG] = INT_MAX; } else { cl->ps.powerups[PW_BLUEFLAG] = INT_MAX; } // flags never expire // store the entitynum of our original flag spawner if (ent->flags & FL_DROPPED_ITEM) { cl->flagParent = ent->s.otherEntityNum; } else { cl->flagParent = ent->s.number; } other->client->speedScale = ent->splashDamage; // Alter player speed if (ent->s.density > 0) { return 1; // We have more flags to give out, spawn back quickly } return -1; // Do not respawn this automatically, but do delete it if it was FL_DROPPED }
void G_PopupMessageForMines(gentity_t *player) // int sound { gentity_t *pm; pm = G_PopupMessage(PM_MINES); VectorCopy(player->client->landmineSpotted->r.currentOrigin, pm->s.origin); pm->s.effect2Time = (player->client->sess.sessionTeam == TEAM_AXIS) ? TEAM_ALLIES : TEAM_AXIS; pm->s.effect3Time = player - g_entities; //pm->s.loopSound = sound; }
void Team_ReturnFlagSound(gentity_t *ent, int team) { // play powerup spawn sound to all clients gentity_t *pm; if (ent == NULL) { G_DPrintf("Warning: NULL passed to Team_ReturnFlagSound\n"); return; } pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = team; pm->s.density = 1; // 1 = returned }
void G_UpdateTeamMapData( void ) { int i, j/*, k*/; gentity_t *ent, *ent2; mapEntityData_t *mEnt; if(level.time - level.lastMapEntityUpdate < 500) { return; } level.lastMapEntityUpdate = level.time; for(i = 0, ent = g_entities; i < level.num_entities; i++, ent++) { if(!ent->inuse) { // mapEntityData[0][i].valid = qfalse; // mapEntityData[1][i].valid = qfalse; continue; } switch(ent->s.eType) { case ET_PLAYER: G_UpdateTeamMapData_Player( ent, qfalse, qfalse ); for( j = 0; j < 2; j++ ) { mapEntityData_Team_t *teamList = &mapEntityData[j]; mEnt = G_FindMapEntityDataSingleClient( teamList, NULL, ent->s.number, -1 ); while( mEnt ) { VectorCopy( ent->client->ps.origin, mEnt->org ); mEnt->yaw = ent->client->ps.viewangles[YAW]; mEnt = G_FindMapEntityDataSingleClient( teamList, mEnt, ent->s.number, -1 ); } } break; case ET_CONSTRUCTIBLE_INDICATOR: if( ent->parent && ent->parent->entstate == STATE_DEFAULT ) { G_UpdateTeamMapData_Construct(ent); } break; case ET_EXPLOSIVE_INDICATOR: if( ent->parent && ent->parent->entstate == STATE_DEFAULT ) { G_UpdateTeamMapData_Destruct(ent); } break; case ET_TANK_INDICATOR: case ET_TANK_INDICATOR_DEAD: G_UpdateTeamMapData_Tank(ent); break; case ET_MISSILE: if( ent->methodOfDeath == MOD_LANDMINE) { G_UpdateTeamMapData_LandMine(ent, qfalse, qfalse); } break; case ET_COMMANDMAP_MARKER: G_UpdateTeamMapData_CommandmapMarker( ent ); break; default: break; } } //for(i = 0, ent = g_entities; i < MAX_CLIENTS; i++, ent++) { for( i = 0, ent = g_entities; i < level.num_entities; i++, ent++ ) { qboolean f1, f2; if( !ent->inuse || !ent->client ) { continue; } if( ent->client->sess.playerType == PC_RECON ) { if( ent->health > 0 ) { f1 = ent->client->sess.sessionTeam == TEAM_ALLIES ? qtrue : qfalse; f2 = ent->client->sess.sessionTeam == TEAM_AXIS ? qtrue : qfalse; G_SetupFrustum( ent ); for( j = 0, ent2 = g_entities; j < level.num_entities; j++, ent2++ ) { if( !ent2->inuse || ent2 == ent ) { continue; } switch(ent2->s.eType) { case ET_PLAYER: { vec3_t pos[3]; VectorCopy( ent2->client->ps.origin, pos[0] ); pos[0][2] += ent2->client->ps.mins[2]; VectorCopy( ent2->client->ps.origin, pos[1] ); VectorCopy( ent2->client->ps.origin, pos[2] ); pos[2][2] += ent2->client->ps.maxs[2]; if(ent2->health > 0 && (G_VisibleFromBinoculars( ent, ent2, pos[0] ) || G_VisibleFromBinoculars( ent, ent2, pos[1] ) || G_VisibleFromBinoculars( ent, ent2, pos[2] ) ) ) { if(ent2->client->sess.sessionTeam != ent->client->sess.sessionTeam) { int k; switch(ent2->client->sess.sessionTeam) { case TEAM_AXIS: mEnt = G_FindMapEntityData( &mapEntityData[0], ent2-g_entities ); if( mEnt && level.time - mEnt->startTime > 5000) { for( k = 0; k < MAX_CLIENTS; k++ ) { if(g_entities[k].inuse && g_entities[k].client && g_entities[k].client->sess.sessionTeam == ent->client->sess.sessionTeam) { trap_SendServerCommand( k, va( "tt \"ENEMY SPOTTED <STOP> CHECK COMMAND MAP FOR DETAILS <STOP>\"\n" )); } } } break; case TEAM_ALLIES: mEnt = G_FindMapEntityData( &mapEntityData[1], ent2-g_entities ); if( mEnt && level.time - mEnt->startTime > 5000) { for( k = 0; k < MAX_CLIENTS; k++ ) { if(g_entities[k].inuse && g_entities[k].client && g_entities[k].client->sess.sessionTeam == ent->client->sess.sessionTeam) { trap_SendServerCommand( k, va( "tt \"ENEMY SPOTTED <STOP> CHECK COMMAND MAP FOR DETAILS <STOP>\"\n" )); } } } break; } } G_UpdateTeamMapData_Player(ent2, f1, f2); } break; } default: break; } } if(ent->client->ps.eFlags & EF_ZOOMING) { G_SetupFrustum_ForBinoculars( ent ); for(j = 0, ent2 = g_entities; j < level.num_entities; j++, ent2++) { if(!ent2->inuse || ent2 == ent) { continue; } switch(ent2->s.eType) { case ET_MISSILE: if( ent2->methodOfDeath == MOD_LANDMINE) { if( (ent2->s.teamNum < 4 || ent2->s.teamNum >= 8) && (ent2->s.teamNum%4 != ent->client->sess.sessionTeam) ) { // TAT - as before, we can only detect a mine if we can see it from our binoculars if (G_VisibleFromBinoculars( ent, ent2, ent2->r.currentOrigin )) { G_UpdateTeamMapData_LandMine(ent2, f1, f2); switch(ent2->s.teamNum%4) { case TEAM_AXIS: if( !ent2->s.modelindex2 ) { ent->client->landmineSpottedTime = level.time; ent->client->landmineSpotted = ent2; ent2->s.density = ent-g_entities+1; ent2->missionLevel = level.time; ent->client->landmineSpotted->count2 += 50; if(ent->client->landmineSpotted->count2 >= 250) { // int k; ent->client->landmineSpotted->count2 = 250; ent->client->landmineSpotted->s.modelindex2 = 1; // for marker ent->client->landmineSpotted->s.frame = rand() % 20; ent->client->landmineSpotted->r.contents = CONTENTS_CORPSE; trap_LinkEntity( ent->client->landmineSpotted ); { gentity_t* pm = G_PopupMessage( PM_MINES ); VectorCopy( ent->client->landmineSpotted->r.currentOrigin, pm->s.origin ); pm->s.effect2Time = TEAM_AXIS; pm->s.effect3Time = ent-g_entities; } /* for( k = 0; k < MAX_CLIENTS; k++ ) { if(g_entities[k].inuse && g_entities[k].client && g_entities[k].client->sess.sessionTeam == ent->client->sess.sessionTeam) { trap_SendServerCommand( k, va( "tt \"LANDMINES SPOTTED BY %s^0<STOP> CHECK COMMAND MAP FOR DETAILS <STOP>\"\n", ent->client->pers.netname)); } }*/ trap_SendServerCommand( ent-g_entities, "cp \"Landmine Revealed\n\"" ); AddScore( ent, 1 ); //G_AddExperience( ent, 1.f ); G_AddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f ); G_DebugAddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f, "spotting a landmine" ); } } break; case TEAM_ALLIES: if( !ent2->s.modelindex2 ) { ent->client->landmineSpottedTime = level.time; ent->client->landmineSpotted = ent2; ent2->s.density = ent-g_entities+1; ent2->missionLevel = level.time; ent->client->landmineSpotted->count2 += 50; if(ent->client->landmineSpotted->count2 >= 250) { // int k; ent->client->landmineSpotted->count2 = 250; ent->client->landmineSpotted->s.modelindex2 = 1; // for marker ent->client->landmineSpotted->s.frame = rand() % 20; ent->client->landmineSpotted->r.contents = CONTENTS_CORPSE; trap_LinkEntity( ent->client->landmineSpotted ); { gentity_t* pm = G_PopupMessage( PM_MINES ); VectorCopy( ent->client->landmineSpotted->r.currentOrigin, pm->s.origin ); pm->s.effect2Time = TEAM_ALLIES; pm->s.effect3Time = ent-g_entities; } /* for( k = 0; k < MAX_CLIENTS; k++ ) { if(g_entities[k].inuse && g_entities[k].client && g_entities[k].client->sess.sessionTeam == ent->client->sess.sessionTeam) { trap_SendServerCommand( k, va( "tt \"LANDMINES SPOTTED BY %s^0<STOP> CHECK COMMAND MAP FOR DETAILS <STOP>\"\n", ent->client->pers.netname)); } }*/ trap_SendServerCommand( ent-g_entities, "cp \"Landmine Revealed\n\"" ); AddScore( ent, 1 ); //G_AddExperience( ent, 1.f ); G_AddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f ); G_DebugAddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f, "spotting a landmine" ); } } break; } // end switch } // end (G_VisibleFromBinoculars( ent, ent2, ent2->r.currentOrigin )) else { // TAT - if we can't see the mine from our binoculars, make sure we clear out the landmineSpotted ptr, // because bots looking for mines are getting confused ent->client->landmineSpotted = NULL; } } } break; default: break; } } /* if(ent->client->landmineSpotted && !ent->client->landmineSpotted->s.modelindex2) { ent->client->landmineSpotted->count2 += 10; if(ent->client->landmineSpotted->count2 >= 250) { int k; ent->client->landmineSpotted->count2 = 250; ent->client->landmineSpotted->s.modelindex2 = 1; // for marker ent->client->landmineSpotted->s.frame = rand() % 20; for( k = 0; k < MAX_CLIENTS; k++ ) { if(g_entities[k].inuse && g_entities[k].client && g_entities[k].client->sess.sessionTeam == ent->client->sess.sessionTeam) { trap_SendServerCommand( k, va( "tt \"LANDMINES SPOTTED <STOP> CHECK COMMAND MAP FOR DETAILS <STOP>\"\n" )); } } trap_SendServerCommand( ent-g_entities, "cp \"Landmine Revealed\n\"" ); AddScore( ent, 1 ); //G_AddExperience( ent, 1.f ); G_AddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f ); G_DebugAddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 3.f, "spotting a landmine" ); } }*/ /* { // find any landmines that don't actually exist anymore, see if the covert ops can see the spot and if so - wipe them mapEntityData_Team_t *teamList = ent->client->sess.sessionTeam == TEAM_AXIS ? &mapEntityData[0] : &mapEntityData[1]; mEnt = teamList->activeMapEntityData.next; while( mEnt && mEnt != &teamList->activeMapEntityData ) { if( mEnt->type == ME_LANDMINE && mEnt->entNum == -1 ) { if( G_VisibleFromBinoculars( ent, NULL, mEnt->org ) ) { mEnt = G_FreeMapEntityData( teamList, mEnt ); trap_SendServerCommand( ent-g_entities, "print \"Old Landmine Cleared\n\"" ); AddScore( ent, 1 ); continue; } } mEnt = mEnt->next; } }*/ } } } } // G_SendAllMapEntityInfo(); }
/** * @brief Team_TouchEnemyFlag * @param[in,out] ent * @param[out] other * @param[in] team * @return */ int Team_TouchEnemyFlag(gentity_t *ent, gentity_t *other, int team) { gclient_t *cl = other->client; gentity_t *tmp; ent->s.density--; // hey, its not our flag, pick it up AddScore(other, WOLF_STEAL_OBJ_BONUS); tmp = ent->parent; ent->parent = other; if (cl->sess.sessionTeam == TEAM_AXIS) { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_AXIS; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "allied_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); #ifdef FEATURE_OMNIBOT Bot_Util_SendTrigger(ent, NULL, va("Axis have stolen %s!", ent->message), "stolen"); #endif } else { gentity_t *pm = G_PopupMessage(PM_OBJECTIVE); pm->s.effect3Time = G_StringIndex(ent->message); pm->s.effect2Time = TEAM_ALLIES; pm->s.density = 0; // 0 = stolen if (level.gameManager) { G_Script_ScriptEvent(level.gameManager, "trigger", "axis_object_stolen"); } G_Script_ScriptEvent(ent, "trigger", "stolen"); #ifdef FEATURE_OMNIBOT Bot_Util_SendTrigger(ent, NULL, va("Allies have stolen %s!", ent->message), "stolen"); #endif } ent->parent = tmp; // reset player disguise on stealing docs other->client->ps.powerups[PW_OPS_DISGUISED] = 0; other->client->disguiseClientNum = -1; if (team == TEAM_AXIS) { cl->ps.powerups[PW_REDFLAG] = INT_MAX; } else { cl->ps.powerups[PW_BLUEFLAG] = INT_MAX; } // flags never expire // store the entitynum of our original flag spawner if (ent->flags & FL_DROPPED_ITEM) { cl->flagParent = ent->s.otherEntityNum; } else { cl->flagParent = ent->s.number; } other->client->speedScale = ent->splashDamage; // Alter player speed if (ent->s.density > 0) { return 1; // We have more flags to give out, spawn back quickly } else { return -1; // Do not respawn this automatically, but do delete it if it was FL_DROPPED } }