当前位置: 首页>>代码示例>>C++>>正文


C++ CCharacterCore::Read方法代码示例

本文整理汇总了C++中CCharacterCore::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacterCore::Read方法的具体用法?C++ CCharacterCore::Read怎么用?C++ CCharacterCore::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCharacterCore的用法示例。


在下文中一共展示了CCharacterCore::Read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Evolve

static void Evolve(CNetObj_Character *pCharacter, int Tick)
{
	CWorldCore TempWorld;
	CCharacterCore TempCore;
	mem_zero(&TempCore, sizeof(TempCore));
	TempCore.Init(&TempWorld, g_GameClient.Collision());
	TempCore.Read(pCharacter);

	while(pCharacter->m_Tick < Tick)
	{
		pCharacter->m_Tick++;
		TempCore.Tick(false);
		TempCore.Move();
		TempCore.Quantize();
	}

	TempCore.Write(pCharacter);
}
开发者ID:paaszczak,项目名称:teeworlds-neural-network,代码行数:18,代码来源:gameclient.cpp

示例2: Evolve

static void Evolve(CNetObj_Character *pCharacter, int Tick, bool PredictFreeze)
{
	CWorldCore TempWorld;
	CCharacterCore TempCore;
	CTeamsCore TempTeams;
	mem_zero(&TempCore, sizeof(TempCore));
	mem_zero(&TempTeams, sizeof(TempTeams));
	TempCore.Init(&TempWorld, g_GameClient.Collision(), &TempTeams);
	TempCore.Read(pCharacter);

	while(pCharacter->m_Tick < Tick)
	{
		pCharacter->m_Tick++;
		TempCore.Tick(false, false, PredictFreeze);
		TempCore.Move();
		TempCore.Quantize();
	}

	TempCore.Write(pCharacter);
}
开发者ID:ftk,项目名称:XXLDDRace,代码行数:20,代码来源:gameclient.cpp

示例3: RenderPlayer


//.........这里部分代码省略.........
			}
		}
		Graphics()->QuadsEnd();

		switch (Player.m_Weapon)
		{
			case WEAPON_GUN: RenderHand(&RenderInfo, p, Direction, -3*pi/4, vec2(-15, 4)); break;
			case WEAPON_SHOTGUN: RenderHand(&RenderInfo, p, Direction, -pi/2, vec2(-5, 4)); break;
			case WEAPON_GRENADE: RenderHand(&RenderInfo, p, Direction, -pi/2, vec2(-4, 7)); break;
		}

	}

	//--- Antiping
	// Draw shadows of enemy tees

	bool LocalPlayerInGame = m_pClient->m_aClients[m_pClient->m_Snap.m_LocalCid].m_Team != -1;
	bool CurPlayerIsEnemy = 
		IsTeamplay == false ||
		(IsTeamplay && m_pClient->m_aClients[m_pClient->m_Snap.m_LocalCid].m_Team != m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_Team);
	
	if (g_Config.m_AntiPing  && 
		g_Config.m_AntiPing  != 2 && // if == 2, than we should show only grenage shadows
		LocalPlayerInGame && pInfo.m_Local == false && CurPlayerIsEnemy &&
		pPlayerChar && pPlayerChar->m_PlayerState == PLAYERSTATE_PLAYING)
	{	
		CCharacterCore ShadowPlayer;
		
		CNetObj_CharacterCore buf;
		m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_Predicted.Write(&buf);
		CWorldCore world;
		ShadowPlayer.m_pWorld = &world;
		ShadowPlayer.Reset(); 
		ShadowPlayer.Read(&buf);

		CNetObj_CharacterCore next;
		ShadowPlayer.Write(&next);

		vec2 Prev = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_PreviousPrediction;
		vec2 NextVec = vec2(next.m_X, next.m_Y);
		vec2 ShadowPosition = NextVec;

		float dist = distance(NextVec, Prev);
		if (dist < 0) dist *= -1;
		if (dist < 300) // like it should be usual
			ShadowPosition = mix(Prev, NextVec, Client()->PredIntraGameTick());

		m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_PreviousPrediction = ShadowPosition;

		CTeeRenderInfo shadow = RenderInfo;
		float color_body_mix = (shadow.m_ColorBody.r + shadow.m_ColorBody.g + shadow.m_ColorBody.b) / 2.5f;
		float color_feet_mix = (shadow.m_ColorFeet.r + shadow.m_ColorFeet.g + shadow.m_ColorFeet.b) / 2.5f;
		shadow.m_ColorBody.a = 0.25f;
		shadow.m_ColorFeet.a = 0.25f;
		shadow.m_ColorBody.r = color_body_mix;
		shadow.m_ColorBody.g = color_body_mix;
		shadow.m_ColorBody.b = color_body_mix;
		shadow.m_ColorFeet.r = color_feet_mix;
		shadow.m_ColorFeet.g = color_feet_mix;
		shadow.m_ColorFeet.b = color_feet_mix;

		shadow.m_Texture = m_pClient->m_pSkins->Get(m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_SkinId)->m_ColorTexture;
		

		// Render shadow
		RenderTools()->RenderTee(&State, &shadow, Player.m_Emote, Direction, ShadowPosition); 
开发者ID:wthnonck,项目名称:tdtw,代码行数:67,代码来源:players.cpp


注:本文中的CCharacterCore::Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。