Exemplo n.º 1
0
Arquivo: main.c Projeto: prophile/dim3
void app_check_editor_link(void)
{
	int				len;
	char			path[1024];
	unsigned char	uc_len;
	FILE			*file;
	
	setup.editor_override.on=FALSE;

		// attempt to open editor link file
		
	file_paths_base(&setup.file_path_setup,path,"editor_link","tmp");
	
	file=fopen(path,"rb");
	if (file==NULL) return;
	
		// name

	fread(&uc_len,1,1,file);
	len=(int)uc_len;
	fread(setup.editor_override.map,1,len,file);

		// position

	fread(&setup.editor_override.pt,1,sizeof(d3pnt),file);
	fread(&setup.editor_override.ang,1,sizeof(d3ang),file);

	fclose(file);
	
		// get rid of the file
		
	remove(path);

		// mark editor override

	setup.editor_override.on=TRUE;
}
Exemplo n.º 2
0
Arquivo: launch.c Projeto: rzel/dim3
void launch_engine(void)
{
	char					err_str[256],path[1024];
	unsigned char			uc_len;
	d3pnt					pnt;
	d3ang					ang;
	FILE					*file;
	
		// ok to save?

	if (os_dialog_confirm("Save Changes and Launch Engine?","You need to save changes to this project before you can launch the engine.  Click Yes to save changes and launch the map in the engine.",FALSE)!=0) return;

		// save specific mode
		// data

	switch (state.mode) {

		case app_mode_project:
			iface_write(&iface,err_str);
			break;

		case app_mode_map:
			if (state.map.map_open) file_save_map();
			break;

		case app_mode_model:
			if (state.model.model_open) model_file_save();
			break;

	}

		// if we are in the map
		// state, launch to that map

	if (state.mode==app_mode_map) {
		
			// the link file
			
		file_paths_dim3_app_data(&file_path_setup,path,"dim3EditorLink","tmp");

		file=fopen(path,"w");
		if (file==NULL) return;
		
			// map name
			
		uc_len=(unsigned char)strlen(map.info.name);
   		fwrite(&uc_len,1,1,file);
   		fwrite(map.info.name,1,strlen(map.info.name),file);
		
			// map position
			
		view_get_position(&pnt);
		view_get_angle(&ang);
			
		fwrite(&pnt,1,sizeof(d3pnt),file);
		fwrite(&ang,1,sizeof(d3ang),file);
		
		fclose(file);
	}
	
		// run engine
		
	file_paths_base(&file_path_setup,path,pref.engine_name,D3_APP_EXTENSION);
	if (!os_launch_process(path,FALSE)) {
		os_dialog_alert("Launch Engine","Could not find Engine, check engine name in preferences.");
    }
}