Thread: Precaching
View Single Post
Re: Precaching
Old
  (#3)
dead bwoy
Member
 
dead bwoy's Avatar
 
Status: Offline
Posts: 512
Join Date: Feb 2004
Location: STL MO USA
Default Re: Precaching - 10-06-2004

Would I need to add code only to this section?
Code:
int pfnPrecacheModel(char* s)
{
   return (*g_engfuncs.pfnPrecacheModel)(s);
}
How would I tie the precaching to specific maps?
Something like this from Splorygon's code from the cfg loading dll he made for me?
Code:
   char server_cmd[256];
   sprintf (server_cmd, "exec %s.cfg\n", STRING (gpGlobals->mapname));
   SERVER_COMMAND (server_cmd);
Or should I use Botman's Stripper2 source?
Code:
void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) {
   int index;
   nullname[0] = 0;
   // precache all the needed items...
   for (index = 0; index < num_precache_items; index++)
   {
	  switch(precache_item_type[index])
	  {
		 case 0:  // model
			if (dllapi_log->value)
			   LOG_MESSAGE(PLID, "PRECACHING MODEL %s", precache_item_name[index]);
			PRECACHE_MODEL(precache_item_name[index]);
			break;
		 case 1:  // sound
			if (dllapi_log->value)
			   LOG_MESSAGE(PLID, "PRECACHING SOUND %s", precache_item_name[index]);
			PRECACHE_SOUND(precache_item_name[index]);
			break;
		 case 2:  // sprite
			if (dllapi_log->value)
			   LOG_MESSAGE(PLID, "PRECACHING SPRITE %s", precache_item_name[index]);
			PRECACHE_MODEL(precache_item_name[index]);
			break;
	  }
   }
If I put this in server activate, will this only work for the first map or every mapchange? Say I put all my desert camo models in czero\models\player\desert\*.* Can I precache every model in that folder? Maybe if I used a similar file structure to the PAF Hostitron (which changes hosti models on mapchange, wish it was open source...).
I know I'm a wankin' n00bified code editor (not a code stealer), but any help would be greatly appreciated!
  
Reply With Quote