Ejemplo n.º 1
0
int CAddonCallbacksGame::OpenAudioStream(void* addonData, GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return -1;

  return gameClient->OpenAudioStream(codec, channel_map) ? 0 : -1;
}
Ejemplo n.º 2
0
void CAddonCallbacksGame::CloseStream(void* addonData, GAME_STREAM_TYPE stream)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return;

  gameClient->CloseStream(stream);
}
Ejemplo n.º 3
0
int CAddonCallbacksGame::OpenPCMStream(void* addonData, GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return -1;

  return gameClient->OpenPCMStream(format, channel_map) ? 0 : -1;
}
Ejemplo n.º 4
0
void CGameClient::cb_close_port(void* kodiInstance, unsigned int port)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return;

  gameClient->ClosePort(port);
}
Ejemplo n.º 5
0
int CGameClient::cb_open_pixel_stream(void* kodiInstance, GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return -1;

  return gameClient->OpenPixelStream(format, width, height, rotation) ? 0 : -1;
}
Ejemplo n.º 6
0
void CGameClient::cb_close_stream(void* kodiInstance, GAME_STREAM_TYPE stream)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return;

  gameClient->CloseStream(stream);
}
Ejemplo n.º 7
0
bool CGameClient::cb_open_port(void* kodiInstance, unsigned int port)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return false;

  return gameClient->OpenPort(port);
}
Ejemplo n.º 8
0
int CGameClient::cb_open_audio_stream(void* kodiInstance, GAME_AUDIO_CODEC codec, const GAME_AUDIO_CHANNEL* channel_map)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return -1;

  return gameClient->OpenAudioStream(codec, channel_map) ? 0 : -1;
}
Ejemplo n.º 9
0
void CGameClient::cb_add_stream_data(void* kodiInstance, GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return;

  gameClient->AddStreamData(stream, data, size);
}
Ejemplo n.º 10
0
bool CAddonCallbacksGame::OpenPort(void* addonData, unsigned int port)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return false;

  return gameClient->OpenPort(port);
}
Ejemplo n.º 11
0
int CGameClient::cb_open_pcm_stream(void* kodiInstance, GAME_PCM_FORMAT format, const GAME_AUDIO_CHANNEL* channel_map)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return -1;

  return gameClient->OpenPCMStream(format, channel_map) ? 0 : -1;
}
Ejemplo n.º 12
0
void CAddonCallbacksGame::ClosePort(void* addonData, unsigned int port)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return;

  gameClient->ClosePort(port);
}
Ejemplo n.º 13
0
int CAddonCallbacksGame::OpenPixelStream(void* addonData, GAME_PIXEL_FORMAT format, unsigned int width, unsigned int height, GAME_VIDEO_ROTATION rotation)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return -1;

  return gameClient->OpenPixelStream(format, width, height, rotation) ? 0 : -1;
}
Ejemplo n.º 14
0
void CAddonCallbacksGame::AddStreamData(void* addonData, GAME_STREAM_TYPE stream, const uint8_t* data, unsigned int size)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return;

  gameClient->AddStreamData(stream, data, size);
}
Ejemplo n.º 15
0
int CGameClient::cb_open_video_stream(void* kodiInstance, GAME_VIDEO_CODEC codec)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return -1;

  return gameClient->OpenVideoStream(codec) ? 0 : -1;
}
Ejemplo n.º 16
0
void CGameClient::ConchainFriendUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
	pfnCallback(pResult, pCallbackUserData);
	CGameClient *pClient = static_cast<CGameClient *>(pUserData);
	for(int i = 0; i < MAX_CLIENTS; ++i)
	{
		if(pClient->m_aClients[i].m_Active)
			pClient->m_aClients[i].m_Friend = pClient->Friends()->IsFriend(pClient->m_aClients[i].m_aName, pClient->m_aClients[i].m_aClan, true);
	}
}
Ejemplo n.º 17
0
bool CGameClient::cb_input_event(void* kodiInstance, const game_input_event* event)
{
  CGameClient *gameClient = static_cast<CGameClient*>(kodiInstance);
  if (!gameClient)
    return false;

  if (event == nullptr)
    return false;

  return gameClient->Input().ReceiveInputEvent(*event);
}
Ejemplo n.º 18
0
bool CAddonCallbacksGame::InputEvent(void* addonData, const game_input_event* event)
{
  CGameClient* gameClient = GetGameClient(addonData, __FUNCTION__);
  if (!gameClient)
    return false;

  if (event == nullptr)
    return false;

  return gameClient->ReceiveInputEvent(*event);
}
Ejemplo n.º 19
0
void CGameClient::RenderTilemapGenerateSkipThread(void *pUser)
{
    CGameClient *pSelf = (CGameClient *)pUser;
    if (pSelf->RenderTilemapGenerateSkipThreadStatus == 1)
    {
        return;
    }
    pSelf->RenderTilemapGenerateSkipThreadStatus = 1;
    pSelf->RenderTools()->RenderTilemapGenerateSkip(pSelf->Layers());
    pSelf->RenderTilemapGenerateSkipThreadStatus = 0;
}
Ejemplo n.º 20
0
CClientFrame *CGameClient::GetSendFrame()
{
	CClientFrame *pFrame = m_pCurrentFrame;

	// just return if replay is disabled
	if ( sv_maxreplay.GetFloat() <= 0 )
		return pFrame;
			
	int followEntity;

	int delayTicks = serverGameClients->GetReplayDelay( edict, followEntity );

	bool isInReplayMode = ( delayTicks > 0 );

	if ( isInReplayMode != m_bIsInReplayMode )
	{
		// force a full update when modes are switched
		m_nDeltaTick = -1; 

		m_bIsInReplayMode = isInReplayMode;

		if ( isInReplayMode )
		{
			m_nEntityIndex = followEntity;
		}
		else
		{
			m_nEntityIndex = m_nClientSlot+1;
		}
	}

	Assert( (m_nClientSlot+1 == m_nEntityIndex) || isInReplayMode );

	if ( isInReplayMode )
	{
		CGameClient *pFollowPlayer = sv.Client( followEntity-1 );

		if ( !pFollowPlayer )
			return NULL;

		pFrame = pFollowPlayer->GetClientFrame( sv.GetTick() - delayTicks, false );

		if ( !pFrame )
			return NULL;

		if ( m_pLastSnapshot == pFrame->GetSnapshot() )
			return NULL;
	}

	return pFrame;
}
Ejemplo n.º 21
0
ControllerVector CGameClientInput::GetControllers(const CGameClient &gameClient)
{
  using namespace ADDON;

  ControllerVector controllers;

  CGameServices& gameServices = CServiceBroker::GetGameServices();

  const auto& dependencies = gameClient.GetDependencies();
  for (auto it = dependencies.begin(); it != dependencies.end(); ++it)
  {
    ControllerPtr controller = gameServices.GetController(it->id);
    if (controller)
      controllers.push_back(controller);
  }

  if (controllers.empty())
  {
    // Use the default controller
    ControllerPtr controller = gameServices.GetDefaultController();
    if (controller)
      controllers.push_back(controller);
  }

  return controllers;
}
Ejemplo n.º 22
0
void CGameClient::ConchainUpdateSkinParts(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
	pfnCallback(pResult, pCallbackUserData);
	CGameClient *pSelf = (CGameClient*)pUserData;
	if(pResult->NumArguments() && pSelf->m_pSkins->Num() > 0)
	{
		int SkinID = pSelf->m_pSkins->Find(g_Config.m_PlayerSkin);
		const CSkins::CSkin *s = pSelf->m_pSkins->Get(SkinID);
		for(int p = 0; p < NUM_SKINPARTS; p++)
		{
			mem_copy(gs_apSkinVariables[p], s->m_apParts[p]->m_aName, 24);
			*gs_apUCCVariables[p] = s->m_aUseCustomColors[p];
			*gs_apColorVariables[p] = s->m_aPartColors[p];
		}
		pSelf->SendInfo(false);
	}
}
Ejemplo n.º 23
0
CClientFrame *CGameClient::GetDeltaFrame( int nTick )
{
#ifndef _XBOX
	Assert ( !IsHLTV() ); // has no ClientFrames
#endif	

	if ( m_bIsInReplayMode )
	{
		int followEntity; 

		serverGameClients->GetReplayDelay( edict, followEntity );

		Assert( followEntity > 0 );

		CGameClient *pFollowEntity = sv.Client( followEntity-1 );

		if ( pFollowEntity )
			return pFollowEntity->GetClientFrame( nTick );
	}

	return GetClientFrame( nTick );
}
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);
}
Ejemplo n.º 25
0
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);
}
Ejemplo n.º 26
0
//-----------------------------------------------------------------------------
// Purpose: Fills buffer with details on everyone in the server
//-----------------------------------------------------------------------------
void CServerRemoteAccess::GetPlayerList(CUtlBuffer &value)
{
	if ( !serverGameClients )
	{
		return;
	}

	for ( int i=0 ; i< sv.GetClientCount() ; i++ )
	{
		CGameClient *client = sv.Client(i);
		if ( !client || !client->IsActive() )
			continue;

		CPlayerState *pl = serverGameClients->GetPlayerState( client->edict );
		if ( !pl )
			continue;

		// valid user, add to buffer
		// format per user, each user seperated by a newline '\n'
		//      "name authID ipAddress ping loss frags time"
		if ( client->IsFakeClient() )
		{
			value.Printf("\"%s\" %s 0 0 0 %d 0\n",
				client->GetClientName(),
				client->GetNetworkIDString(),
				pl->frags);
		}
		else
		{
			value.Printf("\"%s\" %s %s %d %d %d %d\n", 
				client->GetClientName(),
				client->GetNetworkIDString(),
				client->GetNetChannel()->GetAddress(),
				(int)(client->GetNetChannel()->GetAvgLatency(FLOW_OUTGOING) * 1000.0f),
				(int)(client->GetNetChannel()->GetAvgLoss(FLOW_INCOMING)),
				pl->frags,
				(int)(client->GetNetChannel()->GetTimeConnected()));
		}
	}

	value.PutChar(0);
}