Example #1
0
void SHeliBodyState::save(NET_Packet &output_packet)
{
	output_packet.w_s16((s16)type);
	output_packet.w_u8(b_looking_at_point ? 1 : 0);    
	output_packet.w_float(currBodyHPB.x);
	output_packet.w_float(currBodyHPB.y);
	output_packet.w_float(currBodyHPB.z);
}
Example #2
0
void SHeliEnemy::save(NET_Packet &output_packet)
{
	output_packet.w_s16		((s16)type);
	output_packet.w_vec3	(destEnemyPos);
	output_packet.w_u32		(destEnemyID);

	output_packet.w_float	(fire_trail_length_des);
	output_packet.w_u8		(bUseFireTrail ? 1 : 0);
}
void game_sv_TeamDeathmatch::OnPlayerChangeTeam(ClientID id_who, s16 team)
{
    game_PlayerState*	ps_who	=	get_id	(id_who);
    if (!ps_who) return;
    if (!team)
    {
        if (!ps_who->team)
            team = AutoTeam();
        else if (TeamSizeEqual())
        {
            team = ps_who->team;
        }
        else
        {
            team = AutoTeam();
        }
    };
    //-----------------------------------------------------
    NET_Packet Px;
    GenerateGameMessage(Px);
    Px.w_u32(GAME_EVENT_PLAYER_GAME_MENU_RESPOND);
    Px.w_u8(PLAYER_CHANGE_TEAM);
    Px.w_s16(team);
    m_server->SendTo(id_who,Px,net_flags(TRUE,TRUE));
    //-----------------------------------------------------
    if (ps_who->team == team) return;
    //-----------------------------------------------------
    KillPlayer(id_who, ps_who->GameID);
    //-----------------------------------------------------
    ps_who->setFlag(GAME_PLAYER_FLAG_SPECTATOR);
    //-----------------------------------------------------
    s16 OldTeam = ps_who->team;
    ps_who->team = u8(team & 0x00ff);
    TeamStruct* pTS = GetTeamData(team);
    if (pTS)
    {
        if ((ps_who->money_for_round < pTS->m_iM_Start) || (OldTeam == 0))
            Money_SetStart(id_who);
    }

/////////////////////////////////////////////////////////
    //Send Switch team message
    NET_Packet			P;
//	P.w_begin			(M_GAMEMESSAGE);
    GenerateGameMessage (P);
    P.w_u32				(PLAYER_CHANGE_TEAM);
    P.w_u16				(ps_who->GameID);
    P.w_u16				(ps_who->team);
    P.w_u16				(team);
    u_EventSend(P);
/////////////////////////////////////////////////////////



    SetPlayersDefItems(ps_who);

}
Example #4
0
void	game_PlayerState::net_Export(NET_Packet& P, BOOL Full)
{
	P.w_u8			(Full ? 1 : 0);
	if (Full)
		P.w_stringZ		(	name	);

	P.w_u8			(	team			);
	P.w_s16			(	m_iRivalKills	);
	P.w_s16			(	m_iSelfKills	);
	P.w_s16			(	m_iTeamKills	);
	P.w_s16			(	m_iDeaths		);
	P.w_s32			(	money_for_round	);
	P.w_float_q8	(	experience_D, -1.0f, 2.0f);
	P.w_u8			(	rank		);
	P.w_u8			(	af_count	);
	P.w_u16			(	flags__	);
	P.w_u16			(	ping	);

	P.w_u16			(	GameID	);
	P.w_s8			(	skin	);
	P.w_u8			(	m_bCurrentVoteAgreed	);

	P.w_u32			(Device.dwTimeGlobal - DeathTime);
};
void game_cl_TeamDeathmatch::OnTeamSelect(int Team)
{
	bool NeedToSendTeamSelect = true;
	if (Team != -1)
	{
		if (Team+1 == local_player->team && m_bSkinSelected)
			NeedToSendTeamSelect = false;
		else
		{
				NeedToSendTeamSelect = true;				
		}
	}

	if (NeedToSendTeamSelect)
	{
		CObject *l_pObj = Level().CurrentEntity();

		CGameObject *l_pPlayer = smart_cast<CGameObject*>(l_pObj);
		if(!l_pPlayer) return;

		NET_Packet		P;
		l_pPlayer->u_EventGen		(P,GE_GAME_EVENT,l_pPlayer->ID()	);
		P.w_u16(GAME_EVENT_PLAYER_GAME_MENU);
		P.w_u8(PLAYER_CHANGE_TEAM);
		
		P.w_s16			(s16(Team+1));
		//P.w_u32			(0);
		l_pPlayer->u_EventSend		(P);
		//-----------------------------------------------------------------
		m_bSkinSelected = FALSE;
	};
	//-----------------------------------------------------------------
	m_bTeamSelected = TRUE;	
	//---------------------------
//	if (m_bMenuCalledFromReady)
//	{
//		OnKeyboardPress(kJUMP);
//	}
};