本文整理汇总了C++中Hunk_AllocName函数的典型用法代码示例。如果您正苦于以下问题:C++ Hunk_AllocName函数的具体用法?C++ Hunk_AllocName怎么用?C++ Hunk_AllocName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Hunk_AllocName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例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);
}
示例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
}
示例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]);
}
示例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]);
}
}
示例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]);
}
示例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");
}
示例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;
}
}
}
}
示例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");
}
示例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);
}
}
示例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);
}
示例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;
}
示例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];
}
}
示例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]);
}
}
示例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)));
}
}