Raised This Month: $ Target: $400
 0% 

[SP] ConfigMap: StringMap & SMCParser


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
nergal
Veteran Member
Join Date: Apr 2012
Old 06-29-2020 , 13:55   Re: [SP] ConfigMap: StringMap & SMCParser
Reply With Quote #3

Quote:
Originally Posted by MAGNAT2645 View Post
Is there any way to include ConfigMap to Voice Changer? I just don't want to use KeyValues loop every time NormalSoundHook is called.
yes! you gotta compile it with Voice Changer. I also want to add that ConfigMap is loop-friendlier than KeyValues since all you need to do get a specific section and iterate that section, here's an example of what I mean from VSH2 which uses ConfigMap:

Code:
	static char download_keys[][] = {
		"downloads.sounds",
		"downloads.models",
		"downloads.materials"
	};
	
	for( int i; i<sizeof(download_keys); i++ ) {
		ConfigMap download_map = g_vsh2.m_hCfg.GetSection(download_keys[i]);
		if( download_map != null ) {
			for( int n; n<download_map.Size; n++ ) {
				char index[10];
				Format(index, sizeof(index), "%i", n);
				int value_size = download_map.GetSize(index);
				char[] filepath = new char[value_size];
				if( download_map.Get(index, filepath, value_size) ) {
					switch( i ) {
						case 0: PrepareSound(filepath);
						case 1: PrepareModel(filepath);
						case 2: PrepareMaterial(filepath);
					}
				}
			}
		}
	}
Have it iterate over an array of keys that map to a section, grab that section, and iterate over it as needed
__________________

Last edited by nergal; 06-29-2020 at 13:56.
nergal is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode