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


C++ Q_memset函数代码示例

本文整理汇总了C++中Q_memset函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_memset函数的具体用法?C++ Q_memset怎么用?C++ Q_memset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: RemoveExtDll_api

void EXT_FUNC RemoveExtDll_api(void *hModule)
{
	if (!hModule) {
		return;
	}

	for (auto i = 0; i < g_iextdllMac; i++)
	{
		if (g_rgextdll[i].lDLLHandle == hModule)
		{
			g_iextdllMac--;
			if (g_iextdllMac != i)
			{
				Q_memmove(&g_rgextdll[i], &g_rgextdll[i + 1], (g_iextdllMac - i) * sizeof(g_rgextdll[0]));
				i = g_iextdllMac;
			}

			Q_memset(&g_rgextdll[i], 0, sizeof(g_rgextdll[0]));
			break;
		}
	}
}
开发者ID:dreamstalker,项目名称:rehlds,代码行数:22,代码来源:rehlds_api_impl.cpp

示例2: Q_memset

CBugReporter::CBugReporter()
{
	Q_memset( &m_cserIP, 0, sizeof( m_cserIP ) );
	m_pBug = NULL;

	m_Severity.AddToTail( m_BugStrings.AddString( "Zero" ) );
	m_Severity.AddToTail( m_BugStrings.AddString( "Low" ) );
	m_Severity.AddToTail( m_BugStrings.AddString( "Medium" ) );
	m_Severity.AddToTail( m_BugStrings.AddString( "High" ) );
	m_Severity.AddToTail( m_BugStrings.AddString( "Showstopper" ) );

	
	m_ReportType.AddToTail( m_BugStrings.AddString( "<<Choose Item>>" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Video / Display Problems" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Network / Connectivity Problems" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Download / Installation Problems" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "In-game Crash" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Game play / Strategy Problems" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Steam Problems" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Unlisted Bug" ) );
	m_ReportType.AddToTail( m_BugStrings.AddString( "Feature Request / Suggestion" ) );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:22,代码来源:bugreporter_public.cpp

示例3: Bot_Think

//-----------------------------------------------------------------------------
// Run this Bot's AI for one frame.
//-----------------------------------------------------------------------------
void Bot_Think( CPluginBot *pBot )
{
	CBotCmd cmd;
	Q_memset( &cmd, 0, sizeof( cmd ) );
	
	// Finally, override all this stuff if the bot is being forced to mimic a player.
	if ( !Bot_RunMimicCommand( cmd ) )
	{
		cmd.sidemove = pBot->m_flSideMove;

		if ( !pBot->m_PlayerInfo->IsDead() )
		{
			Bot_SetForwardMovement( pBot, cmd );

			// Only turn if I haven't been hurt
			if ( !pBot->m_BotInterface->IsEFlagSet(EFL_BOT_FROZEN) && pBot->m_PlayerInfo->GetHealth() == 100 )
			{
				Bot_UpdateDirection( pBot );
				Bot_UpdateStrafing( pBot, cmd );
			}

			// Handle console settings.
			Bot_ForceFireWeapon( pBot, cmd );
			Bot_HandleSendCmd( pBot );
		}
		else
		{
			Bot_HandleRespawn( pBot, cmd );
		}

		Bot_FlipOut( pBot, cmd );

		cmd.viewangles = pBot->m_BotInterface->GetLocalAngles();
		cmd.upmove = 0;
		cmd.impulse = 0;
	}

	pBot->m_BotInterface->RunPlayerMove( &cmd );
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:42,代码来源:serverplugin_bot.cpp

示例4: CL_BaseMove

/*
================
CL_BaseMove

Send the intended movement message to the server
================
*/
void CL_BaseMove (usercmd_t *cmd)
{
	if (cls.signon != SIGNONS)
		return;

	CL_AdjustAngles ();

	Q_memset (cmd, 0, sizeof(*cmd));

	if (in_strafe.state & 1)
	{
		cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
		cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_left);
	}

	cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_moveright);
	cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_moveleft);

	cmd->upmove += cl_upspeed.value * CL_KeyState (&in_up);
	cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);

	if (! (in_klook.state & 1) )
	{
		cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
		cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
	}

//
// adjust for speed key
//
	if (cl_forwardspeed.value > 200 && cl_movespeedkey.value)
		cmd->forwardmove /= cl_movespeedkey.value;
	if ((cl_forwardspeed.value > 200) ^ (in_speed.state & 1))
	{
		cmd->forwardmove *= cl_movespeedkey.value;
		cmd->sidemove *= cl_movespeedkey.value;
		cmd->upmove *= cl_movespeedkey.value;
	}
}
开发者ID:Darktori,项目名称:vkQuake,代码行数:46,代码来源:cl_input.c

示例5: MIN

void CTilegenAction_PlaceComponent::OnBeginGeneration( CLayoutSystem *pLayoutSystem )
{
	int nNumOptionalRooms = pLayoutSystem->GetRandomInt( m_nMinOptionalRooms, m_nMaxOptionalRooms );
	nNumOptionalRooms = MIN( nNumOptionalRooms, m_OptionalRooms.Count() );
	nNumOptionalRooms = MAX( nNumOptionalRooms, 0 );

	m_RoomsToPlace.RemoveAll();
	for ( int i = 0; i < m_MandatoryRooms.Count(); ++ i )
	{
		AddRoomPlacementInstance( pLayoutSystem, &m_MandatoryRooms[i] );
	}

	bool isRoomChosen[m_nMaxTotalOptionalRooms];
	Q_memset( isRoomChosen, 0, sizeof( isRoomChosen ) );

	// Simplest but probably not the most efficient way to randomly choose N rooms from a list of X rooms.
	int nNumOptionalRoomsChosen = 0;
	Msg("Processing random rooms, need to add [%d] rooms.  Have [%d] options\n",nNumOptionalRooms, m_OptionalRooms.Count());
	Log_Msg(LOG_TilegenLayoutSystem, "Processing random rooms, need to add [%d] rooms.  Have [%d] options\n",nNumOptionalRooms, m_OptionalRooms.Count());
		
	while ( nNumOptionalRoomsChosen < nNumOptionalRooms )
	{

		//BUG: int nRoom = pLayoutSystem->GetRandomInt( 0, nNumOptionalRooms - 1 );
		//Should choose from all available rooms.
		int nRoom = pLayoutSystem->GetRandomInt( 0, m_OptionalRooms.Count() -1);
			
		if ( !isRoomChosen[nRoom] )
		{
			
			isRoomChosen[nRoom] = true;
			AddRoomPlacementInstance( pLayoutSystem, &m_OptionalRooms[nRoom] );
			++ nNumOptionalRoomsChosen;
			Msg("Room [%d] is id [%d]\n", nNumOptionalRoomsChosen, nRoom);
			Log_Msg(LOG_TilegenLayoutSystem,  "Room [%d] is id [%d]\n", nNumOptionalRoomsChosen, nRoom);			
		}
	}
	Msg("Done processing random rooms.\n");
}
开发者ID:ppittle,项目名称:AlienSwarmDirectorMod,代码行数:39,代码来源:tilegen_actions.cpp

示例6: R_AllocateMirrorTexture

/*
================
R_AllocateMirrorTexture

Allocate the screen texture and make copy
================
*/
int R_AllocateMirrorTexture( void )
{
	rgbdata_t	r_screen;
	int	i, texture;
	char	txName[16];

	i = tr.num_mirrors_used;
	if( i >= MAX_MIRRORS )
	{
		MsgDev( D_ERROR, "R_AllocateMirrorTexture: mirror textures limit exceeded!\n" );
		return 0;	// disable
	}

	texture = tr.mirrorTextures[i];
	tr.num_mirrors_used++;

	if( !texture )
	{
		// not initialized ?
		Q_memset( &r_screen, 0, sizeof( r_screen ));
		Q_snprintf( txName, sizeof( txName ), "*screen%i", i );

		r_screen.width = RI.viewport[2];
		r_screen.height = RI.viewport[3];
		r_screen.type = PF_RGBA_32;
		r_screen.size = r_screen.width * r_screen.height * 4;
		r_screen.flags = IMAGE_HAS_COLOR;
		r_screen.buffer = NULL; // create empty texture for now
		tr.mirrorTextures[i] = GL_LoadTextureInternal( txName, &r_screen, TF_IMAGE, false );
		GL_SetTextureType( tr.mirrorTextures[i], TEX_SCREENCOPY );
		texture = tr.mirrorTextures[i];
	}

	GL_Bind( GL_TEXTURE0, texture );
	pglCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, RI.viewport[0], RI.viewport[1], RI.viewport[2], RI.viewport[3], 0 );

	return texture;
}
开发者ID:DavidKnight247,项目名称:xash3d,代码行数:45,代码来源:gl_mirror.c

示例7: Netchan_Setup

void Netchan_Setup(netsrc_t socketnumber, netchan_t *chan, netadr_t adr, int player_slot, void *connection_status, qboolean(*pfnNetchan_Blocksize)(void *))
{
	Netchan_Clear(chan);

	Q_memset(chan, 0, sizeof(netchan_t));

	chan->player_slot = player_slot + 1;
	chan->sock = socketnumber;
	chan->remote_address = adr;
	chan->last_received = (float)realtime;
	chan->connect_time = (float)realtime;

	chan->message.buffername = "netchan->message";
#ifdef REHLDS_FIXES
	if (player_slot != -1)
	{
		chan->message.data = g_GameClients[player_slot]->GetExtendedMessageBuffer();
		chan->message.maxsize = NET_MAX_PAYLOAD;
	}
	else
#endif
	{
		chan->message.data = chan->message_buf;
		chan->message.maxsize = sizeof(chan->message_buf);
	}
#ifdef REHLDS_FIXES
	chan->message.cursize = 0;
#endif // REHLDS_FIXES
	chan->message.flags = SIZEBUF_ALLOW_OVERFLOW;

	chan->rate = DEFAULT_RATE;

	// Prevent the first message from getting dropped after connection is set up.
	chan->outgoing_sequence = 1;

	chan->connection_status = connection_status;
	chan->pfnNetchan_Blocksize = pfnNetchan_Blocksize;
}
开发者ID:Chuvi-w,项目名称:rehlds,代码行数:38,代码来源:net_chan.cpp

示例8: CL_WriteUsercmd

void CL_WriteUsercmd( sizebuf_t *msg, int from, int to )
{
	usercmd_t	nullcmd;
	usercmd_t	*f, *t;

	ASSERT( from == -1 || ( from >= 0 && from < MULTIPLAYER_BACKUP ));
	ASSERT( to >= 0 && to < MULTIPLAYER_BACKUP );

	if( from == -1 )
	{
		Q_memset( &nullcmd, 0, sizeof( nullcmd ));
		f = &nullcmd;
	}
	else
	{
		f = &cl.cmds[from];
	}

	t = &cl.cmds[to];

	// write it into the buffer
	MSG_WriteDeltaUsercmd( msg, f, t );
}
开发者ID:Reedych,项目名称:xash3d,代码行数:23,代码来源:cl_main.c

示例9: CL_ParseBaseline

/*
==================
CL_ParseBaseline
==================
*/
void CL_ParseBaseline( sizebuf_t *msg )
{
	int		newnum;
	float		timebase;
	cl_entity_t	*ent;

	Delta_InitClient ();	// finalize client delta's

	newnum = BF_ReadWord( msg );

	if( newnum < 0 ) Host_Error( "CL_SpawnEdict: invalid number %i\n", newnum );
	if( newnum >= clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );

	ent = CL_EDICT_NUM( newnum );
	Q_memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
	ent->index = newnum;

	if( cls.state == ca_active )
		timebase = cl.mtime[0];
	else timebase = 1.0f; // sv.state == ss_loading

	MSG_ReadDeltaEntity( msg, &ent->prevstate, &ent->baseline, newnum, CL_IsPlayerIndex( newnum ), timebase );
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:28,代码来源:cl_parse.c

示例10: Q_memset

void netadr_t::ToSockadr (struct sockaddr * s) const
{
	Q_memset ( s, 0, sizeof(struct sockaddr));

	if (type == NA_BROADCAST)
	{
		((struct sockaddr_in*)s)->sin_family = AF_INET;
		((struct sockaddr_in*)s)->sin_port = port;
		((struct sockaddr_in*)s)->sin_addr.s_addr = INADDR_BROADCAST;
	}
	else if (type == NA_IP)
	{
		((struct sockaddr_in*)s)->sin_family = AF_INET;
		((struct sockaddr_in*)s)->sin_addr.s_addr = *(int *)&ip;
		((struct sockaddr_in*)s)->sin_port = port;
	}
	else if (type == NA_LOOPBACK )
	{
		((struct sockaddr_in*)s)->sin_family = AF_INET;
		((struct sockaddr_in*)s)->sin_port = port;
		((struct sockaddr_in*)s)->sin_addr.s_addr = INADDR_LOOPBACK ;
	}
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:23,代码来源:NetAdr.cpp

示例11: Sys_CheckOSVersion

void Sys_CheckOSVersion(void)
{
	OSVERSIONINFO verInfo;

	Q_memset(&verInfo, 0, sizeof(verInfo));
	verInfo.dwOSVersionInfoSize = sizeof(verInfo);
	if (!GetVersionEx(&verInfo))
		Sys_Error("%s: Couldn't get OS info", __func__);

	g_WinNTOrHigher = verInfo.dwMajorVersion >= 4;
	if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4)
	{
		if (verInfo.dwMinorVersion)
		{
			if (verInfo.dwMinorVersion < 90)
				g_bIsWin98 = TRUE;
		}
		else
		{
			g_bIsWin95 = TRUE;
		}
	}
}
开发者ID:theAsmodai,项目名称:rehlds,代码行数:23,代码来源:sys_dll2.cpp

示例12: Q_atov

void Q_atov( float *vec, const char *str, size_t siz )
{
    string	buffer;
    char	*pstr, *pfront;
    int	j;

    Q_strncpy( buffer, str, sizeof( buffer ));
    Q_memset( vec, 0, sizeof( vec_t ) * siz );
    pstr = pfront = buffer;

    for( j = 0; j < siz; j++ )
    {
        vec[j] = Q_atof( pfront );

        // valid separator is space
        while( *pstr && *pstr != ' ' )
            pstr++;

        if( !*pstr ) break;
        pstr++;
        pfront = pstr;
    }
}
开发者ID:nekonomicon,项目名称:xash3d,代码行数:23,代码来源:crtlib.c

示例13: CL_FlushEntityPacket

/*
=================
CL_FlushEntityPacket
=================
*/
void CL_FlushEntityPacket( sizebuf_t *msg )
{
	int		newnum;
	entity_state_t	from, to;

	MsgDev( D_INFO, "FlushEntityPacket()\n" );
	Q_memset( &from, 0, sizeof( from ));

	cl.frames[cl.parsecountmod].valid = false;
	cl.validsequence = 0; // can't render a frame

	// read it all, but ignore it
	while( 1 )
	{
		newnum = BF_ReadWord( msg );
		if( !newnum ) break; // done

		if( BF_CheckOverflow( msg ))
			Host_Error( "CL_FlushEntityPacket: read overflow\n" );

		MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ), cl.mtime[0] );
	}
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:28,代码来源:cl_frame.c

示例14: Sys_CheckOSVersion

NOXREF void Sys_CheckOSVersion(void)
{
	struct _OSVERSIONINFOA verInfo;

	Q_memset(&verInfo, 0, sizeof(verInfo));
	verInfo.dwOSVersionInfoSize = sizeof(verInfo);
	if (!GetVersionExA(&verInfo))
		Sys_Error("Couldn't get OS info");

	g_WinNTOrHigher = verInfo.dwMajorVersion >= 4;
	if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4)
	{
		if (verInfo.dwMinorVersion)
		{
			if (verInfo.dwMinorVersion < 90)
				g_bIsWin98 = 1;
		}
		else
		{
			g_bIsWin95 = 1;
		}
	}
}
开发者ID:mefisto2009,项目名称:rehlds,代码行数:23,代码来源:sys_dll2.cpp

示例15: GL_BackendEndFrame

/*
==============
GL_BackendEndFrame
==============
*/
void GL_BackendEndFrame( void )
{
	// go into 2D mode (in case we draw PlayerSetup between two 2d calls)
	if( !RI.drawWorld ) R_Set2DMode( true );

	if( r_speeds->integer <= 0 || !RI.drawWorld )
		return;

	switch( r_speeds->integer )
	{
	case 1:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i wpoly, %3i bpoly\n%3i epoly, %3i spoly",
		r_stats.c_world_polys, r_stats.c_brush_polys, r_stats.c_studio_polys, r_stats.c_sprite_polys );
		break;		
	case 2:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "visible leafs:\n%3i leafs\ncurrent leaf %3li",
		r_stats.c_world_leafs, r_viewleaf - cl.worldmodel->leafs );
		break;
	case 3:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i studio models drawn\n%3i sprites drawn",
		r_stats.c_studio_models_drawn, r_stats.c_sprite_models_drawn );
		break;
	case 4:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i static entities\n%3i normal entities",
		r_numStatics, r_numEntities - r_numStatics );
		break;
	case 5:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i tempents\n%3i viewbeams\n%3i particles",
		r_stats.c_active_tents_count, r_stats.c_view_beams_count, r_stats.c_particle_count );
		break;
	case 6:
		Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i mirrors\n", r_stats.c_mirror_passes );
		break;
	}

	Q_memset( &r_stats, 0, sizeof( r_stats ));
}
开发者ID:jeefo,项目名称:xash3d,代码行数:42,代码来源:gl_backend.c


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