void close_Edit_window();
void GUI_MAP_OBJECTS_EDIT();
void GUI_MAP_OBJECTS_START();
void GUI_MAP_OBJECTS_ADD();
void delete_object();

LBG_WINDOW* startwindow;
LBG_WINDOW* Edit_Map_Object;
LBG_WINDOW* Change_Map_Object;

LBG_LISTBOX* listbox1;
LBG_BUTTON* button1;
LBG_BUTTON* button2;
LBG_BUTTON* button3;

LBG_BUTTON* button4; // Change Object Window
LBG_BUTTON* button5; // Edit Apply
LBG_BUTTON* button6; // Edit Close Window

LBG_BUTTON* button7; // Change Object
LBG_BUTTON* button8; // Close Change Window
LBG_BUTTON* button9; // Ped Map Generator

LBG_EDITBOX* edit_OBJ_ID;
LBG_EDITBOX* edit_CORD_X;
LBG_EDITBOX* edit_CORD_Y;
LBG_EDITBOX* edit_CORD_Z;

LBG_EDITBOX* edit_PAN_X;
LBG_EDITBOX* edit_LILT_Y;

LBG_EDITBOX* ObjectMonsterUN;
LBG_EDITBOX* ObjectTexturIndex;
LBG_EDITBOX* ObjectSCRIndex;
LBG_EDITBOX* ObjectBodyCondition;
LBG_COMBOBOX* IsEvent; // Combobox
LBG_COMBOBOX* EventType; //Combobox

LBG_EDITBOX* EventIndexFrom;
LBG_EDITBOX* EventIndexTo;
LBG_EDITBOX* EventIndex3;
LBG_EDITBOX* info_text;

LBG_COMBOBOX* Change_Object_filter;
LBG_LISTBOX* listbox_object_ids;

LBG_VSCROLLBAR* listbox1_scrollbar;


LBG_EDITBOX* obj_edit_info;

LBG_EDITBOX* obj_OBJUID;
LBG_EDITBOX* obj_OBJBC;
LBG_EDITBOX* obj_OBJCX;
LBG_EDITBOX* obj_OBJCY;
LBG_EDITBOX* obj_OBJCZ;
LBG_EDITBOX* obj_OBJPAN;
LBG_EDITBOX* obj_OBJTILT;
LBG_EDITBOX* obj_OBJMUID;
LBG_EDITBOX* obj_OBJTEXIDX;
LBG_EDITBOX* obj_OBJSCRIDX;
LBG_EDITBOX* obj_OBJBODYC;
LBG_EDITBOX* obj_OBJISEVENT;
LBG_EDITBOX* obj_OBJEVENTTYPE;
LBG_EDITBOX* obj_OBJEVIDXF;
LBG_EDITBOX* obj_OBJEVIDXT;
LBG_EDITBOX* obj_OBJEVIDX3;
LBG_EDITBOX* obj_OBJEVNTINFO;


void close_change_object_window()
{
	LBG_destroy_window (Change_Map_Object);
}

void GUI_PED_MAP_EDIT()
{
	var coord_x = 0;
	var coord_y = 0;
	
	aas_window = LBG_create_window(0,0,50, 238, 120 ,12, 1,"Air Supply Shop",&win_bbmaps,&win_cbmaps,&win_tbmaps,1, 0, WF_SHOW);
	LBG_EDITBOX* tempEditBox = LBG_create_editbox (aas_window, 0, 10, 115, 5, 3, "Shop UID:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); EditASS_INPUT = LBG_create_editbox (aas_window, 120, 10, 100, 16, 4, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW ); 
	//startwindow.text.font = text_font;
	button9 = LBG_create_button(aas_window,50,50,16,4,"Generate",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),create_ped_map,BF_SHOW);
	var temp123456 = 0;
	while(temp123456 < 65536)
	{
		if(sma_data2[temp123456].EventP1 > 0)
		{
//			str_cat(EditASS_INPUT.caption ,str_for_int(NULL, sma_data2[temp123456].EventP1));
//			LBG_update_editbox(EditASS_INPUT);
			my = ent_create("ped_ja.tga",vector(coord_x,coord_y,5000),NULL);
			my.tilt = 90;
			
		}
		coord_y +=40;
		if(coord_y >= 10240)
		{
			coord_y = 0;
			coord_x +=40;
		}
		
		
		temp123456 +=1;
	}
}

var move_staerke = 0.1;

void update_edit_object() // updated die infos
{

					str_cpy(obj_OBJUID.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].map_object_id)); LBG_update_editbox(obj_OBJUID);
					str_cpy(obj_OBJBC.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].obj_counter)); LBG_update_editbox(obj_OBJBC);
					str_cpy(obj_OBJCX.caption,str_for_float(NULL,map_objects[listbox1.marked_item.skill_x].x)); LBG_update_editbox(obj_OBJCX);
					str_cpy(obj_OBJCY.caption,str_for_float(NULL,map_objects[listbox1.marked_item.skill_x].y)); LBG_update_editbox(obj_OBJCY);
					str_cpy(obj_OBJCZ.caption,str_for_float(NULL,map_objects[listbox1.marked_item.skill_x].z)); LBG_update_editbox(obj_OBJCZ);
					str_cpy(obj_OBJPAN.caption,str_for_float(NULL,map_objects[listbox1.marked_item.skill_x].pan)); LBG_update_editbox(obj_OBJPAN);
					str_cpy(obj_OBJTILT.caption,str_for_float(NULL,map_objects[listbox1.marked_item.skill_x].roll)); LBG_update_editbox(obj_OBJTILT);
					str_cpy(obj_OBJMUID.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].ObjectMonsterUnique)); LBG_update_editbox(obj_OBJMUID);
					str_cpy(obj_OBJTEXIDX.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].ObjectTexIndex)); LBG_update_editbox(obj_OBJTEXIDX);
					str_cpy(obj_OBJSCRIDX.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].ObjectScrIndex)); LBG_update_editbox(obj_OBJSCRIDX);
					str_cpy(obj_OBJBODYC.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].BodyCondition)); LBG_update_editbox(obj_OBJBODYC);
					str_cpy(obj_OBJISEVENT.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].IsEvent)); LBG_update_editbox(obj_OBJISEVENT);
					str_cpy(obj_OBJEVENTTYPE.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].EventType)); LBG_update_editbox(obj_OBJEVENTTYPE);
					str_cpy(obj_OBJEVIDXF.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].EventIndexFrom)); LBG_update_editbox(obj_OBJEVIDXF);
					str_cpy(obj_OBJEVIDXT.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].EventIndexTo)); LBG_update_editbox(obj_OBJEVIDXT);
					str_cpy(obj_OBJEVIDX3.caption,str_for_int(NULL,objData[listbox1.marked_item.skill_x].EventIndex3)); LBG_update_editbox(obj_OBJEVIDX3);
					str_cpy(obj_OBJEVNTINFO.caption,objData[listbox1.marked_item.skill_x].info_text); LBG_update_editbox(obj_OBJEVNTINFO);
}

var temp_old_obj = 99999;
var select_oldobj;

void update_edit_pf()
{
					rotate_pan.x = map_objects[listbox1.marked_item.skill_x].x;
					rotate_pan.y = map_objects[listbox1.marked_item.skill_x].y;
					rotate_pan.z = map_objects[listbox1.marked_item.skill_x].z;
					rotate_tilt.x = map_objects[listbox1.marked_item.skill_x].x;
					rotate_tilt.y = map_objects[listbox1.marked_item.skill_x].y;
					rotate_tilt.z = map_objects[listbox1.marked_item.skill_x].z;
					
					obj_z_Pfeil.x = map_objects[listbox1.marked_item.skill_x].x;
					obj_z_Pfeil.y = map_objects[listbox1.marked_item.skill_x].y;
					obj_z_Pfeil.z = map_objects[listbox1.marked_item.skill_x].z;
					
					obj_y_Pfeil.x = map_objects[listbox1.marked_item.skill_x].x;
					obj_y_Pfeil.y = map_objects[listbox1.marked_item.skill_x].y;
					obj_y_Pfeil.z = map_objects[listbox1.marked_item.skill_x].z;
					
					obj_x_Pfeil.x = map_objects[listbox1.marked_item.skill_x].x;
					obj_x_Pfeil.y = map_objects[listbox1.marked_item.skill_x].y;
					obj_x_Pfeil.z = map_objects[listbox1.marked_item.skill_x].z;
					
					rotate_pan.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					rotate_pan.scale_y = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					rotate_pan.scale_z = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					rotate_tilt.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 10;
					rotate_tilt.scale_y = map_objects[listbox1.marked_item.skill_x].max_y / 10;
					rotate_tilt.scale_z = map_objects[listbox1.marked_item.skill_x].max_y / 10;
					
					obj_z_Pfeil.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_z_Pfeil.scale_y = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_z_Pfeil.scale_z = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					
					obj_y_Pfeil.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_y_Pfeil.scale_y = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_y_Pfeil.scale_z = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					
					obj_x_Pfeil.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_x_Pfeil.scale_y = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
					obj_x_Pfeil.scale_z = map_objects[listbox1.marked_item.skill_x].max_y / 9.8;
}

void OBJ_Selected()
{		
					
					obj_select.x = objData[listbox1.marked_item.skill_x].vec_pos_x;
					obj_select.y = objData[listbox1.marked_item.skill_x].vec_pos_z;
					obj_select.z = objData[listbox1.marked_item.skill_x].vec_pos_y;
					obj_select.scale_x = map_objects[listbox1.marked_item.skill_x].max_y / 8;
					obj_select.scale_y = map_objects[listbox1.marked_item.skill_x].max_x / 8;
					obj_select.scale_z = map_objects[listbox1.marked_item.skill_x].max_z / 8;
					
					update_edit_pf();
					
					
					
						VECTOR* temp = vector(map_objects[listbox1.marked_item.skill_x].x,map_objects[listbox1.marked_item.skill_x].y,map_objects[listbox1.marked_item.skill_x].z);
						
						var cam_dist = 600;
						var cam_angle = 0;
						
							
														

							if(key_1){map_objects[listbox1.marked_item.skill_x].pan +=move_staerke * time_step;}
							if(key_2){map_objects[listbox1.marked_item.skill_x].pan -=move_staerke * time_step;}
							if(key_3){map_objects[listbox1.marked_item.skill_x].roll +=move_staerke * time_step;}
							if(key_4){map_objects[listbox1.marked_item.skill_x].roll -=move_staerke * time_step;}
							if(key_ins){move_staerke +=0.1;}
							if(key_del){move_staerke -=0.1;}
							
							objData[listbox1.marked_item.skill_x].vec_pos_x = map_objects[listbox1.marked_item.skill_x].x;
							objData[listbox1.marked_item.skill_x].vec_pos_z = map_objects[listbox1.marked_item.skill_x].y;
							objData[listbox1.marked_item.skill_x].vec_pos_y = map_objects[listbox1.marked_item.skill_x].z;
							obj_select.x = objData[listbox1.marked_item.skill_x].vec_pos_x;
							obj_select.y = objData[listbox1.marked_item.skill_x].vec_pos_z;
							obj_select.z = objData[listbox1.marked_item.skill_x].vec_pos_y;
							
							
							
							object_view.x = map_objects[listbox1.marked_item.skill_x].x + fcos(cam_angle,-cam_dist);		// Positionierung der Kamera um dem Player
							object_view.y = map_objects[listbox1.marked_item.skill_x].y + fsin(cam_angle,-cam_dist);		// Positionierung der Kamera um dem Player
							object_view.z = map_objects[listbox1.marked_item.skill_x].z + 300; 							// Höhe der Kamera
							cam_angle += 1 * time_step;							// Variable zur Änderung der Kamera Position
							vec_diff(temp.x,map_objects[listbox1.marked_item.skill_x].x,object_view.x);						// Berechnung des Richtungsvektors
							vec_to_angle (object_view.pan,temp.x);					// Drehungen der Kamera zum Player
							temporaere = mouse_ent;
							update_edit_object();
							
}

void clone_Object()
{
	if(listbox1.marked_item)
		{	
			ANGLE winkel;
			hData.object_block_count +=1;
			hData.FileSize +=112;
			hData.DataSize +=112;
			Edit_object_Clone = hData.object_block_count - 1;
			memcpy ( &objData[Edit_object_Clone], &objData[listbox1.marked_item.skill_x], sizeof(DAT_STRUC_MAPOBJECTS) );
			
			var vec_x = objData[Edit_object_Clone].vec_pos_x;
			var vec_y = objData[Edit_object_Clone].vec_pos_y;
			var vec_z = objData[Edit_object_Clone].vec_pos_z;
			
			VECTOR* Angel_1 = vec_normalize(vector(objData[Edit_object_Clone].vec_vel_x,objData[Edit_object_Clone].vec_vel_z,objData[Edit_object_Clone].vec_vel_y),1);
			
			vec_to_angle (winkel, Angel_1);
			
			STRING* objname = str_create(str_for_int(NULL,0));
			STRING* obj_test_id = str_for_int(NULL,objData[Edit_object_Clone].map_object_id);
			str_cat(objname,str_for_int(NULL,objData[Edit_object_Clone].map_object_id));
			//SendMessage(hWndListbox, LB_ADDSTRING, 0,_chr(obj_test_id));
			str_cat(objname,".mdl");
			map_objects[Edit_object_Clone] = ent_create(objname,vector(vec_x,vec_z,vec_y),NULL);
			map_objects[Edit_object_Clone].pan = 	winkel.pan -90;
			map_objects[Edit_object_Clone].roll = 	winkel.tilt;
			map_objects[Edit_object_Clone].skill21 = Edit_object_Clone;
			objData[Edit_object_Clone].obj_counter = Edit_object_Clone;
			c_setminmax (map_objects[Edit_object_Clone]);
			LBG_create_listitem(listbox1, Edit_object_Clone,str_for_int(NULL,objData[Edit_object_Clone].map_object_id), 0);
			LBG_update_listbox (listbox1);
			
					
		}
}

void draw_bbox1(ENTITY* temp)
{
  me = temp;
  var vMin[3];
  var vMax[3];  
 
    vec_set(vMin,my.x);
    vec_add(vMin,my.min_x);    
    vec_set(vMax,my.x);
    vec_add(vMax,my.max_x);    
    draw_box3d(vMin,vMax,vector(0,0,255),100);   
   
}

void transform()
{
	while(1)
	{
		if(temporaere)
		{
			
			if(EditorModus == EDITOR_MODE_OBJECTS)
			{
				draw_bbox1(map_objects[listbox1.marked_item.skill_x]);
			}
			
			
		}
		if(mouse_ent == rotate_pan || mouse_ent == rotate_tilt || mouse_ent == obj_x_Pfeil || mouse_ent == obj_y_Pfeil || mouse_ent == obj_z_Pfeil && buttoun_state > 0)
		{button_e_over = 1;}
		else{button_e_over = 0;}
		
		
		
		if(mouse_ent == rotate_pan && buttoun_state == 2)
		{
			ent_morphskin ( rotate_pan, "rotate_selected.tga");
			while(mouse_left)
			{
				map_objects[listbox1.marked_item.skill_x].pan +=mouse_force.x * 10 ;
				update_edit_object();
				//update_edit_pf();
				wait(1);
			}
			
		}
		else{ent_morphskin ( rotate_pan,"rotate_pan.tga");}
							
		if(mouse_ent == rotate_tilt && buttoun_state == 2)
		{
			ent_morphskin ( rotate_tilt, "rotate_selected.tga");
			while(mouse_left)
			{
				map_objects[listbox1.marked_item.skill_x].roll -=mouse_force.y * 10;
				update_edit_object();
				//update_edit_pf();
				wait(1);
			}
		}
		else{ent_morphskin ( rotate_tilt,"rotate_tilt.tga");}
		
		if(mouse_ent == obj_z_Pfeil && buttoun_state == 1)
		{
			ent_morphskin ( obj_z_Pfeil, "rotate_selected.tga");
			while(mouse_left)
			{
				map_objects[listbox1.marked_item.skill_x].z +=mouse_force.y * 50;
				update_edit_object();
				update_edit_pf();
				wait(1);
			}
		}
		else{ent_morphskin ( obj_z_Pfeil,"move_z.tga");}
		
		if(mouse_ent == obj_y_Pfeil && buttoun_state == 1)
		{
			ent_morphskin ( obj_y_Pfeil, "rotate_selected.tga");
			while(mouse_left)
			{
				map_objects[listbox1.marked_item.skill_x].x +=mouse_force.y * 50;
				update_edit_object();
				update_edit_pf();
				wait(1);
			}
		}
		else{ent_morphskin ( obj_y_Pfeil,"move_y.tga");}
		
		if(mouse_ent == obj_x_Pfeil && buttoun_state == 1)
		{
			ent_morphskin ( obj_x_Pfeil, "rotate_selected.tga");
			while(mouse_left)
			{
				map_objects[listbox1.marked_item.skill_x].y -=mouse_force.x * 50;
				update_edit_object();
				update_edit_pf();
				wait(1);
			}
		}
		else{ent_morphskin ( obj_x_Pfeil,"move_x.tga");}
		
		wait(1);
	}
}

void GUI_MAP_OBJECTS_START()
{
	if(aas_window)
	{
		LBG_destroy_window (aas_window);
	}
	Edit_type = 2;
	obj_select = ent_create("selectOBJ.mdl",vector(0,0,0),NULL);
	
	obj_z_Pfeil = ent_create("move.mdl",vector(0,0,0),NULL);
	obj_z_Pfeil.material = doublesided;
	set(obj_z_Pfeil,INVISIBLE);
	
	obj_y_Pfeil = ent_create("move.mdl",vector(0,0,0),NULL);
	obj_y_Pfeil.material = doublesided;
	set(obj_y_Pfeil,INVISIBLE);
	obj_y_Pfeil.tilt = 90;
	
	obj_x_Pfeil = ent_create("move.mdl",vector(0,0,0),NULL);
	obj_x_Pfeil.material = doublesided;
	set(obj_x_Pfeil,INVISIBLE);
	obj_x_Pfeil.tilt = 90;
	obj_x_Pfeil.roll = 90;
	
	
	
//	obj_y_Pfeil = ent_create("move.mdl",vector(0,0,0),NULL);

//	obj_x_Pfeil = ent_create("move.mdl",vector(0,0,0),NULL);

	rotate_pan = ent_create("rotate.mdl",vector(0,0,0),NULL);
	rotate_pan.material = doublesided;
	rotate_pan.pan += 90;
	rotate_pan.roll += 90;
	
	set(rotate_pan,POLYGON);
	rotate_tilt = ent_create("rotate.mdl",vector(0,0,0),NULL);
	rotate_tilt.material = doublesided;
	
	set(rotate_tilt,POLYGON);
	set(rotate_pan,INVISIBLE);
	set(rotate_tilt,INVISIBLE);
	Editor_Mode =0;
	transform();
	//set(obj_select,SHOW);
	set(obj_select,INVISIBLE);
	if(Edit_type == 2 && obj_editor == 0)
	{
		obj_editor = 1;
		startwindow = LBG_create_window(0, 0, 60, 265, 420, 12, 1,"",&win_bbmaps,&win_cbmaps,&win_tbmaps,1, 0, WF_SHOW|WF_DONTMOVE);
		listbox1 = LBG_create_listbox (startwindow, 5, 0, 245, 350, 5, 5, 190, 350, &listbox_bmaps, LF_SHOW | LF_AUTOVSCROLL  );
		button1 = LBG_create_button(startwindow,5,355,5,5,"Clone Object",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),clone_Object,BF_SHOW);
		button2 = LBG_create_button(startwindow,90,355,5,5,"Add Object",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),NULL,BF_SHOW);
		button3 = LBG_create_button(startwindow,175,355,5,5,"Del Object",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),NULL,BF_SHOW);
		listbox1_scrollbar = LBG_create_vscrollbar(listbox1, LBG_vsbmaps (vscrollbar_top_tga,vscrollbar_middle_tga,vscrollbar_bottom_tga,vscrollbar_bar_tga), LBG_bbmaps(vscrollbar_up1_tga,vscrollbar_up2_tga,vscrollbar_up3_tga,vscrollbar_up1_tga,vscrollbar_up2_tga,vscrollbar_up1_tga), LBG_bbmaps(vscrollbar_down1_tga,vscrollbar_down2_tga,vscrollbar_down3_tga,vscrollbar_down1_tga,vscrollbar_down2_tga,vscrollbar_down1_tga), VSF_SHOW);
		
		listbox1->tpos_x = 1; // This sets the text position of the items of this list relative to their positions
		listbox1->tpos_y = 1;
		listbox1->itemheight = 20; 
		listbox1->bmaps_over.bmap_left = listitem_over_left_tga; // This determines the bitmap of the list items, when the mouse is over them.
		listbox1->bmaps_over.bmap_middle = listitem_over_middle_tga;
		listbox1->bmaps_over.bmap_right = listitem_over_right_tga;
		listbox1->bmaps_marked.bmap_left = listitem_marked_left_tga; // This determines the bitmap of the list items, when they are selected.
		listbox1->bmaps_marked.bmap_middle = listitem_marked_middle_tga;
		listbox1->bmaps_marked.bmap_right = listitem_marked_right_tga;
		listbox1->Select = OBJ_Selected;
		vec_set(button1.color_default,vector(1,1,1));
		vec_set(button1.color_over,vector(255,153,0));
		vec_set(button2.color_default,vector(1,1,1));
		vec_set(button2.color_over,vector(255,153,0));
		vec_set(button3.color_default,vector(1,1,1));
		vec_set(button3.color_over,vector(255,153,0));
		vec_set(listbox1->color_default,vector(1,1,1));
		vec_set(listbox1->color_over,vector(255,153,0));	// When the mouse over a list item, its text should turn cyan
		vec_set(listbox1->color_marked,vector(255,0,0));	// When it's marked, it should be yellow.
		GUI_MAP_OBJECTS_EDIT();
		var i;
		for(i = 0;i < hData.object_block_count;i++)
		{
		
				LBG_create_listitem(listbox1, i,str_for_int(NULL,objData[i].map_object_id), 0);
				LBG_update_listbox (listbox1);
				LBG_update_window (startwindow); //map_object_id
		
		}	
	}
	else
	{
		LBG_destroy_window (Edit_Map_Object);
		LBG_destroy_window (startwindow);
		ptr_remove(obj_select);
		obj_editor = 0;
	}
}

void delete_object()
{
		if(listbox1.marked_item)
		{	
			objData[listbox1.marked_item.skill_x].obj_counter = 9999;
			set(map_objects[listbox1.marked_item.skill_x],INVISIBLE);
			LBG_destroy_listitem (listbox1.marked_item);
			LBG_update_listbox (listbox1);
			Edit_Object_count -=1;
			
		}
}

void GUI_MAP_OBJECTS_EDIT()
{
	
		Edit_Map_Object = LBG_create_window(0, 0, 480, 265, 500, 12, 1,"",&win_bbmaps,&win_cbmaps,&win_tbmaps,1, 0, WF_SHOW|WF_DONTMOVE );
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 10, 116, 5, 3, "Obj UID:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 			obj_OBJUID = LBG_create_editbox (Edit_Map_Object, 120, 10, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 35, 116, 5, 3, "Obj BC :", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 			obj_OBJBC = LBG_create_editbox (Edit_Map_Object, 120, 35, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 60, 116, 5, 3, "Vector X:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 			obj_OBJCX = LBG_create_editbox (Edit_Map_Object, 120, 60, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 85, 116, 5, 3, "Vector Y:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 			obj_OBJCY = LBG_create_editbox (Edit_Map_Object, 120, 85, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 110, 116, 5, 3, "Vector Z:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 		obj_OBJCZ = LBG_create_editbox (Edit_Map_Object, 120, 110, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 135, 116, 5, 3, "Rotation Pan:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJPAN = LBG_create_editbox (Edit_Map_Object, 120, 135, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 160, 116, 5, 3, "Rotation Tilt:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  );	obj_OBJTILT = LBG_create_editbox (Edit_Map_Object, 120, 160, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 185, 116, 5, 3, "Obj Monster UID:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJMUID = LBG_create_editbox (Edit_Map_Object, 120, 185, 100,5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 210, 116, 5, 3, "Obj Tex Index:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJTEXIDX = LBG_create_editbox (Edit_Map_Object, 120, 210, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 235, 116, 5, 3, "OBJ Scr Index:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJSCRIDX = LBG_create_editbox (Edit_Map_Object, 120, 235, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 260, 116, 5, 3, "Body Condition:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJBODYC = LBG_create_editbox (Edit_Map_Object, 120, 260, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 285, 116, 5, 3, "Is Event:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 		obj_OBJISEVENT = LBG_create_editbox (Edit_Map_Object, 120, 285, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 310, 116, 5, 3, "Event Type:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 		obj_OBJEVENTTYPE = LBG_create_editbox (Edit_Map_Object, 120, 310, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 335, 116, 5, 3, "Event Idx From:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJEVIDXF = LBG_create_editbox (Edit_Map_Object, 120, 335, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 360, 116, 5, 3, "Event Idx To:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 	obj_OBJEVIDXT = LBG_create_editbox (Edit_Map_Object, 120, 360, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 385, 116, 5, 3, "Evemt Idx 3:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 		obj_OBJEVIDX3 = LBG_create_editbox (Edit_Map_Object, 120, 385, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		obj_edit_info = LBG_create_editbox (Edit_Map_Object, 0, 410, 116, 5, 3, "Event Info:", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_DISABLED  ); 		obj_OBJEVNTINFO = LBG_create_editbox (Edit_Map_Object, 120, 410, 100, 5, 3, "", LBG_ebmaps(editbox_left_tga,editbox_middle_tga,editbox_right_tga), EF_SHOW|EF_READONLY ); 
		
	//	listbox1 = LBG_create_listbox (Edit_Map_Object, 10, 10, 200, 400, 16, 16, 160, 224, &listbox_bmaps, LF_SHOW | LF_MULTIPLE | LF_UNSELECT);
	//	button1 = LBG_create_button(Edit_Map_Object,45,420,16,4,"Edit Object",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),GUI_MAP_OBJECTS_EDIT,BF_SHOW);
	//	button2 = LBG_create_button(Edit_Map_Object,45,460,16,4,"Add Object",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),NULL,BF_SHOW);
//		button3 = LBG_create_button(Edit_Map_Object,45,480,16,4,"Close",LBG_bbmaps(kl_button1_tga,kl_button2_tga,kl_button3_tga,kl_button4_tga,kl_button5_tga,kl_button6_tga),close_Edit_window,BF_SHOW);
}

void close_Edit_window()
{
	LBG_destroy_window (Edit_Map_Object);
}

