本文整理汇总了C++中Hunk_AllocName函数的典型用法代码示例。如果您正苦于以下问题:C++ Hunk_AllocName函数的具体用法?C++ Hunk_AllocName怎么用?C++ Hunk_AllocName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Hunk_AllocName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: R_InitParticles
/*
===============
R_InitParticles
===============
*/
void R_InitParticles(void)
{
int i = COM_CheckParm("-particles");
if (i)
{
r_numparticles = (int)(Q_atoi(com_argv[i + 1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES;
}
else
r_numparticles = MAX_PARTICLES;
particles = (particle_t *)
Hunk_AllocName(r_numparticles * sizeof(particle_t), "particles");
}
开发者ID:leilei-,项目名称:tyrquake,代码行数:21,代码来源:r_part.c
示例2: Host_FindMaxClients
/*
================
Host_FindMaxClients
================
*/
void Host_FindMaxClients (void)
{
int i;
svs.maxclients = 1;
#if !defined (GLQUAKE)
i = COM_CheckParm ("-dedicated");
if (i)
{
cls.state = ca_dedicated;
if (i != (com_argc - 1))
{
svs.maxclients = Q_atoi (com_argv[i+1]);
}
else
svs.maxclients = 8;
}
else
#endif /* GLQUAKE */
cls.state = ca_disconnected;
i = COM_CheckParm ("-listen");
if (i)
{
if (cls.state == ca_dedicated)
Sys_Error ("Only one of -dedicated or -listen can be specified");
if (i != (com_argc - 1))
svs.maxclients = Q_atoi (com_argv[i+1]);
else
svs.maxclients = 8;
}
if (svs.maxclients < 1)
svs.maxclients = 8;
else if (svs.maxclients > MAX_SCOREBOARD)
svs.maxclients = MAX_SCOREBOARD;
svs.maxclientslimit = svs.maxclients;
if (svs.maxclientslimit < 4)
svs.maxclientslimit = 4;
svs.clients = Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
if (svs.maxclients > 1)
Cvar_SetValue ("deathmatch", 1.0);
else
Cvar_SetValue ("deathmatch", 0.0);
}
开发者ID:MaddTheSane,项目名称:Quake,代码行数:52,代码来源:host.c
示例3: Mod_LoadNodes
/*
=================
Mod_LoadNodes
=================
*/
void Mod_LoadNodes (lump_t *l)
{
int i, j, count, p;
dnode_t *in;
mnode_t *out;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->nodes = out;
loadmodel->numnodes = count;
for ( i=0 ; i<count ; i++, in++, out++)
{
// for (j=0 ; j<3 ; j++) // l
{
out->minmaxs[0] = LittleShort (in->mins[0]);
out->minmaxs[3+0] = LittleShort (in->maxs[0]);
out->minmaxs[1] = LittleShort (in->mins[1]);
out->minmaxs[3+1] = LittleShort (in->maxs[1]);
out->minmaxs[2] = LittleShort (in->mins[2]);
out->minmaxs[3+2] = LittleShort (in->maxs[2]);
}
p = LittleLong(in->planenum);
out->plane = loadmodel->planes + p;
out->firstsurface = LittleShort (in->firstface);
out->numsurfaces = LittleShort (in->numfaces);
for (j=0 ; j<2 ; j++)
{
p = LittleShort (in->children[j]);
if (p >= 0)
out->children[j] = loadmodel->nodes + p;
else
out->children[j] = (mnode_t *)(loadmodel->leafs + (-1 - p));
}
}
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
}
开发者ID:Blzut3,项目名称:Engoo,代码行数:52,代码来源:model_common.c
示例4: Mod_LoadSurfedges
/*
=================
Mod_LoadSurfedges
=================
*/
static void Mod_LoadSurfedges (lump_t *l)
{
int i, count;
int *in, *out;
in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
SV_Error ("%s: funny lump size in %s", __thisfunc__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = (int *) Hunk_AllocName (count * sizeof(*out), "surfedges");
loadmodel->surfedges = out;
loadmodel->numsurfedges = count;
for (i = 0; i < count; i++)
out[i] = LittleLong (in[i]);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:22,代码来源:model.c
示例5: Mod_LoadClipnodes
/*
=================
Mod_LoadClipnodes
=================
*/
void Mod_LoadClipnodes (lump_t *l)
{
dclipnode_t *in, *out;
int i, count;
hull_t *hull;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->clipnodes = out;
loadmodel->numclipnodes = count;
hull = &loadmodel->hulls[1];
hull->clipnodes = out;
hull->firstclipnode = 0;
hull->lastclipnode = count-1;
hull->planes = loadmodel->planes;
hull->clip_mins[0] = -16;
hull->clip_mins[1] = -16;
hull->clip_mins[2] = -24;
hull->clip_maxs[0] = 16;
hull->clip_maxs[1] = 16;
hull->clip_maxs[2] = 32;
hull = &loadmodel->hulls[2];
hull->clipnodes = out;
hull->firstclipnode = 0;
hull->lastclipnode = count-1;
hull->planes = loadmodel->planes;
hull->clip_mins[0] = -32;
hull->clip_mins[1] = -32;
hull->clip_mins[2] = -24;
hull->clip_maxs[0] = 32;
hull->clip_maxs[1] = 32;
hull->clip_maxs[2] = 64;
for (i=0 ; i<count ; i++, out++, in++)
{
out->planenum = LittleLong(in->planenum);
out->children[0] = LittleShort(in->children[0]);
out->children[1] = LittleShort(in->children[1]);
}
}
开发者ID:Cabriter,项目名称:Quake,代码行数:51,代码来源:gl_model.c
示例6: Mod_LoadSurfedges
/*
=================
Mod_LoadSurfedges
=================
*/
void Mod_LoadSurfedges (lump_t *l)
{
int i, count;
int *in, *out;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->surfedges = out;
loadmodel->numsurfedges = count;
for ( i=0 ; i<count ; i++)
out[i] = LittleLong (in[i]);
}
开发者ID:Cabriter,项目名称:Quake,代码行数:22,代码来源:gl_model.c
示例7: Host_FindMaxClients
/*
================
Host_FindMaxClients
================
*/
void Host_FindMaxClients (void)
{
int i;
svs.maxclients = 1;
i = COM_CheckParm ("-dedicated");
if (i)
{
cls.state = ca_dedicated;
if (i != (com_argc - 1))
{
svs.maxclients = Q_atoi (com_argv[i+1]);
}
else
svs.maxclients = 8;
}
else
cls.state = ca_disconnected;
i = COM_CheckParm ("-listen");
if (i)
{
if (cls.state == ca_dedicated)
Sys_Error ("Only one of -dedicated or -listen can be specified");
if (i != (com_argc - 1))
svs.maxclients = Q_atoi (com_argv[i+1]);
else
svs.maxclients = 8;
}
if (svs.maxclients < 1)
svs.maxclients = 8;
else if (svs.maxclients > MAX_SCOREBOARD)
svs.maxclients = MAX_SCOREBOARD;
svs.maxclientslimit = svs.maxclients;
if (svs.maxclientslimit < 4)
svs.maxclientslimit = 4;
svs.clients = (struct client_s *) Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
if (svs.maxclients > 1)
Cvar_SetQuick (&deathmatch, "1");
else
Cvar_SetQuick (&deathmatch, "0");
}
开发者ID:sakridge,项目名称:quakespasm-ml,代码行数:50,代码来源:host.c
示例8: Mod_LoadTexinfo
/*
=================
Mod_LoadTexinfo
=================
*/
void Mod_LoadTexinfo (lump_t *l)
{
texinfo_t *in;
mtexinfo_t *out;
int i, j, count, miptex;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error ("Mod_LoadTexinfo: funny lump size in %s", loadmodel->name); // was Sys_Error
count = l->filelen / sizeof(*in);
out = Hunk_AllocName (count * sizeof(*out), mod_loadname);
loadmodel->texinfo = out;
loadmodel->numtexinfo = count;
for (i=0 ; i<count ; i++, in++, out++)
{
for (j=0 ; j<4 ; j++) {
out->vecs[0][j] = LittleFloat (in->vecs[0][j]);
out->vecs[1][j] = LittleFloat (in->vecs[1][j]);
}
miptex = LittleLong (in->miptex);
out->flags = LittleLong (in->flags);
if (!loadmodel->textures)
{
out->texture = r_notexture_mip; // checkerboard texture
out->flags = 0;
}
else
{
if (miptex >= loadmodel->numtextures)
Host_Error ("Mod_LoadTexinfo: miptex >= loadmodel->numtextures"); // was Sys_Error
out->texture = loadmodel->textures[miptex];
if (!out->texture)
{
out->texture = r_notexture_mip; // texture not found
out->flags = 0;
}
}
}
}
开发者ID:SpiritQuaddicted,项目名称:reQuiem,代码行数:49,代码来源:gl_brush.c
示例9: SV_Init
/*
====================
SV_Init
====================
*/
void SV_Init (void)
{
Sys_Printf ("Host_Init\n");
Memory_Init (host_parms->membase, host_parms->memsize);
Cbuf_Init ();
Cmd_Init ();
COM_Init ();
FS_Init ();
PR_Init ();
Mod_Init ();
SV_InitNet ();
SV_InitLocal ();
Pmove_Init ();
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark ();
Cbuf_InsertText ("exec server.cfg\n");
Cbuf_Execute ();
// unlock the early-set cvars after init
Cvar_UnlockAll ();
host_initialized = true;
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("%4.1f megabyte heap\n", host_parms->memsize/(1024*1024.0));
Con_Printf ("======== HexenWorld Initialized ========\n");
// process command line arguments
Cmd_StuffCmds_f ();
Cbuf_Execute ();
// if a map wasn't specified on the command line, spawn demo1.map
if (sv.state == ss_dead)
Cmd_ExecuteString ("map demo1", src_command);
if (sv.state == ss_dead)
SV_Error ("Couldn't spawn a server");
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:48,代码来源:sv_main.c
示例10: R_InitParticles
/*
===============
R_InitParticles
===============
*/
void R_InitParticles (void)
{
int i;
FILE *f;
i = COM_CheckParm ("-particles");
MyTable[0] = 254;
if (i)
{
r_numparticles = (int)(atoi(com_argv[i+1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES;
}
else
{
r_numparticles = MAX_PARTICLES;
}
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
Cvar_RegisterVariable (&leak_color);
//JFM: snow test
Cvar_RegisterVariable (&snow_flurry);
Cvar_RegisterVariable (&snow_active);
transTable = (byte *)malloc(65536);
if (!transTable)
Sys_Error ("Couldn't load gfx/tinttab.lmp");
COM_FOpenFile ("gfx/tinttab.lmp", &f, false);
if (f)
{
fread(transTable,1,65536,f);
fclose(f);
}
}
开发者ID:elhobbs,项目名称:hexen2,代码行数:47,代码来源:r_part.c
示例11: Mod_LoadExternalVisibility
/*
=================
Mod_LoadExternalVisibility
=================
*/
void Mod_LoadExternalVisibility (int fhandle)
{
long filelen;
// get visibility data length
filelen = 0;
Sys_FileRead (fhandle, &filelen, 4);
filelen = LittleLong(filelen);
Con_Printf("...%i bytes visibility data\n", filelen);
// load visibility data
if (!filelen)
{
loadmodel->visdata = NULL;
return;
}
loadmodel->visdata = Hunk_AllocName ( filelen, "EXT_VIS");
Sys_FileRead (fhandle, loadmodel->visdata, filelen);
}
开发者ID:Blzut3,项目名称:Engoo,代码行数:25,代码来源:model_common.c
示例12: Mod_LoadAliasFrame
/*
=================
Mod_LoadAliasFrame
=================
*/
void * Mod_LoadAliasFrame (void * pin, int *pframeindex, int numv,
trivertx_t *pbboxmin, trivertx_t *pbboxmax, aliashdr_t *pheader, char *name)
{
trivertx_t *pframe, *pinframe;
int i, j;
daliasframe_t *pdaliasframe;
pdaliasframe = (daliasframe_t *)pin;
strcpy (name, pdaliasframe->name);
for (i=0 ; i<3 ; i++)
{
// these are byte values, so we don't have to worry about
// endianness
pbboxmin->v[i] = pdaliasframe->bboxmin.v[i];
pbboxmax->v[i] = pdaliasframe->bboxmax.v[i];
}
pinframe = (trivertx_t *)(pdaliasframe + 1);
pframe = Hunk_AllocName (numv * sizeof(*pframe), loadname);
*pframeindex = (byte *)pframe - (byte *)pheader;
for (j=0 ; j<numv ; j++)
{
int k;
// these are all byte values, so no need to deal with endianness
pframe[j].lightnormalindex = pinframe[j].lightnormalindex;
for (k=0 ; k<3 ; k++)
{
pframe[j].v[k] = pinframe[j].v[k];
}
}
pinframe += numv;
return (void *)pinframe;
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:46,代码来源:model.c
示例13: Mod_LoadLeafs
/*
=================
Mod_LoadLeafs
=================
*/
void Mod_LoadLeafs (lump_t *l)
{
dleaf_t *in;
mleaf_t *out;
int i, j, count, p;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->leafs = out;
loadmodel->numleafs = count;
for ( i=0 ; i<count ; i++, in++, out++)
{
for (j=0 ; j<3 ; j++)
{
out->minmaxs[j] = LittleShort (in->mins[j]);
out->minmaxs[3+j] = LittleShort (in->maxs[j]);
}
p = LittleLong(in->contents);
out->contents = p;
out->firstmarksurface = loadmodel->marksurfaces +
LittleShort(in->firstmarksurface);
out->nummarksurfaces = LittleShort(in->nummarksurfaces);
p = LittleLong(in->visofs);
if (p == -1)
out->compressed_vis = NULL;
else
out->compressed_vis = loadmodel->visdata + p;
out->efrags = NULL;
for (j=0 ; j<4 ; j++)
out->ambient_sound_level[j] = in->ambient_level[j];
}
}
开发者ID:Izhido,项目名称:qrevpak,代码行数:46,代码来源:model.c
示例14: Mod_LoadEdges
/*
=================
Mod_LoadEdges
=================
*/
void Mod_LoadEdges (lump_t *l)
{
dedge_t *in;
medge_t *out;
int i, count;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
loadmodel->edges = out;
loadmodel->numedges = count;
for ( i=0 ; i<count ; i++, in++, out++)
{
out->v[0] = (unsigned short)LittleShort(in->v[0]);
out->v[1] = (unsigned short)LittleShort(in->v[1]);
}
}
开发者ID:Cabriter,项目名称:Quake,代码行数:26,代码来源:gl_model.c
示例15: Mod_LoadSurfedges
/*
=================
Mod_LoadSurfedges
=================
*/
void Mod_LoadSurfedges (lump_t *l)
{
int i, count, *in, *out;
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error ("Mod_LoadSurfedges: funny lump size in %s", loadmodel->name); // was Sys_Error
count = l->filelen / sizeof(*in);
out = Hunk_AllocName (count * sizeof(*out), mod_loadname);
loadmodel->surfedges = out;
loadmodel->numsurfedges = count;
for (i=0 ; i<count ; i++)
{
out[i] = LittleLong (in[i]);
// assert (((out[i] < MAX_MAP_EDGES) && (out[i] > -MAX_MAP_EDGES)));
}
}
开发者ID:SpiritQuaddicted,项目名称:reQuiem,代码行数:26,代码来源:gl_brush.c
示例16: Mod_LoadEdges
/*
=================
Mod_LoadEdges
=================
*/
static void Mod_LoadEdges (lump_t *l)
{
dedge_t *in;
medge_t *out;
int i, count;
in = (dedge_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
SV_Error ("%s: funny lump size in %s", __thisfunc__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = (medge_t *) Hunk_AllocName ((count + 1) * sizeof(*out), "edges");
loadmodel->edges = out;
loadmodel->numedges = count;
for (i = 0; i < count; i++, in++, out++)
{
out->v[0] = (unsigned short)LittleShort(in->v[0]);
out->v[1] = (unsigned short)LittleShort(in->v[1]);
}
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:26,代码来源:model.c
示例17: Mod_LoadSpriteFrame
/*
=================
Mod_LoadSpriteFrame
=================
*/
static void * Mod_LoadSpriteFrame(void *pin, mspriteframe_t **ppframe, const char *loadname,
int framenum)
{
int origin[2];
dspriteframe_t *pinframe = (dspriteframe_t *)pin;
#ifdef MSB_FIRST
int width = LittleLong(pinframe->width);
int height = LittleLong(pinframe->height);
#else
int width = (pinframe->width);
int height = (pinframe->height);
#endif
int numpixels = width * height;
int size = sizeof(mspriteframe_t) + R_SpriteDataSize(numpixels);
mspriteframe_t *pspriteframe = (mspriteframe_t*)Hunk_AllocName(size, loadname);
memset(pspriteframe, 0, size);
*ppframe = pspriteframe;
pspriteframe->width = width;
pspriteframe->height = height;
#ifdef MSB_FIRST
origin[0] = LittleLong(pinframe->origin[0]);
origin[1] = LittleLong(pinframe->origin[1]);
#else
origin[0] = (pinframe->origin[0]);
origin[1] = (pinframe->origin[1]);
#endif
pspriteframe->up = origin[1];
pspriteframe->down = origin[1] - height;
pspriteframe->left = origin[0];
pspriteframe->right = width + origin[0];
/* Let the renderer process the pixel data as needed */
R_SpriteDataStore(pspriteframe, loadname, framenum, (byte *)(pinframe + 1));
return (byte *)pinframe + sizeof(dspriteframe_t) + numpixels;
}
开发者ID:leilei-,项目名称:tyrquake,代码行数:45,代码来源:sprite_model.c
示例18: Host_FindMaxClients
void Host_FindMaxClients(void) {
svs.maxclients = 1;
int i = COM_CheckParm("-dedicated");
if (i) {
cls.state = ca_dedicated;
if (i != (com_argc - 1)) {
svs.maxclients = atoi(com_argv[i + 1]);
} else
svs.maxclients = 8;
} else
cls.state = ca_disconnected;
//qmb :64 clients
//various number changes including max_scoreboard
i = COM_CheckParm("-listen");
if (i) {
if (cls.state == ca_dedicated)
Sys_Error("Only one of -dedicated or -listen can be specified");
if (i != (com_argc - 1))
svs.maxclients = atoi(com_argv[i + 1]);
else
svs.maxclients = 32;
}
if (svs.maxclients < 1)
svs.maxclients = 32;
else if (svs.maxclients > MAX_SCOREBOARD)
svs.maxclients = MAX_SCOREBOARD;
svs.maxclientslimit = svs.maxclients;
if (svs.maxclientslimit < 32)
svs.maxclientslimit = 32;
svs.clients = (client_t *) Hunk_AllocName(svs.maxclientslimit * sizeof (client_t), "clients");
if (svs.maxclients > 1)
deathmatch.set(1.0f);
else
deathmatch.set(0.0f);
}
开发者ID:DrLabman,项目名称:QMB,代码行数:39,代码来源:host.cpp
示例19: Memory_Init
/*
========================
Memory_Init
========================
*/
void Memory_Init (void *buf, int size)
{
int p;
int zonesize = DYNAMIC_SIZE;
hunk_base = (byte *)buf;
hunk_size = size;
hunk_low_used = 0;
hunk_high_used = 0;
Cache_Init ();
p = COM_CheckParm ("-zone");
if (p)
{
if (p < com_argc-1)
zonesize = Q_atoi (com_argv[p+1]) * 1024;
else
Sys_Error ("Memory_Init: you must specify a size in KB after -zone");
}
mainzone = (memzone_t *)Hunk_AllocName (zonesize, "zone" );
Z_ClearZone (mainzone, zonesize);
}
开发者ID:GAMELASTER,项目名称:WPQuake1,代码行数:27,代码来源:zone.cpp
示例20: PR_AllocString
int PR_AllocString (int size, char **ptr)
{
int i;
if (!size)
return 0;
for (i = 0; i < pr_numknownstrings; i++)
{
if (!pr_knownstrings[i])
break;
}
// if (i >= pr_numknownstrings)
// {
if (i >= pr_maxknownstrings)
PR_AllocStringSlots();
pr_numknownstrings++;
// }
pr_knownstrings[i] = (char *)Hunk_AllocName(size, "string");
if (ptr)
*ptr = (char *) pr_knownstrings[i];
return -1 - i;
}
开发者ID:ProfessorKaos64,项目名称:vkQuake,代码行数:22,代码来源:pr_edict.c
注:本文中的Hunk_AllocName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论