actually i don´t load maps from files.. cause i code the mapping first, and then the saving/loading script, wich will just runthrough the blocks struct and save its specs.


But i load Models, Sounds..etc with this script:
Click to reveal..

Code:
void load_files(STRING* pakname)
{
	STRING* openpak = str_create("");
	str_cat(openpak, pakname);
	str_cat(openpak, ".wrs");
	str_cpy(actual_contentpack, openpak);
	var ilt, objectcount, cutterlen;
	entitycounter = 0;
	
	if(pan_objectlist != NULL)
	{pan_remove(pan_objectlist);}
	wait(1);
	pan_objectlist = pan_create("flags=SHOW;", 90);
	pan_objectlist.pos_y = 64; pan_objectlist.pos_x = 0;
	pan_objectlist.red = 1; pan_objectlist.green = 1; pan_objectlist.blue = 1;
	pan_objectlist.size_y = 24;
	set(pan_objectlist, SHOW);
	
	for(ilt=0; ilt<4001; ilt++)
	{
		str_cpy((ordnerinhalt.pstring)[ilt], "");
		if(ilt < 2001) //Weil liste nur 2000 Zeilen hat
		{
			str_cpy((objekteigenschaften.pstring)[ilt], "");
			str_cpy((objektnamen.pstring)[ilt], "");
			str_cpy((objektdigits.pstring)[entitycounter], "");
		}
	}
	//	free(buffer_single);
	//	buffer_single = file_load(actual_contentpack, NULL, NULL);
	//	add_resource(buffer_single);
	str_trunc(openpak, 3);
	str_cat(openpak, "pak");
	file_cpy("Modelliste.txt", openpak);
	var f_handle = file_open_read("Modelliste.txt");
	var copystrings = 0;
	var runthrough_list = 0;
	while(copystrings == 0)
	{
		file_str_read(f_handle, (ordnerinhalt.pstring)[runthrough_list]);
		if(str_stri((ordnerinhalt.pstring)[runthrough_list], "#end") == 1)
		{
			copystrings = 1;
		}
		runthrough_list ++;
	}
	file_close(f_handle);
	file_delete("Modelliste.txt");
	for(ilt=0; ilt<4001; ilt++)
	{
		if((ordnerinhalt.pstring)[ilt] != NULL)
		{
			if(str_stri((ordnerinhalt.pstring)[ilt], ".mdl") && str_stri((ordnerinhalt.pstring)[ilt], themenname) && str_stri((ordnerinhalt.pstring)[ilt], "Quader") == 0)
			{
				//objektname (mdl) eintragen
				str_cpy((objektnamen.pstring)[entitycounter], (ordnerinhalt.pstring)[ilt]);
				//trunc file extention
				str_trunc((ordnerinhalt.pstring)[ilt], 3);
				//save name without extention in shorter way
				str_cpy((objektdigits.pstring)[entitycounter], (ordnerinhalt.pstring)[ilt]);
				str_trunc((objektdigits.pstring)[entitycounter], 1);
				if(str_len((objektdigits.pstring)[entitycounter]) > MAXIMALE_ZEICHENZAHL)
				{
					while(str_len((objektdigits.pstring)[entitycounter]) > MAXIMALE_ZEICHENZAHL)
					{str_trunc((objektdigits.pstring)[entitycounter], 1);}
					str_cat((objektdigits.pstring)[entitycounter], "...");
				}
				//add the nymph extention
				str_cat((ordnerinhalt.pstring)[ilt], "pak");
				//frag ob die nymph Datei existiert
				if(file_exists((ordnerinhalt.pstring)[ilt]) == 0)
				{
					error("Es existiert keine PAK Datei zu einem geladenen Objekt!");
				}
				//Add object to the button list
				pan_setdigits(pan_objectlist, 0,    4, 200+entitycounter*24, (objektdigits.pstring)[entitycounter], arialing, 1, ilt);
				pan_setbutton(pan_objectlist, 0, 0, 2, 200+entitycounter*24, bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, call_filename, NULL, call_info);
				pan_objectlist.size_y += 24;
				//go on to next Object
				wait(1);
				entitycounter += 1;
				auswahlobjekte = ilt+1;
			}
		}
	}
	
	pan_setdigits(pan_objectlist, 0,    10, (200+(entitycounter+1)*24)+4, "NO MORE OBJECTS", arialing_bold, 1, ilt);
}



It loads the file list (a txt-pak file) from the chosen wrs file, readsout the filenames and creates buttons to it.
The complete filename list is stored in:
Code:
(objektnamen.pstring)[N]



to call a file and set placing_filename..etc, i just use the button function:
Click to reveal..

Code:
void call_filename(var butt_num)
{
	str_cpy(placing_filename, (objektnamen.pstring)[butt_num-1]);
	str_cpy(regive_filename, placing_filename);
	str_trunc(placing_filename, 3);
	str_cat(placing_filename, "pak");
	str_cpy(placing_setupname, "Models\\Map\\");
	str_cat(placing_setupname, placing_filename);
	str_cpy(placing_filename, (objektnamen.pstring)[butt_num-1]);
	
	ent_morph(preview_entity, placing_filename);
	set(preview_entity, PASSABLE | TRANSLUCENT | UNTOUCHABLE);
	preview_entity.alpha = 50;
	ent_morph(rotate_preview, placing_filename);
	rotate_preview.material = mtl_specBump;
}




Last edited by Espér; 06/29/12 07:10.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<