void xrServer::Process_save(NET_Packet& P, ClientID sender)
{
    xrClientData* CL		= ID_to_client(sender);
    if (CL)	CL->net_Ready	= TRUE;

    R_ASSERT(CL->flags.bLocal);
    // while has information
    while (!P.r_eof())
    {
        // find entity
        u16				ID;
        u16				size;

        P.r_u16			(ID);
        P.r_u16			(size);
        s32				_pos_start	= P.r_tell	();
        CSE_Abstract	*E	= ID_to_entity(ID);

        if (E) {
            E->net_Ready = TRUE;
            E->load		(P);
        }
        else
            P.r_advance	(size);
        s32				_pos_end	= P.r_tell	();
        s32				_size		= size;
        if				(_size != (_pos_end-_pos_start))	{
            Msg			("! load/save mismatch, object: '%s'",E?E->name_replace():"unknown");
            s32			_rollback	= _pos_start+_size;
            P.r_seek	(_rollback);
        }
    }
}
void CWeaponMagazinedWGrenade::OnEvent(NET_Packet& P, u16 type) 
{
	inherited::OnEvent(P,type);
	u16 id;
	switch (type) 
	{
		case GE_OWNERSHIP_TAKE: 
			{
				P.r_u16(id);
				CRocketLauncher::AttachRocket(id, this);
			}
			break;
		case GE_OWNERSHIP_REJECT :
		case GE_LAUNCH_ROCKET : 
			{
				bool bLaunch	= (type==GE_LAUNCH_ROCKET);
				P.r_u16			(id);
				CRocketLauncher::DetachRocket(id, bLaunch);
				if(bLaunch)
				{
					PlayAnimShoot		();
					PlaySound			("sndShotG", get_LastFP2());
					AddShotEffector		();
					StartFlameParticles2();
				}
				break;
			}
	}
}
Beispiel #3
0
void CAI_Trader::OnEvent		(NET_Packet& P, u16 type)
{
	inherited::OnEvent			(P,type);
	CInventoryOwner::OnEvent	(P,type);

	u16 id;
	CObject* Obj;

	switch (type) {
		case GE_TRADE_BUY:
		case GE_OWNERSHIP_TAKE:
			P.r_u16		(id);
			Obj = Level().Objects.net_Find	(id);
			if(inventory().CanTakeItem(smart_cast<CInventoryItem*>(Obj))){
				Obj->H_SetParent(this);
				inventory().Take(smart_cast<CGameObject*>(Obj), false, false);
			}else
			{
				NET_Packet				P;
				u_EventGen				(P,GE_OWNERSHIP_REJECT,ID());
				P.w_u16					(u16(Obj->ID()));
				u_EventSend				(P);
			}
			break;
		case GE_TRADE_SELL:
		case GE_OWNERSHIP_REJECT:
			P.r_u16		(id);
			Obj = Level().Objects.net_Find	(id);
			if(inventory().Drop(smart_cast<CGameObject*>(Obj))) 
				Obj->H_SetParent(0,!P.r_eof() && P.r_u8());
			break;
		case GE_TRANSFER_AMMO:
			break;
	}
}
Beispiel #4
0
void	game_PlayerState::net_Import(NET_Packet& P)
{
	BOOL	bFullUpdate = !!P.r_u8();

	if (bFullUpdate)
		P.r_stringZ		(name);


	P.r_u8			(	team			);
	
	P.r_s16			(	m_iRivalKills	);
	P.r_s16			(	m_iSelfKills	);
	P.r_s16			(	m_iTeamKills	);
	P.r_s16			(	m_iDeaths		);

	P.r_s32			(	money_for_round	);
	P.r_float_q8	(	experience_D, -1.0f, 2.0f);
	P.r_u8			(	rank		);
	P.r_u8			(	af_count	);
	P.r_u16			(	flags__	);
	P.r_u16			(	ping	);

	P.r_u16			(	GameID	);
	P.r_s8			(	skin	);
	P.r_u8			(	m_bCurrentVoteAgreed	);

	DeathTime = P.r_u32();
};
Beispiel #5
0
void CInventoryBox::OnEvent(NET_Packet& P, u16 type)
{
	inherited::OnEvent	(P, type);

	switch (type)
	{
	case GE_OWNERSHIP_TAKE:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			m_items.push_back	(id);
			itm->H_SetParent	(this);
			itm->setVisible		(FALSE);
			itm->setEnabled		(FALSE);
		}break;
	case GE_OWNERSHIP_REJECT:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			xr_vector<u16>::iterator it;
			it = std::find(m_items.begin(),m_items.end(),id); VERIFY(it!=m_items.end());
			m_items.erase		(it);
			itm->H_SetParent	(NULL,!P.r_eof() && P.r_u8());

			if( m_in_use )
			{
				CGameObject* GO		= smart_cast<CGameObject*>(itm);
				Actor()->callback(GameObject::eInvBoxItemTake)( this->lua_game_object(), GO->lua_game_object() );
			}
		}break;
	};
}
Beispiel #6
0
void SHit::Read_Packet				(NET_Packet	Packet)
{
	u16 type_dummy;	
	Packet.r_begin			(type_dummy);
	Packet.r_u32			(Time);
	Packet.r_u16			(PACKET_TYPE);
	Packet.r_u16			(DestID);
	Read_Packet_Cont		(Packet);
};
void game_cl_TeamDeathmatch::TranslateGameMessage	(u32 msg, NET_Packet& P)
{
	CStringTable st;
	string512 Text;
//	LPSTR	Color_Teams[3]	= {"%c[255,255,255,255]", "%c[255,64,255,64]", "%c[255,64,64,255]"};
	char	Color_Main[]	= "%c[255,192,192,192]";
//	LPSTR	TeamsNames[3]	= {"Zero Team", "Team Green", "Team Blue"};

	switch(msg)	{
	case GAME_EVENT_PLAYER_JOIN_TEAM: //tdm
		{
			string64 PlayerName;
			P.r_stringZ	(PlayerName);
			u16 Team;
			P.r_u16		(Team);

			sprintf_s(Text, "%s%s %s%s %s%s",
							"",//no color
							PlayerName,
							Color_Main,
							*st.translate("mp_joined"),
							CTeamInfo::GetTeam_color_tag(int(Team)),							
							CTeamInfo::GetTeam_name(int(Team)));
			CommonMessageOut(Text);
			//---------------------------------------
			Msg("%s %s %s", PlayerName, *st.translate("mp_joined"),
				CTeamInfo::GetTeam_name(int(Team)));
		}break;

	case PLAYER_CHANGE_TEAM://tdm
		{
			u16 PlayerID, OldTeam, NewTeam;
			P.r_u16 (PlayerID);
			P.r_u16 (OldTeam);
			P.r_u16 (NewTeam);

			game_PlayerState* pPlayer = GetPlayerByGameID(PlayerID);
			if (!pPlayer) break;

			sprintf_s(Text, "%s%s %s%s %s%s", 
							CTeamInfo::GetTeam_color_tag(int(OldTeam)), 
							pPlayer->name, 
							Color_Main, 
							*st.translate("mp_switched_to"),
							CTeamInfo::GetTeam_color_tag(int(NewTeam)), 
							CTeamInfo::GetTeam_name(int(NewTeam)));
			CommonMessageOut(Text);
			//---------------------------------------
			Msg("%s *s %s", pPlayer->name, *st.translate("mp_switched_to"), CTeamInfo::GetTeam_name(int(NewTeam)));
		}break;

	default:
		inherited::TranslateGameMessage(msg,P);
	};
}
Beispiel #8
0
void CHelicopter::OnEvent(	NET_Packet& P, u16 type) 
{
	inherited::OnEvent(P,type);
	CExplosive::OnEvent(P,type);
	u16 id;
	switch (type) {
		case GE_OWNERSHIP_TAKE : {
			P.r_u16(id);
			CRocketLauncher::AttachRocket(id, this);
								 } break;
		case GE_OWNERSHIP_REJECT : {
			P.r_u16(id);
			CRocketLauncher::DetachRocket(id);
								   } break;
	}
}
Beispiel #9
0
void CInventoryItem::net_Import			(NET_Packet& P) 
{	
	P.r_float							(m_fCondition)	;
	net_update_IItem	N								;
	N.dwTimeStamp=P.r_u32										(  );
	u16	NumItems = 0;
	NumItems=P.r_u16					( );
	if (CSE_ALifeInventoryItem::FLAG_NO_POSITION != NumItems)
		N.State.position=P.r_vec3			();

	if (!NumItems || (CSE_ALifeInventoryItem::FLAG_NO_POSITION == NumItems)) return;
	position_Import						(P,N)			;
	net_updateData		*p				= NetSync()		;

	if (	!p->NET_IItem.empty() && 
			(p->NET_IItem.back().dwTimeStamp>=N.dwTimeStamp)) 
	return;

	if (!p->NET_IItem.empty()){
		m_flags.set						(FInInterpolate, TRUE);
//		m_bInterpolate = true;
	}

	Level().AddObject_To_Objects4CrPr		(m_object);
	object().CrPr_SetActivated				(false);
	object().CrPr_SetActivationStep			(0);

	p->NET_IItem.push_back					(N);
	while (p->NET_IItem.size() > 2)
	{
		p->NET_IItem.pop_front				();
	};
};
Beispiel #10
0
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
	switch (type)
	{
	case GE_ADDON_ATTACH:
		{
			u16 ItemID;
			P.r_u16			(ItemID);
			CInventoryItem*	 ItemToAttach	= smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
			if (!ItemToAttach) break;
			Attach(ItemToAttach,true);
		}break;
	case GE_ADDON_DETACH:
		{
			string64			i_name;
			P.r_stringZ			(i_name);
			Detach(i_name, true);
		}break;	
	case GE_CHANGE_POS:
		{
			Fvector p; 
			P.r_vec3(p);
			CPHSynchronize* pSyncObj = NULL;
			pSyncObj = object().PHGetSyncItem(0);
			if (!pSyncObj) return;
			SPHNetState state;
			pSyncObj->get_State(state);
			state.position = p;
			state.previous_position = p;
			pSyncObj->set_State(state);

		}break;
	}
}
Beispiel #11
0
void game_cl_Deathmatch::net_import_state	(NET_Packet& P)
{
	inherited::net_import_state	(P);

	m_s32FragLimit				= P.r_s32();
	m_s32TimeLimit				= P.r_s32() * 60000;
	m_u32ForceRespawn			= P.r_u32() * 1000;
	m_cl_dwWarmUp_Time			= P.r_u32();
	m_bDamageBlockIndicators	= !!P.r_u8();
	// Teams
	u16							t_count;
	P.r_u16						(t_count);
	teams.clear					();

	for (u16 t_it=0; t_it<t_count; ++t_it)
	{
		game_TeamState	ts;
		P.r				(&ts,sizeof(game_TeamState));
		teams.push_back	(ts);
	};

	switch (Phase())
	{
	case GAME_PHASE_PLAYER_SCORES:
		{
			P.r_stringZ(WinnerName);
			bool NeedSndMessage = (xr_strlen(WinnerName) != 0);
			if (NeedSndMessage && local_player && !xr_strcmp(WinnerName, local_player->getName()))
			{
				PlaySndMessage(ID_YOU_WON);
			}
		}break;
	}
}
Beispiel #12
0
void CCar::OnEvent(NET_Packet& P, u16 type)
{
	inherited::OnEvent		(P,type);
	CExplosive::OnEvent		(P,type);

	//обработка сообщений, нужных для работы с багажником машины
	u16 id;
	switch (type)
	{
	case GE_OWNERSHIP_TAKE:
		{
			P.r_u16		(id);
			CObject* O	= Level().Objects.net_Find	(id);
			if( GetInventory()->CanTakeItem(smart_cast<CInventoryItem*>(O)) ) 
			{
				O->H_SetParent(this);
				GetInventory()->Take(smart_cast<CGameObject*>(O), false, false);
			}
			else 
			{
				if (!O || !O->H_Parent() || (this != O->H_Parent())) return;
				NET_Packet P;
				u_EventGen(P,GE_OWNERSHIP_REJECT,ID());
				P.w_u16(u16(O->ID()));
				u_EventSend(P);
			}
		}break;
	case GE_OWNERSHIP_REJECT:
		{
			P.r_u16		(id);
			CObject* O	= Level().Objects.net_Find	(id);

			bool just_before_destroy		= !P.r_eof() && P.r_u8();
			O->SetTmpPreDestroy				(just_before_destroy);
			GetInventory()->DropItem(smart_cast<CGameObject*>(O), just_before_destroy, just_before_destroy);
			//if(GetInventory()->DropItem(smart_cast<CGameObject*>(O), just_before_destroy)) 
			//{
			//	O->H_SetParent(0, just_before_destroy);
			//}
			//moved to DropItem
		}break;
	}

}
Beispiel #13
0
void CPHSkeleton::LoadNetState(NET_Packet& P)
{
	CPhysicsShellHolder* obj=PPhysicsShellHolder();
	IKinematics* K=smart_cast<IKinematics*>(obj->Visual());
	P.r_u8 (m_flags.flags);
	if(K)
	{
		K->LL_SetBonesVisible(P.r_u64());
		K->LL_SetBoneRoot(P.r_u16());
	}

	u16 bones_number=P.r_u16();
	for(u16 i=0;i<bones_number;i++)
	{
		SPHNetState state;
		state.net_Load(P);
		obj->PHGetSyncItem(i)->set_State(state);
	}
}
void CSE_ALifeItem::STATE_Read				(NET_Packet &tNetPacket, u16 size)
{
	inherited1::STATE_Read		(tNetPacket, size);
	if ((m_tClassID == CLSID_OBJECT_W_BINOCULAR) && (m_wVersion < 37)) {
		tNetPacket.r_u16		();
		tNetPacket.r_u16		();
		tNetPacket.r_u8			();
	}
	inherited2::STATE_Read		(tNetPacket, size);
}
void game_cl_ArtefactHunt::net_import_state	(NET_Packet& P)
{
	inherited::net_import_state	(P);
	
	P.r_u8	(artefactsNum);
	P.r_u16	(artefactBearerID);
	P.r_u8	(teamInPossession);
	P.r_u16	(artefactID);
	bBearerCantSprint = !!P.r_u8();

	iReinforcementTime = P.r_s32();
	if (iReinforcementTime > 0)
	{
		P.r_s32	(dReinforcementTime);
		dReinforcementTime += Level().timeServer();
	}
	else
		dReinforcementTime = 0;
}
Beispiel #16
0
void SPHBonesData::net_Load(NET_Packet &P)
{
	bones.clear					();

	bones_mask					=P.r_u64();
	root_bone					=P.r_u16();
	Fvector						_mn, _mx;
	P.r_vec3					(_mn);
	P.r_vec3					(_mx);
	set_min_max					(_mn, _mx);

	u16 bones_number			=P.r_u16();//bones number /**/
	for(int i=0;i<bones_number;i++)
	{
		SPHNetState	S;
		S.net_Load(P,get_min(),get_max());
		bones.push_back(S);
	}
}
Beispiel #17
0
void CWeaponRPG7::OnEvent(NET_Packet& P, u16 type) 
{
	inherited::OnEvent(P,type);
	u16 id;
	switch (type) {
		case GE_OWNERSHIP_TAKE : {
			P.r_u16(id);
			CRocketLauncher::AttachRocket(id, this);
		} break;
		case GE_OWNERSHIP_REJECT:
		case GE_LAUNCH_ROCKET	: 
			{
			bool bLaunch = (type==GE_LAUNCH_ROCKET);
			P.r_u16(id);
			CRocketLauncher::DetachRocket(id, bLaunch);
			if(bLaunch)
				UpdateMissileVisibility();
		} break;
	}
}
Beispiel #18
0
void CWeapon::net_Import(NET_Packet& P)
{
	inherited::net_Import (P);
	
	float _cond;
	P.r_float_q8			(_cond,0.0f,1.0f);
	SetCondition			(_cond);

	u8 flags				= 0;
	P.r_u8					(flags);

	u16 ammo_elapsed = 0;
	P.r_u16					(ammo_elapsed);

	u8						NewAddonState;
	P.r_u8					(NewAddonState);

	m_flagsAddOnState		= NewAddonState;
	UpdateAddonsVisibility	();

	u8 ammoType, wstate;
	P.r_u8					(ammoType);
	P.r_u8					(wstate);

	u8 Zoom;
	P.r_u8					((u8)Zoom);

	if (H_Parent() && H_Parent()->Remote())
	{
		if (Zoom) OnZoomIn();
		else OnZoomOut();
	};
	switch (wstate)
	{	
	case eFire:
	case eFire2:
	case eSwitch:
	case eReload:
		{
		}break;	
	default:
		{
			if (ammoType >= m_ammoTypes.size())
				Msg("!! Weapon [%d], State - [%d]", ID(), wstate);
			else
			{
				m_ammoType = ammoType;
				SetAmmoElapsed((ammo_elapsed));
			}
		}break;
	}
	
	VERIFY((u32)iAmmoElapsed == m_magazine.size());
}
void CSE_ALifeItemDocument::STATE_Read		(NET_Packet	&tNetPacket, u16 size)
{
	inherited::STATE_Read		(tNetPacket,size);

	if ( m_wVersion < 98  ){
		u16 tmp;
		tNetPacket.r_u16			(tmp);
		m_wDoc = NULL;
	}else
		tNetPacket.r_stringZ		(m_wDoc);
}
void CSE_ALifeItemWeapon::UPDATE_Read(NET_Packet	&tNetPacket)
{
	inherited::UPDATE_Read		(tNetPacket);

	tNetPacket.r_float_q8		(m_fCondition,0.0f,1.0f);
	tNetPacket.r_u8				(wpn_flags);
	tNetPacket.r_u16			(a_elapsed);
	tNetPacket.r_u8				(m_addon_flags.flags);
	tNetPacket.r_u8				(ammo_type);
	tNetPacket.r_u8				(wpn_state);
	tNetPacket.r_u8				(m_bZoom);
}
Beispiel #21
0
void CMPPlayersBag::OnEvent(NET_Packet& P, u16 type) 
{
	CInventoryItemObject::OnEvent		(P,type);
	u16						id;
	switch (type) {
		case GE_OWNERSHIP_TAKE : 
			{
				P.r_u16(id);
				CObject* O = Level().Objects.net_Find(id);
				O->H_SetParent(this);
				O->Position().set(Position());
			}break;
		case GE_OWNERSHIP_REJECT : 
			{
				P.r_u16			(id);
				CObject* O = Level().Objects.net_Find(id);
				O->H_SetParent(0,!P.r_eof() && P.r_u8());
			}break;

	}
}
void CSE_ALifeItemWeapon::STATE_Read(NET_Packet	&tNetPacket, u16 size)
{
	inherited::STATE_Read		(tNetPacket, size);
	tNetPacket.r_u16			(a_current);
	tNetPacket.r_u16			(a_elapsed);
	tNetPacket.r_u8				(wpn_state);
	
	if (m_wVersion > 40)
		tNetPacket.r_u8			(m_addon_flags.flags);

	if (m_wVersion > 46)
		tNetPacket.r_u8			(ammo_type);
}
void game_sv_CaptureTheArtefact::OnEvent(NET_Packet & tNetPacket, u16 type, u32 time, ClientID sender )
{
	switch	(type)
	{
	case GAME_EVENT_PLAYER_KILL:
		{
			u16				ID = tNetPacket.r_u16();
			xrClientData*	l_pC = (xrClientData*)get_client(ID);
			if (!l_pC)
				break;

			KillPlayer		(l_pC->ID, l_pC->ps->GameID);
		}break;
	case GAME_EVENT_PLAYER_BUY_FINISHED:
		{
			xrClientData* l_pC = m_server->ID_to_client(sender);
			OnPlayerBuyFinished(l_pC->ID, tNetPacket);
		}break;
	case GAME_EVENT_PLAYER_ENTER_TEAM_BASE:
		{
			u16 pl_id = tNetPacket.r_u16();
			//warning, in editor green team zone has 1 id, blue team zone has id 2
			u8 z_t_id = tNetPacket.r_u8();
			z_t_id--; // :( !!!
			OnObjectEnterTeamBase(pl_id, z_t_id);
		}break;

	case GAME_EVENT_PLAYER_LEAVE_TEAM_BASE:
		{
 			u16 pl_id = tNetPacket.r_u16();
			u8 z_t_id = tNetPacket.r_u8();
			z_t_id--;						// :( !!!
			OnObjectLeaveTeamBase(pl_id, z_t_id);
		}break;
	default:
		inherited::OnEvent(tNetPacket, type, time, sender);
	};//switch
}
Beispiel #24
0
void SHit::Read_Packet_Cont		(NET_Packet	Packet)
{

	Packet.r_u16			(whoID);
	Packet.r_u16			(weaponID);
	Packet.r_dir			(dir);
	Packet.r_float			(power);
	Packet.r_u16			(boneID);
	Packet.r_vec3			(p_in_bone_space);
	Packet.r_float			(impulse);
	aim_bullet				= Packet.r_u16()!=0;
	hit_type				= (ALife::EHitType)Packet.r_u16();	//hit type

	if (hit_type == ALife::eHitTypeFireWound)
	{
		Packet.r_float	(ap);
	}
	if (PACKET_TYPE == GE_HIT_STATISTIC)
	{
		Packet.r_u32(BulletID);
		Packet.r_u32(SenderID);
	}
}
void xrServer::Process_update(NET_Packet& P, ClientID sender)
{
    xrClientData* CL		= ID_to_client(sender);
    if (!CL)
    {
        return;
    }
//	if (CL)	CL->net_Ready	= TRUE;

#ifdef DEBUG
    if (g_Dump_Update_Read) Msg("---- UPDATE_Read --- ");
#endif						// Entities

    R_ASSERT(CL->flags.bLocal);
    // while has information
    while (!P.r_eof())
    {
        // find entity
        u16				ID;
        u8				size;

        P.r_u16			(ID);
        P.r_u8			(size);
        u32	_pos		= P.r_tell();
        CSE_Abstract	*E	= ID_to_entity(ID);

        if (E) {
            //Msg				("sv_import: %d '%s'",E->ID,E->name_replace());
            E->net_Ready	= TRUE;
            E->UPDATE_Read	(P);
#ifdef DEBUG
            if (g_Dump_Update_Read) Msg("* %s : %d - %d", E->name(), size, P.r_tell() - _pos);
#endif

            if ((P.r_tell()-_pos) != size)	{
                string16	tmp;
                CLSID2TEXT	(E->m_tClassID,tmp);
                Debug.fatal	(DEBUG_INFO,"Beer from the creator of '%s'",tmp);
            }
        }
        else
            P.r_advance	(size);
    }
#ifdef DEBUG
    if (g_Dump_Update_Read) Msg("-------------------- ");
#endif						// Entities

}
Beispiel #26
0
void CLevel::cl_Process_Event				(u16 dest, u16 type, NET_Packet& P)
{
	//			Msg				("--- event[%d] for [%d]",type,dest);
	CObject*	 O	= Objects.net_Find	(dest);
	if (0==O)		{
#ifdef DEBUG
		Msg("* WARNING: c_EVENT[%d] to [%d]: unknown dest",type,dest);
#endif // DEBUG
		return;
	}
	CGameObject* GO = smart_cast<CGameObject*>(O);
	if (!GO)		{
		Msg("! ERROR: c_EVENT[%d] : non-game-object",dest);
		return;
	}
	if (type != GE_DESTROY_REJECT)
	{
		if (type == GE_DESTROY)
			Game().OnDestroy(GO);
		GO->OnEvent		(P,type);
	}
	else { // handle GE_DESTROY_REJECT here
		u32				pos = P.r_tell();
		u16				id = P.r_u16();
		P.r_seek		(pos);

		bool			ok = true;

		CObject			*D	= Objects.net_Find	(id);
		if (0==D)		{
			Msg			("! ERROR: c_EVENT[%d] : unknown dest",id);
			ok			= false;
		}

		CGameObject		*GD = smart_cast<CGameObject*>(D);
		if (!GD)		{
			Msg			("! ERROR: c_EVENT[%d] : non-game-object",id);
			ok			= false;
		}

		GO->OnEvent		(P,GE_OWNERSHIP_REJECT);
		if (ok)
		{
			Game().OnDestroy(GD);
			GD->OnEvent	(P,GE_DESTROY);
		};
	}
};
Beispiel #27
0
void CExplosive::OnEvent(NET_Packet& P, u16 type) 
{
	switch (type) {
		case GE_GRENADE_EXPLODE : {
			Fvector pos, normal;
			u16 parent_id;
			P.r_u16(parent_id);
			P.r_vec3(pos);
			P.r_vec3(normal);
			
			SetInitiator(parent_id);
			ExplodeParams(pos,normal);
			Explode();
			m_fExplodeDuration = m_fExplodeDurationMax;
			break;
		}
	}
}
Beispiel #28
0
void CBaseMonster::OnEvent(NET_Packet& P, u16 type)
{
	inherited::OnEvent			(P,type);

	u16			id;
	switch (type)
	{
	case GE_KILL_SOMEONE:
		P.r_u16		(id);
		CObject* O	= Level().Objects.net_Find	(id);

		if (O)  {
			CEntity *pEntity = smart_cast<CEntity*>(O);
			if (pEntity) on_kill_enemy(pEntity);
		}
			
		break;
	}
}
void	CSE_Abstract::load			(NET_Packet	&tNetPacket)
{
	CPureServerObject::load		(tNetPacket);
	u16 client_data_size		= (m_wVersion > 93) ? tNetPacket.r_u16() : tNetPacket.r_u8(); //не может быть больше 256 байт
	if (client_data_size > 0) {
#ifdef DEBUG
//		Msg						("SERVER:loading:load:%d bytes:%d:%s",client_data_size,ID,s_name_replace ? s_name_replace : "");
#endif // DEBUG
		client_data.resize		(client_data_size);
		tNetPacket.r			(&*client_data.begin(),client_data_size);
	}
	else {
#ifdef DEBUG
		if (!client_data.empty())
			Msg					("CSE_Abstract::load: client_data is cleared for [%d][%s]",ID,name_replace());
#endif // DEBUG
        client_data.clear		();
	}
}
Beispiel #30
0
void message_filter::msg_type_subtype_t::import(NET_Packet& packet)
{
	packet.r_begin	(msg_type);
	msg_subtype		= 0;
	switch (msg_type)
	{
	case M_EVENT:
		{
			u16				tmp_subtype;
			packet.r_u32			(msg_receive_time);
			packet.r_u16			(tmp_subtype);
			packet.r_u16			(dest_obj_id);
			msg_subtype		= static_cast<u32>(tmp_subtype);
		}break;
	case M_GAMEMESSAGE:
		{
			packet.r_u32			(msg_subtype);
		}break;
	};//switch (msg_type)
}