本文整理汇总了C++中Q_memcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_memcpy函数的具体用法?C++ Q_memcpy怎么用?C++ Q_memcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_memcpy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Cbuf_Execute
/*
============
Cbuf_Execute
============
*/
void Cbuf_Execute (void)
{
int i;
char *text;
char line[1024];
int quotes;
while (cmd_text.cursize)
{
// find a \n or ; line break
text = (char *)cmd_text.data;
quotes = 0;
for (i=0 ; i< cmd_text.cursize ; i++)
{
if (text[i] == '"')
quotes++;
if ( !(quotes&1) && text[i] == ';')
break; // don't break if inside a quoted string
if (text[i] == '\n')
break;
}
memcpy (line, text, i);
line[i] = 0;
// delete the text from the command buffer and move remaining commands down
// this is necessary because commands (exec, alias) can insert data at the
// beginning of the text buffer
if (i == cmd_text.cursize)
cmd_text.cursize = 0;
else
{
i++;
cmd_text.cursize -= i;
Q_memcpy (text, text+i, cmd_text.cursize);
}
// execute the command line
Cmd_ExecuteString (line);
if (cmd_wait)
{ // skip out while text still remains in buffer, leaving it
// for next frame
cmd_wait = false;
break;
}
}
}
开发者ID:jrk,项目名称:QuakeTM,代码行数:56,代码来源:cmd.c
示例2: Cbuf_InsertText
// When a command wants to issue other commands immediately, the text is
// inserted at the beginning of the buffer, before any remaining unexecuted
// commands.
void Cbuf_InsertText(char *text)
{
int addLen = Q_strlen(text);
int currLen = cmd_text.cursize;
if (cmd_text.cursize + addLen >= cmd_text.maxsize)
{
Con_Printf(__FUNCTION__ ": overflow\n");
return;
}
#ifdef REHLDS_FIXES
if (currLen)
Q_memmove(cmd_text.data + addLen, cmd_text.data, currLen);
Q_memcpy(cmd_text.data, text, addLen);
cmd_text.cursize += addLen;
#else
char *temp = NULL;
if (currLen)
{
temp = (char *)Z_Malloc(currLen); // TODO: Optimize: better use memmove without need for a temp buffer
Q_memcpy(temp, cmd_text.data, currLen);
SZ_Clear(&cmd_text);
}
Cbuf_AddText(text);
if (currLen)
{
SZ_Write(&cmd_text, temp, currLen);
Z_Free(temp);
}
#endif // REHLDS_FIXES
}
开发者ID:LeninChan,项目名称:rehlds,代码行数:41,代码来源:cmd.cpp
示例3: Q_strlen
void KeyValues::SetStringValue(char const *strValue)
{
if (m_iDataType == TYPE_STRING || m_iDataType == TYPE_WSTRING)
delete [] m_pValue;
if (!strValue)
strValue = "";
int len = Q_strlen(strValue);
m_sValue = new char[len + 1];
Q_memcpy(m_sValue, strValue, len + 1);
m_iDataType = TYPE_STRING;
}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:14,代码来源:KeyValues.cpp
示例4: Assert
void CDispMeshEvent::GetVirtualMesh( void *userData, virtualmeshlist_t *pList )
{
Assert(userData==((void *)this));
pList->pVerts = m_verts.Base();
pList->indexCount = m_indexCount;
pList->triangleCount = m_indexCount/3;
pList->vertexCount = m_verts.Count();
pList->surfacePropsIndex = 0; // doesn't matter here, reset at runtime
pList->pHull = NULL;
int indexMax = ARRAYSIZE(pList->indices);
int indexCount = min(m_indexCount, indexMax);
Assert(m_indexCount < indexMax);
Q_memcpy( pList->indices, m_pIndices, sizeof(*m_pIndices) * indexCount );
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:14,代码来源:disp_ivp.cpp
示例5: Cache_Move
/*
===========
Cache_Move
===========
*/
void Cache_Move ( cache_system_t *c)
{
cache_system_t *new_cs;
// we are clearing up space at the bottom, so only allocate it late
new_cs = Cache_TryAlloc (c->size, true);
if (new_cs)
{
// Con_Printf ("cache_move ok\n");
Q_memcpy ( new_cs+1, c+1, c->size - sizeof(cache_system_t) );
new_cs->user = c->user;
Q_memcpy (new_cs->name, c->name, sizeof(new_cs->name));
Cache_Free (c->user, false); //johnfitz -- added second argument
new_cs->user->data = (void *)(new_cs+1);
}
else
{
// Con_Printf ("cache_move failed\n");
Cache_Free (c->user, true); // tough luck... //johnfitz -- added second argument
}
}
开发者ID:ACIIL,项目名称:Quakespasm-Rift,代码行数:28,代码来源:zone.c
示例6: MSG_ReadBuf
int MSG_ReadBuf(int len, void *data) {
if(data == NULL || len < 1) { Sys_Error("MSG_ReadBuf: Bad arguments."); }
if(global_msg_readcount+len > global_net_message.cursize) {
global_msg_badread = 1;
return(-1);
}
Q_memcpy(data, global_net_message.data, len);
global_msg_readcount += len;
return(1);
}
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:14,代码来源:messages.c
示例7: Cbuf_AddText
/*
============
Cbuf_AddText
Adds command text at the end of the buffer
============
*/
void Cbuf_AddText( const char *text )
{
int l;
l = Q_strlen( text );
if( cmd_text.cursize + l >= cmd_text.maxsize )
{
MsgDev( D_WARN, "Cbuf_AddText: overflow\n" );
return;
}
Q_memcpy( Cbuf_GetSpace( &cmd_text, l ), text, l );
}
开发者ID:gitter-badger,项目名称:xash3d,代码行数:21,代码来源:cmd.c
示例8: CL_ParseMovevars
/*
==================
CL_ParseMovevars
==================
*/
void CL_ParseMovevars( sizebuf_t *msg )
{
Delta_InitClient (); // finalize client delta's
MSG_ReadDeltaMovevars( msg, &clgame.oldmovevars, &clgame.movevars );
// update sky if changed
if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
R_SetupSky( clgame.movevars.skyName );
Q_memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
// keep features an actual!
clgame.oldmovevars.features = clgame.movevars.features = host.features;
}
开发者ID:Reedych,项目名称:xash3d,代码行数:20,代码来源:cl_parse.c
示例9: Mod_LoadSpriteFrame
/*
=================
Mod_LoadSpriteFrame
=================
*/
void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe)
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
int i, width, height, size, origin[2];
unsigned short *ppixout;
byte *ppixin;
pinframe = (dspriteframe_t *)pin;
width = LittleLong (pinframe->width);
height = LittleLong (pinframe->height);
size = width * height;
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size*r_pixbytes,
loadname);
Q_memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
*ppframe = pspriteframe;
pspriteframe->width = width;
pspriteframe->height = height;
origin[0] = LittleLong (pinframe->origin[0]);
origin[1] = LittleLong (pinframe->origin[1]);
pspriteframe->up = origin[1];
pspriteframe->down = origin[1] - height;
pspriteframe->left = origin[0];
pspriteframe->right = width + origin[0];
if (r_pixbytes == 1)
{
Q_memcpy (&pspriteframe->pixels[0], (byte *)(pinframe + 1), size);
}
else if (r_pixbytes == 2)
{
ppixin = (byte *)(pinframe + 1);
ppixout = (unsigned short *)&pspriteframe->pixels[0];
for (i=0 ; i<size ; i++)
ppixout[i] = d_8to16table[ppixin[i]];
}
else
{
Sys_Error ("Mod_LoadSpriteFrame: driver set invalid r_pixbytes: %d\n",
r_pixbytes);
}
return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size);
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:55,代码来源:model.c
示例10: Cache_Move
/*
===========
Cache_Move
===========
*/
void Cache_Move ( cache_system_t *c)
{
cache_system_t *newmem;
// we are clearing up space at the bottom, so only allocate it late
newmem = Cache_TryAlloc (c->size, true);
if (newmem)
{
// Con_Printf ("cache_move ok\n");
Q_memcpy ( newmem+1, c+1, c->size - sizeof(cache_system_t) );
newmem->user = c->user;
Q_memcpy (newmem->name, c->name, sizeof(newmem->name));
Cache_Free (c->user);
newmem->user->data = (void *)(newmem+1);
}
else
{
// Con_Printf ("cache_move failed\n");
Cache_Free (c->user); // tough luck...
}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:28,代码来源:zone.cpp
示例11: HPAK_FindResource
/* <2a451> ../engine/hashpak.c:217 */
qboolean HPAK_FindResource(hash_pack_directory_t *pDir, unsigned char *hash, struct resource_s *pResourceEntry)
{
for (int i = 0; i < pDir->nEntries; i++)
{
if (Q_memcmp(hash, pDir->p_rgEntries[i].resource.rgucMD5_hash, 16) == 0)
{
if (pResourceEntry)
Q_memcpy(pResourceEntry, &pDir->p_rgEntries[i].resource, sizeof(resource_t));
return TRUE;
}
}
return FALSE;
}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:15,代码来源:hashpak.cpp
示例12: SV_Trace_Toss
/* DESCRIPTION: SV_Trace_Toss
// LOCATION: sv_phys.c
// PATH: PF_TraceToss_Shared
//
// Say I throw a grenade. Where will it go? This function finds out by
// simulating ten seconds' worth of frames.
*/
trace_t * SV_Trace_Toss(trace_t * Outgoing_Trace, edict_t *tossent, edict_t *ignore) {
int i;
vec3_t var_378_end;
vec3_t var_36C_move;
trace_t var_360_trace;
edict_t var_324_TempEdict;
edict_t * var_328_TempEdictPtr;
double var_380_host_frametime;
var_380_host_frametime = host_frametime;
host_frametime = .05;
Q_memcpy(&var_324_TempEdict, tossent, sizeof(edict_t));
var_328_TempEdictPtr = &var_324_TempEdict;
// while(1) //a sanity check to avoid tracing more than ten seconds was present in QW, I think it's a good idea. This may need to be adjusted to account for the alterable frametimes.
for (i = 0; i < 200; i++)
{
SV_CheckVelocity(var_328_TempEdictPtr);
SV_AddGravity(var_328_TempEdictPtr);
VectorMA(var_328_TempEdictPtr->v.angles, host_frametime, var_328_TempEdictPtr->v.avelocity, var_328_TempEdictPtr->v.angles);
VectorScale(var_328_TempEdictPtr->v.velocity, host_frametime, var_36C_move);
VectorAdd(var_328_TempEdictPtr->v.origin, var_36C_move, var_378_end);
var_360_trace = SV_Move(var_328_TempEdictPtr->v.origin, var_328_TempEdictPtr->v.mins, var_328_TempEdictPtr->v.maxs, var_378_end, 0, var_328_TempEdictPtr, 0);
VectorCopy(var_360_trace.endpos, var_328_TempEdictPtr->v.origin);
if(var_360_trace.pHit != NULL && var_360_trace.pHit != ignore) { break; }
}
host_frametime = var_380_host_frametime;
Q_memcpy(Outgoing_Trace, &var_360_trace, sizeof(trace_t));
return(Outgoing_Trace);
}
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:43,代码来源:SV_move.c
示例13: CL_DuplicateTexture
/*
====================
CL_DuplicateTexture
Dupliacte texture with remap pixels
====================
*/
void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
{
gltexture_t *glt;
texture_t *tx = NULL;
char texname[128];
int i, index;
size_t size;
byte paletteBackup[768];
byte *raw, *pal;
// save off the real texture index
index = ptexture->index;
glt = R_GetTexture( index );
Q_snprintf( texname, sizeof( texname ), "#%i_%s", RI.currententity->curstate.number, glt->name + 1 );
// search for pixels
for( i = 0; i < RI.currentmodel->numtextures; i++ )
{
tx = RI.currentmodel->textures[i];
if( tx->gl_texturenum == index )
break; // found
}
ASSERT( tx != NULL );
// backup original palette
pal = (byte *)(tx + 1) + (tx->width * tx->height);
Q_memcpy( paletteBackup, pal, 768 );
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR, NULL ); // do copy
GL_SetTextureType( ptexture->index, TEX_REMAP );
// restore original palette
Q_memcpy( pal, paletteBackup, 768 );
}
开发者ID:Reedych,项目名称:xash3d,代码行数:43,代码来源:cl_remap.c
示例14: SimpleArray
void CHLSL_Solver_Array::OnIdentifierAlloc( IdentifierLists_t &List )
{
SimpleArray *pArray = new SimpleArray();
pArray->iNumComps = m_iNumComps;
pArray->iSize_X = m_iSize_x;
pArray->iSize_Y = m_iSize_y;
pArray->iIndex = GetData().iNodeIndex;
const int arraySize = m_iSize_x * m_iSize_y;
pArray->vecData = new Vector4D[ arraySize ];
Q_memcpy( pArray->vecData, m_vecData, sizeof(Vector4D) * arraySize );
List.hList_Arrays.AddToTail( pArray );
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:15,代码来源:chlsl_solver_array.cpp
示例15: SV_UpdateMovevars
/*
===================
SV_UpdateMovevars
check movevars for changes every frame
send updates to client if changed
===================
*/
void SV_UpdateMovevars( qboolean initialize )
{
if( !initialize && !physinfo->modified )
return;
// check range
if( sv_zmax->value < 256.0f ) Cvar_SetFloat( "sv_zmax", 256.0f );
if( sv_zmax->value > 32767.0f ) Cvar_SetFloat( "sv_zmax", 32767.0f );
svgame.movevars.gravity = sv_gravity->value;
svgame.movevars.stopspeed = sv_stopspeed->value;
svgame.movevars.maxspeed = sv_maxspeed->value;
svgame.movevars.spectatormaxspeed = sv_spectatormaxspeed->value;
svgame.movevars.accelerate = sv_accelerate->value;
svgame.movevars.airaccelerate = sv_airaccelerate->value;
svgame.movevars.wateraccelerate = sv_wateraccelerate->value;
svgame.movevars.friction = sv_friction->value;
svgame.movevars.edgefriction = sv_edgefriction->value;
svgame.movevars.waterfriction = sv_waterfriction->value;
svgame.movevars.bounce = sv_wallbounce->value;
svgame.movevars.stepsize = sv_stepsize->value;
svgame.movevars.maxvelocity = sv_maxvelocity->value;
svgame.movevars.zmax = sv_zmax->value;
svgame.movevars.waveHeight = sv_wateramp->value;
Q_strncpy( svgame.movevars.skyName, sv_skyname->string, sizeof( svgame.movevars.skyName ));
svgame.movevars.footsteps = sv_footsteps->integer;
svgame.movevars.rollangle = sv_rollangle->value;
svgame.movevars.rollspeed = sv_rollspeed->value;
svgame.movevars.skycolor_r = sv_skycolor_r->value;
svgame.movevars.skycolor_g = sv_skycolor_g->value;
svgame.movevars.skycolor_b = sv_skycolor_b->value;
svgame.movevars.skyvec_x = sv_skyvec_x->value;
svgame.movevars.skyvec_y = sv_skyvec_y->value;
svgame.movevars.skyvec_z = sv_skyvec_z->value;
svgame.movevars.skydir_x = sv_skydir_x->value;
svgame.movevars.skydir_y = sv_skydir_y->value;
svgame.movevars.skydir_z = sv_skydir_z->value;
svgame.movevars.skyangle = sv_skyangle->value;
svgame.movevars.wateralpha = sv_wateralpha->value;
svgame.movevars.features = host.features; // just in case. not really need
if( initialize ) return; // too early
if( MSG_WriteDeltaMovevars( &sv.reliable_datagram, &svgame.oldmovevars, &svgame.movevars ))
Q_memcpy( &svgame.oldmovevars, &svgame.movevars, sizeof( movevars_t )); // oldstate changed
physinfo->modified = false;
}
开发者ID:n00ner,项目名称:xash3d,代码行数:56,代码来源:sv_main.c
示例16: lhsLength
CUtlString &CUtlString::operator+=( const char *rhs )
{
const int lhsLength( Length() );
const int rhsLength( V_strlen( rhs ) );
const int requestedLength( lhsLength + rhsLength );
if (!requestedLength)
{
return *this;
}
AllocMemory( requestedLength );
Q_memcpy( m_pString + lhsLength, rhs, rhsLength );
return *this;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:16,代码来源:utlstring.cpp
示例17: Q_memset
void SEditModelRender::GetModelCenter( float *pFl3_ViewOffset )
{
Q_memset( pFl3_ViewOffset, 0, sizeof(float) * 3 );
if ( IsModelReady() )
{
MDLCACHE_CRITICAL_SECTION();
if ( pModelInstance->GetModelPtr() )
{
const Vector &vecMin = pModelInstance->GetModelPtr()->hull_min();
const Vector &vecMax = pModelInstance->GetModelPtr()->hull_max();
Vector vecPos = ( vecMin + ( vecMax - vecMin ) * 0.5f );
if ( pFl3_ViewOffset )
Q_memcpy( pFl3_ViewOffset, vecPos.Base(), sizeof(float) * 3 );
}
}
}
开发者ID:InfoSmart,项目名称:InSource,代码行数:16,代码来源:SEdit_ModelRender.cpp
示例18: while
/*
=============
COM_MemFgets
=============
*/
char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize )
{
int i, last, stop;
if( !pMemFile || !pBuffer || !filePos )
return NULL;
if( *filePos >= fileSize )
return NULL;
i = *filePos;
last = fileSize;
// fgets always NULL terminates, so only read bufferSize-1 characters
if( last - *filePos > ( bufferSize - 1 ))
last = *filePos + ( bufferSize - 1);
stop = 0;
// stop at the next newline (inclusive) or end of buffer
while( i < last && !stop )
{
if( pMemFile[i] == '\n' )
stop = 1;
i++;
}
// if we actually advanced the pointer, copy it over
if( i != *filePos )
{
// we read in size bytes
int size = i - *filePos;
// copy it out
Q_memcpy( pBuffer, pMemFile + *filePos, size );
// If the buffer isn't full, terminate (this is always true)
if( size < bufferSize ) pBuffer[size] = 0;
// update file pointer
*filePos = i;
return pBuffer;
}
return NULL;
}
开发者ID:Reedych,项目名称:xash3d,代码行数:53,代码来源:common.c
示例19: SockadrToNetadr
/* <d321a> ../engine/net_ws.c:228 */
void SockadrToNetadr(const struct sockaddr *s, netadr_t *a)
{
if (s->sa_family == AF_INET)
{
a->type = NA_IP;
*(int *)&a->ip = ((struct sockaddr_in *)s)->sin_addr.s_addr;
a->port = ((struct sockaddr_in *)s)->sin_port;
}
#ifdef _WIN32
else if (s->sa_family == AF_IPX)
{
a->type = NA_IPX;
Q_memcpy(a->ipx, s->sa_data, 10);
a->port = *(unsigned short *)&s->sa_data[10];
}
#endif // _WIN32
}
开发者ID:omertelli,项目名称:rehlds,代码行数:18,代码来源:net_ws.cpp
示例20: CreateAsyncResult
//-----------------------------------------------------------------------------
// Purpose: Award an achievement to the current user
//-----------------------------------------------------------------------------
void CXboxSystem::AwardAchievement( uint nUserIdx, uint nAchievementId )
{
AsyncResult_t *pResult = CreateAsyncResult( true );
XUSER_ACHIEVEMENT ach;
ach.dwUserIndex = nUserIdx;
ach.dwAchievementId = nAchievementId;
pResult->pInputData = malloc( sizeof( ach ) );
Q_memcpy( pResult->pInputData, &ach, sizeof( ach ) );
DWORD ret = XUserWriteAchievements( 1, (XUSER_ACHIEVEMENT*)pResult->pInputData, &pResult->overlapped );
if ( ret != ERROR_IO_PENDING )
{
Warning( "XUserWriteAchievments failed.\n" );
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:20,代码来源:xboxsystem.cpp
注:本文中的Q_memcpy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论