//
// AVP_PlayerInfo_Messages.cpp
//
// Created by JG - 29 July 2008
//
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//

#include "Core/Asura.h"

// This file's header.
#include "Entity/PlayerInfo/AVP_PlayerInfo_Messages.h"

// Engine 
#include "Entity/AVP_Messages.h"

#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
void AVP_Message_PlayerInfo_ClientUpdate::RegisterFields(u_short usMsgID, u_short usEntityClassification)
{
	Asura_Assert(usMsgID == ASURA_MSG_CLIENTUPDATE, "invalid msg ID");
	Asura_Assert(!Asura_NetMsg::FindNetMsgObject(usMsgID, usEntityClassification), "already exists");

	u_char ucNumFields = GetNumFields();

	Asura_NetMsg* pxNetMsg = new Asura_NetMsg(usMsgID, usEntityClassification, ucNumFields, sizeof(AVP_Message_PlayerInfo_ClientUpdate));
	RegisterFields(pxNetMsg);
	pxNetMsg->EndRegistration();
}

void AVP_Message_PlayerInfo_ClientUpdate::RegisterFields(class Asura_NetMsg* pxNetMsg)
{
	AVP_Message_PlayerInfo_ClientUpdate xDummy;
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_uint, 		m_uPuppetGuid, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_uint,		m_uPersecutorGuid, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_char, 		m_cMultiplayerTeam, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_char, 		m_cMultiplayerRole, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_int,		m_iIndividualScore, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_int,		m_iMissionTime,	1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_int,		m_iTeamOneScore, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_int,		m_iTeamTwoScore, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_int,		m_iTeamThreeScore, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfKillsAsAlien, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfKillsAsMarine, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfKillsAsPredator, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usKillStreak, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfKillAssists, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfTimesKilled, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfHeadshots, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfTrophies, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_short, 	m_usNumberOfHeadbites, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_char,		m_bLookingAtTarget, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_vector3,	m_xLookAtTargetPos, 1, Asura_Threshold_AnyChange, 0.01f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_uint, 		m_uLookAtTargetGuid, 1, Asura_Threshold_AnyChange, 0.0f);
	Asura_NetMsg_RegisterField(pxNetMsg, xDummy, Asura_FieldType_uint, 		m_uLookAtTargetMP, 1, Asura_Threshold_AnyChange, 0.0f);
}
#endif//#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
