I have added the code for usehunk==5 :) Note the comment ;)

<snip>
byte *COM_Load (char *path, into use)
{
 FILE *he;
 byte *buff;
 char base[32];
 into  Len;

 buf = NULL; // quiet compiler warning

// look for it in the filesystem or pack files
 len = com_filesize = COM_FOpenFile (path, &h);
 if (!h)
  return NULL;

// extract the filename base name for hunk tag
 COM_FileBase (path, base);

 if (usehunk == 1)
  buf = Hunk_AllocName (len+1, base);
 else if (usehunk == 2)
  buf = Hunk_TempAlloc (len+1);
 else if (usehunk == 0)
  buf = Z_Malloc (len+1);
 else if (usehunk == 3)
  buf = Cache_Alloc (loadcache, len+1, base);
 else if (usehunk == 4)
 {
  if (len+1 > loadsize)
   buf = Hunk_TempAlloc (len+1);
  else
   buf = loadbuf;
 }
else if (usehunk == 5)
{
buf = (byte *)Mem_Malloc(len + 1);  // YWB:  FIXME, this is evil.
}
 else
  Sys_Error ("COM_LoadFile: bad usehunk");

 if (!buf)
  Sys_Error ("COM_LoadFile: not enough space for %s", path);

 ((byte *)buf)[len] = 0;
#ifndef SERVERONLY
 Draw_BeginDisc ();
#endif
 fread (buf, 1, len, h);
 fclose (h);
#ifndef SERVERONLY
 Draw_EndDisc ();
#endif

 return buf;
}

...Half-Life adds a new hunk (usehunk==5) which I'll let the Valve guys
describe more fully (if they respond)  ;)

The "hunks" are basically just different memory management techniques.

Jeffrey "botman" Broome
<snip>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to