@ -69,7 +69,7 @@ using df::global::gps;
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					// Predefined common guard functions
 // Predefined common guard functions
  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : default_hotkey ( Core  * ,  df : : viewscreen  * top ) bool  Gui : : default_hotkey ( Core  * ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    // Default hotkey guard function
 
    // Default hotkey guard function
 
 
			
		
	
		
		
			
				
					
					    for  ( ; top  ; top  =  top - > parent ) 
    for  ( ; top  ; top  =  top - > parent ) 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -78,26 +78,26 @@ bool DFHack::default_hotkey(Core *, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    return  false ; 
    return  false ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : dwarfmode_hotkey ( Core  * ,  df : : viewscreen  * top ) bool  Gui : : dwarfmode_hotkey ( Core  * ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    // Require the main dwarf mode screen
 
    // Require the main dwarf mode screen
 
 
			
		
	
		
		
			
				
					
					    return  ! ! strict_virtual_cast < df : : viewscreen_dwarfmodest > ( top ) ; 
    return  ! ! strict_virtual_cast < df : : viewscreen_dwarfmodest > ( top ) ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : unitjobs_hotkey ( Core  * ,  df : : viewscreen  * top ) bool  Gui : : unitjobs_hotkey ( Core  * ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    // Require the unit or jobs list
 
    // Require the unit or jobs list
 
 
			
		
	
		
		
			
				
					
					    return  ! ! strict_virtual_cast < df : : viewscreen_joblistst > ( top )  | | 
    return  ! ! strict_virtual_cast < df : : viewscreen_joblistst > ( top )  | | 
 
			
		
	
		
		
			
				
					
					           ! ! strict_virtual_cast < df : : viewscreen_unitlistst > ( top ) ; 
           ! ! strict_virtual_cast < df : : viewscreen_unitlistst > ( top ) ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : item_details_hotkey ( Core  * ,  df : : viewscreen  * top ) bool  Gui : : item_details_hotkey ( Core  * ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    // Require the main dwarf mode screen
 
    // Require the main dwarf mode screen
 
 
			
		
	
		
		
			
				
					
					    return  ! ! strict_virtual_cast < df : : viewscreen_itemst > ( top ) ; 
    return  ! ! strict_virtual_cast < df : : viewscreen_itemst > ( top ) ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : cursor_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : cursor_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( ! dwarfmode_hotkey ( c ,  top ) ) 
    if  ( ! dwarfmode_hotkey ( c ,  top ) ) 
 
			
		
	
		
		
			
				
					
					        return  false ; 
        return  false ; 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -109,7 +109,7 @@ bool DFHack::cursor_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    return  true ; 
    return  true ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : workshop_job_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : workshop_job_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  namespace  ui_sidebar_mode ; 
    using  namespace  ui_sidebar_mode ; 
 
			
		
	
		
		
			
				
					
					    using  df : : global : : ui ; 
    using  df : : global : : ui ; 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -147,7 +147,7 @@ bool DFHack::workshop_job_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : build_selector_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : build_selector_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  namespace  ui_sidebar_mode ; 
    using  namespace  ui_sidebar_mode ; 
 
			
		
	
		
		
			
				
					
					    using  df : : global : : ui ; 
    using  df : : global : : ui ; 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -175,7 +175,7 @@ bool DFHack::build_selector_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : view_unit_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : view_unit_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  df : : global : : ui ; 
    using  df : : global : : ui ; 
 
			
		
	
		
		
			
				
					
					    using  df : : global : : world ; 
    using  df : : global : : world ; 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -191,7 +191,7 @@ bool DFHack::view_unit_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    return  vector_get ( world - > units . other [ 0 ] ,  * ui_selected_unit )  ! =  NULL ; 
    return  vector_get ( world - > units . other [ 0 ] ,  * ui_selected_unit )  ! =  NULL ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : unit_inventory_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : unit_inventory_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  df : : global : : ui_unit_view_mode ; 
    using  df : : global : : ui_unit_view_mode ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -203,7 +203,7 @@ bool DFHack::unit_inventory_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    return  ui_unit_view_mode - > value  = =  df : : ui_unit_view_mode : : Inventory ; 
    return  ui_unit_view_mode - > value  = =  df : : ui_unit_view_mode : : Inventory ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					df : : job  * DFHack : : getSelectedWorkshopJob ( Core  * c ,  bool  quiet ) df : : job  * Gui : : getSelectedWorkshopJob ( Core  * c ,  bool  quiet )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  df : : global : : world ; 
    using  df : : global : : world ; 
 
			
		
	
		
		
			
				
					
					    using  df : : global : : ui_workshop_job_cursor ; 
    using  df : : global : : ui_workshop_job_cursor ; 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -226,7 +226,7 @@ df::job *DFHack::getSelectedWorkshopJob(Core *c, bool quiet)
 
			
		
	
		
		
			
				
					
					    return  selected - > jobs [ idx ] ; 
    return  selected - > jobs [ idx ] ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : any_job_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : any_job_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( VIRTUAL_CAST_VAR ( screen ,  df : : viewscreen_joblistst ,  top ) ) 
    if  ( VIRTUAL_CAST_VAR ( screen ,  df : : viewscreen_joblistst ,  top ) ) 
 
			
		
	
		
		
			
				
					
					        return  vector_get ( screen - > jobs ,  screen - > cursor_pos )  ! =  NULL ; 
        return  vector_get ( screen - > jobs ,  screen - > cursor_pos )  ! =  NULL ; 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -237,7 +237,7 @@ bool DFHack::any_job_hotkey(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    return  workshop_job_hotkey ( c , top ) ; 
    return  workshop_job_hotkey ( c , top ) ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					df : : job  * DFHack : : getSelectedJob ( Core  * c ,  bool  quiet ) df : : job  * Gui : : getSelectedJob ( Core  * c ,  bool  quiet )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    df : : viewscreen  * top  =  c - > getTopViewscreen ( ) ; 
    df : : viewscreen  * top  =  c - > getTopViewscreen ( ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -285,7 +285,7 @@ static df::unit *getAnyUnit(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					        return  ref  ?  ref - > getUnit ( )  :  NULL ; 
        return  ref  ?  ref - > getUnit ( )  :  NULL ; 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    if  ( ! ( c , top ) ) 
    if  ( ! Gui: :  dwarfmode_hotkey( c , top ) ) 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					        return  NULL ; 
        return  NULL ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    switch  ( ui - > main . mode )  { 
    switch  ( ui - > main . mode )  { 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -312,12 +312,12 @@ static df::unit *getAnyUnit(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : any_unit_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : any_unit_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    return  getAnyUnit ( c ,  top )  ! =  NULL ; 
    return  getAnyUnit ( c ,  top )  ! =  NULL ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					df : : unit  * DFHack : : getSelectedUnit ( Core  * c ,  bool  quiet ) df : : unit  * Gui : : getSelectedUnit ( Core  * c ,  bool  quiet )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    df : : unit  * unit  =  getAnyUnit ( c ,  c - > getTopViewscreen ( ) ) ; 
    df : : unit  * unit  =  getAnyUnit ( c ,  c - > getTopViewscreen ( ) ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -344,7 +344,7 @@ static df::item *getAnyItem(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					        return  ref  ?  ref - > getItem ( )  :  NULL ; 
        return  ref  ?  ref - > getItem ( )  :  NULL ; 
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    if  ( ! ( c , top ) ) 
    if  ( ! Gui: :  dwarfmode_hotkey( c , top ) ) 
 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					        return  NULL ; 
        return  NULL ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    switch  ( ui - > main . mode )  { 
    switch  ( ui - > main . mode )  { 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -387,12 +387,12 @@ static df::item *getAnyItem(Core *c, df::viewscreen *top)
 
			
		
	
		
		
			
				
					
					    } 
    } 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  DFHack : : any_item_hotkey ( Core  * c ,  df : : viewscreen  * top ) bool  Gui : : any_item_hotkey ( Core  * c ,  df : : viewscreen  * top )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    return  getAnyItem ( c ,  top )  ! =  NULL ; 
    return  getAnyItem ( c ,  top )  ! =  NULL ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					df : : item  * DFHack : : getSelectedItem ( Core  * c ,  bool  quiet ) df : : item  * Gui : : getSelectedItem ( Core  * c ,  bool  quiet )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    df : : item  * item  =  getAnyItem ( c ,  c - > getTopViewscreen ( ) ) ; 
    df : : item  * item  =  getAnyItem ( c ,  c - > getTopViewscreen ( ) ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -404,7 +404,7 @@ df::item *DFHack::getSelectedItem(Core *c, bool quiet)
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					//
 //
  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  DFHack : : showAnnouncement ( std : : string  message ,  int  color ,  bool  bright ) void  Gui : : showAnnouncement ( std : : string  message ,  int  color ,  bool  bright )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  df : : global : : world ; 
    using  df : : global : : world ; 
 
			
		
	
		
		
			
				
					
					    using  df : : global : : cur_year ; 
    using  df : : global : : cur_year ; 
 
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -455,7 +455,7 @@ void DFHack::showAnnouncement(std::string message, int color, bool bright)
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					void  DFHack : : showPopupAnnouncement ( std : : string  message ,  int  color ,  bool  bright ) void  Gui : : showPopupAnnouncement ( std : : string  message ,  int  color ,  bool  bright )  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    using  df : : global : : world ; 
    using  df : : global : : world ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -466,77 +466,6 @@ void DFHack::showPopupAnnouncement(std::string message, int color, bool bright)
 
			
		
	
		
		
			
				
					
					    world - > status . popups . push_back ( popup ) ; 
    world - > status . popups . push_back ( popup ) ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					//
  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					Module *  DFHack : : createGui ( )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    return  new  Gui ( ) ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					struct  Gui : : Private  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    Private ( ) 
 
			
		
	
		
		
			
				
					
					    { 
 
			
		
	
		
		
			
				
					
					        Started  =  false ; 
 
			
		
	
		
		
			
				
					
					        StartedMenu  =  false ; 
 
			
		
	
		
		
			
				
					
					        StartedScreen  =  false ; 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    bool  Started ; 
 
			
		
	
		
		
			
				
					
					    int32_t  *  window_x_offset ; 
 
			
		
	
		
		
			
				
					
					    int32_t  *  window_y_offset ; 
 
			
		
	
		
		
			
				
					
					    int32_t  *  window_z_offset ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    bool  StartedMenu ; 
 
			
		
	
		
		
			
				
					
					    uint8_t  *  menu_width_offset ; 
 
			
		
	
		
		
			
				
					
					    uint8_t  *  area_map_width_offset ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    bool  StartedScreen ; 
 
			
		
	
		
		
			
				
					
					    void  *  screen_tiles_ptr_offset ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    Process  *  owner ; 
 
			
		
	
		
		
			
				
					
					} ;  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					Gui : : Gui ( )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    Core  &  c  =  Core : : getInstance ( ) ; 
 
			
		
	
		
		
			
				
					
					    d  =  new  Private ; 
 
			
		
	
		
		
			
				
					
					    d - > owner  =  c . p ; 
 
			
		
	
		
		
			
				
					
					    VersionInfo  *  mem  =  c . vinfo ; 
 
			
		
	
		
		
			
				
					
					    // Setting up menu state
 
 
			
		
	
		
		
			
				
					
					    df_menu_state  =  ( uint32_t  * )  &  df : : global : : ui - > main . mode ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    d - > window_x_offset  =  ( int32_t  * )  mem - > getAddress  ( " window_x " ) ; 
 
			
		
	
		
		
			
				
					
					    d - > window_y_offset  =  ( int32_t  * )  mem - > getAddress  ( " window_y " ) ; 
 
			
		
	
		
		
			
				
					
					    d - > window_z_offset  =  ( int32_t  * )  mem - > getAddress  ( " window_z " ) ; 
 
			
		
	
		
		
			
				
					
					    if ( d - > window_z_offset  & &  d - > window_y_offset  & &  d - > window_x_offset ) 
 
			
		
	
		
		
			
				
					
					        d - > Started  =  true ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    d - > menu_width_offset  =  ( uint8_t  * )  mem - > getAddress ( " ui_menu_width " ) ; 
 
			
		
	
		
		
			
				
					
					    d - > area_map_width_offset  =  ( uint8_t  * )  mem - > getAddress ( " ui_area_map_width " ) ; 
 
			
		
	
		
		
			
				
					
					    if  ( d - > menu_width_offset  & &  d - > area_map_width_offset ) 
 
			
		
	
		
		
			
				
					
					        d - > StartedMenu  =  true ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    d - > screen_tiles_ptr_offset  =  ( void  * )  mem - > getAddress  ( " screen_tiles_pointer " ) ; 
 
			
		
	
		
		
			
				
					
					    if ( d - > screen_tiles_ptr_offset ) 
 
			
		
	
		
		
			
				
					
					        d - > StartedScreen  =  true ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					Gui : : ~ Gui ( )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    delete  d ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : Start ( )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : Finish ( )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					df : : viewscreen  *  Gui : : GetCurrentScreen ( ) df : : viewscreen  *  Gui : : GetCurrentScreen ( )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    df : : viewscreen  *  ws  =  & gview - > view ; 
    df : : viewscreen  *  ws  =  & gview - > view ; 
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -552,27 +481,18 @@ df::viewscreen * Gui::GetCurrentScreen()
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : getViewCoords  ( int32_t  & x ,  int32_t  & y ,  int32_t  & z ) bool  Gui : : getViewCoords  ( int32_t  & x ,  int32_t  & y ,  int32_t  & z )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( ! d - > Started )  return  false ; 
    x  =  * df : : global : : window_x ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    Process  *  p  =  d - > owner ; 
    y  =  * df : : global : : window_y ; 
 
			
				
				
			
		
	
		
		
			
				
					
					
    z  =  * df : : global : : window_z ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    p - > readDWord  ( d - > window_x_offset ,  ( uint32_t  & )  x ) ; 
 
			
		
	
		
		
			
				
					
					    p - > readDWord  ( d - > window_y_offset ,  ( uint32_t  & )  y ) ; 
 
			
		
	
		
		
			
				
					
					    p - > readDWord  ( d - > window_z_offset ,  ( uint32_t  & )  z ) ; 
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    return  true ; 
    return  true ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					//FIXME: confine writing of coords to map bounds?
  
			
		
	
		
		
			
				
					
					bool  Gui : : setViewCoords  ( const  int32_t  x ,  const  int32_t  y ,  const  int32_t  z ) bool  Gui : : setViewCoords  ( const  int32_t  x ,  const  int32_t  y ,  const  int32_t  z )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( ! d - > Started ) 
    auto  cursor  =  df : : global : : cursor ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    { 
    ( * df : : global : : window_x )  =  x ; 
 
			
				
				
			
		
	
		
		
			
				
					
					        return  false ; 
    ( * df : : global : : window_y )  =  y ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    } 
    ( * df : : global : : window_z )  =  z ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    Process  *  p  =  d - > owner ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    p - > writeDWord  ( d - > window_x_offset ,  ( uint32_t )  x ) ; 
 
			
		
	
		
		
			
				
					
					    p - > writeDWord  ( d - > window_y_offset ,  ( uint32_t )  y ) ; 
 
			
		
	
		
		
			
				
					
					    p - > writeDWord  ( d - > window_z_offset ,  ( uint32_t )  z ) ; 
 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					    return  true ; 
    return  true ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -581,8 +501,7 @@ bool Gui::getCursorCoords (int32_t &x, int32_t &y, int32_t &z)
 
			
		
	
		
		
			
				
					
					    x  =  df : : global : : cursor - > x ; 
    x  =  df : : global : : cursor - > x ; 
 
			
		
	
		
		
			
				
					
					    y  =  df : : global : : cursor - > y ; 
    y  =  df : : global : : cursor - > y ; 
 
			
		
	
		
		
			
				
					
					    z  =  df : : global : : cursor - > z ; 
    z  =  df : : global : : cursor - > z ; 
 
			
		
	
		
		
			
				
					
					    if  ( x  = =  - 30000 )  return  false ; 
    return  ( x  = =  - 30000 )  ?  false  :  true ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					//FIXME: confine writing of coords to map bounds?
 //FIXME: confine writing of coords to map bounds?
  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -599,8 +518,7 @@ bool Gui::getDesignationCoords (int32_t &x, int32_t &y, int32_t &z)
 
			
		
	
		
		
			
				
					
					    x  =  df : : global : : selection_rect - > start_x ; 
    x  =  df : : global : : selection_rect - > start_x ; 
 
			
		
	
		
		
			
				
					
					    y  =  df : : global : : selection_rect - > start_y ; 
    y  =  df : : global : : selection_rect - > start_y ; 
 
			
		
	
		
		
			
				
					
					    z  =  df : : global : : selection_rect - > start_z ; 
    z  =  df : : global : : selection_rect - > start_z ; 
 
			
		
	
		
		
			
				
					
					    if  ( x  = =  - 30000 )  return  false ; 
    return  ( x  = =  - 30000 )  ?  false  :  true ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : setDesignationCoords  ( const  int32_t  x ,  const  int32_t  y ,  const  int32_t  z ) bool  Gui : : setDesignationCoords  ( const  int32_t  x ,  const  int32_t  y ,  const  int32_t  z )  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -615,8 +533,7 @@ bool Gui::getMousePos (int32_t & x, int32_t & y)
 
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    x  =  gps - > mouse_x ; 
    x  =  gps - > mouse_x ; 
 
			
		
	
		
		
			
				
					
					    y  =  gps - > mouse_y ; 
    y  =  gps - > mouse_y ; 
 
			
		
	
		
		
			
				
					
					    if ( x  = =  - 1 )  return  false ; 
    return  ( x  = =  - 1 )  ?  false  :  true ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : getWindowSize  ( int32_t  & width ,  int32_t  & height ) bool  Gui : : getWindowSize  ( int32_t  & width ,  int32_t  & height )  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -628,49 +545,14 @@ bool Gui::getWindowSize (int32_t &width, int32_t &height)
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : getMenuWidth ( uint8_t  & menu_width ,  uint8_t  & area_map_width ) bool  Gui : : getMenuWidth ( uint8_t  & menu_width ,  uint8_t  & area_map_width )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( ! d - > StartedMenu )  return  false ; 
    menu_width  =  * df : : global : : ui_menu_width ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    
    area_map_width  =  * df : : global : : ui_area_map_width ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    Process  *  p  =  d - > owner ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    p - > readByte  ( d - > menu_width_offset ,  menu_width ) ; 
 
			
		
	
		
		
			
				
					
					    p - > readByte  ( d - > area_map_width_offset ,  area_map_width ) ; 
 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					    return  true ; 
    return  true ; 
 
			
		
	
		
		
			
				
					
					} }  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : setMenuWidth ( const  uint8_t  menu_width ,  const  uint8_t  area_map_width ) bool  Gui : : setMenuWidth ( const  uint8_t  menu_width ,  const  uint8_t  area_map_width )  
			
		
	
		
		
			
				
					
					{ {  
			
		
	
		
		
			
				
					
					    if  ( ! d - > StartedMenu )  return  false ; 
    * df : : global : : ui_menu_width  =  menu_width ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    
    * df : : global : : ui_area_map_width  =  area_map_width ; 
 
			
				
				
			
		
	
		
		
			
				
					
					    Process  *  p  =  d - > owner ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    p - > writeByte  ( d - > menu_width_offset ,  menu_width ) ; 
 
			
		
	
		
		
			
				
					
					    p - > writeByte  ( d - > area_map_width_offset ,  area_map_width ) ; 
 
			
		
	
		
		
			
				
					
					    return  true ; 
 
			
		
	
		
		
			
				
					
					}  
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					bool  Gui : : getScreenTiles  ( int32_t  width ,  int32_t  height ,  t_screen  screen [ ] )  
			
		
	
		
		
			
				
					
					{  
			
		
	
		
		
			
				
					
					    if ( ! d - > StartedScreen )  return  false ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    void  *  screen_addr  =  ( void  * )  d - > owner - > readDWord ( d - > screen_tiles_ptr_offset ) ; 
 
			
		
	
		
		
			
				
					
					    uint8_t *  tiles  =  new  uint8_t [ width * height * 4 /* + 80 + width*height*4*/ ] ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    d - > owner - > read  ( screen_addr ,  ( width * height * 4 /* + 80 + width*height*4*/ ) ,  tiles ) ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    for ( int32_t  iy = 0 ;  iy < height ;  iy + + ) 
 
			
		
	
		
		
			
				
					
					    { 
 
			
		
	
		
		
			
				
					
					        for ( int32_t  ix = 0 ;  ix < width ;  ix + + ) 
 
			
		
	
		
		
			
				
					
					        { 
 
			
		
	
		
		
			
				
					
					            screen [ ix  +  iy * width ] . symbol  =  tiles [ ( iy  +  ix * height ) * 4  + 0 ] ; 
 
			
		
	
		
		
			
				
					
					            screen [ ix  +  iy * width ] . foreground  =  tiles [ ( iy  +  ix * height ) * 4  + 1 ] ; 
 
			
		
	
		
		
			
				
					
					            screen [ ix  +  iy * width ] . background  =  tiles [ ( iy  +  ix * height ) * 4  + 2 ] ; 
 
			
		
	
		
		
			
				
					
					            screen [ ix  +  iy * width ] . bright  =  tiles [ ( iy  +  ix * height ) * 4  + 3 ] ; 
 
			
		
	
		
		
			
				
					
					            //screen[ix + iy*width].gtile = tiles[width*height*4 + 80 + iy + ix*height +0];
 
 
			
		
	
		
		
			
				
					
					            //screen[ix + iy*width].grayscale = tiles[width*height*4 + 80 + iy + ix*height +1];
 
 
			
		
	
		
		
			
				
					
					        } 
 
			
		
	
		
		
			
				
					
					    } 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					    delete  [ ]  tiles ; 
 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					    return  true ; 
    return  true ; 
 
			
		
	
		
		
			
				
					
					} }