コード例 #1
0
void G_UpdateTeamMapData_Player( gentity_t* ent, qboolean forceAllied, qboolean forceAxis ) {
	int num = ent - g_entities;
	mapEntityData_Team_t* teamList;
	mapEntityData_t *mEnt;

	if ( ent->client ) {
		switch ( ent->client->sess.sessionTeam ) {
		case TEAM_AXIS:
			forceAxis = qtrue;
			break;

		case TEAM_ALLIES:
			forceAllied = qtrue;
			break;

		default:
			break;
		}
	}

	if ( forceAxis && ent->client && !( ent->client->ps.pm_flags & PMF_LIMBO ) /*ent->health > 0*/ ) {
		teamList = &mapEntityData[0];
		mEnt = G_FindMapEntityData( teamList, num );
		if ( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->client->ps.origin, mEnt->org );
		mEnt->yaw = ent->client->ps.viewangles[YAW];
		mEnt->data = num;
		mEnt->startTime = level.time;

		if ( ent->health <= 0 ) {
			mEnt->type = ME_PLAYER_REVIVE;
		} else {
			mEnt->type = ME_PLAYER;
		}
	}

	if ( forceAllied && ent->client && !( ent->client->ps.pm_flags & PMF_LIMBO ) /*ent->health > 0*/ ) {
		teamList = &mapEntityData[1];
		mEnt = G_FindMapEntityData( teamList, num );
		if ( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}

		VectorCopy( ent->client->ps.origin, mEnt->org );
		mEnt->yaw = ent->client->ps.viewangles[YAW];
		mEnt->data = num;
		mEnt->startTime = level.time;
		if ( ent->health <= 0 ) {
			mEnt->type = ME_PLAYER_REVIVE;
		} else {
			mEnt->type = ME_PLAYER;
		}
	}
}
コード例 #2
0
void G_UpdateTeamMapData_LandMine(gentity_t* ent, qboolean forceAllied, qboolean forceAxis) {
//void G_UpdateTeamMapData_LandMine(gentity_t* ent) {
	int num = ent-g_entities;
	mapEntityData_Team_t* teamList;
	mapEntityData_t *mEnt;

	// inversed teamlists, we want to see the enemy mines
	switch(ent->s.teamNum % 4) {
		case TEAM_AXIS:
			forceAxis = qtrue;
			break;

		case TEAM_ALLIES:
			forceAllied = qtrue;
			break;
	}

	if(forceAxis && (ent->s.teamNum < 4 || ent->s.teamNum >= 8) ) {
		teamList = &mapEntityData[0];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}

		VectorCopy( ent->r.currentOrigin, mEnt->org );
		//mEnt->data = TEAM_AXIS;
		mEnt->data = (ent->s.teamNum % 4);
		mEnt->startTime = level.time;
		//if( ent->s.teamNum < 4 )
			mEnt->type = ME_LANDMINE;
		//else if( ent->s.teamNum >= 8 )
		//	mEnt->type = ME_LANDMINE_ARMED;
	} 

	if(forceAllied && (ent->s.teamNum < 4 || ent->s.teamNum >= 8) ) {
		teamList = &mapEntityData[1];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
	
		VectorCopy( ent->r.currentOrigin, mEnt->org );
		//mEnt->data = TEAM_ALLIES;
		mEnt->data = (ent->s.teamNum % 4);
		mEnt->startTime = level.time;
		//if( ent->s.teamNum < 4 )
			mEnt->type = ME_LANDMINE;
		//else if( ent->s.teamNum >= 8 )
		//	mEnt->type = ME_LANDMINE_ARMED;
	}
}
コード例 #3
0
static void G_UpdateTeamMapData_DisguisedPlayer( gentity_t* spotter, gentity_t* ent, qboolean forceAllied, qboolean forceAxis ) {
	int num = ent - g_entities;
	mapEntityData_Team_t* teamList;
	mapEntityData_t *mEnt;

	if ( ent->client ) {
		switch ( ent->client->sess.sessionTeam ) {
		case TEAM_AXIS:
			forceAxis = qtrue;
			break;

		case TEAM_ALLIES:
			forceAllied = qtrue;
			break;

		default:
			break;
		}
	}

	if ( ent->client && !( ent->client->ps.pm_flags & PMF_LIMBO ) ) {
		if ( forceAxis ) {
			teamList = &mapEntityData[0];

			mEnt = G_FindMapEntityDataSingleClient( teamList, NULL, num, spotter->s.clientNum );
			if ( !mEnt ) {
				mEnt = G_AllocMapEntityData( teamList );
				mEnt->entNum = num;
				mEnt->singleClient = spotter->s.clientNum;
			}
			VectorCopy( ent->client->ps.origin, mEnt->org );
			mEnt->yaw = ent->client->ps.viewangles[YAW];
			mEnt->data = num;
			mEnt->startTime = level.time;
			mEnt->type = ME_PLAYER_DISGUISED;
		}
		if ( forceAllied ) {
			teamList = &mapEntityData[1];

			mEnt = G_FindMapEntityDataSingleClient( teamList, NULL, num, spotter->s.clientNum );
			if ( !mEnt ) {
				mEnt = G_AllocMapEntityData( teamList );
				mEnt->entNum = num;
				mEnt->singleClient = spotter->s.clientNum;
			}
			VectorCopy( ent->client->ps.origin, mEnt->org );
			mEnt->yaw = ent->client->ps.viewangles[YAW];
			mEnt->data = num;
			mEnt->startTime = level.time;
			mEnt->type = ME_PLAYER_DISGUISED;
		}
	}
}
コード例 #4
0
void G_UpdateTeamMapData_Construct(gentity_t *ent)
{
	int                  num = ent - g_entities;
	mapEntityData_Team_t *teamList;
	mapEntityData_t      *mEnt;

	switch (ent->s.teamNum)
	{
	case TEAM_SPECTATOR: // both teams - do twice
	{
		teamList = &mapEntityData[0];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}
		VectorCopy(ent->s.pos.trBase, mEnt->org);
		mEnt->data      = mEnt->entNum; //ent->s.modelindex2;
		mEnt->type      = ME_CONSTRUCT;
		mEnt->startTime = level.time;
		mEnt->yaw       = 0;

		teamList = &mapEntityData[1];
		break;
	}
	case TEAM_AXIS:
	{
		teamList = &mapEntityData[0];
		break;
	}
	case TEAM_ALLIES:
	{
		teamList = &mapEntityData[1];

		break;
	}
	default:
		return;
	}

	mEnt = G_FindMapEntityData(teamList, num);
	if (!mEnt)
	{
		mEnt         = G_AllocMapEntityData(teamList);
		mEnt->entNum = num;
	}
	VectorCopy(ent->s.pos.trBase, mEnt->org);
	mEnt->data      = mEnt->entNum; //ent->s.modelindex2;
	mEnt->type      = ME_CONSTRUCT;
	mEnt->startTime = level.time;
	mEnt->yaw       = 0;
}
コード例 #5
0
ファイル: g_teammapdata.c プロジェクト: etlegacy/etlegacy
/**
 * @brief G_UpdateTeamMapData_CommandmapMarker
 * @param[in] ent
 */
void G_UpdateTeamMapData_CommandmapMarker(gentity_t *ent)
{
	if (!ent->parent)
	{
		return;
	}

	if (ent->entstate != STATE_DEFAULT)
	{
		return;
	}

	if (ent->parent->spawnflags & (ALLIED_OBJECTIVE | AXIS_OBJECTIVE))
	{
		int                  num = ent - g_entities;
		mapEntityData_Team_t *teamList;
		mapEntityData_t      *mEnt;

		// alies
		teamList = &mapEntityData[0];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}
		VectorCopy(ent->s.origin, mEnt->org);
		mEnt->data      = ent->parent ? ent->parent->s.teamNum : -1;
		mEnt->startTime = level.time;
		mEnt->type      = ME_COMMANDMAP_MARKER;
		mEnt->yaw       = 0;


		// axis
		teamList = &mapEntityData[1];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}
		VectorCopy(ent->s.origin, mEnt->org);
		mEnt->data      = ent->parent ? ent->parent->s.teamNum : -1;
		mEnt->startTime = level.time;
		mEnt->type      = ME_COMMANDMAP_MARKER;
		mEnt->yaw       = 0;
	}
}
コード例 #6
0
void G_UpdateTeamMapData_Tank(gentity_t *ent)
{
	int                  num       = ent - g_entities;
	mapEntityData_Team_t *teamList = &mapEntityData[0];
	mapEntityData_t      *mEnt;

	mEnt = G_FindMapEntityData(teamList, num);

	if (!mEnt)
	{
		mEnt         = G_AllocMapEntityData(teamList);
		mEnt->entNum = num;
	}
	VectorCopy(ent->s.pos.trBase, mEnt->org);
	mEnt->data      = ent->s.modelindex2;
	mEnt->startTime = level.time;
	if (ent->s.eType == ET_TANK_INDICATOR_DEAD)
	{
		mEnt->type = ME_TANK_DEAD;
	}
	else
	{
		mEnt->type = ME_TANK;
	}
	mEnt->yaw = 0;

	teamList = &mapEntityData[1];
	mEnt     = G_FindMapEntityData(teamList, num);
	if (!mEnt)
	{
		mEnt         = G_AllocMapEntityData(teamList);
		mEnt->entNum = num;
	}
	VectorCopy(ent->s.pos.trBase, mEnt->org);
	mEnt->data      = ent->s.modelindex2;
	mEnt->startTime = level.time;
	if (ent->s.eType == ET_TANK_INDICATOR_DEAD)
	{
		mEnt->type = ME_TANK_DEAD;
	}
	else
	{
		mEnt->type = ME_TANK;
	}
	mEnt->yaw = 0;
}
コード例 #7
0
void G_UpdateTeamMapData_LandMine(gentity_t *ent)
{
	int                  num = ent - g_entities;
	mapEntityData_Team_t *teamList;
	mapEntityData_t      *mEnt;
	int                  team = ent->s.teamNum & 3;    //ent->s.teamNum % 4

	if (!(ent->s.teamNum < 4 || ent->s.teamNum >= 8))
	{
		return;                                                 // must be armed..

	}
	// inversed teamlists, we want to see the enemy mines
	if (ent->s.modelindex2)     // must be spotted..
	{
		teamList = &mapEntityData[(team == TEAM_AXIS) ? 1 : 0];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}
		VectorCopy(ent->r.currentOrigin, mEnt->org);
		mEnt->data      = team;
		mEnt->startTime = level.time;
		mEnt->type      = ME_LANDMINE;
	}

	// team mines..
	teamList = &mapEntityData[(team == TEAM_AXIS) ? 0 : 1];
	mEnt     = G_FindMapEntityData(teamList, num);
	if (!mEnt)
	{
		mEnt         = G_AllocMapEntityData(teamList);
		mEnt->entNum = num;
	}
	VectorCopy(ent->r.currentOrigin, mEnt->org);
	mEnt->data      = team;
	mEnt->startTime = level.time;
	mEnt->type      = ME_LANDMINE;
}
コード例 #8
0
void G_UpdateTeamMapData_Destruct(gentity_t* ent) {
	int num = ent-g_entities;
	mapEntityData_Team_t* teamList;
	mapEntityData_t *mEnt;

	if( ent->s.teamNum == TEAM_AXIS ) {
		teamList = &mapEntityData[1];	// inverted
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->startTime = level.time;
		mEnt->type = ME_DESTRUCT;
		mEnt->yaw = 0;
	} else {
		if( ent->parent->target_ent && ( ent->parent->target_ent->s.eType == ET_CONSTRUCTIBLE || ent->parent->target_ent->s.eType == ET_EXPLOSIVE ) ) {
			if( ent->parent->spawnflags & ((1 << 6) | (1 << 4))) {
				teamList = &mapEntityData[1];	// inverted
				mEnt = G_FindMapEntityData( teamList, num );
				if( !mEnt ) {
					mEnt = G_AllocMapEntityData( teamList );
					mEnt->entNum = num;
				}
				VectorCopy( ent->s.pos.trBase, mEnt->org );
				mEnt->data = mEnt->entNum; //ent->s.modelindex2;
				mEnt->startTime = level.time;
				mEnt->type = ME_DESTRUCT_2;
				mEnt->yaw = 0;
			}
		}
	}

	if(ent->s.teamNum == TEAM_ALLIES  ) {
		teamList = &mapEntityData[0];	// inverted
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->startTime = level.time;
		mEnt->type = ME_DESTRUCT;
		mEnt->yaw = 0;
	} else {
		if( ent->parent->target_ent && ( ent->parent->target_ent->s.eType == ET_CONSTRUCTIBLE || ent->parent->target_ent->s.eType == ET_EXPLOSIVE ) ) {
			if( ent->parent->spawnflags & ((1 << 6) | (1 << 4)) ) {
				teamList = &mapEntityData[0];	// inverted
				mEnt = G_FindMapEntityData( teamList, num );
				if( !mEnt ) {
					mEnt = G_AllocMapEntityData( teamList );
					mEnt->entNum = num;
				}
				VectorCopy( ent->s.pos.trBase, mEnt->org );
				mEnt->data = mEnt->entNum; //ent->s.modelindex2;
				mEnt->startTime = level.time;
				mEnt->type = ME_DESTRUCT_2;
				mEnt->yaw = 0;
			}
		}
	}
}
コード例 #9
0
void G_UpdateTeamMapData_Construct(gentity_t* ent) {
	int num = ent-g_entities;
	mapEntityData_Team_t* teamList;
	mapEntityData_t *mEnt;

	if( ent->s.teamNum == 3 ) {
		teamList = &mapEntityData[0];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->type = ME_CONSTRUCT;
		mEnt->startTime = level.time;
		mEnt->yaw = 0;

		teamList = &mapEntityData[1];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->type = ME_CONSTRUCT;
		mEnt->startTime = level.time;
		mEnt->yaw = 0;

		return;
	}

	if( ent->s.teamNum == TEAM_AXIS ) {
		teamList = &mapEntityData[0];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->type = ME_CONSTRUCT;
		mEnt->startTime = level.time;
		mEnt->yaw = 0;
	} else {
	}

	if( ent->s.teamNum == TEAM_ALLIES ) {
		teamList = &mapEntityData[1];
		mEnt = G_FindMapEntityData( teamList, num );
		if( !mEnt ) {
			mEnt = G_AllocMapEntityData( teamList );
			mEnt->entNum = num;
		}
		VectorCopy( ent->s.pos.trBase, mEnt->org );
		mEnt->data = mEnt->entNum; //ent->s.modelindex2;
		mEnt->type = ME_CONSTRUCT;
		mEnt->startTime = level.time;
		mEnt->yaw = 0;
	} else {
	}
}
コード例 #10
0
void G_UpdateTeamMapData_Player(gentity_t *ent, qboolean forceAllied, qboolean forceAxis)
{
	int                  num = ent - g_entities;
	mapEntityData_Team_t *teamList;
	mapEntityData_t      *mEnt;

	if (!ent->client)
	{
		return;
	}

	if (ent->client->ps.pm_flags & PMF_LIMBO)
	{
		return;
	}

	if (ent->client->sess.sessionTeam == TEAM_AXIS)
	{
		forceAxis = qtrue;
	}
	else if (ent->client->sess.sessionTeam == TEAM_ALLIES)
	{
		forceAllied = qtrue;
	}

	if (forceAxis)
	{
		teamList = &mapEntityData[0];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}
		VectorCopy(ent->client->ps.origin, mEnt->org);
		mEnt->yaw       = ent->client->ps.viewangles[YAW];
		mEnt->data      = num;
		mEnt->startTime = level.time;

		if (ent->health <= 0)
		{
			mEnt->type = ME_PLAYER_REVIVE;
		}
		else if (ent->client->ps.powerups[PW_REDFLAG] || ent->client->ps.powerups[PW_BLUEFLAG])
		{
			mEnt->type = ME_PLAYER_OBJECTIVE;
		}
		else
		{
			mEnt->type = ME_PLAYER;
		}
	}

	if (forceAllied)
	{
		teamList = &mapEntityData[1];
		mEnt     = G_FindMapEntityData(teamList, num);
		if (!mEnt)
		{
			mEnt         = G_AllocMapEntityData(teamList);
			mEnt->entNum = num;
		}

		VectorCopy(ent->client->ps.origin, mEnt->org);
		mEnt->yaw       = ent->client->ps.viewangles[YAW];
		mEnt->data      = num;
		mEnt->startTime = level.time;
		if (ent->health <= 0)
		{
			mEnt->type = ME_PLAYER_REVIVE;
		}
		else if (ent->client->ps.powerups[PW_REDFLAG] || ent->client->ps.powerups[PW_BLUEFLAG])
		{
			mEnt->type = ME_PLAYER_OBJECTIVE;
		}
		else
		{
			mEnt->type = ME_PLAYER;
		}
	}
}